home *** CD-ROM | disk | FTP | other *** search
/ GRIPS 2: Government Rast…rocessing Software & Data / GRIPS_2.cdr / dos / imcomp / tardev.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-29  |  9.6 KB  |  336 lines

  1. /*
  2.  */
  3. #include "mk_crefs.h"
  4.  
  5. /*
  6.  *        Board types used for targa->boardType
  7.  */
  8. #define    TYPE_8     8
  9. #define    TYPE_16  16
  10. #define    TYPE_24  24
  11. #define    TYPE_32  32
  12. #define    TYPE_M8  -8
  13.  
  14. /*
  15.  * TARGA: 400 to 482 rows x 512 pixels/row X 16 bits/pixel     
  16.  */
  17.  
  18. #define XMIN    0
  19. #define    YMIN    0
  20. #define XRES    512            /*  X resolution */
  21. #define YRES    512            /*  Y Resolution */
  22. #define    YVISMAX    (2*targa->LinesPerField)    /*   Maximum visible Y coordinate */
  23. #define    YVISMIN    0                /*   Minimum visible Y coordiate */
  24. #define DEF_ROWS 400            /*  Default number of rows */
  25.  
  26.  
  27. #define DEF_IOBASE   0x220
  28. #define IOBASE    targa->iobase    /* io base location of graphics registers */
  29. #define MEMSEG   targa->memloc   /*  use the variable so we can use */
  30. #define SCNSEG   targa->memloc   /*  the one defined in TARGA */
  31. #define SRCBANK  (targa->memloc+0x0800)   /*  use high-bank as source bank */
  32. #define DESTBANK targa->memloc              /*  use lo-bank as destination bank */
  33. #define    DEF_MEMSEG 0xa000        /* Default screen memory */
  34.  
  35. /*
  36.  *                Output register definitions
  37.  */
  38. #define MODEREG (IOBASE+0xC00)    /*  Mode Register address */
  39. #define MASKREG    (IOBASE+0x800)    /*  Mask Registers */
  40. #define UNDERREG     (IOBASE+0x800)    /*  Underscan register */
  41. #define OVERREG        (IOBASE+0x802)    /*  overscan register */
  42. #define DESTREG    (IOBASE+0x802)     /*  Address of Page Select Lower Register */
  43. #define SRCREG    (IOBASE+0x803)     /*  Address of Page Select Upper Register */
  44. #define VCRCON    (IOBASE+0x400)     /*  Address of Contrast/VidSrc Register */
  45. #define BLNDREG  VCRCON
  46. #define    SATHUE    (IOBASE+0x402)    /* Satuation/Hue Register address */
  47. #define DRREG (IOBASE+0x401)    /* ADDRESS OF Controller Write Register */
  48. #define VERTPAN    (IOBASE+0x403)     /*  Address of Vertical Pan Register */
  49. #define BORDER    (IOBASE)    /*  Address of Page Select Lower Register */
  50.  
  51.  
  52. /*
  53.  *                Input register definitions
  54.  */
  55. #define VIDEOSTATUS    (IOBASE+0xC02)    /*  Video Status Register */
  56. #define RASTERREG    (IOBASE+0xC00)        /* Raster counter register */
  57.  
  58.  
  59.  
  60. /*
  61.  *            Default register values 
  62.  */
  63. #define DEF_MODE 1                /*  Default mode register value */
  64.                                 /*   Memory selected, 512x512, 1x */
  65.                                 /*   Display mode */
  66. #define DEF_MASK 0                /*  default memory mask */
  67. #define    DEF_SATURATION    0x4            /* default saturation value */
  68. #define    DEF_HUE    0x10        /* default hue value */
  69. #define    DEF_CONTRAST    0x10        /* default contrast value */
  70. #define    DEF_VIDSRC  0        /* default video source value - Composite */
  71. #define DEF_VERTPAN 56        /*  assumes 400-line output */
  72. #define DEF_BORDER  0        /*  default border color */
  73.  
  74.  
  75. /*  
  76.  *            MASK AND SHIFT VALUE FOR REGISTERS CONTAINING SUBFIELDS
  77.  */
  78. /*
  79.  *   ******************************************************
  80.  *                    MODE REGISTERS
  81.  *   ******************************************************
  82.  */
  83. #define MSK_MSEL 0xfffC        /*  memory select bits */
  84. #define SHF_MSEL 0x0000
  85. #define MSEL     1
  86.  
  87. #define MSK_IBIT 0xfffb        /*  Interlace bit */
  88. #define SHF_IBIT 2
  89.  
  90. #define MSK_RES     0xFFC7            /*   disp. resolution and screen select bits */
  91. #define SHF_RES  3
  92. #define S0_512X512_0        0        /*   512x512 resolution screen */
  93. #define S1_512X512_1        1
  94. #define S2_512X256_0        2        /*   512x256 resolution screen 0 */
  95. #define S3_512X256_1        3        /*   512x256 resolution screen 1 */
  96. #define S4_256X256_0        4        /*   256x256 resolution screen 0 */
  97. #define S5_256X256_1        5        /*      ....   */
  98. #define S6_256X256_2        6
  99. #define S7_256X256_3        7
  100.  
  101. #define MSK_REGWRITE    0xFFBF    /*   mask for display register write */
  102. #define SHF_REGWRITE    6
  103. #define REGINDEX        0        /*  to write an index value */
  104. #define REGVALUE        1        /*  to write a value */
  105.  
  106. #define MSK_BIT9        0xFF7F    /*  maks for high-order bit of DR's */
  107. #define SHF_BIT9        7        
  108.  
  109. #define MSK_TAPBITS        0xFCFF    /*  mask for setting the tap bits */
  110. #define SHF_TAPBITS        8    
  111.  
  112. #define    MSK_ZOOM        0xF3FF    /*  Mask for zoom factor */
  113. #define SHF_ZOOM        10
  114.  
  115. #define MSK_DISPLAY        0xCFFF    /*  Mask for display mode */
  116. #define SHF_DISPLAY        12
  117. #define MEMORY_MODE        0
  118. #define LIVE_FIXED        1
  119. #define OVERLAY_MODE    2
  120. #define LIVE_LIVE        3
  121. #define DEF_DISPLAY        0
  122.  
  123. #define MSK_CAPTURE        0xBFFF    /*  Mask for capture bit */
  124. #define SHF_CAPTURE     14
  125.  
  126. #define MSK_GENLOCK        0x7FFF    /*  MASK FOR GENLOCK */
  127. #define SHF_GENLOCK        15
  128. #define DEF_GENLOCK        0
  129. /*
  130.  *        Video status input register
  131.  */
  132. #define FIELDBIT    0x0001
  133. #define VIDEOLOSS 0x0002
  134. /*
  135.  *    VIDEO SOURCE/CONTROL REGISTER
  136.  */
  137. #define MSK_CONTRAST    0xFFC1
  138. #define SHF_CONTRAST    1
  139. #define MAX_CONTRAST    0x1f
  140.  
  141. #define MSK_RGBORCV    0xBF
  142. #define SHF_RGBORCV    6
  143. #define RGB            1
  144. #define CV                0
  145.  
  146. #define MSK_VCRORCAMERA    0x7F
  147. #define SHF_VCRORCAMERA    7
  148. #define VCR                1
  149. #define CAMERA                0
  150.  
  151.  /* 
  152.   *      HUE/SATUATION REGISTER
  153.   */
  154. #define    MSK_HUE            0xE0
  155. #define SHF_HUE            0
  156. #define MAX_HUE         0x1f
  157.  
  158. #define MSK_SATURATION  0x1F
  159. #define SHF_SATURATION  5
  160. #define MAX_SATURATION  0x07
  161.  
  162.  
  163. /*
  164.  *  *********************************************
  165.  *            Display register settings
  166.  *  *********************************************
  167.  *
  168.  *    Screen Positioning Registers:
  169.  *        DR 0-3
  170.  */
  171. #define     LEFTBORDER    0
  172. #define  DEF_LEFT   85
  173. #define  MIN_LEFT    75
  174. #define     MAX_LEFT    95
  175. #define     RIGHTBORDER    1
  176. #define  DEF_RIGHT       (DEF_LEFT+256)
  177. #define     TOPBORDER    2
  178. #define  DEF_TOP        40
  179. #define     MIN_TOP    20
  180. #define  BOTTOMBORDER   3
  181. #define  DEF_BOTTOM    (DEFTOP+DEFROWS/2)
  182. #define     MAX_BOTTOM    261
  183.  
  184. /*
  185.  *    REgisters which track 0-3
  186.  */
  187. #define    DR8    8
  188. #define PRESHIFT    DR8
  189. #define    EQU_DR8    DR0
  190. #define DR9    9
  191. #define EQU_DR9    DR1
  192. #define DR10    10
  193. #define EQU_DR10    DR2
  194. #define DR11    11
  195. #define EQU_DR11    DR3
  196.  
  197. /*
  198.  *    REQUIRED REGISTERS
  199.  */
  200. #define    DR4    4
  201. #define    DEF_DR4    352
  202. #define    DR5    5
  203. #define    DEF_DR5    1
  204. #define    DR6    6
  205. #define    DEF_DR6    0
  206. #define    DR7    7
  207. #define    DEF_DR7    511
  208. #define    DR12    12
  209. #define    DEF_DR12    20
  210. #define    DR13    13
  211. #define    DEF_DR13    22
  212. #define    DR14    14
  213. #define    DEF_DR14    0
  214. #define    DR15    15
  215. #define    DEF_DR15    511
  216. #define    DR16    16
  217. #define    DEF_DR16    0
  218. #define    DR17    17
  219. #define    DEF_DR17    0
  220. #define    DR18    18
  221. #define    DEF_DR18    0
  222. #define    DR19    19
  223. #define    DEF_DR19    4
  224.  
  225. /* interlace mode register & parameters */
  226. #define DR20    20
  227. #define    INTREG    0x14
  228. #define DEF_INT  0        /*  default to interlace mode 0 */
  229. #define MSK_INTERLACE 0x0003
  230.  
  231.  
  232.  
  233. struct    TARStruct {
  234.     /*            Board Configuration */
  235.     int   memloc;    /* memory segment */
  236.     int   iobase;    /*  IOBASE segment */
  237.     int   BytesPerPixel;  /* number of words per pixel */
  238.     int   RowsPerBank;   /* number of row per 64K bank */
  239.     int      MaxBanks;        /*   maximum bank id */
  240.     int   AddressShift; /*   number of bits to shift address */
  241.  
  242.     /*            Control registers */
  243.     int  mode;        /*  mode register */
  244.     int  Mask;        /*  mask register */
  245.     int  PageMode;    /*  current page mode (screen res. and page) */
  246.     unsigned  PageLower;        /*  Lower Page Select register */
  247.     unsigned  PageUpper;        /*  upper Page select register */
  248.     int  VCRCon;        /*  VCRContract register */
  249.     int  SatHue;        /* Hue and Saturation register */
  250.     long  BorderColor;    /*  Border color register */
  251.     int  VertShift;    /*  Vertical Pan Register */
  252.  
  253.     int    PanXOrig, PanYOrig;    /* x,y pan origin */
  254.  
  255.     /*             TARGA-SET PARAMETERS */ 
  256.     int  boardType;        /*  See TYPE_XX  IN THIS FILE */
  257.                         /*  FOR DEFINITION OF Board Types */
  258.     int  xOffset;        /* X-offset */
  259.     int  yOffset;        /*  Y-Offset */
  260.     int  LinesPerField;    /*  maximum visible row count */
  261.     int  InterlaceMode;    /*  desired interlace mode */
  262.     int  AlwaysGenLock;        /*  Genlock always on or not  */
  263.     int  Contrast;        /*  Desired Contrast */
  264.     int  Hue;        /*  Desired Hue */
  265.     int  Saturation;    /*  Desired Satuation */
  266.     int  RGBorCV;        /*  CV or RGB Input */
  267.     int  VCRorCamera;    /*  VCR or Camera */
  268.     int  ovrscnAvail, ovrscnOn; /*  ovrscnAvail   1  if Overscan installed */
  269.                                 /*  ovrscnOn  1 if overscan is stretching */
  270.     
  271.     /*            Display Registers */
  272.     int    DisplayRegister[22];
  273.     };
  274.  
  275. struct  M8Struct {
  276.     int  there;      /*  flag to indicate if m8 is present */
  277.                      /*  logical true if M8 present (i.e. 1) */
  278.                      /*  and logical false (0) otherwise */
  279.     int  inOffset;   /*  input offset */
  280.     int  inGain;     /*  input gain */
  281.     int  inputMux;  /*  input channel */
  282.     int  modeRegister;    /*   value of the mode register on the M8 top */
  283.     int  inMap, outMap;  /*  active input/output color map */
  284.     int  loopThru;        /*   logical flag if M8 loop-through is desired */
  285.                         /*  of CGA input 1---YES,  0---No     */
  286.     int  topFunction;   /*  currently selected top function */
  287.     int  CGAInterlace;  /*  interlace mode for  a CGA if used */
  288. };
  289.  
  290. #define M8MODE  0x400    /*  IO Offset for writes to M8 Mode register */
  291. #define M8WRITE 0x402    /*  Offset for writes to M8 function registers */
  292. #define M8READ  0x802    /*  Offset for reads from M8 function registers */
  293.  
  294. #define DEF_M8MODE        2
  295. #define DEF_M8GAIN        50
  296. #define DEF_M8OFFSET    50
  297. #define DEF_M8MUX        0
  298. #define DEF_M8INMAP        0
  299. #define DEF_M8OUTMAP    0
  300. #define DEF_CGAINTERLACE    3
  301.  
  302.  
  303. struct hdStruct {
  304.     char textSize;
  305.     char mapType;
  306.     char dataType;
  307.     int  mapOrig;
  308.     int  mapLength;
  309.     char CMapBits;
  310.     int  XOffset;
  311.     int  YOffset;
  312.     int  x;
  313.     int  y;
  314.     int  dataBits, imType;
  315.     } ;
  316.  
  317.  
  318. /* stroke font file */
  319.  
  320. typedef struct{
  321.     int width;            /* width of character */
  322.     int height;            /* height of char from baseline */
  323.     int descent;            /* descent below baseline */
  324.     int index;            /* index into stroke table */
  325. } SFONTCHAR;
  326.  
  327. typedef struct {
  328.     int dx;                /* dx of character */
  329.     int dy;                /* dy of character */
  330.     int dd;                /* dy of descenders */
  331.     int first;            /* value of first char in font */
  332.     int last;            /* value of last char in font */
  333.     int *strokes;            /* where the strokes are located */
  334.     SFONTCHAR *info;        /* info on each character */
  335. } SFONT;
  336.