![]() |
Routines |
| Prev: B19E | Up: Map | Next: B29A |
|
Used by the routines at DrawChangedObjects and DisplayObjectsCarried.
Copies a rectangle from the buffer to the screen, a line at a time.
|
||||||||||||||
| CopyBlockToScreen | B278 | PUSH BC | Stash the line counter, the screen address and the buffer address on the stack. | |||||||||||
| B279 | PUSH DE | |||||||||||||
| B27A | PUSH HL | |||||||||||||
| B27B | LD B,$00 | Clear B, ready for the copy. | ||||||||||||
| B27D | LDIR | Copy a line of the rectangle to the screen. | ||||||||||||
| B27F | POP HL | Restore the buffer address from the stack. | ||||||||||||
| B280 | LD DE,$0020 | Move HL on to the next line of the buffer by adding 20. | ||||||||||||
| B283 | ADD HL,DE | |||||||||||||
| B284 | POP DE | Restore the screen address from the stack. | ||||||||||||
|
Move up to the next pixel line of the screen.
|
||||||||||||||
| B285 | DEC D | Move up one pixel line. | ||||||||||||
| B286 | LD A,D | Invert the high byte of the screen address to test its pixel line bits. | ||||||||||||
| B287 | CPL | |||||||||||||
| B288 | AND %00000111 | Keep only the pixel line bits. | ||||||||||||
| B28A | JR NZ,CopyBlockToScreen_Next | Jump to CopyBlockToScreen_Next if the line is still in the same character row. | ||||||||||||
| B28C | LD A,E | Move up one character row. | ||||||||||||
| B28D | SUB $20 | |||||||||||||
| B28F | LD E,A | |||||||||||||
| B290 | JR C,CopyBlockToScreen_Next | Jump to CopyBlockToScreen_Next if that has crossed into the third above. | ||||||||||||
| B292 | LD A,D | Otherwise cancel the effect of the borrow on the third, by adding 08 to the high byte. | ||||||||||||
| B293 | ADD A,$08 | |||||||||||||
| B295 | LD D,A | |||||||||||||
| CopyBlockToScreen_Next | B296 | POP BC | Restore the line counter from the stack. | |||||||||||
| B297 | DJNZ CopyBlockToScreen | Decrease the line counter and loop until all the lines have been copied. | ||||||||||||
| B299 | RET | Return. | ||||||||||||
|
View the equivalent code in;
|
||||||||||||||
| Prev: B19E | Up: Map | Next: B29A |