![]() |
Routines |
| Prev: 45470 | Up: Map | Next: 45722 |
|
Used by the routines at DrawChangedObjects and DisplayObjectsCarried.
Copies a rectangle from the buffer to the screen, a line at a time.
|
||||||||||||||
| CopyBlockToScreen | 45688 | PUSH BC | Stash the line counter, the screen address and the buffer address on the stack. | |||||||||||
| 45689 | PUSH DE | |||||||||||||
| 45690 | PUSH HL | |||||||||||||
| 45691 | LD B,0 | Clear B, ready for the copy. | ||||||||||||
| 45693 | LDIR | Copy a line of the rectangle to the screen. | ||||||||||||
| 45695 | POP HL | Restore the buffer address from the stack. | ||||||||||||
| 45696 | LD DE,32 | Move HL on to the next line of the buffer by adding 32. | ||||||||||||
| 45699 | ADD HL,DE | |||||||||||||
| 45700 | POP DE | Restore the screen address from the stack. | ||||||||||||
|
Move up to the next pixel line of the screen.
|
||||||||||||||
| 45701 | DEC D | Move up one pixel line. | ||||||||||||
| 45702 | LD A,D | Invert the high byte of the screen address to test its pixel line bits. | ||||||||||||
| 45703 | CPL | |||||||||||||
| 45704 | AND %00000111 | Keep only the pixel line bits. | ||||||||||||
| 45706 | JR NZ,CopyBlockToScreen_Next | Jump to CopyBlockToScreen_Next if the line is still in the same character row. | ||||||||||||
| 45708 | LD A,E | Move up one character row. | ||||||||||||
| 45709 | SUB 32 | |||||||||||||
| 45711 | LD E,A | |||||||||||||
| 45712 | JR C,CopyBlockToScreen_Next | Jump to CopyBlockToScreen_Next if that has crossed into the third above. | ||||||||||||
| 45714 | LD A,D | Otherwise cancel the effect of the borrow on the third, by adding 8 to the high byte. | ||||||||||||
| 45715 | ADD A,8 | |||||||||||||
| 45717 | LD D,A | |||||||||||||
| CopyBlockToScreen_Next | 45718 | POP BC | Restore the line counter from the stack. | |||||||||||
| 45719 | DJNZ CopyBlockToScreen | Decrease the line counter and loop until all the lines have been copied. | ||||||||||||
| 45721 | RET | Return. | ||||||||||||
|
View the equivalent code in;
|
||||||||||||||
| Prev: 45470 | Up: Map | Next: 45722 |