Routines |
Prev: D07C | Up: Map | Next: D0EC |
Used by the routine at C89F.
|
||||
...There's a missile/bolt flying around in the room..!
This routine copies the missile's data from the table at 6CDC into a working (missile) buffer at EB9D.
It also checks if Maroc has a counter defence spell active (SHIELD, DEFENCE etc.)
|
||||
D09B | LD A,($EB4E) | Missile properties byte | ||
D09E | AND $01 | Check if it's is on-screen (bit 1 is set) | ||
D0A0 | JP Z,$D141 | ...if not, skip out to a later instruction | ||
D0A3 | LD HL,($EB44) | Get address pointer to missile type (in table at 6CDC) | ||
D0A6 | LD BC,$0008 | Copy the 8 bytes of missile data into missile working buffer table at EB9D | ||
D0A9 | LD DE,$EB9D | |||
D0AC | LDIR | |||
D0AE | LD A,($EB9F) | Missile attribute (INK) colour | ||
D0B1 | LD ($EAA8),A | Copy into item data buffer | ||
D0B4 | LD A,($EBA0) | Missile's event/collision type to check (stored as the 4th byte in the missile/bolt table at 6CDC) | ||
D0B7 | CP $00 | |||
D0B9 | JR Z,$D0BE | If it's zero (no event), don't copy any event data (shouldn't happen as there's a value for each missile) | ||
D0BB | CALL $E2B0 | ...If it's not zero, copy item event data into working buffer | ||
COUNTER SPELL #1 CHECK
|
||||
D0BE | LD A,($EAE9) | Get currently active 'effect' spell (value = 0 if none currently in effect) | ||
D0C1 | LD C,A | Copy to C register | ||
D0C2 | LD A,($EBA1) | Defence counter spell #1 (the spell in this slot is always AMULET) | ||
D0C5 | CP $00 | |||
D0C7 | JR Z,$D0CC | Check for zero - if no counter spell in this slot (shouldn't happen as there's a value for every counter slot) | ||
D0C9 | CP C | Check counter spell vs current active spell number | ||
D0CA | JR Z,$D0E0 | If there's a match, can skip the next two checks straight to D0E0 | ||
COUNTER SPELL #2 CHECK
|
||||
D0CC | LD A,($EBA3) | Defence counter spell #2 | ||
D0CF | CP $00 | Check for zero - if no counter spell in this slot (shouldn't happen as there's a value for every counter slot) | ||
D0D1 | JR Z,$D0D6 | |||
D0D3 | CP C | Check counter spell vs current active spell number | ||
D0D4 | JR Z,$D0E0 | If there's a match, can skip the final check and jump straight to D0E0 | ||
COUNTER SPELL #2 CHECK
|
||||
D0D6 | LD A,($EBA4) | Defence counter spell #3 | ||
D0D9 | CP $00 | heck for zero - if no counter spell in this slot (shouldn't happen as there's a value for every counter slot) | ||
D0DB | JR Z,$D116 | |||
D0DD | CP C | Check counter spell vs current active spell number | ||
D0DE | JR NZ,$D116 | If there's NO match, jump out of the routine here | ||
The following instructions are redundant (possibly duplicated), as CP C has already happened in a previous check
|
||||
D0E0 | CP C | - | ||
D0E1 | JR NZ,$D116 | - | ||
There's a match between the missile/bolt fired and an active shielding spell around Maroc that will negate/deflect it
The following instructions check for a collision against Maroc's flickering shielding/protective spell
|
||||
D0E3 | LD C,$01 | For the usual collision/event detection routine (DFCD) the C register is set an event/collision type. On this occasion loading the C register is unnecessary as it's not actually needed/used for this (special) missile routine. | ||
D0E5 | CALL $E286 | Check for a collision between the fired bolt/missile and the shield/barrier around Maroc | ||
D0E8 | CP $00 | The A register is returned with 0 if no collision, or 8 (this byte is used elsewhere for the accompanying sound effect) if there's a collision | ||
D0EA | JR Z,$D116 | If no collision, jump out of this routine/check |
Prev: D07C | Up: Map | Next: D0EC |