diff --git a/recipes/rc2014/zasm/.gitignore b/recipes/rc2014/zasm/.gitignore index 6ce9766..b0ae3fe 100644 --- a/recipes/rc2014/zasm/.gitignore +++ b/recipes/rc2014/zasm/.gitignore @@ -1 +1,2 @@ /cfsin/zasm +/cfsin/user.h diff --git a/recipes/rc2014/zasm/README.md b/recipes/rc2014/zasm/README.md index 9ed35e8..8b22717 100644 --- a/recipes/rc2014/zasm/README.md +++ b/recipes/rc2014/zasm/README.md @@ -51,12 +51,11 @@ Compiling and running `hello.asm` is done very much like in > sdci > fson > fopn 0 hello.asm - > zasm 2 1 - > mptr 8600 - > bsel 1 - > seek 00 0000 - > load ff - > call 00 0000 + > fnew 1 dest + > fopn 1 dest + > zasm 1 2 + > dest Assembled from a RC2014 + > That RC2014 is starting to feel powerful now, right? diff --git a/recipes/rc2014/zasm/cfsin/user.h b/recipes/rc2014/zasm/cfsin/user.h deleted file mode 100644 index 539eacb..0000000 --- a/recipes/rc2014/zasm/cfsin/user.h +++ /dev/null @@ -1,30 +0,0 @@ -.equ USER_CODE 0x8600 -.equ USER_RAMSTART USER_CODE+0x1800 -.equ FS_HANDLE_SIZE 6 -.equ BLOCKDEV_SIZE 8 - -; *** JUMP TABLE *** -.equ strncmp 0x03 -.equ addDE 0x06 -.equ addHL 0x09 -.equ upcase 0x0c -.equ unsetZ 0x0f -.equ intoDE 0x12 -.equ intoHL 0x15 -.equ writeHLinDE 0x18 -.equ findchar 0x1b -.equ parseHex 0x1e -.equ parseHexPair 0x21 -.equ blkSel 0x24 -.equ blkSet 0x27 -.equ fsFindFN 0x2a -.equ fsOpen 0x2d -.equ fsGetC 0x30 -.equ cpHLDE 0x33 - -.equ parseArgs 0x3e -.equ printstr 0x41 -.equ _blkGetC 0x44 -.equ _blkPutC 0x47 -.equ _blkSeek 0x4a -.equ _blkTell 0x4d diff --git a/recipes/rc2014/zasm/glue.asm b/recipes/rc2014/zasm/glue.asm index 6dad3c3..18cb7fa 100644 --- a/recipes/rc2014/zasm/glue.asm +++ b/recipes/rc2014/zasm/glue.asm @@ -1,9 +1,10 @@ ; 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 .equ RAMSTART 0x8000 -; kernel RAM usage is under 0x300 bytes. We give ourselves at least 0x300 bytes +; kernel RAM usage, because of SDC, is a bit high and bring us almost to 0x9c00 +; We allocate at least 0x100 bytes for RAM, which is why we have this threshold. ; for the stack. -.equ RAMEND 0x8600 +.equ RAMEND 0x9d00 .equ PGM_CODEADDR RAMEND .equ ACIA_CTL 0x80 ; Control and status. RS off. .equ ACIA_IO 0x81 ; Transmit. RS on. @@ -47,12 +48,13 @@ jp aciaInt .equ ACIA_RAMSTART RAMSTART #include "acia.asm" .equ BLOCKDEV_RAMSTART ACIA_RAMEND -.equ BLOCKDEV_COUNT 3 +.equ BLOCKDEV_COUNT 4 #include "blockdev.asm" ; List of devices .dw sdcGetC, sdcPutC -.dw mmapGetC, mmapPutC +.dw blk1GetC, blk1PutC .dw blk2GetC, blk2PutC +.dw mmapGetC, mmapPutC .equ MMAP_START 0xe000 @@ -62,7 +64,7 @@ jp aciaInt #include "stdio.asm" .equ FS_RAMSTART STDIO_RAMEND -.equ FS_HANDLE_COUNT 1 +.equ FS_HANDLE_COUNT 2 #include "fs.asm" .equ SHELL_RAMSTART FS_RAMEND @@ -107,12 +109,22 @@ init: ei jp shellLoop -; *** blkdev 2: file handle 0 *** +; *** blkdev 1: file handle 0 *** -blk2GetC: +blk1GetC: ld ix, FS_HANDLES jp fsGetC -blk2PutC: +blk1PutC: ld ix, FS_HANDLES jp fsPutC + +; *** blkdev 2: file handle 1 *** + +blk2GetC: + ld ix, FS_HANDLES+FS_HANDLE_SIZE + jp fsGetC + +blk2PutC: + ld ix, FS_HANDLES+FS_HANDLE_SIZE + jp fsPutC diff --git a/recipes/rc2014/zasm/user.h b/recipes/rc2014/zasm/user.h index 539eacb..e55b387 100644 --- a/recipes/rc2014/zasm/user.h +++ b/recipes/rc2014/zasm/user.h @@ -1,4 +1,4 @@ -.equ USER_CODE 0x8600 +.equ USER_CODE 0x9d00 .equ USER_RAMSTART USER_CODE+0x1800 .equ FS_HANDLE_SIZE 6 .equ BLOCKDEV_SIZE 8 @@ -22,9 +22,9 @@ .equ fsGetC 0x30 .equ cpHLDE 0x33 -.equ parseArgs 0x3e -.equ printstr 0x41 -.equ _blkGetC 0x44 -.equ _blkPutC 0x47 -.equ _blkSeek 0x4a -.equ _blkTell 0x4d +.equ parseArgs 0x3b +.equ printstr 0x3e +.equ _blkGetC 0x41 +.equ _blkPutC 0x44 +.equ _blkSeek 0x47 +.equ _blkTell 0x4a