This describes how you should be able to build and use the experimental KaffePC VM with AWT support. Contents: 1. Precautions 2. Building KaffePC 3. Runtime setup 1. Precautions This is a first version of KaffePC with AWT support. In addition to the libraries that were included in Yuji Yamaguchi's original version, it uses Ulrich Leodolter's DOS/DJGPP port of the X11 libraries, and a few graphics libraries (grx20, gif, jpeg, png); I've made a few changes to the X11 and gif libraries to make them compile under DJGPP version 2 with GRX 2.3. Many things work somehow, and practically nothing works properly, so this should be considered a strictly developers' only release. Particular problems I am aware of are: 1. Keyboard support is very limited: Due to the fact that GRX 2.3 does no longer pass on the BIOS scancodes, and since I didn't want to fiddle around with their sources, I decided to settle for second-guessing some scancodes from the ascii value returned; this means that this version will only work with the keyboard driver in US mode (if ascii values >127 are returned, there may be a prtection fault) 2. The X11 library currently only supports pseudocolor modes; this (and other problems) is a flaw in the original port 3. There is no 16 bit character support; in writing to the screen (via drawString() ) only the low-order byte is used; in addition, the grx library uses the PC doepage 850 encoding, so international characters (e.g., German umlauts) are not displayed correctly. 4. event handling is osmewhat flimsy; this results in some (but not all) menu items being ignored when they are clicked, FileDialog not returning the file chosen, and others 5. timing is a problem; as the DJGPP settimer/SIGALRM omly uses the standard timer resolution of 18.2 Hz, one has to hold down the mouse button for about one second before a click is recognized; I have some kludge to improve this, but it is not really recommended. 6. In particular, png support doesn't work too well; sometimes this kills the VM with a NullPointerException 7. The documentation isn't really up to date 8. Lots of other things I haven't even noticed yet. 2. Building KaffePC At this time, KaffePC can only be built with long filename support. Yout options are: 2.1 Building under linux 2.2 Building under Win 9.x 2.1 Building under linux This requires a lot of gnu utilities (gcc, sed, patch etc.) which should be present on any linux system. In addition the following are needed: JDK version 1.1.x or above (I use 1.1.7) The DJGPP cross to Dos compiler: 2.1.1. Setting up the cross compiler You need the following files: gccc-2.7.2.tar.gz binutils-2.7.tar.gz (from your favorite gnu archive) djcrx201.zip (from your favorite djgpp archive, in v2tk/old) (I keep copies on my home page: http://www.ci.tuwien.ac.at/~grill/kaffepc.html) On the DJGPP homepage, in the "HOWTO" section, you can find instructions on building a gcc 2.8.1 cross compiler; this should work, too, but you have to replace djcrx202 by djcrx201 in order to successfully compile KaffePC. Somehow the low-level features of the DJGPP libraries have changed, and this breaks the Kaffe code. Create a directory for the source (henceforth called the `base directory') cd to your base directory and: unzip -a djcrx201.zip tar -zxvf gcc-2.7.2.tar.gz tar -zxvf binutils-2.7.tar.gz copy everything from the `cross' subdir up into the base directory apply the library patch: patch -p0 patch.lib edit the top level Makefile: set the PREFIX variable to where your executables are supposed to go (I suggest /usr/local; that's what I use) now make all have some coffee (my AMD 400 took about 5 minutes, so you may be able to figure out if you can go out to lunch) make install Now, go ahead and play around with your new compiler a bit, trying out all those great pieces of programming wisdom ("Wello Hurld!"), and come back later to 2.1.2 Compiling kaffepc 2.1.2.1 Setting up the sources Get kaffepc-1.0.b3a.zip from my homepage Create a `base directory' and there unzip kaffepc-1.0.b3.zip this will give you a nice directory tree under /kaffepc-1.0.b3 edit Environment: change the DJGPPHOME variable to the place where your dos libraries sit (if you installed the cross compiler into /usr/lib as I told you, you won't have to change anything) make sure $PREFIX/bin is in your path (that's where dos-gcc and all the other executables sit); make sure javac, jar and the likes are on the path then source Environment will set up all the variables you need make support-install puts the add-on libraries where dos-gcc can find them make creates the binaries make buildbin creates a binary distribution make buildjar builds the class libraries (only needed if you change any of the .java files) make support recompiles the support libraries (not all of them - grx, gif, png, and jpeg are not included (yet?); I built those under MSDOS and was too lazy to add them to the linux source tree - if you want - or have to - recompile those, the sources are in the src subdirectory) make xlibs remakes the libraries for X11 support 2.2 Building under Win 9.x Unpack the source distribution as described for building under linux. You may want to use the -a option (or whatever makes unzip change unix to dos line endings; in addition, make sure that the directory structure is maintained) I created a makefile Makefile.w9x which should work for windows. Copy or rename this one to Makefile. I didn't try this one, so I'm not sure if it works at all. 2.2.1 Machine environment OS Windows95/98 (Windows NT unusable) Phisical Memory 64MB over HDD 50MB over 2.2.2 Installation of DJGPP To development of KaffePC, we use DJGPP. Please download listed below from DJGPP FTP site, and extract. (about overlapping files, you can overwrite have no problem). * v2/djdev201.zip * v2gnu/bnu281b.zip * v2gnu/bsh1147b.zip * v2gnu/dif271b.zip * v2gnu/fil316b.zip * v2gnu/find41b.zip * v2gnu/gcc281b.zip * v2gnu/grep22b.zip * v2gnu/gwk303b.zip * v2gnu/mak377b.zip * v2gnu/sed302b.zip * v2gnu/shl112b.zip * v2gnu/txt122b.zip * v2misc/csdpmi4b.zip 2.2.3 Setting of shell Mkdir \bin on current drive and cp bash.exe arleady extracted above process to \bin\sh.exe. 2.2.4 Installation of JDK Install JDK1.1.X or JDK1.2.X. It is needed to make JAR file. 2.3 Building KaffePC/VM Show sample building KaffePC/VM. First, we assume that some required software by building process listed below are arleady installed in described location. djpgpp d:/djgpp KaffePC/VM binary d:/kaffepc KaffePC/VM source d:/kaffepc-1.0.b3 JDK d:/java/jdk1.1.7B 2.3.1 Setting of environment variables Show the sample setting of environment variables below. rem -------------------------------------------------------------------------- rem Modify the following environment variables. rem set JDKHOME=d:/java/jdk1.1.7B set DJGPPHOME=d:/djgpp set KAFFEHOME=d:/kaffepc set KAFFESRCHOME=d:/kaffepc-1.0.b3 rem -------------------------------------------------------------------------- set PATH=%DJGPPHOME%/bin;%KAFFEHOME%/bin;%JDKHOME%/bin set DJGPP=%DJGPPHOME%/djgpp.env set LFN=y set VPATHSEP=; set CC=gcc set AR=ar rc set RANLIB=ranlib set LIBS=-ltcp -lserio set STD_LIBRARIES=-ltcp -lserio set EXTRA_CFLAGS=-DDEBUG set SHELL=%DJGPPHOME%/bin/bash.exe set CFLAGS=-O2 set CLASSPATH=.;%KAFFESRCHOME%/kaffe-1.0.b3/libraries/javalib/pizza.jar set LANG=ja_JP.SJIS set TZ=JST-9 rem for wattcp set LAB=%KAFFESRCHOME% set WATTCPHOME=%LAB%/tcplib set C_INCLUDE_PATH=%C_INCLUDE_PATH%;%WATTCPHOME%/include set C_INCLUDE_PATH=%C_INCLUDE_PATH%;%WATTCPHOME%/include/tcp rem set LIBRARY_PATH=%WATTCPHOME% rem for bcsio20 rem set BCSIO20HOME=%KAFFESRCHOME%/bcsio20 rem set C_INCLUDE_PATH=%C_INCLUDE_PATH%;%BCSIO20HOME% rem set LIBRARY_PATH=%LIBRARY_PATH%;%BCSIO20HOME% rem for gmp rem set GMPHOME=%KAFFESRCHOME%/gmp-2.0.2 rem set C_INCLUDE_PATH=%C_INCLUDE_PATH%;%GMPHOME% rem set LIBRARY_PATH=%LIBRARY_PATH%;%GMPHOME% rem for zlib rem set ZLIBHOME=%KAFFESRCHOME%/zlib-1.12 rem set C_INCLUDE_PATH=%C_INCLUDE_PATH%;%ZLIBHOME% rem for X11 set X_INCLUDE_PATH=%KAFFESRCHOME%/x/include set C_INCLUDE_PATH=%C_INCLUDE_PATH%;%KAFFESRCHOME%/x/include set C_INCLUDE_PATH=%C_INCLUDE_PATH%;%DJGPPHOME%/include set X_INCLUDE_PATH=%X_INCLUDE_PATH%;%DJGPPHOME%/include set LIBRARY_PATH=%KAFFESRCHOME%/lib (These are Yuji Yamaguchi's instructions, which I changed to reflect the changes in the source tree I've made. Ignore all the lines that are rem'd out) 2.3.2 Running make Run make at KaffePC/VM source directory. With make, some targets available: all to make kaffe.exe, compile all C source of KaffePC/VM. buildjar to make klasses.jar and kaffepc.jar, recompile all Java source. (If you don't modify Java source in KaffePC/VM, you have no need to execute the target) buildbin to pack running environment, mkdir kpcbin on current directory, collect all of KaffePC/VM binaries needed into kpcbin and pack it. allclean delete all of binaries produced. 3. Runtime setup Put your binary distribution on a DOS partition (either copy it from the build directory or unzip the binary distribution) Copy the grx (from grx20/fonts) to some directory on your Dos Partition. set a few environment variables: (assuming your KaffePC binaries are in c:\kaffepc and the GRX fonts in c:\fonts) set PATH=c:\kaffepc\bin set KAFFEHOME=c:/kaffepc set CLASSPATH= set GRXFONT=c:/fonts optionally, you can set the GRX20DRV variable (look at the GRX docs), but make sure to specify a color depth <=256. set FVWM=y (this enables the window manager, so you get titlebars and can iconify your windows; occassionally, you may wnat to try without; this gives undecorated windows that cannot be iconified or resized, but a few things work better this way) Now, kaffe should run your favorite application If you are not happy with the speed of this (remember: it takes about a second of pressing a mouse button in order to hav it recognized), you may try the timewarp utility. This speeds the system up by making the timer tick run faster: timewarp [0123] 0 - normal speed (your usual 18.2 Hz) 1 - 8 times as fast 2 - 16 times 3 - 32 times (doesn't work for me) Be cautious - there is danger that this may bring the whole system down; at least, you will get some clock skew, so if you want to do anything productive, you should reboot your machine. 4. About modification of cwsdpmi.exe The reason of the mismatch of hardware interrupt mechanism of KaffePC/VM and DJGPP, we modify DPMI server module of DJGPP, namely cwsdpmi.exe. the modified module is included in source and binary release of KaffePC/VM.