In my most recent video on YouTube in my programming series I show the results of optimizing GET and PUT routines by ignoring the ,G option (which captures “graphic detail”) and ignoring the G option allows us to GET and PUT faster, however what we get, and where we put it become important. We need to grab graphics data in 8 pixel wide widths, which deals with data on BYTE boundaries rather than forcing the CPU to process data at the BIT level, this is computationally faster.
Before we get more into that, let’s look at some of the improvements to the actual spaceship itself. We start by changing the DRAW command to start an improved looking spaceship, but it’s a hollow outline:
We then paint in the spaceship:
OK so that’s better, but let’s make the rocket boosters look better and add some “engine glow”
Now we have a spaceship! Let’s take this, PRESET it to start our reverse mask:
This will blank out the background behind the ship, but since it’s solid white, and could appear in front of white planets, I wanted to add an additional black border around the spaceship, so I drew a black outline around the reverse mask, increasing everything 1 pixel in all directions:
Wit this improved reverse mask, I can PUT the spaceship against any background object or color, and never have it get lost:
Cool, right? Let’s look at some of the code changes to make this possible:
These improved DRAW statements changed the shape, or overall design, and I then painted in the ship, drew the lines to separate the engines from the glow, and added color to the engine glow by adding odd black pixels to the while bar, forcing artifact colors. Now let’s look at how wet GET things, without the ,G option and what the improved coordinates, or dimensions of the object become;
The spaceship is now 16×20 pixels, reduces from the original 40×40, I then GET the spaceship into the array SP, and then PRESET it to being the revers mask.
Line 28 adds an additional 1 pixel outline around the reversed MASK which will allow my spaceship to appear outlined on the screen. We then GET this new reverse MASK into the variable RM. Now let’s look at the improved process of PUTTING this spaceship, and GETTING the background without the ,G option:
Line 90 no longer lets the X coordinate be completely random, but it picks a random number and multiplies it by 8, so the X position will always bee at an exact BYTE location in memory.
Line 96 allows me to GET the background without the ,G option which will allow it to be PUT back faster. Lines 96-98 show that the dimensions we are capturing are reduced to 16×20 now, as well, which also increases the PUT performance. The end result looks like this:
If you’d like to download this latest demo to try at home click the link for getput42.dsk, unzip that file, and the use the .DSK image on a CoCo or emulator.
1426total visits,1visits today