Prev: AD8A Up: Map Next: AE20
AD9E: evaluate expression
Used by the routines at A928, A9A5, AAA0, AD8A, AE86, AFA7, B1B2 and E257.
AD9E A6 7A LDX $7A get BASIC execute pointer low byte
ADA0 D0 02 BNE $ADA4 skip next if not zero
ADA2 C6 7B DEC $7B else decrement BASIC execute pointer high byte
ADA4 C6 7A DEC $7A decrement BASIC execute pointer low byte
ADA6 A2 00 LDX #$00 set null precedence, flag done
ADA8 .BYTE $24 makes next line BIT $48
This entry point is used by the routine at AE20.
ADA9 48 PHA push compare evaluation byte if branch to here
ADAA 8A TXA copy precedence byte
ADAB 48 PHA push precedence byte
ADAC A9 01 LDA #$01 2 bytes
ADAE 20 FB A3 JSR $A3FB check room on stack for A*2 bytes
ADB1 20 83 AE JSR $AE83 get value from line
ADB4 A9 00 LDA #$00 clear A
ADB6 85 4D STA $4D clear comparrison evaluation flag
This entry point is used by the routine at B63D.
ADB8 20 79 00 JSR $0079 scan memory
ADBB 38 SEC set carry for subtract
ADBC E9 B1 SBC #$B1 subtract the token for ">"
ADBE 90 17 BCC $ADD7 branch if < ">"
ADC0 C9 03 CMP #$03 compare with ">" to +3
ADC2 B0 13 BCS $ADD7 branch if >= 3
was token for ">" "=" or "<"
ADC4 C9 01 CMP #$01 compare with token for =
ADC6 2A ROL A *2, b0 = carry (=1 if token was = or <)
ADC7 49 01 EOR #%00000001 toggle b0
ADC9 45 4D EOR $4D EOR with comparison evaluation flag
ADCB C5 4D CMP $4D compare with comparison evaluation flag
ADCD 90 61 BCC $AE30 if < saved flag do syntax error then warm start
ADCF 85 4D STA $4D save new comparison evaluation flag
ADD1 20 73 00 JSR $0073 increment and scan memory
ADD4 4C BB AD JMP $ADBB go do next character
ADD7 A6 4D LDX $4D get comparison evaluation flag
ADD9 D0 2C BNE $AE07 branch if compare function
ADDB B0 7B BCS $AE58 go do functions
else was < TK_GT so is operator or lower
ADDD 69 07 ADC #$07 add # of operators (+, -, *, /, ^, AND or OR)
ADDF 90 77 BCC $AE58 branch if < + operator
carry was set so token was +, -, *, /, ^, AND or OR
ADE1 65 0D ADC $0D add data type flag, $FF = string, $00 = numeric
ADE3 D0 03 BNE $ADE8 branch if not string or not + token
will only be $00 if type is string and token was +
ADE5 4C 3D B6 JMP $B63D add strings, string 1 is in the descriptor, string 2 is in line, and return
ADE8 69 FF ADC #$FF -1 (corrects for carry add)
ADEA 85 22 STA $22 save it
ADEC 0A ASL A *2
ADED 65 22 ADC $22 *3
ADEF A8 TAY copy to index
ADF0 68 PLA pull previous precedence
ADF1 D9 80 A0 CMP $A080,Y compare with precedence byte
ADF4 B0 67 BCS $AE5D branch if A >=
ADF6 20 8D AD JSR $AD8D check if source is numeric, else do type mismatch
ADF9 48 PHA save precedence
This entry point is used by the routine at AE86.
ADFA 20 20 AE JSR $AE20 get vector, execute function then continue evaluation
ADFD 68 PLA restore precedence
ADFE A4 4B LDY $4B get precedence stacked flag
AE00 10 17 BPL $AE19 branch if stacked values
AE02 AA TAX copy precedence, set flags
AE03 F0 56 BEQ $AE5B exit if done
AE05 D0 5F BNE $AE66 else pop FAC2 and return, branch always
AE07 46 0D LSR $0D clear data type flag, $FF = string, $00 = numeric
AE09 8A TXA copy compare function flag
AE0A 2A ROL A <<1, shift data type flag into b0, 1 = string, 0 = num
AE0B A6 7A LDX $7A get BASIC execute pointer low byte
AE0D D0 02 BNE $AE11 branch if no underflow
AE0F C6 7B DEC $7B else decrement BASIC execute pointer high byte
AE11 C6 7A DEC $7A decrement BASIC execute pointer low byte
AE13 A0 1B LDY #$1B set offset to = operator precedence entry
AE15 85 4D STA $4D save new comparison evaluation flag
AE17 D0 D7 BNE $ADF0 branch always
AE19 D9 80 A0 CMP $A080,Y compare with stacked function precedence
AE1C B0 48 BCS $AE66 if A >=, pop FAC2 and return
AE1E 90 D9 BCC $ADF9 else go stack this one and continue, branch always
Prev: AD8A Up: Map Next: AE20