Prev: BDA5 Up: Map Next: BDE7
BDD1: Get address of entry in map_object_table.
Used by the routines at routine23, routine41 and routine46.
Calculate address of entry in map_object_table from coordinates in BC and return in HL.
coordinate_to_address BDD1 PUSH BC Preserve coordinates.
BDD2 DEC B Decrement each coordinate to get zero-based value.
BDD3 DEC C
BDD4 SLA B Multiply row by 16 and add column as table offset.
BDD6 SLA B
BDD8 SLA B
BDDA SLA B
BDDC LD A,B
BDDD ADD A,C
BDDE LD C,A Set HL to address of map_object_table and add offset.
BDDF LD B,$00
BDE1 LD HL,map_object_table
BDE4 ADD HL,BC
BDE5 POP BC Restore coordinates and return.
BDE6 RET
Prev: BDA5 Up: Map Next: BDE7