Introduction

Have you ever wished to have GEOS 128 always ready to be activated at your command? Look no further, for GEOS Kernal Construction Set lets you build a customized ROM image, which you can burn and install on the empty U36 socket of your C128 or in certain models of Commodore 17xx REUs. Once installed, this ROM will remain inactive until you choose to boot into GEOS 128 by holding down the Control key while turning on or pressing the reset button. All you need is a disk with a copy of Configure and deskTop to complete the initialization process. It's that simple!

Customize your ROM image with your own GEOS serial number in order to retain full compatibility with any "keyed" applications you may own. Choose boot-drive type (1541/71/81) and device number (8/9), as well as your favorite input device (joystick, 1351 mouse or any other, with user-supplied drivers). Last, but certainly not least, the required kind of RAM expansion support can be specified: Commodore 17xx REU or Berkeley Softworks GEORAM. And for all our German-speaking friends, GKCS can also build the German Kernal, umlauts and all!

How it works

On the original disk media, GEOS and GEOS BOOT take care of autostarting and fast-loading the bulk of the operating system from the GEOS KERNAL file. After a successful copy-protection check, the GEOS Kernal gets decrypted in memory, along with a joystick input driver and a 1541 disk driver (yes, even on GEOS 128) with additional copy-protection code. At this point GEOS is started and begins loading any Auto-Exec files present on the boot disk in device #8. Among them is Configure, whose job is to detect the presence of a RAM Expansion Unit and any additional disk drives, and install the corresponding drivers. It is only after this process that a 1571 will be able to read double sided disks. Once all Auto-Exec files have been loaded, control is passed to the deskTop which, in turn, loads the first input driver it finds on disk, thus replacing the one loaded along with the Kernal.

With all this in mind, it's clear to see we can preload GEOS Kernal with the proper disk driver in order to let it complete the boot process from a specific drive type (1541/71/81) at either device #8 or #9. And, instead of loading a joystick driver only to be overwritten later, just start with our favorite default input driver in memory and do without additional on-disk drivers. This is exactly what GKCS does!

Changes to the Kernal

The goal behind GKCS is to create a ROM image of the original GEOS 128 Kernal which gets loaded to RAM and works exactly as its disk-based counterpart. This way, you retain all the flexibility of mixing and matching Auto-Exec files (e.g. Configure 2.1), including those which patch Kernal routines, or even replacing the deskTop completely with an alternative file manager. Yet, a handful of GEOS routines had to be slightly modified to accommodate for the fact that the GEOS Kernal is always available in ROM. These routines deal exclusively with entering, leaving or reentering GEOS.

ResetHandle

Behind this misleading name is the routine which takes care of the initial GEOS configuration, and is the only routine that is never called again during GEOS operation. In fact, it's located in standard application space and gets overwritten as soon as you enter deskTop. Code related to installation and on-disk copy protection has been removed, and the necessary changes made to make it compatible with 1581 drives during Auto-Exec files search.

BootGEOS

This short routine located just after the GEOS header (in the $C000-$C07F region) checks whether RAM expansion is available and the RAM reboot option enabled, and if so, reboots GEOS instantly from RAM, including configuration settings and all disk drivers. If RAM expansion is not available, or the RAM reboot option is not checked, it will simply reset the C128 expecting a GEOS 128 boot disk to be present in the disk drive.

Of course, with the GEOS Kernal available permanently in ROM, there is no need ever to reboot from disk. Rebooting from RAM Expansion is still supported (and favored), both for convenience and compatibility with any software that relies on it (including 128 RBOOT). When that's not possible, this routine now resorts to the boot procedure in ROM to handle the call and reload GEOS Kernal instantly.

ToBasic

Though in principle it required little modification, this routine ended up being rewritten extensively due to several bugs present in the original. Any time you returned to BASIC from the deskTop, it would hold the screen with garbage during an unnecessary initialization command sent to the disk drive. Then, even if there was no BASIC-command sent from GEOS, the NMI-based routine which handled the keyboard entry would still send a CR, making the cursor skip down one line. And if you think that's nitpicking, beware ToBasic didn't restore the NMI pointer to its default value afterwards! (Boot GEOS 128 from disk, exit to BASIC from deskTop and try pressing RUN/STOP-RESTORE a couple of times to watch the screen editor go haywire.)

American-only changes

The original release of GEOS 2.0 contains a graphic glitch in the 40-column BSW font, which results in extra space displayed following a lowercase "z". This was carried on to GEOS 128 2.0, and later fixed by Berkeley Softworks for the GEORAM-bundled release. GEOS Kernal Construction Set will always use the fixed font when building a ROM image.

Perhaps less annoyingly, the American GEOS 128 2.0 Kernal asks for "128 DESKTOP V2.0" in all-caps, unlike GEOS 2.0 (for the C64), or even the German edition of GEOS 128 2.0, which correctly requests "128 deskTop V2.0". This string has been changed accordingly for the American builds.

Build your own

Before building your custom GEOS Kernal ROM image, please review the following options carefully:

Nationality
Selects locale, which affects the language of Kernal messages and the inclusion of foreign-language characters in BSW/BSW80 fonts. Although American, German, French, Dutch, Italian, Swedish, Spanish and Portuguese versions were announced, only American and German editions seem to have seen the light of day. If you happen to own GEOS 64 or 128 in any other language, please contact us so we can include it on GKCS.
Serial Number
Upon first boot, every GEOS disk is assigned a random 16-bit serial number. This number is later keyed into any Berkeley Softworks application you install. By transferring your on-disk serial number to your ROM image, you can retain compatibility with any applications you have already installed. Given Berkeley Softworks' vicious copy-protection schemes, it's probably safer not to rely on patching applications.
RAM Expansion Support
Standard support for Commodore 17xx REUs has been included with GEOS since version 1.3, but GEORAM units require a different set of low-level routines. If you have GEORAM or compatible RAM expansion, choose Berkeley Softworks GEORAM to build your Kernal. Please beware you need to use the corresponding Configure 2.0r for correct operation.
Boot Drive and Device Number
Once GEOS Kernal is in memory, it has to complete the boot procedure by loading any Auto-Exec files present on boot disk. Select your preferred boot drive type and device number from which to load Configure and others. Note: Bear in mind the boot disk should be inserted before entering GEOS for the Auto-Exec files to be loaded.
Default Input Device
If you're the lucky owner of a Commodore 1351, or any other proportional mouse, you should build it as default, and forget about on-disk input drivers. Since there are countless input devices and drivers, rather than trying to include them all, GKCS offers you the possibility of uploading your own. Select Custom... and choose the driver to upload, in Convert (.CVT) format.

Final words

If you don't have a RTC but do set the proper date and time when using GEOS, it is recommended that in case of going to BASIC from GEOS and back, you do so by typing SYS 996 instead of pressing the reset button. Although GEOS is able to recover date information from the previous session, the "hard" reset restarts the TOD clock and there's nothing that can be done to preserve the time.

It's been a very satisfying experience to play around with the GEOS 128 Kernal, and get it booting from ROM. From the initial "proof of concept", which loaded the Kernal in 2.5 seconds (down from 26s booting from disk) to load this current release, which boots instantly (it takes about 0.5s, but that's hard to notice) and incorporates as much flexibility as I could think of. I'm sure there'll be further development soon :)

Acknowledgements

I'd like to show my appreciation to the whole Commodore community for keeping the dream alive. Specially, in no particular order, to DLH's Bombjack site full of books which would otherwise have been lost in time; Zimmers.net resources regarding ROM dumps and tech stuff; Cenbe's pages with a huge collection of GEOS stuff (the Guida ufficiale alla programmazione di GEOS was a real treat); to iCore64 for sending me a copy of GEOS 128 2.0r (a long time ago...), Maciej Witkowiak & Michael Steil for their GEOS disassembly, and to everybody who's expressed encouragement and feedback at Lemon64 and Forum64.