Skip to content

Instantly share code, notes, and snippets.

View jblang's full-sized avatar

J.B. Langston jblang

View GitHub Profile
@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 / 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 / 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 / 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 / rc2014.md
Last active January 20, 2024 14:57
RC2014 Links
@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 / apa102.asm
Last active February 23, 2018 00:07
Z80 APA102 LED control via AY2149 GPIO port
; Control APA102 LEDs attached to the YM2149 sound chip's
; IO port A on pins 0 (data) and 1 (clock) by bit banging a shift register
; Yes, I have turned my RC2014 into the world's most Rube Goldbergesque Arduino
ymaddr equ 0d8h ; address port on YM2149
ymdata equ 0d0h ; data port on YM2149
mixer equ 7h ; mixer/IO control register
iodira equ 40h ; port A direction bit
@jblang
jblang / disz80.asm
Created May 14, 2018 01:04
John Kerr's DIS-Z80 with Comments
SECTION code_clib
PUBLIC disz80
PUBLIC _disz80
EXTERN fputc_cons
; This code is been found in a ZX Spectrum tool called UTILITY3 v1.3
@jblang
jblang / a2apple30th.asm
Last active January 18, 2023 02:46
Apple 30th Anniversary
; Apple 30th Anniversary Tribute for Apple II by Dave Schmenk
; Original at https://www.applefritter.com/node/24600#comment-60100
; Disassembled, Commented, and ported to Apple II by J.B. Langston
; Assemble with `64tass -b -o a2apple30th.bin -L a2apple30th.lst`
KEYBD = $C000 ; keyboard register
STROBE = $C010 ; keyboard strobe register
PTR = $06 ; pointer to current image
* = $0C00