home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga 14 / MA_Cover_14.iso / hobby / tppset / source / tppset.c < prev   
Encoding:
C/C++ Source or Header  |  2000-01-09  |  1.5 KB  |  53 lines

  1. /*
  2.  
  3.     Small program to set the default out port for the Triple Play or Quadra
  4.     Play midi-interfaces. Made by Kjetil S. Matheussen.
  5.  
  6.     This program and its sourcecode is released into the Public Domain, and
  7.     may be freely distributed in its original form.
  8.  
  9.     It is supplied ``as is'', and comes with no warranty. This program code
  10.     was  released  because it might be useful as a starting point for other
  11.     programmers. However, if any damage arises from its use,  the  original
  12.     author and I will not be held liable. Use it at your own risk.
  13.  
  14.     You are free to use and modify  this  code  to  your  heart's  content,
  15.     provided you acknowledge me as the original author in any code that you
  16.     might distribute which is based largely on this code.
  17.  
  18. */
  19.  
  20. #include <stdio.h>
  21. #include <stdlib.h>
  22. #include <exec/types.h>
  23.  
  24. extern void __asm set_dtr_rts(
  25.     register __d0 LONG dtr,
  26.     register __d1 LONG rts
  27. );
  28.  
  29. int main(int argc,char **argv){
  30.     if(argc!=2){
  31.         printf("Settppoutport. Made by Kjetil S. Matheussen.\nUsage: settppoutport <port>\nPort can be 1,2,3 or 4.\n",argv[1]);
  32.         return 1;
  33.     }
  34.     switch(atoi(argv[1])){
  35.         case 1:
  36.             set_dtr_rts(1,1);
  37.             break;
  38.         case 2:
  39.             set_dtr_rts(1,0);
  40.             break;
  41.         case 3:
  42.             set_dtr_rts(0,1);
  43.             break;
  44.         case 4:
  45.             set_dtr_rts(0,0);
  46.             break;
  47.         default:
  48.             printf("Port can only be 1,2,3 or 4.\n",argv[1]);
  49.             return 2;
  50.     }
  51.     return 0;
  52. }
  53.