1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-09-28 08:30:55 +10:00

zasm: don't use lib/args

This unit is being removed.
This commit is contained in:
Virgil Dupras 2019-12-29 20:56:13 -05:00
parent d0f031939f
commit 346bcc3d3d
4 changed files with 50 additions and 26 deletions

View File

@ -5,6 +5,31 @@ isWS:
cp 0x09
ret
; Advance HL to next WS.
; Set Z if WS found, unset if end-of-string.
toWS:
ld a, (hl)
call isWS
ret z
or a
jp z, unsetZ
inc hl
jr toWS
; Consume following whitespaces in HL until a non-WS is hit.
; Set Z if non-WS found, unset if end-of-string.
rdWS:
ld a, (hl)
call isWS
jr nz, .ok
or a
jp z, unsetZ
inc hl
jr rdWS
.ok:
cp a ; ensure Z
ret
; Copy string from (HL) in (DE), that is, copy bytes until a null char is
; encountered. The null char is also copied.
; HL and DE point to the char right after the null char.

View File

@ -68,7 +68,6 @@ jp zasmMain
.inc "lib/util.asm"
.inc "lib/ari.asm"
.inc "lib/parse.asm"
.inc "lib/args.asm"
.inc "zasm/util.asm"
.equ IO_RAMSTART USER_RAMSTART
.inc "zasm/io.asm"

View File

@ -25,7 +25,6 @@ jp zasmMain
.inc "lib/util.asm"
.inc "lib/ari.asm"
.inc "lib/parse.asm"
.inc "lib/args.asm"
.inc "zasm/util.asm"
.equ IO_RAMSTART USER_RAMSTART
.inc "zasm/io.asm"

View File

@ -23,34 +23,32 @@
; HL is set to the last lineno to be read.
; Sets Z on success, unset on error. On error, A contains an error code (ERR_*)
zasmMain:
; Parse args. HL points to string already
; We don't allocate memory just to hold this. Because this happens
; before initialization, we don't really care where those args are
; parsed. That's why we borrow zasm's RAMSTART for a little while.
ld de, .argspecs
ld ix, ZASM_RAMSTART
call parseArgs
jr z, .goodargs
; bad args
ld hl, 0
ld de, 0
ld a, SHELL_ERR_BAD_ARGS
ret
.goodargs:
; HL now points to parsed args
; Init I/O
ld a, (ZASM_RAMSTART) ; blkdev in ID
; Parse args in (HL)
; blkdev in
call parseHexPair ; --> A
jr c, .badargs
ld de, IO_IN_BLK
call blkSel
ld a, (ZASM_RAMSTART+1) ; blkdev out ID
inc hl ; char following last hex char
; blkdev in
call rdWS
jr nz, .badargs
call parseHexPair ; --> A
jr c, .badargs
ld de, IO_OUT_BLK
call blkSel
inc hl ; char following last hex char
; Init .org
; This is the 3rd argument, optional, will be zero if not given.
; .org high byte
call rdWS
jr nz, .skipOrgSet ; no org argument
call parseHexPair ; --> A
jr c, .badargs
.skipOrgSet:
; Init .org with value of E
; Save in "@" too
ld a, (ZASM_RAMSTART+2)
ld (ZASM_ORG+1), a ; high byte of .org
ld (DIREC_LASTVAL+1), a
xor a
@ -82,8 +80,11 @@ zasmMain:
.end:
jp ioLineNo ; --> HL, --> DE, returns
.argspecs:
.db 0b001, 0b001, 0b101
.badargs:
; bad args
ld a, SHELL_ERR_BAD_ARGS
ret
.sFirstPass:
.db "First pass", 0
.sSecondPass: