EasyManua.ls Logo

Atari ST series - Page 87

Atari ST series
420 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
XBIOS Graphics and Sound Functions
301,
/* G#
s
415.3 HZ
*/
284,
268,
/* A
=
440.0 HZ
V
/* A#
s
466.2
HZ
*/
253,
/ * B
=
493.9 Hz
*/
239
};
main()
/* c
523.2 Hz
*/
t
int clickonQ, clickoff(); /* address of "super" functions */
unsigned period, x;
char regvalue, ch=0;
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); /* turn on channel A tone * /
while(ch!=16) /* until "q" key is pressed */
ch = (char)(Bconin(CON)»16); /* wait til key press */
if (ch <14) /* & get scan code */
( /* if on top row of keyboard */
period = notes[ch-l]; /* find period */
Giaccess(period & 255, 0x80); / * set period low byte*/
Giaccess(period » 8, 0x81); /* set period high byte*/
Giaccess(15, 0x88); /* set channel A volume */
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;
conterm |= 0x01 ; /* turn click bit on */
)
/************* 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
79

Related product manuals