Chapter 11 - December 15th, 2013

Houston, we have scrolling!

With the buildup to Christmas, it seems that everyone and everything is out to ensue I have no free time to relax in front of the CoCo. But after a long delay, I can finally report that I have the split screen 1 byte hardware scrolling working as planned.

As a bonus, I have also spruced up the title page (yet again), created a BASIC loader that will load all the modules and added the ability to operate on both the 1986 and 1987 GIME chip equipped CoCo3.

Smooth scroll

All along, my concern has been whether the scrolling routine will consume too many CPU cycles and negate my chances of running the game at the full 60/30 frames per second (30 frames plus a blank for interlace). I am happy with the results.

To summarise, my code is currently being interrupted at every third scanline. This interrupt routine monitors the video scanline and modifies the horizontal offset on the screen to create the split screen scrolling. It also runs a two channel sound sample player for sound effects. This routine plus the time require to decode the mapdata and recreate it on the screen had me concerned but fortunately the results have been better than I expected.

The new terrain data, which consists of the ceiling and ground components, are drawn just off from the right edge of the offset screen. To minimise the amount of drawing and provide optimisation, I blasted the data that was there first with a fast routine that employed an unrolled loop. In other words, I minimised the looping structure and repeated commands sequentially to obtain a high speed. This erasure is necessary to clear old terrain data that has looped over and would have scrolled in for a repeat appearance.

The erasure was done using a solid color which is used as the terrain itself. All I need to do next is write a tight loop to cutout the gap between the ceiling and the ground at the correct points. I could still improve this routine further if I unrolled this loop but the position and size of the cutout varies so much and I got lazy and avoided the added complexity for now and can come back to it later if I need to.

If you recall in an earlier blog chapter, I had a method of measuring the time used by setting the border color to red at the start of the main game loop and resetting it to black when finished. The images below are representations of these times. These are worst case measurements achieved when I have no ceiling or ground so therefore the area that is erased and cut out is the full vertical height of the play area. 


My original simple scroll test before the final terrain routine.
Note the red border at the top. The higher up it is, the better.

Again but with the full terrain routine running a worst-case-scenario.
When there is a ceiling and ground area, it actually consumes less time.


Below right is a still shot of the terrain. Note the change in the level display at the top area of the screen... there is no BASE anymore. I felt that having the BASE at the end was too much like arcade Scramble. As I progress,  I keep changing my ideas and hopefully I can end up with a game that can be considered original.

For speed and simplicity, I will keep the color of the ceiling and ground the same. I'm toying with the idea of adding another color for extra detail on the edges of these and may later try it and see what the speed penalty is. At the end of this blog page is a link to YouTube where you can see it fully animated in all its glory!

The scrolling is silky smooth on real hardware. The emulators are close with the occasional jitter. The YouTube video is very jittery due to the video capture and compression. I'll try and improve this next time.

Currently I've only defined two screens worth of terrain and have these looping but the program's capability is for 200 screens allocated in an 8K block of data.

The speed of the scroll is faster than what I would have like for the game. It's slower than what it would have been if I had not done the 1 byte scroll but still faster than what I would have liked. There are ways to slow it down but I want to try and keep the smoothness that I currently have with scrolling at 60/30 frames per second.

 '86 and '87 GIME chip compatibility

Due to differences in interrupt timing of each of these chip versions, there is a need to have different settings for the counting of scanlines. This required a change of 2 scanline count variables. My computer uses the 1987 GIME and so I wrote the timings to suit this. When I used a 1986 GIME or even when I tried running my program on the VCC emulator, the split screen scrolling didn't work.

I have corrected these timings so now I can make it work on both GIME chip versions and it also works on the VCC emulator. Clearly VCC has been created with the 1986 GIME as the template.

I am tossing up whether to add some auto detect feature in the code. This involves measuring the timings of the GIME but I am concerned that these timings may not work accurately or reliably when running on the current emulators or in future versions. I have therefore added a manual setting within the BASIC loader to allow the user to choose which GIME chip they are using.

A new and improved Title Page... again!

I keep improving the Title Page and this time around, I'm very happy with the results. The small picture of our hero in his yellow craft just sets the scene. I also decided to emphasis the split in the word 'POPSTAR' to highlight each word, especially the 'POP'. This is to differentiate with the musician Popstar but still have the double interpretation. Now he is more a STAR of POP'ing objects... if that makes sense.

I have also incorporated the new title graphics as part of the BASIC program loader which loads all the game modules together complete with a loading progress bar. I like doing it this way because it is easy for me to change a module if I need to.


Click on the image above to see a YouTube video of my progress. 



Copyright 2013 by Nickolas Marentes