Routines |
Prev: CDD7 | Up: Map | Next: CEB1 |
Used by the routine at CDD7.
|
||||
|
||||
CE71 | LD A,($EBAE) | Object number (if any) from table at 736F that has been offered to the warlock | ||
CE74 | LD D,A | Temp store in D register | ||
CE75 | CP $00 | |||
CE77 | JR Z,$CED4 | If nothing has been offered, jump out to next routine handling warlock missiles | ||
Maroc has offered an object to the warlock in a trade for the warlock's item.
Alternatively Maroc can destroy the warlock to obtain its held object, if he has a powerful enough spell.
|
||||
CE79 | LD A,($EB46) | Warlock number (1-7) - table at 6C7C | ||
CE7C | LD C,A | Temp store in C register | ||
CE7D | LD A,($EBAF) | Single byte containing both the object's attribute/colour and its 'value' | ||
CE80 | RRA | The trade-based value of this object is stored in bits 5-7 | ||
CE81 | RRA | |||
CE82 | RRA | |||
CE83 | RRA | ...now shifted to bits 0-2 | ||
CE84 | AND $07 | Keep a value between 0-7 | ||
CE86 | CP C | Compare against warlock number. If it's greater, it's accepted as a trade for their carried object/spell | ||
CE87 | JR C,$CEB1 | Carry here means the item value isn't high enough, so it's not accepted | ||
Item accepted by warlock - traded for carried item:
|
||||
CE89 | LD A,($EBA8) | Number of item held by warlock (from table at 736F) | ||
CE8C | LD ($EBAE),A | |||
CE8F | LD A,D | Retrieve the object number (from table at 736F) that Maroc has offered | ||
CE90 | LD ($EBA8),A | ...and store in the warlock's working data buffer | ||
CE93 | LD HL,($EB44) | Address pointer to warlock data set in table at 6C7C | ||
CE96 | INC HL | |||
CE97 | INC HL | |||
CE98 | INC HL | |||
CE99 | LD (HL),A | ...and store this object number as the warlock's held object | ||
CE9A | LD A,($EB4E) | Get the warlock's properties byte | ||
CE9D | AND %00001111 | Filter out/clear bits 4-7 | ||
CE9F | OR %01000101 | Set bit 6 (warlock ready for materialization routine) and bits 0 & 2 (item is visible and moving) | ||
CEA1 | LD ($EB4E),A | ...and restore properties byte | ||
CEA4 | LD A,$01 | Graphics frame offset (1 = no offset) | ||
CEA6 | LD ($EB50),A | |||
CEA9 | LD A,$5B | Graphics address for materialization graphics at 9877 | ||
CEAB | CALL $E0C2 | Set up graphics | ||
CEAE | JP $D27D |
Prev: CDD7 | Up: Map | Next: CEB1 |