Prev: 26953 Up: Map Next: 27068
27008: Handler: Terrain Dots
Used by the routine at 26033.
Input
IX One of the 16 TerrainDots entities
HandlerTerrainDots 27008 RES 0,(IX+0) Reset bit 0 of the given Terrain Dot entity.
27012 LD HL,(24116) HL=PlayerWorldPosition.
27015 LD A,L L=player Y - terrain dot Y.
27016 SUB (IX+0)
27019 LD L,A
27020 LD A,H H=player X - terrain dot X.
27021 SUB (IX+1)
27024 LD H,A
This entry point is used by the routines at 25180 and 25943.
HandlerTerrainDots_0 27025 LD A,134 Write 134 to 27047.
27027 LD (27047),A
27030 JR HandlerTerrainDots_2 Jump to HandlerTerrainDots_2.
HandlerTerrainDots_1 27032 LD A,198 Write 198 to 27047.
27034 LD (27047),A
HandlerTerrainDots_2 27037 PUSH BC Stash BC and HL on the stack.
27038 PUSH HL
27039 LD A,L A=L.
27040 CPL Flip the bits.
27041 RLCA A=A * 8.
27042 RLCA
27043 RLCA
27044 AND %00111000 Keep only bits 3-5.
Self modifying code
Altered From Bytes bits
HandlerTerrainDots_0 134 10000110
HandlerTerrainDots_1 198 11000110
27046 OR %11000110 Set bits 1-2, 6-7.
27048 LD (27055),A Store A at 27055.
27051 CALL ScreenAddress Call ScreenAddress.
HandlerTerrainDots_3 27054 SET 0,(HL) Set bit 0 of HL.
27056 CALL ScreenPos1PixelAbove Call ScreenPos1PixelAbove.
27059 DJNZ HandlerTerrainDots_3 Decrease counter by one and loop back to HandlerTerrainDots_3 until counter is zero.
27061 POP HL Restore HL and BC from the stack.
27062 POP BC
27063 INC L Increment L by one.
27064 DEC C Decrease counter by one and loop back to HandlerTerrainDots_2 until counter is zero.
27065 JR NZ,HandlerTerrainDots_2
27067 RET Return.
Prev: 26953 Up: Map Next: 27068