Date : Sat, 26 Oct 1991 19:38:49 GMT
From : mips!quack!mrapple@decwrl.dec.com (Nick Sayer)
Subject: Re: Sayer's UP/M program
wilker@HOPF.MATH.PURDUE.EDU (Clarence Wilkerson) writes:
>I'm trying to get this running. It compiles fine, but I must not have the
>files from CP/M set up properly. Examination of the code in upm.c didn't
>show any initialization of the fake Z80 memory, setting of jump tables or
>similar activity. Does anyone have this running enough to give me a few
>hints?
Woah. Brings back memories. That thing was such a performance pig I just
chucked it. Took 2 minutes to do a 'DIR' on an empty disk on a Sun 3/160.
The emulator itself is just that - an emulator. If I remember right,
upm loaded in a .HEX file, relocated it to the top of memory (after
figuring out how much to leave for BIOS and buffers), and jumped to
$8000.
The relocator assumed the code was loaded in at 0, with all the jumps
set to run at location 0. The relocation bitmap started at $4000, and
a length byte was at $FFFF, which was the number of pages in the
relocated chunk. The bitmap was one bit per byte of relocated code.
If the bit was 1, then an offset was applied to the byte as it was
copied into place, otherwise the byte was copied verbatim.
The BIOS jump table was 76 C9 00 76 C9 00.... That is, a
bunch of HALTs, then RETs. The idea was that a HALT caused the emulator
to return to the C program that called it, which then examined
(PC%64)/3 to see which BIOS call it was. It then performed the desired
BIOS function (in C), incremented PC, and jumped back into the emulator.
The rest of CP/M (BDOS, CCP) was Z-80. That way, someone
could have made ZCPR for it if they wanted. I couldn't distribute
BDOS/CCP since they're still subject to Digital Research's copyright.
Which is a shame, since DR no longer distributes CP/M. IMHO if
they're not going to sell it, they ought to give it to someone
who will, or make it PD. But that's another story.
--
Nick Sayer | "Don't try this at home, kids. This should
mrapple@quack.sac.ca.us | only be done by trained, professional idiots."
N6QQQ @ K3MC |
+1 408 249 9630 (modem) | -- Plucky Duck