Prev: 1CEE Up: Map Next: 1D03
1CF0: THE 'IF' COMMAND ROUTINE
The address of this routine is found in the parameter table.
On entry the value of the expression between the IF and the THEN is the 'last value' on the calculator stack. If this is logically true then the next statement is considered; otherwise the line is considered to have been finished.
Input
Output
IF_CMD 1CF0 POP BC Drop the return address - STMT_RET.
1CF1 CALL SYNTAX_Z Jump forward if checking syntax.
1CF4 JR Z,IF_1
Now use the calculator to 'delete' the last value on the calculator stack but leave the DE register pair addressing the first byte of the value.
1CF6 RST $28 Use the calculator.
1CF7 DEFB $02 delete
1CF8 DEFB $38 end_calc
1CF9 EX DE,HL Make HL point to the first byte and call TEST_ZERO.
1CFA CALL TEST_ZERO
1CFD JP C,LINE_END If the value was 'FALSE' jump to the next line.
IF_1 1D00 JP STMT_L_1 But if 'TRUE' jump to the next statement (after the THEN).
Prev: 1CEE Up: Map Next: 1D03