Prev: E556 Up: Map Next: E62D
E576: Handler: Bullets
Used by the routine at RunHandlers.
Handler_Bullets E576 LD B,$1A B=1A (number of possible bullets).
E578 LD HL,$D2BF HL=Table_Bullets.
Handler_Bullets_Loop E57B PUSH BC Stash current bullet on the stack.
E57C LD A,(HL) Jump to Collision_Bullets_Next if this bullet is not active.
E57D AND A
E57E JP Z,Collision_Bullets_Next
This bullet is active so let's process it.
E581 INC HL Increment HL by one.
E582 LD C,(HL) C=*HL.
E583 INC HL Increment HL by one.
E584 LD B,(HL) B=*HL.
E585 PUSH HL Stash the bullet table pointer on the stack.
E586 CP $80 Jump to Handler_Bullets_4 if A is higher than 80.
E588 JP NC,Handler_Bullets_4
E58B CP $05 Jump to Handler_Bullets_3 if A is equal to 05.
E58D JR Z,Handler_Bullets_3
E58F CP $04 Jump to Handler_Bullets_2 if A is equal to 04.
E591 JR Z,Handler_Bullets_2
E593 CP $03 Jump to Handler_Bullets_1 if A is equal to 03.
E595 JR Z,Handler_Bullets_1
E597 CP $02 Jump to Handler_Bullets_0 if A is equal to 02.
E599 JR Z,Handler_Bullets_0
E59B INC B Increment B by one.
E59C JR Handler_Bullets_9 Jump to Handler_Bullets_9.
Handler_Bullets_0 E59E INC C Increment C by one.
E59F INC B Increment B by one.
E5A0 JR Handler_Bullets_9 Jump to Handler_Bullets_9.
Handler_Bullets_1 E5A2 INC C Increment C by one.
E5A3 JR Handler_Bullets_9 Jump to Handler_Bullets_9.
Handler_Bullets_2 E5A5 DEC B Decrease B by one.
E5A6 INC C Increment C by one.
E5A7 JR Handler_Bullets_9 Jump to Handler_Bullets_9.
Handler_Bullets_3 E5A9 DEC B Decrease B by one.
E5AA JR Handler_Bullets_9 Jump to Handler_Bullets_9.
Handler_Bullets_4 E5AC AND %00001111 Keep only bits 0-3.
E5AE CP $05 Jump to Handler_Bullets_8 if A is equal to 05.
E5B0 JR Z,Handler_Bullets_8
E5B2 CP $04 Jump to Handler_Bullets_7 if A is equal to 04.
E5B4 JR Z,Handler_Bullets_7
E5B6 CP $03 Jump to Handler_Bullets_6 if A is equal to 03.
E5B8 JR Z,Handler_Bullets_6
E5BA CP $02 Jump to Handler_Bullets_5 if A is equal to 02.
E5BC JR Z,Handler_Bullets_5
E5BE INC B Increment B by one.
E5BF JR Handler_Bullets_9 Jump to Handler_Bullets_9.
Handler_Bullets_5 E5C1 DEC C Decrease C by one.
E5C2 INC B Increment B by one.
E5C3 JR Handler_Bullets_9 Jump to Handler_Bullets_9.
Handler_Bullets_6 E5C5 DEC C Decrease C by one.
E5C6 JR Handler_Bullets_9 Jump to Handler_Bullets_9.
Handler_Bullets_7 E5C8 DEC B Decrease B by one.
E5C9 DEC C Decrease C by one.
E5CA JR Handler_Bullets_9 Jump to Handler_Bullets_9.
Handler_Bullets_8 E5CC DEC B Decrease B by one.
Handler_Bullets_9 E5CD LD A,B A=B.
E5CE CP $18 Jump to Handler_Bullets_11 if A is higher than 18.
E5D0 JR NC,Handler_Bullets_11
E5D2 LD A,C A=C.
E5D3 CP $20 Jump to Handler_Bullets_11 if A is higher than 20.
E5D5 JR NC,Handler_Bullets_11
E5D7 PUSH HL Stash HL on the stack.
E5D8 CALL GetSpriteID Call GetSpriteID.
E5DB AND A Jump to Handler_Bullets_10 if A is zero.
E5DC JR Z,Handler_Bullets_10
E5DE CP $C1 Jump to Handler_Bullets_10 if A is higher than C1.
E5E0 JR NC,Handler_Bullets_10
E5E2 AND %00111111 Keep only bits 0-5.
E5E4 CP $32 Jump to Handler_Bullets_10 if A is higher than 32.
E5E6 JR NC,Handler_Bullets_10
There's been a hit, find out which monster.
E5E8 LD A,(HL) A=*HL.
E5E9 CALL Convert_To_MonsterData Call Convert_To_MonsterData.
Take off one hit point from the monsters energy.
E5EC LD A,$01 A=01 (damage).
E5EE CALL Handler_DecreaseEnergy Call Handler_DecreaseEnergy.
E5F1 POP HL Restore HL from the stack.
E5F2 JR Handler_Bullets_13 Jump to Handler_Bullets_13.
Handler_Bullets_10 E5F4 POP HL Restore HL from the stack.
E5F5 LD (HL),B Write B to *HL.
E5F6 DEC HL Decrease HL by one.
E5F7 LD (HL),C Write C to *HL.
E5F8 LD A,$F4 A=sprite ID F4.
ID Sprite
F4 sprite-244-left
E5FA CALL PrintSprite Call PrintSprite.
E5FD POP HL Restore HL from the stack.
E5FE JR Handler_Bullets_14 Jump to Handler_Bullets_14.
Handler_Bullets_11 E600 DEC HL Decrease HL by two.
E601 DEC HL
E602 LD (HL),$00 Write 00 to *HL.
E604 LD A,($D3F8) Jump to Handler_Bullets_12 if *NumberBullets is not zero.
E607 AND A
E608 JR NZ,Handler_Bullets_12
E60A LD A,($D3F9) Decrease *D3F9 by one.
E60D DEC A
E60E LD ($D3F9),A
E611 POP HL Restore HL from the stack.
E612 JR Handler_Bullets_14 Jump to Handler_Bullets_14.
Handler_Bullets_12 E614 DEC A Decrease A by one.
E615 LD ($D3F8),A Write A to *NumberBullets.
E618 POP HL Restore HL from the stack.
E619 JR Handler_Bullets_14 Jump to Handler_Bullets_14.
Handler_Bullets_13 E61B LD A,$73 A=sprite ID 73.
ID Sprite
73 sprite-115-left
E61D PUSH HL Stash HL on the stack.
E61E CALL PrintSprite Call PrintSprite.
E621 POP HL Restore HL from the stack.
E622 JR Handler_Bullets_11 Jump to Handler_Bullets_11.
Collision_Bullets_Next E624 INC HL Increment HL by three.
E625 INC HL
Handler_Bullets_14 E626 INC HL
E627 POP BC Restore bullet ID from the stack.
E628 DEC B Decrease bullet ID by one.
E629 JP NZ,Handler_Bullets_Loop Jump to Handler_Bullets_Loop until all bullets have been processed.
E62C RET Return.
Prev: E556 Up: Map Next: E62D