|
|
1.1 root 1: /* $Id: */
2:
3: /****************************************************************************
4: * @format.tab-size 4 (Plain Text/Source Code File Header) *
5: * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
6: * *
7: * Copyright 2004 Rob Swindell - http://www.synchro.net/copyright.html *
8: * *
9: * This library is free software; you can redistribute it and/or *
10: * modify it under the terms of the GNU Lesser General Public License *
11: * as published by the Free Software Foundation; either version 2 *
12: * of the License, or (at your option) any later version. *
13: * See the GNU Lesser General Public License for more details: lgpl.txt or *
14: * http://www.fsf.org/copyleft/lesser.html *
15: * *
16: * Anonymous FTP access to the most recent released source is available at *
17: * ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
18: * *
19: * Anonymous CVS access to the development source and modification history *
20: * is available at cvs.synchro.net:/cvsroot/sbbs, example: *
21: * cvs -d :pserver:[email protected]:/cvsroot/sbbs login *
22: * (just hit return, no password is necessary) *
23: * cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src *
24: * *
25: * For Synchronet coding style and modification guidelines, see *
26: * http://www.synchro.net/source.html *
27: * *
28: * You are encouraged to submit any modifications (preferably in Unix diff *
29: * format) via e-mail to [email protected] *
30: * *
31: * Note: If this box doesn't appear square, then you need to fix your tabs. *
32: ****************************************************************************/
33:
34: #ifndef _VIDMODES_H_
35: #define _VIDMODES_H_
36:
37: #include "ciolib.h"
38:
39: struct video_params {
40: int mode;
41: int palette;
42: int cols;
43: int rows;
44: int curs_start;
45: int curs_end;
46: int charheight;
47: int charwidth;
48: };
49:
50: enum {
51: MONO_PALETTE
52: ,GREYSCALE_PALETTE
53: ,COLOUR_PALETTE
54: };
55:
56: static struct video_params vparams[] = {
57: /* BW 40x25 */
58: {BW40, GREYSCALE_PALETTE, 40, 25, 14, 15, 16, 8},
59: /* CO 40x25 */
60: {C40, COLOUR_PALETTE, 40, 25, 14, 15, 16, 8},
61: /* BW 80x25 */
62: {BW80, GREYSCALE_PALETTE, 80, 25, 14, 15, 16, 8},
63: /* CO 80x25 */
64: {C80, COLOUR_PALETTE, 80, 25, 14, 15, 16, 8},
65: /* MONO */
66: {MONO, 0, 80, 25, 14, 15, 16, 8},
67: /* CO 40x14 */
68: {C40X14, COLOUR_PALETTE, 40, 14, 14, 15, 16, 8},
69: /* CO 40x21 */
70: {C40X21, COLOUR_PALETTE, 40, 21, 14, 15, 16, 8},
71: /* CO 40x28 */
72: {C40X28, COLOUR_PALETTE, 40, 28, 12, 13, 14, 8},
73: /* CO 40x43 */
74: {C40X43, COLOUR_PALETTE, 40, 43, 7, 7, 8, 8},
75: /* CO 40x50 */
76: {C40X50, COLOUR_PALETTE, 40, 50, 7, 7, 8, 8},
77: /* CO 40x60 */
78: {C40X60, COLOUR_PALETTE, 40, 60, 7, 7, 8, 8},
79: /* CO 80x14 */
80: {C80X14, COLOUR_PALETTE, 80, 14, 14, 15, 16, 8},
81: /* CO 80x21 */
82: {C80X21, COLOUR_PALETTE, 80, 21, 14, 15, 16, 8},
83: /* CO 80x28 */
84: {C80X28, COLOUR_PALETTE, 80, 28, 12, 13, 14, 8},
85: /* CO 80x43 */
86: {C80X43, COLOUR_PALETTE, 80, 43, 7, 7, 8, 8},
87: /* CO 80x50 */
88: {C80X50, COLOUR_PALETTE, 80, 50, 7, 7, 8, 8},
89: /* CO 80x60 */
90: {C80X60, COLOUR_PALETTE, 80, 60, 7, 7, 8, 8},
91: /* B 40x14 */
92: {BW40X14, GREYSCALE_PALETTE, 40, 14, 14, 15, 16, 8},
93: /* BW 40x21 */
94: {BW40X21, GREYSCALE_PALETTE, 40, 21, 14, 15, 16, 8},
95: /* BW 40x28 */
96: {BW40X28, GREYSCALE_PALETTE, 40, 28, 12, 13, 14, 8},
97: /* BW 40x43 */
98: {BW40X43, GREYSCALE_PALETTE, 40, 43, 7, 7, 8, 8},
99: /* BW 40x50 */
100: {BW40X50, GREYSCALE_PALETTE, 40, 50, 7, 7, 8, 8},
101: /* BW 40x60 */
102: {BW40X60, GREYSCALE_PALETTE, 40, 60, 7, 7, 8, 8},
103: /* BW 80x14 */
104: {BW80X14, GREYSCALE_PALETTE, 80, 14, 14, 15, 16, 8},
105: /* BW 80x21 */
106: {BW80X21, GREYSCALE_PALETTE, 80, 21, 14, 15, 16, 8},
107: /* BW 80x28 */
108: {BW80X28, GREYSCALE_PALETTE, 80, 28, 12, 13, 14, 8},
109: /* BW 80x43 */
110: {BW80X43, GREYSCALE_PALETTE, 80, 43, 7, 7, 8, 8},
111: /* BW 80x50 */
112: {BW80X50, GREYSCALE_PALETTE, 80, 50, 7, 7, 8, 8},
113: /* BW 80x60 */
114: {BW80X60, GREYSCALE_PALETTE, 80, 60, 7, 7, 8, 8},
115: /* MONO 80x14 */
116: {MONO14, MONO_PALETTE, 80, 14, 14, 15, 16, 8},
117: /* MONO 80x21 */
118: {MONO21, MONO_PALETTE, 80, 21, 14, 15, 16, 8},
119: /* MONO 80x28 */
120: {MONO28, MONO_PALETTE, 80, 28, 12, 13, 14, 8},
121: /* MONO 80x43 */
122: {MONO43, MONO_PALETTE, 80, 43, 7, 7, 8, 8},
123: /* MONO 80x50 */
124: {MONO50, MONO_PALETTE, 80, 50, 7, 7, 8, 8},
125: /* MONO 80x60 */
126: {MONO60, MONO_PALETTE, 80, 60, 7, 7, 8, 8},
127: /* Magical C4350 Mode */
128: {C4350, COLOUR_PALETTE, 80, 50, 7, 7, 8, 8},
129: };
130:
131: #define NUMMODES (sizeof(vparams) / sizeof(struct video_params))
132:
133: static unsigned char palettes[][16] = {
134: /* Mono */
135: { 0x00, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
136: 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07
137: },
138: /* Black and White */
139: { 0x00, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
140: 0x08, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f
141: },
142: /* Colour */
143: { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
144: 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
145: }
146: };
147:
148: /* Entry type for the DAC table. Each value is actually 6 bits wide. */
149: struct dac_colors {
150: BYTE red;
151: BYTE green;
152: BYTE blue;
153: };
154:
155: static struct dac_colors dac_default16[] = {
156: {0, 0, 0}, {0, 0, 42}, {0, 42, 0}, {0, 42, 42},
157: {42, 0, 0}, {42, 0, 42}, {42, 21, 0}, {42, 42, 42},
158: {21, 21, 21}, {21, 21, 63}, {21, 63, 21}, {21, 63, 63},
159: {63, 21, 21}, {63, 21, 63}, {63, 63, 21}, {63, 63, 63}
160: };
161:
162: static int find_vmode(int mode)
163: {
164: unsigned i;
165:
166: for (i = 0; i < NUMMODES; i++)
167: if (vparams[i].mode == mode)
168: return i;
169:
170: return -1;
171: }
172:
173: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.