Routines
 Prev: \$3B46 Up: Map Next: \$3BE7
\$3B5E: Move the current character
Used by the routine at \$3AB4.
\$3B5E LDA \$60 Pick up the current character number from \$60.
\$3B60 CMP #\$12 Is it \$12 (BOY WONDER's pellet)?
\$3B62 BEQ \$3BA0 Branch if so.
\$3B64 CMP #\$13 Is the current character number \$13 (ERIC's pellet)?
\$3B66 BEQ \$3BA0 Branch if so.
\$3B68 DEC \$FF Decrement the character's movement speed change delay counter at \$FF.
\$3B6A BEQ \$3B7A Branch if it's time to consider a change in movement speed.
\$3B6C LDA \$FF Pick up the character's movement speed change delay counter from \$FF.
\$3B6E LSR A Is the new value even?
\$3B6F BCC \$3BA0 Branch if so (half the time) to move the character.
\$3B71 LDA \$3F Pick up the flags byte from \$3F.
\$3B73 AND #\$40 Is bit 6 set, meaning the character is running (or otherwise moving quickly)?
\$3B75 BNE \$3BA0 Branch if so to move the character now.
\$3B77 JMP \$3BE6 Otherwise return without having moved the character.
It's time to consider a movement speed change for this character.
\$3B7A LDA \$D41B Generate a random value between 4 and 67.
\$3B7D AND #\$3F
\$3B81 LSR A Now 2<=A<=33, and the carry flag is set if the random value is odd.
\$3B82 STA \$FF Reinitialise the movement speed change delay counter at \$FF with this value.
\$3B84 BCC \$3B90 Branch if the random value is even.
\$3B86 LDA \$3F Set bit 6 of the flags byte at \$3F: the character is running (or otherwise moving quickly).
\$3B88 ORA #\$40
\$3B8A STA \$3F
\$3B8C AND #\$05 Is bit 2 of the flags byte set, meaning this character is either a teacher, or EINSTEIN speaking?
\$3B8E BEQ \$3BA0 Branch if not to move the character now.
\$3B90 LDA \$3F Reset bit 6 of the flags byte at \$3F: the character is walking (or otherwise moving) at a normal pace.
\$3B92 AND #\$BF
\$3B94 STA \$3F
\$3B96 AND #\$0A Is bit 1 or bit 3 of the flags byte set (meaning the character is a stampeding boy, MR WACKER looking for the pea-shooter, or EINSTEIN waiting to answer a teacher's question)?
\$3B98 BEQ \$3BA0 Branch if not to move the character now.
\$3B9A LDA \$3F Set bit 6 of the flags byte at \$3F: the character is running (or otherwise moving quickly).
\$3B9C ORA #\$40
\$3B9E STA \$3F
Now we consider the character's next move. From this point, the following steps are taken:
• Otherwise, restart the command list if bit 7 of the flags byte at \$3F is set.
• Otherwise, collect the next primary command routine address from the command list, place it at \$29, and jump to it.
The address of one of the following uninterruptible subcommand routines may be present at \$B0:
\$0FBA Control the horizontal flight of a catapult pellet
\$1042 Control the vertical flight of a catapult pellet
\$1CB4 Deal with a character who's been dethroned (1)
\$1CCB Deal with a character who's been dethroned (2)
\$1CEC Deal with a character who is looking for a seat
\$267A Make ANGELFACE throw a punch (1)
\$2696 Make ANGELFACE throw a punch (2)
\$26E0 Make ANGELFACE finish punching or BOY WONDER finish firing his catapult
\$2A43 Deal with a character who has been knocked over
\$2B21 Make BOY WONDER fire his catapult (1)
\$2B3F Make BOY WONDER fire his catapult (2)
\$2B52 Make BOY WONDER fire his catapult (3)
\$2B9F Make BOY WONDER fire his catapult (4)
The address of one of the following continual subcommand routines may be present at \$39:
\$26EF Check whether ANGELFACE is touching ERIC
\$270D Make ANGELFACE hit now and then
\$2797 Make the stampede leader trip people up on the way to a random location
\$2873 Make a little boy trip people up
\$2CA5 Make BOY WONDER fire his catapult now and then
The address of one of the following interruptible subcommand routines (or an entry point thereof) may be present at \$AA:
\$0C3F Make a character track down ERIC
\$1129 Make a character write on a blackboard
\$136F Guide a character to an intermediate destination
\$13F3 Guide a character up or down a staircase
\$16E9 Make a teacher wipe a blackboard
\$1F1E Make a teacher wait for EINSTEIN to finish speaking
\$2387 Make a character speak
The address of one of the following primary command routines (or an entry point thereof) may be present at \$29:
\$09E9 Make a teacher conduct a class
\$0A57 Do nothing
\$0A58 Make a teacher conduct a class with ERIC
\$0E35 Make a teacher perform dinner duty
\$0EB4 Restart the command list
\$0EC2 Restart the command list unless it's time to start the lesson
\$105B Make a character go to a random location
\$1A04 Make a character walk up and down until a certain time
\$1D16 Make a character find a seat
\$1F4D Control EINSTEIN during class
\$1FA0 Make a teacher tell the kids to sit down
\$2757 Make a teacher tell ERIC to go home, and end the game
\$277D Make MR WACKER give ERIC 2000 lines
\$27AB Make a character walk up and down a few times or until a certain time
\$284F Make MR WACKER run to a given location
\$2865 Place a continual subcommand routine address into a character's buffer
\$2885 Make a little boy find and follow little boy no. 1
\$28AB Make BOY WONDER write on a blackboard
\$28BC Make little boy no. 10 give ERIC a message
\$2A99 Make a character find ERIC
\$2AF9 Raise the signal for a certain event and move to the next command
\$2B0D Lower the signal for a certain event and move to the next command
\$3BA0 LDA \$B1 Is there an uninterruptible subcommand routine address at \$B0?
\$3BA2 BEQ \$3BA7 Branch if not.
\$3BA7 LDA \$3A Is there a continual subcommand routine address at \$39?
\$3BA9 BEQ \$3BB4 Branch if not.
\$3BAB LDA #\$3B Push \$3BB3 onto the stack so that we return to \$3BB4 below after executing the continual subcommand routine.
\$3BAE LDA #\$B3
\$3BB0 PHA
\$3BB4 LDA \$AB Is there an interruptible subcommand routine address at \$AA?
\$3BB6 BEQ \$3BBB Branch if not.
\$3BBB LDA \$3F Pick up the flags byte from \$3F.
\$3BBD ASL A Is a command list restart required (bit 7 set)?
\$3BBE BCC \$3BDF Branch if not.
\$3BC0 LDA \$3F Reset bit 7 of the flags byte at \$3F.
\$3BC2 AND #\$7F
\$3BC4 STA \$3F
\$3BC6 LDA \$3D Copy the command list start address from \$3D to \$3B. This has the effect of restarting the command list.
\$3BC8 STA \$3B
\$3BCA LDA \$3E
\$3BCC STA \$3C
\$3BCE LDY #\$00 Remove the address of any continual subcommand routine from \$39.
\$3BD0 STY \$3A
This entry point is used by the routine at \$2865.
\$3BD2 JSR \$3BE7 Collect the address of the primary command routine from the command list and place it into the character's buffer at \$29.
\$3BD5 STA \$29
\$3BD7 JSR \$3BE7
\$3BDA STA \$2A
\$3BDC JMP \$3BE3 Jump forward.
\$3BDF LDA \$2A Is there a primary command routine address at \$29?
\$3BE1 BEQ \$3BCE Branch back if not to collect one from the command list.