Prev: 0A69 Up: Map Next: 0AD9
0A6D: THE 'CONTROL CHARACTERS WITH OPERANDS' ROUTINE
The control characters from INK to OVER require a single operand whereas the control characters AT and TAB are required to be followed by two operands.
The present routine leads to the control character code being saved in TVDATA-lo, the first operand in TVDATA-hi or the A register if there is only a single operand required, and the second operand in the A register.
Input
A Control character code (+10 to +17)
PO_TV_2 0A6D LD DE,$0A87 Save the first operand in TVDATA-hi and change the address of the 'output' routine to PO_CONT.
0A70 LD ($5C0F),A
0A73 JR PO_CHANGE
The address of this entry point is derived from an offset found in the control character table.
Enter here when handling the characters AT and TAB.
PO_2_OPER 0A75 LD DE,$0A6D The character code will be saved in TVDATA-lo and the address of the 'output' routine changed to PO_TV_2.
0A78 JR PO_TV_1
The address of this entry point is derived from an offset found in the control character table.
Enter here when handling the colour items - INK to OVER.
PO_1_OPER 0A7A LD DE,$0A87 The 'output' routine is to be changed to PO_CONT.
PO_TV_1 0A7D LD ($5C0E),A Save the control character code in TVDATA-hi.
The current 'output' routine address is changed temporarily.
PO_CHANGE 0A80 LD HL,($5C51) HL will point to the 'output' routine address (CURCHL).
0A83 LD (HL),E Enter the new 'output' routine address and thereby force the next character code to be considered as an operand.
0A84 INC HL
0A85 LD (HL),D
0A86 RET
Once the operands have been collected the routine continues.
PO_CONT 0A87 LD DE,$09F4 Restore the original address for PRINT_OUT.
0A8A CALL PO_CHANGE
0A8D LD HL,($5C0E) Fetch the control code and the first operand from TVDATA if there are indeed two operands.
0A90 LD D,A The 'last' operand and the control code are moved.
0A91 LD A,L
0A92 CP $16 Jump forward if handling INK to OVER.
0A94 JP C,CO_TEMP_5
0A97 JR NZ,PO_TAB Jump forward if handling TAB.
Now deal with the AT control character.
0A99 LD B,H The line number.
0A9A LD C,D The column number.
0A9B LD A,$1F Reverse the column number, i.e. +00 to +1F becomes +1F to +00.
0A9D SUB C
0A9E JR C,PO_AT_ERR Must be in range.
0AA0 ADD A,$02 Add in the offset to give C holding +21 to +02.
0AA2 LD C,A
0AA3 BIT 1,(IY+$01) Jump forward if handling the printer (bit 1 of FLAGS set).
0AA7 JR NZ,PO_AT_SET
0AA9 LD A,$16 Reverse the line number, i.e. +00 to +15 becomes +16 to +01.
0AAB SUB B
PO_AT_ERR 0AAC JP C,REPORT_B_2 If appropriate jump forward.
0AAF INC A The range +16 to +01 becomes +17 to +02.
0AB0 LD B,A
0AB1 INC B And now +18 to +03.
0AB2 BIT 0,(IY+$02) If printing in the lower part of the screen (bit 0 of TV-FLAG set) then consider whether scrolling is needed.
0AB6 JP NZ,PO_SCR
0AB9 CP (IY+$31) Give report 5 - Out of screen, if required (DF-SZ>A).
0ABC JP C,REPORT_5
PO_AT_SET 0ABF JP CL_SET Return via CL_SET and PO_STORE.
And the TAB control character.
PO_TAB 0AC2 LD A,H Fetch the first operand.
This entry point is used by the routine at PO_COMMA.
PO_FILL 0AC3 CALL PO_FETCH The current print position.
0AC6 ADD A,C Add the current column value.
0AC7 DEC A Find how many spaces, modulo 32, are required and return if the result is zero.
0AC8 AND $1F
0ACA RET Z
0ACB LD D,A Use D as the counter.
0ACC SET 0,(IY+$01) Suppress 'leading space' (set bit 0 of FLAGS).
PO_SPACE 0AD0 LD A," " Print D number of spaces.
0AD2 CALL PO_SAVE
0AD5 DEC D
0AD6 JR NZ,PO_SPACE
0AD8 RET Now finished.
Prev: 0A69 Up: Map Next: 0AD9