Routines |
Prev: B57E | Up: Map | Next: B943 |
B645 | LD IX,$5D22 | Set IX to the base address for enemy projectiles configuration | ||
B649 | LD B,$14 | Set B to the max number of enemy projectiles on screen | ||
B64B | JP $B654 | Jump forward to read projectile data and draw | ||
Draw Rex projectiles. Used by the routine at 947A.
|
||||
B64E | LD IX,$5B60 | Set IX to the base address for Rex projectiles configuration | ||
B652 | LD B,$1E | Set B to the max number of Rex projectiles | ||
Read configuration data and draw projectiles
|
||||
B654 | LD A,(IX+$06) | Set A the projectile status | ||
B657 | OR A | is destroyed? | ||
B658 | JP Z,$B6F6 | Jump if so | ||
B65B | CP $02 | just hit? | ||
B65D | JP Z,$B7BD | Jump if so | ||
B660 | CP $03 | exploding? | ||
B662 | JP Z,$B7D8 | Jump is so The projectile is flying | ||
B665 | LD L,(IX+$02) | Set HL to the addres location in room graphic buffer | ||
B668 | LD H,(IX+$03) | |||
B66B | LD A,(IX+$0B) | Set REG#a the projectile type | ||
B66E | AND $7F | |||
B670 | OR A | is a basic laser? | ||
B671 | JP Z,$B893 | draw basic laser sprite | ||
B674 | CP $01 | is a basic laser? | ||
B676 | JP Z,$B893 | draw basic laser sprite | ||
B679 | CP $04 | is a spray? | ||
B67B | JP Z,$B867 | draw spray sprite | ||
B67E | CP $02 | is a laser? | ||
B680 | JP Z,$B8BC | draw laser sprite $02 | ||
B683 | CP $03 | is a multiple? | ||
B685 | JP Z,$B893 | draw basic laser sprite | ||
B688 | CP $06 | is a laser? | ||
B68A | JP Z,$B920 | draw laser sprite $06 | ||
B68D | CP $07 | is a missile? | ||
B68F | JP Z,$B7FC | draw missile | ||
B692 | LD A,(IX+$00) | Set A the projectile x-position | ||
B695 | ADC A,(IX+$04) | Adds the projectile x-speed | ||
B698 | LD (IX+$00),A | Set the new x-position | ||
B69B | LD ($A0AF),A | Save the x-position at A0AF | ||
B69E | CP $F8 | Projectile left room from the right? | ||
B6A0 | JP NC,$B700 | Jump if so | ||
B6A3 | CP $09 | Projectile left room from the left? | ||
B6A5 | JP C,$B700 | Jump if so | ||
B6A8 | LD A,(IX+$01) | Set A the proejctile y-position | ||
B6AB | ADC A,(IX+$05) | Add the projectile y-speed | ||
B6AE | LD (IX+$01),A | Save the new y-position | ||
B6B1 | LD ($A0B0),A | Save the y-position at A0B0 | ||
B6B4 | CP $C0 | Projectile left room from the bottom? | ||
B6B6 | JP NC,$B700 | Jump if so | ||
B6B9 | CP $18 | Projectil left the room from the top? | ||
B6BB | JP C,$B700 | Jump if so | ||
B6BE | LD A,$01 | Computes address into the tile type buffer based on the computed position of the projectile | ||
B6C0 | CALL $A503 | |||
B6C3 | LD A,(HL) | Set A to the tile type impacted by the projectile | ||
B6C4 | CP $04 | Is a destructible tile (needs 3 impacts to destroy)? | ||
B6C6 | JP Z,$B707 | Jump forward to handle impact | ||
B6C9 | CP $05 | Is a destructible tile (needs 2 impascts to destry)? | ||
B6CB | JP Z,$B707 | Jump forward to handle impact | ||
B6CE | CP $06 | Is a destructible tile (needs 1 impact to destroy)? | ||
B6D0 | JP Z,$B707 | Jump forward to handle impact | ||
B6D3 | CALL $D08B | Check if A is a 'background' type tile | ||
B6D6 | JP NZ,$B794 | Jump if is not a background tile | ||
the projectile continue flying
|
||||
B6D9 | LD A,(IX+$0B) | the projectile is a missile? | ||
B6DC | AND $7F | |||
B6DE | CP $07 | |||
B6E0 | JP Z,$B6F6 | Jump and check the next projectile if so | ||
B6E3 | LD L,(IX+$02) | Computes into HL the addres pointer into room graphics buffer for the new position of projectile | ||
B6E6 | LD H,(IX+$03) | |||
B6E9 | LD E,(IX+$07) | |||
B6EC | LD D,(IX+$08) | |||
B6EF | ADD HL,DE | |||
B6F0 | LD (IX+$02),L | Set into projectile configuration buffer the new address | ||
B6F3 | LD (IX+$03),H | |||
this projectile has been handled, go the next one
|
||||
B6F6 | LD DE,$000F | Set DE to the length of projectile configuration buffer | ||
B6F9 | ADD IX,DE | Adds to the previous base address into IX | ||
B6FB | DEC B | Decrement B | ||
B6FC | JP NZ,$B654 | Jump back if there are projectiles to handle | ||
B6FF | RET | |||
the projectile has been destroyed
|
||||
B700 | LD (IX+$06),$00 | Set the projectile status to destroyed | ||
B704 | JP $B6F6 | Jump back and check for the next one | ||
handle destructible tiles
|
||||
B707 | BIT 7,(IX+$0B) | Check if projectile goes through objects | ||
B70B | JP NZ,$B6D9 | Jump back if so and the projectile continue flying | ||
B70E | LD ($A093),A | Set A093 to the destructible tile type | ||
B711 | INC A | Increasee the tile type number (one more impact receive) | ||
B712 | LD (HL),A | And set the new tile type into tile type buffer | ||
B713 | LD DE,$E19F | Computes into HL the offset of the tile to the tile type buffer base address | ||
B716 | AND A | |||
B717 | SBC HL,DE | |||
B719 | PUSH HL | Save HL | ||
B71A | LD DE,$DE9F | Set A to the tile number into tile counter buffer based on the offset previously compted | ||
B71D | ADD HL,DE | |||
B71E | LD A,(HL) | |||
B71F | DEC A | Decrement A, as tile count begins by 1. | ||
B720 | LD L,A | Computes into HL the address of the tile into the mapping table of tile graphics and room graphic buffer. (every tile mapping spans two words) | ||
B721 | LD H,$00 | |||
B723 | ADD HL,HL | |||
B724 | ADD HL,HL | |||
B725 | LD DE,$D962 | |||
B728 | ADD HL,DE | |||
B729 | LD ($A095),HL | Set into A095 this address | ||
B72C | INC HL | Set DE the address for the tile graphic data | ||
B72D | INC HL | |||
B72E | LD E,(HL) | |||
B72F | INC HL | |||
B730 | LD D,(HL) | |||
B731 | PUSH HL | Save HL | ||
B732 | LD HL,$0008 | Increment tile graphic data address to point to the next tile | ||
B735 | ADD HL,DE | |||
B736 | EX DE,HL | |||
B737 | POP HL | Restore HL | ||
B738 | DEC HL | Puts the new addres into the mapping table of tile graphics and room graphics data | ||
B739 | LD (HL),E | |||
B73A | INC HL | |||
B73B | LD (HL),D | |||
B73C | EX DE,HL | Exchange DE and HL | ||
B73D | LD DE,$63E0 | Computes into HL the tile number based on the tile graphic data offset of the tile | ||
B740 | AND A | |||
B741 | SBC HL,DE | |||
B743 | SRL H | |||
B745 | RR L | |||
B747 | SRL H | |||
B749 | RR L | |||
B74B | SRL H | |||
B74D | RR L | |||
B74F | LD DE,$6BE0 | Set into A the color attribute for the tile | ||
B752 | ADD HL,DE | |||
B753 | LD A,(HL) | |||
B754 | LD ($A097),A | Set A097 to the color attribute | ||
B757 | LD A,($A093) | Set A to destructible tile type | ||
B75A | CP $06 | is tile type $06? | ||
B75C | JP NZ,$B764 | Jump forward if not | ||
B75F | LD A,$47 | Set color attribute to $47 (background color attribute) | ||
B761 | LD ($A097),A | |||
B764 | POP HL | Restore HL | ||
B765 | PUSH HL | Save HL | ||
B766 | LD DE,$5800 | Set DE to attribute file base address | ||
B769 | ADD HL,DE | Adds offset of the tile | ||
B76A | LD A,($A097) | Set color attribute for the tile in attribute file | ||
B76D | LD (HL),A | |||
B76E | POP HL | Save and restore HL | ||
B76F | PUSH HL | |||
B770 | LD DE,$E4FF | Set color attribute for the tile in attribute buffer | ||
B773 | ADD HL,DE | |||
B774 | LD A,($A097) | |||
B777 | LD (HL),A | |||
B778 | POP HL | Restore HL | ||
B779 | LD A,($A093) | If tile type is destructible type $04 or $05 jump forward | ||
B77C | CP $04 | |||
B77E | JP Z,$B794 | |||
B781 | CP $05 | |||
B783 | JP Z,$B794 | |||
B786 | LD DE,$E19F | Set tile type to $00 (background) at tile type buffer | ||
B789 | ADD HL,DE | |||
B78A | LD (HL),$00 | |||
B78C | LD DE,($A095) | Reset room graphic address into mapping table | ||
B790 | XOR A | |||
B791 | LD (DE),A | |||
B792 | INC DE | |||
B793 | LD (DE),A | |||
the projectile has just impacted 1
|
||||
B794 | LD L,(IX+$02) | Draw impact 1 projectile | ||
B797 | LD H,(IX+$03) | |||
B79A | LD (HL),$10 | |||
B79C | LD (IX+$06),$00 | Set state of projectile to destroyed | ||
B7A0 | LD A,($A013) | Check if weapon used is $02 | ||
B7A3 | CP $02 | |||
B7A5 | JP Z,$B6F6 | Jump to handle the next projectile | ||
B7A8 | LD (IX+$06),$02 | Set impact 1 state for projectile | ||
B7AC | LD A,($D842) | Sound channel 3 is in use? | ||
B7AF | CP $FF | |||
B7B1 | JP NZ,$B6F6 | Jump to the next projectile if in use | ||
B7B4 | LD DE,$D787 | Set DE to impact sound data | ||
B7B7 | CALL $D5E7 | Configure sound channel and mixer register | ||
B7BA | JP $B6F6 | Jump back to handle next projectile | ||
the projectile has just impacted 2
|
||||
B7BD | LD L,(IX+$02) | Draw impact 2 projectile | ||
B7C0 | LD H,(IX+$03) | |||
B7C3 | LD DE,$0020 | |||
B7C6 | AND A | |||
B7C7 | SBC HL,DE | |||
B7C9 | LD (HL),$10 | |||
B7CB | ADD HL,DE | |||
B7CC | LD (HL),$38 | |||
B7CE | ADD HL,DE | |||
B7CF | LD (HL),$10 | |||
B7D1 | LD (IX+$06),$03 | Set projectile status to impact 2 | ||
B7D5 | JP $B6F6 | Jump back to handle next projectile | ||
the projectile is exploding
|
||||
B7D8 | LD L,(IX+$02) | Draw projectile exploding | ||
B7DB | LD H,(IX+$03) | |||
B7DE | LD DE,$0040 | |||
B7E1 | AND A | |||
B7E2 | SBC HL,DE | |||
B7E4 | LD DE,$0020 | |||
B7E7 | LD (HL),$10 | |||
B7E9 | ADD HL,DE | |||
B7EA | LD (HL),$00 | |||
B7EC | ADD HL,DE | |||
B7ED | LD (HL),$44 | |||
B7EF | ADD HL,DE | |||
B7F0 | LD (HL),$00 | |||
B7F2 | ADD HL,DE | |||
B7F3 | LD (HL),$10 | |||
B7F5 | LD (IX+$06),$00 | Set projectile status to destroyed | ||
B7F9 | JP $B6F6 | Jump back to handle next projectile | ||
Draw missile projectile
|
||||
B7FC | LD L,(IX+$01) | Computes address into room graphic buffer based on x and y position of projectile | ||
B7FF | LD H,$00 | |||
B801 | ADD HL,HL | |||
B802 | ADD HL,HL | |||
B803 | ADD HL,HL | |||
B804 | ADD HL,HL | |||
B805 | ADD HL,HL | |||
B806 | LD E,(IX+$00) | |||
B809 | SRL E | |||
B80B | SRL E | |||
B80D | SRL E | |||
B80F | LD D,$00 | |||
B811 | ADD HL,DE | |||
B812 | LD DE,$E7FF | |||
B815 | ADD HL,DE | |||
B816 | LD (IX+$02),L | Puts this address into the projectile configuration buffer | ||
B819 | LD (IX+$03),H | |||
B81C | PUSH HL | Save HL | ||
B81D | LD A,(IX+$0C) | Set A to the missile trajectory index | ||
B820 | LD E,A | Computes the address into the missile trajectory position offset based on the missile trajectory index | ||
B821 | LD D,$00 | |||
B823 | LD HL,$A9AF | |||
B826 | ADD HL,DE | |||
B827 | LD A,(HL) | Set A to the offset y-position of the missile | ||
B828 | CP $1E | is an end marker? | ||
B82A | JP NZ,$B838 | Jump if not | ||
B82D | DEC (IX+$0C) | Point the missile trajectory index to the last offset value | ||
B830 | DEC (IX+$0C) | |||
B833 | LD HL,$A9C9 | Point HL to the last address into the missile trajectory position offset table | ||
B836 | LD A,$08 | Set A to the y-offset of $08 | ||
B838 | LD (IX+$05),A | Set the y-offset into the projectile configuration buffer | ||
B83B | INC HL | Increment the address into the missile trajectory position offset | ||
B83C | LD E,(HL) | Set DE to the offset for the missile graphic data | ||
B83D | LD D,$00 | |||
B83F | LD HL,$8F4A | Set HL to the address for the missile graphic data heading right | ||
B842 | BIT 7,(IX+$04) | Is x-offset is negative then set HL to the address for the missile graphic data heading left | ||
B846 | JP Z,$B84C | |||
B849 | LD HL,$8A42 | |||
B84C | ADD HL,DE | Adds the offset of the missile graphics data and exchange registers | ||
B84D | EX DE,HL | |||
B84E | POP HL | Restore HL | ||
B84F | PUSH BC | Save BC | ||
B850 | LD B,$04 | Copy into room graphics data the graphic data of the missile | ||
B852 | LD A,(DE) | |||
B853 | LD (HL),A | |||
B854 | INC DE | |||
B855 | PUSH DE | |||
B856 | LD DE,$0020 | |||
B859 | ADD HL,DE | |||
B85A | POP DE | |||
B85B | DJNZ $B852 | |||
B85D | POP BC | Restore BC | ||
B85E | INC (IX+$0C) | Increment the missile trajectory index to the next pair of offsets | ||
B861 | INC (IX+$0C) | |||
B864 | JP $B692 | Jump back and handle next projectile | ||
draw spray bullet
|
||||
B867 | LD DE,$0040 | Init offset to draw | ||
B86A | AND A | |||
B86B | SBC HL,DE | |||
B86D | LD DE,$0020 | |||
B870 | BIT 7,(IX+$0B) | Check subtype of spray bullet | ||
B874 | JP NZ,$B885 | Jump if subtype is 1 | ||
draw spray bullet 0
|
||||
B877 | LD (HL),$10 | Draw spray bullet 0 | ||
B879 | ADD HL,DE | |||
B87A | LD (HL),$1C | |||
B87C | ADD HL,DE | |||
B87D | LD (HL),$38 | |||
B87F | ADD HL,DE | |||
B880 | LD (HL),$08 | |||
B882 | JP $B692 | Jump back | ||
draw spray bullet 1
|
||||
B885 | LD (HL),$00 | Draw spray bullet 1 | ||
B887 | ADD HL,DE | |||
B888 | LD (HL),$10 | |||
B88A | ADD HL,DE | |||
B88B | LD (HL),$28 | |||
B88D | ADD HL,DE | |||
B88E | LD (HL),$10 | |||
B890 | JP $B692 | Jump back | ||
draw basic laser-type projectile
|
||||
B893 | BIT 7,(IX+$0B) | Check laser-type projectile | ||
B897 | JP NZ,$B8AB | Jump to draw basic laser-type 1 | ||
draw basic laser-type 0
|
||||
B89A | LD A,(IX+$04) | Set A direction of projectile | ||
B89D | DEC A | |||
B89E | JP M,$B8A6 | Jump if lase direction is left | ||
B8A1 | LD (HL),$B7 | Draw laser sprite | ||
B8A3 | JP $B692 | Jump back | ||
B8A6 | LD (HL),$ED | Draw laser sprite | ||
B8A8 | JP $B692 | Jump back | ||
draw basic laser-type 1
|
||||
B8AB | LD A,(IX+$04) | Set A direction of projectile | ||
B8AE | DEC A | |||
B8AF | JP M,$B8B7 | Jump if laser direction is left | ||
B8B2 | LD (HL),$97 | Draw laser sprite | ||
B8B4 | JP $B692 | Jump back | ||
B8B7 | LD (HL),$E9 | Draw laser sprite | ||
B8B9 | JP $B692 | Jump back | ||
draw laser
|
||||
B8BC | LD A,(IX+$0E) | Decrement laser duration counter | ||
B8BF | DEC A | |||
B8C0 | LD (IX+$0E),A | |||
B8C3 | OR A | is 0 ? | ||
B8C4 | JP NZ,$B8CE | Jump if not | ||
B8C7 | LD (IX+$06),$00 | Destroy laser | ||
B8CB | JP $B692 | Jump back for next projectile | ||
B8CE | LD A,(IX+$0C) | Set A to number of laser type $06 extensions | ||
B8D1 | DEC A | if no need to create more laser type $06 jump back and handle next projectile | ||
B8D2 | OR A | |||
B8D3 | JP Z,$B692 | |||
B8D6 | LD (IX+$0C),A | Decrement the laser type $06 counter on projectile configuration buffer | ||
B8D9 | LD A,(IX+$0D) | Set A093 to laser type $06 x-position + 1 | ||
B8DC | INC A | |||
B8DD | LD ($A093),A | |||
B8E0 | LD A,(IX+$01) | Set A095 to laser y-position | ||
B8E3 | LD ($A095),A | |||
B8E6 | LD A,$01 | Set laser direction to left at A097 | ||
B8E8 | LD ($A097),A | |||
B8EB | BIT 7,(IX+$04) | laser x-delta is negative (moving left)? | ||
B8EF | JP NZ,$B8FE | Jump if so | ||
B8F2 | XOR A | Set laser diretion to right at A097 | ||
B8F3 | LD ($A097),A | |||
B8F6 | LD A,($A093) | Substract two byte to x-position of laser | ||
B8F9 | SUB $10 | |||
B8FB | LD ($A093),A | |||
B8FE | XOR A | Set 0 for y-position increment at A099 | ||
B8FF | LD ($A099),A | |||
B902 | PUSH IX | Save IX and BC | ||
B904 | PUSH BC | |||
B905 | CALL $B506 | Configure weapon sound and check for weapon free slot | ||
B908 | XOR A | Set A = 0 (used as laser type in nex routine) | ||
B909 | CALL $B5C1 | Create a new laser type $06 | ||
B90C | LD A,($A068) | Set laser duration/graphic index from A068 | ||
B90F | LD (IY+$0E),A | |||
B912 | LD (IY+$05),$00 | Set y-delta to 0 | ||
B916 | LD (IY+$0B),$06 | Set laser type to $06 | ||
B91A | POP BC | Restore BC and IX | ||
B91B | POP IX | |||
B91D | JP $B692 | Jump back and configure next projectile | ||
B920 | EX DE,HL | Exchange DE and HL | ||
B921 | PUSH DE | Save DE | ||
B922 | LD A,(IX+$0E) | Point HL to the graphic of laser at B943 base on laser graphic index | ||
B925 | LD E,A | |||
B926 | LD D,$00 | |||
B928 | LD HL,$B943 | |||
B92B | ADD HL,DE | |||
B92C | LD A,R | Set A to semi-random number (R: memory refresh register) | ||
B92E | AND (HL) | Apply AND operator to laser graphics | ||
B92F | POP DE | Puts this random graphics to room graphics buffer | ||
B930 | LD (DE),A | |||
B931 | LD A,(IX+$0E) | Decrement laser graphic index | ||
B934 | DEC A | |||
B935 | LD (IX+$0E),A | |||
B938 | OR A | if graphic index=0 then set projectile status to destroyed. Then jump back and configure next projectile | ||
B939 | JP NZ,$B692 | |||
B93C | LD (IX+$06),$00 | |||
B940 | JP $B692 |
Prev: B57E | Up: Map | Next: B943 |