Bitmapping

This time I want to output a little bit more than just “Hello World!” onto the screen.

I did a design for the ui I’d like to use in the game with Multipaint. A great little program that allows the user to pixel paint using the restrictions of multiple classic 8 bit computers. I export this design as a text file containing all the bitmap data as assembly .byte data. That makes it easy to import into the code.

Importing the Bitmap Data

I take the resulting file and simply change it to an asm. Then I change the comment style to match the one used by Kick Assembler and move the border and background color as well as the row data to the end of the file so that it immediatly starts with the bitmap data. I also add some labels to the data for easier access.

Updating the code

Last time I allready switched the VIC-Bank to start at $4000 now I also set the space reserved for the Basic Rom to free Ram as I won’t need it anyway.

Copy to Clipboard

Now I import the Multipaint data at memory address $6000.

Copy to Clipboard

The screen initialization routine gets changed as well. First off I change the VIC memory pointers to look for bitmap data at address $6000. Then I change two VIC control registers to switch to bitmap mode and activate multicolor mode. Finally I load the color data for border and background from the exportet Multipaint file.

Copy to Clipboard

A little bit of cheating…

As I have imported the Multipaint data at $6000 and ensured the bitmap data was the first thing there I don’t have to  load the data into screen ram as it is allready at the needed position since I changed the memory pointers to that specific address.

Later on I will most likely have to change that but right now I use that little cheat.

Now all that’s left is to import the color data from the exported file to screen and color ram. For this purpose I create a routine that iterates over the color data and stores it in the specific four bytes of color and screen ram.

Copy to Clipboard

Compiling the code

After compiling the code the screen shows the bitmap data as expected.

And once again I’ll run the prg file on TheC64.

And once again the complete code listing.

Copy to Clipboard