The basic concept for the scrolling road is to Stack Blast 8 bytes at a time for a ROW of Road Graphics that is 8 bits high for a total of $100 address' (i.e. height) per Row. The screen consists of 22 usable Road Course Rows. The bottom two rows are used for the MISL, OIL, VAN, SMOKE, GUNS display.
Starting at Row #22 (see figure), each Row PULU's CC,D,DP,X,Y registers from the address that the Row above it PULU'd from last program loop and PSHS's them 'backwards' starting from their coresponding Row Address (e.g. $19FF+$1 for Row #22).
The last Row (Row #1) PULU's from an address in a Table ('Course') that lists the address for the next new Row Graphic.
The trick with Stack Blasting is that the Road Graphics need to be 'prepared' before PULU'ing them.
I prepared each unique Row graphic by 'Stack Blasting' them to a specific address ($6000 +) for use by the COURSE Table. See figure to right showning the address layout for the first two Road Graphics. The addresses shown are memory page 1. I added an offset ($4400+$1880) to each of them (not shown) to store in higher memory.
The cool thing that I was able do was PSHS each Row with an offset amount of bytes, therefore placing them left or right on the screen (+/- # of bytes) as needed to make turns in the course. Using an offset allowed for one Row Graphic to be used multiple times. There is a bit of visual overlap interference between Rows with the offset but it seems like a decent trade off. I'm working on hiding/reducing this interference.
This allowed me to use only (6) different Row Graphics for the entire Road Course in version SPYH21 (1/5/24)
This image shows what the first four Road Row Graphics look like in memory before and after they are 'Stack Blasted' (i.e. 'prepared').
The Course Table, for example, will list address $1A00 (plus $4400+$1800) as the address to PULU from for Road Graphic #1 (shown in green). Between $1B00 to $1BFF (in blue) is Row Graphic #1 as it is drawn and intented to look after being PSHS'd to the visible working game screen.
The Water/Bridge Graphic Rows are not shown in this image.
The image to the right is a screen shot of the code from 'SPYH21' showing how Row #22 is PULU'd and PSHS'd to the bottom of the screen.
Currently, the erasing of the sprites is accomplished each screen update since a Row includes a central black (i.e. road) section. This eliminates the need for additional erasing functions.
The Screen updates only once every SPEED loop countdown while the Sprites update every main loop.