Dirty Tricks 6502 Programmers Use

I’ve been reading for last week 6502 Software Development by Scanlon. I’ve been sick and its been keeping me company. It is weird reading a technical programming book which is “by the book” and then read some of the code I’ve been using/borrowing/suggesting recently. My code has been riddled with so many intentional bugs/glitches to get amazing side effects. I really wonder what Scanlon would have said after reading what went on below… it is a great read for people into 6502 asm.


Trogue64: Drain of Doom (Beta)

Yes… It is in a state for review –so download it here: Trogue.

You’ll need VICE or compatible emulator. It runs best in NTSC, but I spent a lot of time getting it stable under various PAL systems.

Sometime in the ’80s, a zombie outbreak plagued the local town. A daring group of heroes lured the undead to an abandoned mine. On the 64th level, they blocked the trogue (drain) and flooded the mine.

Recently, a depth alarm has gone off — the mine is draining. Someone has popped the Trogue!

Start from the lowest part of the mine, activate 9 pumps to flood the ravenous undead before they can escape. Each pump raises the water level, so move fast — or join the ranks of the undead!

Trogue64 Intro

All the levels are randomly generated, with a basic AI for the monsters and turn-based movement/combat. You level your character up through combat, which in turn boosts your maximum hitpoints. There is a timer though, water rushing in as the player activates the pumps on various levels. Too many pumps at once and risk drowning, not enough (say 9) by the end and you can’t escape.

There is a crowbar for extra damage, a medkit to heal, oxygen tanks for those water moments and a holy hand grenade when the denizens of the mine overwhelm you. Sometimes there is a clue that a pump exists on a level or just an old plan for that area is just lying on the floor (it might be a little outdated).

Watch the border water meter, it shows the current water level and the mine level.

Quick Introduction and play intro of Trogue64

Trogue64 Programming Notes: Part 1 GFX

Before we begin…

There were a lot of things that I learned in the process of making this game. I can’t imagine making something like this back in the day. I’ve always had a lot of respect for the games and software developed for the machine on the machine. Without emulation, this would have been a real mess.


I’ve never made MultiColor GFX (serious ones) and it was always this mystery to get a koala painter image going with a scroller. I always wanted to make an ESI Intro (that eagle one). Draw a cool picture, make a custom font scroller and bang out a simple tune. I could do everything but the picture.. there was always something getting in the way.

Cross Development is really hard in the MC Picture side of things. I’m used to Photoshop or Deluxe Paint for source material.. but getting it looking ok on the commie was a royal pain. At the end after piles of crashing plugins and ageing software, I found something that works great:

Watch Dan do the magic…

Photoshop using the Dan Fessler method -> GangEd ( https://csdb.dk/release/?id=19831 ) -> PRG for Import or Viewing on Real C64 -> MMC64 Cart

Photoshop could be replaced by any other bitmap software, but it is what I am comfortable with. GangEd is great for the conversion and troublesome as an editor. I would love to help clean up that application.

I’m colour blind ( Protanopia ), so having some colour conversion or colour by numbers is really helpful. So the tool/dev chain above really helps.. if I had to come up with gradients by eye… well that is not going to happen. Also having the commodore palette files for photoshop is really helpful.

A great resource for gradients is Daniel Krajzewicz’s notes on his blog.

I can do sprites and fonts ala code, which in the day I also had a nice editor from Compute! Gazette — but SpritePad and CharPad are awesome tools. It’s also handy to load snapshots from VICE and see charsets that have been modified by code or have as a reference for where things are.

One of my “like to have” addons for Trogue64 is fade/pattern wipe for the intro graphic. It’s not hard but I had to draw the line somewhere to get this to Beta.

C64: First 8K Generic Cart

As of today, I made my first C64 cartridge. Most of my programming experience is either through floppy or tape-based storage. Making a ROM/BIN file and getting it to work was tougher than I thought. It was more problems with getting a CRT/BIN combo into the toolchain for testing in an emulator than to actually make a cart and burn an EEPROM. My first cart is nothing amazing, but it pumps out the INC $d021’s.

C64 NIC: Networking on the Commodore 64

I have a few of these guys in a box, mostly for a long term project that I have been working on. I haven’t had much need for them in the last while as VICE has great networking support.

Lately, it has been crazy fun doing TCP/IP communications with the IP65 networking stack. It’s definitely the way to go for making games that need updates from time to time. Write a bootloader that fits in ROM, place it in the socket and off you go. Yes, there are issues with a ROM update later on and that you need to have internet access to enjoy the software. Oh well, it is a connected world.

One of these guys needs to get crossed with a 16 MB REU. It would be a pretty awesome combo. But for now; this thing is still great.

C64: 64Bites.com (teaching old dogs new tricks)



I will say three things about Michal’s c64 programming series: his videos are fun, fast and packed with information.

I am not a bad assembly programmer, -not the best- but not bad. After watching a few seasons of his videos I started to notice subtle ways to improve my style.

There is a common problem with programmers in general. We need a problem to learn something and anything else in the way gets filtered out. So when Michal’s videos had Basic language sections, I was going to skip them for more interesting topics. I’m glad I didn’t. In fact, a few assumptions (over the years) that I’ve made were proven wrong (about the DATA statement in Basic). Suddenly, I wanted to know if there were other things that I was mistaken about.

Before you complain about it being a paid service; its worth it. It’s a good refresher and it’s interesting to see how he works and his logic. He even manages to get automated testing into the mix.. on an 8bit 64k machine. It’s worth the money and I’m happy when a new episode appears in my inbox.

C64: Asteroids Emulation on a C64

Link: http://members.aon.at/nkehrer/astc64.html

Well, it’s pretty awesome. A quote from the site, explains the awesomeness of this:

Since the nineties, arcade emulators like MAME can emulate the classics like Asteroids on the PC or the Mac. This program is an Asteroids emulator for the Commodore 64. The “emulation” of the arcade machine’s CPU is done natively by the 6510 processor of the C64. The video and sound hardware is simulated by the Asteroids emulator program. In this way, the original arcade game program is executed and interpreted, and the original game play is (more or less) exactly reproduced.

I can remember the disappointment in the conversions that showed up over the years of this amazing game. It was one of the first games I loaded in MAME to check out. Well Done Norbert!