Prev: 02665 Up: Map Next: 02777
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.
A Control character code (16 to 23)
PO_TV_2 02669 LD DE,2695 Save the first operand in TVDATA-hi and change the address of the 'output' routine to PO_CONT.
02672 LD (23567),A
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 02677 LD DE,2669 The character code will be saved in TVDATA-lo and the address of the 'output' routine changed to PO_TV_2.
02680 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 02682 LD DE,2695 The 'output' routine is to be changed to PO_CONT.
PO_TV_1 02685 LD (23566),A Save the control character code in TVDATA-hi.
The current 'output' routine address is changed temporarily.
PO_CHANGE 02688 LD HL,(23633) HL will point to the 'output' routine address (CURCHL).
02691 LD (HL),E Enter the new 'output' routine address and thereby force the next character code to be considered as an operand.
02692 INC HL
02693 LD (HL),D
02694 RET
Once the operands have been collected the routine continues.
PO_CONT 02695 LD DE,2548 Restore the original address for PRINT_OUT.
02701 LD HL,(23566) Fetch the control code and the first operand from TVDATA if there are indeed two operands.
02704 LD D,A The 'last' operand and the control code are moved.
02705 LD A,L
02706 CP 22 Jump forward if handling INK to OVER.
02708 JP C,CO_TEMP_5
02711 JR NZ,PO_TAB Jump forward if handling TAB.
Now deal with the AT control character.
02713 LD B,H The line number.
02714 LD C,D The column number.
02715 LD A,31 Reverse the column number, i.e. 0 to 31 becomes 31 to 0.
02717 SUB C
02718 JR C,PO_AT_ERR Must be in range.
02720 ADD A,2 Add in the offset to give C holding 33 to 2.
02722 LD C,A
02723 BIT 1,(IY+1) Jump forward if handling the printer (bit 1 of FLAGS set).
02729 LD A,22 Reverse the line number, i.e. 0 to 21 becomes 22 to 1.
02731 SUB B
PO_AT_ERR 02732 JP C,REPORT_B_2 If appropriate jump forward.
02735 INC A The range 22 to 1 becomes 23 to 2.
02736 LD B,A
02737 INC B And now 24 to 3.
02738 BIT 0,(IY+2) If printing in the lower part of the screen (bit 0 of TV-FLAG set) then consider whether scrolling is needed.
02742 JP NZ,PO_SCR
02745 CP (IY+49) Give report 5 - Out of screen, if required (DF-SZ>A).
02748 JP C,REPORT_5
PO_AT_SET 02751 JP CL_SET Return via CL_SET and PO_STORE.
And the TAB control character.
PO_TAB 02754 LD A,H Fetch the first operand.
This entry point is used by the routine at PO_COMMA.
PO_FILL 02755 CALL PO_FETCH The current print position.
02758 ADD A,C Add the current column value.
02759 DEC A Find how many spaces, modulo 32, are required and return if the result is zero.
02760 AND 31
02762 RET Z
02763 LD D,A Use D as the counter.
02764 SET 0,(IY+1) Suppress 'leading space' (set bit 0 of FLAGS).
PO_SPACE 02768 LD A," " Print D number of spaces.
02773 DEC D
02776 RET Now finished.
Prev: 02665 Up: Map Next: 02777