home *** CD-ROM | disk | FTP | other *** search
/ HomeWare 14 / HOMEWARE14.bin / music / vaisdk.arj / SETPREF.C < prev    next >
C/C++ Source or Header  |  1994-04-10  |  28KB  |  845 lines

  1.  
  2. ;   /*\
  3. ;---|*|----====< Setpref.exe >====----
  4. ;---|*|
  5. ;---|*| Sets the preference levels of the different drivers
  6. ;---|*|
  7. ;---|*| Copyright (c) 1993,1994  V.E.S.A, Inc. All Rights Reserved.
  8. ;---|*|
  9. ;---|*| VBE/AI 1.0 Specification
  10. ;---|*|    February 2, 1994. 1.00 release
  11. ;---|*|
  12. ;   \*/
  13.  
  14. #include <stdio.h>
  15. #include <signal.h>
  16.  
  17. #include "vbeai.h"
  18. #include "vesa.h"
  19.  
  20. #define TRUE    -1
  21. #define FALSE    0
  22. #define ON      TRUE
  23. #define OFF     FALSE
  24.  
  25.         VESAHANDLE hVESA  = 0;
  26.  
  27.         GeneralDeviceClass gdc; // receives a copy of the VESA driver info block
  28.         int  IncrVal = 0;
  29.         int  DecVal  = 0;
  30.         int  DevHan  = 0;
  31.         int  Listing = FALSE;   // amout reported
  32.         int  Verbose = -1;      // amout reported
  33.  
  34. #define SERVICESIZE 4096
  35.         char services[SERVICESIZE] = {0};
  36.  
  37.     // tables for reporting attached volume info and services
  38.  
  39. #define VOLTABLESIZE 1024
  40.         char volinf[VOLTABLESIZE] = {0};
  41.         char volsrv[VOLTABLESIZE] = {0};
  42.  
  43.  
  44. ;   /*\
  45. ;---|*| prototypes
  46. ;   \*/
  47.  
  48.         long GetValue               ( char *, long );
  49.  
  50.         void far *NewAddress        ( char far * );
  51.  
  52.         PrintMIDIServices           ( fpMIDServ );
  53.         PrintWaveServices           ( fpWAVServ );
  54.         PrintSpecificDeviceInfo     ( int, void far * );
  55.         PrintGeneralDeviceInfo      ( GeneralDeviceClass *,VESAHANDLE );
  56.         PrintAttachedVolumes        ( VESAHANDLE );
  57.  
  58.     // only allows us to run on this version of the VBE interface. This
  59.     // will be removed after the interface is ratified. Changes may be made
  60.     // that would cause this code to crash if run on other version. Again,
  61.     // this will be removed in the final software.
  62.  
  63.         int  VersionControl = 0x0100;
  64.  
  65.  
  66. ;   /*\
  67. ;---|*|------------------==============================-------------------
  68. ;---|*|------------------====< Start of execution >====-------------------
  69. ;---|*|------------------==============================-------------------
  70. ;   \*/
  71.  
  72. main(argc,argv)
  73.     int argc;
  74.     char *argv[];
  75. {
  76. int query;
  77. int pref;
  78.  
  79.     // process the command line
  80.  
  81.         CommandLine (argc,argv);
  82.  
  83.     // disable the ^C so the devices will close properly.
  84.  
  85.         signal (SIGINT,SIG_IGN);
  86.  
  87.     // process each driver
  88.  
  89.         while (-1) {
  90.  
  91.             // Find each device and adjust each
  92.  
  93.                 if ((hVESA = VESAFindADevice(0)) == 0)
  94.                     break;
  95.  
  96.                 if (VESAQueryDevice(hVESA, VESAQUERY2 ,&gdc) == 0) {
  97.                     printf ("Cannot query the installed VBE/AI devices!\n");
  98.                     DoExit(-1);
  99.                 }
  100.  
  101.             // if we want to do just one, then skip the rest
  102.  
  103.                 if (DevHan)
  104.                     if (DevHan != hVESA)
  105.                         continue;
  106.  
  107.             // make sure it's matches the beta version #
  108.  
  109.                 if (gdc.gdvbever != VersionControl)
  110.                     continue;
  111.  
  112.                 PrintGeneralDeviceInfo(&gdc,hVESA);
  113.  
  114.                 if (IncrVal||DecVal) {
  115.  
  116.                     switch (gdc.gdclassid) {
  117.  
  118.                         case WAVDEVICE:
  119.                             printf ("    Old setting = %d  ",pref = gdc.u.gdwi.widevpref);
  120.  
  121.                             pref += IncrVal;
  122.                             pref -= DecVal;
  123.                             if (pref < 0)
  124.                                 pref = 0;
  125.                             query = WAVESETPREFERENCE;
  126.  
  127.                             printf ("New setting = %d\n",pref);
  128.                             break;
  129.  
  130.                         case MIDDEVICE:
  131.                             printf ("    Old setting = %d  ",pref = gdc.u.gdmi.midevpref);
  132.  
  133.                             pref += IncrVal;
  134.                             pref -= DecVal;
  135.                             if (pref < 0)
  136.                                 pref = 0;
  137.                             query = MIDISETPREFERENCE;
  138.  
  139.                             printf ("New setting = %d\n",pref);
  140.                             break;
  141.  
  142.                         case VOLDEVICE:
  143.                             break;
  144.  
  145.                         default:
  146.                             printf ("Invalid, or unknown device class! (handle=%x)\n",hVESA);
  147.                             query = 0;
  148.                             break;
  149.                     }
  150.                 }
  151.  
  152.             // if this is a WAVE/MIDI device, set the preference now
  153.  
  154.                 if (query)
  155.                     VESAQueryDevice(hVESA, query, (void far *)(pref));
  156.  
  157.         }
  158.  
  159.         DoExit(0);
  160. }
  161.  
  162.  
  163. ;   /*\
  164. ;---|*|----------------------=======================---------------------------
  165. ;---|*|----------------------====< Subroutines >====---------------------------
  166. ;---|*|----------------------=======================---------------------------
  167. ;   \*/
  168.  
  169. ;   /*\
  170. ;---|*|----====< CommandLine >====----
  171. ;---|*|
  172. ;---|*| Process the command line switches
  173. ;---|*|
  174. ;   \*/
  175. CommandLine(argc,argv)
  176.     int argc;
  177.     char *argv[];
  178. {
  179. int n,x;
  180. char *s,c;
  181. int vh,vl;
  182.  
  183.         vh = VersionControl >> 8;
  184.         vl = VersionControl &  0xFF;
  185.  
  186.     // intro...
  187.  
  188.         printf ("\nVESA VBE/AI Preference setting Program, %02x.%02x\n",vh,vl);
  189.         printf ("Copyright (c) 1993,1994  VESA, Inc. All Rights Reserved.\n\n");
  190.  
  191.     // exit if no other parameters
  192.  
  193.         if (argc < 2) {
  194.             GiveHelps();
  195.             return(0);
  196.         }
  197.  
  198.     // process all the switches
  199.  
  200.         n = 1;
  201.         while (n<argc) {
  202.  
  203.             s = argv[n++];
  204.  
  205.             switch (*s) {
  206.  
  207.                 case '?':
  208.                 case 'H':
  209.                 case 'h':
  210.                     GiveHelps();
  211.                     DoExit(0);
  212.  
  213.                 case '+':
  214.                     IncrVal = 1;
  215.                     DevHan  = GetValue (++s,DevHan);
  216.                     if (DevHan)
  217.                         printf ("Will increment %d's preference\n\n",DevHan);
  218.                     else
  219.                         printf ("Will increment all preferences\n\n");
  220.                     break;
  221.  
  222.                 case '-':
  223.                     DecVal  = 1;
  224.                     DevHan  = GetValue (++s,DevHan);
  225.                     if (DevHan)
  226.                         printf ("Will Decrement %d's preference\n\n",DevHan);
  227.                     else
  228.                         printf ("Will Decrement all preferences\n\n");
  229.                     break;
  230.  
  231.                 case 'L':   // list  all drivers
  232.                 case 'l':
  233.                     Listing = TRUE;
  234.                     break;
  235.  
  236.                 case 'V':
  237.                 case 'v':
  238.                     Verbose = GetValue (++s,Verbose);
  239.                     break;
  240.  
  241.  
  242.                 default:
  243.                     printf ("Unknown option - %s\n",s);
  244.             }
  245.         }
  246.  
  247. }
  248.  
  249.  
  250. ;   /*\
  251. ;---|*|----====< DoExit >====----
  252. ;---|*|
  253. ;---|*| Shut everything down, then exit to DOS
  254. ;---|*|
  255. ;   \*/
  256. DoExit(cc)
  257.     int cc;
  258. {
  259.  
  260.     // return to DOS, don't return to caller
  261.  
  262.         exit(cc);
  263. }
  264.  
  265.  
  266. ;   /*\
  267. ;---|*|----====< GetKey >====----
  268. ;---|*|
  269. ;---|*| Get a key from the keyboard
  270. ;---|*|
  271. ;   \*/
  272. int GetKey(flag)
  273.     int flag;
  274. {
  275. int c;
  276.  
  277.     // flush the keys coming in
  278.  
  279.         if (flag)
  280.             while (kbhit())
  281.                 getch();
  282.  
  283.     // get the real key
  284.  
  285.         if ((c = getch()) == 0)
  286.             c = getch();
  287.  
  288.     // return to the caller
  289.  
  290.         return(c);
  291. }
  292.  
  293.  
  294. ;   /*\
  295. ;---|*|----====< GetValue >====----
  296. ;---|*|
  297. ;---|*| Return a value from the string, or the last value
  298. ;---|*|
  299. ;   \*/
  300. long GetValue (s,orig)
  301.     char * s;
  302.     long orig;
  303. {
  304. long w;
  305. int NegateFlag = FALSE;
  306.  
  307.     // if the first character is negative, then set out neg flag
  308.  
  309.         if (*s == '-') {
  310.             s++;
  311.             NegateFlag = TRUE;
  312.         }
  313.  
  314.     // check the first character, if zero, then it's octal or hex
  315.  
  316.         if (*s == '0') {
  317.  
  318.             w = 0;
  319.  
  320.             if ((*++s & 0x5F) == 'X') {
  321.  
  322.                 if (sscanf (++s,"%lx",&w) != 1)
  323.                     w = orig;
  324.  
  325.             }
  326.             else {
  327.                 if (isdigit(*s)) {
  328.  
  329.                     if (sscanf (s,"%lo",&w) != 1)
  330.                         w = orig;
  331.                 }
  332.                 else {
  333.                     w = 0;
  334.                 }
  335.             }
  336.         }
  337.  
  338.     // return a decimal value
  339.  
  340.         else {
  341.  
  342.             if (sscanf (s,"%ld",&w) != 1)
  343.                 w = orig;
  344.  
  345.         }
  346.  
  347.     // we have something...
  348.  
  349.         if (NegateFlag)
  350.             w = 0 - w;
  351.  
  352.         return(w);
  353.  
  354. }
  355.  
  356.  
  357. ;   /*\
  358. ;---|*|----====< GiveHelps >====----
  359. ;---|*|
  360. ;---|*| Give the user the commandline option list
  361. ;---|*|
  362. ;   \*/
  363.  
  364. GiveHelps()
  365. {
  366.  
  367.         printf ("To Use: DOS>SETPREF [H|?] [L] [+] [+xx] [-] [-xxx] [Vxxx]\n\n");
  368.  
  369.         printf ("Where:     [L]        lists all devices.\n");
  370.         printf ("           [+]        increments all preference levels by 1\n");
  371.         printf ("           [+xxx]     increments a specific devices's preference.\n");
  372.         printf ("           [-]        decrements all preference levels by 1\n");
  373.         printf ("           [-xxx]     decrements a specific devices's preference.\n");
  374.         printf ("           [Vxxx]     verbose listing of this devices's configuration.\n");
  375.         printf ("\n");
  376.  
  377.         printf ("NOTE: The highest preference level is zero (0), so incrementing the\n");
  378.         printf ("      preference actually lowers the user preference, and visa versa.\n");
  379.         printf ("\n");
  380.  
  381. }
  382.  
  383. ;
  384. ;   /*\
  385. ;---|*|----====< PrintGeneralDeviceInfo >====----
  386. ;---|*|
  387. ;---|*| Printout the table entries
  388. ;---|*|
  389. ;   \*/
  390. PrintGeneralDeviceInfo(p,h)
  391.     GeneralDeviceClass *p;
  392.     VESAHANDLE h;
  393. {
  394. void far *vfp;
  395.  
  396.  
  397.     // if verbose, give a better heading
  398.  
  399.         if (Verbose==h) {
  400.             printf ("\n   %s General Device Class:\n\n", &p->u.gdwi.wivname);
  401.             printf ("    char gdname[4]  = %lx\n", (long)*(long*)&p->gdname);
  402.             printf ("    long gdlength   = %lx\n",  p->gdlength   );
  403.             printf ("    int  gdclassid  = %x\n",   p->gdclassid  );
  404.             printf ("    int  gdvbever   = %x\n",   p->gdvbever  );
  405.             printf ("    ");
  406.  
  407.             vfp = NewAddress(services);
  408.  
  409.         }
  410.  
  411.         switch (p->gdclassid) {
  412.  
  413.             case WAVDEVICE:
  414.  
  415.                 if ((Listing)||(Verbose==h)) {
  416.  
  417.                     printf ("WAVE device Class (handle=%x)\n",h);
  418.                     printf ("    %s\n",  &p->u.gdwi.wivname   );
  419.                     printf ("    %s\n",  &p->u.gdwi.wiprod    );
  420.                     printf ("    %s\n",  &p->u.gdwi.wichip    );
  421.                     printf ("    %lx\n",  p->u.gdwi.wiboardid  );
  422.                     printf ("    %d preference\n\n",   p->u.gdwi.widevpref  );
  423.  
  424.                     if (Verbose==h) {
  425.  
  426.                         PrintSpecificDeviceInfo(WAVDEVICE,(void far *) &p->u.gdwi );
  427.  
  428.                         if (VESAOpenADevice ( h, 0, vfp )) {
  429.                             PrintWaveServices((fpWAVServ)vfp);
  430.                             VESACloseDevice ( h );
  431.                         }
  432.                         else
  433.                             printf ("This WAVE device is opened, thus cannot be displayed.\n");
  434.                     }
  435.  
  436.                     PrintAttachedVolumes(h); // print any volume services
  437.  
  438.                 }
  439.                 else
  440.                     printf ("WAVE device Class (handle=%x,pref=%d) %s\n",h,p->u.gdwi.widevpref,&p->u.gdwi.wiprod);
  441.  
  442.                 break;
  443.  
  444.             case MIDDEVICE:
  445.  
  446.                 if ((Listing)||(Verbose==h)) {
  447.                     printf ("MIDI device Class (handle=%x)\n",h);
  448.                     printf ("    %s\n",  &p->u.gdmi.mivname   );
  449.                     printf ("    %s\n",  &p->u.gdmi.miprod    );
  450.                     printf ("    %s\n",  &p->u.gdmi.michip    );
  451.                     printf ("    %lx\n\n",  p->u.gdmi.miboardid );
  452.                     printf ("    %d preference\n\n", p->u.gdmi.midevpref  );
  453.  
  454.                     if (Verbose==h) {
  455.  
  456.                         PrintSpecificDeviceInfo(MIDDEVICE,(void far *) &p->u.gdmi );
  457.  
  458.                         if (VESAOpenADevice ( h, 0, vfp )) {
  459.                             PrintMIDIServices((fpMIDServ)vfp);
  460.                             VESACloseDevice ( h );
  461.                         }
  462.                         else
  463.                             printf ("This MIDI device is opened, thus cannot be displayed.\n");
  464.                     }
  465.  
  466.                     PrintAttachedVolumes(h); // print any volume services
  467.                 }
  468.                 else
  469.                     printf ("MIDI device Class (handle=%x,pref=%d) %s\n",h,p->u.gdmi.midevpref,&p->u.gdmi.miprod);
  470.  
  471.                 break;
  472.  
  473.             case VOLDEVICE:
  474.  
  475.                 if ((Listing)||(Verbose==h)) {
  476.                     printf ("VOLUME device Class (handle=%x)\n",h);
  477.                     printf ("    %s\n",  &p->u.gdvi.vivname   );
  478.                     printf ("    %s\n",  &p->u.gdvi.viprod    );
  479.                     printf ("    %s\n",  &p->u.gdvi.vichip    );
  480.                     printf ("    %lx\n\n",  p->u.gdvi.viboardid );
  481.  
  482.                     if (Verbose==h)
  483.                         PrintSpecificDeviceInfo(VOLDEVICE,(void far *) &p->u.gdvi );
  484.  
  485.                 }
  486.                 else
  487.                     printf ("VOLUME device Class (handle=%x,no preferences) %s\n",h,&p->u.gdvi.viprod);
  488.                 break;
  489.  
  490.             default:
  491.                 printf ("Invalid, or unknown device class! (handle=%x)\n",h);
  492.                 break;
  493.         }
  494.  
  495. }
  496.  
  497. ;
  498. ;   /*\
  499. ;---|*|----====< NewAddress >====----
  500. ;---|*|
  501. ;---|*| Build a far address with an offset of zero
  502. ;---|*|
  503. ;   \*/
  504. void far *NewAddress(char far *cfp)
  505. {
  506.     _asm {
  507.  
  508.         mov     ax,word ptr [cfp+0];
  509.         mov     dx,word ptr [cfp+2];
  510.         shr     ax,4
  511.         add     dx,ax
  512.         inc     dx
  513.         sub     ax,ax
  514.     }
  515. }
  516.  
  517. ;
  518. ;   /*\
  519. ;---|*|----====< PrintAttachedVolumes >====----
  520. ;---|*|
  521. ;---|*| locate and print any volume info and services structures for the
  522. ;---|*| device handle
  523. ;---|*|
  524. ;   \*/
  525. PrintAttachedVolumes(han)
  526.     VESAHANDLE han;
  527. {
  528. fpVolInfo vi;
  529. fpVolServ vs;
  530.  
  531.     // if there is a valid volume info structure, print it...
  532.  
  533.         if (VESAQueryDevice ( han, VESAQUERY3, 0 )) {
  534.  
  535.             if (vi = (fpVolInfo)VESAQueryDevice ( han, VESAQUERY4, (fpVolInfo)&volinf ))
  536.  
  537.                 PrintSpecificDeviceInfo(VOLDEVICE,(void far *)vi);
  538.  
  539.         }
  540.  
  541.     // if there is a valid volume info structure, print it...
  542.  
  543.  
  544.         if (VESAQueryDevice ( han, VESAQUERY5, 0 )) {
  545.  
  546.             if (vs = (fpVolServ)VESAQueryDevice ( han, VESAQUERY6, (fpVolServ)&volsrv ))
  547.  
  548.                 PrintVolServices(vs);
  549.  
  550.         }
  551. }
  552.  
  553. ;
  554. ;   /*\
  555. ;---|*|----====< PrintSpecificDeviceInfo >====----
  556. ;---|*|
  557. ;---|*| Printout the table entries
  558. ;---|*|
  559. ;   \*/
  560. PrintSpecificDeviceInfo(id,p)
  561.     int id;
  562.     void far *p;
  563. {
  564. fpMIDInfo mp;
  565. fpVolInfo vp;
  566. fpWAVInfo wp;
  567.  
  568.     // print the specific info structure
  569.  
  570.         switch (id) {
  571.  
  572.             case WAVDEVICE:
  573.  
  574.                 wp = (fpWAVInfo) p;
  575.  
  576.                 printf ("    char winame[4]   = %4c\n", &wp->winame    );
  577.                 printf ("    long wilength    = %lx\n",  wp->wilength  );
  578.  
  579.                 printf ("    long wifeatures  = %lx\n",  wp->wifeatures);
  580.  
  581.                 printf ("    int  wimemreq    = %x\n",   wp->wimemreq    );
  582.                 printf ("    int  witimerticks= %x\n",   wp->witimerticks);
  583.                 printf ("    int  wiChannels  = %x\n",   wp->wiChannels  );
  584.                 printf ("    int  wiSampleSize= %x\n\n", wp->wiSampleSize);
  585.  
  586.                 // print a list of supported features
  587.  
  588.                 if (wp->wifeatures & WAVEMP8K)
  589.                     printf ("    Supports 8000hz Mono Playback.\n");
  590.  
  591.                 if (wp->wifeatures & WAVEMR8K)
  592.                     printf ("    Supports 8000hz Mono Record.\n");
  593.  
  594.                 if (wp->wifeatures & WAVESR8K)
  595.                     printf ("    Supports 8000hz Stereo Record.\n");
  596.  
  597.                 if (wp->wifeatures & WAVESP8K)
  598.                     printf ("    Supports 8000hz Stereo Playback.\n");
  599.  
  600.                 if (wp->wifeatures & WAVEFD8K)
  601.                     printf ("    Supports 8000hz Full Duplex Play/Record.\n");
  602.  
  603.                 if (wp->wifeatures & WAVEMP11K)
  604.                     printf ("    Supports 11025hz Mono Playback.\n");
  605.  
  606.                 if (wp->wifeatures & WAVEMR11K)
  607.                     printf ("    Supports 11025hz Mono Record.\n");
  608.  
  609.                 if (wp->wifeatures & WAVESR11K)
  610.                     printf ("    Supports 11025hz Stereo Record.\n");
  611.  
  612.                 if (wp->wifeatures & WAVESP11K)
  613.                     printf ("    Supports 11025hz Stereo Playback.\n");
  614.  
  615.                 if (wp->wifeatures & WAVEFD11K)
  616.                     printf ("    Supports 11025hz Full Duplex Play/Record.\n");
  617.  
  618.                 if (wp->wifeatures & WAVEMP22K)
  619.                     printf ("    Supports 22050hz Mono Playback.\n");
  620.  
  621.                 if (wp->wifeatures & WAVEMR22K)
  622.                     printf ("    Supports 22050hz Mono Record.\n");
  623.  
  624.                 if (wp->wifeatures & WAVESR22K)
  625.                     printf ("    Supports 22050hz Stereo Record.\n");
  626.  
  627.                 if (wp->wifeatures & WAVESP22K)
  628.                     printf ("    Supports 22050hz Stereo Playback.\n");
  629.  
  630.                 if (wp->wifeatures & WAVEFD22K)
  631.                     printf ("    Supports 22050hz Full Duplex Play/Record.\n");
  632.  
  633.                 if (wp->wifeatures & WAVEMP44K)
  634.                     printf ("    Supports 44100hz Mono Playback.\n");
  635.  
  636.                 if (wp->wifeatures & WAVEMR44K)
  637.                     printf ("    Supports 44100hz Mono Record.\n");
  638.  
  639.                 if (wp->wifeatures & WAVESR44K)
  640.                     printf ("    Supports 44100hz Stereo Record.\n");
  641.  
  642.                 if (wp->wifeatures & WAVESP44K)
  643.                     printf ("    Supports 44100hz Stereo Playback.\n");
  644.  
  645.                 if (wp->wifeatures & WAVEFD44K)
  646.                     printf ("    Supports 44100hz Full Duplex Play/Record.\n");
  647.  
  648.                 if (wp->wifeatures &
  649.                     (WAVEVARIPMONO+WAVEVARIPSTER+WAVEVARIRMONO+WAVEVARIRSTER))
  650.                     printf ("    Supports Variable Sample Rates\n");
  651.  
  652.                 // print the different sample sizes
  653.  
  654.                 if (wp->wiSampleSize & WAVE08BITPLAY)
  655.                     printf ("    Supports 8 bit PCM playback\n");
  656.  
  657.                 if (wp->wiSampleSize & WAVE08BITREC )
  658.                     printf ("    Supports 8 bit PCM record\n");
  659.  
  660.                 if (wp->wiSampleSize & WAVE16BITPLAY)
  661.                     printf ("    Supports 16 bit PCM playback\n");
  662.  
  663.                 if (wp->wiSampleSize & WAVE16BITREC )
  664.                     printf ("    Supports 16 bit PCM record\n");
  665.                 break;
  666.  
  667.             case MIDDEVICE:
  668.  
  669.                 mp = (fpMIDInfo) p;
  670.  
  671.                 printf ("    char miname[4]   = %4c\n", &mp->miname    );
  672.                 printf ("    long milength    = %lx\n",  mp->milength  );
  673.  
  674.                 printf ("    long milibrary   = %s\n",  &mp->milibrary );
  675.  
  676.                 printf ("    long mifeatures  = %lx\n",  mp->mifeatures);
  677.  
  678.                 printf ("    int  mimemreq    = %x\n",   mp->mimemreq     );
  679.                 printf ("    int  mitimerticks= %x\n",   mp->mitimerticks );
  680.                 printf ("    int  miactivetons= %x\n",   mp->miactivetones);
  681.  
  682.                 break;
  683.  
  684.             case VOLDEVICE:
  685.  
  686.                 vp = (fpVolInfo) p;
  687.  
  688.                 printf ("    char viname[4]   = %4c\n", &vp->viname    );
  689.                 printf ("    long vilength    = %lx\n",  vp->vilength  );
  690.  
  691.                 printf ("    long vicname     = %s\n",  &vp->vicname   );
  692.  
  693.                 printf ("    long vifeatures  = %lx\n",  vp->vifeatures);
  694.                 printf ("    int  vimin       = %x\n",   vp->vimin     );
  695.                 printf ("    int  vimax       = %x\n",   vp->vimax     );
  696.                 printf ("    int  vicross     = %x\n",   vp->vicross   );
  697.  
  698.                 break;
  699.  
  700.             default:
  701.                 printf ("Invalid, or unknown device class!\n");
  702.                 break;
  703.         }
  704.         printf ("\n");
  705.  
  706. }
  707.  
  708. ;
  709. ;   /*\
  710. ;---|*|----====< PrintMIDIServices >====----
  711. ;---|*|
  712. ;---|*| Printout the table entries
  713. ;---|*|
  714. ;   \*/
  715. PrintMIDIServices(msv)
  716. fpMIDServ msv;
  717. {
  718.         printf ("    MIDI Services:\n");
  719.         printf ("    char msname[4]  = %4Fc\n", &msv->msname   );
  720.         printf ("    long mslength   = %lx\n",   msv->mslength );
  721.  
  722.         // device driver supplied function
  723.  
  724.         printf ("    msDeviceCheck   = %x:%x\n",(int)(((long)msv->msDeviceCheck) >>16), (int)msv->msDeviceCheck  );
  725.         printf ("    msGlobalReset   = %x:%x\n",(int)(((long)msv->msGlobalReset) >>16), (int)msv->msGlobalReset  );
  726.         printf ("    msMIDImsg       = %x:%x\n",(int)(((long)msv->msMIDImsg)     >>16), (int)msv->msMIDImsg      );
  727.         printf ("    msPreLoadPatch  = %x:%x\n",(int)(((long)msv->msPreLoadPatch)>>16), (int)msv->msPreLoadPatch );
  728.         printf ("    msTimerTick     = %x:%x\n",(int)(((long)msv->msTimerTick)   >>16), (int)msv->msTimerTick    );
  729.         printf ("    msGetLastError  = %x:%x\n",(int)(((long)msv->msGetLastError)>>16), (int)msv->msGetLastError );
  730.  
  731.         // device driver run-information time data
  732.  
  733.         printf ("    msApplFreeCB    = %x:%x\n",(int)(((long)msv->msApplFreeCB)>>16),(int)msv->msApplFreeCB );
  734.         printf ("    msApplMIDIIn    = %x:%x\n",(int)(((long)msv->msApplMIDIIn)>>16),(int)msv->msApplMIDIIn );
  735.  
  736.         printf ("    mspatches[0]     = %x\n",msv->mspatches[0]    );
  737.         printf ("    mspatches[1]     = %x\n",msv->mspatches[1]    );
  738.         printf ("    mspatches[2]     = %x\n",msv->mspatches[2]    );
  739.         printf ("    mspatches[3]     = %x\n",msv->mspatches[3]    );
  740.         printf ("    mspatches[4]     = %x\n",msv->mspatches[4]    );
  741.         printf ("    mspatches[5]     = %x\n",msv->mspatches[5]    );
  742.         printf ("    mspatches[6]     = %x\n",msv->mspatches[6]    );
  743.         printf ("    mspatches[7]     = %x\n",msv->mspatches[7]    );
  744.         printf ("    mspatches[8]     = %x\n",msv->mspatches[8]    );
  745.         printf ("    mspatches[9]     = %x\n",msv->mspatches[9]    );
  746.         printf ("    mspatches[A]     = %x\n",msv->mspatches[0xA]    );
  747.         printf ("    mspatches[B]     = %x\n",msv->mspatches[0xB]    );
  748.         printf ("    mspatches[C]     = %x\n",msv->mspatches[0xC]    );
  749.         printf ("    mspatches[D]     = %x\n",msv->mspatches[0xD]    );
  750.         printf ("    mspatches[E]     = %x\n",msv->mspatches[0xE]    );
  751.         printf ("    mspatches[F]     = %x\n",msv->mspatches[0xF]    );
  752.  
  753.         printf ("\n");
  754.  
  755.         printf ("    DC: tones      = %lx\n",(msv->msDeviceCheck)(MIDITONES,         0));
  756.         printf ("    DC: patch type = %lx\n",(msv->msDeviceCheck)(MIDIPATCHTYPE,     0));
  757.         printf ("    DC: preference = %lx\n",(msv->msDeviceCheck)(MIDISETPREFERENCE,-1));
  758.         printf ("    DC: unused     = %lx\n",(msv->msDeviceCheck)(MIDIVOICESTEAL,    2));
  759.         printf ("    DC: fifo sizes = %lx\n",(msv->msDeviceCheck)(MIDIGETFIFOSIZES,  0));
  760.         printf ("    DC: DMA/IRQ    = %lx\n",(msv->msDeviceCheck)(MIDIGETDMAIRQ,     0));
  761.         printf ("    DC: I/O address= %lx\n",(msv->msDeviceCheck)(MIDIGETIOADDRESS,  0));
  762.         printf ("    DC: mem address= %lx\n",(msv->msDeviceCheck)(MIDIGETMEMADDRESS, 0));
  763.         printf ("    DC: mem free   = %lx\n",(msv->msDeviceCheck)(MIDIGETMEMFREE,    0));
  764.  
  765.         printf ("\n");
  766.  
  767. }
  768.  
  769. ;
  770. ;   /*\
  771. ;---|*|----====< PrintVolServices >====----
  772. ;---|*|
  773. ;---|*| Printout the table entries
  774. ;---|*|
  775. ;   \*/
  776. PrintVolServices(vfn)
  777. fpVolServ vfn;
  778. {
  779.         printf ("    Volume Services:\n");
  780.         printf ("    char vsname[4]  = %4c\n", &vfn->vsname   );
  781.         printf ("    long vslength   = %lx\n",  vfn->vslength );
  782.  
  783.         // device driver supplied function
  784.  
  785.         printf ("    vsDeviceCheck   = %x:%x\n",(int)(((long)vfn->vsDeviceCheck) >>16), (int)vfn->vsDeviceCheck  );
  786.         printf ("    vsSetVolume     = %x:%x\n",(int)(((long)vfn->vsSetVolume)   >>16), (int)vfn->vsSetVolume    );
  787.         printf ("    vsSetFieldVol   = %x:%x\n",(int)(((long)vfn->vsSetFieldVol) >>16), (int)vfn->vsSetFieldVol  );
  788.         printf ("    vsToneControl   = %x:%x\n",(int)(((long)vfn->vsToneControl) >>16), (int)vfn->vsToneControl  );
  789.         printf ("    vsFilterControl = %x:%x\n",(int)(((long)vfn->vsFilterControl)>>16),(int)vfn->vsFilterControl);
  790.         printf ("    vsOutputPath    = %x:%x\n",(int)(((long)vfn->vsOutputPath)  >>16), (int)vfn->vsOutputPath   );
  791.         printf ("    vsResetChannel  = %x:%x\n",(int)(((long)vfn->vsResetChannel)>>16), (int)vfn->vsResetChannel );
  792.         printf ("    vsGetLastError  = %x:%x\n",(int)(((long)vfn->vsGetLastError)>>16), (int)vfn->vsGetLastError );
  793.  
  794.         printf ("\n");
  795.  
  796. }
  797.  
  798. ;
  799. ;   /*\
  800. ;---|*|----====< PrintWaveServices >====----
  801. ;---|*|
  802. ;---|*| Printout the table entries
  803. ;---|*|
  804. ;   \*/
  805. PrintWaveServices(wfn)
  806. fpWAVServ wfn;
  807. {
  808.         printf ("    Wave Services:\n");
  809.         printf ("    char wsname[4]  = %4c\n", &wfn->wsname   );
  810.         printf ("    long wslength   = %lx\n",  wfn->wslength );
  811.  
  812.         // device driver supplied function
  813.  
  814.         printf ("    wsDeviceCheck   = %x:%x\n",(int)(((long)wfn->wsDeviceCheck) >>16), (int)wfn->wsDeviceCheck  );
  815.         printf ("    wsPCMInfo       = %x:%x\n",(int)(((long)wfn->wsPCMInfo)     >>16), (int)wfn->wsPCMInfo      );
  816.         printf ("    wsPlayBlock     = %x:%x\n",(int)(((long)wfn->wsPlayBlock)   >>16), (int)wfn->wsPlayBlock    );
  817.         printf ("    wsPlayCont      = %x:%x\n",(int)(((long)wfn->wsPlayCont)    >>16), (int)wfn->wsPlayCont     );
  818.         printf ("    wsRecordBlock   = %x:%x\n",(int)(((long)wfn->wsRecordBlock) >>16), (int)wfn->wsRecordBlock  );
  819.         printf ("    wsRecordCont    = %x:%x\n",(int)(((long)wfn->wsRecordCont)  >>16), (int)wfn->wsRecordCont   );
  820.         printf ("    wsPauseIO       = %x:%x\n",(int)(((long)wfn->wsPauseIO)     >>16), (int)wfn->wsPauseIO      );
  821.         printf ("    wsResumeIO      = %x:%x\n",(int)(((long)wfn->wsResumeIO)    >>16), (int)wfn->wsResumeIO     );
  822.         printf ("    wsStopIO        = %x:%x\n",(int)(((long)wfn->wsStopIO)      >>16), (int)wfn->wsStopIO       );
  823.         printf ("    wsWavePrepare   = %x:%x\n",(int)(((long)wfn->wsWavePrepare) >>16), (int)wfn->wsWavePrepare  );
  824.         printf ("    wsTimerTick     = %x:%x\n",(int)(((long)wfn->wsTimerTick)   >>16), (int)wfn->wsTimerTick    );
  825.         printf ("    wsGetLastError  = %x:%x\n",(int)(((long)wfn->wsGetLastError)>>16), (int)wfn->wsGetLastError );
  826.  
  827.         // device driver run-information time data
  828.  
  829.         printf ("    wsApplPSyncCB   = %x:%x\n",(int)(((long)wfn->wsApplPSyncCB)>>16),(int)wfn->wsApplPSyncCB );
  830.         printf ("    wsApplRSyncCB   = %x:%x\n",(int)(((long)wfn->wsApplRSyncCB)>>16),(int)wfn->wsApplRSyncCB );
  831.  
  832.         printf ("    DC: DMA/IRQ    = %lx\n",(wfn->wsDeviceCheck)(WAVEGETDMAIRQ,     0));
  833.         printf ("    DC: IO address = %lx\n",(wfn->wsDeviceCheck)(WAVEGETIOADDRESS,  0));
  834.         printf ("    DC: MEM address= %lx\n",(wfn->wsDeviceCheck)(WAVEGETMEMADDRESS, 0));
  835.         printf ("    DC: MEM free   = %lx\n",(wfn->wsDeviceCheck)(WAVEGETMEMFREE,    0));
  836.         printf ("    DC: block size = %lx\n",(wfn->wsDeviceCheck)(WAVEGETBLOCKSIZE,  0));
  837.  
  838.         printf ("\n");
  839.  
  840. }
  841.  
  842.  
  843.  
  844.  
  845.