I’ve created a few single file intros now and have been interested in expanding out to something bigger. There are some pretty awesome one file demos around that I’d like to work my way towards, but I’d also like to be able to have the option to load content off disk. From some initial research, I found there were a handful of common loaders around that people used. My first thought was to dive in and learn to use one. Before I do that however, I wanted to take a step back and start from the start to gain a much deeper understanding of how loaders evolved. Many of the demos I grew up with in the late 80’s and early 90’s contained multiple parts that were loaded separately off disk (or tape) and I felt this would be a good starting point.
While browsing through the C64 memory map, I noticed a kernal routine specifically for clearing the screen. While I prefer the later methods I outlined in my earlier post (here), it’s a quick one liner to get the job done, and I will be making use of it in coming examples to keep the code length down.
The routine is found at $e544.
I love finding little things like this as I explore the memory map. Sometimes it useful routines, other time it’s blocks of memory or registers designed to do something I’ve been thinking about in my head. It’s a shame they don’t make systems like this to develop for anymore.
Having settled on the use of the win2c64 compiler for now, I wanted to push ahead and continue getting my hands dirty with the 6502/6510 instruction set. I decided to write a simple routine that would clear the screen.
The first step I figured would be to write the basic version. It’s quite a straight forward routine. The default screen memory location starts at $0400 (or 1024 in decimal) and is 1024 bytes long. The first 1000 bytes is allocated for the screen characters (40×25) and these are the bytes I need to modify when clearing the screen.
For this routine, I figured I’d simply populate the screen with spaces to “clear” it. All the routine needs to do is poke the decimal value for space (32) into each screen character location.