trunk/src/mame/video/finalizr.c
| r30595 | r30596 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | #include "emu.h" |
| 10 | #include "video/resnet.h" |
| 10 | 11 | #include "includes/finalizr.h" |
| 11 | 12 | |
| 12 | 13 | |
| 14 | /*************************************************************************** |
| 15 | |
| 16 | The palette PROMs are connected to the RGB output this way: |
| 17 | |
| 18 | bit 7 -- 220 ohm resistor -- \ |
| 19 | -- 470 ohm resistor -- | -- 470 ohm pulldown resistor -- GREEN |
| 20 | -- 1 kohm resistor -- | |
| 21 | -- 2.2 kohm resistor -- / |
| 22 | -- 220 ohm resistor -- \ |
| 23 | -- 470 ohm resistor -- | -- 470 ohm pulldown resistor -- RED |
| 24 | -- 1 kohm resistor -- | |
| 25 | bit 0 -- 2.2 kohm resistor -- / |
| 26 | |
| 27 | |
| 28 | bit 3 -- 220 ohm resistor -- \ |
| 29 | -- 470 ohm resistor -- | -- 470 ohm pulldown resistor -- BLUE |
| 30 | -- 1 kohm resistor -- | |
| 31 | bit 0 -- 2.2 kohm resistor -- / |
| 32 | |
| 33 | ***************************************************************************/ |
| 34 | |
| 13 | 35 | PALETTE_INIT_MEMBER(finalizr_state, finalizr) |
| 14 | 36 | { |
| 15 | 37 | const UINT8 *color_prom = memregion("proms")->base(); |
| 38 | static const int resistances[4] = { 2200, 1000, 470, 220 }; |
| 39 | double rweights[4], gweights[4], bweights[4]; |
| 16 | 40 | int i; |
| 17 | 41 | |
| 42 | /* compute the color output resistor weights */ |
| 43 | compute_resistor_weights(0, 255, -1.0, |
| 44 | 4, &resistances[0], rweights, 470, 0, |
| 45 | 4, &resistances[0], gweights, 470, 0, |
| 46 | 4, &resistances[0], bweights, 470, 0); |
| 47 | |
| 18 | 48 | /* create a lookup table for the palette */ |
| 19 | 49 | for (i = 0; i < 0x20; i++) |
| 20 | 50 | { |
| 21 | | int r = pal4bit(color_prom[i + 0x00] >> 0); |
| 22 | | int g = pal4bit(color_prom[i + 0x00] >> 4); |
| 23 | | int b = pal4bit(color_prom[i + 0x20] >> 0); |
| 51 | int bit0, bit1, bit2, bit3; |
| 52 | int r, g, b; |
| 24 | 53 | |
| 54 | /* red component */ |
| 55 | bit0 = (color_prom[i] >> 0) & 0x01; |
| 56 | bit1 = (color_prom[i] >> 1) & 0x01; |
| 57 | bit2 = (color_prom[i] >> 2) & 0x01; |
| 58 | bit3 = (color_prom[i] >> 3) & 0x01; |
| 59 | r = combine_4_weights(rweights, bit0, bit1, bit2, bit3); |
| 60 | |
| 61 | /* green component */ |
| 62 | bit0 = (color_prom[i] >> 4) & 0x01; |
| 63 | bit1 = (color_prom[i] >> 5) & 0x01; |
| 64 | bit2 = (color_prom[i] >> 6) & 0x01; |
| 65 | bit3 = (color_prom[i] >> 7) & 0x01; |
| 66 | g = combine_4_weights(gweights, bit0, bit1, bit2, bit3); |
| 67 | |
| 68 | /* blue component */ |
| 69 | bit0 = (color_prom[i + 0x20] >> 0) & 0x01; |
| 70 | bit1 = (color_prom[i + 0x20] >> 1) & 0x01; |
| 71 | bit2 = (color_prom[i + 0x20] >> 2) & 0x01; |
| 72 | bit3 = (color_prom[i + 0x20] >> 3) & 0x01; |
| 73 | b = combine_4_weights(bweights, bit0, bit1, bit2, bit3); |
| 74 | |
| 25 | 75 | palette.set_indirect_color(i, rgb_t(r, g, b)); |
| 26 | 76 | } |
| 27 | 77 | |