[f40a309] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | vsetpal.c -- Buchla 700 color palette setup
|
---|
| 4 | Version 2 -- 1987-11-20 -- D.N. Lynx Crowe
|
---|
| 5 | =============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
[b28a12e] | 8 | #include "ram.h"
|
---|
[6262b5c] | 9 |
|
---|
[7258c6a] | 10 | #define PALETTE ((uint16_t *)0x280000L)
|
---|
[f40a309] | 11 |
|
---|
[7258c6a] | 12 | int16_t dfltpal[16][3] = {
|
---|
[f40a309] | 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 | */
|
---|
[7258c6a] | 48 |
|
---|
[f40a309] | 49 | void vsetpal(uint16_t slot, uint16_t red, uint16_t grn, uint16_t blu)
|
---|
[7258c6a] | 50 | {
|
---|
| 51 | register uint16_t palval;
|
---|
[f40a309] | 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 | =============================================================================
|
---|
[7258c6a] | 81 | */
|
---|
[f40a309] | 82 |
|
---|
[7258c6a] | 83 | void vsndpal(int16_t pp[16][3])
|
---|
[f40a309] | 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 | }
|
---|