zasm: don't use lib/args
This unit is being removed.
This commit is contained in:
parent
d0f031939f
commit
346bcc3d3d
@ -5,6 +5,31 @@ isWS:
|
|||||||
cp 0x09
|
cp 0x09
|
||||||
ret
|
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
|
; Copy string from (HL) in (DE), that is, copy bytes until a null char is
|
||||||
; encountered. The null char is also copied.
|
; encountered. The null char is also copied.
|
||||||
; HL and DE point to the char right after the null char.
|
; HL and DE point to the char right after the null char.
|
||||||
|
@ -68,7 +68,6 @@ jp zasmMain
|
|||||||
.inc "lib/util.asm"
|
.inc "lib/util.asm"
|
||||||
.inc "lib/ari.asm"
|
.inc "lib/ari.asm"
|
||||||
.inc "lib/parse.asm"
|
.inc "lib/parse.asm"
|
||||||
.inc "lib/args.asm"
|
|
||||||
.inc "zasm/util.asm"
|
.inc "zasm/util.asm"
|
||||||
.equ IO_RAMSTART USER_RAMSTART
|
.equ IO_RAMSTART USER_RAMSTART
|
||||||
.inc "zasm/io.asm"
|
.inc "zasm/io.asm"
|
||||||
|
@ -25,7 +25,6 @@ jp zasmMain
|
|||||||
.inc "lib/util.asm"
|
.inc "lib/util.asm"
|
||||||
.inc "lib/ari.asm"
|
.inc "lib/ari.asm"
|
||||||
.inc "lib/parse.asm"
|
.inc "lib/parse.asm"
|
||||||
.inc "lib/args.asm"
|
|
||||||
.inc "zasm/util.asm"
|
.inc "zasm/util.asm"
|
||||||
.equ IO_RAMSTART USER_RAMSTART
|
.equ IO_RAMSTART USER_RAMSTART
|
||||||
.inc "zasm/io.asm"
|
.inc "zasm/io.asm"
|
||||||
|
@ -23,34 +23,32 @@
|
|||||||
; HL is set to the last lineno to be read.
|
; 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_*)
|
; Sets Z on success, unset on error. On error, A contains an error code (ERR_*)
|
||||||
zasmMain:
|
zasmMain:
|
||||||
; Parse args. HL points to string already
|
; Parse args in (HL)
|
||||||
; We don't allocate memory just to hold this. Because this happens
|
; blkdev in
|
||||||
; before initialization, we don't really care where those args are
|
call parseHexPair ; --> A
|
||||||
; parsed. That's why we borrow zasm's RAMSTART for a little while.
|
jr c, .badargs
|
||||||
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
|
|
||||||
ld de, IO_IN_BLK
|
ld de, IO_IN_BLK
|
||||||
call blkSel
|
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
|
ld de, IO_OUT_BLK
|
||||||
call blkSel
|
call blkSel
|
||||||
|
inc hl ; char following last hex char
|
||||||
|
|
||||||
; Init .org
|
; .org high byte
|
||||||
; This is the 3rd argument, optional, will be zero if not given.
|
call rdWS
|
||||||
|
jr nz, .skipOrgSet ; no org argument
|
||||||
|
call parseHexPair ; --> A
|
||||||
|
jr c, .badargs
|
||||||
|
|
||||||
|
.skipOrgSet:
|
||||||
|
; Init .org with value of E
|
||||||
; Save in "@" too
|
; Save in "@" too
|
||||||
ld a, (ZASM_RAMSTART+2)
|
|
||||||
ld (ZASM_ORG+1), a ; high byte of .org
|
ld (ZASM_ORG+1), a ; high byte of .org
|
||||||
ld (DIREC_LASTVAL+1), a
|
ld (DIREC_LASTVAL+1), a
|
||||||
xor a
|
xor a
|
||||||
@ -82,8 +80,11 @@ zasmMain:
|
|||||||
.end:
|
.end:
|
||||||
jp ioLineNo ; --> HL, --> DE, returns
|
jp ioLineNo ; --> HL, --> DE, returns
|
||||||
|
|
||||||
.argspecs:
|
.badargs:
|
||||||
.db 0b001, 0b001, 0b101
|
; bad args
|
||||||
|
ld a, SHELL_ERR_BAD_ARGS
|
||||||
|
ret
|
||||||
|
|
||||||
.sFirstPass:
|
.sFirstPass:
|
||||||
.db "First pass", 0
|
.db "First pass", 0
|
||||||
.sSecondPass:
|
.sSecondPass:
|
||||||
|
Loading…
Reference in New Issue
Block a user