All Those Years Ago

By Kevin Ryan

Posted on March 13th, 2016

I worked on Zoo Master during my senior year the University of Oregon in 1983. It was written for the 48k Apple II Plus in 6502 machine language. The Apple II was 1 Mhz so you would want to do coding tricks like unroll your loops for speed. Most of the instructions took between 2 and 4 cycles.

I think I remember the resolution being 280×192. The Apple II also had a interesting way of specifying pixel colors. If two neighboring bits were set then the color would be white otherwise the color would be either red, green, blue, or purple depending upon if the pixel was on a even or odd screen pixel location and also whether the 8th bit was set or not. Three zero bits in a row would give you at least one black pixel.

zooMasterFront
www.topmeadow.com/plans/white720x4.jpg
At the time I did not have an assembler so I wrote it by typing in all the instructions in HEX code into the Apple. The branch instructions in 6502 were relative to the current instruction memory location. So if I wanted to branch forward to an instruction 10 bytes ahead I’d use $0A and for branching backwards I’d use a negative number like $F4. For forward branches I had to estimate how many bytes my code would need to jump over and then go back and fix the branch instruction if I got it wrong.

Since I wasn’t using an assembler everything ended up being hard coded to fixed memory locations on the Apple. The upshot of this was that I had to write bug-free code because they would be a pain to fix. I actually did have a couple bugs where I ended up I having to JMP to a free memory area do what I needed to do and then JMP back using some NOPs to clean up in the patch area. Went against my structured code college stuff, but what else could I do. I think there was an assembler available for the Apple back then, but it was beyond my college days budget.

Funny how I can still remember what hex values correspond with which 6502 instructions – for example:

$20 – JSR — jump subroutine

$4C – JMP  — jump

$60 – RTS — return subroutine

You had three 8 bit registers available to do computation with, but only the A register could be used for addition or subtraction. You could only increment (INX,INY) or decrement (DEX,DEY) the X and Y registers. There was an add with carry (ADC) instruction so you could do 16-bit computations easier.

I wrote this game for the technical fun of it. It was published by Earthware Computer Services, but never really sold. I actually played it online a few months ago somewhere online.

After Zoo Master came out I made my home town paper which made Mom and Dad proud.

zooMasterFresnoBee