trunk/src/mame/video/skyfox.c
| r32141 | r32142 | |
| 36 | 36 | ***************************************************************************/ |
| 37 | 37 | |
| 38 | 38 | #include "emu.h" |
| 39 | #include "video/resnet.h" |
| 39 | 40 | #include "includes/skyfox.h" |
| 40 | 41 | |
| 41 | 42 | |
| r32141 | r32142 | |
| 44 | 45 | Convert the color PROMs into a more useable format. |
| 45 | 46 | |
| 46 | 47 | There are three 256x4 palette PROMs (one per gun). |
| 47 | | I don't know the exact values of the resistors between the RAM and the |
| 48 | | RGB output. I assumed these values (the same as Commando) |
| 48 | The palette PROMs are connected to the RGB output this way: |
| 49 | 49 | |
| 50 | | bit 3 -- 220 ohm resistor -- RED/GREEN/BLUE |
| 51 | | -- 470 ohm resistor -- RED/GREEN/BLUE |
| 52 | | -- 1 kohm resistor -- RED/GREEN/BLUE |
| 53 | | bit 0 -- 2.2kohm resistor -- RED/GREEN/BLUE |
| 50 | bit 3 -- 110 ohm resistor -- RED/GREEN/BLUE |
| 51 | -- 220 ohm resistor -- RED/GREEN/BLUE |
| 52 | -- 680 ohm resistor -- RED/GREEN/BLUE |
| 53 | bit 0 -- 1.2kohm resistor -- RED/GREEN/BLUE |
| 54 | 54 | |
| 55 | 55 | ***************************************************************************/ |
| 56 | 56 | |
| 57 | | PALETTE_INIT_MEMBER(skyfox_state, skyfox) |
| 57 | static const res_net_decode_info skyfox_decode_info = |
| 58 | 58 | { |
| 59 | | const UINT8 *color_prom = memregion("proms")->base(); |
| 59 | 1, |
| 60 | 0, 255, // start/end |
| 61 | // R, G, B, |
| 62 | { 0, 0x100, 0x200, }, // offsets |
| 63 | { 0, 0, 0, }, // shifts |
| 64 | { 0xf, 0xf, 0xf, } // masks |
| 65 | }; |
| 60 | 66 | |
| 61 | | for (int i = 0; i < 256; i++) |
| 67 | static const res_net_info skyfox_net_info = |
| 68 | { |
| 69 | RES_NET_VCC_5V | RES_NET_VBIAS_5V | RES_NET_VIN_TTL_OUT, |
| 62 | 70 | { |
| 63 | | int bit0, bit1, bit2, bit3, r, g, b; |
| 71 | { RES_NET_AMP_NONE, 0, 0, 4, { 1200, 680, 220, 110 } }, |
| 72 | { RES_NET_AMP_NONE, 0, 0, 4, { 1200, 680, 220, 110 } }, |
| 73 | { RES_NET_AMP_NONE, 0, 0, 4, { 1200, 680, 220, 110 } } |
| 74 | } |
| 75 | }; |
| 64 | 76 | |
| 65 | | /* red component */ |
| 66 | | bit0 = (color_prom[i] >> 0) & 0x01; |
| 67 | | bit1 = (color_prom[i] >> 1) & 0x01; |
| 68 | | bit2 = (color_prom[i] >> 2) & 0x01; |
| 69 | | bit3 = (color_prom[i] >> 3) & 0x01; |
| 70 | | r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; |
| 71 | | /* green component */ |
| 72 | | bit0 = (color_prom[i + 256] >> 0) & 0x01; |
| 73 | | bit1 = (color_prom[i + 256] >> 1) & 0x01; |
| 74 | | bit2 = (color_prom[i + 256] >> 2) & 0x01; |
| 75 | | bit3 = (color_prom[i + 256] >> 3) & 0x01; |
| 76 | | g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; |
| 77 | | /* blue component */ |
| 78 | | bit0 = (color_prom[i + 2*256] >> 0) & 0x01; |
| 79 | | bit1 = (color_prom[i + 2*256] >> 1) & 0x01; |
| 80 | | bit2 = (color_prom[i + 2*256] >> 2) & 0x01; |
| 81 | | bit3 = (color_prom[i + 2*256] >> 3) & 0x01; |
| 82 | | b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; |
| 77 | PALETTE_INIT_MEMBER(skyfox_state, skyfox) |
| 78 | { |
| 79 | const UINT8 *color_prom = memregion("proms")->base(); |
| 80 | dynamic_array<rgb_t> rgb; |
| 83 | 81 | |
| 84 | | palette.set_pen_color(i, rgb_t(r, g, b)); |
| 85 | | } |
| 82 | compute_res_net_all(rgb, color_prom, skyfox_decode_info, skyfox_net_info); |
| 83 | palette.set_pen_colors(0, rgb, 256); |
| 86 | 84 | |
| 87 | 85 | /* Grey scale for the background??? is wrong */ |
| 88 | 86 | for (int i = 0; i < 256; i++) |
| r32141 | r32142 | |
| 92 | 90 | } |
| 93 | 91 | |
| 94 | 92 | |
| 95 | | |
| 96 | 93 | /*************************************************************************** |
| 97 | 94 | |
| 98 | 95 | Sprites Drawing |
| r32141 | r32142 | |
| 173 | 170 | |
| 174 | 171 | for (dy = ystart; dy != yend; dy += yinc) |
| 175 | 172 | { |
| 176 | | for (dx = xstart; dx != xend; dx += xinc) |
| 173 | for (dx = xstart; dx != xend; dx += xinc, code++) |
| 177 | 174 | { |
| 178 | 175 | gfx->transpen(bitmap, cliprect, code, 0, flipx, flipy, dx*8 + x, dy*8 + y, 0xff); |
| 179 | | code++; |
| 176 | |
| 177 | // wraparound y - BTANB: large sprites exiting the screen sometimes reappear on the other edge |
| 178 | gfx->transpen(bitmap, cliprect, code, 0, flipx, flipy, dx*8 + x, dy*8 + y - 256, 0xff); |
| 180 | 179 | } |
| 181 | 180 | |
| 182 | 181 | if (n == 2) |
| r32141 | r32142 | |
| 229 | 228 | |
| 230 | 229 | UINT32 skyfox_state::screen_update_skyfox(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 231 | 230 | { |
| 232 | | bitmap.fill(255, cliprect); // the bg is black |
| 231 | bitmap.fill(m_palette->black_pen(), cliprect); |
| 233 | 232 | draw_background(bitmap, cliprect); |
| 234 | 233 | draw_sprites(bitmap, cliprect); |
| 235 | 234 | return 0; |