Prev: DC26 Up: Map Next: DD97
DC62: Handler: Enemies
Used by the routine at Dispatch_Handlers.
Animates the 0E-byte records at *ReferenceEnemies.
Handler_Enemies DC62 LD HL,$9070 Write Graphics_TileFont to *CHARS.
DC65 LD ($5C36),HL
DC68 LD IX,($6432) IX=*ReferenceEnemies.
Handler_Enemies_Loop DC6C LD A,(IX+$00) Return if the terminator FF is reached.
DC6F INC A
DC70 RET Z
DC71 BIT 7,A Call Pause_LeavingRoom if this enemy is inactive.
DC73 CALL NZ,Pause_LeavingRoom
DC76 JP NZ,Handler_Enemies_Next Jump to Handler_Enemies_Next if it is inactive.
DC79 LD A,(IX+$06) Jump to Handler_Enemies_Probe if the sprite ID is E2 or higher.
DC7C CP $E2
DC7E JR NC,Handler_Enemies_Probe
Wrap the walking-enemy frame.
DC80 ADD A,$06 C=the sprite ID+06.
DC82 LD C,A
DC83 LD B,$24 B=24.
Handler_Enemies_BelowPlayer DC85 SUB B Subtract 24 until the frame is in range.
DC86 JR Z,Handler_Enemies_AbovePlayer
DC88 JR C,Handler_Enemies_CommitFrame
DC8A JR Handler_Enemies_BelowPlayer
Handler_Enemies_AbovePlayer DC8C LD A,C C=C-24.
DC8D SUB B
DC8E LD C,A
Handler_Enemies_CommitFrame DC8F LD (IX+$06),C Write the wrapped sprite ID.
Handler_Enemies_Probe DC92 LD A,(IX+$02) Jump to Handler_Enemies_Update unless the fine-X is 07.
DC95 CP $07
DC97 JR NZ,Handler_Enemies_Update
DC99 BIT 7,(IX+$07) Jump to Handler_Enemies_ProbeLeft if the enemy is facing left.
DC9D JR Z,Handler_Enemies_ProbeLeft
DC9F LD C,(IX+$00) Probe the cell above and to the right.
DCA2 LD A,(IX+$01)
DCA5 SUB (IX+$05)
DCA8 LD B,A
DCA9 INC C
Reverse if that Buffer_RoomTiles tile is solid.
DCAA CALL JumpTable_SetPrintPosition Call JumpTable_SetPrintPosition.
DCAD LD HL,($6412) Point HL at that Buffer_RoomTiles tile.
DCB0 LD DE,$5DCE
DCB3 ADD HL,DE
DCB4 LD A,(HL) Call Reverse_Direction if the tile is solid.
DCB5 CP $10
DCB7 CALL NC,Reverse_Direction
DCBA JR Handler_Enemies_Update Jump to Handler_Enemies_Update.
Handler_Enemies_ProbeLeft DCBC LD A,(IX+$01) Jump to Handler_Enemies_Update if the enemy is past column 23.
DCBF SUB (IX+$05)
DCC2 LD B,A
DCC3 LD A,(IX+$00)
DCC6 CP $23
DCC8 JR NC,Handler_Enemies_Update
Probe the cell to the left.
DCCA SUB (IX+$04) C=the column minus the width.
DCCD LD C,A
DCCE CALL JumpTable_SetPrintPosition Call JumpTable_SetPrintPosition.
DCD1 LD HL,($6412) Point HL at that Buffer_RoomTiles tile.
DCD4 LD DE,$5DCE
DCD7 ADD HL,DE
DCD8 LD A,(HL) Call Reverse_Direction if the tile is solid.
DCD9 CP $10
DCDB CALL NC,Reverse_Direction
Handler_Enemies_Update DCDE CALL JumpTable_AdvanceEntity Call JumpTable_AdvanceEntity.
DCE1 CALL JumpTable_StorePosition Call JumpTable_StorePosition.
DCE4 CALL JumpTable_MoveEntity Call JumpTable_MoveEntity.
DCE7 CALL JumpTable_DrawEntity Call JumpTable_DrawEntity.
DCEA CALL JumpTable_EraseEntity Call JumpTable_EraseEntity.
Handler_Enemies_Next DCED LD DE,$000E IX+=000E.
DCF0 ADD IX,DE
DCF2 JP Handler_Enemies_Loop Jump to Handler_Enemies_Loop.
This entry point is used by the routine at Handler_Keyboard.
Move to the next room (wrapping from 16 to 00).
Cheat_NextRoom DCF5 POP BC Restore BC from the stack.
DCF6 LD A,($64A2) A=*CurrentRoom+1, or 00 after room 16.
DCF9 INC A
DCFA CP $17
DCFC JP NZ,Change_Room
DCFF XOR A Jump to Change_Room.
DD00 JP Change_Room
This entry point is used by the routine at Handler_Keyboard.
Move to the previous room (wrapping from 00 to 16).
Cheat_PreviousRoom DD03 POP BC Restore BC from the stack.
DD04 LD A,($64A2) A=*CurrentRoom-1, or 16 before room 00.
DD07 DEC A
DD08 CP $FF
DD0A JP NZ,Change_Room
DD0D LD A,$16
DD0F JP Change_Room Jump to Change_Room.
Point IX at SkipDelayFlag and set DE to the number of bytes through to 7C67.
Tape_BlockRange DD12 LD IX,$647C DE=7C67-SkipDelayFlag.
DD16 LD DE,$647C
DD19 LD HL,$7C67
DD1C XOR A A=FF.
DD1D SBC HL,DE
DD1F EX DE,HL Return.
DD20 DEC A
DD21 RET
This entry point is used by the routine at Handler_Keyboard.
Save the game to tape.
Tape_Save DD22 CALL Tape_Checksum Write the checksum from Tape_Checksum to *TapeChecksum.
DD25 LD ($6488),A
DD28 POP BC Restore BC from the stack.
DD29 CALL Tape_BlockRange Call Tape_BlockRange.
DD2C CALL $04C2 Call SA_BYTES.
DD2F LD A,($64A2) Set bit 7 of *CurrentRoom.
DD32 SET 7,A
DD34 JP Change_Room Jump to Change_Room.
This entry point is used by the routine at Handler_Keyboard.
Load a saved game from tape.
Tape_Load DD37 LD HL,$3C00 Write 3C00 to *CHARS.
DD3A LD ($5C36),HL
DD3D LD HL,$E7E4 Print the messaging at Messaging_LoadGame.
DD40 CALL JumpTable_PrintMessage
Tape_Load_Wait DD43 LD BC,$2710 Call JumpTable_Delay with a pause of 2710.
DD46 CALL JumpTable_Delay
DD49 CALL $028E Call KEY_SCAN.
DD4C LD A,E Jump to Tape_Load_Wait if no key is pressed.
DD4D CP $FF
DD4F JR Z,Tape_Load_Wait
DD51 CP $02 Jump to Tape_Load_Resume unless "2" was pressed.
DD53 JR NZ,Tape_Load_Resume
DD55 POP BC Restore BC from the stack.
DD56 CALL Tape_BlockRange Call Tape_BlockRange.
DD59 SCF Call LD_BYTES with carry set.
DD5A CALL $0556
DD5D CALL Tape_Checksum Jump to Reset_Introduction if the checksum does not match.
DD60 CP L
DD61 JP NZ,Reset_Introduction
Tape_Load_Resume DD64 LD A,($64A2) Set bit 7 of *CurrentRoom.
DD67 SET 7,A
DD69 JP Change_Room Jump to Change_Room.
Add every byte from SkipDelayFlag through the tape block.
Tape_Checksum DD6C CALL Tape_BlockRange Call Tape_BlockRange.
DD6F XOR A A=00 and clear *TapeChecksum.
DD70 LD HL,($6488)
DD73 LD ($6488),A
DD76 LD H,A
Tape_Checksum_Loop DD77 ADD A,(IX+$00) Add *(IX) into A until DE is zero.
DD7A LD H,A
DD7B INC IX
DD7D DEC DE
DD7E LD A,E
DD7F OR D
DD80 LD A,H
DD81 JR NZ,Tape_Checksum_Loop
DD83 RET Return.
This entry point is used by the routine at Handler_Keyboard.
Wait for any key.
Wait_Keypress DD84 LD BC,$2710 Call JumpTable_Delay with a pause of 2710.
DD87 CALL JumpTable_Delay
DD8A CALL $028E Call KEY_SCAN.
DD8D LD A,E Jump to Wait_Keypress if no key is pressed.
DD8E INC A
DD8F JR Z,Wait_Keypress
DD91 RET Return.
This entry point is used by the routine at Handler_Keyboard.
Fire event 09 (suicide / restart).
Cheat_LoseLife DD92 LD A,$09 Jump to Dispatch_Events with event 09.
DD94 JP Dispatch_Events
View the equivalent code in Booty.
Prev: DC26 Up: Map Next: DD97