| The Hobbit (v1.0) | Routines |
| Prev: 8C75 | Up: Map | Next: 8CC8 |
|
Checks the weights for TAKE and CARRY. Byte 3 of an object record is its weight. The target's weight, plus the weight of everything it contains (9C42), must not exceed the actor's lifting capacity (byte 3 of the actor's record), or 'the X is too heavy to lift.' And the actor's capacity minus what they are already carrying minus the new load must not go negative, or 'you are carrying too much.' Doors and other multi-place objects (91B0), and objects fixed in place, cannot be taken at all.
|
||||
| 8C86 | LD IX,($B5F8) | IX = the target's record | ||
| 8C8A | LD A,($B5D9) | A = the weight of everything in the target... | ||
| 8C8D | CALL $9C42 | |||
| 8C90 | ADD A,(IX+$03) | ...plus its own weight | ||
| 8C93 | JR NC,$8C97 | |||
| 8C95 | LD A,$FF | (capped at 255) | ||
| 8C97 | LD B,A | B = the total | ||
| 8C98 | LD IY,($B5FC) | IY = the actor's record | ||
| 8C9C | LD A,(IY+$03) | A = how much the actor can lift | ||
| 8C9F | SUB B | Can it lift the load? | ||
| 8CA0 | LD HL,$ACF7 | "the X is too heavy to lift." | ||
| 8CA3 | JR C,$8CB5 | No: say so | ||
| 8CA5 | PUSH AF | |||
| 8CA6 | LD A,($B5DB) | Subtract what the actor is already carrying | ||
| 8CA9 | CALL $9C42 | |||
| 8CAC | LD B,A | |||
| 8CAD | POP AF | |||
| 8CAE | SUB B | |||
| 8CAF | JP P,$8CBA | Still not negative: it can be taken | ||
| 8CB2 | LD HL,$ACFF | "you are carrying too much." | ||
| 8CB5 | EX (SP),HL | Print the message instead of returning... | ||
| 8CB6 | POP HL | |||
| 8CB7 | JP $72D4 | ...and stop the action | ||
|
This entry point is used by the routines at 91B9 and 9392.
|
||||
| 8CBA | CALL $91B0 | Is the target an ordinary object? | ||
| 8CBD | JR NZ,$8CC4 | No (a door, say): it cannot be taken | ||
| 8CBF | BIT 1,(IX+$07) | Objects with bit 1 set ("evaporates") can be taken; others... | ||
| 8CC3 | RET Z | |||
| 8CC4 | POP HL | |||
| 8CC5 | JP $9EBF | ...(this path) cannot: report failure | ||
| Prev: 8C75 | Up: Map | Next: 8CC8 |