Close

Adding an OS to the Apple-1 or KIM-1

A project log for ESP65 Pocket Computer: KIM-I/Apple-1/esp32

Like a HP-200LX but better - because 6502

oscarvOscarv 01/15/2021 at 14:420 Comments

From my previous KIM Uno project, I already had a 6502 simulator with KIM/Apple compatibility. But for the esp65, I had to add an operating system to implement disk storage.

In the Z80 world, CP/M offered a 'standard' OS right from the early days. For whatever (interesting!) reason, standardisation did not happen for the 6502. Only proprietary systems, for the OSI computer and for some other early machines existed, but no standard emerged.

I looked at porting the Ohio Scientific (OSI) disk operating system, and the interesting DOS65 for the Dutch Octopus computer. I might end up adding them, but because I am familiar with CP/M, I chose Richard Leary's DOS/65. Developed around 1980, Richard published this only some years ago. It really is CP/M for the 6502, and comes with the essentials: an assembler, Basic compiler, line editor, and debugger. As part of the Retrobrew 6x0x project, Dan Werner added a full-screen editor and Lee Davison's ehBasic. But for me, the attraction of DOS/65 is that it was *meant* to be added on to any 6502 system. Not just one specific computer.


Bringing up DOS/65 turned out to be surprisingly simple. I wrote a 40-line disk interface simulator on the esp32 side, a little 70-byte boat loader ROM within the 6502 emulator, which loads DOS/65 from a disk image on the esp32. To make it live as an extension of the KIM-1 and Apple-1, and not a replacement for either one, I configured DOS/65 to claim $2000-$D000 as its RAM territory. But it allows you to load code anywhere, so it indeed can load Apple-1 and KIM-1 programs and lets you jump back to the KIM or Apple ROM firmware. It's perfect in that it truly is an enhancement to the original machines, not a replacement fo them. You can have KIM, Apple, or DOS/65 software live side by side on the disks and run any of it. That fits my ambition of having my esp65 be both KIM and Apple compatible at the same time!

(Image: we start in Wozmon on the Apple-1, boot up DOS/65 and flip to the KIM-1 terminal mode - seamless integration :)

For now, I have two 320K disk images preloaded with software in the esp32's SPIFFs file system, plus a tiny 16K ram disk for when you continuously edit a file and you don't want to wear out the disks ;)

Future projects will be to add the similar-named but very different DOS65, and I will try to bring up 6502 fuzix. But fuzix, of course, will disable KIM/Apple compatibility and be its own thing. Still: it'd make the esp65 into a tiny unix-like system with even a C compiler. Ooh, the possibilities...

Discussions