Prev: 58925 Up: Map Next: 59751
59020: Handler: Controls
Handler_Controls 59020 CALL Controls Call Controls.
59023 AND A Jump to Monster_Idle if no keys are currently being pressed.
59024 JP Z,Monster_Idle
Controls: Jump/ Punch.
Controls_JumpPunch 59027 BIT 4,A Jump to Controls_Up if the key for jump/ punch is not being pressed.
59029 JP Z,Controls_Up
59032 XOR %00010000 Flip bit 4.
59034 JR NZ,Handler_Controls_1 Jump to Handler_Controls_1 if the result is not zero.
Handler_Controls_0 59036 LD A,10 Write 10 to *JumpTable_Pointer.
59038 LD (53828),A
59041 LD A,1 Write 1 to *Flag_MonsterJumping.
59043 LD (53832),A
59046 JP Action_JumpTable Jump to Action_JumpTable.
Handler_Controls_1 59049 LD A,(53830) Jump to Handler_Controls_2 if *Flag_MonsterClimbing is zero.
59052 AND A
59053 JR Z,Handler_Controls_2
59055 LD A,13 Write 13 to *JumpTable_Pointer.
59057 LD (53828),A
59060 JP Action_JumpTable Jump to Action_JumpTable.
Handler_Controls_2 59063 LD A,(53842) Jump to Handler_Controls_0 if *Active_MonsterControlType is set to "computer controlled".
59066 AND A
59067 JR Z,Handler_Controls_0
59069 LD A,14 Write 14 to *JumpTable_Pointer.
59071 LD (53828),A
59074 JP Action_JumpTable Jump to Action_JumpTable.
Controls: Up.
Controls_Up 59077 BIT 3,A Jump to Controls_Down if the key for up is not being pressed.
59079 JP Z,Controls_Down
59082 LD A,(53831) A=*Flag_Orientation.
Moves the orientation flag into the carry flag.
59085 RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
59086 JR C,Handler_Controls_3 Jump to Handler_Controls_3 if the carry flag is set.
59088 LD BC,258 BC=258.
59091 LD DE,2319 DE=2319.
59094 CALL 57517 Call 57517.
59097 JR Z,Handler_Controls_5 Jump to Handler_Controls_5 if {} is zero.
59099 LD A,(53832) A=*Flag_MonsterJumping.
59102 RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
59103 JP C,Handler_Controls_13 Jump to Handler_Controls_13 if the carry flag is set.
59106 JR Handler_Controls_4 Jump to Handler_Controls_4.
Handler_Controls_3 59108 LD BC,257 BC=257.
59111 LD DE,2319 DE=2319.
59114 CALL 57517 Call 57517.
59117 JR Z,Handler_Controls_9 Jump to Handler_Controls_9 if {} is zero.
59119 LD A,(53832) A=*Flag_MonsterJumping.
59122 RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
59123 JP C,Handler_Controls_13 Jump to Handler_Controls_13 if the carry flag is set.
59126 CALL Handler_DecreaseMonsterXPosition Call Handler_DecreaseMonsterXPosition.
Handler_Controls_4 59129 LD A,(53838) A=*Active_MonsterYPosition.
59132 SUB 4 A-=4.
59134 LD (53838),A Write A to *Active_MonsterYPosition.
59137 XOR A Write 0 to:
59138 LD (53832),A
59141 LD (53830),A
59144 LD (53836),A
59147 INC A Write 1 to *JumpTable_Pointer.
59148 LD (53828),A
59151 JP Action_JumpTable Jump to Action_JumpTable.
Handler_Controls_5 59154 LD BC,514 BC=514.
59157 LD DE,4371 DE=4371.
59160 LD A,(53830) A=*Flag_MonsterClimbing.
59163 RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
59164 JR C,Handler_Controls_7 Jump to Handler_Controls_7 if the carry flag is set.
Handler_Controls_6 59166 INC C Increment C by one.
59167 CALL 57517 Call 57517.
59170 JR Z,Handler_Controls_8 Jump to Handler_Controls_8 if {} is zero.
59172 CALL Handler_IncrementMonsterXPosition Call Handler_IncrementMonsterXPosition.
59175 JR Handler_Controls_10 Jump to Handler_Controls_10.
Handler_Controls_7 59177 LD A,(53832) A=*Flag_MonsterJumping.
59180 RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
59181 JR C,Handler_Controls_6 Jump to Handler_Controls_6 if the carry flag is set.
59183 CALL 57517 Call 57517.
59186 JR NZ,Handler_Controls_10 Jump to Handler_Controls_10 if {} is not zero.
Handler_Controls_8 59188 LD BC,514 BC=514.
59191 LD DE,5142 DE=5142.
59194 CALL 57517 Call 57517.
59197 JR Z,Handler_Controls_12 Jump to Handler_Controls_12 if {} is zero.
59199 LD A,1 Write 1 to *Flag_Orientation.
59201 LD (53831),A
59204 JR Handler_Controls_10 Jump to Handler_Controls_10.
Handler_Controls_9 59206 LD BC,514 BC=514.
59209 LD DE,5142 DE=5142.
59212 CALL 57517 Call 57517.
59215 JR NZ,Handler_Controls_10 Jump to Handler_Controls_10 if {} is not zero.
59217 LD BC,515 BC=515.
59220 LD DE,4371 DE=4371.
59223 CALL 57517 Call 57517.
59226 JR Z,Handler_Controls_12 Jump to Handler_Controls_12 if {} is zero.
59228 XOR A Write 0 to *Flag_Orientation.
59229 LD (53831),A
59232 CALL Handler_IncrementMonsterXPosition Call Handler_IncrementMonsterXPosition.
Handler_Controls_10 59235 LD A,(53830) A=*Flag_MonsterClimbing.
59238 RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
59239 JR C,Handler_Controls_14 Jump to Handler_Controls_14 if the carry flag is set.
59241 LD A,(53838) A=*Active_MonsterYPosition.
59244 CP 18 Jump to Handler_Controls_11 if A is no equal to 18.
59246 JR NZ,Handler_Controls_11
59248 SUB 2 A-=2.
59250 LD (53838),A Write A to *Active_MonsterYPosition.
Handler_Controls_11 59253 XOR A Write 0 to:
59254 LD (53832),A
59257 LD (53836),A
59260 INC A Set *Flag_MonsterClimbing to "climbing" (1).
59261 LD (53830),A
59264 LD A,3 Write 3 to *53839.
59266 LD (53839),A
Handler_Controls_12 59269 LD A,(53832) A=*Flag_MonsterJumping.
59272 RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
59273 JR C,Handler_Controls_13 Jump to Handler_Controls_13 if the carry flag is set.
59275 XOR A Write 0 to:
59276 LD (53832),A
59279 LD (53836),A
59282 JP 61318 Jump to 61318.
Handler_Controls_13 59285 LD HL,53831 HL=Flag_Orientation.
59288 LD A,(HL) A=*HL.
59289 XOR %00000001 Flip bit 0.
59291 INC HL Increment HL by one.
59292 AND (HL) Merge the bits from *HL.
59293 CALL NZ,Handler_IncrementMonsterXPosition Call Handler_IncrementMonsterXPosition not zero.
59296 LD A,(53830) A=*Flag_MonsterClimbing.
59299 RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
59300 CALL C,Handler_DecreaseMonsterYPosition Call Handler_DecreaseMonsterYPosition if the carry flag is set.
59303 JP 60207 Jump to 60207.
Handler_Controls_14 59306 LD A,3 Write 3 to *53839.
59308 LD (53839),A
59311 LD DE,(53843) DE=*53843.
59315 CALL 55823 Call 55823.
59318 LD A,(53829) A=*53829.
59321 AND %00000001 Keep only bit 0.
59323 XOR %00000001 Flip bit 0.
59325 LD (IX+5),A Write A to *IX+5.
59328 CALL Z,Handler_DecreaseMonsterYPosition Call Handler_DecreaseMonsterYPosition zero.
59331 LD A,8 Write 8 to *IX+0.
59333 LD (IX+0),A
59336 XOR A Write 0 to:
59337 LD (53832),A
59340 LD (53836),A
59343 INC A Set *Flag_MonsterClimbing to "climbing" (1).
59344 LD (53830),A
59347 LD A,3 Write 3 to:
59349 LD (53828),A
59352 LD (53829),A
59355 JP Action_JumpTable Jump to Action_JumpTable.
Controls: Down.
Controls_Down 59358 BIT 2,A Jump to Controls_Left if the key for down is not being pressed.
59360 JP Z,Controls_Left
59363 LD A,(53838) Jump to Handler_Controls_22 if *Active_MonsterYPosition is equal to 16.
59366 CP 16
59368 JP Z,Handler_Controls_22
59371 LD A,(53831) A=*Flag_Orientation.
Moves the orientation flag into the carry flag.
59374 RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
59375 JR C,Handler_Controls_16 Jump to Handler_Controls_16 if the carry flag is set.
59377 LD BC,1282 BC=1282.
59380 LD DE,2319 DE=2319.
59383 CALL 57517 Call 57517.
59386 LD C,2 C=2.
59388 JR Z,Handler_Controls_18 Jump to Handler_Controls_18 if {} is zero.
59390 LD BC,1538 BC=1538.
59393 LD DE,5142 DE=5142.
59396 CALL 57517 Call 57517.
59399 JR Z,Handler_Controls_15 Jump to Handler_Controls_15 if {} is zero.
59401 LD A,1 A=1.
59403 JP Handler_Controls_21 Jump to Handler_Controls_21.
Handler_Controls_15 59406 LD BC,1538 BC=1538.
59409 LD DE,4371 DE=4371.
59412 CALL 57517 Call 57517.
59415 LD C,2 C=2.
59417 JR Z,Handler_Controls_18 Jump to Handler_Controls_18 if {} is zero.
59419 XOR A A=0.
59420 JP Handler_Controls_21 Jump to Handler_Controls_21.
Handler_Controls_16 59423 LD BC,1283 BC=1283.
59426 LD DE,2319 DE=2319.
59429 CALL 57517 Call 57517.
59432 LD C,3 C=3.
59434 JR Z,Handler_Controls_18 Jump to Handler_Controls_18 if {} is zero.
59436 LD BC,1539 BC=1539.
59439 LD DE,4371 DE=4371.
59442 CALL 57517 Call 57517.
59445 JR Z,Handler_Controls_17 Jump to Handler_Controls_17 if {} is zero.
59447 CALL Handler_IncrementMonsterXPosition Call Handler_IncrementMonsterXPosition.
59450 XOR A A=0.
59451 JR Handler_Controls_21 Jump to Handler_Controls_21.
Handler_Controls_17 59453 LD BC,1539 BC=1539.
59456 LD DE,5142 DE=5142.
59459 CALL 57517 Call 57517.
59462 LD C,3 C=3.
59464 JR Z,Handler_Controls_18 Jump to Handler_Controls_18 if {} is zero.
59466 CALL Handler_IncrementMonsterXPosition Call Handler_IncrementMonsterXPosition.
59469 LD A,1 A=1.
59471 JR Handler_Controls_21 Jump to Handler_Controls_21.
Handler_Controls_18 59473 LD A,(53830) A=*Flag_MonsterClimbing.
59476 XOR %00000001 Flip bit 0.
59478 ADD A,5 A+=5.
59480 LD B,A B=A.
59481 LD DE,2319 DE=2319.
59484 CALL 57517 Call 57517.
59487 JR Z,Handler_Controls_19 Jump to Handler_Controls_19 if {} is zero.
59489 XOR A Set *Flag_MonsterClimbing to "not climbing" (0).
59490 LD (53830),A
59493 INC A Write 1 to:
59494 LD (53828),A
59497 LD (53839),A
59500 LD A,(53831) A=*Flag_Orientation.
Moves the orientation flag into the carry flag.
59503 RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
59504 CALL NC,Handler_DecreaseMonsterXPosition Call Handler_DecreaseMonsterXPosition if the carry flag is not set.
59507 JP 61318 Jump to 61318.
Handler_Controls_19 59510 LD A,(53830) A=*Flag_MonsterClimbing.
59513 RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
59514 JP NC,61318 Jump to 61318 if the carry flag is not set.
59517 LD BC,1026 BC=1026.
59520 LD DE,4371 DE=4371.
59523 LD A,(53831) A=*Flag_Orientation.
Moves the orientation flag into the carry flag.
59526 RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
59527 JR NC,Handler_Controls_20 Jump to Handler_Controls_20 if the carry flag is not set.
59529 LD DE,5142 DE=5142.
Handler_Controls_20 59532 CALL 57517 Call 57517.
59535 JP Z,61318 Jump to 61318 if {} is zero.
59538 LD A,2 Write 2 to *53839.
59540 LD (53839),A
59543 LD DE,(53843) DE=*53843.
59547 CALL 55823 Call 55823.
59550 LD A,(53829) A=*53829.
59553 AND %00000001 Keep only bit 0.
59555 LD (IX+5),A Write A to *IX+5.
59558 LD A,4 Write 4 to:
59560 LD (IX+0),A
59563 LD (53828),A
59566 LD (53829),A
59569 JP Action_JumpTable Jump to Action_JumpTable.
Handler_Controls_21 59572 LD (53831),A Write A to *Flag_Orientation.
59575 LD A,(53838) A=*Active_MonsterYPosition.
59578 ADD A,4 A+=4.
59580 LD (53838),A Write A to *Active_MonsterYPosition.
59583 LD A,3 Write 3 to:
59585 LD (53828),A
59588 LD (53839),A
59591 LD A,1 Set *Flag_MonsterClimbing to "climbing" (1).
59593 LD (53830),A
59596 JP Action_JumpTable Jump to Action_JumpTable.
Handler_Controls_22 59599 LD A,18 Write 18 to *Active_MonsterYPosition.
59601 LD (53838),A
59604 LD A,1 Write 1 to *JumpTable_Pointer.
59606 LD (53828),A
59609 LD A,(53831) A=*Flag_Orientation.
Moves the orientation flag into the carry flag.
59612 RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
59613 CALL NC,Handler_DecreaseMonsterXPosition Call Handler_DecreaseMonsterXPosition if the carry flag is not set.
59616 XOR A Set *Flag_MonsterClimbing to "not climbing" (0).
59617 LD (53830),A
59620 JP Action_JumpTable Jump to Action_JumpTable.
Controls: Left.
Controls_Left 59623 BIT 0,A Jump to Controls_Right if the key for left is not being pressed.
59625 JR Z,Controls_Right
59627 LD A,(53830) A=*Flag_MonsterClimbing.
59630 RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
59631 JP C,61318 Jump to 61318 if the carry flag is set.
59634 LD A,1 Write 1 to *53839.
59636 LD (53839),A
59639 LD DE,(53843) DE=*53843.
59643 CALL 55823 Call 55823.
59646 LD A,(53837) A=*Active_MonsterXPosition.
59649 DEC A Decrease A by one.
59650 CP 252 Jump to 61318 if A is equal to 252.
59652 JP Z,61318
59655 LD (53837),A Write A to *Active_MonsterXPosition.
59658 XOR A Write 0 to *IX+5.
59659 LD (IX+5),A
59662 INC A Write 1 to *Flag_Orientation.
59663 LD (53831),A
59666 INC A Write 2 to:
59667 LD (IX+0),A
59670 LD (53828),A
59673 JP Action_JumpTable Jump to Action_JumpTable.
Controls: Right.
Controls_Right 59676 BIT 1,A Jump to Monster_Idle if the key for right is not being pressed.
59678 JR Z,Monster_Idle
59680 LD A,(53830) A=*Flag_MonsterClimbing.
59683 RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
59684 JP C,61318 Jump to 61318 if the carry flag is set.
59687 LD A,1 Write 1 to *53839.
59689 LD (53839),A
59692 LD DE,(53843) DE=*53843.
59696 CALL 55823 Call 55823.
59699 LD A,(53837) A=*Active_MonsterXPosition.
59702 INC A Increment A by one.
59703 CP 30 Jump to 61318 if A is equal to 30.
59705 JP Z,61318
59708 LD (53837),A Write A to *Active_MonsterXPosition.
59711 XOR A Write 0 to:
59712 LD (IX+5),A
59715 LD (53831),A
59718 INC A Write 1 to:
59719 LD (IX+0),A
59722 LD (53828),A
59725 JP Action_JumpTable Jump to Action_JumpTable.
No keys are being pressed so decrease the waiting countdown.
Monster_Idle 59728 LD A,(53833) Decrease *Active_MonsterIdleCountdown by one.
59731 DEC A
59732 LD (53833),A
59735 JP NZ,61318 Jump to 61318 if *Active_MonsterIdleCountdown is not yet zero.
The idle countdown is finished, so reset the countdown and mark the action event.
59738 LD A,25 Write 25 to *Active_MonsterIdleCountdown.
59740 LD (53833),A
59743 LD A,5 Write "waiting" (5) to *JumpTable_Pointer.
59745 LD (53828),A
59748 JP Action_JumpTable Jump to Action_JumpTable.
Prev: 58925 Up: Map Next: 59751