I spent some time this weekend on Simh in CP/M, trying out the BDS and Aztec C compilers. They both seem pretty good, but I think the Aztec compiler has more language features, including a more complete library and a full floating point library, which BDS lacks.
BDS compiles to a relocatable object file, and then links directly to a .COM file.
Aztec compiles to an ASM file, then assembles to a .O file, then links to a .COM file. A bit more work, but I use a submit file to do most of it for me anyway.
All in all, I think I like the Aztec compiler a bit better.
I also spent some time writing some simple UNIX-like tools:
- cat - prints a file to standard output
- more - pages a file to standard output
- cls - clears the screen and homes the cursor
- wc - counts lines, words, and characters in a text file
A couple of these (more and cls) were written using some vt100/ansi escape sequences, so would need some changes to work with another terminal. Not sure how I'd do a cls for a really dumb terminal.
Tonight I went and found an old getopt source distribution and compiled it with Aztec. It seemed to compile just fine to an object file, but I haven't tried to use it in a program yet. Maybe tomorrow night. It will be nice to be able to parse command line switches in some of these tools.
CP/M is turning out to be a lot of fun on the emulator. I have two emulated hard drives, and four 1MB floppies, so there's enough room there to do just about anything I want.