| The Hobbit (v1.0) | Routines |
| Prev: 9C8C | Up: Map | Next: 9CA5 |
|
The command routines are run more than once: first as a 'dry run' to find out whether a command is possible (for example while the parser is choosing between two objects that fit the same noun), and then for real. The flag at $B5EB is 1 when the action should really happen. If it is not, this routine sets B5EC to record that the action would have succeeded, discards its own return address and returns to the caller's caller, so the rest of the command routine is skipped. That is why the fight routine calls this after rolling the attack value but before doing anything that has a visible effect.
|
||||
| 9C99 | LD A,($B5EB) | Is this action really happening, or is it only being tried out to see if it would work? | ||
| 9C9C | CP $01 | |||
| 9C9E | RET Z | Really happening: carry on with the rest of the routine as normal | ||
| 9C9F | INC A | Only a trial: record that it would succeed... | ||
| 9CA0 | LD ($B5EC),A | |||
| 9CA3 | POP BC | ...then throw away the return address of whoever called us, so control passes back one level further, skipping the part of the routine that would actually change anything | ||
| 9CA4 | RET | |||
| Prev: 9C8C | Up: Map | Next: 9CA5 |