![]() |
Routines |
| Prev: 50908 | Up: Map | Next: 51036 |
|
Fetches the code of a cell from TownMap, which is sixteen rows of sixteen. L is the column and H is the row. It sets CellColumn and CellRow. When bit 0 of ViewRotation is set, the map is read from the end.
|
||||||||||||||
|
Work out the number of the cell.
|
||||||||||||||
| GetMapCell | 51000 | LD (41556),HL | Set CellColumn and CellRow. | |||||||||||
| 51003 | LD A,L | Put the column in A and the row in HL. | ||||||||||||
| 51004 | LD L,H | |||||||||||||
| 51005 | LD H,0 | |||||||||||||
| 51007 | ADD HL,HL | Multiply the row by 16. | ||||||||||||
| 51008 | ADD HL,HL | |||||||||||||
| 51009 | ADD HL,HL | |||||||||||||
| 51010 | ADD HL,HL | |||||||||||||
| 51011 | OR L | Add the column. | ||||||||||||
| 51012 | LD L,A | |||||||||||||
|
Point at the map.
|
||||||||||||||
| 51013 | LD BC,24497 | Point BC at TownMap. | ||||||||||||
| 51016 | LD A,(41576) | Fetch ViewRotation. | ||||||||||||
| 51019 | AND %00000001 | Keep the lowest bit. | ||||||||||||
| 51021 | JR Z,GetMapCell_Fetch | Jump to GetMapCell_Fetch if the view is not rotated. | ||||||||||||
|
Read from the end.
|
||||||||||||||
| 51023 | LD A,L | Complement HL. | ||||||||||||
| 51024 | CPL | |||||||||||||
| 51025 | LD L,A | |||||||||||||
| 51026 | LD A,H | |||||||||||||
| 51027 | CPL | |||||||||||||
| 51028 | LD H,A | |||||||||||||
| 51029 | LD BC,24753 | Point BC one past TownMap. | ||||||||||||
|
Fetch the code.
|
||||||||||||||
| GetMapCell_Fetch | 51032 | ADD HL,BC | Add the address of the map. | |||||||||||
| 51033 | LD A,(HL) | Fetch the code and return. | ||||||||||||
| 51034 | AND A | |||||||||||||
| 51035 | RET | |||||||||||||
|
View the equivalent code in;
|
||||||||||||||
| Prev: 50908 | Up: Map | Next: 51036 |