A reasonable amount of the low level stuff... initializing MEMC and VIDC took a while to get right, as did keyboard IO. Once I had it starting up and clearing the screen, plotting text was just a matter of decoding the bytes from the RISC OS system font and writing them to the appropriate place in screen memory. Took me a while because I haven't written that much ARM assembly. Luckily the gnu-arm-embedded / arm-eabi-none-gcc toolchain seems to generate ARMv2 code just fine, so I could write most of it in C/C++ -- things sped up a lot at that point. There's no heap, so malloc() etc won't work, but that hasn't been an impediment so far. Here's most of the code:
- Low level startup (assembly) - mem size detection, MEMC and VIDC init, banner printer. The intention here is to also provide a basic POST, so nothing in this file should depend on working RAM; it only uses registers for storage.
- Main menu code
- IOC registers
- Text display code and font from RISC OS source
- Keyboard IO routines
Plus some open source bits:
- nanopb, which lets me use the protobuf format for OS/CMOS/menu metadata.
- Some C library routines (divmod, memcpy, memset) from arm-trusted-firmware.
- stb_sprintf for string formatting
I just realized that most of this probably won't work on a Risc PC... not looking forward to getting it all working there! I wonder if I can steal more of the RISC OS startup code and do a less "bare metal" version there, given that the open source version will build and run on IOMD machines.