Previous 199869 Revisions Next

r32142 Tuesday 16th September, 2014 at 23:49:02 UTC by hap
correct color prom resistors
[src/mame/video]skyfox.c

trunk/src/mame/video/skyfox.c
r32141r32142
3636***************************************************************************/
3737
3838#include "emu.h"
39#include "video/resnet.h"
3940#include "includes/skyfox.h"
4041
4142
r32141r32142
4445  Convert the color PROMs into a more useable format.
4546
4647  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:
4949
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
5454
5555***************************************************************************/
5656
57PALETTE_INIT_MEMBER(skyfox_state, skyfox)
57static const res_net_decode_info skyfox_decode_info =
5858{
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};
6066
61   for (int i = 0; i < 256; i++)
67static const res_net_info skyfox_net_info =
68{
69   RES_NET_VCC_5V | RES_NET_VBIAS_5V | RES_NET_VIN_TTL_OUT,
6270   {
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};
6476
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;
77PALETTE_INIT_MEMBER(skyfox_state, skyfox)
78{
79   const UINT8 *color_prom = memregion("proms")->base();
80   dynamic_array<rgb_t> rgb;
8381
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);
8684
8785   /* Grey scale for the background??? is wrong */
8886   for (int i = 0; i < 256; i++)
r32141r32142
9290}
9391
9492
95
9693/***************************************************************************
9794
9895                                Sprites Drawing
r32141r32142
173170
174171      for (dy = ystart; dy != yend; dy += yinc)
175172      {
176         for (dx = xstart; dx != xend; dx += xinc)
173         for (dx = xstart; dx != xend; dx += xinc, code++)
177174         {
178175            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);
180179         }
181180
182181         if (n == 2)
r32141r32142
229228
230229UINT32 skyfox_state::screen_update_skyfox(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
231230{
232   bitmap.fill(255, cliprect); // the bg is black
231   bitmap.fill(m_palette->black_pen(), cliprect);
233232   draw_background(bitmap, cliprect);
234233   draw_sprites(bitmap, cliprect);
235234   return 0;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team