A long time ago, I was a MSX and MSX2 programmer

Page 12/12
5 | 6 | 7 | 8 | 9 | 10 | 11 |

By ARTRAG

Enlighted (6567)

ARTRAG's picture

28-12-2012, 18:46

The code needs to set r18 twice per frame: once at lint, once in vblank. In this way you can have a static scorebar and a scrolling upper part of the screen. As we go for full rate, all vdp commands have to last less than one frame, or the scroll will not work.
What I did with this last version of the code is to arrange things in such a way that all command are completed before lint occurs and when the second change in r18 is set.

Now at lint, the vdp starts filling the black columns into the border, while the cpu starts blitting the column of new pixels.
The cpu is slower blitting columns than the vdp filling a black column. While the raster is plotting the lower border, after the vdp has finished plotting its black line, the cpu pauses blitting, sets r18 and sends a large copy command of 176x16 and resume blitting. The cpu ends its blitting while the raster is halfway into the vblank time.

In this way r18 changes never occur while the vdp is coping/filling, in 16 steps you have moved the whole screen, filled a new area of 176x16 and deleted an area of the same size into the opposite border.

Page 12/12
5 | 6 | 7 | 8 | 9 | 10 | 11 |