Skip to content

Commit 9a00624

Browse files
committed
misc/freeway.cpp: preliminary palette decoding
1 parent 3d357c0 commit 9a00624

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

Diff for: src/mame/misc/freeway.cpp

+31-5
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class freeway_state : public driver_device
3434
, m_charram(*this, "charram")
3535
, m_colorram(*this, "colorram")
3636
, m_gfx_rom(*this, "gfx")
37-
, m_color_rom(*this, "cor")
37+
, m_color_rom(*this, "color_rom")
3838
, m_lamps(*this, "lamp%u", 1U)
3939
{
4040
}
@@ -64,6 +64,8 @@ class freeway_state : public driver_device
6464
required_region_ptr<u8> m_color_rom;
6565

6666
output_finder<3> m_lamps;
67+
68+
void palette_init(palette_device &palette) const;
6769
};
6870

6971
void freeway_state::machine_start()
@@ -168,9 +170,33 @@ static INPUT_PORTS_START(freeway)
168170
INPUT_PORTS_END
169171

170172
static GFXDECODE_START(gfx_freeway)
171-
GFXDECODE_ENTRY("gfx", 0, gfx_8x8x3_planar, 0x0, 1)
173+
GFXDECODE_ENTRY("gfx", 0, gfx_8x8x3_planar, 0x0, 0x20)
172174
GFXDECODE_END
173175

176+
// TODO: diverges between freeway and freewaya
177+
// makes more sense with latter, different?
178+
void freeway_state::palette_init(palette_device &palette) const
179+
{
180+
uint8_t const *const data = m_color_rom;
181+
182+
u8 value = 0;
183+
184+
for (int i = 0; i < palette.entries(); i++)
185+
{
186+
value = data[i + 0x7c00];
187+
int const r = (value == 0xff) ? 0 : 0x0e * BIT(value, 0) + 0x1f * BIT(value, 1) + 0x43 * BIT(value, 2) + 0x8f * BIT(value, 3);
188+
189+
value = data[i + 0x7d00];
190+
int const g = (value == 0xff) ? 0 : 0x0e * BIT(value, 0) + 0x1f * BIT(value, 1) + 0x43 * BIT(value, 2) + 0x8f * BIT(value, 3);
191+
192+
value = data[i + 0x7f00];
193+
int const b = (value == 0xff) ? 0 : 0x0e * BIT(value, 0) + 0x1f * BIT(value, 1) + 0x43 * BIT(value, 2) + 0x8f * BIT(value, 3);
194+
195+
palette.set_pen_color(i, rgb_t(r, g, b));
196+
}
197+
}
198+
199+
174200
void freeway_state::freeway(machine_config &config)
175201
{
176202
I8088(config, m_maincpu, 10_MHz_XTAL / 2); // divider unknown
@@ -190,7 +216,7 @@ void freeway_state::freeway(machine_config &config)
190216
screen.set_raw(10_MHz_XTAL / 2, 320, 0, 256, 312, 0, 256);
191217
screen.set_screen_update("crtc", FUNC(mc6845_device::screen_update));
192218

193-
PALETTE(config, "palette").set_entries(0x10);
219+
PALETTE(config, "palette", FUNC(freeway_state::palette_init), 0x100);
194220
GFXDECODE(config, "gfxdecode", "palette", gfx_freeway);
195221

196222
mc6845_device &crtc(MC6845(config, "crtc", 10_MHz_XTAL / 16));
@@ -231,7 +257,7 @@ ROM_START(freeway)
231257
ROM_LOAD("sb_52.bin", 0x08000, 0x8000, CRC(f2b33acd) SHA1(e4786b4f00871d771aadacd9d6ec767691f4d939))
232258
ROM_LOAD("sb_53.bin", 0x10000, 0x8000, CRC(50407ae6) SHA1(2c6c4803905bed5f27c6783f99a24f8dee62c19b))
233259

234-
ROM_REGION(0x8000, "cor", 0)
260+
ROM_REGION(0x8000, "color_rom", 0)
235261
ROM_LOAD("sb_cor.bin", 0x0000, 0x8000, CRC(5f86a160) SHA1(f21b7e0e6a407371c252d6fde6fcb32a2682824c)) // all 0xFF fill until 0x7C00; valid data is only 4 bits wide
236262
ROM_END
237263

@@ -244,7 +270,7 @@ ROM_START(freewaya)
244270
ROM_LOAD("rgb 2fw 256 vr 512b", 0x08000, 0x8000, CRC(ed1bb4d8) SHA1(78f9eced819c1fa269e685bb176671158ffcec26))
245271
ROM_LOAD("rgb 3fw 256 vr 512b", 0x10000, 0x8000, CRC(c685c530) SHA1(deec9ce1df500f14b9ebd007d482473f97b3ecf3))
246272

247-
ROM_REGION(0x8000, "cor", 0)
273+
ROM_REGION(0x8000, "color_rom", 0)
248274
ROM_LOAD("color_431b_eprom-256", 0x0000, 0x8000, CRC(e49fc782) SHA1(2c50cf644b7c6449880ed3d6e778ba116e123ae2)) // FIXED BITS (0000xxxx)
249275

250276
ROM_REGION(0x21ee, "nvram", 0)

0 commit comments

Comments
 (0)