Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

VM02 Beta 1

2 views
Skip to first unread message

David Schmenk

unread,
Sep 13, 2008, 11:27:00 PM9/13/08
to
Whoopee, time to release a Beta! This is a pretty significant upgrade
to the Alpha release. A few VM bugs were fixed that were exposed by the
new functionality. Performance of Java calls back into the VM and
device calls has been improved. A new device driver architecture has
been implemented and has three drivers available: console, super serial
card, and mouse card. The mouse card uses the VBL interrupt for
accurate timing. I wrote a simple multi-threaded terminal program to
test the serial port. I discovered that the mouse firmware had such
high overhead it caused characters to be dropped at 9600 baud. The only
workable solution was to add a control to the mouse driver to totally
disable and remove the IRQ handler. On the IIc, the VBL interrupt would
also confuse the game paddle code - they share an I/O location between
the mouse and game controller. So again, I needed to disable the VBL
interrupt to consistently read the paddle on the IIc. Not the kind of
stuff you run into programming the Apple II in everyday environments.

I also added parameter passing. If your launcher supports it, you can
pass in a complete command line. Something like:

JAVA.SYSTEM ECHO HELLO WORLD

would pass HELLO and WORLD as parameters to the ECHO class. The test
launcher (davex) I used only allowed for one parameter though - the
class to execute.

When the program exits, it will offer the option to reboot or return to
the VM02 command line and run another class. Kind of a compromise
between a nice exit back to ProDOS and running more Java classes.

I'm quite pleased with the progress made in this release. I feel the
VM02 environment is shaping up to be one of the most powerful and full
featured environments for the Apple II. I hope you take some time to
check it out. All suggestions welcome,

Dave...

Get it here:

http://schmenk.is-a-geek.com/tarfiles/VM02BETA1.DSK.zip

From the README:

VM02 Java capable Virtual Machine for Apple II
==============================================

Introduction:
-------------
VM02 is a Java compatible environment for the Apple II series of computers.
Most basic features of a Java VM are implemented to allow direct
execution of
standard Java class files. However, 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 implemented:
- Standard Java class file loading and execution.
- Full object inheritence
- Multithreading (4 threads max by default)
- Exception handling
- Arrays up to 15 dimension
- 32 bit integers and single precision floating point
- Garbage collection
- Finalizers
- Software and hardware implemented timing
- Device drivers for common hardware

What is missing:
- 64 bit data types unimplemented
- Standard class library unavailable or limited implementation only
- Lots of memory

Running VM02:
-------------
VM02 is run by executing the JAVA.SYSTEM file. You must start
JAVA.SYSTEM from
the prefix where it exits. This is required to find the class base path
to the
support classes. Parameter passing is supported if your shell
implements it.
If no paramter is passed in and a file named STARTUP exits, it will be
loaded
as the initial class. Otherwise, you will be greeted with with a prompt to
type in the class name to execute. You can start classes in other
directories
by typing in the fully qualified path. Class filenames under ProDOS are
missing
the ".class" suffix due to limited filename lengths. For example, to
execute
the Hello.class file on the VM02.SAMPLES volume, with VM02 you would type:

/VM02.SAMPLES/HELLO

at the "Main class:" prompt. You would see this:

Main class:/VM02.SAMPLES/HELLO

and then VM02 would attempt to find and load the class file. If an error
occurs along the way, you will get an Unhandled Exception message, probably
because the file (or superclass file) was not found. The preferred
directory
structure is to place all classes as subdirectories of the main VM02
directory.

Implementation of VM02:
-----------------------
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. This leaves
about
30K of RAM available for data and code. Not a lot, but Java was defined for
small platforms so you can get some reasonable programs even in such a small
space. A high-resolution graphics page is available for use with small
programs. Performance is acceptable for a 1 MHz, 8 bit CPU. On par
with the
UCSD p-System VM used in Apple Pascal. All features of the Apple II are
made
available through either specific classes, a low-level class that can
call ROM
routines, or both. There is a device driver architecture that currently
supports 80 column cards, the Super Serial card, and the Apple Mouse
card. Lastly, native methods are available through an overly complicated
process.

As noted earlier, class filenames are missing the ".class" suffix. System
classes are in the JAVA/* subdirectories. Apple II specific classes are
found
in the APPLE2/ directory.

Developing for VM02:
--------------------
There isn't a native Java compiler for the Apple II (yet). All Java source
must be cross-developed on a capable computer. The resulting class file
needs
to be transferred to an Apple or emulator using any number of available
tools.
One way is to use a tool like a2tools, AppleCommander, or CiderPress to copy
the class file to a .DSK disk image file. The disk image can be run
directly
from an emulator or copied to real hardware with ADT or ADTPro. To compile
against the Apple II specific classes, either download the source
package (you
will also need cc65, a 6502 C compiler package) or copy the APPLE2/
directory
contents and rename the files with mixed case and add the .class suffix.

The sample classes:
-------------------
Included with VM02 are sample classes that show off the capabilites 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
LIST - list a text file to the screen
P8 - ProDOS example
APPLE2/MOUSE - AppleMouse class with interactive test


Beta1 release:
--------------
This represents the first Beta release of VM02. All the VM functionality
is in
place. Some support classes may be extended or implemented to add compiler
features or improve compatibility. This is pretty solid for small
programs but
Java is a large and rich environment. No doubt there will be many
issues crop
up.

Known issues:
-------------
Currently two know issues are exist; the StringBuilder class has
problems that sometimes
cause string concatenation to freak out. I'll be looking into this
shortly. In
the mean time, try alternative methods (like individial print() calls to
print
a compound message). The Super Serial Card driver has problems with
XON/XOFF
flow control. It might be a problem with my USB serial dongle. I tried
hardware flow control, which worked except charaters would get truncated
when
it halted the receiver. XON/XOFF should work, but doesn't on my setup. I'll
try to connect to a real serial port on a Linux box to see if it works any
better.

Dave Schmenk...

David Schmenk

unread,
Sep 13, 2008, 11:36:37 PM9/13/08
to
... I'm having a bad text-formatting day. I'll try that README again:

VM02 Java capable Virtual Machine for Apple II
==============================================

Introduction:
-------------
VM02 is a Java compatible environment for the Apple II series of
computers. Most basic features of a Java VM are implemented to allow
direct execution of standard Java class files. However, 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 implemented:
- Standard Java class file loading and execution.
- Full object inheritence
- Multithreading (4 threads max by default)
- Exception handling - Arrays up to 15 dimension
- 32 bit integers and single precision floating point
- Garbage collection
- Finalizers
- Software and hardware implemented timing
- Device drivers for common hardware

What is missing:
- 64 bit data types unimplemented

- Standard class library missing or limited implementation
- Lots of memory

Running VM02:
-------------
VM02 is run by executing the JAVA.SYSTEM file. You must start

JAVA.SYSTEM from the prefix where it exists. This is required to find

/VM02.SAMPLES/HELLO

Main class:/VM02.SAMPLES/HELLO

As noted earlier, class filenames are missing the ".class" suffix.

System classes are in the JAVA/* subdirectories. Apple II specific
classes are found in the APPLE2/ directory.

Developing for VM02:
--------------------
There isn't a native Java compiler for the Apple II (yet). All Java
source must be cross-developed on a capable computer. The resulting
class file needs to be transferred to an Apple or emulator using any
number of available tools. One way is to use a tool like a2tools,
AppleCommander, or CiderPress to copy the class file to a .DSK disk
image file. The disk image can be run directly from an emulator or
copied to real hardware with ADT or ADTPro. To compile against the
Apple II specific classes, either download the source package (you will

also need cc65, the 6502 C compiler package) or copy the APPLE2/

problems that cause string concatentation to freak out. I'll be looking

Jeff Blakeney

unread,
Sep 14, 2008, 12:54:45 PM9/14/08
to
To: David Schmenk
Just want to point out a few typographical errors in your README:

On Sat, 13 Sep 2008 20:27:00 -0700, David Schmenk wrote:
> Running VM02:
> -------------
> VM02 is run by executing the JAVA.SYSTEM file. You must start
> JAVA.SYSTEM from
> the prefix where it exits. This is required to find the class base path
> to the

"exits" should probably be "exists".

> support classes. Parameter passing is supported if your shell
> implements it.
> If no paramter is passed in and a file named STARTUP exits, it will be
> loaded

Again, "exits" should probably be "exists"

[snip]

> Known issues:
> -------------
> Currently two know issues are exist; the StringBuilder class has
> problems that sometimes

"known" should probably be "known" and the beginning of that sentence
might work better worded this way : "Currenty two issues are known to
exist".

> cause string concatenation to freak out. I'll be looking into this
> shortly. In
> the mean time, try alternative methods (like individial print() calls to
> print
> a compound message). The Super Serial Card driver has problems with
> XON/XOFF
> flow control. It might be a problem with my USB serial dongle. I tried
> hardware flow control, which worked except charaters would get truncated
> when

"charaters" shoudl probably be "characters".

Bill Garber

unread,
Sep 14, 2008, 2:24:12 PM9/14/08
to

"Jeff Blakeney" <jeff.b...@a2central.com.remove-3ym-this> wrote in message news:140sokc53p7je$.1xk6bi9q0qby8$.dlg@40tude.net...

It may also be a good idea to proof-read your corrections
before posting, in order to not create any more errors.

Example above, 'shoudl', should be 'should'. ;-)

Bill Garber from GS-Electronics
http://www.garberstreet.com

"If you wish to forget anything on the spot,
make a note that this thing is to be remembered."
(Edgar Allen Poe)

winston19842005

unread,
Sep 14, 2008, 2:55:39 PM9/14/08
to
On 9/14/08 2:24 PM, in article ipqdnWmvM75ay1DV...@comcast.com,
"Bill Garber" <will...@comcast.net> wrote:

And when he listed one correction, he made the correction:


>> "known" should probably be "known"

It can be hard to type the wrong thing, sometimes...

David Schmenk

unread,
Sep 14, 2008, 3:50:15 PM9/14/08
to

It's what I get for typing while tired. At least I'm not the only one
"guilty" ;-)

Dave...

heuser...@freenet.de

unread,
Sep 14, 2008, 4:11:34 PM9/14/08
to
On Sep 14, 9:50 pm, David Schmenk <dschm...@YUCH.gmail.com> wrote:
>
> It's what I get for typing while tired. At least I'm not
> the only one "guilty" ;-)

I was so hoping for a "guitly" ;-)

bye
Marcus

Bill Garber

unread,
Sep 14, 2008, 4:14:28 PM9/14/08
to

"David Schmenk" <dsch...@YUCH.gmail.com> wrote in message news:XVdzk.425$yr3...@nlpi068.nbdc.sbc.com...

Dave, I double Proof every email, post, etc..., and
will still let something slip through, so, don't try
that "I'm only human", or "tired" stuff with me. ;-)))

John B. Matthews

unread,
Sep 15, 2008, 10:47:49 AM9/15/08
to
In article <9F%yk.355$YU2...@nlpi066.nbdc.sbc.com>,
David Schmenk <dsch...@YUCH.gmail.com> wrote:

<http://schmenk.is-a-geek.com/tarfiles/VM02BETA1.DSK.zip>
<http://schmenk.is-a-geek.com/tarfiles/vm02.beta1.src.zip>
[...] SourceForge [...]

Wurks gud:-) Thank you!

Several folks here work on SourceForge projects. Let me know how I can
help.

I'm puzzled by Hello.java setting 80-column mode with "vm02.call(0,
0xC300);" commented out. What switches it to 40-columns after entering a
name?

[Sorry for the delay in responding; Ike took out the power here for the
best part of a day.]

--
John B. Matthews
trashgod at gmail dot com
home dot woh dot rr dot com slash jbmatthews

David Schmenk

unread,
Sep 15, 2008, 12:16:56 PM9/15/08
to
John B. Matthews wrote:
> In article <9F%yk.355$YU2...@nlpi066.nbdc.sbc.com>,
> David Schmenk <dsch...@YUCH.gmail.com> wrote:
>
> <http://schmenk.is-a-geek.com/tarfiles/VM02BETA1.DSK.zip>
> <http://schmenk.is-a-geek.com/tarfiles/vm02.beta1.src.zip>
> [...] SourceForge [...]
>
> Wurks gud:-) Thank you!

Awsum!

>
> Several folks here work on SourceForge projects. Let me know how I can
> help.

Thanks John- I've got a couple already there so it shouldn't be a
problem to migrate. I'll post a message, then start signing people up
for developer access.

>
> I'm puzzled by Hello.java setting 80-column mode with "vm02.call(0,
> 0xC300);" commented out. What switches it to 40-columns after entering a
> name?
>
> [Sorry for the delay in responding; Ike took out the power here for the
> best part of a day.]
>

Ah, yes. Good eye! When adding the device driver code, I cleaned up
some of the work-arounds I had. For the system I/O classes
(System.out/in) I check for an 80 column card during object
initialization and set it automatically. If you choose to use the lower
level conio class, you will have to set 80 column mode explicitly with a
tex80() call. I thought this would be a good compromise. Setting the
mode back to 40 columns required the disable-80-column-mode control
sequence (I send the codes for all the cards I know about). Here's the
rub - I only have the ref manuals for the IIe/IIc video card and a Videx
80 column card. So if you have a different card that uses different
control codes, it probably won't work. Send me the codes and I can add
them. You may see the codes printed out briefly, but I then print
backspaces to cover them up :-) I currently have one monolithic driver
for the console, but when I get more information about the different
cards, I will write a driver for each specific card to reduce the memory
footprint.

Besides the device drivers, the other major change since alpha was the
restart code. Instead of forcing a reboot when the program exits, it
now gives the option of reboot or run another Java program. This hasn't
been extensively tested so I expect to come across some problems. In
order to restart without having to write a lot of code, I simply reload
the VM02 binary on top of itself and jump to a warm init routine. This
reloads all the initialization code, which is what I was after. If you
find a failure after running a program (like a lockup or crash to
monitor) it's probably due to the restart code.

Thanks for taking the time to check it out,

Dave...

David Schmenk

unread,
Sep 15, 2008, 12:47:59 PM9/15/08
to


Updated and corrected. Thanks,

Dave...

Jeff Blakeney

unread,
Sep 15, 2008, 3:25:53 PM9/15/08
to
To: winston19842005

In my defense, I didn't actually proofread my own post. I usually do
but didn't this time and it looks like I really needed to. :-)



> And when he listed one correction, he made the correction:
>>> "known" should probably be "known"
> It can be hard to type the wrong thing, sometimes...

Yeah, I just noticed that when reading the message that came off the
server.

Ah well, at least David got the message I was trying to convey. :-)

David Schmenk

unread,
Sep 15, 2008, 5:09:02 PM9/15/08
to
David Schmenk wrote:

>
> Known issues:
> -------------
> Currently two know issues exist; the StringBuilder class has
> problems that cause string concatenation to freak out. I'll be looking

> into this shortly. In the mean time, try alternative methods (like

> individual print() calls to print a compound message). The Super Serial

> Card driver has problems with XON/XOFF flow control. It might be a
> problem with my USB serial dongle. I tried hardware flow control, which

> worked except characters would get truncated when it halted the receiver.

> XON/XOFF should work, but doesn't on my setup. I'll try to connect to a
> real serial port on a Linux box to see if it works any better.
>

I was able to hook my Apple II up to a real serial port on a Linux
machine. XON/XOFF appears to work on that setup. The USB dongle might
be causing problems due to it's internal buffer size. So this makes me
happy - one less issue. I'll add VT100 screen controls to the TERMINAL
program soon and have the terminal program I always wanted. BTW, if you
have a II or II+, you can use Ctrl-A as a CAPS LOCK. No shift key
modification support yet, though.

Dave...

John B. Matthews

unread,
Sep 15, 2008, 10:16:43 PM9/15/08
to
In article <ZTvzk.307$W06...@flpi148.ffdc.sbc.com>,
David Schmenk <dsch...@YUCH.gmail.com> wrote:

> John B. Matthews wrote:
> > I'm puzzled by Hello.java setting 80-column mode with "vm02.call(0,
> > 0xC300);" commented out. What switches it to 40-columns after
> > entering a name?
>

> Ah, yes. Good eye! When adding the device driver code, I cleaned up
> some of the work-arounds I had. For the system I/O classes
> (System.out/in) I check for an 80 column card during object
> initialization and set it automatically. If you choose to use the lower
> level conio class, you will have to set 80 column mode explicitly with a
> tex80() call. I thought this would be a good compromise. Setting the
> mode back to 40 columns required the disable-80-column-mode control
> sequence (I send the codes for all the cards I know about). Here's the
> rub - I only have the ref manuals for the IIe/IIc video card and a Videx
> 80 column card. So if you have a different card that uses different
> control codes, it probably won't work. Send me the codes and I can add
> them. You may see the codes printed out briefly, but I then print
> backspaces to cover them up :-) I currently have one monolithic driver
> for the console, but when I get more information about the different
> cards, I will write a driver for each specific card to reduce the memory
> footprint.

[...]

I get similar results on KEGSMAC or KEGS-OSX, which emulate a //e 80
column card (ctrl-Q -> 40-columns, ctrl-R -> 80 columns, ctrl-U -> quit,
etc.) I see LDA #26 in vm02.s under VM_WARMINIT, which does clear line
on the //e 80 column firmware.

I see my MACHID ($BF98) is $B3 (%10110011), suggesting a 128K //e with
80 columns and clock.

110 * (Bit 3 off) BITS 7,6- 00=II 01=II+ 10=IIe 11=/// EMULATION
111 * (Bit 3 on) BITS 7,6- 00=NA 01=NA 10=//c 11=NA
112 * BITS 5,4- 00=NA 01=48K 10=64K 11=128K
113 * BIT 3 - Modifier for MACHID Bits 7,6.
114 * BIT 2 - RESERVED FOR FUTURE DEFINITION.
115 * BIT 1=1- 80 Column card
116 * BIT 0=1- Recognizable Clock Card

I'll poke around in io.s to see if anything jumps out.

David Schmenk

unread,
Sep 15, 2008, 10:36:19 PM9/15/08
to

That's it. The #26 is part of the control sequence for the Videx card:
Ctrl-Z 1. Then a backspace in case it shows up. Then the next control
code, #21, is for the IIe/IIc 80 column card.

Dave...

John B. Matthews

unread,
Sep 16, 2008, 5:34:31 AM9/16/08
to
In article <EYEzk.346$as4...@nlpi069.nbdc.sbc.com>,
David Schmenk <dsch...@YUCH.gmail.com> wrote:

D'oh! Your code is correct. I was confounding the execution of Hello
with the subsequent vm warm start after Hello exits.

mdj

unread,
Sep 16, 2008, 5:39:32 AM9/16/08
to
On Sep 14, 1:27 pm, David Schmenk <dschm...@YUCH.gmail.com> wrote:

> I also added parameter passing.  If your launcher supports it, you can
> pass in a complete command line.  Something like:
>
> JAVA.SYSTEM ECHO HELLO WORLD
>
> would pass HELLO and WORLD as parameters to the ECHO class.  The test
> launcher (davex) I used only allowed for one parameter though - the
> class to execute.

No luck with this under ProSEL 8 - a NoClassDefFoundException is
thrown. If the ProSEL entry has no STARTUP parameter it prompts for a
class ...

Matt

David Schmenk

unread,
Sep 16, 2008, 6:45:30 AM9/16/08
to


Is the class to execute in the same directory as JAVA.SYSTEM or does it
include a fully qualified path? It must be setting the correct prefix
to JAVA.SYSTEM beforehand or it wouldn't find the exception class to throw.

Dave...

David Schmenk

unread,
Sep 16, 2008, 6:57:45 AM9/16/08
to

Soon I will move that code into the IOCTL_DISABLE or IOCTL_DEACTIVATE
clause of the console device driver (see the code just above in vm02.s).
I don't like it cluttering up my warm init code :-)

Dave...

mdj

unread,
Sep 16, 2008, 9:23:40 AM9/16/08
to
On Sep 16, 8:45 pm, David Schmenk <dschm...@YUCH.gmail.com> wrote:

> > No luck with this under ProSEL 8 - a NoClassDefFoundException is
> > thrown. If the ProSEL entry has no STARTUP parameter it prompts for a
> > class ...
>
> > Matt
>
> Is the class to execute in the same directory as JAVA.SYSTEM or does it
> include a fully qualified path?  It must be setting the correct prefix
> to JAVA.SYSTEM beforehand or it wouldn't find the exception class to throw.

I tried using a qualified path to the class and relative, in both
cases it's one of the classes in the distribution and hence at the
same directory level as JAVA.SYSTEM

Since other applications work, I suspect it's some kind of string
termination issue. Unfortunately ProSEL won't allow spaces in the
STARTUP parameter so once this is working that's something I'm going
to have to patch...

Matt

David Schmenk

unread,
Sep 16, 2008, 11:12:10 AM9/16/08
to

The ProDOS Tech Ref shows how to set the start of the system program to
receive the parameter buffer. I'm pretty sure I got that right, as it
works with davex. Can I send you a version that prints out the
parameter buffer before it tries to load it?

Dave...

mdj

unread,
Sep 16, 2008, 11:33:27 AM9/16/08
to

Sure - send it through :-)

0 new messages