friday, 6 july 2007

posted at 22:01

I have a development environment for demos! I didn't have much luck figuring out the cc65 linker - I think its really meant for "proper" linking, like real relocatable Unixy kind of things (and I'm being highly descriptive, I know). The assembler is good though - I like the format (very close to Turbo Assembler), and via cl65 its trivial to run.

So, I've written a couple of tools to make things work the way I want. 64asm loops over all .s in the current directory, extracts their start address from a .ORG directive, and calls cl65 to assemble them. The start address gets embedded into the filename for 64link. This one takes multiple files with their load locations in the filename, loads them all into a "virtual" 64K memory space, and then spits the whole lot out in a format that can be loaded directly by a C64. Now building a demo part from source and pulling in all its necessary pieces (music, graphics, tables, text, etc) is two simple commands. The gory details are over at toybox.

There's a few other tools I'll need as time goes on - a sine/cosine table generator, an ASCII-to-screencode and a code relocator, and probably others. I'd also like to write a proper 64 assembly mode for VIM with syntax highlighting. And while we're at it, a crazy-smart hex editing mode for VIM would be totally awesome - every hex editor I've tried so far is complete pants.

I've been refactoring an unreleased demopart from 1997 to get a feel for the new setup. Its working perfectly, which makes me happy. I wrote some rather shoddy code in those days so I've been able to clean up a fair bit of it. Most notably, I've removed all the self-modifying code - its really not a smart idea. I've also been adding comments, but its tricky - I didn't write any comments the first time, and the whole thing is based on some rather complex maths I worked out when I wrote it (reducing rotation matrix calculations so that there's no multiplications in it), so I don't quite get all of it. Its proven the development environment is solid though, which makes me happy.

Next is to implement the dot tunnel :P