A Java Environment for the Commodore

leJOS is a compact JVM that runs on a 32kB Hitachi microcontroller. The leJOS code is written in ANSI C and is very portable to other platforms, provided a C cross compiler exists for that platform. This makes it an ideal candidate to port over to the 64kb Commodore 64.

Phase One: c64 LUnix JVM

Goal - To create a small-footprint JVM for an unexpanded Commodore 64.

[details]

Phase Two: C=1 JVM

Goal: To create a Java 2 compliant JVM and API for the Commodore One

There are two possibilities for this.

1) Port the LUnix JVM from Phase One over to C=1 .

OR

2) Since there is lots of memory available on the C=1, it's possible to port a more advanced ANSI C implementation of a JVM over. Kaffe looks like it might be the best option.

[details]

Additional Java Projects

Once the foundation of a JVM is in place, additional projects could expand the C=1 Java platform. These are not necessarily projects I would want to attempt, but they are possibilities.

Project A: Expand C=1 Java Tool Set

Without a full toolset, such as Sun's JDK 1.4, it wouldn't be possible to compile programs on the C=1 platform. Without this, development would have to occur on a PC and the resulting class files transfered over to the C=1. We also wouldn't be able to use JAR files without jar.exe. There are many tools to help with development, and the most important ones should be ported over. Hopefully these tools exist as open source projects somewhere on the Internet (maybe even available by Sun) so we can port them over without much hassle.

If you know more information about this, please e-mail me.

Project B: Wheels JVM

Project C: Java Library for C=1

Project D: Integrate JVM into web browsers

Project E: A True Java Compiler

Details

Phase One

I think the best possibility for a c64 JVM is leJOS. This is a project for the Lego Mindstorms RCX brick. The entire JVM runs in only 32Kb of RAM, but there are a few standard features have been cut in order to fit this in memory:

The API is very limited with leJOS. Things like System.out.println() will need to be adapted for the c64. If LUnix ever attempts a GUI then maybe even portions of the java.awt could be adapted for the c64. And a special API for handling sprites, SID sound, character mapping could be developed. Development of c64 Java code would occur on a PC using a Java Cross Compiler (similar to the development cycle for leJOS) since compiling source code is pretty memory intensive. In other words, no javac.exe for the c64. The ideal platform to accept command line arguments is LUnix .

The leJOS code is written in ANSI C so it should be very portable. I've done some preliminary research on this and was looking for a good C compiler. I think the cc65 cross compiler looks about the best. It looks like it has a decent library just for the c64 from what I could tell. On the down side, C code doesn't compile very efficiently to the 6502/6510 chip for some reason, but still 64Kb should be fine.

An alternate possibility is Waba, a JVm written in assembler but made to be easily portable to other systems. Unfortunately I have no assembler skills.

In order for this to run under LUnix it needs to be programmed for the LUnix Kernal. There are two possibilities for this:

  1. Use assembly in-line with the C code to access the LUnix kernal functions. This would be used in conjunction with a 6502 C compiler, such as cc65 (above).
  2. Jozef V. Molnar is working on a C compiler specifically for LUnix. This would be ideal since the entire code base could be written in ANSI C. It would also be awesome because then there's the possibility to port selected Unix based tools over to LUnix - provided they are small enough.
  3. There's a small-C compiler called scc6502, but it's not ANSI-C
  4. Use CA65 and LD65 (from the CC65 package) to generate a .o65 file, then use the Luna assembler to generate a binary file.
    http://www.geocities.com/SiliconValley/Way/4588/scc6502.html

Alternate JVM possibilities:

http://www.rtjcom.com/6811/general.html - written in Assembly using a GNU Assembler.

http://www.rtjcom.com/general.html - Written in C, compiled by various (usually GNU GCC)

Phase Two

The primary target for this port will be WiNGs (presently known as JOS). Jolse has created some amazing tools for JOS, including an LCC compiler back-end for WiNGS ( currently available for JOS).

Some goals for this project inlcude:

  • Adding a java.awt for the WiNGs GUI
  • java.io and java.net for use with WiNGS TCP/IP modules

    Converting the entire J2SE library over will not be too hard. Once a few key classes are defined (java.net.Socket, java.lang.Math, and some java.awt classes) the rest are mostly written in straight Java. This means most code can be copied right from the Sun source code.

    Back to Commodore 64 Home


    The C64 Banner Exchange
    The C64 Banner Exchange