1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-25 17:08:07 +11:00

recipes/rc2014/zasm: zasm can now assemble *and* write to file

This commit is contained in:
Virgil Dupras 2019-06-07 19:53:50 -04:00
parent 495d69c1cb
commit 9bb2194fb0
5 changed files with 33 additions and 51 deletions

View File

@ -1 +1,2 @@
/cfsin/zasm /cfsin/zasm
/cfsin/user.h

View File

@ -51,12 +51,11 @@ Compiling and running `hello.asm` is done very much like in
> sdci > sdci
> fson > fson
> fopn 0 hello.asm > fopn 0 hello.asm
> zasm 2 1 > fnew 1 dest
> mptr 8600 > fopn 1 dest
> bsel 1 > zasm 1 2
> seek 00 0000 > dest
> load ff
> call 00 0000
Assembled from a RC2014 Assembled from a RC2014
>
That RC2014 is starting to feel powerful now, right? That RC2014 is starting to feel powerful now, right?

View File

@ -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

View File

@ -1,9 +1,10 @@
; classic RC2014 setup (8K ROM + 32K RAM) and a stock Serial I/O module ; 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 ; The RAM module is selected on A15, so it has the range 0x8000-0xffff
.equ RAMSTART 0x8000 .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. ; for the stack.
.equ RAMEND 0x8600 .equ RAMEND 0x9d00
.equ PGM_CODEADDR RAMEND .equ PGM_CODEADDR RAMEND
.equ ACIA_CTL 0x80 ; Control and status. RS off. .equ ACIA_CTL 0x80 ; Control and status. RS off.
.equ ACIA_IO 0x81 ; Transmit. RS on. .equ ACIA_IO 0x81 ; Transmit. RS on.
@ -47,12 +48,13 @@ jp aciaInt
.equ ACIA_RAMSTART RAMSTART .equ ACIA_RAMSTART RAMSTART
#include "acia.asm" #include "acia.asm"
.equ BLOCKDEV_RAMSTART ACIA_RAMEND .equ BLOCKDEV_RAMSTART ACIA_RAMEND
.equ BLOCKDEV_COUNT 3 .equ BLOCKDEV_COUNT 4
#include "blockdev.asm" #include "blockdev.asm"
; List of devices ; List of devices
.dw sdcGetC, sdcPutC .dw sdcGetC, sdcPutC
.dw mmapGetC, mmapPutC .dw blk1GetC, blk1PutC
.dw blk2GetC, blk2PutC .dw blk2GetC, blk2PutC
.dw mmapGetC, mmapPutC
.equ MMAP_START 0xe000 .equ MMAP_START 0xe000
@ -62,7 +64,7 @@ jp aciaInt
#include "stdio.asm" #include "stdio.asm"
.equ FS_RAMSTART STDIO_RAMEND .equ FS_RAMSTART STDIO_RAMEND
.equ FS_HANDLE_COUNT 1 .equ FS_HANDLE_COUNT 2
#include "fs.asm" #include "fs.asm"
.equ SHELL_RAMSTART FS_RAMEND .equ SHELL_RAMSTART FS_RAMEND
@ -107,12 +109,22 @@ init:
ei ei
jp shellLoop jp shellLoop
; *** blkdev 2: file handle 0 *** ; *** blkdev 1: file handle 0 ***
blk2GetC: blk1GetC:
ld ix, FS_HANDLES ld ix, FS_HANDLES
jp fsGetC jp fsGetC
blk2PutC: blk1PutC:
ld ix, FS_HANDLES ld ix, FS_HANDLES
jp fsPutC 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

View File

@ -1,4 +1,4 @@
.equ USER_CODE 0x8600 .equ USER_CODE 0x9d00
.equ USER_RAMSTART USER_CODE+0x1800 .equ USER_RAMSTART USER_CODE+0x1800
.equ FS_HANDLE_SIZE 6 .equ FS_HANDLE_SIZE 6
.equ BLOCKDEV_SIZE 8 .equ BLOCKDEV_SIZE 8
@ -22,9 +22,9 @@
.equ fsGetC 0x30 .equ fsGetC 0x30
.equ cpHLDE 0x33 .equ cpHLDE 0x33
.equ parseArgs 0x3e .equ parseArgs 0x3b
.equ printstr 0x41 .equ printstr 0x3e
.equ _blkGetC 0x44 .equ _blkGetC 0x41
.equ _blkPutC 0x47 .equ _blkPutC 0x44
.equ _blkSeek 0x4a .equ _blkSeek 0x47
.equ _blkTell 0x4d .equ _blkTell 0x4a