summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2026-04-16 17:50:11 +0200
committer hap <happppp@users.noreply.github.com>2026-04-16 17:50:11 +0200
commit84ffd54c16f670524918ee4d96d283d1a9012962 (patch)
tree9336013a3db36bccb6921b70465dbfe136254f42
parent521e4263581adaab86b9d0327f93686ca1399cbf (diff)
galaga,bosco,digdug: use resnet for palette
-rw-r--r--src/mame/namco/bosco.cpp41
-rw-r--r--src/mame/namco/digdug.cpp28
-rw-r--r--src/mame/namco/galaga_v.cpp41
-rw-r--r--src/mame/namco/namcos22.cpp14
-rw-r--r--src/mame/nintendo/punchout_v.cpp26
5 files changed, 99 insertions, 51 deletions
diff --git a/src/mame/namco/bosco.cpp b/src/mame/namco/bosco.cpp
index 58c94f37b28..4ab866cac45 100644
--- a/src/mame/namco/bosco.cpp
+++ b/src/mame/namco/bosco.cpp
@@ -17,41 +17,60 @@
#include "galaga.h"
#include "bosco.h"
+#include "video/resnet.h"
+
void bosco_state::bosco_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
+ static constexpr int resistances[3] = { 1000, 470, 220 };
+
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
+ compute_resistor_weights(0, 255, -1.0,
+ 3, &resistances[0], rweights, 0, 0,
+ 3, &resistances[0], gweights, 0, 0,
+ 2, &resistances[1], bweights, 0, 0);
// core palette
for (int i = 0; i < 32; i++)
{
int bit0, bit1, bit2;
+ // red component
bit0 = BIT(*color_prom, 0);
bit1 = BIT(*color_prom, 1);
bit2 = BIT(*color_prom, 2);
- int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const r = combine_weights(rweights, bit0, bit1, bit2);
+
+ // green component
bit0 = BIT(*color_prom, 3);
bit1 = BIT(*color_prom, 4);
bit2 = BIT(*color_prom, 5);
- int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = 0;
- bit1 = BIT(*color_prom, 6);
- bit2 = BIT(*color_prom, 7);
- int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const g = combine_weights(gweights, bit0, bit1, bit2);
+
+ // blue component
+ bit0 = BIT(*color_prom, 6);
+ bit1 = BIT(*color_prom, 7);
+ int const b = combine_weights(bweights, bit0, bit1);
palette.set_indirect_color(i, rgb_t(r, g, b));
color_prom++;
}
+ // r/g low bit is n/c and effectively becomes a pulldown
+ double rsweights[2], gsweights[2], bsweights[2];
+ compute_resistor_weights(0, 255, -1.0,
+ 2, &resistances[1], rsweights, resistances[0], 0,
+ 2, &resistances[1], gsweights, resistances[0], 0,
+ 2, &resistances[1], bsweights, 0, 0);
+
// palette for the stars
for (int i = 0; i < 64; i++)
{
- static constexpr int map[4] = { 0x00, 0x47, 0x97 ,0xde };
-
- int const r = map[(i >> 0) & 0x03];
- int const g = map[(i >> 2) & 0x03];
- int const b = map[(i >> 4) & 0x03];
+ int const r = combine_weights(rsweights, BIT(i, 0), BIT(i, 1));
+ int const g = combine_weights(gsweights, BIT(i, 2), BIT(i, 3));
+ int const b = combine_weights(bsweights, BIT(i, 4), BIT(i, 5));
palette.set_indirect_color(32 + i, rgb_t(r, g, b));
}
diff --git a/src/mame/namco/digdug.cpp b/src/mame/namco/digdug.cpp
index 2cab91a7942..858ca8cd209 100644
--- a/src/mame/namco/digdug.cpp
+++ b/src/mame/namco/digdug.cpp
@@ -4,6 +4,8 @@
#include "galaga.h"
#include "digdug.h"
+#include "video/resnet.h"
+
/***************************************************************************
@@ -27,23 +29,37 @@
void digdug_state::digdug_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
+ static constexpr int resistances[3] = { 1000, 470, 220 };
+
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
+ compute_resistor_weights(0, 255, -1.0,
+ 3, &resistances[0], rweights, 0, 0,
+ 3, &resistances[0], gweights, 0, 0,
+ 2, &resistances[1], bweights, 0, 0);
+ // core palette
for (int i = 0; i < 32; i++)
{
int bit0, bit1, bit2;
+ // red component
bit0 = BIT(*color_prom, 0);
bit1 = BIT(*color_prom, 1);
bit2 = BIT(*color_prom, 2);
- int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const r = combine_weights(rweights, bit0, bit1, bit2);
+
+ // green component
bit0 = BIT(*color_prom, 3);
bit1 = BIT(*color_prom, 4);
bit2 = BIT(*color_prom, 5);
- int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = 0;
- bit1 = BIT(*color_prom, 6);
- bit2 = BIT(*color_prom, 7);
- int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const g = combine_weights(gweights, bit0, bit1, bit2);
+
+ // blue component
+ bit0 = BIT(*color_prom, 6);
+ bit1 = BIT(*color_prom, 7);
+ int const b = combine_weights(bweights, bit0, bit1);
+
palette.set_indirect_color(i, rgb_t(r, g, b));
color_prom++;
}
diff --git a/src/mame/namco/galaga_v.cpp b/src/mame/namco/galaga_v.cpp
index 907f6e20f2a..e9a2042664e 100644
--- a/src/mame/namco/galaga_v.cpp
+++ b/src/mame/namco/galaga_v.cpp
@@ -11,6 +11,8 @@
#include "emu.h"
#include "galaga.h"
+#include "video/resnet.h"
+
#define LOG_DEBUG (1U << 1)
#define LOG_ALL (LOG_DEBUG)
@@ -43,37 +45,54 @@
void galaga_state::galaga_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
+ static constexpr int resistances[3] = { 1000, 470, 220 };
+
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
+ compute_resistor_weights(0, 255, -1.0,
+ 3, &resistances[0], rweights, 0, 0,
+ 3, &resistances[0], gweights, 0, 0,
+ 2, &resistances[1], bweights, 0, 0);
// core palette
for (int i = 0; i < 32; i++)
{
int bit0, bit1, bit2;
+ // red component
bit0 = BIT(*color_prom, 0);
bit1 = BIT(*color_prom, 1);
bit2 = BIT(*color_prom, 2);
- int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const r = combine_weights(rweights, bit0, bit1, bit2);
+
+ // green component
bit0 = BIT(*color_prom, 3);
bit1 = BIT(*color_prom, 4);
bit2 = BIT(*color_prom, 5);
- int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = 0;
- bit1 = BIT(*color_prom, 6);
- bit2 = BIT(*color_prom, 7);
- int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const g = combine_weights(gweights, bit0, bit1, bit2);
+
+ // blue component
+ bit0 = BIT(*color_prom, 6);
+ bit1 = BIT(*color_prom, 7);
+ int const b = combine_weights(bweights, bit0, bit1);
palette.set_indirect_color(i, rgb_t(r, g, b));
color_prom++;
}
+ // r/g low bit is n/c and effectively becomes a pulldown
+ double rsweights[2], gsweights[2], bsweights[2];
+ compute_resistor_weights(0, 255, -1.0,
+ 2, &resistances[1], rsweights, resistances[0], 0,
+ 2, &resistances[1], gsweights, resistances[0], 0,
+ 2, &resistances[1], bsweights, 0, 0);
+
// palette for the stars
for (int i = 0; i < 64; i++)
{
- static constexpr int map[4] = { 0x00, 0x47, 0x97 ,0xde };
-
- int const r = map[(i >> 0) & 0x03];
- int const g = map[(i >> 2) & 0x03];
- int const b = map[(i >> 4) & 0x03];
+ int const r = combine_weights(rsweights, BIT(i, 0), BIT(i, 1));
+ int const g = combine_weights(gsweights, BIT(i, 2), BIT(i, 3));
+ int const b = combine_weights(bsweights, BIT(i, 4), BIT(i, 5));
palette.set_indirect_color(32 + i, rgb_t(r, g, b));
}
diff --git a/src/mame/namco/namcos22.cpp b/src/mame/namco/namcos22.cpp
index 34facffdb22..c19e35e43ef 100644
--- a/src/mame/namco/namcos22.cpp
+++ b/src/mame/namco/namcos22.cpp
@@ -15,7 +15,7 @@ driver provided with thanks to:
TODO:
- finish slave DSP emulation
- emulate System22 I/O board C74 instead of HLE (inputs, outputs, volume control - HLE only handles the inputs)
-- C139 for linked cabinets, as well as in RR fullscale
+- C139 for linked cabinets, as well as in RR fullscale and RR 3 monitor version
- confirm DSP and MCU IRQ timing
- EEPROM write timing should be around 5ms, it doesn't do any data/rdy polling
- Rave Racer car will sometimes do a 'strafe slide' when playing the game with a small analog device (such as an
@@ -3045,11 +3045,11 @@ static INPUT_PORTS_START( ridgerac3m )
PORT_INCLUDE( ridgera )
PORT_MODIFY("DSW")
- PORT_DIPNAME(0x00030000, 0x00010000, "PCB (screen) Select") PORT_DIPLOCATION("SW2:1,2")
- PORT_DIPSETTING( 0x00000000, "Center/Main (PCB 2)") // No exit from Service Mode due to lack C139 and full 3 screen implementation???
- PORT_DIPSETTING( 0x00010000, "Center/Main (PCB 2)")
- PORT_DIPSETTING( 0x00020000, "Left (PCB 1)") // shows black screen due to lack C139 and full 3 screen implementation
- PORT_DIPSETTING( 0x00030000, "Right (PCB 3)") // shows black screen due to lack C139 and full 3 screen implementation
+ PORT_DIPNAME( 0x00030000, 0x00010000, "PCB (screen) Select") PORT_DIPLOCATION("SW2:1,2")
+ PORT_DIPSETTING( 0x00000000, "Center/Main (PCB 2)") // No exit from Service Mode due to lack C139 and full 3 screen implementation???
+ PORT_DIPSETTING( 0x00010000, "Center/Main (PCB 2)")
+ PORT_DIPSETTING( 0x00020000, "Left (PCB 1)") // shows black screen due to lack C139 and full 3 screen implementation
+ PORT_DIPSETTING( 0x00030000, "Right (PCB 3)") // shows black screen due to lack C139 and full 3 screen implementation
INPUT_PORTS_END
static INPUT_PORTS_START( ridgeracf )
@@ -6404,7 +6404,7 @@ GAME( 1993, ridgeraca, ridgerac, namcos22, ridgera, namcos22_state, init_r
GAME( 1993, ridgeracb, ridgerac, namcos22, ridgera, namcos22_state, init_ridgerac, ROT0, "Namco", "Ridge Racer (US, RR3 Ver.B)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS ) // 1994-01-17, reports as "-Foreign B-" RR3 means USA?
GAME( 1993, ridgeracc, ridgerac, namcos22, ridgera, namcos22_state, init_ridgerac, ROT0, "Namco", "Ridge Racer (US, RR3)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS ) // 1993-10-28, reports as "-Foreign B-"
GAME( 1993, ridgeracj, ridgerac, namcos22, ridgera, namcos22_state, init_ridgerac, ROT0, "Namco", "Ridge Racer (Japan, RR1)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS ) // 1993-10-07
-GAME( 1994, ridgerac3m, ridgerac, namcos22, ridgerac3m, namcos22_state, init_ridgerac, ROT0, "Namco", "Ridge Racer (World, Three Monitor Version)", MACHINE_SUPPORTS_SAVE| MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) // 1994-07-01, Standard game with 3 monitor linkup
+GAME( 1994, ridgerac3m, ridgerac, namcos22, ridgerac3m, namcos22_state, init_ridgerac, ROT0, "Namco", "Ridge Racer (World, RRC, Three Monitor Version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) // 1994-07-01, Standard game with 3 monitor linkup
GAME( 1993, ridgeracf, 0, namcos22, ridgeracf, namcos22_state, init_ridgerac, ROT0, "Namco", "Ridge Racer Full Scale (World, RRF2)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) // 1993-12-13, very different version, incomplete dump.
GAME( 1994, ridgera2, 0, namcos22, ridgera2, namcos22_state, init_ridgera2, ROT0, "Namco", "Ridge Racer 2 (World, RRS2)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NODEVICE_LAN ) // 1994-06-21 - NOT labeled "B" but based off Japan Rev.B
GAME( 1994, ridgera2j, ridgera2, namcos22, ridgera2, namcos22_state, init_ridgera2, ROT0, "Namco", "Ridge Racer 2 (Japan, RRS1 Ver.B)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NODEVICE_LAN ) // 1994-06-21
diff --git a/src/mame/nintendo/punchout_v.cpp b/src/mame/nintendo/punchout_v.cpp
index 69ce807b5c3..f119e57a470 100644
--- a/src/mame/nintendo/punchout_v.cpp
+++ b/src/mame/nintendo/punchout_v.cpp
@@ -165,9 +165,8 @@ void punchout_state::punchout_spr2_videoram_w(offs_t offset, uint8_t data)
void punchout_state::draw_big_sprite(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int palette)
{
- int zoom;
+ int zoom = m_spr1_ctrlram[0] + 256 * (m_spr1_ctrlram[1] & 0x0f);
- zoom = m_spr1_ctrlram[0] + 256 * (m_spr1_ctrlram[1] & 0x0f);
if (zoom)
{
int sx,sy;
@@ -208,15 +207,14 @@ void punchout_state::draw_big_sprite(screen_device &screen, bitmap_ind16 &bitmap
void punchout_state::armwrest_draw_big_sprite(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int palette)
{
- int zoom;
+ int zoom = m_spr1_ctrlram[0] + 256 * (m_spr1_ctrlram[1] & 0x0f);
- zoom = m_spr1_ctrlram[0] + 256 * (m_spr1_ctrlram[1] & 0x0f);
if (zoom)
{
int sx,sy;
uint32_t startx,starty;
int incxx,incyy;
- tilemap_t *_tilemap;
+ tilemap_t *spr1_tilemap;
sx = 4096 - (m_spr1_ctrlram[2] + 256 * (m_spr1_ctrlram[3] & 0x0f));
if (sx > 2048) sx -= 4096;
@@ -235,16 +233,16 @@ void punchout_state::armwrest_draw_big_sprite(screen_device &screen, bitmap_ind1
if (m_spr1_ctrlram[6] & 1) /* flip x */
{
- _tilemap = m_spr1_tilemap_flipx;
+ spr1_tilemap = m_spr1_tilemap_flipx;
startx = ((32 * 8) << 16) - startx - 1;
incxx = -incxx;
}
else
- _tilemap = m_spr1_tilemap;
+ spr1_tilemap = m_spr1_tilemap;
- _tilemap->set_palette_offset(0x100 * palette);
+ spr1_tilemap->set_palette_offset(0x100 * palette);
- _tilemap->draw_roz(screen, bitmap, cliprect,
+ spr1_tilemap->draw_roz(screen, bitmap, cliprect,
startx,starty + 0x200*(2) * zoom,
incxx,0,0,incyy, /* zoom, no rotation */
0, /* no wraparound */
@@ -285,11 +283,10 @@ void punchout_state::drawbs2(screen_device &screen, bitmap_ind16 &bitmap, const
void punchout_state::punchout_copy_top_palette(int bank)
{
- int i;
const uint8_t *color_prom = memregion("proms")->base();
// top monitor palette
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
int base = 0x100 * bank;
int r, g, b;
@@ -305,11 +302,10 @@ void punchout_state::punchout_copy_top_palette(int bank)
void punchout_state::punchout_copy_bot_palette(int bank)
{
- int i;
const uint8_t *color_prom = memregion("proms")->base() + 0x600;
// bottom monitor palette
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
int base = 0x100 * bank;
int r, g, b;
@@ -338,12 +334,10 @@ uint32_t punchout_state::screen_update_punchout_top(screen_device &screen, bitma
uint32_t punchout_state::screen_update_punchout_bottom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int offs;
-
punchout_copy_bot_palette(BIT(*m_palettebank,0));
/* copy the character mapped graphics */
- for (offs = 0;offs < 32;offs++)
+ for (int offs = 0; offs < 32; offs++)
m_bg_bot_tilemap->set_scrollx(offs, 58 + m_bg_bot_videoram[2*offs] + 256 * (m_bg_bot_videoram[2*offs + 1] & 0x01));
m_bg_bot_tilemap->draw(screen, bitmap, cliprect, 0, 0);