Prev: 6949 Up: Map Next: 69BC
6980: Handler: Terrain Dots
Used by the routine at 65B1.
Input
IX One of the 10 TerrainDots entities
HandlerTerrainDots 6980 RES 0,(IX+$00) Reset bit 0 of the given Terrain Dot entity.
6984 LD HL,($5E34) HL=PlayerWorldPosition.
6987 LD A,L L=player Y - terrain dot Y.
6988 SUB (IX+$00)
698B LD L,A
698C LD A,H H=player X - terrain dot X.
698D SUB (IX+$01)
6990 LD H,A
This entry point is used by the routines at 625C and 6557.
HandlerTerrainDots_0 6991 LD A,$86 Write 86 to 69A7.
6993 LD ($69A7),A
6996 JR HandlerTerrainDots_2 Jump to HandlerTerrainDots_2.
HandlerTerrainDots_1 6998 LD A,$C6 Write C6 to 69A7.
699A LD ($69A7),A
HandlerTerrainDots_2 699D PUSH BC Stash BC and HL on the stack.
699E PUSH HL
699F LD A,L A=L.
69A0 CPL Flip the bits.
69A1 RLCA A=A * 08.
69A2 RLCA
69A3 RLCA
69A4 AND %00111000 Keep only bits 3-5.
Self modifying code
Altered From Bytes bits
HandlerTerrainDots_0 86 10000110
HandlerTerrainDots_1 C6 11000110
69A6 OR %11000110 Set bits 1-2, 6-7.
69A8 LD ($69AF),A Store A at 69AF.
69AB CALL ScreenAddress Call ScreenAddress.
HandlerTerrainDots_3 69AE SET 0,(HL) Set bit 0 of HL.
69B0 CALL ScreenPos1PixelAbove Call ScreenPos1PixelAbove.
69B3 DJNZ HandlerTerrainDots_3 Decrease counter by one and loop back to HandlerTerrainDots_3 until counter is zero.
69B5 POP HL Restore HL and BC from the stack.
69B6 POP BC
69B7 INC L Increment L by one.
69B8 DEC C Decrease counter by one and loop back to HandlerTerrainDots_2 until counter is zero.
69B9 JR NZ,HandlerTerrainDots_2
69BB RET Return.
Prev: 6949 Up: Map Next: 69BC