jbnbeeb wrote:
a) What is the concept behind the writing to the screen beyond &7FFF?
b) How do you implement it?
When the screen is scrolled so that the display address goes beyond &7FFF, the address is wrapped-around to the screen start by adding in a value that's appropriate to the current screen size. This value is controlled by something called the addressable latch but only certain values can be set (corresponding to the sizes of the Beeb's standard modes 0-6):
Code:
Modes Size Value to add in
0,1,2 20K 12K
3 16K 16K
4,5 10K 22K
6 8K 24K
The latch value can changed by programming the System VIA - page 419 of the Advanced User Guide has more details but you only need to change the latch value if you are looking to scroll a custom made mode. For example, if you've created a 128 x 256 pixel "Mode 2", this will create a 16K screen. To scroll it correctly, the addressable latch needs to be setup as it would be for Mode 3 and not Mode 2.
Assuming the latch has been set correctly, which it will be if you're using a standard mode, scrolling is "just" a matter of adjusting the screen start address in registers 12 and 13 (R12, R13) of the CRTC. There's an example in BASIC on page 374 of the Advanced User Guide.
jbnbeeb wrote:
c) What happens to screen addressing? e.g. I have a pixel on the screen whose address is known prior to scroll. Screen is then scrolled. Will it's address be the same?
If you're thinking of the pixel as having a particular location on the screen (e.g. the top-left corner) then its address will have changed following scrolling. However, if you're thinking of the pixel as the red dot that you've drawn, then although the red dot will have moved following scrolling, its address won't have changed.
When writing something like a vertically scrolling game, you have to bring in new data at the top of the screen when it has been scrolled. This means keeping track of the screen start address (the top left corner) and writing the appropriate amount of new data over the old data that has just passed off the bottom of the screen and wrapped around to the top. Of course, you also need to keep track of the screen start address so that you can update R12 and R13.
Hope this helps - I'm sure others can explain it much better than me.
Cheers,
Rob