|  | Routines | 
| Prev: 9DB0 | Up: Map | Next: 9E2C | 
| 
Used by the routine at 8D06.
 | ||||
| 
Only handle the laser beam on every 4th frame.
 | ||||
| Handler_LaserBeam | 9DC0 | LD A,($5E42) | ||
| 9DC3 | AND %00000001 | Keep only bit 0. | ||
| 9DC5 | RET NZ | |||
| 
Search for a "free" laser beam slot.
 | ||||
| 9DC6 | LD HL,$6000 | HL=Laser_Param_1. | ||
| 9DC9 | LD DE,$0018 | DE=0018 (each slot is 18 bytes). | ||
| 9DCC | LD B,$04 | B=04 (counter; there are 4 "slots"). | ||
| LaserBeam_Slot | 9DCE | LD A,(HL) | If the slot is not in use, jump to Init_LaserBeam. | |
| 9DCF | AND A | |||
| 9DD0 | JR Z,Init_LaserBeam | |||
| 9DD2 | ADD HL,DE | HL=HL+DE (move onto the next slot). | ||
| 9DD3 | 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...
 | ||||
| 9DD5 | RET | Return. | ||
| 
Possibly the "shoot right" code?
 | ||||
| Handler_LaserBeam_0 | 9DD6 | ADD A,$10 | A=A+10. | |
| 9DD8 | OR %00000100 | Set bit 2. | ||
| 9DDA | AND %11111110 | Keep only bits 1-7. | ||
| 9DDC | JR Handler_LaserBeam_2 | Jump to Handler_LaserBeam_2. | ||
| 
Initialise a new laser beam.
 | ||||
| Init_LaserBeam | 9DDE | LD (HL),$11 | Mark the laser beam slot as "in-use". | |
| 9DE0 | INC HL | HL=Laser beam Y position. | ||
| 9DE1 | LD DE,$6078 | DE=6078. | ||
| 9DE4 | LD B,$0D | |||
| 9DE6 | LD A,(DE) | |||
| 9DE7 | INC DE | |||
| 9DE8 | DEC A | |||
| 9DE9 | BIT 3,A | |||
| 9DEB | JR Z,Handler_LaserBeam_1 | |||
| 9DED | DEC B | |||
| 9DEE | DEC B | |||
| Handler_LaserBeam_1 | 9DEF | AND $04 | ||
| 9DF1 | LD A,(DE) | |||
| 9DF2 | JR NZ,Handler_LaserBeam_0 | |||
| 9DF4 | SUB $08 | |||
| 9DF6 | AND $F8 | |||
| 9DF8 | OR $05 | |||
| Handler_LaserBeam_2 | 9DFA | LD C,A | ||
| 9DFB | INC DE | |||
| 9DFC | INC DE | |||
| 9DFD | INC DE | |||
| 9DFE | LD A,(DE) | |||
| 9DFF | SUB B | |||
| 9E00 | LD (HL),A | |||
| 9E01 | INC HL | |||
| 9E02 | LD B,$03 | |||
| 9E04 | LD (HL),C | |||
| 9E05 | LD A,C | |||
| 9E06 | AND $FB | |||
| Handler_LaserBeam_3 | 9E08 | INC HL | ||
| 9E09 | LD (HL),A | |||
| 9E0A | DJNZ Handler_LaserBeam_3 | |||
| 9E0C | INC HL | |||
| 9E0D | LD A,($5E40) | |||
| 9E10 | AND $18 | |||
| 9E12 | ADD A,$60 | |||
| 9E14 | LD (HL),A | |||
| 9E15 | INC HL | |||
| 9E16 | EX DE,HL | |||
| 9E17 | LD HL,$9E28 | HL=Attributes_LaserBeam. | ||
| 9E1A | LD A,($5E40) | |||
| 9E1D | AND $03 | |||
| 9E1F | LD C,A | |||
| 9E20 | LD B,$00 | |||
| 9E22 | ADD HL,BC | |||
| 9E23 | LD A,(HL) | |||
| 9E24 | LD (DE),A | |||
| 9E25 | JP SoundsLaserBeam | Jump to SoundsLaserBeam. | ||
| 
All the attributes a laser beam can be.
 | ||||
| Attributes_LaserBeam | 9E28 | DEFB $47,$43,$43,$45 | ||
| 
View the equivalent code in; 
 | ||||
| Prev: 9DB0 | Up: Map | Next: 9E2C |