Routines |
Prev: 9AB3 | Up: Map | Next: 9BDA |
Used by the routine at 969B.
|
||||
9AC5 | LD A,($A063) | Jump back if not the last live | ||
9AC8 | OR A | |||
9AC9 | JP NZ,$96A7 | |||
9ACC | LD IY,$9C0B | Set IY to the address for explosion data position and index graphic data | ||
9AD0 | LD B,$10 | Set B the number of explosions | ||
9AD2 | PUSH BC | Save BC | ||
9AD3 | LD A,(IY+$00) | Set A the index of explosion graphic data | ||
9AD6 | OR A | if index = 0 jump forward to configure explosion position | ||
9AD7 | JP Z,$9B62 | |||
9ADA | LD B,A | Multiply index number by 72 (length of graphic data explosion) | ||
9ADB | LD DE,$0048 | |||
9ADE | CALL $C8E8 | |||
9AE1 | LD DE,$816A | Set A034 to the address point for the current graphic data explosion | ||
9AE4 | ADD HL,DE | |||
9AE5 | LD ($A034),HL | |||
9AE8 | LD A,(IY+$01) | Set A0AF the x-position for the explosion | ||
9AEB | LD ($A0AF),A | |||
9AEE | LD A,(IY+$02) | Set A the y-position for the explosion | ||
9AF1 | CP $A8 | Jump forward to configure (x-y) position if y-position is greater than 168 or less than 24 | ||
9AF3 | JP NC,$9B62 | |||
9AF6 | CP $18 | |||
9AF8 | JP C,$9B62 | |||
9AFB | LD ($A0B0),A | Set A0B0 the y-position of explosion | ||
9AFE | LD A,$03 | Set A0B1 the width in bytes for the sprite | ||
9B00 | LD ($A0B1),A | |||
9B03 | LD A,$18 | Set A0B2 the height in pixels of the sprite | ||
9B05 | LD ($A0B2),A | |||
9B08 | LD A,$FF | Set A033 the entity type for explosion | ||
9B0A | LD ($A033),A | |||
9B0D | XOR A | Set A the facing direction to right | ||
9B0E | CALL $B258 | Draw the explosion | ||
9B11 | LD A,(IY+$01) | Set A0AF the x-position for the explosion | ||
9B14 | LD ($A0AF),A | |||
9B17 | LD A,(IY+$02) | Set A0B0 the y-position of explosion | ||
9B1A | LD ($A0B0),A | |||
9B1D | CALL $CF9B | Compute address into attribute file based on (x,y) position | ||
9B20 | LD A,(IY+$00) | Increment index of explosion | ||
9B23 | INC A | |||
9B24 | LD (IY+$00),A | |||
9B27 | CP $09 | Jump forward and process next explosion if index is less than 9 | ||
9B29 | JP NZ,$9B3A | |||
9B2C | LD (IY+$00),$00 | Set index to 0 | ||
9B30 | LD HL,($A093) | Set HL to the address into the attribute file for the explosion | ||
9B33 | LD DE,($A095) | Set DE to the address into the attribute buffer for the explosion | ||
9B37 | CALL $CF6E | Reset attribute color when explosion ended | ||
handle next explosion
|
||||
9B3A | LD DE,$0003 | Point IY to the next explosion data | ||
9B3D | ADD IY,DE | |||
9B3F | POP BC | Restore BC | ||
9B40 | DJNZ $9AD2 | Jump back and process next explosion | ||
9B42 | LD A,($A056) | Decrement explosion counter | ||
9B45 | DEC A | |||
9B46 | LD ($A056),A | |||
9B49 | CP $2F | If explosion counter is 47 or 34 jump to change offset pair | ||
9B4B | CALL Z,$9BC8 | |||
9B4E | CP $22 | |||
9B50 | CALL Z,$9BC8 | |||
9B53 | CP $19 | If explosion counter is 25 or 23 jump to change offset pair | ||
9B55 | CALL Z,$9BD1 | |||
9B58 | CP $17 | |||
9B5A | CALL Z,$9BD1 | |||
9B5D | OR A | If counter is zero jump to handle finish game | ||
9B5E | JP Z,$9C76 | |||
9B61 | RET | |||
configure explosion position
|
||||
9B62 | LD A,($A056) | If counter equals 16 jump to process next explosion | ||
9B65 | CP $10 | |||
9B67 | JP C,$9B3A | |||
9B6A | CALL $A375 | Set A a pseudo random number | ||
9B6D | CP $96 | If number is less than $96 then jump to process next explosion | ||
9B6F | JP C,$9B3A | |||
computes x-position of explosion
|
||||
9B72 | LD HL,($A057) | Substract offset to x-position of Rex | ||
9B75 | LD A,($A0B6) | |||
9B78 | SUB (HL) | |||
9B79 | LD E,A | Set E the x-position for explosion | ||
9B7A | CALL $A388 | Set A a pseudo random number | ||
9B7D | LD HL,($A057) | Increment address into explosion data offsets | ||
9B80 | INC HL | |||
9B81 | AND (HL) | And pattern for random number | ||
9B82 | SLA A | Multiply by 8 this number and add to the previous partial computed position x-position of explosion = x-position of Rex - offset #1 + (random & offset #2)*8 | ||
9B84 | SLA A | |||
9B86 | SLA A | |||
9B88 | ADD A,E | |||
9B89 | AND $F8 | Set new position grid fixed | ||
9B8B | CP $F0 | If x-position of explosion is greater than 230 jump forward and handle next explosion | ||
9B8D | JP NC,$9B3A | |||
9B90 | LD (IY+$01),A | Set the new x-position into explosion data buffer | ||
computes y-position of explosion
|
||||
9B93 | LD A,($A0B7) | Substract offset to y-position of Rex | ||
9B96 | LD HL,($A057) | |||
9B99 | SUB (HL) | |||
9B9A | LD E,A | Set E the x-position for explosion | ||
9B9B | CALL $A388 | Set A a pseudo random number | ||
9B9E | LD HL,($A057) | Increment address into explosion data offsets | ||
9BA1 | INC HL | |||
9BA2 | AND (HL) | And pattern for random number | ||
9BA3 | SLA A | Multiply by 8 this number and add to the previous partial computed position y-position of explosion = y-position of Rex - offset #1 + (random & offset #2)*8 | ||
9BA5 | SLA A | |||
9BA7 | SLA A | |||
9BA9 | ADD A,E | |||
9BAA | AND $F8 | Set new position grid fixed | ||
9BAC | LD (IY+$02),A | Set the new y-position into explosion data buffer | ||
9BAF | LD (IY+$00),$01 | Increment graphic data index of explosion | ||
configure sound explosion
|
||||
9BB3 | CALL $A375 | Generate a random number between 1 and 3 for channel sound | ||
9BB6 | AND $03 | |||
9BB8 | OR A | |||
9BB9 | JP Z,$9BB3 | |||
9BBC | LD ($D790),A | Set the random channel used for explosion | ||
9BBF | LD DE,$D790 | Set DE to address for explosion sound | ||
9BC2 | CALL $D5E7 | Configure sound channel and mixer register | ||
9BC5 | JP $9B3A | Jump back and process next explosion | ||
Increment address into data pairs
|
||||
9BC8 | LD HL,($A057) | Point A057 to the next pair of data to compute position | ||
9BCB | INC HL | |||
9BCC | INC HL | |||
9BCD | LD ($A057),HL | |||
9BD0 | RET | |||
Decrement address into data pairs
|
||||
9BD1 | LD HL,($A057) | Point A057 to the previous pair of data to compute position | ||
9BD4 | DEC HL | |||
9BD5 | DEC HL | |||
9BD6 | LD ($A057),HL | |||
9BD9 | RET |
Prev: 9AB3 | Up: Map | Next: 9BDA |