![]() |
Routines |
| Prev: 45381 | Up: Map | Next: 45470 |
|
Copies the whole buffer to the screen. The buffer is held with its bottom line first, so the copy starts with the bottom line of the screen and works its way up.
|
||||||||
|
Set up the addresses of the buffer and of the bottom line of the screen.
|
||||||||
| UpdateScreen | 45432 | LD HL,55439 | Point HL at the start of the buffer, ScreenBuffer. | |||||
| 45435 | LD DE,22496 | Point DE at the bottom line of the screen, 22496. | ||||||
| 45438 | LD C,192 | Set a counter in C of 192 lines. | ||||||
| UpdateScreen_Loop | 45440 | PUSH BC | Stash the line counter on the stack. | |||||
| 45441 | PUSH DE | Stash the screen address on the stack. | ||||||
| 45442 | LD BC,32 | Set a counter in BC of 32 bytes. | ||||||
| 45445 | LDIR | Copy the line to the screen. | ||||||
| 45447 | POP DE | Restore the screen address from the stack. | ||||||
|
Move up to the next pixel line of the screen.
|
||||||||
| 45448 | DEC D | Move up one pixel line. | ||||||
| 45449 | LD A,D | Invert the high byte of the screen address to test its pixel line bits. | ||||||
| 45450 | CPL | |||||||
| 45451 | AND %00000111 | Keep only the pixel line bits. | ||||||
| 45453 | JR NZ,UpdateScreen_Next | Jump to UpdateScreen_Next if the line is still in the same character row. | ||||||
| 45455 | LD A,E | Move up one character row. | ||||||
| 45456 | SUB 32 | |||||||
| 45458 | LD E,A | |||||||
| 45459 | JR C,UpdateScreen_Next | Jump to UpdateScreen_Next if that has crossed into the third above. | ||||||
| 45461 | LD A,D | Otherwise cancel the effect of the borrow on the third, by adding 8 to the high byte. | ||||||
| 45462 | ADD A,8 | |||||||
| 45464 | LD D,A | |||||||
| UpdateScreen_Next | 45465 | POP BC | Restore the line counter from the stack. | |||||
| 45466 | DEC C | Decrease the line counter. | ||||||
| 45467 | JR NZ,UpdateScreen_Loop | Jump to UpdateScreen_Loop until all the lines have been copied. | ||||||
| 45469 | RET | Return. | ||||||
|
View the equivalent code in;
|
||||||||
| Prev: 45381 | Up: Map | Next: 45470 |