Routines |
Prev: $1294 | Up: Map | Next: $136E |
This corresponds to $63BE in the ZX Spectrum version.
The address of this primary command routine is found in many command lists.
|
||||
$12B5 | JSR $3BE7 | Collect the destination x-coordinate from the command list and store it at $A6. | ||
$12B8 | STA $A6 | |||
$12BA | TAX | Transfer the destination x-coordinate to X. | ||
$12BB | JSR $3BE7 | Collect the destination y-coordinate from the command list and store it at $A7. | ||
$12BE | STA $A7 | |||
$12C0 | TAY | Transfer the destination y-coordinate to Y. | ||
This entry point is used by the routine at $105B.
|
||||
$12C1 | LDA $3F | Reset bit 1 in the flags byte at $3F: the character is not running continuously. | ||
$12C3 | AND #$FC | |||
$12C5 | STA $3F | |||
This entry point is used by the routine at $284F.
|
||||
$12C7 | JSR $126D | Determine the region identifier for the destination coordinates and store it at $A8. | ||
$12CA | STA $A8 | |||
$12CC | LDA #$12 | Replace the address of this primary command routine in the character's buffer with that of $12E8 below. | ||
$12CE | STA $2A | |||
$12D0 | LDA #$E8 | |||
$12D2 | STA $29 | |||
$12D4 | LDA $26 | Pick up the character's animatory state from $26. | ||
$12D6 | AND #$07 | Keep only bits 0-2. | ||
$12D8 | CMP #$05 | Is the character sitting on a chair? | ||
$12DA | BNE $12E8 | Branch if not. | ||
$12DC | JSR $322E | Update the SRB for the character's current animatory state and location. | ||
$12DF | LDA $26 | Clear bits 0-2 of the character's animatory state, making him stand up. | ||
$12E1 | AND #$F8 | |||
$12E3 | STA $26 | |||
$12E5 | JMP $322E | Update the SRB for the character's new animatory state. | ||
This entry point is used on the second and subsequent passes.
|
||||
$12E8 | LDA $26 | Pick up the character's animatory state from $26. | ||
$12EA | LSR A | Is the character midstride? | ||
$12EB | BCC $12F0 | Branch if not. | ||
$12ED | JMP $1390 | Move the character from the midstride position. | ||
The character is ready to start making his way to the destination.
|
||||
$12F0 | LDX $FC | Pick up the character's current coordinates from $FB. | ||
$12F2 | LDY $FB | |||
$12F4 | JSR $126D | Determine the region identifier for these coordinates and store it at $48. | ||
$12F7 | STA $48 | |||
$12F9 | CMP $A8 | Is the character already in the destination region? | ||
$12FB | BNE $1313 | Branch if not. | ||
The character is in the destination region, so it's just a straight walk left or right from here.
|
||||
$12FD | LDA $A6 | Pick up the destination x-coordinate from $A6. | ||
$12FF | CMP $FC | Does it match the character's x-coordinate? | ||
$1301 | BNE $1306 | Branch if not. | ||
$1303 | JMP $1D2D | Otherwise terminate this primary command: the character has reached his destination. | ||
$1306 | STA $AC | Store the destination x-coordinate at $AC. | ||
$1308 | LDA #$13 | Place the address of the interruptible subcommand routine at $136F into the character's buffer. | ||
$130A | STA $AB | |||
$130C | LDA #$6F | |||
$130E | STA $AA | |||
$1310 | JMP ($00AA) | Jump to $136F. | ||
The character is not in the destination region. One or more staircases need to be navigated.
|
||||
$1313 | BCC $1320 | Branch if the current region identifier is less than the destination region identifier. | ||
$1315 | LDA #$54 | Prepare to address the staircase endpoint data table at $4454. | ||
$1317 | STA $4E | |||
$1319 | LDA #$44 | |||
$131B | STA $4F | |||
$131D | JMP $1328 | Jump forward. | ||
$1320 | LDA #$40 | Prepare to address the staircase endpoint data table at $4440. | ||
$1322 | STA $4E | |||
$1324 | LDA #$44 | |||
$1326 | STA $4F | |||
$1328 | LDA #$00 | Set A equal to 4 multiplied by the region identifier for the character's current location. | ||
$132A | LDX $48 | |||
$132C | BEQ $1334 | |||
$132E | CLC | |||
$132F | ADC #$04 | |||
$1331 | DEX | |||
$1332 | BNE $132E | |||
$1334 | TAY | Pick up a staircase endpoint x-coordinate from the table at $4440 or $4454. | ||
$1335 | LDA ($4E),Y | |||
$1337 | CMP $FC | Is the character at the top or bottom of the staircase? | ||
$1339 | BEQ $1348 | Branch if so. | ||
$133B | STA $AC | Store the staircase endpoint x-coordinate at $AC. | ||
$133D | LDA #$13 | Place the address of the interruptible subcommand routine at $136F into the character's buffer. | ||
$133F | STA $AB | |||
$1341 | LDA #$6F | |||
$1343 | STA $AA | |||
$1345 | JMP ($00AA) | Jump to $136F. | ||
The character is at the top or bottom of a staircase that must be navigated.
|
||||
$1348 | INY | Pick up the staircase direction indicator ($00 or $80) from the table at $4440 or $4454. | ||
$1349 | LDA ($4E),Y | |||
$134B | PHA | Save it temporarily. | ||
$134C | LDA $26 | Pick up the character's animatory state from $26. | ||
$134E | AND #$80 | Keep only the direction bit (bit 7) and store the result at $57. | ||
$1350 | STA $57 | |||
$1352 | PLA | Restore the staircase direction indicator to A. | ||
$1353 | CMP $57 | Is the character facing the right way to start climbing or descending the staircase? | ||
$1355 | BEQ $135D | Branch if so. | ||
$1357 | JSR $322E | Update the SRB for the character's current animatory state and location. | ||
$135A | JMP $13C6 | Turn the character round. | ||
The character is at the top or bottom of a staircase that must be navigated, and is facing the right way to begin the ascent or descent.
|
||||
$135D | LDA #$0F | Going up or down a staircase requires 15 movements. | ||
$135F | STA $AC | Store this counter at $AC. | ||
$1361 | INY | Collect the interruptible subcommand routine address ($13F3 or $13FA) from the table at $4440 or $4454 and place it into the character's buffer. | ||
$1362 | LDA ($4E),Y | |||
$1364 | STA $AA | |||
$1366 | INY | |||
$1367 | LDA ($4E),Y | |||
$1369 | STA $AB | |||
$136B | JMP ($00AA) | Jump to the interruptible subcommand routine. |
Prev: $1294 | Up: Map | Next: $136E |