🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Program to turn KeyClick On/Off

#25926
From: david
Date: Fri, 27 Mar 1987 16:01
80 lines
2352 bytes
*** REPLACE THIS LINE WITH YOUR MESSAGE ***

Someone was asking how to turn key click on/off within a program.
(I believe it was Warren Long, who didn't want key click sounds to
 interrupt the other sounds generated by SpaceWars).

Well here is a simple program to do it.  It is pretty much self-
explanatory.

--------------------cut here----------------cut here--------------------
#include <stdio.h>
#include <osbind.h>

/* CLICK Modes */
#define C_TOGGLE	0
#define C_SET		1
#define C_RESET		2

/* System Variable 'Conterm' is a byte */
#define CONTERM		(*((char *)0x484))

/* Declare the meaning of the bits */
#define CLICK_BIT	1	/* Key click on/off */
#define REPEAT_BIT	2	/* Key repeat on/off */
#define BELL_BIT	4	/* Bell at <ctrl-G> on/off */
#define KBSHIFT_BIT	8	/* Return KBShift from Cconin in
				 * bits 24-31 on/off
				 */

main( argc, argv )
int argc;
char *argv[];
{
	int old_val, new_val;
	int mode;
	long save_ssp;

	/* Get the option.  If no option, toggle click setting */
	if( argc < 2 )
		mode = C_TOGGLE;
	else if ( strcmp( argv[1], "on" ) == 0 )
		mode = C_SET;
	else if ( strcmp( argv[1], "off" ) == 0 )
		mode = C_RESET;
	else {
		printf( "Unknown option '%s'\n", argv[1] );
		exit(1);
	}

	/* Enter Supervisor mode */
	save_ssp = Super( 0L );

	/* Get old value of CONTERM byte */
	old_val = CONTERM;

	switch( mode ) {
		case C_TOGGLE:
			new_val = old_val ^ CLICK_BIT;
			break;
		case C_SET:
			new_val = old_val | CLICK_BIT;
			break;
		case C_RESET:
			new_val = old_val & ~CLICK_BIT;
			break;
	}

	/* Set the new value */
	CONTERM = new_val;

	/* Exit out of supervisor mode */
	Super( save_ssp );
}

-------------cut here--------------------cut here-------------------------

David Rowley
Looking Glass Software
Waterloo, Ontario
...utzoo!watmath!looking!david
Technical Details
Message-ID: <766@looking.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!looking!david

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!looking!david
From: david@looking.UUCP
Newsgroups: comp.sys.atari.st
Subject: Program to turn KeyClick On/Off
Message-ID: <766@looking.UUCP>
Date: Fri, 27-Mar-87 11:01:02 EST
Article-I.D.: looking.766
Posted: Fri Mar 27 11:01:02 1987
Date-Received: Sat, 28-Mar-87 11:32:54 EST
Distribution: net
Organization: Looking Glass Software Ltd. Waterloo, Ontario
Lines: 80