Prev: E46F Up: Map Next: E4F1
E47A: Handler: Bomb
Used by the routine at InitialiseGame.
Handler_Bomb E47A LD A,($E479) Return if *TableBomb_Flag is equal to 00.
E47D CP $00
E47F RET Z
Only continue every other frame.
E480 LD A,($F341) A=*BombFrameSkip.
E483 INC A Increment A by one.
E484 AND %00000001 Ensure A is only ever 00 or 01.
E486 LD ($F341),A Write A back to *BombFrameSkip.
E489 CP $00 Return if A is not equal to 00.
E48B RET NZ
Set up the bomb.
E48C LD HL,$924C Write 924C (Graphics_Bomb) to *CHARS.
E48F LD ($5C36),HL
E492 LD A,$10 Set INK: YELLOW (06).
E494 RST $10
E495 LD A,$06
E497 RST $10
The fuse burning down acts as a countdown before the explosion.
E498 LD A,($E475) A=*TableBomb_SpriteID.
E49B ADD A,$04 A+=04.
E49D CP $40 Jump to IgniteBomb if A is equal to 40.
E49F JR Z,IgniteBomb
E4A1 LD ($E475),A Write the new frame ID back to *TableBomb_SpriteID.
Print the bomb on the screen.
E4A4 LD BC,($E46F) BC=*TableBomb_Position.
E4A8 LD DE,$0202 DE=Set the sprite width/ height (02/ 02).
E4AB CALL PrintSprite Call PrintSprite.
E4AE RET Return.
The bomb has been lit!
IgniteBomb E4AF LD BC,($E46F) BC=*TableBomb_Position.
E4B3 LD DE,$0202 DE=Set the sprite width/ height (02/ 02).
E4B6 CALL PrintSpriteUpdateBuffer Call PrintSpriteUpdateBuffer.
E4B9 LD A,$00 Write 00 to:
E4BB LD ($FFFD),A
E4BE LD ($E479),A
E4C1 LD A,($F2DB) Return if an explosion is already in-progress, only one bomb can explode at a time.
E4C4 CP $00
E4C6 RET NZ
There are 05 sparks, and each occupies 06 bytes.
E4C7 LD DE,$F2DB Copy 001E bytes of data from TableDefaultBombSparks to TableBombSparks.
E4CA LD HL,$F2F9
E4CD LD BC,$001E
E4D0 LDIR
E4D2 LD BC,($E46F) BC=*TableBomb_Position.
E4D6 DEC B Move down one line.
Update each spark with the starting co-ordinates.
E4D7 LD IX,$F2DB IX=TableBombSparks.
E4DB LD L,$05 L=05 (counter; number of sparks).
SetSparksStartingPosition E4DD LD (IX+$00),C Write C to *IX+00.
E4E0 LD (IX+$01),B Write B to *IX+01.
E4E3 LD DE,$0006 IX+=0006.
E4E6 ADD IX,DE
E4E8 DEC L Decrease spark counter by one.
E4E9 JR NZ,SetSparksStartingPosition Jump to SetSparksStartingPosition until all sparks have been processed.
E4EB LD A,$02 Write 02 to *SoundFlag_Bomb.
E4ED LD ($FFFD),A
E4F0 RET Return.
Prev: E46F Up: Map Next: E4F1