Prev: F104 Up: Map Next: F1AF
F107: Handler: Keys And Locked Doors
Used by the routine at Handler_Player.
Handler_KeysAndLockedDoors F107 PUSH IX Stash IX on the stack.
F109 LD IX,($5BDA) IX=*ReferenceKeysAndLockedDoors.
Handler_KeysAndLockedDoors_Loop F10D LD A,(IX+$00) Jump to Handler_Housekeeping if the terminator character has been received instead of a co-ordinate (FF).
F110 CP $FF
F112 JR Z,Handler_Housekeeping
F114 LD A,(IX+$05) A=*IX+05.
F117 AND %00000010 Keep only bit 1.
F119 JR Z,Handler_KeysAndLockedDoors_Next Jump to Handler_KeysAndLockedDoors_Next if the result is zero.
F11B LD A,(IX+$02) Jump to Handler_KeysAndLockedDoors_Next if *IX+02 is not equal to C.
F11E CP C
F11F JR NZ,Handler_KeysAndLockedDoors_Next
F121 LD A,(IX+$03) Jump to Handler_KeysAndLockedDoors_0 if *IX+03 is equal to B.
F124 CP B
F125 JR Z,Handler_KeysAndLockedDoors_0
Handler_KeysAndLockedDoors_Next F127 LD DE,$0006 IX+=0006.
F12A ADD IX,DE
F12C JR Handler_KeysAndLockedDoors_Loop Jump to Handler_KeysAndLockedDoors_Loop.
Handler_KeysAndLockedDoors_0 F12E LD A,$06 Write 06 to *SoundFlag_General.
F130 LD ($FFFE),A
F133 LD (IX+$05),$01 Write 01 to *IX+05.
F137 LD C,(IX+$02) C=*IX+02.
F13A LD B,(IX+$03) B=*IX+03.
F13D LD E,$01 Set the sprite width/ height in DE (01/02).
F13F LD D,$02
F141 LD A,$00 A=00.
F143 CALL $E72F Call E72F.
F146 LD HL,($5C36) Stash *CHARS on the stack.
F149 PUSH HL
F14A LD HL,$9F6C Write 9F6C (Graphics_MaskSprite) to *CHARS.
F14D LD ($5C36),HL
F150 LD A,$20 A=20.
F152 CALL PrintSprite Call PrintSprite.
F155 POP HL Restore the original value of *CHARS from the stack.
F156 LD ($5C36),HL
F159 LD A,(IX+$04) A=*IX+04.
F15C POP IX Restore IX from the stack.
F15E PUSH AF Stash AF on the stack.
F15F LD A,(IX+$10) Jump to Handler_KeysAndLockedDoors_1 if *IX+10 is equal to 00.
F162 CP $00
F164 JR Z,Handler_KeysAndLockedDoors_1
F166 PUSH IX Stash IX on the stack.
F168 CALL $F1E5 Call F1E5.
F16B LD HL,($5C36) Stash *CHARS on the stack.
F16E PUSH HL
F16F LD HL,$8378 Write 8378 (Graphics_RoomScaffolding_Empty) to *CHARS.
F172 LD ($5C36),HL
F175 LD A,$10 Set INK: *ActiveRoom_KeyColour.
F177 RST $10
F178 LD A,($5BCC)
F17B RST $10
F17C LD (IX+$05),$03 Write 03 to *IX+05.
F180 LD C,(IX+$02) C=*IX+02.
F183 LD B,(IX+$03) B=*IX+03.
F186 PUSH BC Stash BC on the stack.
F187 CALL ConvertCoordinateToBufferOffset Call ConvertCoordinateToBufferOffset.
F18A CALL $0DD9 Call CL_SET.
F18D LD A,(IX+$04) A=*IX+04.
F190 ADD A,$41 A+=41. TODO Graphics_KeyLabels
F192 CALL $E804 Call E804.
F195 RST $10 Print to the screen using RST 10.
F196 POP BC Restore BC from the stack.
F197 DEC B Decrease B by one.
F198 CALL ConvertCoordinateToBufferOffset Call ConvertCoordinateToBufferOffset.
F19B CALL $0DD9 Call CL_SET.
F19E LD A,$4B A=Graphics_KeyBottom (4B).
F1A0 CALL $E804 Call E804.
F1A3 RST $10 Print to the screen using RST 10.
F1A4 POP HL Restore the original value of *CHARS from the stack.
F1A5 LD ($5C36),HL
F1A8 POP IX Restore IX from the stack.
Handler_KeysAndLockedDoors_1 F1AA POP AF Restore AF from the stack.
F1AB LD (IX+$10),A Write A to *IX+10.
F1AE RET Return.
Prev: F104 Up: Map Next: F1AF