Prev: B506 Up: Map Next: B645
B57E: Create a new projectile
Used by the routine at C03A.
Input
IY Address pointer in the projectile configuration buffer
IX Address pointer in the enemy configuration buffer
B57E LD A,(IX+$00) Set A to the x-position for the laser
B581 SUB $10
B583 JP $B589 Jump forward
B586 LD A,(IX+$00) Set A to the enemy x-position
This entry point is used by the routine at B57E.
B589 LD ($A093),A Set A093 the enemy x-position
B58C LD A,$0F Set A to the increment for the y-position
Creates a new projectile for enemy. Used by the routines at BA5C, BE5B, BE75, BE9B and BEB3.
B58E LD ($A099),A Set A099 to the increment for the y-position
B591 LD A,(IX+$01) Set A095 to enemy y-position
B594 LD ($A095),A
B597 LD A,(IX+$02) Set A0BB to enemy face direction
B59A LD ($A097),A
B59D LD A,($A054) Set the projectile type to A
B5A0 SET 7,A
B5A2 JP $B5C1 Jump to create this projectile
Create a new projectile fired for Rex. Used by the routines at B372 and B456.
B5A5 LD A,($A0B6) Set A093 to Rex x-position
B5A8 LD ($A093),A
B5AB LD A,($A0B7) Set A095 to Rex y-position
B5AE LD ($A095),A
B5B1 LD A,($A0BB) Set A0BB to Rex face direction
B5B4 LD ($A097),A
B5B7 LD A,$11 Set A099 to the increment for the y-position
B5B9 LD ($A099),A
B5BC LD A,($A013) Set A to Rex weapon number
B5BF RES 7,A
Create a new projectile in the projectile configuration buffer based on predefined values This entry point is used by the routines at B372, B589, B64E and BCC6.
B5C1 LD (IY+$06),$01 Set projectile status to flying
B5C5 LD (IY+$0B),A Set the projectile type
B5C8 LD A,($A095) Set A to the y-position
B5CB LD HL,$A099 Increment y-position
B5CE ADD A,(HL)
B5CF LD (IY+$01),A Save y-position of laser to projectile configuration buffer
B5D2 LD L,A Computes offset on room buffer for y-position. NOT NEEDED HERE!
B5D3 LD H,$00
B5D5 ADD HL,HL
B5D6 ADD HL,HL
B5D7 ADD HL,HL
B5D8 ADD HL,HL
B5D9 ADD HL,HL
B5DA LD A,($A093) Increment x-position and save it at projectile configuration buffer
B5DD ADD A,$10
B5DF LD (IY+$00),A
B5E2 LD A,($A07B) is Rex firing the wepaon?
B5E5 OR A
B5E6 JP NZ,$B5FA Jump if not
B5E9 LD A,($A093) Check bits 2-0 of x-position
B5EC AND $07
B5EE CP $06 Decrement y-position of laser when Rex is moving Bits 2-0: $06 and $00 decrement y-position
B5F0 JP Z,$B5F7
B5F3 OR A
B5F4 JP NZ,$B5FA
B5F7 DEC (IY+$01)
B5FA LD (IY+$04),$08 Set x-delta of laser
B5FE LD HL,$0001 Set offset of 1
B601 LD (IY+$07),L
B604 LD (IY+$08),H
B607 LD A,($A097) is Rex direction facing right
B60A OR A
B60B JP Z,$B623 Jump if so
B60E LD A,(IY+$00) Recompute x-position for facing left
B611 SUB $10
B613 LD (IY+$00),A
B616 LD HL,$FFFF Recompute x-offset for facing left (-1)
B619 LD (IY+$07),L
B61C LD (IY+$08),H
B61F LD (IY+$04),$F8 Recompute x-delta for facing left
B623 LD L,(IY+$01) Computes offset on room buffer for y-position
B626 LD H,$00
B628 ADD HL,HL
B629 ADD HL,HL
B62A ADD HL,HL
B62B ADD HL,HL
B62C ADD HL,HL
B62D LD A,(IY+$00) Computes offset on room buffer for x-position
B630 SRL A
B632 SRL A
B634 SRL A
B636 LD E,A Computes address into room buffer for draw the projectile and save this address into projectile configuration buffer
B637 LD D,$00
B639 ADD HL,DE
B63A LD DE,$E7FF
B63D ADD HL,DE
B63E LD (IY+$02),L
B641 LD (IY+$03),H
B644 RET
Prev: B506 Up: Map Next: B645