![]() |
Routines |
| Prev: 54631 | Up: Map | Next: 54687 |
|
Copies the screen buffer to the screen, and clears the buffer as it goes. The buffer holds the lines of the screen from the bottom up, 32 bytes to a line, so the lines are copied from the bottom of the screen to the top.
|
||||||||
|
Copy each line from the buffer to the display, then clear the buffer.
|
||||||||
| UpdateScreen | 54639 | LD HL,55539 | Point HL at the screen buffer, ScreenBuffer. | |||||
| 54642 | LD DE,22496 | Point DE at the last line of the bitmap of the screen. | ||||||
| 54645 | LD BC,8384 | Set the width to 32 bytes and the number of lines to 192. | ||||||
| UpdateScreen_Line | 54648 | PUSH BC | Stash the counters on the stack. | |||||
| 54649 | PUSH DE | Stash the address of the line on the screen on the stack. | ||||||
| 54650 | PUSH HL | Stash the address of the line in the buffer on the stack. | ||||||
| UpdateScreen_Byte | 54651 | LD A,(HL) | Fetch a byte from the buffer. | |||||
| 54652 | LD (DE),A | Copy it to the screen. | ||||||
| 54653 | LD (HL),0 | Clear the byte in the buffer. | ||||||
| 54655 | INC HL | Move on in the buffer. | ||||||
| 54656 | INC E | Move on in the screen. | ||||||
| 54657 | DJNZ UpdateScreen_Byte | Jump to UpdateScreen_Byte until the line is copied. | ||||||
| 54659 | POP HL | Restore the address of the line in the buffer from the stack. | ||||||
| 54660 | LD BC,32 | Set BC to the length of a line. | ||||||
| 54663 | ADD HL,BC | Move on to the next line in the buffer. | ||||||
| 54664 | POP DE | Restore the address of the line on the screen from the stack. | ||||||
| 54665 | DEC D | Go up one line on the screen. | ||||||
| 54666 | LD A,D | Test whether that has gone into the character row above. | ||||||
| 54667 | CPL | |||||||
| 54668 | AND %00000111 | Keep the bits of the line within the character row. | ||||||
| 54670 | JR NZ,UpdateScreen_Next | Jump to UpdateScreen_Next if it has not. | ||||||
| 54672 | LD A,E | Go up one character row. | ||||||
| 54673 | SUB 32 | |||||||
| 54675 | LD E,A | Store it. | ||||||
| 54676 | JR C,UpdateScreen_Next | Jump to UpdateScreen_Next if that has gone into the third of the screen above. | ||||||
| 54678 | LD A,D | Put the line at the bottom of the character row. | ||||||
| 54679 | ADD A,8 | |||||||
| 54681 | LD D,A | Store it. | ||||||
| UpdateScreen_Next | 54682 | POP BC | Restore the counters from the stack. | |||||
| 54683 | DEC C | Count down the lines. | ||||||
| 54684 | JR NZ,UpdateScreen_Line | Jump to UpdateScreen_Line until all of the lines are copied. | ||||||
| 54686 | RET | Return. | ||||||
| Prev: 54631 | Up: Map | Next: 54687 |