![]() |
Routines |
| Prev: D508 | Up: Map | Next: D589 |
|
Fetches the tile of a cell from Map, which is thirty-two rows of thirty-two. L is the column and H is the row. It sets CellColumn and CellRow. When bit 0 of ViewRotatedFlag is set, the map is read from the end.
|
||||||||||||||
|
Work out the number of the cell.
|
||||||||||||||
| GetMapCell | D564 | LD ($BBB4),HL | Set CellColumn and CellRow. | |||||||||||
| D567 | LD A,L | Put the column in A and the row in HL. | ||||||||||||
| D568 | LD L,H | |||||||||||||
| D569 | LD H,$00 | |||||||||||||
| D56B | ADD HL,HL | Multiply the row by 20. | ||||||||||||
| D56C | ADD HL,HL | |||||||||||||
| D56D | ADD HL,HL | |||||||||||||
| D56E | ADD HL,HL | |||||||||||||
| D56F | ADD HL,HL | |||||||||||||
| D570 | OR L | Add the column. | ||||||||||||
| D571 | LD L,A | |||||||||||||
|
Point at the map.
|
||||||||||||||
| D572 | LD BC,$5E04 | Point BC at Map. | ||||||||||||
| D575 | LD A,($BBBA) | Fetch ViewRotatedFlag. | ||||||||||||
| D578 | AND %00000001 | Keep the lowest bit. | ||||||||||||
| D57A | JR Z,GetMapCell_Tile | Jump to GetMapCell_Tile if the view is not rotated. | ||||||||||||
|
Read from the end.
|
||||||||||||||
| D57C | LD A,L | Complement HL. | ||||||||||||
| D57D | CPL | |||||||||||||
| D57E | LD L,A | |||||||||||||
| D57F | LD A,H | |||||||||||||
| D580 | CPL | |||||||||||||
| D581 | LD H,A | |||||||||||||
| D582 | LD BC,$6204 | Point BC past Map. | ||||||||||||
|
Fetch the tile.
|
||||||||||||||
| GetMapCell_Tile | D585 | ADD HL,BC | Add the address of the map. | |||||||||||
| D586 | LD A,(HL) | Fetch the tile and return. | ||||||||||||
| D587 | AND A | |||||||||||||
| D588 | RET | |||||||||||||
|
View the equivalent code in;
|
||||||||||||||
| Prev: D508 | Up: Map | Next: D589 |