1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-25 05:18:06 +11:00

parseExpr --> parseExprDE: easy ones

Those replacements were trivially equivalent. For the other ones, an
examination of the context is necessary.
This commit is contained in:
Virgil Dupras 2019-12-23 15:59:55 -05:00
parent a034f63e23
commit cc754e12aa
5 changed files with 11 additions and 18 deletions

View File

@ -222,9 +222,8 @@ basPRINT:
call rdWord
push hl ; --> lvl 1
ex de, hl
call parseExpr
call parseExprDE
jr nz, .parseError
push ix \ pop de
ld hl, SCRATCHPAD
call fmtDecimalS
call printstr
@ -252,9 +251,8 @@ basGOTO:
ld de, SCRATCHPAD
call rdWord
ex de, hl
call parseExpr
call parseExprDE
ret nz
push ix \ pop de
call bufFind
jr nz, .notFound
push ix \ pop de
@ -316,8 +314,8 @@ basINPUT:
call spitQuoted
call rdSep
call stdioReadLine
call parseExpr
ld (VAR_TBL), ix
call parseExprDE
ld (VAR_TBL), de
call printcrlf
cp a ; ensure Z
ret

View File

@ -40,9 +40,8 @@ parseTruth:
ret
.simple:
call parseExpr
call parseExprDE
jr nz, .end
push ix \ pop de
ld a, d
or e
jr .success
@ -136,8 +135,7 @@ parseTruth:
ret nz
push ix ; --> lvl 1. save (HL) value in stack.
ex de, hl
call parseExpr
call parseExprDE
ret nz
push ix \ pop de
pop hl ; <-- lvl 1. restore.
ret

View File

@ -52,10 +52,9 @@ varTryAssign:
call rdWord
ex de, hl
; Now, evaluate that expression now in (HL)
call parseExpr ; --> number in IX
call parseExprDE ; --> number in DE
jr nz, .exprErr
pop af ; <-- lvl 4
push ix \ pop de ; send number to DE
call varAssign
xor a ; ensure Z
.end:

View File

@ -657,19 +657,18 @@ _readk7:
push hl
push de
push ix
call parseExpr
call parseExprDE
jr nz, .end
; If we're in first pass, stop now. The value of HL doesn't matter and
; truncation checks might falsely fail.
call zasmIsFirstPass
jr z, .end
; IX contains an absolute value. Turn this into a -64/+63 relative
; DE contains an absolute value. Turn this into a -64/+63 relative
; value by subtracting PC from it. However, before we do that, let's
; add 0x7f to it, which we'll remove later. This will simplify bounds
; checks. (we use 7f instead of 3f because we deal in bytes here, not
; in words)
push ix \ pop hl
ld de, 0x7f
ld hl, 0x7f
add hl, de ; Carry cleared
ex de, hl
call zasmGetPC ; --> HL

View File

@ -146,10 +146,9 @@ handleEQU:
call readWord
jr nz, .badfmt
ld hl, scratchpad
call parseExpr
call parseExprDE
jr nz, .badarg
ld hl, DIREC_SCRATCHPAD
push ix \ pop de
; Save value in "@" special variable
ld (DIREC_LASTVAL), de
call symRegisterConst ; A and Z set