Prev: 58479 Up: Map Next: 58609
58490: Handler: Bomb
Used by the routine at InitialiseGame.
Handler_Bomb 58490 LD A,(58489) Return if *TableBomb_Flag is equal to 0.
58493 CP 0
58495 RET Z
Only continue every other frame.
58496 LD A,(62273) A=*BombFrameSkip.
58499 INC A Increment A by one.
58500 AND %00000001 Ensure A is only ever 0 or 1.
58502 LD (62273),A Write A back to *BombFrameSkip.
58505 CP 0 Return if A is not equal to 0.
58507 RET NZ
Set up the bomb.
58508 LD HL,37452 Write 37452 (Graphics_Bomb) to *CHARS.
58511 LD (23606),HL
58514 LD A,16 Set INK: YELLOW (6).
58516 RST 16
58517 LD A,6
58519 RST 16
The fuse burning down acts as a countdown before the explosion.
58520 LD A,(58485) A=*TableBomb_SpriteID.
58523 ADD A,4 A+=4.
58525 CP 64 Jump to IgniteBomb if A is equal to 64.
58527 JR Z,IgniteBomb
58529 LD (58485),A Write the new frame ID back to *TableBomb_SpriteID.
Print the bomb on the screen.
58532 LD BC,(58479) BC=*TableBomb_Position.
58536 LD DE,514 DE=Set the sprite width/ height (2/ 2).
58539 CALL PrintSprite Call PrintSprite.
58542 RET Return.
The bomb has been lit!
IgniteBomb 58543 LD BC,(58479) BC=*TableBomb_Position.
58547 LD DE,514 DE=Set the sprite width/ height (2/ 2).
58550 CALL PrintSpriteUpdateBuffer Call PrintSpriteUpdateBuffer.
58553 LD A,0 Write 0 to:
58555 LD (65533),A
58558 LD (58489),A
58561 LD A,(62171) Return if an explosion is already in-progress, only one bomb can explode at a time.
58564 CP 0
58566 RET NZ
There are 5 sparks, and each occupies 6 bytes.
58567 LD DE,62171 Copy 0030 bytes of data from TableDefaultBombSparks to TableBombSparks.
58570 LD HL,62201
58573 LD BC,30
58576 LDIR
58578 LD BC,(58479) BC=*TableBomb_Position.
58582 DEC B Move down one line.
Update each spark with the starting co-ordinates.
58583 LD IX,62171 IX=TableBombSparks.
58587 LD L,5 L=5 (counter; number of sparks).
SetSparksStartingPosition 58589 LD (IX+0),C Write C to *IX+0.
58592 LD (IX+1),B Write B to *IX+1.
58595 LD DE,6 IX+=0006.
58598 ADD IX,DE
58600 DEC L Decrease spark counter by one.
58601 JR NZ,SetSparksStartingPosition Jump to SetSparksStartingPosition until all sparks have been processed.
58603 LD A,2 Write 2 to *SoundFlag_Bomb.
58605 LD (65533),A
58608 RET Return.
Prev: 58479 Up: Map Next: 58609