cj7hawk
Experienced Member
Thought I'd share with the group and thank the group for it's support and help with my project - The Open Spectrum Project.
I've been working on building the Sinclair Loki as a long-term project. It was touted in 1985 as a machine that would have similar hardware-accelerated graphics to the Amiga, Better sound than the Atari, and cost only GBP200 - around USD400... Which at the time would have been amazing.... In fact it was widely thought to be impossible by everyone to complete at that price. So Last year I did a university assignment looking into whether it was possible and discovered that it was actually plausible, and I've been slowly working to making one using only the technology of the era that was available and common in 1985. Long Story Short, since I haven't had time to revisit the hardware, I've been working on the OS ( Loki OS )which was supposed to be based on CP/M and customised for the Spectrum.
A key element, and the reason I've been learning CP/M is that it would have run CP/M as a base OS, but would have needed to be Case Insensitive as the original Spectrum it was to replace needs to support both lower and uppercase filenames, so I built an emulator, and an assembler ( because at the time I couldn't find a suitable alternative for Windows 10 ) and then began writing CP/M from scratch, much the same way as MS-DOS was created - difference being I needed mine to be compatible with CP/M and to be able to run CP/M programs, which was a Loki specification.
And then I discovered just how difficult a task that is to complete.
Today, I finished the initial build of my CCP, My BDOS is mostly functional ( still a few bugs and missing functions, but supports random read and write and sequential read and write and follows CP/M format for disks and storage ) and my BIOS is skeletal, but sufficient for testing. I finally reached the point where I can load up a CP/M file and execute it and it runs OK, so things like BASIC work well on it even before I work on control codes. I've run a couple of flavors of microsoft basic, nevada basic and a few others, and they all seem to work OK now.
It's not as cleanly written as CP/M was - writing an OS from scratch is something I'm not an expert at, but it works, and the BIOS, Stack and BDOS are about 4K combined, and the CCP is another 4K, though the current CCP also includes a monitor and debugger and has extra functions for disk handling like Copy ( DOS style - which works really well with CP/M ) and all of the other functions expected ( DIR, ERA, SAVE, RENAME etc ) work OK. Since the CCP will be stored in a ROM, reloading post execution of a COM won't be a problem or a delay.
I've learned a lot writing an OS. I tried to better understand the original by reading the source, but that didn't help, so my code structure is very very different, though even in writing it differently, I've learned a lot about why CP/M was the way it was. I push the stack a lot less than CP/M does and make extensive use of in-code variables and both index pointers (eg, with FCBs), though I've tried to avoid using the shadow registers.
I'm also thinking of including a small assembler and debugger ( both very rudimentary ) in the monitor, and was curious as to what other small routines anyone might think would be worthwhile including in a CCP? Such as Format, Assembler, Disassembler etc and other common functions, assuming that there's about 12K of reasonable space for an over-stuffed CCP, allowing still that replacement routines can be run from disk in any event, as could a complete native CP/M if the user wanted, so I'm not too worried about cloning CP/M as much as just being compatible.
( 12K is kind of the practical limit, given the CCP also uses 16K for copying extents and that allows CCP functions without obliterating existing user code within the lower 32K of space - and it doesn't do anything like paging at the moment, just one big contiguous memory space ).
And likewise, what functions would you definitely avoid putting into a CCP? The sort that should only even run off of a disk? ( Assuming there are functions like that ).
I'm putting my code down for a couple of weeks to finish other projects, but wanted to ask the combined wisdom here for suggestions, thoughts and anything else that might come up in the discussion.
Also a big thanks to Mike, who helped me get my Amstrad working and talked me through my early figuring out CP/M disk formats, and Doug, whose emulator made it possible for me to figure out why mine wasn't working right, but thanks also to everyone who has helped so far. It's been amazingly fun, though at times frustrating, writing an OS from scrt
David
I've been working on building the Sinclair Loki as a long-term project. It was touted in 1985 as a machine that would have similar hardware-accelerated graphics to the Amiga, Better sound than the Atari, and cost only GBP200 - around USD400... Which at the time would have been amazing.... In fact it was widely thought to be impossible by everyone to complete at that price. So Last year I did a university assignment looking into whether it was possible and discovered that it was actually plausible, and I've been slowly working to making one using only the technology of the era that was available and common in 1985. Long Story Short, since I haven't had time to revisit the hardware, I've been working on the OS ( Loki OS )which was supposed to be based on CP/M and customised for the Spectrum.
A key element, and the reason I've been learning CP/M is that it would have run CP/M as a base OS, but would have needed to be Case Insensitive as the original Spectrum it was to replace needs to support both lower and uppercase filenames, so I built an emulator, and an assembler ( because at the time I couldn't find a suitable alternative for Windows 10 ) and then began writing CP/M from scratch, much the same way as MS-DOS was created - difference being I needed mine to be compatible with CP/M and to be able to run CP/M programs, which was a Loki specification.
And then I discovered just how difficult a task that is to complete.
Today, I finished the initial build of my CCP, My BDOS is mostly functional ( still a few bugs and missing functions, but supports random read and write and sequential read and write and follows CP/M format for disks and storage ) and my BIOS is skeletal, but sufficient for testing. I finally reached the point where I can load up a CP/M file and execute it and it runs OK, so things like BASIC work well on it even before I work on control codes. I've run a couple of flavors of microsoft basic, nevada basic and a few others, and they all seem to work OK now.
It's not as cleanly written as CP/M was - writing an OS from scratch is something I'm not an expert at, but it works, and the BIOS, Stack and BDOS are about 4K combined, and the CCP is another 4K, though the current CCP also includes a monitor and debugger and has extra functions for disk handling like Copy ( DOS style - which works really well with CP/M ) and all of the other functions expected ( DIR, ERA, SAVE, RENAME etc ) work OK. Since the CCP will be stored in a ROM, reloading post execution of a COM won't be a problem or a delay.
I've learned a lot writing an OS. I tried to better understand the original by reading the source, but that didn't help, so my code structure is very very different, though even in writing it differently, I've learned a lot about why CP/M was the way it was. I push the stack a lot less than CP/M does and make extensive use of in-code variables and both index pointers (eg, with FCBs), though I've tried to avoid using the shadow registers.
I'm also thinking of including a small assembler and debugger ( both very rudimentary ) in the monitor, and was curious as to what other small routines anyone might think would be worthwhile including in a CCP? Such as Format, Assembler, Disassembler etc and other common functions, assuming that there's about 12K of reasonable space for an over-stuffed CCP, allowing still that replacement routines can be run from disk in any event, as could a complete native CP/M if the user wanted, so I'm not too worried about cloning CP/M as much as just being compatible.
( 12K is kind of the practical limit, given the CCP also uses 16K for copying extents and that allows CCP functions without obliterating existing user code within the lower 32K of space - and it doesn't do anything like paging at the moment, just one big contiguous memory space ).
And likewise, what functions would you definitely avoid putting into a CCP? The sort that should only even run off of a disk? ( Assuming there are functions like that ).
I'm putting my code down for a couple of weeks to finish other projects, but wanted to ask the combined wisdom here for suggestions, thoughts and anything else that might come up in the discussion.
Also a big thanks to Mike, who helped me get my Amstrad working and talked me through my early figuring out CP/M disk formats, and Doug, whose emulator made it possible for me to figure out why mine wasn't working right, but thanks also to everyone who has helped so far. It's been amazingly fun, though at times frustrating, writing an OS from scrt
David