Article View: net.micro.atari16
Article #2578Re: Supervisor mode
From: Richard Sansom
Date: Mon, 27 Oct 1986 21:40
Date: Mon, 27 Oct 1986 21:40
50 lines
2383 bytes
2383 bytes
In article <660@chinet.UUCP> cabbie@chinet.UUCP (Richard Andrews) writes:
>
> I want to do some hardware tweaking and mave been attempting
>to enter supervisor mode but am still getting bus errors? Does
>anyone have some general purpose source code to do this?
>
Gemdos function 0x20 is the one you want:
Call: Super(stack); - or - gemdos(0x20, stack);
where "stack" is a pointer to your supervisor stack or NULL (0L) if you
want to use the user stack as supervisor stack. The function returns a
pointer to the old supervisor stack. You MUST restore the stack to this
value when you exit supervisor mode or else the machine will crash.
C code example:
long old_ssp; /* old supervisor stack pointer */
old_ssp = Super(0L); /* enter supervisor mode, use the user stack*/
/* your super code goes here */
Super(old_ssp); /* exit supervisor mode, restore stack */
Assembly example:
clr.l -(sp) ; pass a long zero (use user stack)
move.w #$20,-(sp) ; pass gemdos function 0x20
trap #1 ; enter supervisor mode
add.l #6,sp ; clean up the stack
move.l d0,old_ssp ; save old stack pointer
; your super code goes here
move.l old_ssp,-(sp) ; pass the old stack pointer
move.w #$20,-(sp) ; pass gemdos function 0x20
trap #1 ; exit supervisor mode
add.l #6,sp ; clean up the stack
-Rich
--
__________ ______ ____ _____ ___
/_________//___ ||__|/____|/__/ Richard E. Sansom
___ ____/ / ____________ TRW Electronics & Defense Sector
/ / / /\ < | /| / One Space Park Drive, R3/1028
/ / / / \ \ | / | / Redondo Beach, CA 90278
/__/ /__/ \__\|__/ |__/ {...decvax,ucbvax,ihnp4}!trwrb!sansom
Technical Details
Message-ID:
<1385@trwrb.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-crg!nike!sri-spam!sri-unix!hplabs!sdcrdcf!trwrb!sansomReferences:
<660@chinet.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!lll-crg!nike!sri-spam!sri-unix!hplabs!sdcrdcf!trwrb!sansom From: sansom@trwrb.UUCP (Richard Sansom) Newsgroups: net.micro.atari16 Subject: Re: Supervisor mode Message-ID: <1385@trwrb.UUCP> Date: Mon, 27-Oct-86 16:40:56 EST Article-I.D.: trwrb.1385 Posted: Mon Oct 27 16:40:56 1986 Date-Received: Tue, 28-Oct-86 06:30:38 EST References: <660@chinet.UUCP> Reply-To: sansom@trwrb.UUCP (Richard Sansom) Distribution: net Organization: TRW EDS, Redondo Beach, CA Lines: 50 Keywords: Hardware tweaking