home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume6 / glib / part02 / pc-mach.h < prev    next >
C/C++ Source or Header  |  1989-05-21  |  5KB  |  172 lines

  1. /* $Id: pc-mach.h,v 1.6 89/05/06 17:13:40 lee Exp $
  2.  *
  3.  * Machine-dependent stuff for DOS.  Has only been tested with Turbo C 2.0.
  4.  * $Log:    pc-mach.h,v $
  5.  * Revision 1.6  89/05/06  17:13:40  lee
  6.  * rel. to comp.sources.misc
  7.  * 
  8.  */
  9.  
  10. #include <dos.h>
  11. #include <dir.h>
  12. #include <stdio.h>
  13. #include <ctype.h>
  14. #include <fcntl.h>
  15. #include <errno.h>
  16. #include <sys/stat.h>
  17.  
  18. #define TURBOC
  19.  
  20. #define MIDIABLE
  21.  
  22. #define OPENBINFILE(f,name,mode) f=fopen(name,mode[0]=='r'?"rb":"wb")
  23. #define OPENTEXTFILE(f,name,mode) f=fopen(name,mode[0]=='r'?"rt":"wt")
  24.  
  25. extern unsigned long hzcount;
  26. extern int wrt_index, rd_index;
  27. extern int Nextpcchar;
  28.  
  29. #define INT16 int
  30.  
  31. #define STATMIDI (wrt_index==rd_index?0:1)
  32. #define STATCONSOLE (Nextpcchar!=EOF?1:(kbhit()?(Nextpcchar=getch(),1):0))
  33. #define RTSTART rtstart()
  34. #define RTEND rtend()
  35. #define KEYCHECK keycheck()
  36. #define TTYISRAW
  37. #define NEEDSECHO
  38.  
  39. #define SEPARATOR "\\"
  40. #define CORELEFT coreleft
  41. /* fake ones for a fake signal() */
  42. #define SIGINT 1
  43. #define SIG_IGN 0
  44.  
  45. /* CLOCK DEFINES */
  46.  
  47. #define MASTER_CLOCK_RATE    96        /* 96 CLOCKS PER BEAT */
  48. #define MIDI_CLOCKS_PER_BEAT    24
  49.  
  50. /* MISC INTERNAL DEFINES */
  51.  
  52. #define REC_CTRL_ALL      1
  53. #define REC_CTRL_NO_BEND  0    
  54. #define REC_CTRL_NO_PRESS 2
  55.  
  56. #define COMMAND_MSG     0
  57. #define READ_MSG     1
  58. #define WRITE_MSG    2
  59.  
  60. #define SHELL_USE_INTERNAL_CLOCK 0
  61. #define SHELL_USE_TAPE_CLOCK 1
  62. #define SHELL_USE_MIDI_CLOCK 2
  63.  
  64. /* CODES FOR THE COMMANDS THAT ARE SENT TO THE MIC */
  65.  
  66. #define PLAY_STOP        0x05
  67. #define PLAY_START        0x0A
  68. #define REC_STOP        0x11
  69. #define OVERDUB_STOP        0x15
  70. #define RECORD_STANDBY        0x20
  71. #define REC_START        0x22
  72. #define OVERDUB_START        0x2A
  73. #define NO_ALL_NOTES_OFF    0x30
  74. #define NO_REAL_TIME        0x32
  75. #define THRU_DEAD        0x33
  76. #define COMMON_TO_HOST        0x38
  77. #define REAL_TIME_IN        0x39
  78. #define UART            0x3f
  79. #define SET_REFA        0x40
  80. #define USE_INTERNAL_CLOCK    0x80
  81. #define USE_TAPE_CLOCK        0x81
  82. #define USE_MIDI_CLOCK        0x82
  83. #define METRONOME_ON_NORMAL    0x83
  84. #define METRONOME_OFF        0x84
  85. #define METRONOME_ON_DOUBLE    0x85
  86. #define BENDER_OFF        0x86
  87. #define BENDER_ON        0x87
  88. #define THRU_OFF         0x88
  89. #define THRU_ON            0x89
  90. #define INHIBIT_MEASURE_END    0x8C
  91. #define REQUEST_MEASURE_END    0x8D
  92. #define CONDUCTOR_OFF        0x8e
  93. #define CONDUCTOR_ON        0x8f
  94. #define RTM_AFFECT_OFF        0x90
  95. #define RTM_AFFECT_ON        0x91
  96. #define FSK_TO_INT        0x92
  97. #define FSK_TO_MIDI        0x93
  98. #define CLOCK_TO_HOST_OFF    0x94
  99. #define CLOCK_TO_HOST_ON    0x95
  100. #define CREFA_OFF        0x98
  101. #define READ_RESET_RECORD_CTR    0xAB
  102. #define TEMPO_REQUEST        0xAF
  103. #define CLEAR_PLAY_COUNTERS    0xB8
  104. #define CLEAR_PLY        0xb9
  105. #define SET_CLOCK_RES        0xc2
  106. #define SEND_DATA        (0xd0 + 7)    /* send on track 7 */
  107. #define SEND_SYSTEM        0xdf
  108. #define SET_TEMPO        0xE0
  109. #define CLOCKS_PER_BEAT        0xE4
  110. #define BEATS_PER_MEASURE    0xE6
  111. #define CLOCK_TO_HOST_RATE    0xe7
  112. #define ACTIVE_TRACKS        0xEC
  113. #define ACCEPT_CHANNELS_LOW    0xEE
  114. #define ACCEPT_CHANNELS_HIGH    0xEF
  115. #define TIMING_OVERFLOW        0xF8
  116. #define SEND_NULL        0xF8
  117. #define MEASURE_END        0xf9
  118. #define DATA_END        0xfc
  119. #define RESET            0xFF
  120.  
  121. /* CODES FOR THE MESSAGES THAT ARE READ FROM THE MIC */
  122.  
  123. #define REQUEST_PLAY_DATA    0xF0
  124. #define TIMING_OVERFLOW        0xF8
  125. #define DATA_END_MARK        0xFC
  126. #define ALL_END            0xFC
  127. /* #define MEASURE_END        0xF9  avoid redefinition */
  128. #define CONDUCT_REQ        0xf9
  129. #define CLOCK_TO_HOST        0xFD
  130. #define ACK            0Xfe
  131. #define SYSTEM_MSG        0xff
  132.  
  133. /* HARDWARE LEVEL ACCESS TO THE MIC, FROM 'C' */
  134.  
  135. #define BASE_ADDRESS_MIC    0X0330
  136. #define STATUS_PORT_MIC        BASE_ADDRESS_MIC + 1
  137. #define COMMAND_PORT_MIC    BASE_ADDRESS_MIC + 1
  138. #define DATA_OUT_PORT_MIC    BASE_ADDRESS_MIC + 0
  139. #define DATA_IN_PORT_MIC    BASE_ADDRESS_MIC + 0
  140. #define INT_MIC            2
  141. #define INT2             10
  142. #define DATA_READY_MIC_MASK    0x40
  143. #define DATA_AVAILABLE_MIC_MASK 0x80
  144. #define INT_RESET_PORT        0x20
  145. #define INT_RESET_CODE        0x20
  146. #define PC_INTERRUPT_MASK_REGISTER 0x21
  147.  
  148.  
  149. /* INPUT/OUTPUT LOW LEVEL MACROS */
  150.  
  151. #define NOT_READY_FOR_DATA_MIC() (inportb(STATUS_PORT_MIC) & \
  152.                     DATA_READY_MIC_MASK)
  153. #define NOT_DATA_AVAILABLE_MIC() (inportb(STATUS_PORT_MIC) & \
  154.                     DATA_AVAILABLE_MIC_MASK)
  155. #define COMMAND_OUT_MIC(com)     outportb(COMMAND_PORT_MIC, com)
  156. #define DATA_OUT_MIC(dat)     outportb(DATA_OUT_PORT_MIC, dat)
  157. #define READ_DATA_MIC()     inportb(DATA_IN_PORT_MIC)
  158.  
  159. /* define the graphics drawing characters for showstr */
  160.  
  161. #define DRAW_VERT    179    /* vertical line */
  162. #define DRAW_HORIZ    196    /* horizontal line */
  163. #define DRAW_CROSS    197    /* vertical line intersecting horizontal */
  164. #define DRAW_UPTEE    194    /* 'T' */
  165. #define DRAW_DOWNTEE    193    /* upside-down 'T' */
  166. #define DRAW_LEFTTEE    195    /* 'T' on its left side */
  167. #define DRAW_RIGHTTEE    180    /* 'T' on its right side */
  168. #define DRAW_UPLEFT    218    /* upper-left corner */
  169. #define DRAW_UPRIGHT    191    /* upper-right corner */
  170. #define DRAW_DOWNLEFT    192    /* lower-left corner */
  171. #define DRAW_DOWNRIGHT    217    /* lower-right corner */
  172.