After years of dedicated development and testing, David Schmenk announced the release of VM02 1.0 — a Java compatible VM for the Apple II series. With VM02, an entirely new and exciting frontier for application development has just opened up for the Apple II. David’s announcement is attached:

Announcing version 1.0 of VM02, the Java compatible VM for 6502 based Apple II computers. Running on the full line of Apple II computers, from the Rev0 Apple ][ with Integer Basic, to the last-of-the-line Apple //c+, and everything in-between. Most basic features of a Java VM are implemented to allow direct execution of standard Java class files.

Download here:
http://sourceforge.net/projects/vm02/

Screenshots here:
http://sourceforge.net/project/screenshots.php?group_id=239665

There are a number of packages available to suit different configurations. There are three ShrinkIt archives: the full version supporting floating point numbers and demand memory swapping, a minimal version without floating point or swapping to increase available RAM for machines without an adequate swap device, and a full version with debugging enabled for developers. There are also DSK images available to help with “sneaker-net” installation. VM02.EXTRAS.DO contains all the samples classes and the Character User Interface classes. There are then the 64K and the 128K versions. 140K is just too small to have a combined image, so they have been split apart. The VM02 version is for 64K machines, VM02E is for 128K IIe and IIc machines. These are meant to install on a larger drive, as no ProDOS is included on the image. Finally, there are the minimal versions of VM02 (VM02.MIN.DO) and VM02E (VM02E.MIN.DO) for booting and running on floppy-only machines (ProDOS included on the image). The only difference in these images are the actual VM image, the system classes are identical. To install on a hard drive simply copy the EXTRAS image and the appropriate VM02 image to the same directory.

In order to fit in the constraints of a 64K, 8 bit, 1 MHz computer, some aspects of a JVM have been reduced or removed.

What is missing:

  • 64 bit data types unimplemented
  • Standard class library missing or limited implementation
  • Lots of memory

What is implemented:

  • Standard Java class file loading and execution.
  • Full object inheritence
  • Pre-emptive multithreading (4 threads max by default)
  • Exception handling
  • Arrays up to 15 dimension
  • 32 bit integers and single precision floating point
  • Garbage collection
  • Demand memory swapping to RAM disk or other available volume
  • Finalizers
  • Software and hardware implemented timing
  • Device drivers for common hardware (80 col/mouse/serial/uthernet/graphics tablet)
  • 128K memory support for //e and //c
  • Full access to Apple II platform features

VM02 is implemented from scratch in 6502 assembly, optimized for the 6502 and Apple II platform. The entire VM fits in about 20K of RAM after initialization. This leaves about 30K of RAM available for data and code in the 64K version, or about 32K for data and 44K for bytecode in the 128K version. Not a lot, but Java was defined for small platforms so you can get some reasonable programs even in such a small space.

Performance is acceptable for a 1 MHz, 8 bit CPU; on par with the UCSD p-System VM used in Apple Pascal. As with any memory managed environment, garbage collection can really take its toll on the system. CUI (character user interface) programs will attempt to force some startup garbage collection and memory swapping to improve the initial response of these programs. Java can eat through 32K of RAM in no time. If you think the computer has locked up, a little patience will probably pay off with the resumption of execution. Demand memory swapping on an Apple II isn’t the most brisk operation it can perform; CF disks and RAM disk greatly aid the speed of swapping. Other garbage collection operations involve defragmenting RAM – an accelerator will improve this.

All features of the Apple II are made available through either specific classes, a low-level class that can access ROM routines and memory, or both. A high-resolution graphics page is available for use with small programs. There is a device driver architecture that currently supports 80 column cards, the Super Serial card, and the Apple Mouse card with preliminary support of the Uthernet card and Apple Graphics Tablet. Probing for the Uthernet card can cause problems in some machines with hardware VM02 doesn’t detect. If probing for the Uthernet card causes the machine to hang at VM02 init time, hold down the Open-Apple key (or PushButton 1) during initialization and the Uthernet probe will be skipped.

Swapping from main memory extends the available RAM, dependent on the swap volume. VM02 will automatically take advantage of large hard drives or RAM disks for swap volumes, giving precedence to RAM drives. If you have a RamWorks card, you must load the ProDrive RAM drives. If you have a RamWorks card, you must load the ProDrive RAM drive software before running VM02 in order to use the extra memory. “Slinky” style memory cards are automatically used. IIgs computers should have a RAM disk of 256K or greater to use for swapping. AUX memory in the IIe and IIc computers is used for storing the Java bytecodes, thus freeing up main memory for data.

Class filenames are missing the “.class” suffix due to filename limitations, however the file type of $ED is used to identify class files and are given the type identifier of JVM. System classes are in the JAVA/* subdirectories. Apple II specific classes are found in the APPLE2/ directory. VM02 specific classes are found in the ORG/VM02/* subdirectories.

Included with VM02 are sample classes that show off the capabilities of the environment. They can be executed from the samples disk or copied to another location.

HELLO – A simple text entry program
HELLOWORLD – sample multi-threaded program
MOIRE – Hires example, requires AppleSoft in ROM
HIRESDEMO – Another hires demo
RODSCOLORS – Lores demo
SIMPLEPONG – Lores demo with paddle input
TERMINAL – Simple terminal program using the SSC
VOLUMES – List online volumes
CATALOG – Catalog a directory
LIST – List a text file to the screen
STRESSMEM – Allocate 64K 2D array. Stresses swapping code
TESTSELECT – select() type call using mouse, keyboard, and timeouts
TESTCHAIN – Chain to another class passing parameters and exit status
TESTARP – Send ARP request from Uthernet card
TESTCUI – Show off the CUI’s controls (128K and hard drive install required)

With this release of version 1.0, a file launcher utilizing the character user-interface classes is included to navigate through volumes and directories and execute Java classes. Files of type $ED show up as JVM executable files. Requires 128K IIe or IIc.

You can find more information to read here:

README.TXT: http://vm02.cvs.sourceforge.net/viewvc/*checkout*/vm02/vm02/README.TXT?revision=1.8

DESIGN.TXT: http://vm02.cvs.sourceforge.net/viewvc/*checkout*/vm02/vm02/DESIGN.TXT?revision=1.18

Enjoy,
Dave Schmenk
March 31st 2010, 11:59:59 PM