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

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

Zero redundant declarations.

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