Apple IIgs Java

Posted: November 17, 2015


So Joe Davisson started extending Java Grinder to support the W65C816 as a CPU for with target platforms of first the W65C265SXB dev board, then Apple IIgs, and hopefully soon also Super Nintendo. I helped him out by writing some code using Google Go to create bootable Apple II disk images. The source code for Java Grinder, the demo below, and the Apple II disk image creator is all available on github.

Since Joe had already extended Java Grinder to create a Java demo on the Commodore 64 he already had a pretty good head start with the W65C816 (considering the W65C816 is a 6502 with 16 bit extensions).

Related Projects

Java Grinder: Playstation 2 Java, Nintendo 64 Java, Sega Genesis Java, Amiga Java, Apple IIgs Java, TI99/4A Java, C64 Java, dsPIC Mandelbrots, Atari 2600 Java, Intellivision Java, chipKIT Java, Java Grinder, naken_asm


Below is the demo compiled out of the samples/apple_iigs directory. The demo was written in Java and compiled using javac against a jar file filled with empty methods for all the API calls. The .class files that are generated are then run through Java Grinder which transforms the Java byte-code into a single native W65C816 source file which is then assembled with naken_asm.

Start of the demo running in the Mess emulator.

Years ago someone gave me an Apple IIgs that I had turned on once or twice and then put in storage in a closet. Never thought I'd find any real use for this thing. I set it back up so I could make this video of the demo running on a real Apple IIgs.

File Transfer

To transfer the demo to the Apple IIgs, I bought a NULL modem cable from Retro Floppy. I wrote this small program in Apple BASIC:

10 D$ = CHR$(4)
20 A$ = CHR$(1)
25 I$ = CHR$(9)
45 PRINT D$;"IN#2"
60 FOR I = 0 to 5435
70 GET C$
75 V = (ASC(C$) - 65) * 16
76 GET C$
78 V = V + (ASC(C$) - 65)
80 POKE 4096 + I, V
200 PRINT D$;"BSAVE GRINDER,A4096,L5436"
1010 PRINT D$;"IN#0"

On the Linux side, I wrote a small program that would take the .bin file produced by Java Grinder and send it over the serial port 300 baud by taking each byte, splitting into 4 bit nybbles, and sending each nybble added with 'A' so that it's always something ASCII being sent over the wire. I believe if it sends a 0, all kinds of awful stuff happens. On the Apple IIgs side, before I could run the program I have to press Ctrl-Apple-Esc and change the default baud rate to 300. I tried to change it programmatically with PR#2 (notice some missing line numbers above?), but it was doing weird things. I eventually got sick of doing that and switch the software to the default 1200 baud.


git clone

Copyright 1997-2023 - Michael Kohn