1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-25 17:58:07 +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 call rdWord
push hl ; --> lvl 1 push hl ; --> lvl 1
ex de, hl ex de, hl
call parseExpr call parseExprDE
jr nz, .parseError jr nz, .parseError
push ix \ pop de
ld hl, SCRATCHPAD ld hl, SCRATCHPAD
call fmtDecimalS call fmtDecimalS
call printstr call printstr
@ -252,9 +251,8 @@ basGOTO:
ld de, SCRATCHPAD ld de, SCRATCHPAD
call rdWord call rdWord
ex de, hl ex de, hl
call parseExpr call parseExprDE
ret nz ret nz
push ix \ pop de
call bufFind call bufFind
jr nz, .notFound jr nz, .notFound
push ix \ pop de push ix \ pop de
@ -316,8 +314,8 @@ basINPUT:
call spitQuoted call spitQuoted
call rdSep call rdSep
call stdioReadLine call stdioReadLine
call parseExpr call parseExprDE
ld (VAR_TBL), ix ld (VAR_TBL), de
call printcrlf call printcrlf
cp a ; ensure Z cp a ; ensure Z
ret ret

View File

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

View File

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

View File

@ -657,19 +657,18 @@ _readk7:
push hl push hl
push de push de
push ix push ix
call parseExpr call parseExprDE
jr nz, .end jr nz, .end
; If we're in first pass, stop now. The value of HL doesn't matter and ; If we're in first pass, stop now. The value of HL doesn't matter and
; truncation checks might falsely fail. ; truncation checks might falsely fail.
call zasmIsFirstPass call zasmIsFirstPass
jr z, .end 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 ; 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 ; 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 ; checks. (we use 7f instead of 3f because we deal in bytes here, not
; in words) ; in words)
push ix \ pop hl ld hl, 0x7f
ld de, 0x7f
add hl, de ; Carry cleared add hl, de ; Carry cleared
ex de, hl ex de, hl
call zasmGetPC ; --> HL call zasmGetPC ; --> HL

View File

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