If you only want to pack a part of any screen and not bother about the remaining area, simply add the coordinates of the top left and bottom right-hand corners of the section to be packed. Note that all x-coordinates will be automatically rounded to the nearest 8 pixel boundary.
To provide you with the maximum memory saving, AMOS Professional will try and SPACK your images using several alternative strategies. It will then choose the method that consumes the least amount of memory. You are requested to be patient during the five or six seconds that this process takes, and are assured that unpacking takes less than a second, so your programs will run smoothly. If a one second delay is not acceptable to you, please see the alternative system that uses GET CBLOCK and PUT CBLOCK in Chapter 7.7.
PACK
picture compactor extension: pack screen data
Pack screen number To bank number
Pack screen number To bank number xl,y1,x2,y2
The PACK command is slightly different from SPACK, because it only compresses the image data. This means that the image must always be unpacked into an existing screen. Also there will be a slight flicker when the image is unpacked, unless the screens have been double buffered, so it is better to use single buffered screens here. Screen numbers, memory bank numbers and optional coordinates for smaller sections of the screen to be packed are used in exactly the same way as with the SPACK command, and x-coordinates are rounded to the nearest 8 pixel boundary too.
SPACK is fully compatible with the standard AUTOBACK system explained in Chapter 7.2, so it is easy to combine compacted images with moving screens. Images can even be unpacked behind existing Bobs, so it is possible to exploit this command together with SCREEN OFFSET to create superb scrolling backgrounds.
UNPACK
picture compactor extension: unpack a compacted screen
Unpack bank number
Unpack bank number,x,y
Unpack bank number To screen number
As you might expect, this is used to unpack crunched images. Using double buffered screens will give smooth results, otherwise unpacking may get messy, and always make sure that the destination screen is in exactly the same format as the packed picture or an error will be generated.
To unpack screen data at its original position, state which memory bank is to be unpacked, like this:
X> Unpack 15
To re-draw the packed image starting from new top left-hand corner coordinates, include them