![]() |
Routines |
| Prev: 8F3B | Up: Map | Next: 8FCD |
|
Runs in the commanded direction until the way is blocked. Reached through the action table at ActionTable, dispatched by Turn_RunTheHandlerIfPresent.
|
||||
| Action_Run | 8FAD | LD A,$0A | Roll a random number below 0A. | |
|
Roll a random number.
|
||||
| 8FAF | CALL GetRandomNumber | Call GetRandomNumber to roll a number from the limit in A. | ||
| 8FB2 | CP $00 | Jump back to Action_Run when the roll is zero. | ||
| 8FB4 | JR Z,Action_Run | |||
| Action_Run_Loop | 8FB6 | LD B,A | Copy the result into B. | |
| 8FB7 | CALL TableFindAnExitInADirection | Call TableFindAnExitInADirection to find an exit in the direction in A. | ||
| 8FBA | CP B | Jump to Action_Run_StartTheMove if this exit's direction is the one being sought. | ||
| 8FBB | JR Z,Action_Run_StartTheMove | |||
| 8FBD | LD A,B | Try the next direction and jump back to Action_Run_Loop while it is below 0A. | ||
| 8FBE | INC A | |||
| 8FBF | CP $0A | |||
| 8FC1 | JR C,Action_Run_Loop | |||
| 8FC3 | LD A,$01 | Set the direction back to 01. | ||
| 8FC5 | JR Action_Run_Loop | Jump back to Action_Run_Loop to find an exit in the direction in A. | ||
| Action_Run_StartTheMove | 8FC7 | LD ($B6E7),A | Update *CurrentAction. | |
| 8FCA | JP Action_Direction | Jump to Action_Direction to move. | ||
| Prev: 8F3B | Up: Map | Next: 8FCD |