Prev: 0FA0 Up: Map Next: 0FF3
0FA9: THE 'EDIT KEY' SUBROUTINE
The address of this routine is derived from an offset found in the editing keys table.
When in 'editing mode' pressing the EDIT key will bring down the 'current BASIC line'. However in 'INPUT mode' the action of the EDIT key is to clear the current reply and allow a fresh one.
ED_EDIT 0FA9 LD HL,($5C49) Fetch the current line number (E-PPC).
0FAC BIT 5,(IY+$37) But jump forward if in 'INPUT mode' (bit 5 of FLAGX set).
0FB0 JP NZ,CLEAR_SP
0FB3 CALL LINE_ADDR Find the address of the start of the current line and hence its number.
0FB6 CALL LINE_NO
0FB9 LD A,D If the line number returned is zero then simply clear the editing area.
0FBA OR E
0FBB JP Z,CLEAR_SP
0FBE PUSH HL Save the address of the line.
0FBF INC HL Move on to collect the length of the line.
0FC0 LD C,(HL)
0FC1 INC HL
0FC2 LD B,(HL)
0FC3 LD HL,$000A Add +0A to the length and test that there is sufficient room for a copy of the line.
0FC6 ADD HL,BC
0FC7 LD B,H
0FC8 LD C,L
0FC9 CALL TEST_ROOM
0FCC CALL CLEAR_SP Now clear the editing area.
0FCF LD HL,($5C51) Fetch the current channel address (CURCHL) and exchange it for the address of the line.
0FD2 EX (SP),HL
0FD3 PUSH HL Save it temporarily.
0FD4 LD A,$FF Open channel 'R' so that the line will be copied to the editing area.
0FD6 CALL CHAN_OPEN
0FD9 POP HL Fetch the address of the line.
0FDA DEC HL Go to before the line.
0FDB DEC (IY+$0F) Decrement the current line number (E-PPC) so as to avoid printing the cursor.
0FDE CALL OUT_LINE Print the BASIC line.
0FE1 INC (IY+$0F) Increment the current line number (E-PPC). Note: the decrementing of the line number does not always stop the cursor from being printed.
0FE4 LD HL,($5C59) Fetch the start of the line in the editing area (E-LINE) and step past the line number and the length to find the address for K-CUR.
0FE7 INC HL
0FE8 INC HL
0FE9 INC HL
0FEA INC HL
0FEB LD ($5C5B),HL
0FEE POP HL Fetch the former channel address and set the appropriate flags before returning to ED_LOOP.
0FEF CALL CHAN_FLAG
0FF2 RET
Prev: 0FA0 Up: Map Next: 0FF3