![]() |
Routines |
| Prev: BC17 | Up: Map | Next: BF4B |
|
Used by the routine at 9470.
|
||||
| BC48 | LD IX,$5E66 | Set IX to the base address for enemy configuration | ||
| BC4C | LD A,($A22B) | Set B to the max number of enemies in the current room | ||
| BC4F | LD B,A | |||
| BC50 | PUSH BC | Save BC | ||
| BC51 | LD A,(IX+$0C) | Check enemy status | ||
| BC54 | OR A | Enemy is dead? | ||
| BC55 | JP Z,$BD5C | Jump if so | ||
| BC58 | LD A,(IX+$09) | check enemy type | ||
| BC5B | AND $7F | |||
| BC5D | OR A | Enemy is FOOT MAN? | ||
| BC5E | JP NZ,$BCCA | Jump forward if not | ||
|
Enemy is FOOT MAN
|
||||
| BC61 | LD HL,$8198 | Set HL to address pointer for FOOT MAN graphic data | ||
| BC64 | LD A,(IX+$03) | Check jumping state for FOOT MAN | ||
| BC67 | OR A | is jumping? | ||
| BC68 | JP NZ,$BC72 | Jump if so? | ||
| BC6B | LD A,(IX+$06) | Check falling state for FOOT MAN | ||
| BC6E | OR A | is falling? | ||
| BC6F | JP Z,$BC75 | Jump if not | ||
| BC72 | LD HL,$9180 | Point HL to address pointer to graphic data for FOOTMAN falling or jumping | ||
| BC75 | LD (IX+$16),L | Set address for enemy graphic data | ||
| BC78 | LD (IX+$17),H | |||
| BC7B | LD A,(IX+$12) | FOOTMAN walker is crouched? | ||
| BC7E | CP $02 | |||
| BC80 | JP Z,$BCCA | Jump forward and no fire? | ||
| BC83 | BIT 7,(IX+$09) | Check type of FOOT MAN | ||
| BC87 | JP Z,$BC95 | Jump if FOOT MAN Walking | ||
|
FOOT MAN is crouched and check if will fire the weapon
|
||||
| BC8A | CALL $A51D | Computes random number on A | ||
| BC8D | CP $F0 | no fire weapon if random number is < $F0 | ||
| BC8F | JP C,$BCCA | |||
| BC92 | JP $BC9D | Jump to fire weapon | ||
|
FOOT MAN is walking and check if will fire the weapon
|
||||
| BC95 | CALL $A51D | Computes random number on A | ||
| BC98 | CP $FE | no fire weapon if random number is < $FE | ||
| BC9A | JP C,$BCCA | |||
|
FOOT MAN fire the weapon
|
||||
| BC9D | CALL $B5B6 | Configure weapon sound and check for weapon free slot | ||
| BCA0 | LD A,(IX+$00) | Set x-position of enemy in A22C | ||
| BCA3 | LD ($A22C),A | |||
| BCA6 | XOR A | Set A1ED to the type of projectile for the enemy | ||
| BCA7 | LD ($A1ED),A | |||
| BCAA | LD A,$0E | Set A to the increment of y-position for the projectile of FOOT MAN walking | ||
| BCAC | BIT 7,(IX+$09) | is FOOT MAN walking? | ||
| BCB0 | JP Z,$BCB5 | Jump if so | ||
| BCB3 | LD A,$11 | Set A to the increment of y-position for the projectile of FOOT MAN crouched | ||
| BCB5 | PUSH AF | Save AF | ||
| BCB6 | CALL $B5D4 | Create a new laser projectile for FOOT MAN | ||
| BCB9 | LD (IY+$05),$00 | Set y-delta of projectile to $00 | ||
| BCBD | CALL $B5B6 | Configure weapon sound and check for weapon free slot | ||
| BCC0 | POP AF | Restore AF | ||
| BCC1 | INC A | Increment projectile y-position | ||
| BCC2 | INC A | |||
| BCC3 | CALL $B5D4 | Create a new laser projectile for FOOT MAN | ||
| BCC6 | LD (IY+$05),$00 | Set y-delta of projectile to $00 | ||
|
Prepares to draw the enemy
|
||||
| BCCA | LD A,(IX+$00) | Set A248 to the x-position of the enemy | ||
| BCCD | LD ($A248),A | |||
| BCD0 | LD A,(IX+$01) | Set A249 to the y-position of the enemy | ||
| BCD3 | LD ($A249),A | |||
| BCD6 | LD A,(IX+$0E) | Set A24A to the width (in bytes) of the enemy sprite | ||
| BCD9 | LD ($A24A),A | |||
| BCDC | LD A,(IX+$0F) | Set A24B to the height (in pixels) of the enemy sprite | ||
| BCDF | LD ($A24B),A | |||
| BCE2 | LD A,(IX+$09) | Set A1CC to the enemy type | ||
| BCE5 | LD ($A1CC),A | |||
| BCE8 | LD L,(IX+$04) | Set #$A1CD to the graphic data address for the enemy (static - not animated) | ||
| BCEB | LD H,(IX+$05) | |||
| BCEE | LD ($A1CD),HL | |||
| BCF1 | LD L,(IX+$0A) | Set HL to address pointer of base address for animated sprite | ||
| BCF4 | LD H,(IX+$0B) | |||
| BCF7 | LD E,(IX+$16) | Set DE to address pointer for animation offset based on previous address | ||
| BCFA | LD D,(IX+$17) | |||
| BCFD | LD A,(IX+$09) | Set A to enemy type | ||
| BD00 | AND $7F | is enemy type is $08 (UNKNOWN) set A to enemy direction to $00 (right) and jump to draw enemy | ||
| BD02 | CP $08 | |||
| BD04 | JP NZ,$BD0B | |||
| BD07 | XOR A | |||
| BD08 | JP $BD0E | |||
| BD0B | LD A,(IX+$02) | Set A to enemy direction | ||
| BD0E | CALL $B296 | Draw the enemy | ||
| BD11 | CALL $9F15 | Handle FOOT MAN teleporting | ||
| BD14 | CALL $C627 | Handle FOOT MAN walking/crouch state change | ||
| BD17 | CALL $C5E8 | Handle FOOT MAN walking/stand-by state change | ||
| BD1A | LD A,(IX+$09) | Enemy destroyed? | ||
| BD1D | CP $FF | |||
| BD1F | JP Z,$C059 | Handle explosion | ||
| BD22 | CP $06 | Foot Man is dying? | ||
| BD24 | JP Z,$C032 | Handle dying Foot Man 6 | ||
|
This entry point is used by the routine at C032.
|
||||
| BD27 | LD A,(IX+$09) | Object type is bubble? | ||
| BD2A | CP $FE | |||
| BD2C | CALL Z,$C1CB | Handle bubble bouncing and burst | ||
| BD2F | LD A,(IX+$09) | Check enemy type | ||
| BD32 | AND $7F | |||
| BD34 | CP $09 | is BULB? | ||
| BD36 | JP Z,$BFA8 | Handle BULB | ||
| BD39 | CP $04 | is PINE? | ||
| BD3B | JP Z,$BE22 | Handle PINE | ||
| BD3E | CP $03 | is BRAIN? | ||
| BD40 | JP Z,$BDF2 | Handle BRAIN? | ||
| BD43 | CP $02 | is DROP? | ||
| BD45 | JP Z,$BD67 | Handle DROP | ||
| BD48 | CP $05 | is PLANT? | ||
| BD4A | JP Z,$BEF1 | Handle PLANT | ||
| BD4D | CALL $C691 | Handler for FOOT MAN jumping | ||
| BD50 | CALL $C721 | Handler for FOOT MAN falling | ||
| BD53 | CALL $C794 | Obtain the tile type address pointer under the entity | ||
| BD56 | CALL $C2E7 | Handler for lateral movement | ||
| BD59 | CALL $CFB5 | Handle collision detection of enemy with Rex and projectiles | ||
|
This entry point is used by the routine at C059.
|
||||
| BD5C | LD DE,$001B | Point IX to the next enemy configuration | ||
| BD5F | ADD IX,DE | |||
| BD61 | POP BC | Restore BC | ||
| BD62 | DEC B | Decrement enemy counter | ||
| BD63 | JP NZ,$BC50 | If there are enemies on the room go back and draw them | ||
| BD66 | RET | Return if not | ||
|
Handle DROP
|
||||
| BD67 | LD A,(IX+$11) | Check DROP state | ||
| BD6A | OR A | is DROP in ceil standing-by? | ||
| BD6B | JP Z,$BDDA | Jump if so | ||
| BD6E | CP $01 | is DROP in animation state hanging from ceil? | ||
| BD70 | JP Z,$BDAA | Jump if so | ||
| BD73 | CP $02 | is DROP free falling? | ||
| BD75 | JP Z,$BD80 | Jump if so | ||
| BD78 | CP $03 | is DROP in animation state impacting ground? | ||
| BD7A | JP Z,$BDAA | Jump if so | ||
| BD7D | JP $BD59 | Jump back and process next enemy | ||
|
DROP is free falling
|
||||
| BD80 | LD A,(IX+$01) | Increment y-position of DROP | ||
| BD83 | ADD A,$08 | |||
| BD85 | LD (IX+$01),A | |||
| BD88 | CP $B0 | if y-position of DROP greater than 176 jump to hide DROP | ||
| BD8A | JP NC,$BDEB | |||
| BD8D | CALL $C794 | Obtain the tile type address pointer under the entity | ||
| BD90 | LD A,(HL) | Check if tile type is background | ||
| BD91 | CALL $CE17 | |||
| BD94 | JP NZ,$BD9F | Jump if not | ||
| BD97 | INC HL | Increase address into tile type buffer and check next tile type | ||
| BD98 | LD A,(HL) | |||
| BD99 | CALL $CE17 | |||
| BD9C | JP Z,$BD59 | Jump back and process next enemy if tile type is background | ||
|
ground impacting
|
||||
| BD9F | LD (IX+$11),$03 | Set state to ground impacting | ||
| BDA3 | LD (IX+$12),$04 | Set state change counter | ||
| BDA7 | JP $BD59 | Jump back and process next enemy | ||
|
DROP in animation state: hanging from ceil or impacting ground
|
||||
| BDAA | LD L,(IX+$04) | Poin to the next graphic data | ||
| BDAD | LD H,(IX+$05) | |||
| BDB0 | LD DE,$0020 | |||
| BDB3 | ADD HL,DE | |||
| BDB4 | LD (IX+$04),L | |||
| BDB7 | LD (IX+$05),H | |||
| BDBA | DEC (IX+$12) | Decrement state change | ||
| BDBD | JP NZ,$BD59 | Jump back and process next enemy if counter is not zero | ||
| BDC0 | LD A,(IX+$11) | Jump forward if DROP is impacting ground | ||
| BDC3 | CP $03 | |||
| BDC5 | JP Z,$BDCF | |||
| BDC8 | LD (IX+$11),$02 | Set state for free falling | ||
| BDCC | JP $BD59 | Jump back and process next enemy | ||
| BDCF | LD (IX+$11),$04 | Set state to DROP in ground | ||
| BDD3 | LD (IX+$12),$03 | Set state counter | ||
| BDD7 | JP $BD59 | Jump back and process next enemy | ||
|
DROP in ceil standing-by
|
||||
| BDDA | DEC (IX+$12) | Decrement state change counter | ||
| BDDD | JP NZ,$BD59 | Jump back and process next enemy if counter is not zero | ||
| BDE0 | LD (IX+$11),$01 | Set state to drop animation hanging from ceil | ||
| BDE4 | LD (IX+$12),$03 | Set state change counter | ||
| BDE8 | JP $BD59 | Jump back and process next enemy | ||
|
Hide DROP
|
||||
| BDEB | LD (IX+$0C),$00 | Hide DROP | ||
| BDEF | JP $BD59 | Jump back and process next enemy | ||
|
Handle BRAIN
|
||||
| BDF2 | LD A,(IX+$12) | Decrement recover counter | ||
| BDF5 | DEC A | |||
| BDF6 | LD (IX+$12),A | |||
| BDF9 | OR A | Return if recover counter is not zero | ||
| BDFA | JP NZ,$BD59 | |||
|
recover BRAIN
|
||||
| BDFD | LD (IX+$12),$04 | Reset recover counter | ||
| BE01 | LD A,(IX+$11) | Decrement wound counter if greater than 0 or jump to process next enemy if not | ||
| BE04 | DEC A | |||
| BE05 | CP $FF | |||
| BE07 | JP Z,$BD59 | |||
| BE0A | LD (IX+$11),A | |||
| BE0D | LD L,(IX+$04) | Point to the next graphic data | ||
| BE10 | LD H,(IX+$05) | |||
| BE13 | LD DE,$0020 | |||
| BE16 | AND A | |||
| BE17 | SBC HL,DE | |||
| BE19 | LD (IX+$04),L | |||
| BE1C | LD (IX+$05),H | |||
| BE1F | JP $BD59 | Jump to process next enemy | ||
|
Handle PINE
|
||||
| BE22 | LD A,(IX+$11) | Check PINE state | ||
| BE25 | OR A | is PINE moving downwards? | ||
| BE26 | JP Z,$BE43 | Jump if so | ||
| BE29 | CP $01 | is PINE moving upwards? | ||
| BE2B | JP Z,$BE6B | Jump if so | ||
|
check for PINE animation
|
||||
| BE2E | LD A,(IX+$12) | Check animation state | ||
| BE31 | CP $02 | is expanding? | ||
| BE33 | JP Z,$BE86 | Jump if so | ||
| BE36 | CP $03 | is retracting? | ||
| BE38 | JP Z,$BEC1 | Jump if so | ||
| BE3B | CP $04 | is holding? | ||
| BE3D | JP Z,$BEE0 | Jump if so | ||
| BE40 | JP $BD59 | Jump to process next enemy | ||
|
PINE is moving downwards
|
||||
| BE43 | LD A,(IX+$01) | Increment y-position | ||
| BE46 | INC A | |||
| BE47 | LD (IX+$01),A | |||
| BE4A | CP $A8 | If y-position is greater than 168 then jump to change direction | ||
| BE4C | JP NC,$BE60 | |||
| BE4F | CALL $BEAD | Try to active PINE animation | ||
|
check for collision
|
||||
| BE52 | CALL $C794 | Obtain the tile type address pointer under the entity | ||
| BE55 | INC HL | Increase address into tile type buffer | ||
| BE56 | LD A,(HL) | If tile type is not 'background' jump to change direction | ||
| BE57 | OR A | |||
| BE58 | JP NZ,$BE60 | |||
| BE5B | INC HL | Increase address into tile type buffer | ||
| BE5C | LD A,(HL) | Check for tile type | ||
| BE5D | JP Z,$BE2E | Jump back and check for PINE animation if is a background tile | ||
|
change PINE direction
|
||||
| BE60 | LD A,(IX+$11) | Change PINE direction | ||
| BE63 | XOR $01 | |||
| BE65 | LD (IX+$11),A | |||
| BE68 | JP $BE2E | Jump to handle PINE animation | ||
|
PINE is moving upwards
|
||||
| BE6B | LD A,(IX+$01) | Decrement y-position | ||
| BE6E | DEC A | |||
| BE6F | LD (IX+$01),A | |||
| BE72 | CP $10 | If y-position is less than 16 then jump to change direction | ||
| BE74 | JP C,$BE60 | |||
| BE77 | CALL $BEAD | Try to active PINE animation | ||
| BE7A | CALL $C794 | Obtain the tile type address pointer under the entity | ||
| BE7D | LD DE,$0040 | Point to the tile type over the PINE sprite | ||
| BE80 | AND A | |||
| BE81 | SBC HL,DE | |||
| BE83 | JP $BE55 | Jump to check for collision | ||
|
PINE expanding animation
|
||||
| BE86 | LD L,(IX+$04) | Point to the next graphic data | ||
| BE89 | LD H,(IX+$05) | |||
| BE8C | LD DE,$0020 | |||
| BE8F | ADD HL,DE | |||
| BE90 | LD (IX+$04),L | |||
| BE93 | LD (IX+$05),H | |||
| BE96 | DEC (IX+$13) | Decrement state change counter | ||
| BE99 | JP NZ,$BD59 | Jump back and process next enemy if counter is not zero | ||
| BE9C | LD (IX+$12),$04 | Change state animation to holding | ||
| BEA0 | CALL $A51D | Computes a random number between 4 and 11 | ||
| BEA3 | AND $07 | |||
| BEA5 | ADD A,$04 | |||
| BEA7 | LD (IX+$13),A | Set this number to the state change counter | ||
| BEAA | JP $BD59 | Jump back to process next enemy | ||
|
Try to active PINE animation
|
||||
| BEAD | LD A,(IX+$12) | Return if state animation is not standing-by | ||
| BEB0 | OR A | |||
| BEB1 | RET NZ | |||
| BEB2 | CALL $A51D | Return if generated random number is greater than 20 | ||
| BEB5 | CP $14 | |||
| BEB7 | RET NC | |||
| BEB8 | LD (IX+$13),$02 | Set state change counter | ||
| BEBC | LD (IX+$12),$02 | Change state animation to expanding | ||
| BEC0 | RET | |||
|
PINE is retracting
|
||||
| BEC1 | LD L,(IX+$04) | Point to the next graphic data | ||
| BEC4 | LD H,(IX+$05) | |||
| BEC7 | LD DE,$0020 | |||
| BECA | AND A | |||
| BECB | SBC HL,DE | |||
| BECD | LD (IX+$04),L | |||
| BED0 | LD (IX+$05),H | |||
| BED3 | DEC (IX+$13) | Decrement state change counter | ||
| BED6 | JP NZ,$BD59 | Jump back and process next enemy if counter is not zero | ||
| BED9 | LD (IX+$12),$00 | Set state animation to standing-by | ||
| BEDD | JP $BD59 | Jump to process next enemy | ||
|
PINE is holding
|
||||
| BEE0 | DEC (IX+$13) | Decrement state change counter | ||
| BEE3 | JP NZ,$BD59 | Jump back and process next enemy if counter is not zero | ||
| BEE6 | LD (IX+$13),$02 | Reset state change counter | ||
| BEEA | LD (IX+$12),$03 | Set state animation to retracting | ||
| BEEE | JP $BD59 | Jump to process next enemy | ||
|
Handle PLANT
|
||||
| BEF1 | LD A,(IX+$11) | Check PLANT state | ||
| BEF4 | OR A | is stand-by? | ||
| BEF5 | JP Z,$BF95 | Jump if so | ||
| BEF8 | CP $01 | is opening? | ||
| BEFA | JP Z,$BF05 | Jump if so | ||
| BEFD | CP $02 | is closing? | ||
| BEFF | JP Z,$BF76 | Jump if so | ||
| BF02 | JP $BD59 | Jump back and process next enemy | ||
|
PLANT is opening
|
||||
| BF05 | LD L,(IX+$04) | Point address to the next graphic data | ||
| BF08 | LD H,(IX+$05) | |||
| BF0B | LD DE,$0020 | |||
| BF0E | ADD HL,DE | |||
| BF0F | LD (IX+$04),L | |||
| BF12 | LD (IX+$05),H | |||
| BF15 | DEC (IX+$12) | Decrement state change counter | ||
| BF18 | JP NZ,$BD59 | Jump back and process next enemy if counter is not zero | ||
| BF1B | LD (IX+$11),$02 | Set state to closing | ||
| BF1F | LD (IX+$12),$06 | Set state change counter | ||
|
fire seeds
|
||||
| BF23 | LD A,$04 | Set projectile type to spray | ||
| BF25 | LD ($A1ED),A | |||
| BF28 | CALL $A51D | Generate a random number between 1 and 8 in B to determine the number of projectiles to fire | ||
| BF2B | AND $07 | |||
| BF2D | INC A | |||
| BF2E | LD B,A | |||
| BF2F | PUSH BC | Save BC | ||
| BF30 | CALL $A530 | Generate a random number between 0 and 3 in DE | ||
| BF33 | AND $03 | |||
| BF35 | LD E,A | |||
| BF36 | LD D,$00 | |||
| BF38 | LD HL,$BF4B | Use this number to obtain the x-delta of the projectile from x-delta table | ||
| BF3B | ADD HL,DE | |||
| BF3C | LD E,(HL) | |||
| BF3D | CALL $A530 | Generate a random number between 0 and 3. Projectile duration? | ||
| BF40 | AND $03 | |||
| BF42 | CALL $BF4F | Create a projectile for the PLANT | ||
| BF45 | POP BC | Restore BC | ||
| BF46 | DJNZ $BF2F | Jump back until all projectiles created | ||
| BF48 | JP $BD59 | Jump back and process next enemy | ||
| Prev: BC17 | Up: Map | Next: BF4B |