Routines |
Prev: 6DD3 | Up: Map | Next: 6FFC |
Used by the routine at JetmanThrust.
|
||||
Only handle the laser beam on every 4th frame.
|
||||
Handler_LaserBeam | 6F91 | LD A,($5C78) | A=FRAMES. | |
6F94 | AND %00000011 | Keep only bits 0-1. | ||
6F96 | RET NZ | Return if FRAMES is non-zero. | ||
Search for a "free" laser beam slot.
|
||||
6F97 | LD HL,$5D08 | HL=Laser_Param_1. | ||
6F9A | LD DE,$0008 | DE=0008 (each slot is 08 bytes). | ||
6F9D | LD B,$04 | B=04 (counter; there are 4 "slots"). | ||
LaserBeam_Slot | 6F9F | LD A,(HL) | If the slot is not in use, jump to Init_LaserBeam. | |
6FA0 | AND A | |||
6FA1 | JR Z,Init_LaserBeam | |||
6FA3 | ADD HL,DE | HL=HL+DE (move onto the next slot). | ||
6FA4 | 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...
|
||||
6FA6 | RET | Return. | ||
Initialise a new laser beam.
|
||||
Init_LaserBeam | 6FA7 | LD (HL),$10 | Mark the laser beam slot as "in-use". | |
6FA9 | INC HL | HL=Laser beam Y position. | ||
6FAA | LD DE,$5D00 | B=JETMAN_FRAME. | ||
6FAD | LD A,(DE) | |||
6FAE | LD B,A | |||
6FAF | INC DE | A=Jetman_Pos_X. | ||
6FB0 | LD A,(DE) | |||
6FB1 | AND %11111000 | Keep only bits 3-7. | ||
6FB3 | OR %00000101 | Set bits 0 and 2. | ||
6FB5 | LD C,A | |||
6FB6 | BIT 6,B | |||
6FB8 | JR Z,LaserBeam_Right | |||
6FBA | SUB $08 | |||
6FBC | LD C,A | |||
LaserBeam_Left | 6FBD | INC DE | ||
6FBE | LD A,(DE) | |||
6FBF | SUB $0D | |||
6FC1 | LD (HL),A | |||
6FC2 | INC HL | |||
6FC3 | LD B,$03 | |||
6FC5 | LD (HL),C | |||
6FC6 | LD A,C | |||
6FC7 | AND $FB | |||
Handler_LaserBeam_0 | 6FC9 | INC HL | ||
6FCA | LD (HL),A | |||
6FCB | DJNZ Handler_LaserBeam_0 | |||
6FCD | INC HL | |||
6FCE | LD A,($5DCE) | A=Random_Number. | ||
6FD1 | AND %00111000 | Keep only bits 3-5. | ||
6FD3 | OR %10000100 | Set bits 2 and 7. | ||
6FD5 | LD (HL),A | |||
6FD6 | INC HL | |||
6FD7 | EX DE,HL | |||
6FD8 | LD HL,$6FE9 | HL=LaserBeam_Attributes. | ||
6FDB | LD A,($5DCE) | A=Random_Number. | ||
6FDE | AND %00000011 | Keep only bits 0-1. | ||
6FE0 | LD C,A | |||
6FE1 | LD B,$00 | |||
6FE3 | ADD HL,BC | |||
6FE4 | LD A,(HL) | |||
6FE5 | LD (DE),A | |||
6FE6 | JP SoundsLaserBeam | Jump to SoundsLaserBeam. | ||
All the attributes a laser beam can be.
|
||||
LaserBeam_Attributes | 6FE9 | DEFB $47,$43,$43,$45 | ||
Handle drawing the laser beam moving to the right.
|
||||
LaserBeam_Right | 6FED | LD A,(DE) | A=Jetman X position. | |
6FEE | AND %00000111 | Keep only bits 0-2. | ||
6FF0 | LD A,C | A=. | ||
6FF1 | JR Z,Handler_LaserBeam_1 | |||
6FF3 | ADD A,$08 | |||
Handler_LaserBeam_1 | 6FF5 | ADD A,$10 | ||
6FF7 | AND %11111110 | Keep only bits 1-7. | ||
6FF9 | LD C,A | Store the result in C. | ||
6FFA | JR LaserBeam_Left | Jump to LaserBeam_Left. |
Prev: 6DD3 | Up: Map | Next: 6FFC |