Prev: 56358 Up: Map Next: 56727
56418: Handler: Enemies
Used by the routine at Dispatch_Handlers.
Animates the 14-byte records at *ReferenceEnemies.
Handler_Enemies 56418 LD HL,36976 Write Graphics_TileFont to *CHARS.
56421 LD (23606),HL
56424 LD IX,(25650) IX=*ReferenceEnemies.
Handler_Enemies_Loop 56428 LD A,(IX+0) Return if the terminator 255 is reached.
56431 INC A
56432 RET Z
56433 BIT 7,A Call Pause_LeavingRoom if this enemy is inactive.
56435 CALL NZ,Pause_LeavingRoom
56438 JP NZ,Handler_Enemies_Next Jump to Handler_Enemies_Next if it is inactive.
56441 LD A,(IX+6) Jump to Handler_Enemies_Probe if the sprite ID is 226 or higher.
56444 CP 226
56446 JR NC,Handler_Enemies_Probe
Wrap the walking-enemy frame.
56448 ADD A,6 C=the sprite ID+6.
56450 LD C,A
56451 LD B,36 B=36.
Handler_Enemies_BelowPlayer 56453 SUB B Subtract 36 until the frame is in range.
56454 JR Z,Handler_Enemies_AbovePlayer
56456 JR C,Handler_Enemies_CommitFrame
56458 JR Handler_Enemies_BelowPlayer
Handler_Enemies_AbovePlayer 56460 LD A,C C=C-36.
56461 SUB B
56462 LD C,A
Handler_Enemies_CommitFrame 56463 LD (IX+6),C Write the wrapped sprite ID.
Handler_Enemies_Probe 56466 LD A,(IX+2) Jump to Handler_Enemies_Update unless the fine-X is 7.
56469 CP 7
56471 JR NZ,Handler_Enemies_Update
56473 BIT 7,(IX+7) Jump to Handler_Enemies_ProbeLeft if the enemy is facing left.
56477 JR Z,Handler_Enemies_ProbeLeft
56479 LD C,(IX+0) Probe the cell above and to the right.
56482 LD A,(IX+1)
56485 SUB (IX+5)
56488 LD B,A
56489 INC C
Reverse if that Buffer_RoomTiles tile is solid.
56490 CALL JumpTable_SetPrintPosition Call JumpTable_SetPrintPosition.
56493 LD HL,(25618) Point HL at that Buffer_RoomTiles tile.
56496 LD DE,24014
56499 ADD HL,DE
56500 LD A,(HL) Call Reverse_Direction if the tile is solid.
56501 CP 16
56503 CALL NC,Reverse_Direction
56506 JR Handler_Enemies_Update Jump to Handler_Enemies_Update.
Handler_Enemies_ProbeLeft 56508 LD A,(IX+1) Jump to Handler_Enemies_Update if the enemy is past column 35.
56511 SUB (IX+5)
56514 LD B,A
56515 LD A,(IX+0)
56518 CP 35
56520 JR NC,Handler_Enemies_Update
Probe the cell to the left.
56522 SUB (IX+4) C=the column minus the width.
56525 LD C,A
56526 CALL JumpTable_SetPrintPosition Call JumpTable_SetPrintPosition.
56529 LD HL,(25618) Point HL at that Buffer_RoomTiles tile.
56532 LD DE,24014
56535 ADD HL,DE
56536 LD A,(HL) Call Reverse_Direction if the tile is solid.
56537 CP 16
56539 CALL NC,Reverse_Direction
Handler_Enemies_Update 56542 CALL JumpTable_AdvanceEntity Call JumpTable_AdvanceEntity.
56545 CALL JumpTable_StorePosition Call JumpTable_StorePosition.
56548 CALL JumpTable_MoveEntity Call JumpTable_MoveEntity.
56551 CALL JumpTable_DrawEntity Call JumpTable_DrawEntity.
56554 CALL JumpTable_EraseEntity Call JumpTable_EraseEntity.
Handler_Enemies_Next 56557 LD DE,14 IX+=0014.
56560 ADD IX,DE
56562 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 22 to 0).
Cheat_NextRoom 56565 POP BC Restore BC from the stack.
56566 LD A,(25762) A=*CurrentRoom+1, or 0 after room 22.
56569 INC A
56570 CP 23
56572 JP NZ,Change_Room
56575 XOR A Jump to Change_Room.
56576 JP Change_Room
This entry point is used by the routine at Handler_Keyboard.
Move to the previous room (wrapping from 0 to 22).
Cheat_PreviousRoom 56579 POP BC Restore BC from the stack.
56580 LD A,(25762) A=*CurrentRoom-1, or 22 before room 0.
56583 DEC A
56584 CP 255
56586 JP NZ,Change_Room
56589 LD A,22
56591 JP Change_Room Jump to Change_Room.
Point IX at SkipDelayFlag and set DE to the number of bytes through to 31847.
Tape_BlockRange 56594 LD IX,25724 DE=31847-SkipDelayFlag.
56598 LD DE,25724
56601 LD HL,31847
56604 XOR A A=255.
56605 SBC HL,DE
56607 EX DE,HL Return.
56608 DEC A
56609 RET
This entry point is used by the routine at Handler_Keyboard.
Save the game to tape.
Tape_Save 56610 CALL Tape_Checksum Write the checksum from Tape_Checksum to *TapeChecksum.
56613 LD (25736),A
56616 POP BC Restore BC from the stack.
56617 CALL Tape_BlockRange Call Tape_BlockRange.
56620 CALL 1218 Call SA_BYTES.
56623 LD A,(25762) Set bit 7 of *CurrentRoom.
56626 SET 7,A
56628 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 56631 LD HL,15360 Write 15360 to *CHARS.
56634 LD (23606),HL
56637 LD HL,59364 Print the messaging at Messaging_LoadGame.
56640 CALL JumpTable_PrintMessage
Tape_Load_Wait 56643 LD BC,10000 Call JumpTable_Delay with a pause of 10000.
56646 CALL JumpTable_Delay
56649 CALL 654 Call KEY_SCAN.
56652 LD A,E Jump to Tape_Load_Wait if no key is pressed.
56653 CP 255
56655 JR Z,Tape_Load_Wait
56657 CP 2 Jump to Tape_Load_Resume unless "2" was pressed.
56659 JR NZ,Tape_Load_Resume
56661 POP BC Restore BC from the stack.
56662 CALL Tape_BlockRange Call Tape_BlockRange.
56665 SCF Call LD_BYTES with carry set.
56666 CALL 1366
56669 CALL Tape_Checksum Jump to Reset_Introduction if the checksum does not match.
56672 CP L
56673 JP NZ,Reset_Introduction
Tape_Load_Resume 56676 LD A,(25762) Set bit 7 of *CurrentRoom.
56679 SET 7,A
56681 JP Change_Room Jump to Change_Room.
Add every byte from SkipDelayFlag through the tape block.
Tape_Checksum 56684 CALL Tape_BlockRange Call Tape_BlockRange.
56687 XOR A A=0 and clear *TapeChecksum.
56688 LD HL,(25736)
56691 LD (25736),A
56694 LD H,A
Tape_Checksum_Loop 56695 ADD A,(IX+0) Add *(IX) into A until DE is zero.
56698 LD H,A
56699 INC IX
56701 DEC DE
56702 LD A,E
56703 OR D
56704 LD A,H
56705 JR NZ,Tape_Checksum_Loop
56707 RET Return.
This entry point is used by the routine at Handler_Keyboard.
Wait for any key.
Wait_Keypress 56708 LD BC,10000 Call JumpTable_Delay with a pause of 10000.
56711 CALL JumpTable_Delay
56714 CALL 654 Call KEY_SCAN.
56717 LD A,E Jump to Wait_Keypress if no key is pressed.
56718 INC A
56719 JR Z,Wait_Keypress
56721 RET Return.
This entry point is used by the routine at Handler_Keyboard.
Fire event 9 (suicide / restart).
Cheat_LoseLife 56722 LD A,9 Jump to Dispatch_Events with event 9.
56724 JP Dispatch_Events
View the equivalent code in Booty.
Prev: 56358 Up: Map Next: 56727