![]() |
Routines |
| Prev: D659 | Up: Map | Next: D695 |
|
Used by the routines at DrawReward and DrawTile.
Draws the pixels of a tile of eight by eight pixels. Bit 7 of the number of the tile says that it is reflected vertically and bit 6 that it is reflected horizontally.
|
||||||||||||
|
Find the pixels of the tile.
|
||||||||||||
| DrawTilePixels | D663 | PUSH BC | Save the registers. | |||||||||
| D664 | PUSH DE | |||||||||||
| D665 | PUSH HL | |||||||||||
| D666 | PUSH AF | |||||||||||
| D667 | EX DE,HL | Keep the screen address in DE. | ||||||||||
| D668 | AND %00111111 | Keep the number of the tile. | ||||||||||
| D66A | LD L,A | Move it to HL. | ||||||||||
| D66B | LD H,$00 | |||||||||||
| D66D | ADD HL,HL | Multiply it by eight. | ||||||||||
| D66E | ADD HL,HL | |||||||||||
| D66F | ADD HL,HL | |||||||||||
| D670 | ADD HL,BC | Add the address of the tile set. | ||||||||||
| D671 | EX DE,HL | Put the address of the tile in DE and the screen address in HL. | ||||||||||
|
Choose how to reflect it.
|
||||||||||||
| D672 | POP AF | Restore the number of the tile. | ||||||||||
| D673 | RLCA | Move bits 6 and 7 to bits 0 and 1. | ||||||||||
| D674 | RLCA | |||||||||||
| D675 | AND %00000011 | Keep them. | ||||||||||
| D677 | JR Z,DrawTilePixels_Normal | Jump to draw the tile as it is if neither is set. | ||||||||||
| D679 | DEC A | Count down. | ||||||||||
| D67A | JR Z,DrawTilePixels_Horizontal | Jump to draw it reflected horizontally if that was one. | ||||||||||
| D67C | DEC A | Count down. | ||||||||||
| D67D | JR Z,DrawTilePixels_Vertical | Jump to draw it reflected vertically if that was two. | ||||||||||
| D67F | CALL DrawTileBoth | Otherwise draw it reflected both ways. | ||||||||||
| DrawTilePixels_Done | D682 | POP HL | Restore the registers and return. | |||||||||
| D683 | POP DE | |||||||||||
| D684 | POP BC | |||||||||||
| D685 | RET | |||||||||||
| DrawTilePixels_Normal | D686 | CALL DrawTileNormal | Draw the tile as it is. | |||||||||
| D689 | JR DrawTilePixels_Done | |||||||||||
| DrawTilePixels_Horizontal | D68B | CALL DrawTileHorizontal | Draw the tile reflected horizontally. | |||||||||
| D68E | JR DrawTilePixels_Done | |||||||||||
| DrawTilePixels_Vertical | D690 | CALL DrawTileVertical | Draw the tile reflected vertically. | |||||||||
| D693 | JR DrawTilePixels_Done | |||||||||||
| Prev: D659 | Up: Map | Next: D695 |