![]() |
Routines |
| Prev: 25620 | Up: Map | Next: 25664 |
|
Used by the routine at InitialiseLevel.
|
||||||||||
| CopyLevelDataToBuffer | 25636 | LD C,5 | Set a counter in C for 5 rows to copy. | |||||||
| CopyLevelDataToBuffer_CopyRow | 25638 | LD B,32 | Set a counter in B for 32 bytes per row. | |||||||
| CopyLevelDataToBuffer_CopyByte | 25640 | LD A,(HL) | Fetch a terrain byte from the source data. | |||||||
| 25641 | INC HL | Move to the next source data byte. | ||||||||
| 25642 | LD (DE),A | Write the byte to the destination buffer. | ||||||||
| 25643 | INC E | Move to the next destination buffer position. | ||||||||
| 25644 | DJNZ CopyLevelDataToBuffer_CopyByte | Decrease the bytes-per-row counter by one and loop back to CopyLevelDataToBuffer_CopyByte until the whole row has been copied. | ||||||||
|
Handle updating the destination pointer positioning after each row.
|
||||||||||
| 25646 | DEC E | Step back one position. | ||||||||
| 25647 | LD A,E | Align to a 32 byte boundary. | ||||||||
| 25648 | AND %11100000 | Keep only the upper 3 bits of the E co-ordinate. | ||||||||
| 25650 | LD E,A | Reset to the start of the current 32 byte block. | ||||||||
| 25651 | INC D | Move down one row. | ||||||||
| 25652 | DEC C | Decrease the row counter by one. | ||||||||
| 25653 | JR NZ,CopyLevelDataToBuffer_CopyRow | Jump back to CopyLevelDataToBuffer_CopyRow until all the rows have been copied. | ||||||||
|
Adjust the destination pointer after copying a complete 5x32 block.
|
||||||||||
| 25655 | ADD A,32 | Move to the next block horizontally. | ||||||||
| 25657 | LD E,A | Load the new horizontal position into E. | ||||||||
| 25658 | RET Z | Return if E wrapped around to 0 (we reached the end of the buffer). | ||||||||
|
Move the destination pointer back up 5 rows to the original vertical position.
|
||||||||||
| 25659 | LD A,D | D-=5. | ||||||||
| 25660 | SUB 5 | |||||||||
| 25662 | LD D,A | |||||||||
| 25663 | RET | Return. | ||||||||
| Prev: 25620 | Up: Map | Next: 25664 |