<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Wed, 08 May 1991 18:44:59 GMT
From   : dog.ee.lbl.gov!hellgate.utah.edu!caen!ox.com!math.fu-berlin.de!ira.uka.de!unido!mcshh!tilmann@ucbvax.Berkeley.EDU (Tilmann Reh)
Subject: Re: BIOS Problems with Zilog Registers

roadhog@austex (Lindsay Haisley) writes:

> CP/M was written for the Intel 8080, and all DRI versions (including, I
> believe CPM3) are 8080 compatible, meaning that they >>don't<< use the  
> special Z80 registers.  The CP/M BDOS, therefore, will preserve the Z80
> registers since it knows nothing about them and makes no use of them.

Of course, CP/M was written for 8080 and thus uses only those registers.
But if YOU as the applications programmer rely on the existance of the Z80
registers, they must be there - implying that the BIOS might use them, too.

> It was generally accepted industry practice on Z80 based machines to extend
> this principle to individual machine BIOS code as well, and with only a 
> few exceptions, all Z80 based computers which use the special Z80 registers
> save and restore them.  Since this rather sound principle was never, to my
> knowledge, incorporated into any sort of industry-wide agreement, these
> few exceptions did slip through to cause trouble.  

As far as I can consider, this is simply not true. All CP/M machines I ever
came in contact with, including my own systems (meanwhile 3 different CP/M-3
implementations), dit not preserve the Z80 registers. I never had troubles,
except finding a bug in Turbo-Pascal where an index register was forgotten to
be saved during Console-Input call (but saved for Con-Out!). BTW, the program
that started this discussion (UCRLZH) runs VERY WELL on my actual machine
which does not preserve any register...

> Since there are a substantial number of programs outstanding which operate
> on the assumption that the Z80 special registers are preserved across system 
> calls, Jay Sage's suggestion makes more sense than trying to fix >>every<<
> program which makes this assumption.

Again, I didn't make that experience. The by far more logical assumption
that in fact every register could be changed after return from BDOS, is
found in every program I ever looked at (or use, of course). More logical,
I say, because it expands the CP/M specification exactly in the same
meaning it was originally defined: 'You may rely on _NO_ register'.
Assuming some registers to be saved and some others not, is not very
consequent, is it? And never forget: If you are able to use the Z80
registers, the BIOS is able, too! (Eventually even the BDOS, if you got
a real Z80 version, which I miss hardly for CP/M-3.)

To come to an end:
Of course, it would be much easier if DRI had specified that every used
register must be saved by the BDOS and BIOS. That would have led to some
additional pushes and pops in both of them, but would have made sure that
applications programs never had to do that. Also, expansion of this spec
would be much easier (with BDOS/BIOS simply saving every used register as
before).
But, as a matter of fact, DRI did not specify that. And like it or not,
their specification is reality. DRI told every programmer NOT to rely on
ANY register, and this should also be expanded in the same meaning (thus
including Z80 registers, in this case).

Tilmann Reh            tilmann.reh@hrz.uni-siegen.dbp.de
                       tilmann@mcshh.hanse.de

<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>