diff options
Diffstat (limited to 'src/mame/misc/freeway.cpp')
-rw-r--r-- | src/mame/misc/freeway.cpp | 106 |
1 files changed, 94 insertions, 12 deletions
diff --git a/src/mame/misc/freeway.cpp b/src/mame/misc/freeway.cpp index c7d9a022fb7..84f6a978cab 100644 --- a/src/mame/misc/freeway.cpp +++ b/src/mame/misc/freeway.cpp @@ -9,6 +9,7 @@ *********************************************************************/ #include "emu.h" + #include "bus/rs232/rs232.h" #include "cpu/i86/i86.h" #include "machine/ins8250.h" @@ -16,6 +17,7 @@ #include "machine/pic8259.h" #include "machine/timekpr.h" #include "video/mc6845.h" + #include "emupal.h" #include "screen.h" @@ -31,6 +33,8 @@ public: , m_pic(*this, "pic") , m_charram(*this, "charram") , m_colorram(*this, "colorram") + , m_gfx_rom(*this, "gfx") + , m_color_rom(*this, "color_rom") , m_lamps(*this, "lamp%u", 1U) { } @@ -40,15 +44,15 @@ public: void nmi_w(int state); protected: - virtual void machine_start() override; + virtual void machine_start() override ATTR_COLD; private: MC6845_UPDATE_ROW(update_row); void lamps_w(u8 data); - void mem_map(address_map &map); - void io_map(address_map &map); + void mem_map(address_map &map) ATTR_COLD; + void io_map(address_map &map) ATTR_COLD; required_device<cpu_device> m_maincpu; required_device<pic8259_device> m_pic; @@ -56,7 +60,12 @@ private: required_shared_ptr<u8> m_charram; required_shared_ptr<u8> m_colorram; + required_region_ptr<u8> m_gfx_rom; + required_region_ptr<u8> m_color_rom; + output_finder<3> m_lamps; + + void palette_init(palette_device &palette) const; }; void freeway_state::machine_start() @@ -64,8 +73,32 @@ void freeway_state::machine_start() m_lamps.resolve(); } +// TODO: just the minimum to show errors on screen MC6845_UPDATE_ROW(freeway_state::update_row) { + uint16_t x = 0; + + for (uint8_t cx = 0; cx < x_count; cx++) + { + int const attr = m_colorram[ma & 0xfff]; + int addr = ((m_charram[ma & 0xfff] | ((attr & 0x10) << 5)) << 3) | (ra & 0x07); + + uint8_t const *const data = m_gfx_rom; + + for (int i = 7; i >= 0; i--) + { + int col = 0; + col |= (BIT(data[0x0000 | addr], i) << 2); + col |= (BIT(data[0x8000 | addr], i) << 1); + col |= (BIT(data[0x10000 | addr], i) << 0); + + const u32 pen = (BIT(col, 2) ? 0xff : 0) | (BIT(col, 1) ? 0xff00 : 0) | (BIT(col, 0) ? 0xff0000 : 0); + bitmap.pix(y, x) = pen; + + x++; + } + ma++; + } } void freeway_state::lamps_w(u8 data) @@ -83,8 +116,8 @@ void freeway_state::mem_map(address_map &map) { map(0x00000, 0x07fff).ram(); map(0x08000, 0x09fff).rw("timekpr", FUNC(timekeeper_device::read), FUNC(timekeeper_device::write)); - map(0xa0000, 0xa0fff).ram().share("charram"); - map(0xa4000, 0xa4fff).ram().share("colorram"); + map(0xa0000, 0xa0fff).ram().share(m_charram); + map(0xa4000, 0xa4fff).ram().share(m_colorram); map(0xf0000, 0xfffff).rom().region("program", 0); } @@ -95,6 +128,7 @@ void freeway_state::io_map(address_map &map) map(0x0040, 0x0047).rw("uart", FUNC(ns16450_device::ins8250_r), FUNC(ns16450_device::ins8250_w)); map(0x00a3, 0x00a3).w(FUNC(freeway_state::lamps_w)); map(0x00d0, 0x00d0).portr("CONFIG"); + map(0x00d1, 0x00d1).portr("INPUTS"); map(0x03d0, 0x03d0).w("crtc", FUNC(mc6845_device::address_w)); map(0x03d1, 0x03d1).w("crtc", FUNC(mc6845_device::register_w)); } @@ -107,14 +141,62 @@ static INPUT_PORTS_START(freeway) PORT_BIT(0x08, 0x08, IPT_UNKNOWN) PORT_BIT(0xf6, 0xf6, IPT_UNKNOWN) // probably unused + PORT_START("INPUTS") + PORT_DIPNAME( 0x01, 0x01, "IN0.1" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) // brings up the 'auditoria' screen in freeway + PORT_DIPNAME( 0x04, 0x04, "IN0.3" ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, "IN0.4" ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, "IN0.5" ) // increases the 'num dias' value in freeway + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, "IN0.6" ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, "IN0.7" ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, "IN0.8" ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_START("RESET") - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_MEMORY_RESET) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF, freeway_state, nmi_w) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_MEMORY_RESET) PORT_WRITE_LINE_MEMBER(FUNC(freeway_state::nmi_w)) INPUT_PORTS_END static GFXDECODE_START(gfx_freeway) - GFXDECODE_ENTRY("gfx", 0, gfx_8x8x3_planar, 0x0, 1) + GFXDECODE_ENTRY("gfx", 0, gfx_8x8x3_planar, 0x0, 0x20) GFXDECODE_END +// TODO: diverges between freeway and freewaya +// makes more sense with latter, different? +void freeway_state::palette_init(palette_device &palette) const +{ + uint8_t const *const data = m_color_rom; + + u8 value = 0; + + for (int i = 0; i < palette.entries(); i++) + { + value = data[i + 0x7c00]; + int const r = (value == 0xff) ? 0 : 0x0e * BIT(value, 0) + 0x1f * BIT(value, 1) + 0x43 * BIT(value, 2) + 0x8f * BIT(value, 3); + + value = data[i + 0x7d00]; + int const g = (value == 0xff) ? 0 : 0x0e * BIT(value, 0) + 0x1f * BIT(value, 1) + 0x43 * BIT(value, 2) + 0x8f * BIT(value, 3); + + value = data[i + 0x7f00]; + int const b = (value == 0xff) ? 0 : 0x0e * BIT(value, 0) + 0x1f * BIT(value, 1) + 0x43 * BIT(value, 2) + 0x8f * BIT(value, 3); + + palette.set_pen_color(i, rgb_t(r, g, b)); + } +} + + void freeway_state::freeway(machine_config &config) { I8088(config, m_maincpu, 10_MHz_XTAL / 2); // divider unknown @@ -134,7 +216,7 @@ void freeway_state::freeway(machine_config &config) screen.set_raw(10_MHz_XTAL / 2, 320, 0, 256, 312, 0, 256); screen.set_screen_update("crtc", FUNC(mc6845_device::screen_update)); - PALETTE(config, "palette").set_entries(0x10); + PALETTE(config, "palette", FUNC(freeway_state::palette_init), 0x100); GFXDECODE(config, "gfxdecode", "palette", gfx_freeway); mc6845_device &crtc(MC6845(config, "crtc", 10_MHz_XTAL / 16)); @@ -175,7 +257,7 @@ ROM_START(freeway) ROM_LOAD("sb_52.bin", 0x08000, 0x8000, CRC(f2b33acd) SHA1(e4786b4f00871d771aadacd9d6ec767691f4d939)) ROM_LOAD("sb_53.bin", 0x10000, 0x8000, CRC(50407ae6) SHA1(2c6c4803905bed5f27c6783f99a24f8dee62c19b)) - ROM_REGION(0x8000, "cor", 0) + ROM_REGION(0x8000, "color_rom", 0) ROM_LOAD("sb_cor.bin", 0x0000, 0x8000, CRC(5f86a160) SHA1(f21b7e0e6a407371c252d6fde6fcb32a2682824c)) // all 0xFF fill until 0x7C00; valid data is only 4 bits wide ROM_END @@ -188,7 +270,7 @@ ROM_START(freewaya) ROM_LOAD("rgb 2fw 256 vr 512b", 0x08000, 0x8000, CRC(ed1bb4d8) SHA1(78f9eced819c1fa269e685bb176671158ffcec26)) ROM_LOAD("rgb 3fw 256 vr 512b", 0x10000, 0x8000, CRC(c685c530) SHA1(deec9ce1df500f14b9ebd007d482473f97b3ecf3)) - ROM_REGION(0x8000, "cor", 0) + ROM_REGION(0x8000, "color_rom", 0) ROM_LOAD("color_431b_eprom-256", 0x0000, 0x8000, CRC(e49fc782) SHA1(2c50cf644b7c6449880ed3d6e778ba116e123ae2)) // FIXED BITS (0000xxxx) ROM_REGION(0x21ee, "nvram", 0) @@ -198,5 +280,5 @@ ROM_END } // anonymous namespace -GAME(1999, freeway, 0, freeway, freeway, freeway_state, empty_init, ROT0, "NVC Electronica", "FreeWay (V5.12)", MACHINE_IS_SKELETON) -GAME(1997, freewaya, freeway, freeway, freeway, freeway_state, empty_init, ROT0, "NVC Electronica", "FreeWay (V4.31)", MACHINE_IS_SKELETON) +GAME(1999, freeway, 0, freeway, freeway, freeway_state, empty_init, ROT0, "NVC Electronica", "FreeWay (V5.12)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING) +GAME(1997, freewaya, freeway, freeway, freeway, freeway_state, empty_init, ROT0, "NVC Electronica", "FreeWay (V4.31)", MACHINE_NO_SOUND | MACHINE_NOT_WORKING) |