Prev: F1E5 Up: Map Next: F231
F1FC: Handler: Port Hole
Used by the routine at InitialiseGame.
Set the UDG graphics pointer.
Handler_PortHole F1FC LD HL,$914C Write 914C (Graphics_Porthole) to *CHARS.
F1FF LD ($5C36),HL
Set the attributes.
F202 LD A,$10 Set INK: CYAN (05).
F204 RST $10
F205 LD A,$05
F207 RST $10
Only action the port holes every 4th frame.
F208 LD A,($F259) A=*TimerPortHole_FrameSkip.
F20B INC A Increment A by one.
F20C AND %00000011 Ensure A is a number between 00-03.
F20E LD ($F259),A Write A to *TimerPortHole_FrameSkip.
F211 RET NZ Return if A is not zero.
The data is stored as:
Byte Offset Data
+00 Horizontal Position
+01 Vertical Position
+02 Frame/ Sprite ID
Find active port holes.
F212 LD HL,($5BDC) HL=*ReferencePortHole.
Keep looping through the table data until we reach a terminator (FF).
Handler_PortHole_Loop F215 LD C,(HL) Fetch the horizontal and vertical position of the port hole from the port hole data pointer.
F216 INC HL
F217 LD B,(HL)
F218 INC HL Increment the port hole data pointer by one.
Are we done?
F219 LD A,$FF Return if the terminator character has been received instead of a co-ordinate (FF).
F21B CP C
F21C RET Z
Move onto the next frame.
F21D LD A,(HL) Retrieve the frame/ sprite ID from the port hole data pointer.
F21E ADD A,$04 Add 04 to the current frame/ sprite ID, as the port hole graphic is made using 04 UDG characters.
F220 CP $40 If the frame/ sprite ID value is under 40 then jump to PrintPortHole (the last frame/ sprite ID is 3C).
F222 JR NZ,PrintPortHole
Reset the sprite ID back to the first frame/ sprite ID.
F224 LD A,$20 A=base sprite ID (20).
Update the frame reference in the data table and print the port hole to the screen.
PrintPortHole F226 LD (HL),A Update the frame/ sprite ID back to the port hole data.
F227 INC HL Increment the port hole data pointer by one.
F228 LD D,$02 DE=Set the sprite width/ height (02/ 02).
F22A LD E,$02
F22C CALL PrintSprite Call PrintSprite.
Keeping looping around, this only finishes when a terminator is received.
F22F JR Handler_PortHole_Loop Jump to Handler_PortHole_Loop.
Prev: F1E5 Up: Map Next: F231