Software for Y Ddraig was initially written in assembly using VASM. Once the initial monitor code was working, more complex programs were required, and it was easier to write those in C rather than using assembler. For compiling these programs GCC was chosen to be used as a cross compiler.
Building a M68K GCC toolchain
Initial versions of the GCC tool chain were built manually, but this was a slow and error prone process when trying to set up a new development system or just updating the software. To ease this, I developed a script to build the tools. I based the build script on Bebbo’s excellent GCC for Amiga cross build system. Now updating or building from scratch can be done in a couple of simple commands.
While I’m working mostly with GCC 9.4, the script has been tested successfully with GCC versions 6-10.
The script can be downloaded from Github: m68k-elf-toolchain
Installation is done by simply running
make update make all
The build script works on Linux, Windows (under MSYS2) and MacOS (hasn’t been tested in several years but should work in theory).
Newlib is used to supply the C standard library for Y Ddraig. The initial version used was modified only as far as allowing printing of characters via the serial terminal. While this was very useful in developing initial test code. When the operating system code became a bit more advanced, file access was needed so a modified version was developed that implements calls into the OS using the 68000’s TRAP instruction.
These BIOS calls handle the file access for the OS and allows access to files on the IDE hard drive interface.
The Montor ROM was initally based on kBug, although it has been modified quite a bit since then. Initial testing of the hardware on Y Ddraig was performed using the monitor. One of the most useful features during the development phase was the abilty to download programs to RAM using the SREC format allowing running of user code.
All interaction is done via the serial port so it has to be connected to a host PC to be used.
There is also a very WIP version of the monitor code that has a much more flexable command line interface but development stalled on that when I started working on the OS. Will hopefully return to this at some point in the future.
DdraigDOS is the main operating system for Y Ddraig. The aim is to have a MS DOS like operating system with a comprehensive set of commands available to it. It has EhBASIC built in as well as support for loading and running ELF executables.
Writing software is done on the PC with the programs cross compiled in GCC. In addition to the BASIC in ROM it’s planned to support development on the system by providing additional language support that can be loaded from disk.
The operating system is currently in an early stage of development and is changing constantly. The current version relies on a serial terminal connection with a host PC for running commands. Once keyboard and video support has been added to the OS, it will be possible to use Y Ddraig as a fully standalone computer.
Programs can be loaded either via the serial port in SREC format, or ELF binaries can be loaded and run from disk. FAT support is provided by the FatFS library and is currently using the CF card as the hard drive but it would be nice to test with an actual spinning hard drive at some point and Floppy disk support is planned as well.
More information to come as the OS develops
Longer term goals will be looking at a multi-tasking OS with a GUI. It will be interesting to get something line Fuzix or μClinux but it may also be that I write my own OS but that may be some time before that happens.