home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / utilit~1 / lack.zoo / gemlib / vdi.c < prev   
Encoding:
C/C++ Source or Header  |  1993-09-27  |  2.0 KB  |  74 lines

  1. #define __IN_VDI_C
  2. #include "common.h"
  3. /* vdi binding arrays (extern everywhere else) */
  4. unsigned short    _contrl[CNTRLMAX];
  5. short        _intin[INTINMAX];
  6. short        _intout[INTOUTMAX];
  7. short        _ptsin[2 * PTSINMAX];    /* upto PTSINMAX vertices are allowed
  8.                        - currently 1024 */
  9. short        _ptsout[2 * PTSOUTMAX];    /* likewise */
  10.  
  11. /*
  12.  * aes binding arrays  - we need only global, other overlapped with
  13.  * arrays for vdi - see common.h
  14.  */
  15.  
  16. /* vdi binding params */
  17. void    *_vdiparams[5] =       { (void *)&_contrl[0],
  18.                  (void *)&_intin[0],
  19.                  (void *)&_ptsin[0],
  20.                  (void *)&_intout[0],
  21.                  (void *)&_ptsout[0] };
  22.  
  23.  
  24. /* 
  25.  * the common interface to vdi
  26.  *    void __vdi__(coded contrl, handle);
  27.  *    unsigned long coded contrl;
  28.  *    int handle;
  29.  * coded contrl:
  30.  *    DD BB CC AA
  31.  * DD : subfunc         (_contrl[5])    5 bits
  32.  * BB : nvert. _ptsin    (_contrl[1])    11 (== # vertices, size = 2 * CC)
  33.  * CC : sizeof _intin     (_contrl[3])    8 bits
  34.  * AA : vdi opcode    (_contrl[0])    8
  35.  *
  36.  * output : void (because it is so inconsistent, individual binding funcs
  37.  *          will pull info out of the appro. binding arrays)
  38.  */
  39.  
  40. void __vdi__(unsigned long coded_contrl, int handle)
  41. {
  42.     /* decode contrl */
  43.     _contrl[0] = (unsigned short)(coded_contrl & 0xff);
  44.     _contrl[3] = (unsigned short)((coded_contrl >>= 8) & 0xff);
  45.     _contrl[1] = (unsigned short)((coded_contrl >>= 8) & 0x7ff);
  46.     _contrl[5] = (unsigned short)(coded_contrl >> 11);
  47.     
  48.     _contrl[6] = handle;
  49.     
  50.     /* call vdi */
  51.     __asm__ volatile
  52.     ("     movl    %0,    d1
  53.         movq    #0x73, d0
  54.         trap    #2"
  55.      :                /* no outputs */
  56.      : "g"(&_vdiparams[0])    /* inputs     */
  57.      : "d0", "d1", "d2", "a0", "a1", "a2"    /* clobbered regs */
  58.      );
  59. }
  60.  
  61. void vdi(void)
  62. {
  63.     __asm__ volatile
  64.     ("     movl    %0,    d1
  65.         movq    #0x73, d0
  66.         trap    #2"
  67.      :                /* no outputs */
  68.      : "g"(&_vdiparams[0])    /* inputs     */
  69.      : "d0", "d1", "d2", "a0", "a1", "a2"    /* clobbered regs */
  70.      );
  71. }
  72. /* -eof- */
  73.  
  74.