Prev: $19A5 Up: Map Next: $1A50
$1A04: Make a character walk up and down until a certain time
This corresponds to $62D7 in the ZX Spectrum version.
Used by command lists $88, $8C, $8E, $90, $92, $94, $96, $98, $9A, $9C, $9E, $A0, $A2, $A4, $A6, $A8, $AA, $AC, $AE, $B0, $B2, $B4, $BA, $BC, $C6, $C8, $CA, $CE, $D0, $D2, $D4, $D6, $D8, $DA, $DE and $E0.
$1A04 LDA $3F Reset bit 1 of the flags byte at $3F: the character is not running continuously.
$1A06 AND #$FC
$1A08 STA $3F
$1A0A JSR $3BE7 Collect the event identifier from the command list and store it at $A6.
$1A0D STA $A6
$1A0F LDA $FC Copy the character's current x-coordinate to $A7. This will be the walkabout origin x-coordinate.
$1A11 STA $A7
$1A13 LDA #$1A Replace the address of this primary command routine in the character's buffer with that of $1A1B below.
$1A15 STA $2A
$1A17 LDA #$1B
$1A19 STA $29
This entry point is used by the routine at $27AB.
$1A1B LDA $A6 Pick up the walkabout event identifier from $A6.
$1A1D JSR $31D2 Has the signal for this event been raised?
$1A20 BCC $1A37 Branch if not to begin another mini-walkabout.
$1A22 LDA $FC Pick up the character's x-coordinate from $FC.
$1A24 CMP $A7 Is the character at the walkabout origin?
$1A26 BNE $1A30 Branch if not.
$1A28 LDA $26 Pick up the character's animatory state from $26.
$1A2A LSR A Is the character midstride?
$1A2B BCS $1A30 Branch if so.
$1A2D JMP $1D2D Otherwise terminate this primary command.
$1A30 LDA $A7 Pick up the walkabout origin x-coordinate from $A7 and copy it to $AC, making it the next mini-walkabout destination.
$1A32 STA $AC
$1A34 JMP $1A45 Jump forward.
The signal has not been raised yet, so it's time for another mini-walkabout.
$1A37 LDA $D41B Generate a random value between 0 and 7 and store it at $57 temporarily.
$1A3A AND #$07
$1A3C STA $57
$1A3E LDA $A7 Pick up the walkabout origin x-coordinate from $A7.
$1A40 SEC Subtract the random value between 0 and 7 and store the result at $AC. This will be the walkabout destination x-coordinate.
$1A41 SBC $57
$1A43 STA $AC
$1A45 LDA #$13 Place the address of the interruptible subcommand routine at $136F into the character's buffer.
$1A47 STA $AB
$1A49 LDA #$6F
$1A4B STA $AA
$1A4D JMP ($00AA) Jump to $136F.
Prev: $19A5 Up: Map Next: $1A50