Prev: E62D Up: Map Next: E967
E68C: Handler: Controls
Handler_Controls E68C CALL Controls Call Controls.
E68F AND A Jump to Monster_Idle if no keys are currently being pressed.
E690 JP Z,Monster_Idle
Controls: Jump/ Punch.
Controls_JumpPunch E693 BIT 4,A Jump to Controls_Up if the key for jump/ punch is not being pressed.
E695 JP Z,Controls_Up
E698 XOR %00010000 Flip bit 4.
E69A JR NZ,Handler_Controls_1 Jump to Handler_Controls_1 if the result is not zero.
Handler_Controls_0 E69C LD A,$0A Write 0A to *JumpTable_Pointer.
E69E LD ($D244),A
E6A1 LD A,$01 Write 01 to *Flag_MonsterJumping.
E6A3 LD ($D248),A
E6A6 JP Action_JumpTable Jump to Action_JumpTable.
Handler_Controls_1 E6A9 LD A,($D246) Jump to Handler_Controls_2 if *Flag_MonsterClimbing is zero.
E6AC AND A
E6AD JR Z,Handler_Controls_2
E6AF LD A,$0D Write 0D to *JumpTable_Pointer.
E6B1 LD ($D244),A
E6B4 JP Action_JumpTable Jump to Action_JumpTable.
Handler_Controls_2 E6B7 LD A,($D252) Jump to Handler_Controls_0 if *Active_MonsterControlType is set to "computer controlled".
E6BA AND A
E6BB JR Z,Handler_Controls_0
E6BD LD A,$0E Write 0E to *JumpTable_Pointer.
E6BF LD ($D244),A
E6C2 JP Action_JumpTable Jump to Action_JumpTable.
Controls: Up.
Controls_Up E6C5 BIT 3,A Jump to Controls_Down if the key for up is not being pressed.
E6C7 JP Z,Controls_Down
E6CA LD A,($D247) A=*Flag_Orientation.
Moves the orientation flag into the carry flag.
E6CD RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
E6CE JR C,Handler_Controls_3 Jump to Handler_Controls_3 if the carry flag is set.
E6D0 LD BC,$0102 BC=0102.
E6D3 LD DE,$090F DE=090F.
E6D6 CALL $E0AD Call E0AD.
E6D9 JR Z,Handler_Controls_5 Jump to Handler_Controls_5 if {} is zero.
E6DB LD A,($D248) A=*Flag_MonsterJumping.
E6DE RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
E6DF JP C,Handler_Controls_13 Jump to Handler_Controls_13 if the carry flag is set.
E6E2 JR Handler_Controls_4 Jump to Handler_Controls_4.
Handler_Controls_3 E6E4 LD BC,$0101 BC=0101.
E6E7 LD DE,$090F DE=090F.
E6EA CALL $E0AD Call E0AD.
E6ED JR Z,Handler_Controls_9 Jump to Handler_Controls_9 if {} is zero.
E6EF LD A,($D248) A=*Flag_MonsterJumping.
E6F2 RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
E6F3 JP C,Handler_Controls_13 Jump to Handler_Controls_13 if the carry flag is set.
E6F6 CALL Handler_DecreaseMonsterXPosition Call Handler_DecreaseMonsterXPosition.
Handler_Controls_4 E6F9 LD A,($D24E) A=*Active_MonsterYPosition.
E6FC SUB $04 A-=04.
E6FE LD ($D24E),A Write A to *Active_MonsterYPosition.
E701 XOR A Write 00 to:
E702 LD ($D248),A
E705 LD ($D246),A
E708 LD ($D24C),A
E70B INC A Write 01 to *JumpTable_Pointer.
E70C LD ($D244),A
E70F JP Action_JumpTable Jump to Action_JumpTable.
Handler_Controls_5 E712 LD BC,$0202 BC=0202.
E715 LD DE,$1113 DE=1113.
E718 LD A,($D246) A=*Flag_MonsterClimbing.
E71B RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
E71C JR C,Handler_Controls_7 Jump to Handler_Controls_7 if the carry flag is set.
Handler_Controls_6 E71E INC C Increment C by one.
E71F CALL $E0AD Call E0AD.
E722 JR Z,Handler_Controls_8 Jump to Handler_Controls_8 if {} is zero.
E724 CALL Handler_IncrementMonsterXPosition Call Handler_IncrementMonsterXPosition.
E727 JR Handler_Controls_10 Jump to Handler_Controls_10.
Handler_Controls_7 E729 LD A,($D248) A=*Flag_MonsterJumping.
E72C RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
E72D JR C,Handler_Controls_6 Jump to Handler_Controls_6 if the carry flag is set.
E72F CALL $E0AD Call E0AD.
E732 JR NZ,Handler_Controls_10 Jump to Handler_Controls_10 if {} is not zero.
Handler_Controls_8 E734 LD BC,$0202 BC=0202.
E737 LD DE,$1416 DE=1416.
E73A CALL $E0AD Call E0AD.
E73D JR Z,Handler_Controls_12 Jump to Handler_Controls_12 if {} is zero.
E73F LD A,$01 Write 01 to *Flag_Orientation.
E741 LD ($D247),A
E744 JR Handler_Controls_10 Jump to Handler_Controls_10.
Handler_Controls_9 E746 LD BC,$0202 BC=0202.
E749 LD DE,$1416 DE=1416.
E74C CALL $E0AD Call E0AD.
E74F JR NZ,Handler_Controls_10 Jump to Handler_Controls_10 if {} is not zero.
E751 LD BC,$0203 BC=0203.
E754 LD DE,$1113 DE=1113.
E757 CALL $E0AD Call E0AD.
E75A JR Z,Handler_Controls_12 Jump to Handler_Controls_12 if {} is zero.
E75C XOR A Write 00 to *Flag_Orientation.
E75D LD ($D247),A
E760 CALL Handler_IncrementMonsterXPosition Call Handler_IncrementMonsterXPosition.
Handler_Controls_10 E763 LD A,($D246) A=*Flag_MonsterClimbing.
E766 RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
E767 JR C,Handler_Controls_14 Jump to Handler_Controls_14 if the carry flag is set.
E769 LD A,($D24E) A=*Active_MonsterYPosition.
E76C CP $12 Jump to Handler_Controls_11 if A is no equal to 12.
E76E JR NZ,Handler_Controls_11
E770 SUB $02 A-=02.
E772 LD ($D24E),A Write A to *Active_MonsterYPosition.
Handler_Controls_11 E775 XOR A Write 00 to:
E776 LD ($D248),A
E779 LD ($D24C),A
E77C INC A Set *Flag_MonsterClimbing to "climbing" (01).
E77D LD ($D246),A
E780 LD A,$03 Write 03 to *D24F.
E782 LD ($D24F),A
Handler_Controls_12 E785 LD A,($D248) A=*Flag_MonsterJumping.
E788 RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
E789 JR C,Handler_Controls_13 Jump to Handler_Controls_13 if the carry flag is set.
E78B XOR A Write 00 to:
E78C LD ($D248),A
E78F LD ($D24C),A
E792 JP $EF86 Jump to EF86.
Handler_Controls_13 E795 LD HL,$D247 HL=Flag_Orientation.
E798 LD A,(HL) A=*HL.
E799 XOR %00000001 Flip bit 0.
E79B INC HL Increment HL by one.
E79C AND (HL) Merge the bits from *HL.
E79D CALL NZ,Handler_IncrementMonsterXPosition Call Handler_IncrementMonsterXPosition not zero.
E7A0 LD A,($D246) A=*Flag_MonsterClimbing.
E7A3 RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
E7A4 CALL C,Handler_DecreaseMonsterYPosition Call Handler_DecreaseMonsterYPosition if the carry flag is set.
E7A7 JP $EB2F Jump to EB2F.
Handler_Controls_14 E7AA LD A,$03 Write 03 to *D24F.
E7AC LD ($D24F),A
E7AF LD DE,($D253) DE=*D253.
E7B3 CALL $DA0F Call DA0F.
E7B6 LD A,($D245) A=*D245.
E7B9 AND %00000001 Keep only bit 0.
E7BB XOR %00000001 Flip bit 0.
E7BD LD (IX+$05),A Write A to *IX+05.
E7C0 CALL Z,Handler_DecreaseMonsterYPosition Call Handler_DecreaseMonsterYPosition zero.
E7C3 LD A,$08 Write 08 to *IX+00.
E7C5 LD (IX+$00),A
E7C8 XOR A Write 00 to:
E7C9 LD ($D248),A
E7CC LD ($D24C),A
E7CF INC A Set *Flag_MonsterClimbing to "climbing" (01).
E7D0 LD ($D246),A
E7D3 LD A,$03 Write 03 to:
E7D5 LD ($D244),A
E7D8 LD ($D245),A
E7DB JP Action_JumpTable Jump to Action_JumpTable.
Controls: Down.
Controls_Down E7DE BIT 2,A Jump to Controls_Left if the key for down is not being pressed.
E7E0 JP Z,Controls_Left
E7E3 LD A,($D24E) Jump to Handler_Controls_22 if *Active_MonsterYPosition is equal to 10.
E7E6 CP $10
E7E8 JP Z,Handler_Controls_22
E7EB LD A,($D247) A=*Flag_Orientation.
Moves the orientation flag into the carry flag.
E7EE RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
E7EF JR C,Handler_Controls_16 Jump to Handler_Controls_16 if the carry flag is set.
E7F1 LD BC,$0502 BC=0502.
E7F4 LD DE,$090F DE=090F.
E7F7 CALL $E0AD Call E0AD.
E7FA LD C,$02 C=02.
E7FC JR Z,Handler_Controls_18 Jump to Handler_Controls_18 if {} is zero.
E7FE LD BC,$0602 BC=0602.
E801 LD DE,$1416 DE=1416.
E804 CALL $E0AD Call E0AD.
E807 JR Z,Handler_Controls_15 Jump to Handler_Controls_15 if {} is zero.
E809 LD A,$01 A=01.
E80B JP Handler_Controls_21 Jump to Handler_Controls_21.
Handler_Controls_15 E80E LD BC,$0602 BC=0602.
E811 LD DE,$1113 DE=1113.
E814 CALL $E0AD Call E0AD.
E817 LD C,$02 C=02.
E819 JR Z,Handler_Controls_18 Jump to Handler_Controls_18 if {} is zero.
E81B XOR A A=00.
E81C JP Handler_Controls_21 Jump to Handler_Controls_21.
Handler_Controls_16 E81F LD BC,$0503 BC=0503.
E822 LD DE,$090F DE=090F.
E825 CALL $E0AD Call E0AD.
E828 LD C,$03 C=03.
E82A JR Z,Handler_Controls_18 Jump to Handler_Controls_18 if {} is zero.
E82C LD BC,$0603 BC=0603.
E82F LD DE,$1113 DE=1113.
E832 CALL $E0AD Call E0AD.
E835 JR Z,Handler_Controls_17 Jump to Handler_Controls_17 if {} is zero.
E837 CALL Handler_IncrementMonsterXPosition Call Handler_IncrementMonsterXPosition.
E83A XOR A A=00.
E83B JR Handler_Controls_21 Jump to Handler_Controls_21.
Handler_Controls_17 E83D LD BC,$0603 BC=0603.
E840 LD DE,$1416 DE=1416.
E843 CALL $E0AD Call E0AD.
E846 LD C,$03 C=03.
E848 JR Z,Handler_Controls_18 Jump to Handler_Controls_18 if {} is zero.
E84A CALL Handler_IncrementMonsterXPosition Call Handler_IncrementMonsterXPosition.
E84D LD A,$01 A=01.
E84F JR Handler_Controls_21 Jump to Handler_Controls_21.
Handler_Controls_18 E851 LD A,($D246) A=*Flag_MonsterClimbing.
E854 XOR %00000001 Flip bit 0.
E856 ADD A,$05 A+=05.
E858 LD B,A B=A.
E859 LD DE,$090F DE=090F.
E85C CALL $E0AD Call E0AD.
E85F JR Z,Handler_Controls_19 Jump to Handler_Controls_19 if {} is zero.
E861 XOR A Set *Flag_MonsterClimbing to "not climbing" (00).
E862 LD ($D246),A
E865 INC A Write 01 to:
E866 LD ($D244),A
E869 LD ($D24F),A
E86C LD A,($D247) A=*Flag_Orientation.
Moves the orientation flag into the carry flag.
E86F RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
E870 CALL NC,Handler_DecreaseMonsterXPosition Call Handler_DecreaseMonsterXPosition if the carry flag is not set.
E873 JP $EF86 Jump to EF86.
Handler_Controls_19 E876 LD A,($D246) A=*Flag_MonsterClimbing.
E879 RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
E87A JP NC,$EF86 Jump to EF86 if the carry flag is not set.
E87D LD BC,$0402 BC=0402.
E880 LD DE,$1113 DE=1113.
E883 LD A,($D247) A=*Flag_Orientation.
Moves the orientation flag into the carry flag.
E886 RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
E887 JR NC,Handler_Controls_20 Jump to Handler_Controls_20 if the carry flag is not set.
E889 LD DE,$1416 DE=1416.
Handler_Controls_20 E88C CALL $E0AD Call E0AD.
E88F JP Z,$EF86 Jump to EF86 if {} is zero.
E892 LD A,$02 Write 02 to *D24F.
E894 LD ($D24F),A
E897 LD DE,($D253) DE=*D253.
E89B CALL $DA0F Call DA0F.
E89E LD A,($D245) A=*D245.
E8A1 AND %00000001 Keep only bit 0.
E8A3 LD (IX+$05),A Write A to *IX+05.
E8A6 LD A,$04 Write 04 to:
E8A8 LD (IX+$00),A
E8AB LD ($D244),A
E8AE LD ($D245),A
E8B1 JP Action_JumpTable Jump to Action_JumpTable.
Handler_Controls_21 E8B4 LD ($D247),A Write A to *Flag_Orientation.
E8B7 LD A,($D24E) A=*Active_MonsterYPosition.
E8BA ADD A,$04 A+=04.
E8BC LD ($D24E),A Write A to *Active_MonsterYPosition.
E8BF LD A,$03 Write 03 to:
E8C1 LD ($D244),A
E8C4 LD ($D24F),A
E8C7 LD A,$01 Set *Flag_MonsterClimbing to "climbing" (01).
E8C9 LD ($D246),A
E8CC JP Action_JumpTable Jump to Action_JumpTable.
Handler_Controls_22 E8CF LD A,$12 Write 12 to *Active_MonsterYPosition.
E8D1 LD ($D24E),A
E8D4 LD A,$01 Write 01 to *JumpTable_Pointer.
E8D6 LD ($D244),A
E8D9 LD A,($D247) A=*Flag_Orientation.
Moves the orientation flag into the carry flag.
E8DC RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
E8DD CALL NC,Handler_DecreaseMonsterXPosition Call Handler_DecreaseMonsterXPosition if the carry flag is not set.
E8E0 XOR A Set *Flag_MonsterClimbing to "not climbing" (00).
E8E1 LD ($D246),A
E8E4 JP Action_JumpTable Jump to Action_JumpTable.
Controls: Left.
Controls_Left E8E7 BIT 0,A Jump to Controls_Right if the key for left is not being pressed.
E8E9 JR Z,Controls_Right
E8EB LD A,($D246) A=*Flag_MonsterClimbing.
E8EE RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
E8EF JP C,$EF86 Jump to EF86 if the carry flag is set.
E8F2 LD A,$01 Write 01 to *D24F.
E8F4 LD ($D24F),A
E8F7 LD DE,($D253) DE=*D253.
E8FB CALL $DA0F Call DA0F.
E8FE LD A,($D24D) A=*Active_MonsterXPosition.
E901 DEC A Decrease A by one.
E902 CP $FC Jump to EF86 if A is equal to FC.
E904 JP Z,$EF86
E907 LD ($D24D),A Write A to *Active_MonsterXPosition.
E90A XOR A Write 00 to *IX+05.
E90B LD (IX+$05),A
E90E INC A Write 01 to *Flag_Orientation.
E90F LD ($D247),A
E912 INC A Write 02 to:
E913 LD (IX+$00),A
E916 LD ($D244),A
E919 JP Action_JumpTable Jump to Action_JumpTable.
Controls: Right.
Controls_Right E91C BIT 1,A Jump to Monster_Idle if the key for right is not being pressed.
E91E JR Z,Monster_Idle
E920 LD A,($D246) A=*Flag_MonsterClimbing.
E923 RRCA Rotate A right one position, setting the carry flag if bit 0 was set.
E924 JP C,$EF86 Jump to EF86 if the carry flag is set.
E927 LD A,$01 Write 01 to *D24F.
E929 LD ($D24F),A
E92C LD DE,($D253) DE=*D253.
E930 CALL $DA0F Call DA0F.
E933 LD A,($D24D) A=*Active_MonsterXPosition.
E936 INC A Increment A by one.
E937 CP $1E Jump to EF86 if A is equal to 1E.
E939 JP Z,$EF86
E93C LD ($D24D),A Write A to *Active_MonsterXPosition.
E93F XOR A Write 00 to:
E940 LD (IX+$05),A
E943 LD ($D247),A
E946 INC A Write 01 to:
E947 LD (IX+$00),A
E94A LD ($D244),A
E94D JP Action_JumpTable Jump to Action_JumpTable.
No keys are being pressed so decrease the waiting countdown.
Monster_Idle E950 LD A,($D249) Decrease *Active_MonsterIdleCountdown by one.
E953 DEC A
E954 LD ($D249),A
E957 JP NZ,$EF86 Jump to EF86 if *Active_MonsterIdleCountdown is not yet zero.
The idle countdown is finished, so reset the countdown and mark the action event.
E95A LD A,$19 Write 19 to *Active_MonsterIdleCountdown.
E95C LD ($D249),A
E95F LD A,$05 Write "waiting" (05) to *JumpTable_Pointer.
E961 LD ($D244),A
E964 JP Action_JumpTable Jump to Action_JumpTable.
Prev: E62D Up: Map Next: E967