Skip to content

Instantly share code, notes, and snippets.

View jblang's full-sized avatar

J.B. Langston jblang

View GitHub Profile
@jblang
jblang / mandel.asm
Last active March 7, 2024 13:31
Z80 Color Mandelbrot
;
; Compute a Mandelbrot set on a simple Z80 computer.
;
; From https://rosettacode.org/wiki/Mandelbrot_set#Z80_Assembly
; Adapted to CP/M and colorzied by J.B. Langston
; Latest version at https://gist.github.com/jblang/3b17598ccfa0f7e5cca79ad826a399a9
; Assemble with sjasm
;
; Porting this program to another Z80 platform should be easy and straight-
; forward: The only dependencies on my homebrew machine are the system-calls
@jblang
jblang / rc2014.md
Last active January 20, 2024 14:57
RC2014 Links
@jblang
jblang / ROMDump.ino
Created January 4, 2018 04:36
Arduino ROM dump routine
#define bytesPerLine 16
#define dataSize 131072
#define A16 10
#define _CE 11
#define _OE 12
#define _WE 13
void setupPorts() {
// Set disable writing and output, enable chip
digitalWrite(_WE, HIGH);
@jblang
jblang / new_ram.v
Created December 21, 2017 03:06
New block ram
module ram(clk, addr, data_in, data_out, cs, we);
parameter ADDR_WIDTH = 11;
parameter DATA_WIDTH = 8;
parameter INIT_FILE = "";
input clk;
input [ADDR_WIDTH-1:0] addr;
input [DATA_WIDTH-1:0] data_in;
output reg [DATA_WIDTH-1:0] data_out;
@jblang
jblang / test.asm
Created December 21, 2017 02:02
Test code
leds = $D000
dips = $D001
* = $F000
begin lda dips
sta leds
jmp begin
* = $FFFA
@jblang
jblang / ram.v
Last active December 21, 2017 02:10
Block ram
module ram(clk, addr, data_in, data_out, cs, we);
parameter ADDR_WIDTH = 11;
parameter DATA_WIDTH = 8;
parameter INIT_FILE = "";
input clk;
input [ADDR_WIDTH-1:0] addr;
input [DATA_WIDTH-1:0] data_in;
output [DATA_WIDTH-1:0] data_out;
@jblang
jblang / cpu_tb.v
Last active December 21, 2017 02:31
6502 testbench
module cpu_tb;
reg clk;
reg reset;
reg irq;
reg nmi;
reg rdy;
wire [15:0] addr;
wire [7:0] cpu_do;
@jblang
jblang / hello.txt
Last active September 20, 2017 17:10
Running Hello World for PDP-1
C:\Users\jblang\Retro\DEC\PDP1>macro1 -s hello.mac
hello - pass 1
hello - pass 2
C:\Users\jblang\Retro\DEC\PDP1>pdp1
PDP-1 simulator V4.0-0 Beta git commit id: ea898b24
sim> att ptr hello.rim
sim> boot ptr
hello, world
@jblang
jblang / debooze.c
Created September 11, 2017 00:31
Decrunches programs crunched with ByteBoozer 1.1
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/stat.h>
#define MEMSIZ 64*1024
#define GETLOC 0x20
uint16_t get, put;
uint8_t cur, mem[MEMSIZ];
@jblang
jblang / a_mind_is_born.asm
Created September 6, 2017 20:14
A Mind is Born by Linus Akesson
; A Mind is Born by Linus Akesson
; https://linusakesson.net/scene/a-mind-is-born/index.php
; transcribed to 64tass and further commented by J.B. Langston
; important locations after program is copied to zero page
vmptr = $cb ; video matrix
clock = $13 ; global clock lsb - indicates position within bar
clock_msb = $20 ; global clock msb - indicates bar of song
script = $21 ; poke table