1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-25 05:28:06 +11:00

recipes/rc2014/zasm: use BASIC shell

Also made Makefile actually portable.
This commit is contained in:
Virgil Dupras 2019-12-11 13:01:51 -05:00
parent 880775ae69
commit 20151a97f8
11 changed files with 74 additions and 62 deletions

View File

@ -10,7 +10,6 @@
; *** Requirements ***
; blkGetB
; parseArgs
;
; *** Includes ***
@ -20,5 +19,9 @@
jp at28wMain
.inc "core.asm"
.inc "lib/util.asm"
.inc "lib/parse.asm"
.inc "lib/args.asm"
.inc "at28w/main.asm"
USER_RAMSTART:

View File

@ -1,3 +1,6 @@
; *** Requirements ***
; lib/parse
;
; *** Consts ***
; maximum number of bytes to receive as args in all commands. Determines the
; size of the args variable.

View File

@ -1,5 +1,6 @@
; *** Requirements ***
; stdioPutC
; divide
;
; Same as fmtDecimal, but DE is considered a signed number

View File

@ -1,3 +1,5 @@
; *** Requirements ***
; lib/util
; *** Code ***
; Parse the hex char at A and extract it's 0-15 numerical value. Put the result

View File

@ -8,12 +8,14 @@
;
; *** Requirements ***
; printstr
; printHexPair
; stdioPutC
;
; *** Includes ***
.inc "user.h"
jp memtMain
.inc "lib/ari.asm"
.inc "lib/fmt.asm"
.inc "memt/main.asm"
USER_RAMSTART:

View File

@ -14,7 +14,7 @@
; sdcPutB
; sdcGetB
; printstr
; printHexPair
; stdioPutC
;
; *** Includes ***
@ -23,5 +23,7 @@
jp sdctMain
.inc "lib/ari.asm"
.inc "lib/fmt.asm"
.inc "sdct/main.asm"
USER_RAMSTART:

View File

@ -1,4 +1,6 @@
CFSTARGETS = $(addprefix cfsin/, zasm sdct memt at28w user.h)
SHELLAPPS = zasm sdct memt at28w
APPTARGETS = ${SHELLAPPS:%=cfsin/%}
CFSTARGETS = $(APPTARGETS) cfsin/user.h
BASE = ../../..
TOOLS = $(BASE)/tools
ZASM = $(TOOLS)/zasm.sh
@ -18,17 +20,8 @@ $(CFSPACK):
sdcard.cfs: $(CFSTARGETS) $(CFSPACK)
$(CFSPACK) cfsin > $@
cfsin/zasm: $(ZASMBIN)
$(ZASM) $(KERNEL) $(APPS) user.h < $(APPS)/zasm/glue.asm > $@
cfsin/sdct: $(ZASMBIN)
$(ZASM) $(APPS) user.h < $(APPS)/sdct/glue.asm > $@
cfsin/memt: $(ZASMBIN)
$(ZASM) $(APPS) user.h < $(APPS)/memt/glue.asm > $@
cfsin/at28w: $(ZASMBIN)
$(ZASM) $(APPS) $(KERNEL) user.h < $(APPS)/at28w/glue.asm > $@
$(APPTARGETS): $(ZASMBIN)
$(ZASM) $(KERNEL) $(APPS) user.h < $(APPS)/${@:cfsin/%=%}/glue.asm > $@
cfsin/user.h: user.h
cp $< $@

View File

@ -1,5 +1,4 @@
.inc "user.h"
.org USER_CODE
ld hl, sAwesome
call printstr

View File

@ -1,11 +1,11 @@
; 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, because of SDC, is a bit high and bring us almost to 0x8500
; We allocate at least 0x200 bytes for the stack, which is why we have this
; Kernel RAMEND last check: 0x98f3
; We allocate at least 0x100 bytes for the stack, which is why we have this
; threshold.
.equ RAMEND 0x8700
.equ PGM_CODEADDR RAMEND
.equ RAMEND 0x9a00
.equ USER_CODE RAMEND ; in sync with user.h
.equ ACIA_CTL 0x80 ; Control and status. RS off.
.equ ACIA_IO 0x81 ; Transmit. RS on.
@ -15,30 +15,25 @@
jp strncmp
jp upcase
jp findchar
jp parseHex
jp parseHexPair
jp blkSel
jp blkSet
jp fsFindFN
jp fsOpen
jp fsGetB
jp parseArgs
jp printstr
jp _blkGetB
jp _blkPutB
jp _blkSeek
jp _blkTell
jp printHexPair ; approaching 0x38...
jp sdcGetB
jp sdcPutB
jp blkGetB
jp stdioPutC
; interrupt hook
.fill 0x38-$
jp aciaInt
; *** Jump Table (cont.) ***
jp sdcGetB
jp sdcPutB
jp blkGetB
.inc "err.h"
.inc "ascii.h"
.inc "blkdev.h"
@ -69,25 +64,32 @@ jp aciaInt
.equ FS_HANDLE_COUNT 2
.inc "fs.asm"
; *** Shell ***
; *** BASIC ***
; RAM space used in different routines for short term processing.
.equ SCRATCHPAD_SIZE 0x20
.equ SCRATCHPAD FS_RAMEND
.inc "lib/util.asm"
.inc "lib/ari.asm"
.inc "lib/parse.asm"
.inc "lib/args.asm"
.inc "lib/stdio.asm"
.equ SHELL_RAMSTART FS_RAMEND
.equ SHELL_EXTRA_CMD_COUNT 11
.inc "shell/main.asm"
.dw sdcInitializeCmd, sdcFlushCmd
.dw blkBselCmd, blkSeekCmd, blkLoadCmd, blkSaveCmd
.dw fsOnCmd, flsCmd, fnewCmd, fdelCmd, fopnCmd
.inc "lib/fmt.asm"
.equ EXPR_PARSE parseLiteralOrVar
.inc "lib/expr.asm"
.inc "basic/util.asm"
.inc "basic/parse.asm"
.inc "basic/tok.asm"
.equ VAR_RAMSTART SCRATCHPAD+SCRATCHPAD_SIZE
.inc "basic/var.asm"
.equ BUF_RAMSTART VAR_RAMEND
.inc "basic/buf.asm"
.inc "basic/blk.asm"
.inc "basic/sdc.asm"
.equ BFS_RAMSTART BUF_RAMEND
.inc "basic/fs.asm"
.equ BAS_RAMSTART BFS_RAMEND
.inc "basic/main.asm"
.inc "shell/fs.asm"
.inc "shell/blkdev.asm"
.equ PGM_RAMSTART SHELL_RAMEND
.inc "shell/pgm.asm"
.equ SDC_RAMSTART PGM_RAMEND
.equ SDC_RAMSTART BAS_RAMEND
.equ SDC_PORT_CSHIGH 6
.equ SDC_PORT_CSLOW 5
.equ SDC_PORT_SPI 4
@ -97,22 +99,32 @@ jp aciaInt
init:
di
; setup stack
ld hl, RAMEND
ld sp, hl
ld sp, RAMEND
im 1
call aciaInit
call fsInit
call shellInit
ld hl, pgmShellHook
ld (SHELL_CMDHOOK), hl
call basInit
ld hl, basFindCmdExtra
ld (BAS_FINDHOOK), hl
xor a
ld de, BLOCKDEV_SEL
call blkSel
ei
jp shellLoop
jp basStart
basFindCmdExtra:
ld hl, basFSCmds
call basFindCmd
ret z
ld hl, basBLKCmds
call basFindCmd
ret z
ld hl, basSDCCmds
call basFindCmd
ret z
jp basPgmHook
; *** blkdev 1: file handle 0 ***

View File

@ -1,25 +1,20 @@
.org 0x8700
.org 0x9a00
; *** JUMP TABLE ***
.equ strncmp 0x03
.equ upcase @+3
.equ findchar @+3
.equ parseHex @+3
.equ parseHexPair @+3
.equ blkSel @+3
.equ blkSet @+3
.equ fsFindFN @+3
.equ fsOpen @+3
.equ fsGetB @+3
.equ parseArgs @+3
.equ printstr @+3
.equ _blkGetB @+3
.equ _blkPutB @+3
.equ _blkSeek @+3
.equ _blkTell @+3
.equ printHexPair @+3
; now at 0x36
.equ sdcGetB 0x3b
.equ sdcGetB @+3
.equ sdcPutB @+3
.equ blkGetB @+3
.equ stdioPutC @+3

View File

@ -5,7 +5,7 @@ APPS = ../../apps
ZASMBIN = zasm/zasm
ZASMSH = ../zasm.sh
SHELLAPPS = zasm ed
SHELLTGTS = ${SHELLAPPS:S/^/cfsin\//}
SHELLTGTS = ${SHELLAPPS:%=cfsin/%}
CFSIN_CONTENTS = $(SHELLTGTS) cfsin/user.h
OBJS = emul.o libz80/libz80.o
@ -55,7 +55,7 @@ $(CFSPACK):
# -o in sync with USER_CODE in shell/user.h
$(SHELLTGTS): $(ZASMBIN)
$(ZASMSH) -o 42 $(KERNEL) $(APPS) shell/user.h < $(APPS)/${@:T}/glue.asm > $@
$(ZASMSH) -o 42 $(KERNEL) $(APPS) shell/user.h < $(APPS)/${@:cfsin/%=%}/glue.asm > $@
cfsin/user.h: shell/user.h
cp shell/user.h $@