| Routines

51DC: Guide a character onto the catwalk or off it

Used by the routine at 52A0. Makes a character walk in from the left to the middle of the screen (at which point his name may be changed), or from the middle of the screen and off to the right.
51DC | LD B,$28 | The character will walk 40 paces
51DE | PUSH BC |
51DF | LD H,$D2 | We use ERIC's buffer at page 0xD2 to control the character
51E1 | CALL $61B4 | Update the SRB for the character's current animatory state and location
51E4 | INC A | A=character's next animatory state
51E5 | AND $FB
51E7 | BIT 0,A | Is the character midstride now?
51E9 | JR NZ,$51EC | Jump if so
51EB | INC E | Otherwise move forward a pace
51EC | CALL $6130 | Update the character's animatory state and location and update the SRB
51EF | CALL $62A0 | Update the display
51F2 | CALL $53AB | Make a walking sound effect
51F5 | LD C,$64 | Wait a bit
51F7 | DJNZ $51F7
51F9 | DEC C
51FA | JR NZ,$51F7
51FC | POP BC |
51FD | DJNZ $51DE | Jump back until all 40 paces have been walked
51FF | RET |