![]() |
Routines |
Prev: 03137 | Up: Map |
This subroutine is called whenever there might be the need to scroll the display. This occurs on three occasions:
|
||||||||||
PO_SCR | 03157 | BIT 1,(IY+1) | Return immediately if the printer is being used (bit 1 of FLAGS set). | |||||||
03161 | RET NZ | |||||||||
03162 | LD DE,3545 | Pre-load the machine stack with the address of CL_SET. | ||||||||
03165 | PUSH DE | |||||||||
03166 | LD A,B | Transfer the line number. | ||||||||
03167 | BIT 0,(IY+2) | Jump forward if considering 'INPUT ... AT ...' (bit 0 of TV-FLAG set). | ||||||||
03171 | JP NZ,PO_SCR_4 | |||||||||
03174 | CP (IY+49) | Return, via CL_SET, if the line number is greater than the value of DF-SZ; give report 5 if it is less; otherwise continue. | ||||||||
03177 | JR C,REPORT_5 | |||||||||
03179 | RET NZ | |||||||||
03180 | BIT 4,(IY+2) | Jump forward unless dealing with an 'automatic listing' (bit 4 of TV-FLAG set). | ||||||||
03184 | JR Z,PO_SCR_2 | |||||||||
03186 | LD E,(IY+45) | Fetch the line counter from BREG. | ||||||||
03189 | DEC E | Decrease this counter. | ||||||||
03190 | JR Z,PO_SCR_3 | Jump forward if the listing is to be scrolled. | ||||||||
03192 | LD A,0 | Otherwise open channel 'K', restore the stack pointer, flag that the automatic listing has finished (reset bit 4 of TV-FLAG) and return via CL_SET. | ||||||||
03194 | CALL CHAN_OPEN | |||||||||
03197 | LD SP,(23615) | |||||||||
03201 | RES 4,(IY+2) | |||||||||
03205 | RET | |||||||||
This entry point is used by the routine at PO_TV_2.
Report 5 - Out of screen.
|
||||||||||
REPORT_5 | 03206 | RST 8 | Call the error handling routine. | |||||||
03207 | DEFB 4 | |||||||||
Now consider if the prompt 'scroll?' is required.
|
||||||||||
PO_SCR_2 | 03208 | DEC (IY+82) | Decrease the scroll counter (SCR-CT) and proceed to give the prompt only if it becomes zero. | |||||||
03211 | JR NZ,PO_SCR_3 | |||||||||
Proceed to give the prompt message.
|
||||||||||
03213 | LD A,24 | The scroll counter (SCR-CT) is reset. | ||||||||
03215 | SUB B | |||||||||
03216 | LD (23692),A | |||||||||
03219 | LD HL,(23695) | The current values of ATTR-T and MASK-T are saved. | ||||||||
03222 | PUSH HL | |||||||||
03223 | LD A,(23697) | The current value of P-FLAG is saved. | ||||||||
03226 | PUSH AF | |||||||||
03227 | LD A,253 | Channel 'K' is opened. | ||||||||
03229 | CALL CHAN_OPEN | |||||||||
03232 | XOR A | The message 'scroll?' is message '0'. This message is now printed. | ||||||||
03233 | LD DE,3320 | |||||||||
03236 | CALL PO_MSG | |||||||||
03239 | SET 5,(IY+2) | Signal 'clear the lower screen after a keystroke' (set bit 5 of TV-FLAG). | ||||||||
03243 | LD HL,23611 | This is FLAGS. | ||||||||
03246 | SET 3,(HL) | Signal 'L mode'. | ||||||||
03248 | RES 5,(HL) | Signal 'no key yet'. | ||||||||
03250 | EXX | Note: DE should be pushed also. | ||||||||
03251 | CALL WAIT_KEY | Fetch a single key code. | ||||||||
03254 | EXX | Restore the registers. | ||||||||
03255 | CP " " | There is a jump forward to REPORT_D - 'BREAK - CONT repeats' - if the keystroke was 'BREAK', 'STOP', 'N' or 'n'; otherwise accept the keystroke as indicating the need to scroll the display. | ||||||||
03257 | JR Z,REPORT_D | |||||||||
03259 | CP 226 | |||||||||
03261 | JR Z,REPORT_D | |||||||||
03263 | OR 32 | |||||||||
03265 | CP "n" | |||||||||
03267 | JR Z,REPORT_D | |||||||||
03269 | LD A,254 | Open channel 'S'. | ||||||||
03271 | CALL CHAN_OPEN | |||||||||
03274 | POP AF | Restore the value of P-FLAG. | ||||||||
03275 | LD (23697),A | |||||||||
03278 | POP HL | Restore the values of ATTR-T and MASK-T. | ||||||||
03279 | LD (23695),HL | |||||||||
The display is now scrolled.
|
||||||||||
PO_SCR_3 | 03282 | CALL CL_SC_ALL | The whole display is scrolled. | |||||||
03285 | LD B,(IY+49) | The line (DF-SZ) and column numbers for the start of the line above the lower part of the display are found and saved. | ||||||||
03288 | INC B | |||||||||
03289 | LD C,33 | |||||||||
03291 | PUSH BC | |||||||||
03292 | CALL CL_ADDR | The corresponding attribute byte for this character area is then found. The HL register pair holds the address of the byte. | ||||||||
03295 | LD A,H | |||||||||
03296 | RRCA | |||||||||
03297 | RRCA | |||||||||
03298 | RRCA | |||||||||
03299 | AND 3 | |||||||||
03301 | OR 88 | |||||||||
03303 | LD H,A | |||||||||
The line in question will have 'lower part' attribute values and the new line at the bottom of the display may have 'ATTR-P' values so the attribute values are exchanged.
|
||||||||||
03304 | LD DE,23264 | DE points to the first attribute byte of the bottom line. | ||||||||
03307 | LD A,(DE) | The value is fetched. | ||||||||
03308 | LD C,(HL) | The 'lower part' value. | ||||||||
03309 | LD B,32 | There are thirty two bytes. | ||||||||
03311 | EX DE,HL | Exchange the pointers. | ||||||||
PO_SCR_3A | 03312 | LD (DE),A | Make the first exchange and then proceed to use the same values for the thirty two attribute bytes of the two lines being handled. | |||||||
03313 | LD (HL),C | |||||||||
03314 | INC DE | |||||||||
03315 | INC HL | |||||||||
03316 | DJNZ PO_SCR_3A | |||||||||
03318 | POP BC | The line and column numbers of the bottom line of the 'upper part' are fetched before returning. | ||||||||
03319 | RET | |||||||||
The 'scroll?' message.
|
||||||||||
SCROLL | 03320 | DEFB 128 | Initial marker - stepped over. | |||||||
03321 | DEFM "scroll" | |||||||||
03327 | DEFM "?"+128 | The '?' is inverted. | ||||||||
Report D - BREAK - CONT repeats.
|
||||||||||
REPORT_D | 03328 | RST 8 | Call the error handling routine. | |||||||
03329 | DEFB 12 | |||||||||
The lower part of the display is handled as follows:
|
||||||||||
PO_SCR_4 | 03330 | CP 2 | The 'out of screen' error is given if the lower part is going to be 'too large' (see DF-SZ) and a return made if scrolling is unnecessary. | |||||||
03332 | JR C,REPORT_5 | |||||||||
03334 | ADD A,(IY+49) | |||||||||
03337 | SUB 25 | |||||||||
03339 | RET NC | |||||||||
03340 | NEG | The A register will now hold 'the number of scrolls to be made'. | ||||||||
03342 | PUSH BC | The line and column numbers are now saved. | ||||||||
03343 | LD B,A | The 'scroll number', ATTR-T, MASK-T and P-FLAG are all saved. | ||||||||
03344 | LD HL,(23695) | |||||||||
03347 | PUSH HL | |||||||||
03348 | LD HL,(23697) | |||||||||
03351 | PUSH HL | |||||||||
03352 | CALL TEMPS | The 'permanent' colour items are to be used. | ||||||||
03355 | LD A,B | The 'scroll number' is fetched. | ||||||||
The lower part of the screen is now scrolled A number of times.
|
||||||||||
PO_SCR_4A | 03356 | PUSH AF | Save the 'number'. | |||||||
03357 | LD HL,23659 | This is DF-SZ. | ||||||||
03360 | LD B,(HL) | The value in DF-SZ is incremented; the B register set to hold the former value and the A register the new value. | ||||||||
03361 | LD A,B | |||||||||
03362 | INC A | |||||||||
03363 | LD (HL),A | |||||||||
03364 | LD HL,23689 | This is S-POSN-hi. | ||||||||
03367 | CP (HL) | The jump is taken if only the lower part of the display is to be scrolled (B=old DF-SZ). | ||||||||
03368 | JR C,PO_SCR_4B | |||||||||
03370 | INC (HL) | Otherwise S-POSN-hi is incremented and the whole display scrolled (B=24). | ||||||||
03371 | LD B,24 | |||||||||
PO_SCR_4B | 03373 | CALL CL_SCROLL | Scroll B lines. | |||||||
03376 | POP AF | Fetch and decrement the 'scroll number'. | ||||||||
03377 | DEC A | |||||||||
03378 | JR NZ,PO_SCR_4A | Jump back until finished. | ||||||||
03380 | POP HL | Restore the value of P-FLAG. | ||||||||
03381 | LD (IY+87),L | |||||||||
03384 | POP HL | Restore the values of ATTR-T and MASK-T. | ||||||||
03385 | LD (23695),HL | |||||||||
03388 | LD BC,(23688) | In case S-POSN has been changed CL_SET is called to give a matching value to DF-CC (after resetting bit 0 of TV-FLAG). | ||||||||
03392 | RES 0,(IY+2) | |||||||||
03396 | CALL CL_SET | |||||||||
03399 | SET 0,(IY+2) | Set bit 0 of TV-FLAG to indicate that the lower screen is being handled, fetch the line and column numbers, and then return. | ||||||||
03403 | POP BC | |||||||||
03404 | RET |
Prev: 03137 | Up: Map |