3 ms·
I'd start by writing a simple Disk Operating System, and forget MS-DOS compatibility (which isn't exactly necessary today). The basic idea (which I think origi
by rwmj 1y ago
I'd start by writing a simple Disk Operating System, and forget MS-DOS compatibility (which isn't exactly necessary today).
The basic idea (which I think originated from FLEX[1]?) is that you have something that accepts typed commands, like "DIR A:", splits on spaces, takes the first part and loads the disk program called "DIR" (or "DIR.COM" etc) into memory and runs it, passing the rest of the parameters on the stack.
From that you can see you'll need a very basic filesystem (to load the command from), and a few system calls (eg. print a character, input a character, open a file, list the directory). The earlier DOSes like CP/M didn't have subdirectories, and only had a handful of system calls, so it was all very simple - by necessity because the hardware was limited.
You can expand on the idea endlessly, eg. writing lots of utilities, your own compiler and assembler, editor, etc.
Presto, you've got your own Disk Operating System!
There's a guy on YouTube you runs all these early proto-DOSes[2] on original hardware so you can get a sense of the extreme limitations of these early home computers.
[1] https://en.wikipedia.org/wiki/FLEX_(operating_system) https://en.wikipedia.org/wiki/FLEX_(operating_system)
[2] https://www.youtube.com/user/deramp5113/videos https://www.youtube.com/user/deramp5113/videos
- ErroneousBosh 1y agoYou've got all the BIOS calls you need to actually shunt sectors on and off disk, read keystrokes, and display characters, right? So with some code simple enough to hand-assemble you could write the bare bones of a Forth "inner interpreter", and from there the Forth compiler, which necessarily has a command line interpreter (or at least, a thing that breaks a text buffer down into words). Then a simple "DOS" would have a command like "dir" which would read the directory sector into a block, format it, and print it, and so on. Using a normal Forth-style "block editor" on a system with files wouldn't have to be complicated, you'd just be working on a 1kB (two sectors) block at a time, starting from the first block referenced by the filename. You'd get to a point where you could read, edit, and compile Forth definitions or even just cope with text files in MS-DOS formatted disks pretty quickly.