🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #27407

Re: Control-F1, Alt-F1 ??? - (nf)

#27407
From: Allan Pratt
Date: Mon, 29 Jun 1987 17:52
48 lines
2421 bytes
in article <1503@ubc-cs.UUCP>, manis@ubc-cs.UUCP (Vincent Manis) says:
> 
> In article <766@atari.UUCP> apratt@atari.UUCP (Allan Pratt) writes:
> 
>>> does anyone know, if there is a way to distinguish between
>>> Functionkey F1, ALT-F1 and CTRL-F1 using C (MWC).
>>...You tell the OS to put the shift key state
>>in that byte by setting bit 3 in the (published) system variable "conterm"
>>to 1 (that is, *(char *)0x484 |= 4;).  Better clear it again before
>>your program exits, though, because the desktop might not be able to
>>handle it (use *(char *)0x484 &= ~4;).
> 
> One slight point: "conterm" is in protected memory. You will get cherry
> bombs if you do what Allan says without turning off protect. In MWC, the
> way to do it is to use the peek and poke [sic!] functions.
> 

Alas... I tried to edit this message before it went out..  The correct
value for the |= and &= is 8 (and ~8), not 4 (and ~4).  What Vincent
refers to as "turning off protect" is really entering Supervisor mode
on the 68K.  The following funtions do what you want:

#include <osbind.h>		/* get OS binding for Super() */

setbit()	/* sets bit 3 of conterm, so shift state is in upper byte */
{
	long oldssp = Super(0L);
	*(char *)0x484 |= 8;
	Super(oldssp);
}

clrbit()	/* clears bit 3 of conterm, so desktop doesn't gag */
{
	long oldssp = Super(0L);
	*(char *)0x484 &= ~8;
	Super(oldssp);
}

You have to link with osbind.o for this to work.

Between the Super(0L) call and the Super(oldssp) call, you are in
Supervisor mode.  YOU CAN'T DO OS CALLS HERE.  If you need to do
OS calls, use Supexec() instead.

/----------------------------------------------\
| Opinions expressed above do not necessarily  |  -- Allan Pratt, Atari Corp.
| reflect those of Atari Corp. or anyone else. |     ...lll-lcc!atari!apratt
\----------------------------------------------/	(APRATT on GEnie)
Technical Details
Message-ID: <776@atari.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!husc6!mit-eddie!ll-xn!ames!amdcad!sun!imagen!atari!apratt
References: <1503@ubc-cs.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!husc6!mit-eddie!ll-xn!ames!amdcad!sun!imagen!atari!apratt
From: apratt@atari.UUCP (Allan Pratt)
Newsgroups: comp.sys.atari.st
Subject: Re: Control-F1, Alt-F1 ??? - (nf)
Message-ID: <776@atari.UUCP>
Date: Mon, 29-Jun-87 13:52:19 EDT
Article-I.D.: atari.776
Posted: Mon Jun 29 13:52:19 1987
Date-Received: Wed, 1-Jul-87 01:02:05 EDT
References: <1503@ubc-cs.UUCP>
Organization: Atari Corp., Sunnyvale CA
Lines: 48