Prev: 05732 Up: Map Next: 05790
05775: 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 05775 DEFB 0,0 Line number zero.
LINE_NO_A 05777 EX DE,HL Consider the other pointer.
05778 LD DE,5775 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 05781 LD A,(HL) Fetch the high byte and test it.
05782 AND 192
05784 JR NZ,LINE_NO_A Jump if not suitable.
05786 LD D,(HL) Fetch the high byte and low byte and return.
05787 INC HL
05788 LD E,(HL)
05789 RET
Prev: 05732 Up: Map Next: 05790