![]() |
Routines |
| Prev: 54873 | Up: Map | Next: 54933 |
|
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 | 54883 | PUSH BC | Save the registers. | |||||||||
| 54884 | PUSH DE | |||||||||||
| 54885 | PUSH HL | |||||||||||
| 54886 | PUSH AF | |||||||||||
| 54887 | EX DE,HL | Keep the screen address in DE. | ||||||||||
| 54888 | AND %00111111 | Keep the number of the tile. | ||||||||||
| 54890 | LD L,A | Move it to HL. | ||||||||||
| 54891 | LD H,0 | |||||||||||
| 54893 | ADD HL,HL | Multiply it by eight. | ||||||||||
| 54894 | ADD HL,HL | |||||||||||
| 54895 | ADD HL,HL | |||||||||||
| 54896 | ADD HL,BC | Add the address of the tile set. | ||||||||||
| 54897 | EX DE,HL | Put the address of the tile in DE and the screen address in HL. | ||||||||||
|
Choose how to reflect it.
|
||||||||||||
| 54898 | POP AF | Restore the number of the tile. | ||||||||||
| 54899 | RLCA | Move bits 6 and 7 to bits 0 and 1. | ||||||||||
| 54900 | RLCA | |||||||||||
| 54901 | AND %00000011 | Keep them. | ||||||||||
| 54903 | JR Z,DrawTilePixels_Normal | Jump to draw the tile as it is if neither is set. | ||||||||||
| 54905 | DEC A | Count down. | ||||||||||
| 54906 | JR Z,DrawTilePixels_Horizontal | Jump to draw it reflected horizontally if that was one. | ||||||||||
| 54908 | DEC A | Count down. | ||||||||||
| 54909 | JR Z,DrawTilePixels_Vertical | Jump to draw it reflected vertically if that was two. | ||||||||||
| 54911 | CALL DrawTileBoth | Otherwise draw it reflected both ways. | ||||||||||
| DrawTilePixels_Done | 54914 | POP HL | Restore the registers and return. | |||||||||
| 54915 | POP DE | |||||||||||
| 54916 | POP BC | |||||||||||
| 54917 | RET | |||||||||||
| DrawTilePixels_Normal | 54918 | CALL DrawTileNormal | Draw the tile as it is. | |||||||||
| 54921 | JR DrawTilePixels_Done | |||||||||||
| DrawTilePixels_Horizontal | 54923 | CALL DrawTileHorizontal | Draw the tile reflected horizontally. | |||||||||
| 54926 | JR DrawTilePixels_Done | |||||||||||
| DrawTilePixels_Vertical | 54928 | CALL DrawTileVertical | Draw the tile reflected vertically. | |||||||||
| 54931 | JR DrawTilePixels_Done | |||||||||||
| Prev: 54873 | Up: Map | Next: 54933 |