Atari ST series Technical Reference Manual page 87

Hide thumbs Also See for ST series:
Table of Contents

Advertisement

XBIOS Graphics and Sound Functions
s
301,
415.3 HZ */
/* G#
= 440.0 HZ V
284,
/* A
s
466.2 HZ */
268,
/* A#
= 493.9 Hz */
/ *
253,
B
239
523.2 Hz */
/* c
};
main()
t
int c l i c k o n Q , clickoff(); /* address of "super" functions */
unsigned period, x;
char regvalue, ch=
puts("Press keys on top row of keyboard to hear notes");
puts("Press 'q' to quit");
Supexec(clickoff); /* turn the keyboard click off
regvalue = Giaccess(ch,0x07); /* read current tone register
Giaccess(regvalue | 0x3E, 0x87);
while(ch!=16)
ch = ( c h ar)(Bconin(CON)»16); /* wait til key press */
if (ch < 1 4 )
(
period = notes[ch-l];
Giaccess(period & 255, 0x80);
Giaccess(period »
Giaccess(15, 0x88);
for (x=0;x<20;x++)Vsync(); /* let it play a while */
Giaccess(0, 0x88); /* turn note off */
)
Supexec(clickon); /* turn key click back on and quit */
)
clickoff()
{
char *conterm;
conterm = (char *)0x484L;
♦conterm &= OxFE; /* turn click bit off */
)
clickon()
(
char *conterm;
conterm = (char *)0x484L;
0
♦conterm |=
)
/************* End of XGIACCES.C *************/
This program uses both the console keyboard and sound
channel A. TOS, however, also uses sound channel A to
produce a click sound when a console key is struck. To avoid
conflict between your program and the TOS routines, shut
off the key click sound at the beginning of the program and
turn it back on at the end. Do this by altering the system
variable conterm, which is stored at location 1156 ($484). Since
0
;
/* until "q" key is pressed */
8
, 0x81);
0 1
x
; /* turn click bit on */
/* turn on channel A tone
/* & get scan code */
/* if on top row of keyboard */
/* find period */
/ *
set period low byte*/
/* set period high byte*/
/* set channel A volume */
* /
* /
* /
79

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents