@@ -33,7 +33,7 @@ handleDW: | |||||
call toWord | call toWord | ||||
call readWord | call readWord | ||||
ld hl, scratchpad | ld hl, scratchpad | ||||
call parseNumber | |||||
call parseNumberOrSymbol | |||||
ld a, ixl | ld a, ixl | ||||
ld (direcData), a | ld (direcData), a | ||||
ld a, ixh | ld a, ixh | ||||
@@ -115,23 +115,6 @@ parseIXY: | |||||
pop hl | pop hl | ||||
ret | ret | ||||
; Parse string in (HL) and return its numerical value whether its a number | |||||
; literal or a symbol. Returns value in IX. | |||||
; Sets Z if number or symbol is valid, unset otherwise. | |||||
parseNumberOrSymbol: | |||||
call parseNumber | |||||
ret z | |||||
; Not a number. Try symbol | |||||
push de | |||||
call symGetVal | |||||
jr nz, .notfound ; Z already unset | |||||
; Found! value in DE. We need it in IX | |||||
ld ixh, d | |||||
ld ixl, e | |||||
; Z already set | |||||
.notfound: | |||||
pop de | |||||
ret | |||||
; find argspec for string at (HL). Returns matching argspec in A. | ; find argspec for string at (HL). Returns matching argspec in A. | ||||
; Return value 0xff holds a special meaning: arg is not empty, but doesn't match | ; Return value 0xff holds a special meaning: arg is not empty, but doesn't match | ||||
; any argspec (A == 0 means arg is empty). A return value of 0xff means an | ; any argspec (A == 0 means arg is empty). A return value of 0xff means an | ||||
@@ -113,3 +113,21 @@ parseNumber: | |||||
call hasHexPrefix | call hasHexPrefix | ||||
jr z, parseHexadecimal | jr z, parseHexadecimal | ||||
jr parseDecimal | jr parseDecimal | ||||
; Parse string in (HL) and return its numerical value whether its a number | |||||
; literal or a symbol. Returns value in IX. | |||||
; Sets Z if number or symbol is valid, unset otherwise. | |||||
parseNumberOrSymbol: | |||||
call parseNumber | |||||
ret z | |||||
; Not a number. Try symbol | |||||
push de | |||||
call symGetVal | |||||
jr nz, .notfound ; Z already unset | |||||
; Found! value in DE. We need it in IX | |||||
ld ixh, d | |||||
ld ixl, e | |||||
; Z already set | |||||
.notfound: | |||||
pop de | |||||
ret |
@@ -3,6 +3,7 @@ | |||||
label1: | label1: | ||||
inc a ; comment | inc a ; comment | ||||
ld hl, label2 | ld hl, label2 | ||||
.dw label2 | |||||
; comment | ; comment | ||||
.db 42 | .db 42 | ||||
label2: | label2: | ||||