Memory, memory and memory


For those interested in the game coding behind the scenes.


It's been my first C64 game, and it's quite an adventure.

First I wanted to write the whole thing in C, and there are a few C compilers out there.  But a C compiler for the C64 is not really going to give you the same experience as a C compiler for making a program on the PC.   

To start, you need speed. And lot's of it.  Some compilers want to be very compatible with the C language, and others will focus on speed over functionality.

I chose KickC, in other words, I chose speed.  
Not that my game needs that much speed, since it's a simple snake game.  But it's supposed to be a first in a few games.  And I want to test the compiler to see if I am happy with it.

So now to memory.

The C64 has very little memory (ram), and if you want to access all of it you need to do tips and tricks.

For instance, I was looking at adding cutscenes.  And noticed that the graphics data at the end of my code and regular data was failing.

The screen was not looking as I intended.  So what happened?   Well the C64 VIC2 graphics chip cannot see all the 64KB.  It is chopped into 4 banks.  And just before the end of my data, there was the character data.  So the character data  and data were overlapping.   Then I realized, I need to move the character data elsewhere.    But there was no more place in the current VIC bank.  So I needed to move the character data to another bank. But all graphics data needs to be in the same bank.  This includes the screen. So I needed to move the screen as well, as the sprites.

Having done that a few times, I had no place to move gfx data.  All the memory in the C64 was taken, and the memory left was taken by ROM.  So here I had to turn off the ROM so I had memory left for the GFX.

A lot of effort went to memory shuffling the gfxdata, other data and code.  And I haven't added the music yet.  But things are getting together now.   Only thing is, after all this shuffling, somewhere it went wrong, and there is some memory corruption somewhere.  This causes the sprites to be corrupted, and the events to fire at random.

I hope to have it all working again in a few weeks again though.  I had a nice offer of a yet to be named magazine to publish my game.  I am really excited about this.  It is an awesome magazine, and it will be so cool to be mentioned in it.

Thanks for reading!  
Feel free to comment or ask anything about the game.

Have a great evening!
Cheers
/CKs

Get SnakeEscape64 [ZZap64 Coverdisk Demo]

Leave a comment

Log in with itch.io to leave a comment.