Prev: $136E Up: Map Next: $13D5
$136F: Guide a character to an intermediate destination
This corresponds to $633C in the ZX Spectrum version.
The address of this interruptible subcommand routine is placed into a character's buffer by the routines at $09E9, $0A58, $0E35, $12B5 and $1A04.
$136F LDA #$11 Initialise the counter at $AD that determines how long this interruptible subcommand will have control.
$1371 STA $AD
$1373 LDA #$13 Replace the address of this interruptible subcommand routine in the character's buffer with that of $137B below.
$1375 STA $AB
$1377 LDA #$7B
$1379 STA $AA
This entry point is used by the routine at $BE09.
$137B DEC $AD Decrement the counter at $AD.
$137D BNE $1382 Branch unless it's zero now.
$137F JMP $1D28 Otherwise terminate this interruptible subcommand.
$1382 LDA $FC Pick up the character's x-coordinate from $FC.
$1384 CMP $AC Has the character reached the intermediate destination?
$1386 BNE $1390 Branch if not.
$1388 LDA $26 Pick up the character's animatory state from $26.
$138A LSR A Is the character midstride?
$138B BCS $1390 Branch if so.
$138D JMP $1D28 Otherwise terminate this interruptible subcommand.
This entry point is used by the routine at $12B5.
$1390 JSR $322E Update the SRB for the character's current animatory state and location.
$1393 LDA $26 Pick up the character's animatory state from $26.
$1395 LSR A Is the character midstride?
$1396 BCC $13B5 Branch if not.
This entry point is used by the routines at $13F3 and $1CEC.
$1398 ASL A Is the character facing left?
$1399 ASL A
$139A BCC $13A1 Branch if so.
$139C INC $FC Increment the character's x-coordinate at $FC.
$139E JMP $13A3 Jump forward.
$13A1 DEC $FC Decrement the character's x-coordinate at $FC.
$13A3 LDA $26 Adjust the character's animatory state at $26 depending on whether his x-coordinate is even or odd.
$13A5 AND #$F8
$13A7 STA $57
$13A9 LDA $FC
$13AB AND #$01
$13AD ASL A
$13AE ADC $57
$13B0 STA $26
$13B2 JMP $13D1 Jump forward.
$13B5 LDA $26 Pick up the character's animatory state from $26.
$13B7 AND #$80 Keep only the direction bit (bit 7) and store it at $57.
$13B9 STA $57
$13BB LDA $FC Pick up the character's x-coordinate from $FC.
$13BD SEC Subtract the intermediate destination x-coordinate, and keep only the resulting sign bit (bit 7).
$13BE SBC $AC
$13C0 AND #$80
$13C2 CMP $57 Is the character facing the right way to get to the intermediate destination?
$13C4 BEQ $13CF Branch if so.
This entry point is used by the routine at $12B5.
$13C6 LDA $26 Flip bit 7 of the character's animatory state at $26, thus turning him round.
$13C8 EOR #$80
$13CA STA $26
$13CC JMP $13D1 Jump forward.
$13CF INC $26 Increment the character's animatory state at $26.
$13D1 JSR $322E Update the SRB for the character's new animatory state and location.
$13D4 RTS
Prev: $136E Up: Map Next: $13D5