2 ms·
FWIW having seen the sources for both, GEMDOS isn't based directly off CP/M68k sources. There are commonalities, in particular in the names of functions, trap l
by cmrdporcupine 4y ago
FWIW having seen the sources for both, GEMDOS isn't based directly off CP/M68k sources. There are commonalities, in particular in the names of functions, trap locations, etc. and some bits of stuff that is common (executable format for one) but they're entirely separate codebases. Most of CP/M68k is written directly in assembler. While GEMDOS is largely C.
GEM on the PC was written to run on MS/DOS. So I think to make a portable GEM for other platforms they made something with an API and filesystem closer to DOS but written by people who were clearly familiar with CP/M, and had access to CP/M68k sources.
The first platform to run GEMDOS on 68k was the Apple Lisa. That was the dev machine DR used.
That's been resurrected in the past few years: https://github.com/cheesestraws/lisa-gemdos https://github.com/cheesestraws/lisa-gemdos
And in fact EmuTOS itself now boots on the Lisa again.
What's interesting is I know Mac OS Classic used the same "push the args to the stack and call TRAP" syscall process as well. I suspect because of this that the Lisa did as well, though I couldn't tell you for sure since hardly any docs are out there for that. Digital Research was not unique in choosing these scheme. Maybe DR copied Apple, even tho the timeline seems wrong there.
FWIW you got me interested, so I'm reading the CP/M68k sources right now and from the bits I've read, I do see the stack based calling convention there, as well:
_bios2:
* For all BIOS functions with a word parameter
* Word parameter follows function number
move.w 6(sp),d1 * get 1st parameter (word)
_bios6:
_bios1:
* For all BIOS functions that have no parameter other than function number
move.w 4(sp),d0 * get function number
movem.l d3-d7/a3-a6,-(sp)
* * save C register variables
trap #3 * do BIOS call
* * returns value in d0
movem.l (sp)+,d3-d7/a3-a6
rts
So yeah. Long history of that.