1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-25 17: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 *** ; *** Requirements ***
; blkGetB ; blkGetB
; parseArgs
; ;
; *** Includes *** ; *** Includes ***
@ -20,5 +19,9 @@
jp at28wMain jp at28wMain
.inc "core.asm"
.inc "lib/util.asm"
.inc "lib/parse.asm"
.inc "lib/args.asm"
.inc "at28w/main.asm" .inc "at28w/main.asm"
USER_RAMSTART: USER_RAMSTART:

View File

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

View File

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

View File

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

View File

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

View File

@ -14,7 +14,7 @@
; sdcPutB ; sdcPutB
; sdcGetB ; sdcGetB
; printstr ; printstr
; printHexPair ; stdioPutC
; ;
; *** Includes *** ; *** Includes ***
@ -23,5 +23,7 @@
jp sdctMain jp sdctMain
.inc "lib/ari.asm"
.inc "lib/fmt.asm"
.inc "sdct/main.asm" .inc "sdct/main.asm"
USER_RAMSTART: 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 = ../../.. BASE = ../../..
TOOLS = $(BASE)/tools TOOLS = $(BASE)/tools
ZASM = $(TOOLS)/zasm.sh ZASM = $(TOOLS)/zasm.sh
@ -18,17 +20,8 @@ $(CFSPACK):
sdcard.cfs: $(CFSTARGETS) $(CFSPACK) sdcard.cfs: $(CFSTARGETS) $(CFSPACK)
$(CFSPACK) cfsin > $@ $(CFSPACK) cfsin > $@
cfsin/zasm: $(ZASMBIN) $(APPTARGETS): $(ZASMBIN)
$(ZASM) $(KERNEL) $(APPS) user.h < $(APPS)/zasm/glue.asm > $@ $(ZASM) $(KERNEL) $(APPS) user.h < $(APPS)/${@:cfsin/%=%}/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 > $@
cfsin/user.h: user.h cfsin/user.h: user.h
cp $< $@ cp $< $@

View File

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

View File

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

View File

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

View File

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