[comp.sys.atari.st] Register saving for BIOS traps?

braner@batcomputer.tn.cornell.edu (Moshe Braner) (09/24/88)

[]

It is all written in the Abacus "ST Internals" (and other places).
I don't have it in front of me now, but more or less:  (X)BIOS
trap routines return their result in D0, and may also mess up
D1, A0 and A1.  In some rare case I sort of remember D2 or A2 being
affected.  Thus, if you save D1, D2, A0, A1 and A2 before a BIOS
trap, and restore them later, you're quite safe.  If you write
an interrupt handler you do the opposite: save D2-D7/A1-A6 at the
start and restore before returning.

- Moshe Braner

1*T800 == 3*68881

poole@forty2.UUCP (Simon Poole) (09/26/88)

In article <19880922163903.5.JRD@MOA.SCRC.Symbolics.COM> jrd@STONY-BROOK.SCRC.SYMBOLICS.COM (John R. Dunning) writes:
.....
>I believe it's necessary to save (some) registers around BIOS and XBIOS
>traps.  The question for today is: which ones?  Is there any rhyme or
>reason to which registers get trashed inside the trap?

D0-D2 and A0-A2,  reason: they aren't  saved by the  trap handler, but
are used by the calls, why Atari decided not to save all regs they use
is a mystery to me (the calls are so slow just because they save nearly
everthing, it seems a shame they didn't do it all).

>A related question; am I correct in assuming that GEMDOS traps don't
>require register saving?

I wouldn't count on that, suposedly D0 and A0 get zapped (I don't have
the official Atari doc's lying around here, but I'll check on Monday).


-- 
----------------------------------------------------------------------------
UUCP:   ...mcvax!cernvax!forty2!poole			Simon Poole
BITNET: K538915@CZHRZU1A
----------------------------------------------------------------------------

t68@nikhefh.hep.nl (Jos Vermaseren) (09/26/88)

The BIOS and XBIOS use internally the registers d0-d2 and a0-a2
Gemdos uses d0 and a0 except for the call Super (gemdos $20) which
uses also d1 and a1. The last one is in hardly any book.

The reason of the BIOS and XBIOS register use lies (I believe) in the fact
that the DRI compiler considers d0-d2/a0-a2 as local registers.
It causes some problems with Turbo-C, because it has to save a2 specifically.
(Turbo-C can have 5 a register variables!)
The reason for d1 and a1 beying demolished in a Super call is found in
sloppy writing of the Gemdos traphandler.

Jos Vermaseren

jrd@STONY-BROOK.SCRC.SYMBOLICS.COM (John R. Dunning) (09/27/88)

I think I remember a discussion about this a while ago, but don't
remember the outcome.

I believe it's necessary to save (some) registers around BIOS and XBIOS
traps.  The question for today is: which ones?  Is there any rhyme or
reason to which registers get trashed inside the trap?

A related question; am I correct in assuming that GEMDOS traps don't
require register saving?

Thanks in advance for any info.