Tandy Gryphon Audio drivers 19.10.92 (c) 1992 Tony Williams / Sound Images LEMMINGS -------- David , I have tried to make the drivers for the Gryphon version identical to the ordinary PC ones , but there are some major differences - CD audio for instance . This means that I have allowed for any audio CD to be inserted , and tracks played from it . The problem with this is that the CD-rom device driver ( I wish I could do it at low level , but I can't ) takes a pretty hefty amount of processor time to read the Table of Contents from the disk . This is where the start of each track is stored , and I read them into a table and calculate the lengths . It is obvuiously nice for the punter to be able to put his favourite CD in to accompany the game , but there are some drawbacks - The Lemmings tunes all loop after about one or two minutes , so when the track ends , I have to start it again . This will also happen on any other audio CD . Also , there are two versions of the Lemmings title tune on the disc , and I only use one of them , making it necessary to use a lookup table ( especially as the title tune wasn't used on the Adlib+Tandy versions .) I decided to add a function whereby you could pass the driver a lookup table if necessary , so Motorhead or The Carpenters could be played if the punter desired . The will mean a small menu program , asking the player which track should accompany each level , and whether it should loop . before calling the functions ( blindingly obvious ) , load the driver - gryphsnd.dat at offset 0 within a segment . The entry point is at 0 and Russell preferred to use a software interrupt , so all routines end with an IRET instruction . The sample file - lemsamp.bin also needs to be loaded at offset zero within a segment , and that segment address is passed to the driver . There now follows a list of the driver functions . You will notice ( I hope ) that the first six functions correspond to those in the Adlib/Tandy drivers and the rest are added just for the CD audio . WARNINGS :- Do not try and start a sound effect before 1) initialising the driver or 2) loading the sample file , which is a separate file . The sample file needs to be loaded at offset 0 within any segment , the address of which is passed to the driver on initialisation . In all cases , expect ax to be corrupt , except where values are returned . Function 0 - Refresh -------------------- entry : ah = 0 exit : nothing much of importance On most drivers , this function needs to be called by a vbl or timer , but due to the CD audio and samples , an irregular call at any reasonable rate should suffice ( 50-60 hz maybe ) The refresh handles looping of tunes and a perculiar twist to the sample playback which is needed where a sample crosses a 64k page . Most processing is done within this routine , and in the case of the Gryphon , it can take a hell of a long time , because it has to be done via the device drivers . Function 1 - Initialise ----------------------- entry : ah = 1 dx = segment address at which samples file is loaded(offset 0) exit : al = 1 if CD audio present , else 0 ah = 1 if sample playback available , else 0 Function 2 - Kill all sound --------------------------- entry : ah = 2 exit : none Function 3 - Start a tune ------------------------- entry : ah = 3 al = tune number 1-22 ( corresponding to keys a-v on demo ) exit : none This function only 'cues up' a tune to start , the processing is done during the next refresh . Function 4 - Start an effect ---------------------------- entry : ah = 4 al = effect number 1-21 ( corresponding to keys A-U on demo ) exit : none This function only 'cues up' an effect to start , the processing is done during the next refresh . Function 5 - Get tune --------------------- entry : ah = 5 exit : al = number of current tune Function 6 - Get effect ----------------------- entry : ah = 6 exit : al = number of current effect Function 7 - Set track table ---------------------------- entry : ah = 7 ds:si = segment:offset of track table format of track table is simple : db CD track number for each tune number as used by the driver ( e.g. tune 1 - awesome ) bit 7 is set if tune needs to be looped N.B. entry zero is NEVER USED exit : not a lot Function 8 - Play next track ---------------------------- entry : ah = 8 exit : nothing This function has been added after today's conversation ( Mon 19th ) and all track play lengths have been extended , so basically they will play until the end or until you stop them . The device driver function which is supposed to read the current track number and CD play position randomly gives back crap and if the track number is greater than the number of tracks , I go back to the beginning . As usual this isn't desirable , but it's getting late and I've arrange for the machine to be picked up in the morning ............