Routines |
Prev: 45450 | Up: Map | Next: 45505 |
|
||||||||
45466 | LD IX,24848 | Point IX at start of Magic Knight's current inventory | ||||||
45470 | LD A,(24768) | Load Magic Knight's current strength into A | ||||||
45473 | PUSH AF | Store AF (A = Magic Knight's current strength) | ||||||
45474 | LD BC,1280 | Load B with 5 (as five inventory slots to check) and C (total weight carried) with zero | ||||||
45477 | LD A,(IX+0) | Load object in current inventory slot | ||||||
45480 | OR A | If no object present... | ||||||
45481 | JR Z,45492 | ...skip ahead to 45492... | ||||||
45483 | CALL 45351 | Load A with weight of object A | ||||||
45486 | ADD A,C | Add C to this... | ||||||
45487 | LD C,A | ...and load result into C (total weight so far) | ||||||
45488 | INC IX | Advance to next inventory slot | ||||||
45490 | DJNZ 45477 | Loop back for next inventory slot | ||||||
45492 | POP AF | Restore AF (A = Magic Knight's current strength) | ||||||
45493 | AND 127 | Ensure that strength is capped at 127 and that sign flag is reset | ||||||
45495 | SUB C | Subtract total weight of Magic Knight's carried objects from his strength to get "surplus" strength... | ||||||
45496 | LD C,A | ...and load into C | ||||||
45497 | LD A,(41779) | Load A with index of Current Object (i.e. object Magic Knight is trying to pick up) | ||||||
45500 | CALL 45351 | Load A with weight of object A | ||||||
45503 | CP C | Set sign flag if surplus strength exceeds weight of object, otherwise reset | ||||||
45504 | RET | Return |
Prev: 45450 | Up: Map | Next: 45505 |