/* tass_dos.1 -- first include file for DOS */ #ifdef __WATCOMC__ /* inline assembly language is a pain in the neck with Watcom C: it requires */ /* a ton of compiler-specific code; may its author slip on a banana peel!!!! */ #else /* assembly source pragma: replace "asm" by whatever works on your compiler */ /* it often is __asm__, by the way */ #define ASM asm #endif typedef union { void *A; /* to convert addresses into offset, segment */ long B; /* to convert longs into hiword, loword */ uint W[2]; /* W[0] : offset, W[1] : segment */ } VideoRec; typedef struct { uint mode; /* video mode */ uint horpix; /* pixels per horizontal line */ uint verlin; /* rows of pixels per screen */ uint colors; /* number of displayable colors, must be 16 */ } video; typedef byte Palette[65]; /* 65 bytes/palette: 17 for EGA colors & border */ /* + 16*3 = 48 for 16 DAC registers VGA & SVGA */ /* global tables for DOS */ static byte logLUT[256] = /* look-up table for log intensity display */ { 0, 1, 2, 3, 4, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15 }; static byte BitMask[4] = { 1, 2, 4, 8 }; /* 4 bit planes = 16 colors */ static Palette G16Pal = /* our own color palette */ { /* 16 colors palette registers */ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, /* 1 border (overscan) palette register */ 7, /* 16 colors times 3 DAC registers: R, G, B */ 0, 0, 0, 4, 4, 4, 8, 8, 8, 12, 12, 12, 17, 17, 17, 21, 21, 21, 25, 25, 25, 29, 29, 29, 34, 34, 34, 38, 38, 38, 42, 42, 42, 46, 46, 46, 51, 51, 51, 55, 55, 55, 59, 59, 59, 63, 63, 63 }; /* global variables for DOS */ static byte DacReg; /* current DAC Color Page */ static byte OldMod; /* former video mode */ static uint OldCur; /* former cursor status */ static Palette OldPal; /* former color palette */ static uint CRTC; /* address of CRTC */ static BitLine bitplane[4]; /* 4 bit planes = 16 colors */ static video Video; /* video mode specs */ static void *afont; /* address of our 8 by 16 font */ static uint rowsiz; /* # of bytes per row */ static uint rowlin; /* # of lines per character row, must be 16 */ static uint maxrow; /* # of rows per screen */