mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-24 01:58:06 +11:00
zasm: try for regular number or symbol before parsing expr
Previously, we would mess up literals like '-'.
This commit is contained in:
parent
723497af69
commit
bccf933ea9
@ -2,6 +2,11 @@
|
|||||||
; We expect (HL) to be disposable: we mutate it to avoid having to make a copy.
|
; We expect (HL) to be disposable: we mutate it to avoid having to make a copy.
|
||||||
; Sets Z on success, unset on error.
|
; Sets Z on success, unset on error.
|
||||||
parseExpr:
|
parseExpr:
|
||||||
|
; Before we evaluate an expression, we first try for a regular number or
|
||||||
|
; symbol. We do this because parsing expressions can mess up some values
|
||||||
|
; with its splitting logic. For example '-' is going to end up '\0'.
|
||||||
|
call parseNumberOrSymbol
|
||||||
|
ret z
|
||||||
push de
|
push de
|
||||||
push hl
|
push hl
|
||||||
call _parseExpr
|
call _parseExpr
|
||||||
@ -19,7 +24,7 @@ _parseExpr:
|
|||||||
ld a, '*'
|
ld a, '*'
|
||||||
call _findAndSplit
|
call _findAndSplit
|
||||||
jp z, _applyMult
|
jp z, _applyMult
|
||||||
jp parseNumberOrSymbol
|
ret ; failure
|
||||||
|
|
||||||
; Given a string in (HL) and a separator char in A, return a splitted string,
|
; Given a string in (HL) and a separator char in A, return a splitted string,
|
||||||
; that is, the same (HL) string but with the found A char replaced by a null
|
; that is, the same (HL) string but with the found A char replaced by a null
|
||||||
|
@ -24,3 +24,4 @@ label2: .dw 0x42
|
|||||||
rl d
|
rl d
|
||||||
rr e
|
rr e
|
||||||
rlc c
|
rlc c
|
||||||
|
cp '-'
|
||||||
|
Loading…
Reference in New Issue
Block a user