zasm: tighten directive detection a bit

This commit is contained in:
Virgil Dupras 2019-10-06 14:39:47 -04:00
parent f4b6c7637d
commit e4732d79dc
2 changed files with 16 additions and 10 deletions

View File

@ -17,16 +17,16 @@
.equ DIREC_RAMEND DIREC_SCRATCHPAD+SCRATCHPAD_SIZE .equ DIREC_RAMEND DIREC_SCRATCHPAD+SCRATCHPAD_SIZE
; *** CODE *** ; *** CODE ***
; 4 bytes per row, fill with zero ; 3 bytes per row, fill with zero
directiveNames: directiveNames:
.db ".DB", 0 .db "DB", 0
.db ".DW", 0 .db "DW", 0
.db ".EQU" .db "EQU"
.db ".ORG" .db "ORG"
.db ".FIL" .db "FIL"
.db ".OUT" .db "OUT"
.db ".INC" .db "INC"
.db ".BIN" .db "BIN"
; This is a list of handlers corresponding to indexes in directiveNames ; This is a list of handlers corresponding to indexes in directiveNames
directiveHandlers: directiveHandlers:
@ -296,14 +296,20 @@ handleBIN:
; Reads string in (HL) and returns the corresponding ID (D_*) in A. Sets Z if ; Reads string in (HL) and returns the corresponding ID (D_*) in A. Sets Z if
; there's a match. ; there's a match.
getDirectiveID: getDirectiveID:
ld a, (hl)
cp '.'
ret nz
push hl
push bc push bc
push de push de
inc hl
ld b, D_BIN+1 ; D_BIN is last ld b, D_BIN+1 ; D_BIN is last
ld c, 4 ld c, 3
ld de, directiveNames ld de, directiveNames
call findStringInList call findStringInList
pop de pop de
pop bc pop bc
pop hl
ret ret
; Parse directive specified in A (D_* const) with args in I/O and act in ; Parse directive specified in A (D_* const) with args in I/O and act in

Binary file not shown.