4 ms·
(Hi, this CPU is my project). I got into this stuff by buying an RC2014[0] kit and putting it together, and learning a bit about how CP/M works on it. If you'
by jstanley 5y ago
(Hi, this CPU is my project).
I got into this stuff by buying an RC2014[0] kit and putting it together, and learning a bit about how CP/M works on it.
If you're interested in that sort of thing, you could do much worse than buying an RC2014 and just writing low-level programs for it for fun.
CP/M is really incredibly simple. You have some "kernel" type stuff towards the top of memory, with routines for reading/writing files on disk, and interacting with the console and a paper tape "reader + punch". When you type a command, the named program is loaded from disk into memory starting at 0x100 and then execution starts at 0x100. To interact with hardware, the program calls the kernel's routines (analogous to system calls). And that's basically all there is to it.
The OS for my CPU is very similar in operation to CP/M, but more pleasant to use for someone coming from a Unix background.
[0] https://rc2014.co.uk/ https://rc2014.co.uk/
- martijnvds 5y agoWait a minute, is that why DOS .com files are loaded at 0x100? CP/M compatibility?
- jstanley 5y agoNot sure! I doubt they would actually be compatible anyway since the CPU is too different. It seems likely that prior experience with CP/M COM files being loaded at 0x100 influenced the design though.
- monocasa 5y agoYeah, QDOS was a CP/M clone for 8086. It wasn't source compatible, but was 'major ideas and structure compatible'.
- wvenable 5y agoYes. The Program Segment Prefix is designed for CP/M compatibility: https://faydoc.tripod.com/structures/13/1378.htm https://faydoc.tripod.com/structures/13/1378.htm
- naikrovek 5y agoyep, lots of other things, too. MS-DOS was CP/M-compatible. Windows 95 was DOS-compatible. and so on. and even though the base OS changed starting with Windows 2000, lots of compatibility things were kept because they were supported in previous versions of Windows or MS-DOS. All the way down to files with special names such as "AUX" or "CON", and the backslash as directory path separator are all from CP/M, though the path thing happened to maintain CP/M compatibility, and not because CP/M had filesystem directories, because early on (maybe always?) it didn't have directories.
- monocasa 5y agoIn fact, DOS 1.x didn't have directories either. Those were added in DOS 2.0
- naikrovek 5y agoyep, because DOS 1 was a virtual clone of CP/M and kept the same feature set.
- wvenable 5y agoThe backslash as path separator didn't come from CP/M (it also didn't have directories at the time). The forward slash couldn't be used because it was already heavily used for command-line switches in DOS 1.0 applications. That choice was likely copied from DEC TOPS-10 which many Microsoft employees would have been using. Microsoft apparently wanted to break compatibility and use the forward slash, and even coded for the possibility by making the switch character configurable in the CONFIG.SYS of DOS 2.0, but IBM was against it.
- naikrovek 5y agoDOS 1.0 used forward slashes for arguments because CP/M did the same. DOS 1.0 was almost an exact copy of CP/M, changing only a few small things, which is why it didn't support directories, either. DOS 2 needed to be compatible with DOS 1, and DOS 1 needed to be able to run CP/M programs in order to capture the business it was gaining at that point, so DOS 2 kept what DOS 1 had, and so on. all the way up to Windows 11 today. The backslash didn't come from CP/M, as I said. it came because they needed a directory separator for DOS 2, and being visually similar to the UNIX directory separator character (a simple diagonal line), the backslash was chosen. so, as I said earlier (very poorly, looking back), the backslash was chosen because of CP/M, but was not copied from it.