home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / apps / educatin / typtutor / osbind.h < prev    next >
C/C++ Source or Header  |  1989-06-03  |  7KB  |  235 lines

  1. /************************************************************************/
  2. /*    OSBINDS.H    #defines for GEMDOS,BIOS & XBIOS binding    */
  3. /*         started 5/2/85 .. Rob Zdybel                */
  4. /*        Copyright 1985 Atari Corp.                */
  5. /************************************************************************/
  6. #ifndef DL_OSBIND
  7. #define DL_OSBIND
  8.  
  9. extern    long    bios();
  10. extern    long    xbios();
  11. extern    long    gemdos();
  12.  
  13.  
  14. /*
  15.      These are the data structures that are used by some of the
  16.      BIOS functions.  rpt
  17. */
  18. typedef struct {
  19.     int (*midivec)();   /* MIDI-input */
  20.     int (*vkbderr)();   /* keyboard error */
  21.     int (*vmiderr)();   /* MIDI error */
  22.     int (*statvec)();   /* ikbd status packet */
  23.     int (*mousevec)();  /* mouse packet */
  24.     int (*clockvec)();  /* clock packet */
  25.     int (*joyvec)();    /* joystick packet */
  26.     int (*midisys)();   /* system MIDI vector */
  27.     int (*ikbdsys)();   /* system IKBD vector */
  28. } kbdvecs;
  29.  
  30. /*
  31.     Used in function Iorec()
  32. */
  33. typedef struct {
  34.     char *ibuf; /* pointer to queue */
  35.     int ibufsiz;    /* size of queue in bytes */
  36.     int ibufhd; /* head index of queue */
  37.     int ibuftl; /* tail index of queue */
  38.     int ibuflow;    /* low water mark */
  39.     int ibufhigh;   /* high water mark */
  40. } iorec;
  41.  
  42.  
  43. /*
  44.     Used by function Dfree().
  45. */
  46. typedef struct {
  47.     long b_free;    /* no. of free clusters on drive */
  48.     long b_total;   /* total no. of clusters on drive */
  49.     long b_secsiz;  /* no. of bytes in a sector */
  50.     long b_clsiz;   /* no. of sectors in a cluster */
  51. } disk_info;
  52.  
  53.  
  54. /*
  55.     Used by function Getmpb().
  56. */
  57. typedef struct md {
  58.     struct md *m_link;   /* next memory block       */
  59.     long       m_start;  /* start address of block  */
  60.     long       m_length; /* No. of bytes in block   */
  61.     long       m_own;    /* Memory block's owner ID */
  62. } md;
  63.  
  64. typedef struct {
  65.     md *mp_mfl;      /* memory free list        */
  66.     md *mp_mal;      /* memory allocated list   */
  67.     md *mp_rover;    /* roving pointer  (woof!) */
  68. } mpb;
  69.  
  70. /*
  71.     Used by function Getbpb().
  72. */
  73. typedef struct _bpb {
  74.     int sector_size_bytes;
  75.     int cl_sectors;
  76.     int cl_bytes;
  77.     int dir_length_sectors;
  78.     int FAT_size_sectors;
  79.     int FAT_sector;                /*  sector number of the second FAT.         */
  80.     int data_sector;            /*  sector number of the first data cluster */
  81.     int total_data_clusters;    /*    number of data clusters on the disk     */
  82.     int flags;                    /*  Miscellaneous Flags.                      */
  83. } bpb;
  84.  
  85.  
  86. /*
  87.     This structure is a bit field that represents the different components of
  88.     the date and time words.   A union structure was used so that a long 
  89.     could be used for the assignment from the gettime() function and the
  90.     bit-field structure could be used to easily decode the long word.
  91.  
  92.     Note:  This data structure was designed to work with Megamax C.  Not all
  93.             compilers allocate bit-fields in the same manner.  rpt
  94. */
  95. typedef union {
  96.     struct {
  97.         unsigned day     : 5;
  98.         unsigned month     : 4;
  99.         unsigned year     : 7;
  100.         unsigned seconds : 5;
  101.         unsigned minutes : 6;
  102.         unsigned hours     : 5;
  103.     } part;
  104.     long realtime;
  105. } datetime;
  106.  
  107.  
  108. typedef union {
  109.     struct {
  110.         unsigned day    : 5;
  111.         unsigned month    : 4;
  112.         unsigned year    : 7;
  113.     } part;
  114.     unsigned realdate;
  115. } dateinfo;
  116.  
  117. typedef union {
  118.     struct {
  119.         unsigned seconds : 5;
  120.         unsigned minutes : 6;
  121.         unsigned hours     : 5;
  122.     } part;
  123.     unsigned realtime;
  124. } timeinfo;
  125.  
  126.  
  127. /*    BIOS    (trap13)    */
  128. #define Getmpb(a) bios(0, a)
  129. #define    Bconstat(a)    (int)bios(1,a)
  130. #define    Bconin(a)    bios(2,a)
  131. #define    Bconout(a,b)    bios(3,a,b)
  132. #define    Rwabs(a,b,c,d,e)    bios(4,a,b,c,d,e)
  133. #define    Setexc(a,b)    bios(5,a,b)
  134. #define Tickcal()    bios(6)
  135. #define Getbpb(a)    (bpb *)bios(7, a)
  136. #define    Bcostat(a)    bios(8,a)
  137. #define    Mediach(a)    bios(9,a)
  138. #define    Drvmap()    bios(10)
  139. #define    Kbshift(a)    bios(11,a)
  140.  
  141. /*    XBIOS    (trap14)    */
  142. #define    Initmous(a,b,c)    xbios(0,a,b,c)
  143. #define    Physbase()    xbios(2)
  144. #define    Logbase()    xbios(3)
  145. #define    Getrez()    (int)xbios(4)
  146. #define    Setscreen(a,b,c)    xbios(5,a,b,c)
  147. #define    Setpalette(a)    xbios(6,a)
  148. #define    Setcolor(a,b)    (int)xbios(7,a,b)
  149. #define    Floprd(a,b,c,d,e,f,g)    (int)xbios(8,a,b,c,d,e,f,g)
  150. #define    Flopwr(a,b,c,d,e,f,g)    (int)xbios(9,a,b,c,d,e,f,g)
  151. #define    Flopfmt(a,b,c,d,e,f,g,h,i)    (int)xbios(10,a,b,c,d,e,f,g,h,i)
  152. #define    Midiws(a,b)    xbios(12,a,b)
  153. #define    Mfpint(a,b)    xbios(13,a,b)
  154. #define    Iorec(a)    (iorec *)xbios(14,a)
  155. #define    Rsconf(a,b,c,d,e,f)    xbios(15,a,b,c,d,e,f)
  156. #define    Keytbl(a,b,c)    xbios(16,a,b,c)
  157. #define    Random()    xbios(17)
  158. #define    Protobt(a,b,c,d)    xbios(18,a,b,c,d)
  159. #define    Flopver(a,b,c,d,e,f,g)    (int)xbios(19,a,b,c,d,e,f,g)
  160. #define    Scrdmp()    xbios(20)    /* WARNING: This Bind Incomplete */
  161. #define    Cursconf(a,b)    (int)xbios(21,a,b)
  162. #define    Settime(a)    xbios(22,a)
  163. #define    Gettime()    xbios(23)
  164. #define    Bioskeys()    xbios(24)
  165. #define    Ikbdws(a,b)    xbios(25,a,b)
  166. #define    Jdisint(a)    xbios(26,a)
  167. #define    Jenabint(a)    xbios(27,a)
  168. #define    Giaccess(a,b)    (char)xbios(28,a,b)
  169. #define    Offgibit(a)    xbios(29,a)
  170. #define    Ongibit(a)    xbios(30,a)
  171. #define    Xbtimer(a,b,c,d)    xbios(31,a,b,c,d)
  172. #define    Dosound(a)    xbios(32,a)
  173. #define    Setprt(a)    (int) xbios(33,a)
  174. #define    Kbdvbase()    (kbdvecs *)xbios(34)
  175. #define    Kbrate(a,b)    (int)xbios(35,a,b)
  176. #define    Prtblk()    xbios(36)
  177. #define Vsync()        xbios(37)
  178. #define Supexec(a)    xbios(38, a)
  179. #define Puntaes()    xbios(39)
  180.  
  181. /*    GEMDOS    (trap1)        */
  182. #define    Pterm0()    gemdos(0x0)
  183. #define    Cconin()    (int)gemdos(0x1)
  184. #define    Cconout(a)    gemdos(0x2,a)
  185. #define    Cauxin()    (int)gemdos(0x3)
  186. #define    Cauxout(a)    gemdos(0x4,a)
  187. #define    Cprnout(a)    gemdos(0x5,a)
  188. #define    Crawio(a)    gemdos(0x6,a)
  189. #define    Crawcin()    gemdos(0x7)
  190. #define    Cnecin()    gemdos(0x8)
  191. #define    Cconws(a)    gemdos(0x9,a)
  192. #define    Cconrs(a)    gemdos(0x0a,a)
  193. #define    Cconis()    (int)gemdos(0x0b)
  194. #define    Dsetdrv(a)    gemdos(0x0e,a)
  195. #define    Cconos()    (int)gemdos(0x10)
  196. #define    Cprnos()    (int)gemdos(0x11)
  197. #define    Cauxis()    (int)gemdos(0x12)
  198. #define    Cauxos()    (int)gemdos(0x13)
  199. #define    Dgetdrv()    (int)gemdos(0x19)
  200. #define    Fsetdta(a)    gemdos(0x1a,a)
  201. #define    Super(a)    gemdos(0x20,a)        /* NOTE:This name may change */
  202. #define    Tgetdate()    (int)gemdos(0x2a)
  203. #define    Tsetdate(a)    gemdos(0x2b,a)
  204. #define    Tgettime()    (int)gemdos(0x2c)
  205. #define    Tsettime(a)    gemdos(0x2d,a)
  206. #define    Fgetdta()    gemdos(0x2f)
  207. #define    Sversion()    (int)gemdos(0x30)
  208. #define    Ptermres(a,b)    gemdos(0x31,a,b)
  209. #define    Dfree(a,b)    gemdos(0x36,a,b)
  210. #define    Dcreate(a)    (int)gemdos(0x39,a)
  211. #define    Ddelete(a)    (int)gemdos(0x3a,a)
  212. #define    Dsetpath(a)    (int)gemdos(0x3b,a)
  213. #define    Fcreate(a,b)    (int)gemdos(0x3c,a,b)
  214. #define    Fopen(a,b)    (int)gemdos(0x3d,a,b)
  215. #define    Fclose(a)    gemdos(0x3e,a)
  216. #define    Fread(a,b,c)    gemdos(0x3f,a,b,c)
  217. #define    Fwrite(a,b,c)    gemdos(0x40,a,b,c)
  218. #define    Fdelete(a)    (int)gemdos(0x41,a)
  219. #define    Fseek(a,b,c)    gemdos(0x42,a,b,c)
  220. #define    Fattrib(a,b,c)    (int)gemdos(0x43,a,b,c)
  221. #define    Fdup(a)        (int)gemdos(0x45,a)
  222. #define    Fforce(a,b)    (int)gemdos(0x46,a,b)
  223. #define    Dgetpath(a,b)    (int)gemdos(0x47,a,b)
  224. #define    Malloc(a)    gemdos(0x48,a)
  225. #define    Mfree(a)    (int)gemdos(0x49,a)
  226. #define    Mshrink(a,b)    (int)gemdos(0x4a,0,a,b)    /* NOTE:Null parameter added */
  227. #define    Pexec(a,b,c,d)    gemdos(0x4b,a,b,c,d)
  228. #define    Pterm(a)    gemdos(0x4c,a)
  229. #define    Fsfirst(a,b)    (int)gemdos(0x4e,a,b)
  230. #define    Fsnext()    (int)gemdos(0x4f)
  231. #define    Frename(a,b,c)    (int)gemdos(0x56,a,b,c)
  232. #define    Fdatime(a,b,c)    (int)gemdos(0x57,a,b,c)
  233.  
  234. #endif
  235.