Routines
| Prev: C306 | Up: Map | Next: C37D |
C316: Scroll the text up a line, printing the line that goes if printing is on
|
Moves screen rows 1-17 up to rows 0-16, eight pixel lines at a time: all 32 bytes of each line in full-width mode, only the left 16 when a picture is showing (C128 set). In full-width mode the colours of rows 1-17 move up too, and before anything moves the top row goes to the ZX Printer (C3E4) if printing is on. Then row 17 is cleared with 36 (or 18) spaces. Called by the character printer at C2DF on every newline.
How it works:
1. At full width, send the top row to the printer (C3E4) if printing is on.
2. Move text rows 1 to 17 up to rows 0 to 16, eight pixel lines each, 32 bytes a line (16 beside a picture).
3. Clear the bottom text row.
|
||||||||||||||
| C316 | LD A,($C128) | Read "Flag: text lines are narrow (a picture is showing)" (C128) into A - Full width: send the top row to the printer first | ||||||||||||
| C319 | AND A | Test A for zero (this leaves A as it was and clears carry) | ||||||||||||
| C31A | CALL Z,$C3E4 | If A is zero, call the routine "Send the screen's top character row to the ZX..." (C3E4) | ||||||||||||
| C31D | PUSH BC | Save BC on the stack | ||||||||||||
| C31E | PUSH HL | Save HL on the stack | ||||||||||||
| C31F | PUSH DE | Save DE on the stack | ||||||||||||
| C320 | LD HL,$4020 | Load HL with $4020 - From row 1 to row 0, 17 rows | ||||||||||||
| C323 | LD DE,$4000 | Load DE with $4000 | ||||||||||||
| C326 | LD BC,$0011 | Load BC with $0011 | ||||||||||||
| C329 | LD A,($C128) | Read "Flag: text lines are narrow (a picture is showing)" (C128) into A - 32 bytes a line, or 16 beside a picture | ||||||||||||
| C32C | AND A | Test A for zero (this leaves A as it was and clears carry) | ||||||||||||
| C32D | LD A,$20 | Load A with $20 | ||||||||||||
| C32F | JR Z,$C333 | If A is zero, skip ahead to C333 | ||||||||||||
| C331 | LD A,$10 | Load A with $10 | ||||||||||||
| C333 | PUSH HL | Save HL on the stack | ||||||||||||
| C334 | PUSH DE | Save DE on the stack | ||||||||||||
| C335 | PUSH BC | Save BC on the stack | ||||||||||||
| C336 | LD C,$08 | Load C with $08 - Eight pixel lines | ||||||||||||
| C338 | PUSH HL | Save HL on the stack | ||||||||||||
| C339 | PUSH DE | Save DE on the stack | ||||||||||||
| C33A | PUSH BC | Save BC on the stack | ||||||||||||
| C33B | LD C,A | Copy A into C - Move one pixel line of the row | ||||||||||||
| C33C | LDIR | Copy BC bytes from where HL points to where DE points, counting up | ||||||||||||
| C33E | POP BC | Restore BC from the stack | ||||||||||||
| C33F | POP DE | Restore DE from the stack | ||||||||||||
| C340 | POP HL | Restore HL from the stack | ||||||||||||
| C341 | INC H | Add one to H - Next pixel line | ||||||||||||
| C342 | INC D | Add one to D | ||||||||||||
| C343 | DEC C | Subtract one from C | ||||||||||||
| C344 | JR NZ,$C338 | If C is not zero, go back to C338 | ||||||||||||
| C346 | POP BC | Restore BC from the stack | ||||||||||||
| C347 | POP DE | Restore DE from the stack | ||||||||||||
| C348 | POP HL | Restore HL from the stack | ||||||||||||
| C349 | PUSH AF | Save AF on the stack - Both pointers on a character row | ||||||||||||
| C34A | CALL $C37D | Call the routine "Swap DE and HL, then move HL down a character row" (C37D) | ||||||||||||
| C34D | CALL $C37D | Call the routine "Swap DE and HL, then move HL down a character row" (C37D) | ||||||||||||
| C350 | POP AF | Restore AF from the stack | ||||||||||||
| C351 | DEC C | Subtract one from C - Next row | ||||||||||||
| C352 | JR NZ,$C333 | If C is not zero, go back to C333 | ||||||||||||
| C354 | CP $10 | Compare A with $10 - Full width: move the colours of rows 1-17 up too | ||||||||||||
| C356 | JR Z,$C363 | If A equals $10, skip ahead to C363 | ||||||||||||
| C358 | LD HL,$5820 | Load HL with $5820 | ||||||||||||
| C35B | LD DE,$5800 | Load DE with $5800 | ||||||||||||
| C35E | LD BC,$0220 | Load BC with $0220 | ||||||||||||
| C361 | LDIR | Copy BC bytes from where HL points to where DE points, counting up | ||||||||||||
| C363 | LD A,($C128) | Read "Flag: text lines are narrow (a picture is showing)" (C128) into A - Clear row 17: 36 spaces, or 18 | ||||||||||||
| C366 | AND A | Test A for zero (this leaves A as it was and clears carry) | ||||||||||||
| C367 | LD B,$24 | Load B with $24 | ||||||||||||
| C369 | JR Z,$C36D | If A is zero, skip ahead to C36D | ||||||||||||
| C36B | LD B,$12 | Load B with $12 | ||||||||||||
| C36D | LD HL,$5020 | Load HL with $5020 - from pixel shift 2 | ||||||||||||
| C370 | LD C,$02 | Load C with $02 | ||||||||||||
| C372 | LD A,$20 | Load A with $20 | ||||||||||||
| C374 | CALL $C388 | Call the routine "PLOT-CHAR: draw one character glyph at HL, shifted by..." (C388) | ||||||||||||
| C377 | DJNZ $C374 | Count B down and, while it is not zero, go back to C374 | ||||||||||||
| C379 | POP DE | Restore DE from the stack | ||||||||||||
| C37A | POP HL | Restore HL from the stack | ||||||||||||
| C37B | POP BC | Restore BC from the stack | ||||||||||||
| C37C | RET | Return to the caller | ||||||||||||
| Prev: C306 | Up: Map | Next: C37D |