Prev: 61925 Up: Map Next: 62001
61948: Handler: Port Hole
Used by the routine at InitialiseGame.
Set the UDG graphics pointer.
Handler_PortHole 61948 LD HL,37196 Write 37196 (Graphics_Porthole) to *CHARS.
61951 LD (23606),HL
Set the attributes.
61954 LD A,16 Set INK: CYAN (5).
61956 RST 16
61957 LD A,5
61959 RST 16
Only action the port holes every 4th frame.
61960 LD A,(62041) A=*TimerPortHole_FrameSkip.
61963 INC A Increment A by one.
61964 AND %00000011 Ensure A is a number between 0-3.
61966 LD (62041),A Write A to *TimerPortHole_FrameSkip.
61969 RET NZ Return if A is not zero.
The data is stored as:
Byte Offset Data
+0 Horizontal Position
+1 Vertical Position
+2 Frame/ Sprite ID
Find active port holes.
61970 LD HL,(23516) HL=*ReferencePortHole.
Keep looping through the table data until we reach a terminator (255).
Handler_PortHole_Loop 61973 LD C,(HL) Fetch the horizontal and vertical position of the port hole from the port hole data pointer.
61974 INC HL
61975 LD B,(HL)
61976 INC HL Increment the port hole data pointer by one.
Are we done?
61977 LD A,255 Return if the terminator character has been received instead of a co-ordinate (255).
61979 CP C
61980 RET Z
Move onto the next frame.
61981 LD A,(HL) Retrieve the frame/ sprite ID from the port hole data pointer.
61982 ADD A,4 Add 4 to the current frame/ sprite ID, as the port hole graphic is made using 4 UDG characters.
61984 CP 64 If the frame/ sprite ID value is under 64 then jump to PrintPortHole (the last frame/ sprite ID is 60).
61986 JR NZ,PrintPortHole
Reset the sprite ID back to the first frame/ sprite ID.
61988 LD A,32 A=base sprite ID (32).
Update the frame reference in the data table and print the port hole to the screen.
PrintPortHole 61990 LD (HL),A Update the frame/ sprite ID back to the port hole data.
61991 INC HL Increment the port hole data pointer by one.
61992 LD D,2 DE=Set the sprite width/ height (2/ 2).
61994 LD E,2
61996 CALL PrintSprite Call PrintSprite.
Keeping looping around, this only finishes when a terminator is received.
61999 JR Handler_PortHole_Loop Jump to Handler_PortHole_Loop.
Prev: 61925 Up: Map Next: 62001