From ed19c6afc1a98426747aafaad79d792919cdd72e Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Mon, 20 May 2019 11:00:14 -0400 Subject: [PATCH] Use zasm in recipes --- recipes/rc2014/Makefile | 4 ++-- recipes/rc2014/README.md | 7 +++---- recipes/rc2014/glue.asm | 20 ++++++++++---------- recipes/rc2014/sdcard/Makefile | 4 ++-- recipes/rc2014/sdcard/glue.asm | 20 ++++++++++---------- recipes/rc2014/sdcard/jumptable.inc | 11 ----------- recipes/rc2014/sdcard/sdinit.asm | 20 +++++++++++++++----- 7 files changed, 42 insertions(+), 44 deletions(-) delete mode 100644 recipes/rc2014/sdcard/jumptable.inc diff --git a/recipes/rc2014/Makefile b/recipes/rc2014/Makefile index 5c3ff71..c51b706 100644 --- a/recipes/rc2014/Makefile +++ b/recipes/rc2014/Makefile @@ -1,7 +1,7 @@ TARGET = os.bin -PARTS = ../../parts/z80 +ZASM = ../../tools/emul/zasm/zasm .PHONY: all all: $(TARGET) $(TARGET): glue.asm - scas -o $@ -L map -I $(PARTS) $< + $(ZASM) < $< > $@ diff --git a/recipes/rc2014/README.md b/recipes/rc2014/README.md index 032cd9a..d5ddbee 100644 --- a/recipes/rc2014/README.md +++ b/recipes/rc2014/README.md @@ -38,8 +38,7 @@ device I use in this recipe. ### Gathering parts -* Collapse OS parts in `/path/to/parts` -* [scas][scas] +* [zasm][zasm] * [romwrite][romwrite] and its specified dependencies * [GNU screen][screen] * A FTDI-to-TTL cable to connect to the Serial I/O module of the RC2014 @@ -75,7 +74,7 @@ is decoupled from the ACIA and can get its IO from anything. See We only have the shell to build, so it's rather straightforward: - scas -I /path/to/parts -o rom.bin glue.asm + zasm < glue.asm > rom.bin ### Write to the ROM @@ -104,5 +103,5 @@ TODO [rc2014]: https://rc2014.co.uk [romwrite]: https://github.com/hsoft/romwrite -[scas]: https://github.com/KnightOS/scas +[zasm]: ../../tools/emul [screen]: https://www.gnu.org/software/screen/ diff --git a/recipes/rc2014/glue.asm b/recipes/rc2014/glue.asm index a1b8e19..77fba48 100644 --- a/recipes/rc2014/glue.asm +++ b/recipes/rc2014/glue.asm @@ -1,9 +1,9 @@ ; classic RC2014 setup (8K ROM + 32K RAM) and a stock Serial I/O module ; The RAM module is selected on A15, so it has the range 0x8000-0xffff -RAMSTART .equ 0x8000 -RAMEND .equ 0xffff -ACIA_CTL .equ 0x80 ; Control and status. RS off. -ACIA_IO .equ 0x81 ; Transmit. RS on. +.equ RAMSTART 0x8000 +.equ RAMEND 0xffff +.equ ACIA_CTL 0x80 ; Control and status. RS off. +.equ ACIA_IO 0x81 ; Transmit. RS on. jp init @@ -13,20 +13,20 @@ jp aciaInt #include "core.asm" #include "parse.asm" -ACIA_RAMSTART .equ RAMSTART +.equ ACIA_RAMSTART RAMSTART #include "acia.asm" -BLOCKDEV_RAMSTART .equ ACIA_RAMEND -BLOCKDEV_COUNT .equ 1 +.equ BLOCKDEV_RAMSTART ACIA_RAMEND +.equ BLOCKDEV_COUNT 1 #include "blockdev.asm" ; List of devices .dw aciaGetC, aciaPutC, 0, 0 -STDIO_RAMSTART .equ BLOCKDEV_RAMEND +.equ STDIO_RAMSTART BLOCKDEV_RAMEND #include "stdio.asm" -SHELL_RAMSTART .equ STDIO_RAMEND -SHELL_EXTRA_CMD_COUNT .equ 0 +.equ SHELL_RAMSTART STDIO_RAMEND +.equ SHELL_EXTRA_CMD_COUNT 0 #include "shell.asm" init: diff --git a/recipes/rc2014/sdcard/Makefile b/recipes/rc2014/sdcard/Makefile index ffb5c81..ba9ef5c 100644 --- a/recipes/rc2014/sdcard/Makefile +++ b/recipes/rc2014/sdcard/Makefile @@ -1,9 +1,9 @@ TARGETS = os.bin sdinit.bin -PARTS = ../../../parts/z80 +ZASM = ../../../tools/emul/zasm/zasm .PHONY: all all: $(TARGETS) os.bin: glue.asm sdinit.bin: sdinit.asm $(TARGETS): - scas -o $@ -L map -I $(PARTS) $< + $(ZASM) < $< > $@ diff --git a/recipes/rc2014/sdcard/glue.asm b/recipes/rc2014/sdcard/glue.asm index b9856f1..58e7b11 100644 --- a/recipes/rc2014/sdcard/glue.asm +++ b/recipes/rc2014/sdcard/glue.asm @@ -1,9 +1,9 @@ ; classic RC2014 setup (8K ROM + 32K RAM) and a stock Serial I/O module ; The RAM module is selected on A15, so it has the range 0x8000-0xffff -RAMSTART .equ 0x8000 -RAMEND .equ 0xffff -ACIA_CTL .equ 0x80 ; Control and status. RS off. -ACIA_IO .equ 0x81 ; Transmit. RS on. +.equ RAMSTART 0x8000 +.equ RAMEND 0xffff +.equ ACIA_CTL 0x80 ; Control and status. RS off. +.equ ACIA_IO 0x81 ; Transmit. RS on. jp init @@ -26,10 +26,10 @@ jp aciaInt #include "core.asm" #include "parse.asm" -ACIA_RAMSTART .equ RAMSTART +.equ ACIA_RAMSTART RAMSTART #include "acia.asm" -BLOCKDEV_RAMSTART .equ ACIA_RAMEND -BLOCKDEV_COUNT .equ 2 +.equ BLOCKDEV_RAMSTART ACIA_RAMEND +.equ BLOCKDEV_COUNT 2 #include "blockdev.asm" ; List of devices .dw aciaGetC, aciaPutC, 0, 0 @@ -37,11 +37,11 @@ BLOCKDEV_COUNT .equ 2 #include "blockdev_cmds.asm" -STDIO_RAMSTART .equ BLOCKDEV_RAMEND +.equ STDIO_RAMSTART BLOCKDEV_RAMEND #include "stdio.asm" -SHELL_RAMSTART .equ STDIO_RAMEND -SHELL_EXTRA_CMD_COUNT .equ 3 +.equ SHELL_RAMSTART STDIO_RAMEND +.equ SHELL_EXTRA_CMD_COUNT 3 #include "shell.asm" .dw sdcInitializeCmd, blkBselCmd, blkSeekCmd diff --git a/recipes/rc2014/sdcard/jumptable.inc b/recipes/rc2014/sdcard/jumptable.inc deleted file mode 100644 index 36de374..0000000 --- a/recipes/rc2014/sdcard/jumptable.inc +++ /dev/null @@ -1,11 +0,0 @@ -JUMP_PRINTSTR .equ 0x03 -JUMP_PRINTHEX .equ 0x06 -JUMP_SDCINITALIZE .equ 0x09 -JUMP_SDCSENDRECV .equ 0x0c -JUMP_SDCWAITRESP .equ 0x0f -JUMP_SDCCMD .equ 0x12 -JUMP_SDCCMDR1 .equ 0x15 -JUMP_SDCCMDR7 .equ 0x18 -JUMP_SDCREAD .equ 0x1b -JUMP_SDCSETBLKSIZE .equ 0x1e - diff --git a/recipes/rc2014/sdcard/sdinit.asm b/recipes/rc2014/sdcard/sdinit.asm index 6c6bec0..4fd8945 100644 --- a/recipes/rc2014/sdcard/sdinit.asm +++ b/recipes/rc2014/sdcard/sdinit.asm @@ -1,16 +1,25 @@ -#include "jumptable.inc" +.equ JUMP_PRINTSTR 0x03 +.equ JUMP_PRINTHEX 0x06 +.equ JUMP_SDCINITALIZE 0x09 +.equ JUMP_SDCSENDRECV 0x0c +.equ JUMP_SDCWAITRESP 0x0f +.equ JUMP_SDCCMD 0x12 +.equ JUMP_SDCCMDR1 0x15 +.equ JUMP_SDCCMDR7 0x18 +.equ JUMP_SDCREAD 0x1b +.equ JUMP_SDCSETBLKSIZE 0x1e .org 0x9000 call JUMP_SDCINITALIZE or a - jp nz, .error + jp nz, error ld hl, sOk call JUMP_PRINTSTR call JUMP_SDCSETBLKSIZE or a - jp nz, .error + jp nz, error ld hl, sOk call JUMP_PRINTSTR @@ -19,7 +28,7 @@ xor a call JUMP_SDCREAD or a - jp nz, .error + jp nz, error push hl ld hl, sOk @@ -30,7 +39,8 @@ call JUMP_PRINTSTR ret -.error: + +error: call JUMP_PRINTHEX ld hl, sErr call JUMP_PRINTSTR