![]() |
Routines |
| Prev: $0C31 | Up: Map | Next: $0D67 |
| $0C3F | LDA $3F | Set bit 6 of the flags byte at $3F: the character is running. | ||
| $0C41 | ORA #$40 | |||
| $0C43 | STA $3F | |||
| $0C45 | JSR $1EC2 | Get ERIC's coordinates. | ||
| $0C48 | STX $08 | Save ERIC's coordinates at $08 and $09. | ||
| $0C4A | STY $09 | |||
| $0C4C | JSR $1C8E | Is the character on a staircase? | ||
| $0C4F | BCS $0C94 | Branch if so. | ||
| $0C51 | LDA $FB | Pick up the character's y-coordinate from $FB. | ||
| $0C53 | CMP $09 | Is ERIC's y-coordinate less than the character's? | ||
| $0C55 | BCS $0C63 | Branch if so. | ||
| $0C57 | LDA $09 | Pick up ERIC's y-coordinate from $09. | ||
| $0C59 | SEC | Subtract the character's y-coordinate from ERIC's y-coordinate. | ||
| $0C5A | SBC $FB | |||
| $0C5C | CMP #$04 | Is ERIC within 4 y-coordinates of the character? | ||
| $0C5E | BCS $0C94 | Branch if not. | ||
| $0C60 | JMP $0C6A | Jump forward. | ||
| $0C63 | SEC | Subtract ERIC's y-coordinate from the character's y-coordinate. | ||
| $0C64 | SBC $09 | |||
| $0C66 | CMP #$04 | Is ERIC within 4 y-coordinates of the character? | ||
| $0C68 | BCS $0C94 | Branch if not. | ||
|
ERIC and the character looking for him are less than 4 y-coordinates away from each other.
|
||||
| $0C6A | LDA $26 | Pick up the character's animatory state from $26. | ||
| $0C6C | ASL A | Is he facing right? | ||
| $0C6D | BCS $0C81 | Branch if so. | ||
| $0C6F | LDA $FC | Pick up the character's x-coordinate from $FC. | ||
| $0C71 | CMP $08 | Is ERIC's x-coordinate greater than the character's? | ||
| $0C73 | BCC $0C94 | Branch if so (ERIC is behind the character). | ||
| $0C75 | LDA $08 | Pick up ERIC's x-coordinate from $08. | ||
| $0C77 | CLC | Add 3 to ERIC's x-coordinate. | ||
| $0C78 | ADC #$03 | |||
| $0C7A | CMP $FC | Is ERIC within 3 x-coordinates in front of the character? | ||
| $0C7C | BCC $0C94 | Branch if not. | ||
| $0C7E | JMP $0C90 | Jump forward. | ||
| $0C81 | LDA $FC | Pick up the character's x-coordinate from $FC. | ||
| $0C83 | CMP $08 | Is ERIC's x-coordinate greater than the character's? | ||
| $0C85 | BCS $0C94 | Branch if not (ERIC is behind the character). | ||
| $0C87 | LDA $08 | Pick up ERIC's x-coordinate from $08. | ||
| $0C89 | SEC | Subtract 4 from ERIC's x-coordinate. | ||
| $0C8A | SBC #$04 | |||
| $0C8C | CMP $FC | Is ERIC within 4 x-coordinates in front of the character? | ||
| $0C8E | BCS $0C94 | Branch if not. | ||
|
The character has found ERIC and is facing him.
|
||||
| $0C90 | SEC | Set the carry flag to indicate that the lesson clock can be restarted. | ||
| $0C91 | JMP ($00AE) | Jump to $0C31 (with the carry flag set) or $2745. | ||
|
ERIC and the character looking for him are 4 or more y-coordinates away from each other.
|
||||
| $0C94 | LDA #$14 | Store ERIC's character number ($14) at $4D for the following subroutine call. | ||
| $0C96 | STA $4D | |||
| $0C98 | JSR $1B2E | Determine the next move of the character in his search for ERIC and store its identifier at $77. | ||
| $0C9B | STA $77 | |||
| $0C9D | JSR $322E | Update the SRB for the character's current animatory state and location. | ||
| $0CA0 | LDA $77 | Pick up the next move identifier from $77. | ||
| $0CA2 | BNE $0CA7 | Branch if there is a move to be made. | ||
| $0CA4 | JMP $0D66 | Otherwise return. | ||
| $0CA7 | CMP #$03 | Should the character go left? | ||
| $0CA9 | BNE $0CDE | Branch if not. | ||
|
The character looking for ERIC should go left.
|
||||
| $0CAB | LDA $26 | Pick up the character's animatory state from $26. | ||
| $0CAD | ASL A | Is the character facing left? | ||
| $0CAE | BCC $0CC4 | Branch if so. | ||
| $0CB0 | LDA $26 | Flip bit 7 of the character's animatory state, thus turning him round. | ||
| $0CB2 | EOR #$80 | |||
| $0CB4 | STA $26 | |||
| $0CB6 | JSR $322E | Update the SRB for the character's current animatory state and location. | ||
| $0CB9 | JSR $1C8E | Is the character on a staircase? | ||
| $0CBC | BCC $0CC1 | Branch if not. | ||
| $0CBE | JMP $0D66 | Otherwise return. | ||
| $0CC1 | JMP ($00AE) | Jump to $0C31 (with the carry flag clear) or $2745. | ||
| $0CC4 | LDA $FC | Pick up the character's x-coordinate from $FC, subtract 1 from it and store the result at $AC. | ||
| $0CC6 | STA $AC | |||
| $0CC8 | DEC $AC | |||
| $0CCA | LDA $FB | Pick up the character's y-coordinate from $FB and store it at $AD. | ||
| $0CCC | STA $AD | |||
| $0CCE | INC $26 | Increment the character's animatory state. | ||
| $0CD0 | LDA #$0D | Replace the address of this interruptible subcommand routine in the character's buffer with that of $0D40 (below). | ||
| $0CD2 | STA $AB | |||
| $0CD4 | LDA #$40 | |||
| $0CD6 | STA $AA | |||
| $0CD8 | JSR $322E | Update the SRB for the character's new animatory state. | ||
| $0CDB | JMP $0D66 | Return. | ||
| $0CDE | CMP #$04 | Should the character go right? | ||
| $0CE0 | BNE $0CF0 | Branch if not. | ||
|
The character looking for ERIC should go right.
|
||||
| $0CE2 | LDA $26 | Pick up the character's animatory state from $26. | ||
| $0CE4 | ASL A | Is the character facing left? | ||
| $0CE5 | BCC $0CB0 | Branch if so to turn him round. | ||
| $0CE7 | LDA $FC | Pick up the character's x-coordinate from $FC, add 1 to it and store the result at $AC. | ||
| $0CE9 | STA $AC | |||
| $0CEB | INC $AC | |||
| $0CED | JMP $0CCA | Jump back to move the character midstride. | ||
| $0CF0 | CMP #$01 | Should the character start or continue going upstairs? | ||
| $0CF2 | BNE $0D22 | Branch if not. | ||
|
The character looking for ERIC should start or continue going upstairs.
|
||||
| $0CF4 | LDA $FC | Pick up the character's x-coordinate from $FC. | ||
| $0CF6 | CMP #$30 | Is it 48 or more (on the right-hand side of the skool)? | ||
| $0CF8 | BCS $0D03 | Branch if so. | ||
| $0CFA | LDA $26 | Reset bit 7 of the character's animatory state at $26, thus making him face left. | ||
| $0CFC | AND #$7F | |||
| $0CFE | STA $26 | |||
| $0D00 | JMP $0D09 | Jump forward. | ||
| $0D03 | LDA $26 | Set bit 7 of the character's animatory state at $26, thus making him face right. | ||
| $0D05 | ORA #$80 | |||
| $0D07 | STA $26 | |||
| $0D09 | DEC $FB | Decrement the character's y-coordinate at $FB. | ||
| $0D0B | LDA $FB | Pick up this new y-coordinate and store it at $AD. | ||
| $0D0D | STA $AD | |||
| $0D0F | LDA $FC | Pick up the character's x-coordinate from $FC and store it at $AC. | ||
| $0D11 | STA $AC | |||
| $0D13 | LDA $26 | Pick up the character's animatory state from $26. | ||
| $0D15 | ASL A | Is the character facing left? | ||
| $0D16 | BCC $0D1D | Branch if so. | ||
| $0D18 | INC $AC | Increment the x-coordinate at $AC. | ||
| $0D1A | JMP $0CCE | Jump back. | ||
| $0D1D | DEC $AC | Decrement the x-coordinate at $AC. | ||
| $0D1F | JMP $0CCE | Jump back to move the character midstride. | ||
|
The character looking for ERIC should start or continue going downstairs.
|
||||
| $0D22 | LDA $FC | Pick up the character's x-coordinate from $FC. | ||
| $0D24 | CMP #$30 | Is it 48 or more (on the right-hand side of the skool)? | ||
| $0D26 | BCS $0D31 | Branch if so. | ||
| $0D28 | LDA $26 | Set bit 7 of the character's animatory state at $26, thus making him face right. | ||
| $0D2A | ORA #$80 | |||
| $0D2C | STA $26 | |||
| $0D2E | JMP $0D37 | Jump forward. | ||
| $0D31 | LDA $26 | Reset bit 7 of the character's animatory state at $26, thus making him face left. | ||
| $0D33 | AND #$7F | |||
| $0D35 | STA $26 | |||
| $0D37 | INC $FB | Increment the character's y-coordinate at $FB. | ||
| $0D39 | LDA $FB | Pick up this new y-coordinate and store it at $AD. | ||
| $0D3B | STA $AD | |||
| $0D3D | JMP $0D0F | Jump back to compute the character's next x-coordinate. | ||
|
The address of this entry point is placed into the character's buffer at $0CD0 above. It takes care of moving the character looking for ERIC from the midstride position.
|
||||
| $0D40 | LDA #$0C | Replace the address of this entry point in the character's buffer with that of the main entry point at $0C3F. | ||
| $0D42 | STA $AB | |||
| $0D44 | LDA #$3F | |||
| $0D46 | STA $AA | |||
| $0D48 | JSR $322E | Update the SRB for the character's current animatory state and location. | ||
| $0D4B | LDA $AC | Pick up the character's next x-coordinate from $AC. | ||
| $0D4D | STA $FC | Update the character's x-coordinate at $FC. | ||
| $0D4F | LDA $AD | Pick up the character's next y-coordinate from $AD. | ||
| $0D51 | STA $FB | Update the character's y-coordinate at $FB. | ||
| $0D53 | LDA $26 | Pick up the character's animatory state from $26, clear bits 0-2, and store the result at $57. | ||
| $0D55 | AND #$F8 | |||
| $0D57 | STA $57 | |||
| $0D59 | LDA $FC | Pick up the character's new x-coordinate from $FC. | ||
| $0D5B | AND #$01 | Adjust the character's animatory state depending on whether the new x-coordinate is even or odd. | ||
| $0D5D | ASL A | |||
| $0D5E | CLC | |||
| $0D5F | ADC $57 | |||
| $0D61 | STA $26 | |||
| $0D63 | JMP $0CB6 | Jump back. | ||
| $0D66 | RTS | |||
| Prev: $0C31 | Up: Map | Next: $0D67 |