Biting the Apple: The development of Overboard

Introduction:

Ever since I've started to use 6502 actively again on my Atari 8-bit stuff, I've been eyeing some of the other 6502 machines as well. The Apple II computer was always one of the machines I was curious about exploring some day and with the Woz himself supporting Lovebyte 2023 in a big way, there was no excuse not to try and create something for release at Kansasfest 2023.

Getting to know the Apple II

Once I had my mind set on a release, I started deep diving the system and making a few small programs and trying to get used to the process of building and running both the binary and disk image. To keep the development consistent across all the different 6502 platforms, I opted to use the MADS assembler (originally written for Atari 8bit development) and exporting the binary without Atari header.

Since the Apple II computer was built on a budget, many hardware-design shortcuts were made. Which will result in a computer that was cheap to build, but hard to program. One such tradeoff for example is that Woz tried to save a few cents on a circuit for DRAM update by arranging RAM in such a way that that it will be hit by other hardware interrupts in time for refresh, resulting in a memory layout that is full of holes and hard to access by software developers.

Furthermore, I was a bit dissapointed to learn that most of the Apple2 machines don't use an actual 6502 CPU, but rather the 65C02, which ment I could not use any of my beloved undocumented opcodes for sizecoding.

Apple II Graphics

Once I had my first stuff up and running, I started to think about ways I could use the limited graphics capabilities of the Apple II in such a way that it

Being a 70s machine, the Apple II Basically you have a black&white textmode with a fixed character set, a 'hires' 4 color graphics mode (which needs as well as a lores 40x48 15-color mode that consists of 8x4 chunky blocks. You can check out this article for information about the Apple 2 graphics.

The hires modes (HGR) in general are very specific and tricky to access, which is why you don't see it utilised much aside from displaying images or small pieces of movable objects in larger productions and games. One of the best examples that uses this modes in my opinion is Jorden Mechner's Karateka, which was able to use heavy code-unrolling to create an amazing game in HGR Apple II mode.

For sizecoding most intros either restrict themselves to non-realtime hires effects using ROM routines or lores 15-color mode. Now there is a way to access something called double-lores 80x48 mode that makes use of the 80column mode that has been present on Apple IIe and later models, as well as the original AppleII using the 80 column card. However using this mode is not trivial takes a bit of setup and requires a bit of code to do backbuffering and copying the data which is split between different memory locations for even and off columns. Furthermore the data for the odd columns is also shifted differently to account for NTSC color artefacting. Therefore you don't see this mode used often on size-limited productions.

Double-Dither: A novel way of doing lowres multicolor-graphics on a size budget

However, I wanted to see if I could use this mode in a way that it would still make sense both from a performance as well as a size-restrained aspect, which eventually led to the Double-Dither mode I designed for this intro.

Since the Apple II doesn't support the use of custom characters using multi-color, the main idea is to abuse the double-lores mode using 2 sets of color-lookup tables which have a front and background color in 2x2 dither pattern, as well as having the second set preshifted already to deal with NTSC artefacting.

Here is a step-by-step on how the Double-dither mode works:

* The mode is inited by initialising LORES graphics mode as well as the 80-Column mode.
* The effect is then written to a piece of linear RAM memory (e.g. $1000) without as color-indices without table lookup.
* Switch to PAGE0 and set colorlookup table to offset 0
* Copy data from this piece of linear memory to PAGE0 videoram via the colortable lookup
* Switch to PAGE0 and set colorlookup table to offset 8
* Copy data from this piece of linear memory to PAGE1 videoram via the colortable lookup
* To save on size (not speed) the GBACALC ($F847) ROM routine is used to set zeropage GBASL/GBASH adress pointer for each scanline to deal with the memory holes and then use sta (GBASL),y to write the data.

Here is an example of such a table for 8x2 lookups for a blue shade as used in Overboard:

colors:
dta $00,$02,$26,$66,$67,$7f,$ff,$ff ; blue8
dta $00,$10,$31,$33,$b3,$fb,$ff,$ff ; blue8x

When I had everything up and running I showed the results to Apple II expert qkumba and to my surprise, I learned that this approach was never attempted on the platform before. Therefore I'm glad I was able to bring something to the longstanding Apple II scene, even if its use might be limited to some demoscene productions.

Intro Design

Once the double-dither tech was in place, it was rather straightforward to create the actual intro. Given that the whole setup and data for the Double-Hires already took up quite a bit of space, there is about 128 byte or so left for the actual effect code. So for my first Apple II production I decided to go for a variation / slanted version of a parallax checkerboard effect, which was based of the code I'd written for Patchwork (A 128 byte intro for the Atari 8-bit).

Release and continued development on future Apple II projects

It took a bit getting to know the platform and to research and create all the code for the double-dither mode. But once that was in place, it was rather straightforward to create the actual intro, based on my earlier experience on the Atari 8-bit. The Overboard intro was finished in time and released at Kansasfest 2023.

After the release of the Overboard intro, I immediately continued Apple II development with two small 64byte intros to be released at a later point in 2023 ( Gash and our digital christmas card Seasons Greetings released at Tillage FX) , as well as the initial setup of what became the Datura intro for Kansasfest 2024 using the same Double-dither setup.

Return to blog overview