Friday, 23 August 2013

Resurrecting the OS-9/68K (OSK) kernel using the FAME 68K Emulator

The Motorola 68000, sadly, is mostly a relic nowadays. It had a beautiful instruction set and a clean architecture, from software all the way down to the bus protocols. Alas, all good things must pass...

However, there was a damn good operating system written for this CPU which I just can't stand to see die slowly, rotting on lost floppy discs and SCSI drives. The OS of which I speak is the OS-9 RTOS by Microware: a microkernel which was originally written for the Motorola 6809 CPU as a contract from Motorola to showcase their new CPU (most famously used on the Tandy Color Computer, various GIMIX systems, the Sharp X68000 series in Japan, and the Fairlight/CMI synthesizers of the early 80s), then ported to the Motorola 68k series of processors, the x86, ARM and Hitachi SH series, amongst others.

This operating system has been really short-changed by history. Ask most programmers which consumer (non-mainframe/UNIX/'big-iron') system was able to do multitasking and/or timesharing; you'll usually get answers of the Commodore Amiga, or the PC, or the Mac. They're all wrong. OS-9 was doing this in 1979, before the Commodore 64 even existed, with a full-fledged UNIX-style shell environment and all of the flexibility that philosophy brought with it, in less than 64 kilobytes!

The folks at Microware really should be legends in the industry for their forward-thinking software. Applications, device drivers, the kernel, and even instances of devices were all modules using an object-based structure that could be configured at boot time, then subsequently reconfigured at run-time, as modules were added or removed, with no reboots. Hmm, it only took, what, twenty-plus years, for other mainstream desktop operating systems to achieve this (and imperfectly)?

With that in mind, I now place here a small lifeline for this amazing operating system in the hopes it will be preserved (and perhaps improved...)

OS-9/68k 'RUSSBOX' Emulator Proof of Concept

This uses the FAME/68K emulation library under Cygwin to boot an OS-9 68000 'idealized' abstract system of my own design (by 'abstract', I mean a system which doesn't correspond to any 'real' historical system and is as simple as possible for the purpose of booting OS-9).


Windows XP or newer

From the cygwin prompt in your home directory:

$ git clone git:// MWOS
$ cd MWOS
[This gives the pristine MWOS OS-9/68k port dev tree, sans Hawk UI cruft, etc.]
$ git checkout origin/rlm-sys-1
[This switches to a branch which adds the virtual 'RUSSBOX' support files:
  MWOS/OS9/68000/PORTS/RUSSBOX - plus some .d/.a files to support the virtual
  hardware in higher directories within MWOS/...]

$ git submodule add git:// \
[This is the emulator itself, using FAME 68k library]

$ cd OS9/68000/PORTS/RUSSBOX

$ . ./

[open a second cygwin terminal]
$ cd MWOS/OS9/68000/PORTS/RUSSBOX/rlm-sys-1/
$ stty -echo -icanon -icrnl -inlcr min 1 && nc -u 8800

[return to first cygwin terminal]

[switch to second cygwin terminal]
[press ENTER]
[You should see a RomBug: prompt.]
[Type [.],[ENTER] to see 68k registers]
[Type [g],[ENTER] to start boot]
[After a few seconds you should see the OS-9 '$' prompt.]
[Type some common OS-9 commands, eg 'devs', 'free', 'mdir', 'dir']


The backspace/del key doesn't work.. the terminal via UDP is primitive and the exact setup for 'stty' above can probably be improved to at least let through delete properly.

Typing CTRL-C on the OS-9 terminal also terminates the stty connection, rather than transmitting CTRL-C through to the OS-9 target.

** NOTE after typing CTRL-C to interrupt the UDP terminal, one must type blindly:

stty echo

.. to turn on echo for the cygwin shell again.

Eventually I would like to write a dedicated UDP terminal + emulator 'front panel' that can pass all ascii codes through properly, and integrate in other ways with the virtual target (such as some way to show the virtual framebuffer, I/O, etc.)

While rudimentary this serves as a demonstration that the FAME/68k emulation library is sufficiently accurate to fully bootstrap and run the OS-9 68000 kernel and as such we can preserve the OS-9/68k operating system in an environment which will never be subject to the ravages of time, dying hardware etc. :)



  1. Great work! Too bad Motorola didn't beat Intel on the desktop. 68k/CPU32 forever!

  2. I absolutely love the work you've done with OSk and FAME.

    I too am interested in the preservation of OS-9. I took a bit different tact: I used the OS-9/x86 (OS-9000) eval CD, a bit of elbow grease, and some work-arounds with some PC emulators to produce a working OS-9000 VirtualBox image. I never got MAUI working, but networking and NFS is all set.

    My HD image includes the native-hosted Ultra C compiler, as well.

    The current line of thinking, when I get some real time to dig in, is to port os9exec (or perhaps create something similar) to OS-9/x86, thereby allowing OS-9/68k applications to run on OS-9/x86.

    I'm not super-familiar with the Windows-hosted MW tools, or Cygwin for that matter. If you have the time, I'd appreciate any pointers you could give in what would be needed to integrate the two MWOS trees for 68k and x86. Hopefully this weekend I'll get a bit of time to diff some things and figure out if the Windows bins are even the same versions and so forth.

    And of course, if you'd like a copy of the x86 stuff, you are welcome to it.

    1. Yes, I would definitely be interested in trying out the x86 virtualbox image! Great to hear someone has gotten that working with networking as well.

      As I understand it, OS-9000 was written mostly in C, so the codebases may not be easily integrated. The cross compile tools are all DOS so I don't know if one would be able to build OS-9 68k modules from the OS-9000 environment if that's what you mean...

      Anyway yes please contact me about it :)

    2. This comment has been removed by a blog administrator.

  3. Hello,

    I have a practical and industrial application for an OS9 68040 emulator, and a project to develop it. Could you please contact me to discuss?

  4. Your git repo isn't connecting (connection refused). Is it gone forever?

    1. Should be fixed now. Note the git repository paths had to change slightly, I have updated them in the post.

  5. Came across this recently and I must say I'm very interested. So far, I haven't been able to get anything to compile. Will continue to work on it.

    1. What error do you get trying to build? I haven't touched this in a while but I'll try to help if you can give more details.

  6. DangerRuss: first of all, thank you very much for this post! I'm working on a legacy industrial system which uses a 68k CPU and OS-9. I've been looking high and low for a way to emulate the hardware and am cloning your git repo as I write this. Would you be open to chatting over email about your work on the 68k/OS-9 platform? I'm a dedicated embedded engineer by day and software mercenary part-time trying to rapidly gain knowledge... and reading over your profile I think we may have a lot in common.

  7. Hope you get this, it seems google in general is having conniptions tonight (or maybe it's this laptop I'm using).

    Anyways... sure, fire off a mail to me at 'rmagee' at gmail... I haven't worked on this in around two years to be honest (since shortly after posting it). But I'd be happy to answer any questions, perhaps it'll kick my butt to do some more work on it.

    Try it out and let me know if the instructions above work for you.

    What OS-9 system are you working on? I haven't worked on real 68k hardware in many years now sadly.. but perhaps something here can help you.

  8. Is the os9_68k_sdk_v12 file still available?

    1. Hi, sorry -- blogger apparently is broken for Firefox now and I had to load up Chromium to reply to you! Sheesh.

      It was a firewall issue, please try pulling the git repo now.

  9. Hi Ppl! I own an old Bosch Motortester and found that it runs on OS-9000. I have lots of floppies containing the OS. Can anybody give me a hint how i can make images of those floppies? DD under linux does not work. ;-)
    Thanks a lot


    1. Hi, if your OS-9000 box still boots and runs, you can make images of the disks by following the guide here:

      You'll need a Windows box and a good term program that supports zmodem and/or kermit (TeraTerm Pro is what I used).

    2. Here is a link to the utils I used from Linux many years ago to read OS9 disks. They use the linux 'fdrawcmd' to achieve a low-level read of the physical media.

      Credit to Bob van der Poel for writing this.

      NOTE you'll also need 'fdrawcmd', part of the 'fdutils' package. It's available from Debian, or source is in git here: git://

    3. Who needs to read OS disks with the first track FM-formated, might look into Bob von der Poel extended distribution with some additions and fixes by me:
      Bob won't add this update to his site, but allowed me to redistribute it on mine.

  10. Hi Russ
    Very nice job.
    I tried the:
    git clone git:// MWOS

    but it times out.
    Any way to get a copy ??
    Also, the guy , who made OS9000/x86 run in Virtual Box, can he be contacted ??

    1. Hello, apologies for the delay. git repos should now be back online.

  11. Ack, my server appears to be down -- and I'm out of town until Tues the 10th of January! My apologies. I'll see if I can get things up again as soon as I get back.

    I can ask the gentleman who has been tinkering with OS-9000 if he'd be OK with me connecting you two, sure :)

    Happy New Year!

  12. Hi DangerRuss
    Is your server up again ??

    1. Drat, sorry! I moved my server to Gentoo a while ago and forgot that I hadn't made my git-daemon part of the default runlevel. It should be up (and stay up) now.

  13. I wonder if you have made any progress on this. When I try to launch the emulator, I get...

    Power-on reset...ok.
    Installing TimTick ms-timer...ok.
    Entering emulation.
    [TIMT_LOAD written zero - IRQ disabled]
    TERM 0 RX ovf [repeated many times]
    TERM 0 RX ovf
    TERM 0 RX ovf
    [CPU NOTICE: cpu_status=16]
    T0: RXD:3c TXD:0a BR1:1 BR0:1 TXE:1 RXF:1 RXV:1 TEI:0 RFI:0 IRQEN:0
    T1: RXD:0d TXD:00 BR1:0 BR0:0 TXE:1 RXF:1 RXV:0 TEI:0 RFI:0 IRQEN:0
    D0:00000000 D1:00002000 D2:00000000 D3:00000000
    D4:00000000 D5:00000001 D6:FFFFE000 D7:000047F8
    A0:00F009A8 A1:00F00478 A2:00F80000 A3:00F80000
    A4:00005800 A5:00000400 A6:00000000 A7:000047EC
    SR:2000 Flags: -----
    [Press a key to continue.]

    1. Oh dear. I seem to have reverted my repo by accident. I need to look through backups. I hope I didn't lose the latest version!

      I will update here once I find out.

    2. Turns out the repo is fine so far as I can tell; the issue seems to be with win7 x86 vs. win7 x64, or cygwin32 on win7 x64.

      I'll try to pinpoint the issue further soon. Please try the steps here on a win7 x86 system using cygwin32.

      ** As well, the '' script may need to be edited on your system to match the actual installation root of your cygwin32 and checkout directory of the repo.