home *** CD-ROM | disk | FTP | other *** search
/ Graphics 16,000 / graphics-16000.iso / msdos / viewers / pcshow / tardev.h < prev    next >
C/C++ Source or Header  |  1991-07-01  |  10KB  |  335 lines

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