source: buchla-68k/vlib/vsetpal.c@ f7c91fc

Last change on this file since f7c91fc was f40a309, checked in by Thomas Lopatic <thomas@…>, 8 years ago

Unix line breaks.

  • Property mode set to 100644
File size: 1.9 KB
RevLine 
[f40a309]1/*
2 =============================================================================
3 vsetpal.c -- Buchla 700 color palette setup
4 Version 2 -- 1987-11-20 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#define PALETTE ((unsigned *)0x280000L)
9
10short dfltpal[16][3] = {
11
12/* R G B color */
13
14 {0, 0, 0}, /* 0: Black */
15 {0, 1, 0}, /* 1: Dark Gray */
16 {0, 0, 2}, /* 2: Dark Blue */
17 {0, 0, 3}, /* 3: Light Blue */
18 {0, 2, 0}, /* 4: Dark Green */
19 {0, 3, 0}, /* 5: Light Green */
20 {0, 2, 2}, /* 6: Dark Cyan */
21 {0, 3, 3}, /* 7: Light Cyan */
22 {3, 0, 0}, /* 8: Red */
23 {3, 1, 0}, /* 9: Orange */
24 {3, 0, 3}, /* 10: Purple */
25 {3, 1, 2}, /* 11: Magenta */
26 {3, 2, 0}, /* 12: Brown */
27 {2, 3, 0}, /* 13: Yellow */
28 {2, 2, 2}, /* 14: Light Gray */
29 {3, 3, 3}, /* 15: White */
30};
31
32/*
33
34*/
35
36/*
37 =============================================================================
38 vsetpal() -- set a palette RAM entry to a specific color
39
40 slot 0..15 color entry number
41 red 0..3 red value
42 grn 0..3 green value
43 blu 0..3 blue value
44 =============================================================================
45*/
46
47vsetpal(slot, red, grn, blu)
48register unsigned slot, red, grn, blu;
49{
50 register unsigned palval;
51 unsigned *pal;
52
53 pal = PALETTE;
54
55 palval = (slot << 6) |
56 ((red & 1) << 5) | ((red & 2) << 1) |
57 ((grn & 1) << 4) | (grn & 2) |
58 ((blu & 1) << 3) | ((blu & 2) >> 1);
59
60 *pal = palval ^ 0x003F;
61}
62
63/*
64
65*/
66
67/*
68 =============================================================================
69 vsndpal() -- send a palette table to the video palette RAM
70
71 pp pointer to a short [16][3] array,
72
73 where:
74 pp[n][0] = blue value
75 pp[n][1] = green value
76 pp[n][2] = red value
77
78 n = slot number (0..15)
79 =============================================================================
80*/
81
82vsndpal(pp)
83short pp[16][3];
84{
85 register short i;
86
87 for (i = 0; i < 16; i++)
88 vsetpal(i, pp[i][0], pp[i][1], pp[i][2]);
89}
Note: See TracBrowser for help on using the repository browser.