S |
For the longest time, QB programmers have been using the BSAVE command to save screens to files. However, the only problem we have faced is with the color palette. A typical BSAVE does not save the palette, so unless we work around this then our colors will be lost and our image appears messed up. Well, Rich Geldreich knew this as well, and he set out to solve the problem. His technique involved placing the color bytes above the image data in screen memory, where it wouldn't be seen, but where it could be easily accessed. When I discovered this technique, I gave it a name: SBS, short for Super BSave. Ever since, I've used this neat technique, and now I'll show you how to use it as well. The main advantage to this technique is that when done properly, it is amazingly fast. We'll use a couple of tricks to obtain maximum speed from this unique technique. Also, keep in mind that this is designed for the typical SCREEN 13, and may not work in other modes. ---CODE SEGMENT:CUT AND PASTE---
'Access the screen memory segment
'Let's read the palette and place it above the video display
'Using the standard BSAVE, we can save the whole thing to a single file!
---END OF CODE SEGMENT--- That writes a 64775 byte SBS file to disk. Your screen is saved! Now, there are two ways to load the screen back in, using the standard BLOAD or using BLOAD with a few extra lines of code. So, here we go... ---CODE SEGMENT:CUT AND PASTE---
'Access the screen memory segment
FOR A = 0 TO 767
'Restore the default segment
---END OF CODE SEGMENT--- There you have it. A set of super-fast screen read/write routines. Like a BMP file, this format is pretty large. However, using compression theories will eliminate that, but that's a story for another tutorial...
| F |