Prev: 1DAB Up: Map Next: 1DEC
1DDA: THE 'NEXT-LOOP' SUBROUTINE
Used by the routines at FOR and NEXT.
This subroutine is used to determine whether the LIMIT (l) has been exceeded by the present VALUE (v). Note has to be taken of the sign of the STEP (s).
The subroutine returns the carry flag set if the LIMIT is exceeded.
NEXT_LOOP 1DDA RST $28 -
1DDB DEFB $E1 get_mem_1: l
1DDC DEFB $E0 get_mem_0: l, v
1DDD DEFB $E2 get_mem_2: l, v, s
1DDE DEFB $36 less_0: l, v,( 1/0)
1DDF DEFB $00 jump_true to NEXT_1: l, v, (1/0)
1DE0 DEFB $02
1DE1 DEFB $01 exchange: v, l
NEXT_1 1DE2 DEFB $03 subtract: v-l or l-v
1DE3 DEFB $37 greater_0: (1/0)
1DE4 DEFB $00 jump_true to NEXT_2: (1/0)
1DE5 DEFB $04
1DE6 DEFB $38 end_calc: -
1DE7 AND A Clear the carry flag and return - loop is possible.
1DE8 RET
However if the loop is impossible the carry flag has to be set.
NEXT_2 1DE9 DEFB $38 end_calc: -
1DEA SCF Set the carry flag and return.
1DEB RET
Prev: 1DAB Up: Map Next: 1DEC