Routines |
Prev: 58710 | Up: Map | Next: 58925 |
Used by the routine at RunHandlers.
|
|||||||
Handler_Bullets | 58742 | LD B,26 | B=26 (number of possible bullets). | ||||
58744 | LD HL,53951 | HL=Table_Bullets. | |||||
Handler_Bullets_Loop | 58747 | PUSH BC | Stash current bullet on the stack. | ||||
58748 | LD A,(HL) | Jump to Collision_Bullets_Next if this bullet is not active. | |||||
58749 | AND A | ||||||
58750 | JP Z,Collision_Bullets_Next | ||||||
This bullet is active so let's process it.
|
|||||||
58753 | INC HL | Increment HL by one. | |||||
58754 | LD C,(HL) | C=*HL. | |||||
58755 | INC HL | Increment HL by one. | |||||
58756 | LD B,(HL) | B=*HL. | |||||
58757 | PUSH HL | Stash the bullet table pointer on the stack. | |||||
58758 | CP 128 | Jump to Handler_Bullets_4 if A is higher than 128. | |||||
58760 | JP NC,Handler_Bullets_4 | ||||||
58763 | CP 5 | Jump to Handler_Bullets_3 if A is equal to 5. | |||||
58765 | JR Z,Handler_Bullets_3 | ||||||
58767 | CP 4 | Jump to Handler_Bullets_2 if A is equal to 4. | |||||
58769 | JR Z,Handler_Bullets_2 | ||||||
58771 | CP 3 | Jump to Handler_Bullets_1 if A is equal to 3. | |||||
58773 | JR Z,Handler_Bullets_1 | ||||||
58775 | CP 2 | Jump to Handler_Bullets_0 if A is equal to 2. | |||||
58777 | JR Z,Handler_Bullets_0 | ||||||
58779 | INC B | Increment B by one. | |||||
58780 | JR Handler_Bullets_9 | Jump to Handler_Bullets_9. | |||||
Handler_Bullets_0 | 58782 | INC C | Increment C by one. | ||||
58783 | INC B | Increment B by one. | |||||
58784 | JR Handler_Bullets_9 | Jump to Handler_Bullets_9. | |||||
Handler_Bullets_1 | 58786 | INC C | Increment C by one. | ||||
58787 | JR Handler_Bullets_9 | Jump to Handler_Bullets_9. | |||||
Handler_Bullets_2 | 58789 | DEC B | Decrease B by one. | ||||
58790 | INC C | Increment C by one. | |||||
58791 | JR Handler_Bullets_9 | Jump to Handler_Bullets_9. | |||||
Handler_Bullets_3 | 58793 | DEC B | Decrease B by one. | ||||
58794 | JR Handler_Bullets_9 | Jump to Handler_Bullets_9. | |||||
Handler_Bullets_4 | 58796 | AND %00001111 | Keep only bits 0-3. | ||||
58798 | CP 5 | Jump to Handler_Bullets_8 if A is equal to 5. | |||||
58800 | JR Z,Handler_Bullets_8 | ||||||
58802 | CP 4 | Jump to Handler_Bullets_7 if A is equal to 4. | |||||
58804 | JR Z,Handler_Bullets_7 | ||||||
58806 | CP 3 | Jump to Handler_Bullets_6 if A is equal to 3. | |||||
58808 | JR Z,Handler_Bullets_6 | ||||||
58810 | CP 2 | Jump to Handler_Bullets_5 if A is equal to 2. | |||||
58812 | JR Z,Handler_Bullets_5 | ||||||
58814 | INC B | Increment B by one. | |||||
58815 | JR Handler_Bullets_9 | Jump to Handler_Bullets_9. | |||||
Handler_Bullets_5 | 58817 | DEC C | Decrease C by one. | ||||
58818 | INC B | Increment B by one. | |||||
58819 | JR Handler_Bullets_9 | Jump to Handler_Bullets_9. | |||||
Handler_Bullets_6 | 58821 | DEC C | Decrease C by one. | ||||
58822 | JR Handler_Bullets_9 | Jump to Handler_Bullets_9. | |||||
Handler_Bullets_7 | 58824 | DEC B | Decrease B by one. | ||||
58825 | DEC C | Decrease C by one. | |||||
58826 | JR Handler_Bullets_9 | Jump to Handler_Bullets_9. | |||||
Handler_Bullets_8 | 58828 | DEC B | Decrease B by one. | ||||
Handler_Bullets_9 | 58829 | LD A,B | A=B. | ||||
58830 | CP 24 | Jump to Handler_Bullets_11 if A is higher than 24. | |||||
58832 | JR NC,Handler_Bullets_11 | ||||||
58834 | LD A,C | A=C. | |||||
58835 | CP 32 | Jump to Handler_Bullets_11 if A is higher than 32. | |||||
58837 | JR NC,Handler_Bullets_11 | ||||||
58839 | PUSH HL | Stash HL on the stack. | |||||
58840 | CALL GetSpriteID | Call GetSpriteID. | |||||
58843 | AND A | Jump to Handler_Bullets_10 if A is zero. | |||||
58844 | JR Z,Handler_Bullets_10 | ||||||
58846 | CP 193 | Jump to Handler_Bullets_10 if A is higher than 193. | |||||
58848 | JR NC,Handler_Bullets_10 | ||||||
58850 | AND %00111111 | Keep only bits 0-5. | |||||
58852 | CP 50 | Jump to Handler_Bullets_10 if A is higher than 50. | |||||
58854 | JR NC,Handler_Bullets_10 | ||||||
There's been a hit, find out which monster.
|
|||||||
58856 | LD A,(HL) | A=*HL. | |||||
58857 | CALL Convert_To_MonsterData | Call Convert_To_MonsterData. | |||||
Take off one hit point from the monsters energy.
|
|||||||
58860 | LD A,1 | A=1 (damage). | |||||
58862 | CALL Handler_DecreaseEnergy | Call Handler_DecreaseEnergy. | |||||
58865 | POP HL | Restore HL from the stack. | |||||
58866 | JR Handler_Bullets_13 | Jump to Handler_Bullets_13. | |||||
Handler_Bullets_10 | 58868 | POP HL | Restore HL from the stack. | ||||
58869 | LD (HL),B | Write B to *HL. | |||||
58870 | DEC HL | Decrease HL by one. | |||||
58871 | LD (HL),C | Write C to *HL. | |||||
58872 | LD A,244 | A=sprite ID 244.
|
|||||
58874 | CALL PrintSprite | Call PrintSprite. | |||||
58877 | POP HL | Restore HL from the stack. | |||||
58878 | JR Handler_Bullets_14 | Jump to Handler_Bullets_14. | |||||
Handler_Bullets_11 | 58880 | DEC HL | Decrease HL by two. | ||||
58881 | DEC HL | ||||||
58882 | LD (HL),0 | Write 0 to *HL. | |||||
58884 | LD A,(54264) | Jump to Handler_Bullets_12 if *NumberBullets is not zero. | |||||
58887 | AND A | ||||||
58888 | JR NZ,Handler_Bullets_12 | ||||||
58890 | LD A,(54265) | Decrease *54265 by one. | |||||
58893 | DEC A | ||||||
58894 | LD (54265),A | ||||||
58897 | POP HL | Restore HL from the stack. | |||||
58898 | JR Handler_Bullets_14 | Jump to Handler_Bullets_14. | |||||
Handler_Bullets_12 | 58900 | DEC A | Decrease A by one. | ||||
58901 | LD (54264),A | Write A to *NumberBullets. | |||||
58904 | POP HL | Restore HL from the stack. | |||||
58905 | JR Handler_Bullets_14 | Jump to Handler_Bullets_14. | |||||
Handler_Bullets_13 | 58907 | LD A,115 | A=sprite ID 115.
|
||||
58909 | PUSH HL | Stash HL on the stack. | |||||
58910 | CALL PrintSprite | Call PrintSprite. | |||||
58913 | POP HL | Restore HL from the stack. | |||||
58914 | JR Handler_Bullets_11 | Jump to Handler_Bullets_11. | |||||
Collision_Bullets_Next | 58916 | INC HL | Increment HL by three. | ||||
58917 | INC HL | ||||||
Handler_Bullets_14 | 58918 | INC HL | |||||
58919 | POP BC | Restore bullet ID from the stack. | |||||
58920 | DEC B | Decrease bullet ID by one. | |||||
58921 | JP NZ,Handler_Bullets_Loop | Jump to Handler_Bullets_Loop until all bullets have been processed. | |||||
58924 | RET | Return. |
Prev: 58710 | Up: Map | Next: 58925 |