Browse Source

zasm: don't use lib/args

This unit is being removed.
pull/85/head
Virgil Dupras 4 years ago
parent
commit
346bcc3d3d
4 changed files with 50 additions and 26 deletions
  1. +25
    -0
      apps/lib/util.asm
  2. +0
    -1
      apps/zasm/glue.asm
  3. +0
    -1
      apps/zasm/gluea.asm
  4. +25
    -24
      apps/zasm/main.asm

+ 25
- 0
apps/lib/util.asm 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.


+ 0
- 1
apps/zasm/glue.asm 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"


+ 0
- 1
apps/zasm/gluea.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"


+ 25
- 24
apps/zasm/main.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:


Loading…
Cancel
Save