[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 | vsetpal() -- set a palette RAM entry to a specific color
|
---|
| 37 |
|
---|
| 38 | slot 0..15 color entry number
|
---|
| 39 | red 0..3 red value
|
---|
| 40 | grn 0..3 green value
|
---|
| 41 | blu 0..3 blue value
|
---|
| 42 | =============================================================================
|
---|
| 43 | */
|
---|
| 44 |
|
---|
[09d1345] | 45 | void vsetpal(int16_t slot, int16_t red, int16_t grn, int16_t blu)
|
---|
[f40a309] | 46 | {
|
---|
[09d1345] | 47 | register int16_t palval;
|
---|
[7258c6a] | 48 | uint16_t *pal;
|
---|
[f40a309] | 49 |
|
---|
| 50 | pal = PALETTE;
|
---|
| 51 |
|
---|
| 52 | palval = (slot << 6) |
|
---|
| 53 | ((red & 1) << 5) | ((red & 2) << 1) |
|
---|
| 54 | ((grn & 1) << 4) | (grn & 2) |
|
---|
| 55 | ((blu & 1) << 3) | ((blu & 2) >> 1);
|
---|
| 56 |
|
---|
[09d1345] | 57 | *pal = (uint16_t)palval ^ 0x003F;
|
---|
[f40a309] | 58 | }
|
---|
| 59 |
|
---|
| 60 | /*
|
---|
| 61 | =============================================================================
|
---|
| 62 | vsndpal() -- send a palette table to the video palette RAM
|
---|
| 63 |
|
---|
| 64 | pp pointer to a short [16][3] array,
|
---|
| 65 |
|
---|
| 66 | where:
|
---|
| 67 | pp[n][0] = blue value
|
---|
| 68 | pp[n][1] = green value
|
---|
| 69 | pp[n][2] = red value
|
---|
| 70 |
|
---|
| 71 | n = slot number (0..15)
|
---|
| 72 | =============================================================================
|
---|
| 73 | */
|
---|
| 74 |
|
---|
[7258c6a] | 75 | void vsndpal(int16_t pp[16][3])
|
---|
[f40a309] | 76 | {
|
---|
[7258c6a] | 77 | register int16_t i;
|
---|
[f40a309] | 78 |
|
---|
| 79 | for (i = 0; i < 16; i++)
|
---|
| 80 | vsetpal(i, pp[i][0], pp[i][1], pp[i][2]);
|
---|
| 81 | }
|
---|