Discussion:
CP/M
(too old to reply)
muta...@gmail.com
2021-03-26 10:15:28 UTC
Permalink
Today I did some investigation on CP/M and 8080
applications (which seemed to exclusively run under
CP/M).

Sufficient documentation is here:

http://www.cpm.z80.de/randyfiles/DRI/CPM_1_4_Interface_Guide.pdf

The interesting thing to note is that the 8080 instruction
set was a bit different from 8086 so it was necessary
to run a program to translate at the assembly code level.

Given that this was being done anyway, and given that
the assembly code used labels, not hardcoded addresses,
it should have been possible to provide relocation information,
and produce a tiny memory model .exe instead of a .com.

But it is offsets that need to be relocated, not segments.

And they also can't be depending on absolute address
5 containing an OS entry point. Basically the same
thing the Amiga did - having everything hinge on
absolute address 4.

In both cases a register could have been provided
with the address you need to use to get OS services.

Then the program would have been relocatable, so
that you could fit multiple executables into a 64k
segment.

Although I'm still a bit unclear as to whether this
would have allowed a larger segment bit shift.

Also, I'd like to know more details about this
8080 to 8086 assembler translation process.
Specifically were calls to address 5 replaced
with interrupts? Or was address 5 in the PSP
kept as a valid execution point so that CP/M
calls with a function code could continue
unchanged? If so, does that mean MSDOS, or
DRDOS (or a future PDOS/86) could have
maintained CP/M-compatibility?

And indeed, CP/M itself was directly available
for the 8086. So what did its interface look like?
Did they maintain that address 5, even if MSDOS
did not? Or did they themselves switch to INT 21H
with no address 5 (relative to cs:, so still relocatable
to some extent) option in any version of CP/M-86?

BFN. Paul.
Rod Pemberton
2021-03-26 23:01:39 UTC
Permalink
On Fri, 26 Mar 2021 03:15:28 -0700 (PDT)
Post by ***@gmail.com
Today I did some investigation on CP/M and 8080
applications (which seemed to exclusively run under
CP/M).
http://www.cpm.z80.de/randyfiles/DRI/CPM_1_4_Interface_Guide.pdf
The interesting thing to note is that the 8080 instruction
set was a bit different from 8086 so it was necessary
to run a program to translate at the assembly code level.
Given that this was being done anyway, and given that
the assembly code used labels, not hardcoded addresses,
it should have been possible to provide relocation information,
and produce a tiny memory model .exe instead of a .com.
But it is offsets that need to be relocated, not segments.
And they also can't be depending on absolute address
5 containing an OS entry point. Basically the same
thing the Amiga did - having everything hinge on
absolute address 4.
In both cases a register could have been provided
with the address you need to use to get OS services.
Then the program would have been relocatable, so
that you could fit multiple executables into a 64k
segment.
Although I'm still a bit unclear as to whether this
would have allowed a larger segment bit shift.
...
Post by ***@gmail.com
Also, I'd like to know more details about this
8080 to 8086 assembler translation process.
Specifically were calls to address 5 replaced
with interrupts? Or was address 5 in the PSP
kept as a valid execution point so that CP/M
calls with a function code could continue
unchanged? If so, does that mean MSDOS, or
DRDOS (or a future PDOS/86) could have
maintained CP/M-compatibility?
And indeed, CP/M itself was directly available
for the 8086. So what did its interface look like?
Did they maintain that address 5, even if MSDOS
did not? Or did they themselves switch to INT 21H
with no address 5 (relative to cs:, so still relocatable
to some extent) option in any version of CP/M-86?
This part might be worth a post to comp.os.msdos.programmer.

I wasn't using IBM clones until the late 90's. So, all
that I can do is direct you to RBIL. It has information
on the PSP, such as it's format and functionality. The
original RBIL package also has files that aren't in the
online html-ized versions by Dj Delorie (DJGPP) and
Marc Perkel.

http://www.cs.cmu.edu/~ralf/files.html
--
Countries that won't talk to Biden: North Korea, China, Russia, Iran.
muta...@gmail.com
2021-03-28 10:53:22 UTC
Permalink
Post by Rod Pemberton
Post by ***@gmail.com
And indeed, CP/M itself was directly available
for the 8086. So what did its interface look like?
Did they maintain that address 5, even if MSDOS
did not? Or did they themselves switch to INT 21H
with no address 5 (relative to cs:, so still relocatable
to some extent) option in any version of CP/M-86?
This part might be worth a post to comp.os.msdos.programmer.
I wasn't using IBM clones until the late 90's. So, all
that I can do is direct you to RBIL. It has information
on the PSP, such as it's format and functionality.
Thanks for the tip. INTERRUP.F shows:

Format of Program Segment Prefix (PSP):
Offset Size Description (Table 01378)
00h 2 BYTEs INT 20 instruction for CP/M CALL 0 program termination
the CDh 20h here is often used as a signature for a valid PSP
02h WORD segment of first byte beyond memory allocated to program
04h BYTE (DOS) unused filler
(OS/2) count of fake DOS version returns
05h BYTE CP/M CALL 5 service request (FAR CALL to absolute 000C0h)
BUG: (DOS 2+ DEBUG) PSPs created by DEBUG point at 000BEh
06h WORD CP/M compatibility--size of first segment for .COM files
08h 2 BYTEs remainder of FAR JMP at 05h

I'll post in the other group for my next question.

BFN. Paul.

Continue reading on narkive:
Loading...