Spectrum ROM | Routines |
Prev: 02665 | Up: Map |
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.
|
|||||||
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 | ||||||
02675 | 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 | 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. | ||||
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. | ||||
02698 | CALL PO_CHANGE | ||||||
02701 | LD HL,(23566) | Fetch the control code and the first operand 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. +00 to +1F becomes +1F to +00. | |||||
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 +21 to +02. | |||||
02722 | LD C,A | ||||||
02723 | BIT 1,(IY+1) | Jump forward if handling the printer. | |||||
02727 | JR NZ,PO_AT_SET | ||||||
02729 | LD A,22 | Reverse the line number, i.e. +00 to +15 becomes +16 to +01. | |||||
02731 | SUB B | ||||||
PO_AT_ERR | 02732 | JP C,REPORT_B_2 | If appropriate jump forward. | ||||
02735 | INC A | The range +16 to +01 becomes +17 to +02. | |||||
02736 | LD B,A | ||||||
02737 | INC B | And now +18 to +03. | |||||
02738 | BIT 0,(IY+2) | If printing in the lower part of the screen then consider whether scrolling is needed. | |||||
02742 | JP NZ,PO_SCR | ||||||
02745 | CP (IY+49) | Give report 5 - Out of screen, if required. | |||||
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'. | |||||
PO_SPACE | 02768 | LD A," " | Print D number of spaces. | ||||
02770 | CALL PO_SAVE | ||||||
02773 | DEC D | ||||||
02774 | JR NZ,PO_SPACE | ||||||
02776 | RET | Now finished. |
Prev: 02665 | Up: Map |