| Routines

25856: Move ERIC from the midstride position and scroll the screen if necessary

Called from the main loop at 26471 when ERIC is midstride.
25856 | LD HL,32745 | Set ERIC's midstride action timer at 32745 to 0 to indicate that ERIC will no longer be midstride after this movement
25859 | LD A,(HL)
25860 | LD (HL),0
25862 | DEC L | Set ERIC's main action timer at 32744 equal to the previous contents of 32745
25863 | LD (HL),A
25864 | LD HL,44131 | Point HL at byte 99 of ERIC's buffer
25867 | CALL 25108 | Update the SRB for ERIC's current location
25870 | LD L,99 | Pick up ERIC's next animatory state in A (from byte 99 of his buffer) and his next location in DE (from bytes 100 and 101)
25872 | LD A,(HL)
25873 | INC L
25874 | LD D,(HL)
25875 | INC L
25876 | LD E,(HL)
25877 | CALL 25008 | Update ERIC's animatory state and location and update the SRB
25880 | CALL 27026 | Update the display
25883 | CALL 65106 | Make a walking sound effect
Decide whether the screen should be scrolled left or right.
25886 | LD HL,44128 | Point HL at byte 96 of ERIC's buffer
25889 | LD A,(32512) | A=X: leftmost column of the skool on screen (0-64)
25892 | BIT 7,(HL) | Is ERIC facing left?
25894 | LD L,98 |
25896 | JR Z,25907 | Jump if so
25898 | CP 64 | Is the far right end of the skool on screen?
25900 | RET Z | Return if so
25901 | SUB (HL) | A=X-x (x=ERIC's x-coordinate)
25902 | CP 234 | Is ERIC's screen x-coordinate 22?
25904 | RET NZ | Return if not
25905 | JR 25820 | Otherwise scroll the screen left 8 columns
25907 | AND A | Is the far left end of the skool on screen (X=0)?
25908 | RET Z | Return if so
25909 | SUB (HL) | A=X-x (x=ERIC's x-coordinate)
25910 | CP 247 | Is ERIC's screen x-coordinate 9?
25912 | RET NZ | Return if not
25913 | JP 25810 | Otherwise scroll the screen right 8 columns