Prev: 07558 Up: Map Next: 07642
07595: THE 'NEXT' COMMAND ROUTINE
The address of this routine is found in the parameter table.
The 'variable in assignment' has already been determined (see CLASS_04), and it remains to change the VALUE as required.
NEXT 07595 BIT 1,(IY+55) Jump to give the error report if the variable was not found (bit 1 of FLAGX set).
07599 JP NZ,REPORT_2
07602 LD HL,(23629) The address of the variable is fetched from DEST and the name tested further.
07605 BIT 7,(HL)
07607 JR Z,REPORT_1
Next the variable's VALUE (v) and STEP (s) are manipulated by the calculator.
07609 INC HL Step past the name.
07610 LD (23656),HL Make the variable a temporary 'memory area' by setting MEM.
07613 RST 40 -
07614 DEFB 224 get_mem_0: v
07615 DEFB 226 get_mem_2: v, s
07616 DEFB 15 addition: v+s
07617 DEFB 192 st_mem_0: v+s (v is replaced by v+s in mem-0)
07618 DEFB 2 delete: -
07619 DEFB 56 end_calc: -
The result of adding the VALUE and the STEP is now tested against the LIMIT by calling NEXT_LOOP.
07620 CALL NEXT_LOOP Test the new VALUE against the LIMIT.
07623 RET C Return now if the FOR-NEXT loop has been completed.
Otherwise collect the 'looping' line number and statement.
07624 LD HL,(23656) Find the address of the low byte of the looping line number (MEM+15).
07627 LD DE,15
07630 ADD HL,DE
07631 LD E,(HL) Now fetch this line number.
07632 INC HL
07633 LD D,(HL)
07634 INC HL
07635 LD H,(HL) Followed by the statement number.
07636 EX DE,HL Exchange the numbers before jumping forward to treat them as the destination line of a GO TO command.
07637 JP GO_TO_2
Report 1 - NEXT without FOR.
REPORT_1 07640 RST 8 Call the error handling routine.
07641 DEFB 0
Prev: 07558 Up: Map Next: 07642