日本語 page is available.

Visit multilingualization of Squeak page if you are interested in it.

The Home Page of Squeak/Zaurus (ZauChu)

Introduction

This is the home page of Squeak that runs on the Zaurus PDA. The official name of this port is "Squeak/Zaurus," but I'd like to nickname it "ZauChu". "Zau" is a shortened phrase of " Zaurus", and "Chu" is the way that a mouse is "squeaking" in Japan. Chu in Pikachu is the same. (However, the possibility that this nickname become popular is doubtful.)

Squeak/Zaurus was used as the platform for an experimental project "Personal Digital Assistant for guests", conducted by a large company that has many theme parks and whose name begins with 'W' (or 'D'). In the following, I'll call the project as "The Project." If you are curious why we used Squeak/Zaurus, refer a section on the merits of Squeak/Zaurus (or "why Java is not as good as Squeak?").

If you don't want to read a detailed explanation, jump to the download section.

If you just want to see the demos, check the demo section.

Table of Contents

What is Squeak?

Squeak is a programming language that is a direct descendant of Smalltalk-80. Although Smalltalk was an old language, its unique features, such as allowing users to "manipulate" the objects directly, are still second to none.

Besides it inherits much things from Smalltalk, it has been rapidly developed by the user community. As a conseqence, we can say it is a new programming system.

What is Zaurus?

Zaurus is a brand name of a PDA family by Sharp. They have many variant of models, but what is worth to say is that they always have a high end model which can be said "one of the most advanced" in the world.

The Merits of Squeak/Zaurus (or "why Java is not as good as Squeak?")

The combination of Squeak and Zaurus has great technical advantage over the other combinations. the followings are the points.

Portable and mature implementation of virtual machine

It is difficult to write a stable virtual machine. Squeak is designed and written by the team that have more than 30 years experience of writing virtual machines, and has been debuged by the people all over the world. By those efforts, Squeak VM is now really stable. Although the Java VMs for the desktop environment are now getting stable, there are no Java VM implementation you can use if you want to build a VM based language environment on a high-end PDA. (I will discuss on KVM later.)

Open Source Style Development

Squeak VM and the library have been developing in a world-wide open source community and have been growing extensively.

Using an Open Source Software on the embedded systems has huge advantage. If you want to build a reasonably large software system, it is normal that you use the software layers, such as operation system, window system, or virtual machine, written by the other people. In such case, there are almost always some glitches or features you need to extend. If you cannot modify those layers, you have to write complex workaround. This is sometimes too painful on a limited hardware. Even if the source code of the all of those layers are available, it is virtually impossible to fix those glitches if there are unnecessarily many layers. For example, some say "the combination of Linux, X and GTK combination is perfect on my PDA and you can modify everything," but can you really modify the X server to fit your specific needs in that situation?

Squeak VM and the Squeak library are completely open. To say more, because VM is written in Squeak itself. So, the obstacle to build your own system is very small.

Yes, the Zaurus OS is an unmodifiable layer in Squeak/Zaurus equation. However, Sharp people gave us great help to write many features depending on the OS and those features are now built into the Squeak VM.

Portability of the Application

Some languages claim the property called "Write Once, Run Anywhere" (WORA). However, is the claim true? When a new version of a language is released, the VM is likely to be released for very limited number of the platform and what the user of the other platform can do is just waiting for the VM port. And, those VMs tend to behave differently. The truth is, you have to debug your application on each platform because of the difference of the thread scheduling, event handling, graphics and font issues of the VM.

Squeak VM is easy to port and has ported to tons of platforms, and because most of the library and VM are written in Squeak, the behavior of VM is very similar from one platform to another. You can expect your application runs just same on the other platforms. In The Project, two programmer used Windows and Mac and worked separetely and the integrated system just worked on Zaurus.

Flexibility of the Application

In Squeak, the mouse, the display screen and those basic hardware are reperented as an abstract objects. The programmer can write a program that has a fine control over those basic componet. In The Project, we began with writing a GUI framework which is suitable for our purpose. In Squeak, you can build such GUI frameworks in very small amount of code and it is easy to stabilize those GUI framework. When you write a program that manipulates graphical bitmaps and display them to the screen, the bottleneck will be the access to the memory because of the typically slow memory bandwidth on PDA. If you write a GUI framework by yourself, you can be aware of that how many times the bitmaps are copied or such things.

In The Project, the application has to check the various peripherals while it is in the main event loop. By writing everything by ourselves, it was very easy to write such system.

Considering that existing Java GUI framework on PDA, AWT is too hard to port and Swing is too large. Also, writing your own GUI framework in Java is hard. Can you implement a GUI framework which is aware of the number of memory copy for graphic bitmap without changing the VM?

Small Memory Footprint

For example, suppose you want to build an application that manipulates tons of QVGA, 16 bit depth images on an environment where the memory resource is tight. The size of such image is 320x240x2 = 150kbytes. Have you ever considered how much memory is really consumed for each image?

There are memory management systems in which the management overhead takes large portion of memory, the request size is rounded up to power of two (in this case 256k!), the fragmentation problem, or the garbage collector algorithm uses the semispace and twice of size of memory is used, or all garbage will not be collected, etc.

In Squeak, the management area for a QVGA image is only 12 words. Of course, the Squeak garbage collector is from from the above problems. You can build an application in Squeak by taking the advantage of this compact representation of objects and with the knowledge of implementation details.

Furthermore, the requirement of minimum memory size should be considered. Although the memory is getting cheap in desktop environment, there are VMs on which a tiny application that does simple animation requires 20-30MB memory. Such VM cannot applicable for high end PDA.

Expressive Power of Squeak

In Squeak, every data is an object. You can write higher level program without caring the distinction as primitive data and object.

Have you ever thought that large part of your program can be considered as "applying a kind of function to a kind of collection?" Squeak has rich Collection class library which represents the "kind of collection" and block closures that represents "kind of function" and you can write such program in natural way.

This is not well known fact, but Squeak does have the compile time error check. You can't write a program that accesses to non-existing instance variable or uninitialized temporary variable, or non-existing method. Note that the Squeak compiler (or Compiler) does not only error check, but also it suggests the possible correct program. If the method only has simple spelling errors, once you compile the method, you can semi-automatically rewrite the method to correct one. After all, the Squeak compiler can check the most of classes of errors that the people expect what the Java compilers do.

Easy to Debug

When a run time error occurs in Squeak, you can modify the data value and program code by hand and continue the execution. When writing a Java class, a typical error is that some of the instance variables are left uninitialized in a constructor and NullPointerException is raised when some other methods executed. Do you think that "it's so trivial error. Why the computer can not cope with this automatically?" In Squeak, you can just do that.

However, after all, the compile time check and simple uninitialized variable error check is not the difficult part of the debugging. The real bugs are more difficult to fix and those bugs are the real problem. The Squeak is really powerful to find and fix those errors.

In most of the programming languages that support the exceptions, when run time error happens during the program execution, the exception is going to *drop* down to the bottom of stack and the valuable information stored in the stack is lost when the exception is caught. So, the programmer can do is merely print out the calling sequence. The typical behavior of the programmer is that after encountering an error, the programmer begins to insert printf() in arbitrary places and hope the same error happens again. Sounds kludge?

On the other hand, when an error occurs, whole information stored in the stack is completely kept and a program called debugger (or Debugger) starts on the top of the stack. Because of this mechanism, the debugger can refer to all the information in stack and heap and the programmer can finely investigate the reason of the error. If the programmer rewrite the method in the debugger, the rewritten method can be started from the context.

In The Project, we handed many units to the guests and let them use the PDA. In such case, we encountered many errors we didn't expect during the office room test (This kind of things happen). Some of the error turned out to be "tricky," which only occurs very special conditions, but we managed to retrieve those unit and managed to find out the reason of the error by using the debugger running on the PDA. If we used some other language like Java, it would be virtually impossible to find out what was happend on those units.

Anyway, don't you think that it is stupid to say "the professional way of debugging is inserting printf() at arbitrary places..." at the beginning of 21st century? How can you use printf() for a tricky bugs on PDA working in a field test?

Some people might say "if you use a language that has compile time type check, there will no such tricky errors." But is this true? In a language like ML, it might be true for a certain extent, but languages like C, C++, or Java, you must have had tons of variety of run time errors. Some error might triggered by some timing issue of hardware or user input, The consensus of the Squeakers is that for the run time errors occurs in Squeak program, there are virtually no such errors that the Java or C compiler can find.

Words on KVM

Some of the patient readers who reached here might have a suggestion about a VM: KVM.

KVM is targeted to the hardware with tenth of kilo bytes memory and the special libraries such as GUI are provided. As a VM for very, very limited hardware, KVM is well-designed programming system. However, the programming style is restricted non-OO style and the libraries are very different from the ones that are used on the desktop environments. The marketing catch phrase WORA is not true here. In the future the memory capacity on the cell phones will be a few MB range and KVM is a framework which would not scale for those platforms.

In the other words, KVM is a system for current hardware, Squeak is a system for the future hardware.

Squeak/Zaurus was the only solution for The Project

The PDA in The Project used hundred mega bytes data includes the movie, images, and sounds and controled various peripherals including the digital camera and ran 5-6 hours continuously. As a matter fact, there are not much systems which make it possible. The combination of the high-end PDA from a good technology company like Sharp and the small and powerful programming language system like Squeak was the only solution.

Installation Squeak/Zaurus

Squeak/Zaurus is an application runs on the Zaurus PDA and its installation is very easy.

The Platform

There are several variant of the products sold under the name of Zaurus, the only one that is capable to execute Squeak/Zaurus is Japanese domestic version. Among the Japanese domestic ones, the realistic platform are the models that has more than 8MB DRAM. Namely,

As a matter fact, Squeak runs on the models with 2MB DRAM, but what it can do is very limited.

Squeak system consists of two parts. One is called the virtual machine (VM) and the other is called the virtual image. The VM is a normal Zaurus OS application (called MORE soft) and the image is a file which contains platform independent code and data.

The VM is a MORE soft whose "MORE soft application identifier" is "wtii." As for the image file, you can use any image files approximately smaller than 3.5MB.

The Squeak code for the Squeak/Zaurus specific functions are available as a tar.gz archive of file outs. Check this out.

You have to have enough flash memory space to store the VM and the image. The size of the VM is about 400k and typical size of the image is more than 1MB. Make sure you have enough space on internal flash memory or external memory.

It is very unlikely that Squeak causes any data loss or corruption and I haven't seen any. However, I recommend you make a backup before the installation.

Downloading to Zaurus Directly

If you are a user of ICRUISE, MI-C1, MI-P10, MI-TR1, or MI-E1, download wtii010126.ZAC as the VM. Next, download WTIIQVGA.ZAC as the default image file. When you extract the files from the archive from the "MORE management" function, the installation is finished.

Downloading from Japanese Windows

If you are using Japanese Windows, you're supposed to be able to read Japanese. Please read the japanese version of this page.

Installing via memory card

If your have a capability to write PC card, CompactFlash card, or SD card or MMC if the unit is MI-E1, you can install the files via the card. To do this, create a directory named "__ZAURUS" at the root directory and put the ZAC files and extract the files from those ZAC files. If you can copy the files from card to internal memory, it would be nice if you install the VM to the internal memory.

Invocation

Select "Squeak" from the MORE soft menu, and touch "JIKKOU" button. You will see a list of available images. Please select one you want to use. The slider bar on the first screen is not significant so far. The Squeak screen will come up in seconds.

Squeak/Zaurus Specific Functions

Squeak/Zaurus has several difference from the other platform due to it is pen based manipulation and there are many special features needed for The Project. The following is the difference of Zaurus version of Squeak.

Middle Button (Yellow Button) Click

"KINOU" prefix is used to generate middle button click event.

If you want the content menu to show up, press the "KINOU" button first and then touch (and hold) in a window. You can also do this by putting the pen around the border between the window and its scrollbar.

Right Button (Blue Button) Click

The "menu" key acts as prefix key for blue button.

The Screen Orientation of MI-E1

On MI-E1, you can switch the screen orientation landscape from/to portlait. From the background menu of the image in WTIIQVGA.ZAC, chose "appearance..." and then "portlait" or "landscape."

Keypad

The software keypad is available. You can on/off the keypad by touching the keypad button located at right-top corder. You should make sure the keyboard mode is selected as "hankaku" (half-width char) and "eisuu" (alphanumeric).

On the portlait screen of MI-E1, you can use the built in hardware keyboard. Note that there are some characters that you cannot enter by the built in keyboard.

External keyboard

You can use the external keyboard (CE-KB1). Connect the keyboard and select "KEITAIGATA keyboard" from the green button as usual. "KINOU" prefix is mapped to "Command", SHIFT+Ctrl is mapped to "option".

"Keys"

Squeak/Zaurus supports a number of "keys" (the buttons by the display screen). When you touch "KIRI (power off)" key, Zaurus will turn off the power immediately and you have no chance to save the changes you made.

When you touch the application keys, the application will come up. However, because Squeak doesn't release the working memory while running, Zaurus may hang up when you are going to use the application.

Interrupt

You can generate interrupts to the interpreter by touching "CHUDAN (interrupt)" key.

Reset

While you are using Squeak, there is a possibility that Squeak stuck. In that case do the "soft reset," which corresponds to the action to replace the battery.

But, please don't be afraid of soft reset. The data of embedded applications will not be lost by Squeak's hang or soft reset. Even I did soft reset my Zaurus which is used for the development thousands times, I've never lost any data.

Instant On feature

Zaurus OS has a function to keep the contents of DRAM while the power of the unit is turned off. Taking the advantage of this function, the VM can skip the image load and boot (virtually) instantly on MI-C1 and MI-E1,

For some reasons, the VM that supports the instant on is another binary. If you want to use the VM to use your Zaurus as a true Squeak machine, use wtii010126i.ZAC as the VM. When you invoke WTIIQVGA.IMA on this VM, a menu item called "suspend" will appear in the background menu. When you choose this item, the Squeak terminates and when you invoke the VM next time, the system resumes the state just before the suspend.

Other Features

As for the other VM features, see the file outs in an archive.

Those features are used by The Project to create a "Squeak machine." Try to create your own Squeak machine by using those functions.

Download

For ICRUISE, MI-C1, MI-P10, MI-TR1, and MI-E1, download wtii010126.ZAC and WTIIQVGA.ZAC by the Zaurus web browser. You can install those files to either the internal or the external memory. If you want to use the camera, you should install both of them to the internal memory. If you want to copy the image file from PC, or you just don't have enough space in internal memory, it would be nice to install the VM to internal and the image to external.

On MI-E1, the image on the SD card can be used if you switch the "card configuration" to SD card.

Demos

When you invoke the Squeak, a list that contains "WTIIQVGA.IMA"as its element. Select the file and you will see the Squeak screen.

There are two workspaces in the initial image in which a number of descriptions for the demos.

The demos are separated by

"----------"
line. You can execute those demos by "doing it" each separated descriptions.

If you have trouble with those demos, I recommend to press the "CHUDAN" button and generate the interrupt. This should result in a small pink window and the Squeak process comes back normally.

Hakoiri Musume

The first demo is a puzzle game called "Hakoiri Musume". You can invoke it by executing
Hako2 start.     "puzzle game"
. The purpose of the game is to move the biggest piece ("Musume") to the bottom-center position.

Hakoiri Musume is originally written by Seki-san (m_seki@mva.biglobe.ne.jp) and enhanced by me.

SimpleDraw (a drawing tool)

The next demo is a simple drawing tool. It supports the shape fill and GIF file creation. You can invoke it by executing
SimpleDraw open.     "simple drawing tool"
. You can draw by the pen.

You can invoke the menu for the drawing tool by pressing "KINOU" prior to a pen-down. The item "fill" fill the shape around the point you touch next, the item "color" is for the color palette, and "save and quit" is for saving the specified rectangle to a GIF file named "WTIIDRAW.GIF".

Life Game

rotating image from the camera

If you have the digital camera unit (CE-AG05, CE-AG06, or CE-AG03), you can execute an interesting demo. Select all of the bottom part from "f _ Form extent ..." and do it. You will see the image from the digital camera rotating. You can quit the demo by pressing "KINOU" and pen-down.

Terminating Squeak

The decent way to shutdown Squeak is to invoke the background menu, to select "quit" and choose no for the next question. You could just turn off the PDA if you just want to see the demo.

2MB model

If you want to use Squeak on 2MB DRAM models, download wtis.ZAC and wtismini.ZAC and extract files from them.

A MORE soft on 2MB model can use only 800k memory space including data and stack area. With this small memory, Squeak merely can load a small image file, and after you open a couple of windows, the process will stuck because of the shortage of memory.

Misc

I'll explain further information about Squeak/Zaurus.

The Naming Convention of File Names

Zaurus OS doesn't have directories. In order to avoid the file name conflict with other applications, the developper is supposed to maintain the uniqueness of the name of executable files and data files. Specifically, SHARP and the developper assigned unique four character string to every application, and the name of the data files related the application must be prefixed by this string.

The initial files in the package maintain this convention. However, the files Squeak will use should be able to have more liberal file names. If four characters out of 8+3 file name is fixed, it is desiastraous.

So I decided that Squeak/Zaurus can manipulate all files including the system files. Please beware not delete or rename the system files. Basically, the files not displayed in "Paso-con data" aren't related to Squeak/Zaurus. I recommend you check "Paso-con data" screen first, and not touch the other files.

Memory Size Limitation

On 8MB DRAM model, the total size of an application can allocate is supposed to be 5MB. Out of five, Squeak allocates 4.5MB for Squeak heap. If you create an image file by yourself, think about this limitation.

Compiling source by SZAB

Again, if you are going to compile the source code, please read the japanese version of this page. The source code archive is available at zau-chu2000.7.tar.gz.

Links



Yoshiki Ohshima
Walt Disney Imagineering R&D
1401 Flower St.
Glendale, CA, 91221-5020