Prev: 1664 Up: Map Next: 169E
168F: THE 'COLLECT A LINE NUMBER' SUBROUTINE
On entry the HL register pair points to the location under consideration. If the location holds a value that constitutes a suitable high byte for a line number then the line number is returned in DE. However if this is not so then the location addressed by DE is tried instead; and should this also be unsuccessful line number zero is returned.
Input
HL Address of the first byte of the BASIC line number to test
DE Address of the first byte of the previous BASIC line number
Output
DE The line number, or zero if none was found
LINE_ZERO 168F DEFB $00,$00 Line number zero.
LINE_NO_A 1691 EX DE,HL Consider the other pointer.
1692 LD DE,$168F Use line number zero.
The main entry point is here, and is used by the routines at ED_EDIT, ED_UP and LN_FETCH.
LINE_NO 1695 LD A,(HL) Fetch the high byte and test it.
1696 AND $C0
1698 JR NZ,LINE_NO_A Jump if not suitable.
169A LD D,(HL) Fetch the high byte and low byte and return.
169B INC HL
169C LD E,(HL)
169D RET
Prev: 1664 Up: Map Next: 169E