|
|
1.1 root 1: #ifndef lint
2: static char *rcsid_apa8c_c = "$Header: apa8c.c,v 10.1 86/11/19 10:39:58 jg Exp $";
3: #endif lint
4: /* apa8c.c - APA8C controller initialization
5: *
6: * apa8c_init APA8C initialization routine
7: * apa8c_set_colors set defualt colors
8: *
9: * Author:
10: * Scott Bates
11: * Brown University
12: * IRIS, Box 1946
13: * Providence, RI 02912
14: *
15: *
16: * Copyright (c) 1986 Brown University
17: *
18: * Permission to use, copy, modify and distribute this software and its
19: * documentation for any purpose and without fee is hereby granted, provided
20: * that the above copyright notice appear in all copies, and that both
21: * that copyright notice and this permission notice appear in supporting
22: * documentation, and that the name of Brown University not be used in
23: * advertising or publicity pertaining to distribution of the software
24: * without specific, written prior permission. Brown University makes no
25: * representations about the suitability of this software for any purpose.
26: * It is provided "as-is" without express or implied warranty.
27: */
28:
29: #include "private.h"
30: #include "bitblt.h"
31: #include "apa8c.h"
32:
33: /*
34: * Initialize APA8C
35: */
36:
37: apa8c_init()
38: {
39: u_short tmp;
40:
41: #ifdef TRACE_X
42: fprintf (stderr, "In apa8c_init\n");
43: fflush (stderr);
44: #endif TRACE_X
45:
46: /*
47: * Initialize (reset) the APA8C screen
48: */
49:
50: /*
51: * Set up the write and data mask.
52: */
53:
54: SET_APA8C_WRITEMASK(NOMASK);
55: SET_APA8C_DATAMASK(HIDDEN_DM);
56:
57: /*
58: * Set up the APA8C control register to use its system read/write
59: * calls in the X direction.
60: */
61:
62: SET_APA8C_FC(DCR_VEN | DCR_SEN | DCR_SWR | DCR_X | HIDDEN_FUNC);
63:
64: /*
65: * Set up the color plane select register and foreground/background
66: * registers.
67: */
68:
69: *(u_short *)CPS_REG = DEFAULT_CPS;
70: *(u_short *)FGBG_REG = DEFAULT_FGBG;
71:
72: /*
73: * Set default colors in Video Look-up Table.
74: */
75:
76: apa8c_set_colors();
77:
78: /*
79: * Test for the APA8C screen.
80: */
81:
82: tmp = *(u_short *)SCREEN_BASE;
83: *(u_short *)SCREEN_BASE = 0x0F0F;
84: if (*(u_short *)SCREEN_BASE != 0x0F0F) {
85: /*
86: * Log error and exit
87: */
88:
89: DeviceError("apa8 color not found !!");
90: exit(2);
91: }
92: *(u_short*)SCREEN_BASE = tmp;
93: }
94:
95: /*
96: * Sets default foreground and background colors in
97: * video look-up table. FG_COLOR and BG_COLOR are default
98: * colors. They are defined in apa8c.h
99: */
100:
101: static
102: apa8c_set_colors()
103: {
104: register i;
105:
106: #ifdef TRACE_X
107: fprintf (stderr, "In apa8c_set_colors\n");
108: fflush (stderr);
109: #endif TRACE_X
110:
111: for (i = 0; i < VLT_SIZE; i++) {
112: if (i == 15)
113: *(u_short *)VLT_REG = (u_short) (i | FG_COLOR);
114: else
115: *(u_short *)VLT_REG = (u_short) (i | BG_COLOR);
116: }
117: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.