Prev: 7D03 Up: Map Next: 7D60
7D04: routine01
Used by the routine at routine06.
routine01 7D04 LD A,(unknown01) Return if unknown01 is less than 6.
7D07 CP $06
7D09 RET M
7D0A LD HL,map_object_table Temporarily store address of map area object code table in object_table_entry_pointer variable.
7D0D LD (object_table_entry_pointer),HL
7D10 LD B,$9F Load B with 159 as loop counter.
routine01_0 7D12 PUSH BC Stack loop counter.
7D13 LD A,(HL) Load byte from cell in map area object code table into A.
7D14 CP $02 Jump to routine01_1 if byte is less than 2 or greater than 33.
7D16 JP M,routine01_1
7D19 CP $22
7D1B JP P,routine01_1
7D1E LD DE,$0281 Add $0281 to address to get address of same cell in fifth_map_table.
7D21 ADD HL,DE
7D22 LD A,(HL) Load byte from fifth_map_table into A.
7D23 SUB $29 Subtract 41 from byte read.
7D25 LD HL,current_player Jump to routine01_1 if result is equal to current_player variable.
7D28 CP (HL)
7D29 JR Z,routine01_1
7D2B LD HL,(object_table_entry_pointer) Load address of cell in map area object code table back into HL from object_table_entry_pointer variable and add $01E1 to get address of same cell in map_object_properties_table.
7D2E LD DE,$01E1
7D31 ADD HL,DE
7D32 LD A,(HL) Load byte from map_object_properties_table into A.
7D33 AND $07 Mod 8.
7D35 LD HL,current_player Jump to routine01_2 if result is equal to current_player variable.
7D38 CP (HL)
7D39 JR Z,routine01_2
routine01_1 7D3B POP BC Pop loop counter.
7D3C LD HL,(object_table_entry_pointer) Increment object_table_entry_pointer variable.
7D3F INC HL
7D40 LD (object_table_entry_pointer),HL
7D43 DJNZ routine01_0 Loop back to routine01_0 158 times.
7D45 LD HL,unknown_table_4 Set HL to address of unknown_table_4.
7D48 LD D,$00 Add value of current_player variable as offset.
7D4A LD A,(current_player)
7D4D LD E,A
7D4E ADD HL,DE
7D4F LD (HL),$14 Store $14 in byte pointed to by HL and return.
7D51 RET
routine01_2 7D52 POP BC Pop loop counter.
7D53 LD HL,unknown_table_4 Set HL to address of unknown_table_4.
7D56 LD D,$00
7D58 LD A,(current_player)
7D5B LD E,A Add value of current_player variable as offset.
7D5C ADD HL,DE
7D5D LD (HL),$00 Store $00 in byte pointed to by HL and return.
7D5F RET
Prev: 7D03 Up: Map Next: 7D60