Amica paint is a C64 tool designed to create bitmap images. I’ve never used it myself, but I know of people that do. One person in particular who has helped me out with some graphics (JSL) uses this a lot. The bitmaps he has sent me have been in this format. To get them into my productions, I have to jump through a few hoops, so I decided to create a script which could export them into a format ready to go into my .asm files. This post will go into those hoops a little bit, along with the script to make my life easier when extracting the bitmap data.
When I receive the bitmaps, the come on a .d64 disk image. This image contains a loader and the image file as a seperate .prg file on the disk. Using a tool like DirMaster (link) I can export the .prg into a new file on my hard drive. With the .prg extracted as a physical file outside the .d64, I’m ready to start converting it.
Why convert it instead of just dumping the data into my .asm file? Because the logos are usually 8 or 9 characters high at most. That leaves the rest of the data unnecessary. Although the data is run length encoded, it’s still a lot of wasted bytes I don’t need to be loading or filling memory up with. It also has an extra table at the end of the file I do not need. As an example, one 9 char high logo was originally compressed as 3724 bytes. After stripping out the unnecessary data and compressing again (still using rle), that came down to 3242 bytes – cutting off a nice 482 bytes.
Therefore, I want to be able to inflate the compressed data from the .prg and then only compress the lines I wish to use. First thing to do is look at the amica paint format itself:
Each of the data blocks are compressed with run length encoding. This format uses $c2 (194) as the escape byte. This is then followed by a count byte and then the byte to store. It also uses $c2 followed by $00 to signify the end of file.
At this point I wrote up a script in lua which would load the specified file, inflate the data, then rip out only the lines required. It will then apply run length encoding to the stripped data and save out in a text format that can be cut and paste into my .asm files.
I added multiple export options which allow the data to be compressed, uncompressed, include some header values like background colour, origin and data pointers. In the end, I have a file that looks similar to this:
It’s much easier to run the .prg through this script instead of manually editing the .prg file to only includes the lines I want and the savings in bytes make it well worth it.
With the converted data, it’s simply a matter of unpacking it into memory and then copying the screen and colour ram into the correct locations.
The script can be downloaded here: link