Thanks guys.
I really enjoyed writing it, and I've got some more ideas I'd like to put in when I get some time.
redbox - what sort of graphical glitches are you getting?
Are you running winape in cpc6128 mode or cpc464 mode?
The program was written using the cpc6128 library for ccz80.
Can you upload a screenshot of the sort of thing you are seeing?
The double-buffering was very tricky, as this is my first machine code game, so I kind of stumbled around and tried lots of things by trial and error.
Here's a rough summary of how it works:
- I use the IYL register (IY low byte) as a flag, so that the program always knows which "screen" is being printed and drawn to.
- the clear screen routine (using the famous stack push method for fast memory filling) checks IYL.
if IYL is 0, &8000 is subtracted from the normal screen address, and then that new location is cleared.
Otherwise the normal screen location is cleared.
ie. I am using &4000 and &c000 as the screen memory locations.
- once all plotting/drawing has been completed, IYL is checked to see which screen buffer is being drawn to.
I then switch the location of the screen memory from &4000 to &c000 (or vice versa) to display the buffered screen data, using SCR SET BASE.
Then I switch the screen-buffer-to-draw-to using SCR SET POSITION.
So if the buffer being displayed is &c000, SCR SET POSITION points to &4000, and vice versa.
I hope that made sense!
I'm sure there are several improvements that could be made to the logic I've used (and I'd love to learn as much as I can to improve it), but for a first effort I'm pretty pleased.
