So I finally built my first 6502 computer, and now I need software for it... While I blew some EPROMs with specifically tailored firmware to do some fancy (and sometimes useful!) things, there was a clear need for a common platform for future applications to rely on -- especially since I'm involved in some technical stuff that would benefit from a simple but highy controllable computer, but I'm not willing to program it from the scratch every time.
So... here's the answer: minimOS
As the name suggests, it's intended to be a minimalistic Operating System; however, there are three main goals in my mind:
- Scalability: from a simple embedded system to a (almost) full-featured desktop with GUI
- Modularity: the ability to program drivers, kernel extensions and applications without knowing each other; and build the kernel with just the needed features (see above)
- Portability: intended to run on my (let's hope, several) machines but also adaptable to existing 65xx architectures... or even other processors (obviously without binary compatibility then)
I have put the source code (and some binaries) provisionally at http://cjss.sytes.net/lib/minimOS/, although I'll try to set a GitHub account for it ASAP... In the meanwhile, I'll try to explain my file structure:
- kernel_0.4rc.s is the main file, the one to be assembled (I use xa). It has #includes for all the remaining components.
- macros_0.4.h includes automatic implementation of CMOS-only opcodes; if NMOS is selected, they're replaced for equivalent NMOS code fragments. There are some conditional-assembly definitions, but that may change in the future...
- api_0.4.h defines several constants: function names, error codes, port numbers... currently uses preprocessor macros, may be labels in the future.
- zeropage_0.4.h reserves the first three bytes, and the last ones for function parameters, etc. -- currently from $EA, but unfortunately the user space may shrink a bit in more mature versions...
- sysvars_0.4.h are the system globals, from $0200 (unless there's very liitle RAM!). Addresses may change within versions or depending on installed drivers, thus shouldn't be directly accessed by applications. Device drivers may include their own variables after this (for instance, drivers/drv_led.h) because currently they're assembled within the kernel... but I don't rule out the possibility of loading drivers on the fly, will have to devise a method for dinamically assigning variable space for them, though.
- shell.s is the code that gets executed after the POST (boot)... so far is just like a "typewriter" (get char from default input device, put it on default output device, loop forever) for demonstration purposes.
- drivers/ contains both the driver code (like drv_led.s for the LED Keypad) and associate variables (drv_led.h). Also included is a dirty replacement for it, drv_debug.s which uses the bus sniffer as a rudimentary output device for debugging purposes.
- firmware/ contains some code for specific tasks on my machines; nothing to do with the OS, really.
- bin/ has ready-to-blow ROM contents of older versions (and the current release minimOS_0.4rc.bin). They're all 2 KiB, suitable for a 27C16 EPROM.
- to_do/ has source code for future components; this is under development and won't assemble right now.
- old/ (also available inside other folders) has, obviously, older (probably non-working) versions.
While this is certainly in a very early stage, it's a start...