Atari ST series Technical Reference Manual page 91

Hide thumbs Also See for ST series:
Table of Contents

Advertisement

XBIOS Graphics and Sound Functions
0X0800,0XFF05,0X080F,OxFFll,0x0800,0X001C,0x0101,0XFF03,
0X080F,OxFFll,0X0800,0XFF05,0X080F,OxFFll,0x0800,0X003F,
0x0101,0XFF03,0X080F,0XFF22,0x0800,OxFFOO
);
int scale;
/* scaling factor for delay loop.*/
/* Timer interrupt is always l/50th of a second. */
/* Vsync() is l/60th of a second on color monitor,*/
/* l/70th of a second on monochrome */
m a i n Q
(
int x;
scale = Getrez();
2
if (scale <
) scale=
else scale = 7 ;
Dosound(commands);
puts("Twinkle,\n");
wait(48);
p u t s ("Twinkle,\n");
wait(48);
puts("Little\n") ;
w a i t (48);
puts("Star.\n");
2 0 0
w a i t (
) ;
)
wait(y)
/* Delay a set number of timer ticks */
int y;
(
int x;
y = y*scale/5; /* convert timer ticks to vblanks */
0
f o r (x=
;x < y ;x++ )V s y nc ;
)
/****************** End of XDOSOUND.C ********/
To synchronize the music with the words, the Vsync()
function was utilized to wait a number of vertical blanking
intervals. But vblanks don't coincide exactly with timer ticks.
There are 70 vertical blank interrupts per second on the mon­
ochrome monitor, 60 per second on the color monitor, and
only 50 timer interrupts per second with either kind of dis­
play. Therefore, the timer ticks had to be scaled to match the
corresponding number of vblanks by multiplying them by 7/5
for the monochrome display and 6/5 for the color display.
/* get monitor type, and set */
6
;
/* scaling factor accordingly */
/* play the song in the background */
/* print the words while it plays */
/* delay 48 timer ticks */
83

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents