Previous Next Contents

6. Java's Features

6.1 Speed Enhancements

ML Decomp

The ML Decomp is a machine language routine by Will Laughlin that converts an object into a string - in other words, it "decompiles" the object. We call it the ML Decomp for short.

The reason Java needs such a routine is so it can display objects on the stack. When you push an object on the stack (say just the number 1) how does it get displayed? Every object on the stack is first converted to a string and then it is displayed. The binary representation of each object is totally independent of how it appears on the stack. Of course, things get a bit more complicated than this with the introduction of AGROB, which creates grobs instead of strings.

There are built in routines to convert objects to strings, but they are written in System RPL and are quite slow. The ML Decomp is written entirely in machine language so that it is fast. However, to accomplish this takes quite a lot of code, so the routine is fairly large. For this reason some flavours of Java contain the ML Decomp (Espresso, Mocha) and others don't (Cappuccino, Decaf).

Graphic Cache

Java also includes a 10 entry cache based on EQStk to speed up display of objects displayed with AGROB. This takes advantage of the fact that for the most part, objects on the stack don't change very much.

For example, suppose you have two large equations on the stack. The first on level 1 and the other on level 2. If you SWAP them, the objects themselves haven't changed - only the order on the stack has changed. A similar argument holds for duplicating or dropping objects.

Once an object on the stack has been converted into a grob for display, it is added to the cache. The next time it needs to be displayed, the grob can be obtained immediately from the cache, avoiding the overhead of running AGROB on it again. All flavours of Java that support AGROB (Espresso, Cappuccino) also include the cache.

The cache is automatically cleared by Java when a system flag that can affect display of algebraics is changed. This includes change of decimal mode (SCI/FIX/ENG) or angle mode. Java also keeps track of the CRC of every object in the cache.

6.2 Improved Status Area

Most people don't like seeing the user flags 1 to 5, so the status area has some new soft annunciators, as follows:

Miscellaneous

<bell>

Error beep on

FIX/SCI/ENG

Indicates decimal mode setting, blank for STD

NORM

Indicates user mode is OFF (normal keys)

Ports

I

ROM or write protected RAM card in port one

I (With box around)

RAM card in port one

I (With inverted box)

Merged RAM card in port one

The same goes for port 2, except it will look like a "II". Obviously, if there is no card in a port, you will not see anything.

The directory path starts with a triangle like in SOL. The rest of the directory path is separated with the '/' character. Ellipses (...) separate the path if it is very long. If selected, the ticking clock is shown as normal in the upper right area of the status area.

6.3 Scrolling of Level One Object

Java has the ability to "scroll" large objects on level one that normally would go off the side or top of the screen. This support uses AGROB to convert the object to a graphic and then uses a special on-stack viewer. Currently we support the following object types:

For other object types the key won't do anything. The scroller is accessed via the right shift picture key RS-Picture. On a S/SX this is RS-Graph (also known as key 34.3).

Just put one of the above objects on level one of the stack, and press the scroller key. Keys while in the scroller are:

Note that list support in the scroller can be useful even if the list does not exceed the screen size. This is because the list is formatted by AGROB, making it a more appropriate for viewing output of utilities like QPI. The scroller is also handy for viewing graphics objects.

Even though AGROB is much faster than the Equation-Writer display, there can be a slight delay before the scroller is activated on very large objects. For this reason the scroll routine turns on both the left and right shift annunciators to indicate when it is active and ready for scrolling.

The scroller will generate an error if there is insufficient memory to make the grob.

6.4 Dynamic Port Lock/Unlock Feature

Note: This routine has been rewritten for Java 3.0

Provided you are in the stack environment, you can change the read/write switch on a free RAM card without turning your HP off! This is especially useful for people with large RAM cards (like 1MB) for eliminating long warmstarts. Of course, this doesn't apply to merged cards.

This feature should work for all cards 128K or larger. It will not work for 32K cards because the HP treats all cards as 128K by default (which is also why cards greater than 128K have to be bank switched).

Note that the port annunciators in the status area won't be updated until you press a key, such as ON. If you have sound turned on you will hear a slight "chirp" when the status area is updated.

A word of warning that applies to all stack programs: Do not try to free a merged card from which Java is currently running! The sudden change in address can cause unexpected results, including memory clear. If you wish to free a merged card, be sure to quit Java first. After the card is free you can start Java again.

6.5 Running of AUTOEXEC

Java will run a program called 'AUTOEXEC' if it exists in the user's HOME directory when it starts up, including warmstarts. This program can contain anything valid for a standard User RPL EVAL. If it does not exist, nothing will be run.

When building your program, remember that there is nothing on the stack. If AUTOEXEC generates an error, Java will not start properly and you will be left with the built in stack. In this case you will have to fix your AUTOEXEC and warmstart before you can run Java again.

Going into user mode and the VAR menu on startup is the default. If this is a problem for you, you can use the AUTOEXEC feature to override this at startup. For example, if you want the CST menu to come up on warmstarts, you can do:

HOME << 1 MENU >> 'AUTOEXEC' STO

6.6 UPDIR Replacement

The UPDIR key has been altered to give it page preservation abilities. This is similar to the UPD package by Joe Horn, or the UP command by Mika Heiskanen, but has been customized for Java.

Suppose you are in the VAR menu and press NXT several times, then enter a directory. If you press UPDIR in the built-in stack you will end up at page one and will have to press NXT several times to get back to the same page you entered the directory in the first place. With Java, if you press UPDIR you will return to the menu page you just came from.

6.7 Interactive Stack Menu Keys

Two new functions have been added to the IStack menu keys. You can find them on the second page of the menu:

->PRG

Nice little feature that puts a program together from the components on the stack. Using this, you can recreate programs that were exploded onto the stack with OB->.

REV

As its name implies, it will reverse the order of the stack objects between the cursor and level 1.

6.8 SysRPL Mode with Jazz

Note: This feature is intended for HP48 Hackers who use the Jazz library!

For SysRPL mode to work properly, you need to use Jazz 5.9 or higher. However, use of Jazz 6.4 or higher is recommended because of its support for the Universal Font Library (UFL), saving you some memory. At the time of this writing, Jazz 6.5 is the latest version.

Once you install Jazz, you will be able to display System RPL objects on the stack just as SSTK does without leaving Java or running multiple stacks on top of each other. Furthermore, your editor keys and review key will be enhanced.

Setup

First, install Jazz 5.9 or higher. See the documentation that comes with Jazz on how to do this. Be sure to also install the tables library (993) or you will just get addresses instead of names. The latest version of Jazz is available from http://www.hut.fi/~mheiskan/

"Light" versions of Jazz that contain the assembler, disassembler, a few other commands, and support for Java are available from http://www.engr.uvic.ca/~aschoorl/

Next, install Java normally as described above.

Java checks for the existence of Jazz on startup, so if you install Jazz after you install Java, use the FHOOK command to force another check, or just warmstart your HP with ON-C. Users with covered ports can use FHOOK after they JAZZ their port.

Once you have done this, you can enable or disable the SSTK type display at any time by using STK, or in your own programs by setting or clearing flag 60 respectively. If Jazz does not exist, or if you are using an old version, the SSTK type display will not be used.

Using the SSTK Type Display

Using the SSTK display does not in any way affect the on-stack algebraics, so you can have your algebraics and matrices symbolically at the same time as your programs are handled with Jazz. If you wish to have all objects on the stack to be handled with Jazz, just use STK to disable equation view (flag 61).

Note that if Jazz exists, Java will bind a few local variables to routines in Jazz. This means you probably will not be able to purge Jazz while Java is running.

If you compile your own light version of Jazz and you don't want all of SSTK just to use this feature, all you need is:

Editor Changes in SysRPL Mode

If you are in SysRPL mode (flag 60 set) the down arrow and interactive stack editors will call DIS and ASS (also in Jazz) automatically when starting and exiting your chosen editor. The exceptions are for strings (which don't need to be disassembled) or if DIS and ASS do not exist. If you wish to edit without disassembling, just use the EDIT key instead of down arrow, or temporarily exit SysRPL mode.

Also, if there is a string on level 2 and a real number on level 1 and you are using ED, you can just press down arrow to use ED's offset feature to jump into the string. This is most typically used with the Jazz assembler to jump directly to an error location.

6.9 External Libraries

The most obvious external library supported by Java is the Universal Font Library (UFL), which Java requires for accessing FNT2.

The libraries directly supported for editing are Jazz, TED, and StringWriter. Other editors can be specified using the 'EDIT' variable. Jazz is also used in SysRPL mode.

Finally, the MATRIX library will be called for all matrix viewing/editing if it exists. Just install it and as long as Java is running all the necessary keys will automatically run it instead of the built-in MatrixWriter.

6.10 Accessing String to Grob Routines

You can access Java's string to grob routines (both smallfont and FNT2) by passing your string and the appropriate size to the AGROB xlib above. For example:

Of course, since the UFL's fonts are configurable, the resulting graphic objects created by AGROB can also change.


Previous Next Contents