Routines
| Prev: C8BE | Up: Map | Next: C8EF |
C8C6: Can the actor carry object A as well as what it holds?
|
Adds the object's size (D2F2) to the actor's load and compares it with the actor's capacity (+3). NZ if it fits.
|
||||||||||||||||
| C8C6 | PUSH BC | Save BC on the stack | ||||||||||||||
| C8C7 | PUSH AF | Save AF on the stack | ||||||||||||||
| C8C8 | LD A,B | Copy B into A - B = the thing's weight (+3) plus all it holds (D2F2) | ||||||||||||||
| C8C9 | CALL $D237 | Call the routine "Resolve an id (in A) to its full entity record" (D237) | ||||||||||||||
| C8CC | LD A,B | Copy B into A | ||||||||||||||
| C8CD | CALL $D2F2 | Call the routine "Total weight (+3) of everything in thing A, at any..." (D2F2) | ||||||||||||||
| C8D0 | ADD A,(IX+$03) | Add byte +3 of the record at IX to A | ||||||||||||||
| C8D3 | JR NC,$C8D7 | If it did not overflow, skip ahead to C8D7 | ||||||||||||||
| C8D5 | LD A,$FF | Load A with $FF | ||||||||||||||
| C8D7 | LD B,A | Copy A into B | ||||||||||||||
| C8D8 | POP AF | Restore AF from the stack | ||||||||||||||
| C8D9 | LD C,A | Copy A into C - The actor's +3 is how much it can carry; take off what it already carries, | ||||||||||||||
| C8DA | CALL $D237 | Call the routine "Resolve an id (in A) to its full entity record" (D237) | ||||||||||||||
| C8DD | LD A,C | Copy C into A | ||||||||||||||
| C8DE | CALL $D2F2 | Call the routine "Total weight (+3) of everything in thing A, at any..." (D2F2) | ||||||||||||||
| C8E1 | SUB (IX+$03) | Subtract byte +3 of the record at IX from A | ||||||||||||||
| C8E4 | NEG | Negate A | ||||||||||||||
| C8E6 | SUB B | Subtract B from A - then the thing: not enough left (carry) gives Z, no | ||||||||||||||
| C8E7 | POP BC | Restore BC from the stack | ||||||||||||||
| C8E8 | JR C,$C8ED | If the carry flag is set, skip ahead to C8ED | ||||||||||||||
| C8EA | OR $01 | Make A non-zero, which clears the zero flag, and hand that back to the caller - NZ: it can carry it | ||||||||||||||
| C8EC | RET | Return to the caller | ||||||||||||||
| C8ED | XOR A | Set A to zero, which sets the zero flag for the caller | ||||||||||||||
| C8EE | RET | Return to the caller | ||||||||||||||
| Prev: C8BE | Up: Map | Next: C8EF |