Prev: 40368 Up: Map Next: 40492
40384: Handler: Laser Beam
Used by the routine at 36102.
Only handle the laser beam on every 4th frame.
Handler_LaserBeam 40384 LD A,(24130)
40387 AND %00000001 Keep only bit 0.
40389 RET NZ
Search for a "free" laser beam slot.
40390 LD HL,24576 HL=Laser_Param_1.
40393 LD DE,24 DE=0024 (each slot is 24 bytes).
40396 LD B,4 B=4 (counter; there are 4 "slots").
LaserBeam_Slot 40398 LD A,(HL) If the slot is not in use, jump to Init_LaserBeam.
40399 AND A
40400 JR Z,Init_LaserBeam
40402 ADD HL,DE HL=HL+DE (move onto the next slot).
40403 DJNZ LaserBeam_Slot Decrease counter by one and loop back to LaserBeam_Slot until counter is zero.
All laser beam slots are in use so just return...
40405 RET Return.
Possibly the "shoot right" code?
Handler_LaserBeam_0 40406 ADD A,16 A=A+16.
40408 OR %00000100 Set bit 2.
40410 AND %11111110 Keep only bits 1-7.
40412 JR Handler_LaserBeam_2 Jump to Handler_LaserBeam_2.
Initialise a new laser beam.
Init_LaserBeam 40414 LD (HL),17 Mark the laser beam slot as "in-use".
40416 INC HL HL=Laser beam Y position.
40417 LD DE,24696 DE=24696.
40420 LD B,13
40422 LD A,(DE)
40423 INC DE
40424 DEC A
40425 BIT 3,A
40427 JR Z,Handler_LaserBeam_1
40429 DEC B
40430 DEC B
Handler_LaserBeam_1 40431 AND 4
40433 LD A,(DE)
40434 JR NZ,Handler_LaserBeam_0
40436 SUB 8
40438 AND 248
40440 OR 5
Handler_LaserBeam_2 40442 LD C,A
40443 INC DE
40444 INC DE
40445 INC DE
40446 LD A,(DE)
40447 SUB B
40448 LD (HL),A
40449 INC HL
40450 LD B,3
40452 LD (HL),C
40453 LD A,C
40454 AND 251
Handler_LaserBeam_3 40456 INC HL
40457 LD (HL),A
40458 DJNZ Handler_LaserBeam_3
40460 INC HL
40461 LD A,(24128)
40464 AND 24
40466 ADD A,96
40468 LD (HL),A
40469 INC HL
40470 EX DE,HL
40471 LD HL,40488 HL=Attributes_LaserBeam.
40474 LD A,(24128)
40477 AND 3
40479 LD C,A
40480 LD B,0
40482 ADD HL,BC
40483 LD A,(HL)
40484 LD (DE),A
40485 JP SoundsLaserBeam Jump to SoundsLaserBeam.
All the attributes a laser beam can be.
Attributes_LaserBeam 40488 DEFB 71,67,67,69
View the equivalent code in;
Prev: 40368 Up: Map Next: 40492