From f1a11f8b236ea142e9d44956222b614266c5aade Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Tue, 21 May 2024 18:10:14 +0200 Subject: [PATCH 1/7] New systems marked not working ------------------------------ unknown Ram Star multi-game (version 80.1) [Siftware] New software list items marked not working ------------------------------------------ American Dream [Siftware] Bar Fever (set 1) [Siftware] Bar Fever (set 2) [Siftware] Bear Country [Siftware] Great America [Siftware] Irish Luck [Siftware] Joker Poker [Siftware] Lucky Critters [Siftware] Lucky Seven [Siftware] Lucky Sevens [Siftware] Nevada Club [Siftware] Rainbow Magic [Siftware] Silver Slots [Siftware] --- hash/ramstar.xml | 180 +++++++++++++++++++++++++++++ src/mame/mame.lst | 9 +- src/mame/skeleton/ramstar.cpp | 207 ++++++++++++++++++++++++++++++++++ 3 files changed, 393 insertions(+), 3 deletions(-) create mode 100644 hash/ramstar.xml create mode 100644 src/mame/skeleton/ramstar.cpp diff --git a/hash/ramstar.xml b/hash/ramstar.xml new file mode 100644 index 00000000000..61775cada65 --- /dev/null +++ b/hash/ramstar.xml @@ -0,0 +1,180 @@ + + + + + + + American Dream + 1991? + Ram Star + + + + + + + + + + + Bar Fever (set 1) + 1991? + Ram Star + + + + + + + + + + + Bar Fever (set 2) + 1991? + Ram Star + + + + + + + + + + + Bear Country + 1991? + Ram Star + + + + + + + + + + + Great America + 1991? + Ram Star + + + + + + + + + + + Irish Luck + 1991? + Ram Star + + + + + + + + + + + Joker Poker + 1991? + Ram Star + + + + + + + + + + + Lucky Critters + 1991? + Ram Star + + + + + + + + + + + Lucky Seven + 1991? + Ram Star + + + + + + + + + + + Lucky Sevens + 1991? + Ram Star + + + + + + + + + + + Nevada Club + 1991? + Ram Star + + + + + + + + + + + Rainbow Magic + 1991? + Ram Star + + + + + + + + + + + Silver Slots + 1991? + Ram Star + + + + + + + + + diff --git a/src/mame/mame.lst b/src/mame/mame.lst index a716114fa69..44f20290197 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -42143,6 +42143,9 @@ qmsirius // @source:skeleton/qtsbc.cpp qtsbc // +@source:skeleton/ramstar.cpp +ramstar // + @source:skeleton/rd100.cpp rd100 // @@ -44022,9 +44025,9 @@ speedspn // (c) 1994 topdrive // (c) 1995 @source:tch/wheelfir.cpp -kongball // (c) 199? TCH -pwball // (c) 199? TCH -radendur // (c) 199? TCH +kongball // (c) 199? TCH +pwball // (c) 199? TCH +radendur // (c) 199? TCH wheelfir // (c) 199? TCH @source:teamconcepts/comquest.cpp diff --git a/src/mame/skeleton/ramstar.cpp b/src/mame/skeleton/ramstar.cpp new file mode 100644 index 00000000000..ea99f67769c --- /dev/null +++ b/src/mame/skeleton/ramstar.cpp @@ -0,0 +1,207 @@ +// license:BSD-3-Clause +// copyright-holders: + +/* + +Unknown multi-game by Ram Star (1991) +It is currently unknown if the system itself has a name. +It comprises at least 2 PCBs, which don't plug in one another. +So very probably missing at least a backplane, if not more PCBs. + +RAM STAR VIDEO GAME PCB4201C +W65C816PL CPU +MAX691CPE supervisor +X24C04 serial E2PROM +P5C032 CPLD +10 MHz XTAL +M62X42B RTC (32.768KHz built-in XTAL) +P5164SL SRAM +8-DIP bank +AY-3-8912 sound chip +2x 27C512 ROM +R65C52P2 DACIA +R65C22P3 VIA +3.6864 MHz XTAL +NE5152BN TRIPLE 4-Bit RGB D/A CONVERTER +HM62256LP-10 video RAM +W65C29P IOD +W65C90P EBC + +RamStar GAME MODULE CONTROL PCB4204A +SC80C31BCCN40 ROMless MCU +27C640 ROM +6 MHz XTAL +6x card slots + +The carts' PCB is RamStar GAME MODULE PCB4203A. +It only contains a 27C512 or 27C1024 and a X24C04. +*/ + + +#include "emu.h" + +#include "cpu/g65816/g65816.h" +#include "cpu/mcs51/mcs51.h" +#include "machine/6522via.h" +#include "machine/i2cmem.h" +#include "machine/msm6242.h" +#include "sound/ay8910.h" + +#include "emupal.h" +#include "screen.h" +#include "softlist_dev.h" +#include "speaker.h" +#include "tilemap.h" + + +namespace { + +class ramstar_state : public driver_device +{ +public: + ramstar_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_cartcpu(*this, "cartcpu") + { } + + void ramstar(machine_config &config) ATTR_COLD; + +private: + required_device m_maincpu; + required_device m_cartcpu; + + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + + void main_program_map(address_map &map) ATTR_COLD; + void main_data_map(address_map &map) ATTR_COLD; + void cart_program_map(address_map &map) ATTR_COLD; + void cart_io_map(address_map &map) ATTR_COLD; +}; + + +uint32_t ramstar_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + bitmap.fill(rgb_t::black(), cliprect); + + return 0; +} + + +void ramstar_state::main_program_map(address_map &map) +{ + map.global_mask(0x0ffff); + map(0x00000, 0x0ffff).rom(); +} + +void ramstar_state::main_data_map(address_map &map) +{ + map(0x00000, 0x01fff).ram(); // P5164SL + map(0x08200, 0x0820f).m("via", FUNC(via6522_device::map)); // TODO: maybe + //map(0x08400, 0x08407).rw() // DACIA? + //map(0x08600, 0x08601).w() // ?? + //map(0x08800, 0x08801).w() // ?? + //map(0x08a00, 0x08a01).w() // ?? + //map(0x08c00, 0x08c01).rw() // AY8912? + //map(0x08e00, 0x08e0f).rw() // MSM6242? + map(0x10000, 0x17fff).ram(); // HM62256, video RAM according to PCB silkscreen + //map(0x18000, 0x1802f).w() // ?? +} + +void ramstar_state::cart_program_map(address_map &map) +{ + map(0x0000, 0x1fff).rom(); +} + +void ramstar_state::cart_io_map(address_map &map) +{ + //map(0x00, 0x00).r() +} + + +static INPUT_PORTS_START( ramstar ) + PORT_START("IN0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("IN1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("DSW1") + PORT_DIPUNKNOWN_DIPLOC(0x01, 0x01, "SW1:1") + PORT_DIPUNKNOWN_DIPLOC(0x02, 0x02, "SW1:2") + PORT_DIPUNKNOWN_DIPLOC(0x04, 0x04, "SW1:3") + PORT_DIPUNKNOWN_DIPLOC(0x08, 0x08, "SW1:4") + PORT_DIPUNKNOWN_DIPLOC(0x10, 0x10, "SW1:5") + PORT_DIPUNKNOWN_DIPLOC(0x20, 0x20, "SW1:6") + PORT_DIPUNKNOWN_DIPLOC(0x40, 0x40, "SW1:7") + PORT_DIPUNKNOWN_DIPLOC(0x80, 0x80, "SW1:8") +INPUT_PORTS_END + + +void ramstar_state::ramstar(machine_config &config) +{ + // basic machine hardware + G65816(config, m_maincpu, 10_MHz_XTAL); // (absence of) divider not verified + m_maincpu->set_addrmap(AS_PROGRAM, &ramstar_state::main_program_map); + m_maincpu->set_addrmap(AS_DATA, &ramstar_state::main_data_map); + + I2C_X2404P(config, "i2cmem"); // actually X24C04 + + MSM6242(config, "rtc", 32.768_kHz_XTAL); // actually M62X42B + + R65C22(config, "via", 3.6864_MHz_XTAL / 2); // divider not verified + + // TODO: R65C52 DACIA + + I80C31(config, m_cartcpu, 6_MHz_XTAL); // (absence of) divider not verified + m_cartcpu->set_addrmap(AS_PROGRAM, &ramstar_state::cart_program_map); + m_cartcpu->set_addrmap(AS_IO, &ramstar_state::cart_io_map); + + SOFTWARE_LIST(config, "cart_list").set_original("ramstar"); + + // video hardware + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); // TODO: verify everything once emulation works + screen.set_refresh_hz(60); + screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); + screen.set_size(64*8, 32*8); + screen.set_visarea(0*8, 64*8-1, 2*8, 30*8-1); + screen.set_screen_update(FUNC(ramstar_state::screen_update)); + + PALETTE(config, "palette").set_entries(0x100); // TODO + + // sound hardware + SPEAKER(config, "mono").front_center(); + + AY8912(config, "ay", 10_MHz_XTAL / 10).add_route(ALL_OUTPUTS, "mono", 1.0); // divider not verified +} + + +ROM_START( ramstar ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "27c512.u46", 0x00000, 0x10000, CRC(8079f1f1) SHA1(82070e1b350e8a91723f892fb21e1fe00c2e5bb2) ) + + ROM_REGION( 0x10000, "gfx", 0 ) + ROM_LOAD( "27c512.u45", 0x00000, 0x10000, CRC(9a5d02fd) SHA1(f33baa7cac6f334dd167afb36a50bc0c040d0645) ) + + ROM_REGION( 0x2000, "cartcpu", 0 ) + ROM_LOAD( "27c640.u5", 0x0000, 0x2000, CRC(68529c08) SHA1(47aa8693f8c1028e4807e3d94301ef51fab98909) ) +ROM_END + +} // anonymous namespace + + +GAME( 1991, ramstar, 0, ramstar, ramstar, ramstar_state, empty_init, ROT0, "Ram Star", "unknown Ram Star multi-game (version 80.1)", MACHINE_IS_SKELETON ) From 855efc855c0c20cc5f4ffb952c87daafbe2d9bb0 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Tue, 21 May 2024 18:12:17 +0200 Subject: [PATCH 2/7] - galaxian/galaxold.cpp: updated clock for superbikg as per measurement - olympia/dday.cpp, olympia/portrait.cpp: consolidated drivers in single files - skeleton/elcirculo.cpp: added a basic memory map - vtech/vsmilepro.cpp: demoted to MIS --- src/mame/galaxian/galaxold.cpp | 2 +- src/mame/olympia/dday.cpp | 495 +++++++++++++++++++++++++++---- src/mame/olympia/dday.h | 87 ------ src/mame/olympia/dday_v.cpp | 322 -------------------- src/mame/olympia/portrait.cpp | 372 ++++++++++++++++++++--- src/mame/olympia/portrait.h | 72 ----- src/mame/olympia/portrait_v.cpp | 244 --------------- src/mame/recfranco/rfjailbrk.cpp | 2 +- src/mame/skeleton/elcirculo.cpp | 43 ++- src/mame/vtech/vsmilepro.cpp | 14 +- 10 files changed, 821 insertions(+), 832 deletions(-) delete mode 100644 src/mame/olympia/dday.h delete mode 100644 src/mame/olympia/dday_v.cpp delete mode 100644 src/mame/olympia/portrait.h delete mode 100644 src/mame/olympia/portrait_v.cpp diff --git a/src/mame/galaxian/galaxold.cpp b/src/mame/galaxian/galaxold.cpp index d956f038e70..ffc17ed5f67 100644 --- a/src/mame/galaxian/galaxold.cpp +++ b/src/mame/galaxian/galaxold.cpp @@ -1863,7 +1863,7 @@ void galaxold_state::superbikg(machine_config &config) { galaxold_base(config); - s2650_device &s2650(S2650(config.replace(), m_maincpu, PIXEL_CLOCK / 4)); + s2650_device &s2650(S2650(config.replace(), m_maincpu, 1'500'000)); // 1.53292 MHz measured with logic analyzer s2650.set_addrmap(AS_PROGRAM, &galaxold_state::superbikg_map); s2650.set_addrmap(AS_IO, &galaxold_state::superbikg_io); s2650.set_addrmap(AS_DATA, &galaxold_state::superbikg_data); diff --git a/src/mame/olympia/dday.cpp b/src/mame/olympia/dday.cpp index eabb34a8e7d..ad6db7ab5a0 100644 --- a/src/mame/olympia/dday.cpp +++ b/src/mame/olympia/dday.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:Zsolt Vasvari +// copyright-holders: Zsolt Vasvari + /*************************************************************************** D-Day @@ -52,27 +53,399 @@ Note: This game doesn't seem to support cocktail mode, which is not too ***************************************************************************/ #include "emu.h" -#include "dday.h" #include "cpu/z80/z80.h" +#include "sound/ay8910.h" + +#include "emupal.h" +#include "screen.h" #include "speaker.h" +#include "tilemap.h" + + +namespace { + +class dday_state : public driver_device +{ +public: + dday_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_textvideoram(*this, "textvideoram"), + m_fgvideoram(*this, "fgvideoram"), + m_bgvideoram(*this, "bgvideoram"), + m_colorram(*this, "colorram"), + m_sl_map(*this, "sl_map"), + m_maincpu(*this, "maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_screen(*this, "screen"), + m_palette(*this, "palette"), + m_ay1(*this, "ay1") + { } + + void dday(machine_config &config); + +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + +private: + required_shared_ptr m_textvideoram; + required_shared_ptr m_fgvideoram; + required_shared_ptr m_bgvideoram; + required_shared_ptr m_colorram; + required_region_ptr m_sl_map; + + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + required_device m_ay1; + + tilemap_t *m_fg_tilemap = nullptr; + tilemap_t *m_bg_tilemap = nullptr; + tilemap_t *m_text_tilemap = nullptr; + tilemap_t *m_sl_tilemap = nullptr; + bitmap_ind16 m_main_bitmap = 0; + uint8_t m_control = 0; + uint8_t m_sl_image = 0; + uint8_t m_sl_enable = 0; + int8_t m_timer_value = 0; + emu_timer *m_countdown_timer = nullptr; + + uint8_t countdown_timer_r(); + void bgvideoram_w(offs_t offset, uint8_t data); + void fgvideoram_w(offs_t offset, uint8_t data); + void textvideoram_w(offs_t offset, uint8_t data); + void colorram_w(offs_t offset, uint8_t data); + uint8_t colorram_r(offs_t offset); + void sl_control_w(uint8_t data); + void control_w(uint8_t data); + TILE_GET_INFO_MEMBER(get_bg_tile_info); + TILE_GET_INFO_MEMBER(get_fg_tile_info); + TILE_GET_INFO_MEMBER(get_text_tile_info); + TILE_GET_INFO_MEMBER(get_sl_tile_info); + void palette_init(palette_device &palette) const; + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_CALLBACK_MEMBER(countdown_timer_callback); + void start_countdown_timer(); + void program_map(address_map &map); +}; + + +/* Note: There seems to be no way to reset this timer via hardware. + The game uses a difference method to reset it to 99. + + Thanks Zwaxy for the timer info. */ + +uint8_t dday_state::countdown_timer_r() +{ + return ((m_timer_value / 10) << 4) | (m_timer_value % 10); +} + +TIMER_CALLBACK_MEMBER(dday_state::countdown_timer_callback) +{ + m_timer_value--; + + if (m_timer_value < 0) + m_timer_value = 99; +} + +void dday_state::start_countdown_timer() +{ + m_timer_value = 0; + + m_countdown_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); +} + + +/*************************************************************************** + + Convert the color PROMs into a more useable format. + +***************************************************************************/ +void dday_state::palette_init(palette_device &palette) const +{ + uint8_t const *const color_prom = memregion("proms")->base(); + + palette.set_shadow_factor(1.0 / 8); + + // create a lookup table for the palette + for (int i = 0; i < 0x100; i++) + { + int const r = pal4bit(color_prom[i + 0x000]); + int const g = pal4bit(color_prom[i + 0x100]); + int const b = pal4bit(color_prom[i + 0x200]); + + palette.set_indirect_color(i, rgb_t(r, g, b)); + } + + for (int i = 0; i < 0x100; i++) + palette.set_pen_indirect(i, i); + + // HACK!!! This table is handgenerated, but it matches the screenshot. I have no clue how it really works + palette.set_pen_indirect(0*8+0+0, 0x00); + palette.set_pen_indirect(0*8+0+1, 0x01); + palette.set_pen_indirect(0*8+0+2, 0x15); + palette.set_pen_indirect(0*8+0+3, 0x02); + palette.set_pen_indirect(0*8+4+0, 0x00); + palette.set_pen_indirect(0*8+4+1, 0x01); + palette.set_pen_indirect(0*8+4+2, 0x15); + palette.set_pen_indirect(0*8+4+3, 0x02); + + palette.set_pen_indirect(1*8+0+0, 0x04); + palette.set_pen_indirect(1*8+0+1, 0x05); + palette.set_pen_indirect(1*8+0+2, 0x03); + palette.set_pen_indirect(1*8+0+3, 0x07); + palette.set_pen_indirect(1*8+4+0, 0x04); + palette.set_pen_indirect(1*8+4+1, 0x05); + palette.set_pen_indirect(1*8+4+2, 0x03); + palette.set_pen_indirect(1*8+4+3, 0x07); + + palette.set_pen_indirect(2*8+0+0, 0x08); + palette.set_pen_indirect(2*8+0+1, 0x15); + palette.set_pen_indirect(2*8+0+2, 0x0a); + palette.set_pen_indirect(2*8+0+3, 0x03); + palette.set_pen_indirect(2*8+4+0, 0x08); + palette.set_pen_indirect(2*8+4+1, 0x15); + palette.set_pen_indirect(2*8+4+2, 0x0a); + palette.set_pen_indirect(2*8+4+3, 0x03); + + palette.set_pen_indirect(3*8+0+0, 0x08); + palette.set_pen_indirect(3*8+0+1, 0x15); + palette.set_pen_indirect(3*8+0+2, 0x0a); + palette.set_pen_indirect(3*8+0+3, 0x03); + palette.set_pen_indirect(3*8+4+0, 0x08); + palette.set_pen_indirect(3*8+4+1, 0x15); + palette.set_pen_indirect(3*8+4+2, 0x0a); + palette.set_pen_indirect(3*8+4+3, 0x03); + + palette.set_pen_indirect(4*8+0+0, 0x10); + palette.set_pen_indirect(4*8+0+1, 0x11); + palette.set_pen_indirect(4*8+0+2, 0x12); + palette.set_pen_indirect(4*8+0+3, 0x07); + palette.set_pen_indirect(4*8+4+0, 0x10); + palette.set_pen_indirect(4*8+4+1, 0x11); + palette.set_pen_indirect(4*8+4+2, 0x12); + palette.set_pen_indirect(4*8+4+3, 0x07); + + palette.set_pen_indirect(5*8+0+0, 0x1d); + palette.set_pen_indirect(5*8+0+1, 0x15); + palette.set_pen_indirect(5*8+0+2, 0x16); + palette.set_pen_indirect(5*8+0+3, 0x1b); + palette.set_pen_indirect(5*8+4+0, 0x1d); + palette.set_pen_indirect(5*8+4+1, 0x15); + palette.set_pen_indirect(5*8+4+2, 0x16); + palette.set_pen_indirect(5*8+4+3, 0x1b); + + palette.set_pen_indirect(6*8+0+0, 0x1d); + palette.set_pen_indirect(6*8+0+1, 0x15); + palette.set_pen_indirect(6*8+0+2, 0x1a); + palette.set_pen_indirect(6*8+0+3, 0x1b); + palette.set_pen_indirect(6*8+4+0, 0x1d); + palette.set_pen_indirect(6*8+4+1, 0x15); + palette.set_pen_indirect(6*8+4+2, 0x1a); + palette.set_pen_indirect(6*8+4+3, 0x1b); + + palette.set_pen_indirect(7*8+0+0, 0x1d); + palette.set_pen_indirect(7*8+0+1, 0x02); + palette.set_pen_indirect(7*8+0+2, 0x04); + palette.set_pen_indirect(7*8+0+3, 0x1b); + palette.set_pen_indirect(7*8+4+0, 0x1d); + palette.set_pen_indirect(7*8+4+1, 0x02); + palette.set_pen_indirect(7*8+4+2, 0x04); + palette.set_pen_indirect(7*8+4+3, 0x1b); +} + + +/*************************************************************************** + + Callbacks for the TileMap code + +***************************************************************************/ + +TILE_GET_INFO_MEMBER(dday_state::get_bg_tile_info) +{ + int const code = m_bgvideoram[tile_index]; + tileinfo.set(0, code, code >> 5, 0); +} + +TILE_GET_INFO_MEMBER(dday_state::get_fg_tile_info) +{ + int const flipx = m_colorram[tile_index & 0x03e0] & 0x01; + int const code = m_fgvideoram[flipx ? tile_index ^ 0x1f : tile_index]; + tileinfo.set(2, code, code >> 5, flipx ? TILE_FLIPX : 0); +} -void dday_state::dday_map(address_map &map) +TILE_GET_INFO_MEMBER(dday_state::get_text_tile_info) +{ + int const code = m_textvideoram[tile_index]; + tileinfo.set(1, code, code >> 5, 0); +} + +TILE_GET_INFO_MEMBER(dday_state::get_sl_tile_info) +{ + uint8_t *sl_map = &m_sl_map[(m_sl_image & 0x07) * 0x0200]; + + int const flipx = (tile_index >> 4) & 0x01; + int const sl_flipx = (m_sl_image >> 3) & 0x01; + + // bit 4 is really a flip indicator. Need to shift bits 5-9 to the right by 1 + tile_index = ((tile_index & 0x03e0) >> 1) | (tile_index & 0x0f); + + int code = sl_map[flipx ? tile_index ^ 0x0f : tile_index]; + + if ((sl_flipx != flipx) && (code & 0x80)) + // no mirroring, draw dark spot + code = 1; + + tileinfo.set(3, code & 0x3f, 0, flipx ? TILE_FLIPX : 0); +} + + +/*************************************************************************** + + Start the video hardware emulation. + +***************************************************************************/ + +void dday_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(dday_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(dday_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + m_text_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(dday_state::get_text_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + m_sl_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(dday_state::get_sl_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + + m_screen->register_screen_bitmap(m_main_bitmap); + + m_bg_tilemap->set_transmask(0, 0x00f0, 0xff0f); // pens 0-3 have priority over the foreground layer + m_fg_tilemap->set_transparent_pen(0); + m_text_tilemap->set_transparent_pen(0); + + m_countdown_timer = timer_alloc(FUNC(dday_state::countdown_timer_callback), this); + + start_countdown_timer(); +} + +void dday_state::bgvideoram_w(offs_t offset, uint8_t data) +{ + m_bgvideoram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + +void dday_state::fgvideoram_w(offs_t offset, uint8_t data) +{ + m_fgvideoram[offset] = data; + m_fg_tilemap->mark_tile_dirty(offset); + m_fg_tilemap->mark_tile_dirty(offset ^ 0x1f); // for flipx case +} + +void dday_state::textvideoram_w(offs_t offset, uint8_t data) +{ + m_textvideoram[offset] = data; + m_text_tilemap->mark_tile_dirty(offset); +} + +void dday_state::colorram_w(offs_t offset, uint8_t data) +{ + offset &= 0x03e0; + + m_colorram[offset & 0x3e0] = data; + + for (int i = 0; i < 0x20; i++) + m_fg_tilemap->mark_tile_dirty(offset + i); +} + +uint8_t dday_state::colorram_r(offs_t offset) +{ + return m_colorram[offset & 0x03e0]; +} + + +void dday_state::sl_control_w(uint8_t data) +{ + if (m_sl_image != data) + { + m_sl_image = data; + m_sl_tilemap->mark_all_dirty(); + } +} + + +void dday_state::control_w(uint8_t data) +{ + // if (data & 0xac) logerror("Control = %02X\n", data & 0xac); + + // bit 0 is coin counter 1 + machine().bookkeeping().coin_counter_w(0, data & 0x01); + + // bit 1 is coin counter 2 + machine().bookkeeping().coin_counter_w(1, data & 0x02); + + // bit 4 is sound enable + if (!(data & 0x10) && (m_control & 0x10)) + m_ay1->reset(); + + machine().sound().system_mute(!BIT(data, 4)); + + // bit 6 is search light enable + m_sl_enable = data & 0x40; + + m_control = data; +} + +/*************************************************************************** + + Display refresh + +***************************************************************************/ + +uint32_t dday_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->draw(screen, m_main_bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); + m_fg_tilemap->draw(screen, m_main_bitmap, cliprect, 0, 0); + m_bg_tilemap->draw(screen, m_main_bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); + m_text_tilemap->draw(screen, m_main_bitmap, cliprect, 0, 0); + + if (m_sl_enable) + { + // apply shadow + bitmap_ind16 &sl_bitmap = m_sl_tilemap->pixmap(); + + for (int x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + { + uint16_t src_pixel = m_main_bitmap.pix(y, x); + + if (sl_bitmap.pix(y, x) == 0xff) + src_pixel += m_palette->entries(); + + bitmap.pix(y, x) = src_pixel; + } + } + else + copybitmap(bitmap, m_main_bitmap, 0, 0, 0, 0, cliprect); + + return 0; +} + + +void dday_state::program_map(address_map &map) { map(0x0000, 0x3fff).rom(); - map(0x4000, 0x4000).w(FUNC(dday_state::dday_sl_control_w)); - map(0x5000, 0x53ff).ram().w(FUNC(dday_state::dday_textvideoram_w)).share("textvideoram"); - map(0x5400, 0x57ff).ram().w(FUNC(dday_state::dday_fgvideoram_w)).share("fgvideoram"); - map(0x5800, 0x5bff).ram().w(FUNC(dday_state::dday_bgvideoram_w)).share("bgvideoram"); - map(0x5c00, 0x5fff).rw(FUNC(dday_state::dday_colorram_r), FUNC(dday_state::dday_colorram_w)).share("colorram"); + map(0x4000, 0x4000).w(FUNC(dday_state::sl_control_w)); + map(0x5000, 0x53ff).ram().w(FUNC(dday_state::textvideoram_w)).share(m_textvideoram); + map(0x5400, 0x57ff).ram().w(FUNC(dday_state::fgvideoram_w)).share(m_fgvideoram); + map(0x5800, 0x5bff).ram().w(FUNC(dday_state::bgvideoram_w)).share(m_bgvideoram); + map(0x5c00, 0x5fff).rw(FUNC(dday_state::colorram_r), FUNC(dday_state::colorram_w)).share(m_colorram); map(0x6000, 0x63ff).ram(); map(0x6400, 0x6401).mirror(0x000e).w(m_ay1, FUNC(ay8912_device::address_data_w)); map(0x6800, 0x6801).w("ay2", FUNC(ay8912_device::address_data_w)); map(0x6c00, 0x6c00).portr("BUTTONS"); map(0x7000, 0x7000).portr("DSW0"); map(0x7400, 0x7400).portr("DSW1"); - map(0x7800, 0x7800).rw(FUNC(dday_state::dday_countdown_timer_r), FUNC(dday_state::dday_control_w)); + map(0x7800, 0x7800).rw(FUNC(dday_state::countdown_timer_r), FUNC(dday_state::control_w)); map(0x7c00, 0x7c00).portr("PADDLE"); } @@ -82,12 +455,12 @@ static INPUT_PORTS_START( dday ) PORT_START("BUTTONS") PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) /* fire button */ + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) // fire button PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_START1 ) PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START2 ) - PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* doesn't seem to be */ - /* accessed */ + PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // doesn't seem to be accessed + PORT_START("DSW0") PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW3:1,2") PORT_DIPSETTING( 0x00, "2" ) PORT_CONDITION("DSW0", 0x80, EQUALS, 0x80) @@ -120,7 +493,7 @@ static INPUT_PORTS_START( dday ) PORT_START("DSW1") PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3,4") PORT_DIPSETTING( 0x0e, DEF_STR( 2C_1C ) ) - PORT_DIPSETTING( 0x0c, DEF_STR( 2C_2C ) ) /* Not shown in manual */ + PORT_DIPSETTING( 0x0c, DEF_STR( 2C_2C ) ) // Not shown in manual PORT_DIPSETTING( 0x0f, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x0a, DEF_STR( 2C_3C ) ) PORT_DIPSETTING( 0x08, DEF_STR( 2C_4C ) ) @@ -162,7 +535,7 @@ static INPUT_PORTS_START( ddayc ) PORT_MODIFY("BUTTONS") PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START2 ) - PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) /* Distance Button */ + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) // Distance Button PORT_MODIFY("DSW0") PORT_DIPNAME( 0x0c, 0x00, "Extended Play At" ) PORT_DIPLOCATION("SW3:3,4") @@ -198,42 +571,42 @@ INPUT_PORTS_END static const gfx_layout layout_1bpp = { - 8,8, /* 8*8 characters */ - RGN_FRAC(1,2), /* 256 characters */ - 1, /* 1 bit per pixel */ + 8,8, // 8*8 characters + RGN_FRAC(1,2), // 256 characters + 1, // 1 bit per pixel { RGN_FRAC(0,1) }, { 7, 6, 5, 4, 3, 2, 1, 0 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 consecutive bytes */ + 8*8 // every char takes 8 consecutive bytes }; static const gfx_layout layout_2bpp = { - 8,8, /* 8*8 characters */ - RGN_FRAC(1,2), /* 256 characters */ - 2, /* 2 bits per pixel */ - { RGN_FRAC(0,2), RGN_FRAC(1,2) }, /* the bitplanes are separated */ + 8,8, // 8*8 characters + RGN_FRAC(1,2), // 256 characters + 2, // 2 bits per pixel + { RGN_FRAC(0,2), RGN_FRAC(1,2) }, // the bitplanes are separated { 7, 6, 5, 4, 3, 2, 1, 0 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 consecutive bytes */ + 8*8 // every char takes 8 consecutive bytes }; static const gfx_layout layout_3bpp = { - 8,8, /* 8*8 characters */ - RGN_FRAC(1,3), /* 256 characters */ - 3, /* 3 bits per pixel */ - { RGN_FRAC(0,3), RGN_FRAC(1,3), RGN_FRAC(2,3) }, /* the bitplanes are separated */ + 8,8, // 8*8 characters + RGN_FRAC(1,3), // 256 characters + 3, // 3 bits per pixel + { RGN_FRAC(0,3), RGN_FRAC(1,3), RGN_FRAC(2,3) }, // the bitplanes are separated { 7, 6, 5, 4, 3, 2, 1, 0 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 consecutive bytes */ + 8*8 // every char takes 8 consecutive bytes }; static GFXDECODE_START( gfx_dday ) - GFXDECODE_ENTRY( "gfx1", 0, layout_3bpp, 0, 256/8 ) /* background */ - GFXDECODE_ENTRY( "gfx2", 0, layout_2bpp, 8*4, 8 ) /* foreground */ - GFXDECODE_ENTRY( "gfx3", 0, layout_2bpp, 8*4+8*4, 8 ) /* text */ - GFXDECODE_ENTRY( "gfx4", 0, layout_1bpp, 254, 1 ) /* searchlight */ + GFXDECODE_ENTRY( "bgtiles", 0, layout_3bpp, 0, 256/8 ) + GFXDECODE_ENTRY( "fgtiles", 0, layout_2bpp, 8*4, 8 ) + GFXDECODE_ENTRY( "chars", 0, layout_2bpp, 8*4+8*4, 8 ) + GFXDECODE_ENTRY( "searchlight", 0, layout_1bpp, 254, 1 ) GFXDECODE_END @@ -256,29 +629,29 @@ void dday_state::machine_reset() void dday_state::dday(machine_config &config) { - /* basic machine hardware */ - Z80(config, m_maincpu, 2000000); /* 2 MHz ? */ - m_maincpu->set_addrmap(AS_PROGRAM, &dday_state::dday_map); + // basic machine hardware + Z80(config, m_maincpu, 2'000'000); // 2 MHz ? + m_maincpu->set_addrmap(AS_PROGRAM, &dday_state::program_map); - /* video hardware */ + // video hardware SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_refresh_hz(60); - m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */); + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate m_screen->set_size(32*8, 32*8); m_screen->set_visarea(0*8, 32*8-1, 0*8, 28*8-1); - m_screen->set_screen_update(FUNC(dday_state::screen_update_dday)); + m_screen->set_screen_update(FUNC(dday_state::screen_update)); m_screen->set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_dday); - PALETTE(config, m_palette, FUNC(dday_state::dday_palette), 256).enable_shadows(); + PALETTE(config, m_palette, FUNC(dday_state::palette_init), 256).enable_shadows(); m_palette->set_indirect_entries(256); // HACK!!! - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); - AY8912(config, m_ay1, 1000000).add_route(ALL_OUTPUTS, "mono", 0.25); - AY8912(config, "ay2", 1000000).add_route(ALL_OUTPUTS, "mono", 0.25); + AY8912(config, m_ay1, 1'000'000).add_route(ALL_OUTPUTS, "mono", 0.25); + AY8912(config, "ay2", 1'000'000).add_route(ALL_OUTPUTS, "mono", 0.25); } @@ -296,29 +669,29 @@ ROM_START( dday ) ROM_LOAD( "e6_65co.bin", 0x2000, 0x1000, CRC(fe414a83) SHA1(1ca1d30b71b62af5230dfe862a67c4cff5a71f41) ) ROM_LOAD( "e5_66co.bin", 0x3000, 0x1000, CRC(fc9f7774) SHA1(1071d05e2f0ee8869eeeb46ad219303b417f4c90) ) - ROM_REGION( 0x1800, "gfx1", 0 ) + ROM_REGION( 0x1800, "bgtiles", 0 ) ROM_LOAD( "k4_73.bin", 0x0000, 0x0800, CRC(fa6237e4) SHA1(0dfe2a0079324a78b462203fe93f7fb186a42122) ) ROM_LOAD( "k2_71.bin", 0x0800, 0x0800, CRC(f85461de) SHA1(e2ed34e993cd657681124df5531e35afd7d8c34b) ) ROM_LOAD( "k3_72.bin", 0x1000, 0x0800, CRC(fdfe88b6) SHA1(cdc37d90500f4ce813b6efee31139e6776aa2bff) ) - ROM_REGION( 0x1000, "gfx2", 0 ) + ROM_REGION( 0x1000, "fgtiles", 0 ) ROM_LOAD( "j8_70co.bin", 0x0000, 0x0800, CRC(0c60e94c) SHA1(136df37b858a7fd399acc89e59917a068165d749) ) ROM_LOAD( "j9_69co.bin", 0x0800, 0x0800, CRC(ba341c10) SHA1(c2c7350f87d5e47ac47cb19020681f0e7340e427) ) - ROM_REGION( 0x1000, "gfx3", 0 ) + ROM_REGION( 0x1000, "chars", 0 ) ROM_LOAD( "k6_74o.bin", 0x0000, 0x0800, CRC(66719aea) SHA1(dd29f8d079868af3c7fd16dc8c383f1eba4543d2) ) ROM_LOAD( "k7_75o.bin", 0x0800, 0x0800, CRC(5f8772e2) SHA1(16194a02bc7d5248dea7a80bf6d6d263ec8a7fd6) ) - ROM_REGION( 0x0800, "gfx4", 0 ) + ROM_REGION( 0x0800, "searchlight", 0 ) ROM_LOAD( "d4_68.bin", 0x0000, 0x0800, CRC(f3649264) SHA1(5486a33fa1f7803e68d141992d6105206da1beba) ) - ROM_REGION( 0x1000, "user1", 0 ) - ROM_LOAD( "d2_67.bin", 0x0000, 0x1000, CRC(2b693e42) SHA1(e52b987cf929ddfc7916b05456b1114076956d12) ) /* search light map */ + ROM_REGION( 0x1000, "sl_map", 0 ) + ROM_LOAD( "d2_67.bin", 0x0000, 0x1000, CRC(2b693e42) SHA1(e52b987cf929ddfc7916b05456b1114076956d12) ) ROM_REGION( 0x0300, "proms", 0 ) - ROM_LOAD( "dday.m11", 0x0000, 0x0100, CRC(aef6bbfc) SHA1(9e07729a4389221bc120af91d8275e1d05f3be7a) ) /* red component */ - ROM_LOAD( "dday.m8", 0x0100, 0x0100, CRC(ad3314b9) SHA1(d103f4f6103987ea85f0791ffc66a1cf9c711031) ) /* green component */ - ROM_LOAD( "dday.m3", 0x0200, 0x0100, CRC(e877ab82) SHA1(03e3905aee37f6743e7a4a87338f9504c832a55b) ) /* blue component */ + ROM_LOAD( "dday.m11", 0x0000, 0x0100, CRC(aef6bbfc) SHA1(9e07729a4389221bc120af91d8275e1d05f3be7a) ) // red component + ROM_LOAD( "dday.m8", 0x0100, 0x0100, CRC(ad3314b9) SHA1(d103f4f6103987ea85f0791ffc66a1cf9c711031) ) // green component + ROM_LOAD( "dday.m3", 0x0200, 0x0100, CRC(e877ab82) SHA1(03e3905aee37f6743e7a4a87338f9504c832a55b) ) // blue component ROM_END ROM_START( ddayc ) @@ -328,31 +701,33 @@ ROM_START( ddayc ) ROM_LOAD( "e6_65-c.bin", 0x2000, 0x1000, CRC(4c210686) SHA1(9d3110c4d1347f8a067c49b363a32d0f6a2c34c7) ) ROM_LOAD( "e5_66-c.bin", 0x3000, 0x1000, CRC(e7e832f9) SHA1(3cbd2f9197e934ba3eae329511886a30c09a1ac7) ) - ROM_REGION( 0x1800, "gfx1", 0 ) + ROM_REGION( 0x1800, "bgtiles", 0 ) ROM_LOAD( "k4_73.bin", 0x0000, 0x0800, CRC(fa6237e4) SHA1(0dfe2a0079324a78b462203fe93f7fb186a42122) ) ROM_LOAD( "k2_71.bin", 0x0800, 0x0800, CRC(f85461de) SHA1(e2ed34e993cd657681124df5531e35afd7d8c34b) ) ROM_LOAD( "k3_72.bin", 0x1000, 0x0800, CRC(fdfe88b6) SHA1(cdc37d90500f4ce813b6efee31139e6776aa2bff) ) - ROM_REGION( 0x1000, "gfx2", 0 ) + ROM_REGION( 0x1000, "fgtiles", 0 ) ROM_LOAD( "j8_70-c.bin", 0x0000, 0x0800, CRC(a0c6b86b) SHA1(8b30370f2d5d7e75b8ec2a68f4e408fcb8ed2c8f) ) ROM_LOAD( "j9_69-c.bin", 0x0800, 0x0800, CRC(d352a3d6) SHA1(4f1ba0b555f6b3dd539511bab8c55db45f719afc) ) - ROM_REGION( 0x1000, "gfx3", 0 ) + ROM_REGION( 0x1000, "chars", 0 ) ROM_LOAD( "k6_74.bin", 0x0000, 0x0800, CRC(d21a3e22) SHA1(9260353245f2ba2aca09fafd377c662ff508e5c0) ) ROM_LOAD( "k7_75.bin", 0x0800, 0x0800, CRC(a5e5058c) SHA1(312dd55902c7e16eeee0dfc42c17fe1440b26e40) ) - ROM_REGION( 0x0800, "gfx4", 0 ) + ROM_REGION( 0x0800, "searchlight", 0 ) ROM_LOAD( "d4_68.bin", 0x0000, 0x0800, CRC(f3649264) SHA1(5486a33fa1f7803e68d141992d6105206da1beba) ) - ROM_REGION( 0x1000, "user1", 0 ) - ROM_LOAD( "d2_67.bin", 0x0000, 0x1000, CRC(2b693e42) SHA1(e52b987cf929ddfc7916b05456b1114076956d12) ) /* search light map */ + ROM_REGION( 0x1000, "sl_map", 0 ) + ROM_LOAD( "d2_67.bin", 0x0000, 0x1000, CRC(2b693e42) SHA1(e52b987cf929ddfc7916b05456b1114076956d12) ) ROM_REGION( 0x0300, "proms", 0 ) - ROM_LOAD( "dday.m11", 0x0000, 0x0100, CRC(aef6bbfc) SHA1(9e07729a4389221bc120af91d8275e1d05f3be7a) ) /* red component */ - ROM_LOAD( "dday.m8", 0x0100, 0x0100, CRC(ad3314b9) SHA1(d103f4f6103987ea85f0791ffc66a1cf9c711031) ) /* green component */ - ROM_LOAD( "dday.m3", 0x0200, 0x0100, CRC(e877ab82) SHA1(03e3905aee37f6743e7a4a87338f9504c832a55b) ) /* blue component */ + ROM_LOAD( "dday.m11", 0x0000, 0x0100, CRC(aef6bbfc) SHA1(9e07729a4389221bc120af91d8275e1d05f3be7a) ) // red component + ROM_LOAD( "dday.m8", 0x0100, 0x0100, CRC(ad3314b9) SHA1(d103f4f6103987ea85f0791ffc66a1cf9c711031) ) // green component + ROM_LOAD( "dday.m3", 0x0200, 0x0100, CRC(e877ab82) SHA1(03e3905aee37f6743e7a4a87338f9504c832a55b) ) // blue component ROM_END +} // anonymous namespace + GAME( 1982, dday, 0, dday, dday, dday_state, empty_init, ROT0, "Olympia", "D-Day", MACHINE_IMPERFECT_COLORS | MACHINE_SUPPORTS_SAVE ) GAME( 1982, ddayc, dday, dday, ddayc, dday_state, empty_init, ROT0, "Olympia (Centuri license)", "D-Day (Centuri)", MACHINE_IMPERFECT_COLORS | MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/olympia/dday.h b/src/mame/olympia/dday.h deleted file mode 100644 index 3bf7e708ac7..00000000000 --- a/src/mame/olympia/dday.h +++ /dev/null @@ -1,87 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Zsolt Vasvari -/************************************************************************* - - D-Day - -*************************************************************************/ -#ifndef MAME_OLYMPIA_DDAY_H -#define MAME_OLYMPIA_DDAY_H - -#pragma once - -#include "emupal.h" -#include "screen.h" -#include "sound/ay8910.h" -#include "tilemap.h" - - -class dday_state : public driver_device -{ -public: - dday_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_textvideoram(*this, "textvideoram"), - m_fgvideoram(*this, "fgvideoram"), - m_bgvideoram(*this, "bgvideoram"), - m_colorram(*this, "colorram"), - m_maincpu(*this, "maincpu"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette"), - m_ay1(*this, "ay1") - { } - - void dday(machine_config &config); - -protected: - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - -private: - /* memory pointers */ - required_shared_ptr m_textvideoram; - required_shared_ptr m_fgvideoram; - required_shared_ptr m_bgvideoram; - required_shared_ptr m_colorram; - - /* video-related */ - tilemap_t *m_fg_tilemap = nullptr; - tilemap_t *m_bg_tilemap = nullptr; - tilemap_t *m_text_tilemap = nullptr; - tilemap_t *m_sl_tilemap = nullptr; - bitmap_ind16 m_main_bitmap = 0; - int m_control = 0; - int m_sl_image = 0; - int m_sl_enable = 0; - int m_timer_value = 0; - emu_timer *m_countdown_timer = nullptr; - - /* devices */ - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; - required_device m_ay1; - - uint8_t dday_countdown_timer_r(); - void dday_bgvideoram_w(offs_t offset, uint8_t data); - void dday_fgvideoram_w(offs_t offset, uint8_t data); - void dday_textvideoram_w(offs_t offset, uint8_t data); - void dday_colorram_w(offs_t offset, uint8_t data); - uint8_t dday_colorram_r(offs_t offset); - void dday_sl_control_w(uint8_t data); - void dday_control_w(uint8_t data); - TILE_GET_INFO_MEMBER(get_bg_tile_info); - TILE_GET_INFO_MEMBER(get_fg_tile_info); - TILE_GET_INFO_MEMBER(get_text_tile_info); - TILE_GET_INFO_MEMBER(get_sl_tile_info); - void dday_palette(palette_device &palette) const; - uint32_t screen_update_dday(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_CALLBACK_MEMBER(countdown_timer_callback); - void start_countdown_timer(); - void dday_map(address_map &map); -}; - -#endif // MAME_OLYMPIA_DDAY_H diff --git a/src/mame/olympia/dday_v.cpp b/src/mame/olympia/dday_v.cpp deleted file mode 100644 index dd7aa8c0799..00000000000 --- a/src/mame/olympia/dday_v.cpp +++ /dev/null @@ -1,322 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Zsolt Vasvari -/*************************************************************************** - - video.c - - Functions to emulate the video hardware of the machine. - - Convention: "sl" stands for "searchlight" - -***************************************************************************/ - -#include "emu.h" -#include "sound/ay8910.h" -#include "dday.h" - - -/* Note: There seems to be no way to reset this timer via hardware. - The game uses a difference method to reset it to 99. - - Thanks Zwaxy for the timer info. */ - -uint8_t dday_state::dday_countdown_timer_r() -{ - return ((m_timer_value / 10) << 4) | (m_timer_value % 10); -} - -TIMER_CALLBACK_MEMBER(dday_state::countdown_timer_callback) -{ - m_timer_value--; - - if (m_timer_value < 0) - m_timer_value = 99; -} - -void dday_state::start_countdown_timer() -{ - m_timer_value = 0; - - m_countdown_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); -} - - -/*************************************************************************** - - Convert the color PROMs into a more useable format. - -***************************************************************************/ - -void dday_state::dday_palette(palette_device &palette) const -{ - uint8_t const *const color_prom = memregion("proms")->base(); - - palette.set_shadow_factor(1.0 / 8); - - // create a lookup table for the palette - for (int i = 0; i < 0x100; i++) - { - int const r = pal4bit(color_prom[i + 0x000]); - int const g = pal4bit(color_prom[i + 0x100]); - int const b = pal4bit(color_prom[i + 0x200]); - - palette.set_indirect_color(i, rgb_t(r, g, b)); - } - - for (int i = 0; i < 0x100; i++) - palette.set_pen_indirect(i, i); - - // HACK!!! This table is handgenerated, but it matches the screenshot. I have no clue how it really works - palette.set_pen_indirect(0*8+0+0, 0x00); - palette.set_pen_indirect(0*8+0+1, 0x01); - palette.set_pen_indirect(0*8+0+2, 0x15); - palette.set_pen_indirect(0*8+0+3, 0x02); - palette.set_pen_indirect(0*8+4+0, 0x00); - palette.set_pen_indirect(0*8+4+1, 0x01); - palette.set_pen_indirect(0*8+4+2, 0x15); - palette.set_pen_indirect(0*8+4+3, 0x02); - - palette.set_pen_indirect(1*8+0+0, 0x04); - palette.set_pen_indirect(1*8+0+1, 0x05); - palette.set_pen_indirect(1*8+0+2, 0x03); - palette.set_pen_indirect(1*8+0+3, 0x07); - palette.set_pen_indirect(1*8+4+0, 0x04); - palette.set_pen_indirect(1*8+4+1, 0x05); - palette.set_pen_indirect(1*8+4+2, 0x03); - palette.set_pen_indirect(1*8+4+3, 0x07); - - palette.set_pen_indirect(2*8+0+0, 0x08); - palette.set_pen_indirect(2*8+0+1, 0x15); - palette.set_pen_indirect(2*8+0+2, 0x0a); - palette.set_pen_indirect(2*8+0+3, 0x03); - palette.set_pen_indirect(2*8+4+0, 0x08); - palette.set_pen_indirect(2*8+4+1, 0x15); - palette.set_pen_indirect(2*8+4+2, 0x0a); - palette.set_pen_indirect(2*8+4+3, 0x03); - - palette.set_pen_indirect(3*8+0+0, 0x08); - palette.set_pen_indirect(3*8+0+1, 0x15); - palette.set_pen_indirect(3*8+0+2, 0x0a); - palette.set_pen_indirect(3*8+0+3, 0x03); - palette.set_pen_indirect(3*8+4+0, 0x08); - palette.set_pen_indirect(3*8+4+1, 0x15); - palette.set_pen_indirect(3*8+4+2, 0x0a); - palette.set_pen_indirect(3*8+4+3, 0x03); - - palette.set_pen_indirect(4*8+0+0, 0x10); - palette.set_pen_indirect(4*8+0+1, 0x11); - palette.set_pen_indirect(4*8+0+2, 0x12); - palette.set_pen_indirect(4*8+0+3, 0x07); - palette.set_pen_indirect(4*8+4+0, 0x10); - palette.set_pen_indirect(4*8+4+1, 0x11); - palette.set_pen_indirect(4*8+4+2, 0x12); - palette.set_pen_indirect(4*8+4+3, 0x07); - - palette.set_pen_indirect(5*8+0+0, 0x1d); - palette.set_pen_indirect(5*8+0+1, 0x15); - palette.set_pen_indirect(5*8+0+2, 0x16); - palette.set_pen_indirect(5*8+0+3, 0x1b); - palette.set_pen_indirect(5*8+4+0, 0x1d); - palette.set_pen_indirect(5*8+4+1, 0x15); - palette.set_pen_indirect(5*8+4+2, 0x16); - palette.set_pen_indirect(5*8+4+3, 0x1b); - - palette.set_pen_indirect(6*8+0+0, 0x1d); - palette.set_pen_indirect(6*8+0+1, 0x15); - palette.set_pen_indirect(6*8+0+2, 0x1a); - palette.set_pen_indirect(6*8+0+3, 0x1b); - palette.set_pen_indirect(6*8+4+0, 0x1d); - palette.set_pen_indirect(6*8+4+1, 0x15); - palette.set_pen_indirect(6*8+4+2, 0x1a); - palette.set_pen_indirect(6*8+4+3, 0x1b); - - palette.set_pen_indirect(7*8+0+0, 0x1d); - palette.set_pen_indirect(7*8+0+1, 0x02); - palette.set_pen_indirect(7*8+0+2, 0x04); - palette.set_pen_indirect(7*8+0+3, 0x1b); - palette.set_pen_indirect(7*8+4+0, 0x1d); - palette.set_pen_indirect(7*8+4+1, 0x02); - palette.set_pen_indirect(7*8+4+2, 0x04); - palette.set_pen_indirect(7*8+4+3, 0x1b); -} - - -/*************************************************************************** - - Callbacks for the TileMap code - -***************************************************************************/ - -TILE_GET_INFO_MEMBER(dday_state::get_bg_tile_info) -{ - int code; - - code = m_bgvideoram[tile_index]; - tileinfo.set(0, code, code >> 5, 0); -} - -TILE_GET_INFO_MEMBER(dday_state::get_fg_tile_info) -{ - int code, flipx; - - flipx = m_colorram[tile_index & 0x03e0] & 0x01; - code = m_fgvideoram[flipx ? tile_index ^ 0x1f : tile_index]; - tileinfo.set(2, code, code >> 5, flipx ? TILE_FLIPX : 0); -} - -TILE_GET_INFO_MEMBER(dday_state::get_text_tile_info) -{ - int code; - - code = m_textvideoram[tile_index]; - tileinfo.set(1, code, code >> 5, 0); -} - -TILE_GET_INFO_MEMBER(dday_state::get_sl_tile_info) -{ - int code, sl_flipx, flipx; - uint8_t* sl_map; - - sl_map = &memregion("user1")->base()[(m_sl_image & 0x07) * 0x0200]; - - flipx = (tile_index >> 4) & 0x01; - sl_flipx = (m_sl_image >> 3) & 0x01; - - /* bit 4 is really a flip indicator. Need to shift bits 5-9 to the right by 1 */ - tile_index = ((tile_index & 0x03e0) >> 1) | (tile_index & 0x0f); - - code = sl_map[flipx ? tile_index ^ 0x0f : tile_index]; - - if ((sl_flipx != flipx) && (code & 0x80)) - /* no mirroring, draw dark spot */ - code = 1; - - tileinfo.set(3, code & 0x3f, 0, flipx ? TILE_FLIPX : 0); -} - - -/*************************************************************************** - - Start the video hardware emulation. - -***************************************************************************/ - -void dday_state::video_start() -{ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(dday_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(dday_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - m_text_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(dday_state::get_text_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - m_sl_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(dday_state::get_sl_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - - m_screen->register_screen_bitmap(m_main_bitmap); - - m_bg_tilemap->set_transmask(0, 0x00f0, 0xff0f); /* pens 0-3 have priority over the foreground layer */ - m_fg_tilemap->set_transparent_pen(0); - m_text_tilemap->set_transparent_pen(0); - - m_countdown_timer = timer_alloc(FUNC(dday_state::countdown_timer_callback), this); - - start_countdown_timer(); -} - -void dday_state::dday_bgvideoram_w(offs_t offset, uint8_t data) -{ - m_bgvideoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -void dday_state::dday_fgvideoram_w(offs_t offset, uint8_t data) -{ - m_fgvideoram[offset] = data; - m_fg_tilemap->mark_tile_dirty(offset); - m_fg_tilemap->mark_tile_dirty(offset ^ 0x1f); /* for flipx case */ -} - -void dday_state::dday_textvideoram_w(offs_t offset, uint8_t data) -{ - m_textvideoram[offset] = data; - m_text_tilemap->mark_tile_dirty(offset); -} - -void dday_state::dday_colorram_w(offs_t offset, uint8_t data) -{ - offset &= 0x03e0; - - m_colorram[offset & 0x3e0] = data; - - for (int i = 0; i < 0x20; i++) - m_fg_tilemap->mark_tile_dirty(offset + i); -} - -uint8_t dday_state::dday_colorram_r(offs_t offset) -{ - return m_colorram[offset & 0x03e0]; -} - - -void dday_state::dday_sl_control_w(uint8_t data) -{ - if (m_sl_image != data) - { - m_sl_image = data; - m_sl_tilemap->mark_all_dirty(); - } -} - - -void dday_state::dday_control_w(uint8_t data) -{ - //if (data & 0xac) logerror("Control = %02X\n", data & 0xac); - - /* bit 0 is coin counter 1 */ - machine().bookkeeping().coin_counter_w(0, data & 0x01); - - /* bit 1 is coin counter 2 */ - machine().bookkeeping().coin_counter_w(1, data & 0x02); - - /* bit 4 is sound enable */ - if (!(data & 0x10) && (m_control & 0x10)) - m_ay1->reset(); - - machine().sound().system_mute(!BIT(data, 4)); - - /* bit 6 is search light enable */ - m_sl_enable = data & 0x40; - - m_control = data; -} - -/*************************************************************************** - - Display refresh - -***************************************************************************/ - -uint32_t dday_state::screen_update_dday(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->draw(screen, m_main_bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); - m_fg_tilemap->draw(screen, m_main_bitmap, cliprect, 0, 0); - m_bg_tilemap->draw(screen, m_main_bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); - m_text_tilemap->draw(screen, m_main_bitmap, cliprect, 0, 0); - - if (m_sl_enable) - { - /* apply shadow */ - bitmap_ind16 &sl_bitmap = m_sl_tilemap->pixmap(); - - for (int x = cliprect.min_x; x <= cliprect.max_x; x++) - for (int y = cliprect.min_y; y <= cliprect.max_y; y++) - { - uint16_t src_pixel = m_main_bitmap.pix(y, x); - - if (sl_bitmap.pix(y, x) == 0xff) - src_pixel += m_palette->entries(); - - bitmap.pix(y, x) = src_pixel; - } - } - else - copybitmap(bitmap, m_main_bitmap, 0, 0, 0, 0, cliprect); - - return 0; -} diff --git a/src/mame/olympia/portrait.cpp b/src/mame/olympia/portrait.cpp index 0a54886f089..6d31322ef95 100644 --- a/src/mame/olympia/portrait.cpp +++ b/src/mame/olympia/portrait.cpp @@ -1,5 +1,6 @@ // license:BSD-3-Clause -// copyright-holders:Steve Ellenoff, Pierpaolo Prazzoli, Angelo Salese +// copyright-holders: Steve Ellenoff, Pierpaolo Prazzoli, Angelo Salese + /************************************************************************** Portraits (c) 1983 Olympia @@ -96,18 +97,318 @@ DM81LS95 = TriState buffer **************************************************************************/ #include "emu.h" -#include "portrait.h" +#include "cpu/mcs48/mcs48.h" #include "cpu/z80/z80.h" #include "machine/gen_latch.h" #include "machine/nvram.h" +#include "machine/pit8253.h" +#include "sound/tms5220.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" + + +namespace { + +class portrait_state : public driver_device +{ +public: + portrait_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_audiocpu(*this, "audiocpu") + , m_gfxdecode(*this, "gfxdecode") + , m_palette(*this, "palette") + , m_tms(*this, "tms") + , m_bgvideoram(*this, "bgvideoram") + , m_fgvideoram(*this, "fgvideoram") + , m_spriteram(*this, "spriteram") + , m_lamps(*this, "lamp%u", 0U) + , m_photo(*this, "photo") + { } + + static constexpr feature_type unemulated_features() { return feature::CAMERA; } + + void portrait(machine_config &config); + +protected: + virtual void machine_start() override { m_lamps.resolve(); m_photo.resolve(); } + virtual void video_start() override; + +private: + void ctrl_w(uint8_t data); + void scroll_w(offs_t offset, uint8_t data); + void bgvideo_write(offs_t offset, uint8_t data); + void fgvideo_write(offs_t offset, uint8_t data); + + TILE_GET_INFO_MEMBER(get_bg_tile_info); + TILE_GET_INFO_MEMBER(get_fg_tile_info); + + void palette_init(palette_device &palette) const; + + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + inline void get_tile_info(tile_data &tileinfo, int tile_index, const uint8_t *source); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t priority); + void main_program_map(address_map &map); + void audio_program_map(address_map &map); + + required_device m_maincpu; + required_device m_audiocpu; + required_device m_gfxdecode; + required_device m_palette; + required_device m_tms; + + required_shared_ptr m_bgvideoram; + required_shared_ptr m_fgvideoram; + required_shared_ptr m_spriteram; + output_finder<2> m_lamps; + output_finder<> m_photo; + + uint16_t m_scroll = 0; + tilemap_t *m_foreground = nullptr; + tilemap_t *m_background = nullptr; +}; + + +void portrait_state::bgvideo_write(offs_t offset, uint8_t data) +{ + m_background->mark_tile_dirty(offset / 2); + m_bgvideoram[offset] = data; +} + +void portrait_state::fgvideo_write(offs_t offset, uint8_t data) +{ + m_foreground->mark_tile_dirty(offset / 2); + m_fgvideoram[offset] = data; +} + +// NB: undisplayed areas gets filled at POST but never really used +// $8x36-$8x3f / $8x76-$8x7f / $8xb6-$8xbf / $8xf6-$8xff +// given that tilemap doesn't really cope well with live editing your best bet in debugging this is +// potentially to subscribe these unused areas to a mark_all_dirty() fn. +inline void portrait_state::get_tile_info(tile_data &tileinfo, int tile_index, const uint8_t *source) +{ + int const attr = source[tile_index * 2 + 0]; + int tilenum = source[tile_index * 2 + 1]; + int flags = 0; + int color = 0; + + // TODO: always set with bit 4 + if (attr & 0x20) flags = TILE_FLIPY; + + if (attr & 1) + tilenum += 0x200; + if (attr & 2) + tilenum += 0x100; + if (attr & 4) + tilenum ^= 0x300; + + // TODO: is the wild arrangement above related to how color upper banks should work? + // cfr. trees in stage 4 leaving holes against the other layer + + // TODO: kludgy + // at worst this is modified at mixing time, outputting sprite color for the status bar. + if (tilenum < 0x100) + color = ((tilenum & 0xfe) >> 1) + 0x00; + else + color = ((tilenum & 0xfe) >> 1) + 0x80; + + tileinfo.set(0, tilenum, color, flags); +} + +TILE_GET_INFO_MEMBER(portrait_state::get_bg_tile_info) +{ + get_tile_info(tileinfo, tile_index, m_bgvideoram); +} + +TILE_GET_INFO_MEMBER(portrait_state::get_fg_tile_info) +{ + get_tile_info(tileinfo, tile_index, m_fgvideoram); +} + +void portrait_state::video_start() +{ + m_background = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(portrait_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); + m_foreground = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(portrait_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); + + m_foreground->set_transparent_pen(7); + + save_item(NAME(m_scroll)); +} + +/* tileattr ROM + + this appears to be divided into 2 0x400 banks + + 0x000 - 0x3ff relates to tiles 0x000-0x0ff + + 0x400 - 0x7ff relates to tiles 0x100-0x1ff, 0x200-0x2ff, and 0x300-0x3ff + + every 2 tiles are somehow related to 8 bytes in the data + + so tiles 0x00 and 0x01 use bytes 0x000-0x007 + 0x02 0x008 + 0x04 0x010 + 0x06 0x018 + 0x08 0x020 + 0x0a 0x028 + 0x0c 0x030 + 0x0e 0x038 + 0x10 0x040 + ....... + 0xfe and 0xff use bytes 0x3f8-0x3ff + etc. + + it's probably some kind of lookup table for the colours (6bpp = 8 colours, maybe every 2 tiles share the same 8 colours) + I guess either the bank (0/1) can be selected, or bank 0 is hardcoded to tiles 0x000-0x0ff (because tilemaps can use + these tiles too, so it's not a case of it being a sprite/tilemap lookup split) + + anyway.. this is why the portraits logo is broken across 3 areas (0x1f2, 0x2f2, 0x3f2) so that they can share the same + attributes from this ROM + +*/ +void portrait_state::palette_init(palette_device &palette) const +{ + uint8_t const *const color_prom = memregion("proms")->base(); + + for (int i = 0; i < 0x20; i++) + { + int const data = (color_prom[i + 0] << 0) | (color_prom[i + 0x20] << 8); + + // TODO: experimental workbench, not using pal*bit intentionally. + // 13 valid bits: + // [+0x00] bit 0-3, bit 6-4 + // [+0x20] bit 0-2, bit 7-5 + // Only bit 0-3 seems to have a valid color ramp, is the rest actually bit mixed? + + int ii = (data >> 0) & 0x0f; + //int b = ((data >> 4) & 0x7) * ii; + //int r = ((data >> 8) & 0x7) * ii; + //int g = ((data >> 13) & 0x7) * ii; + int r = ii * 0x11; + int g = ii * 0x11; + int b = ii * 0x11; + + palette.set_indirect_color(i, rgb_t(r, g, b)); + + ii = (data >> 1) & 0x0f; + r = ii * 0x11; + g = ii * 0x11; + b = ii * 0x11; + + // ?? the lookup seems to reference 0x3f colours, unless 1 bit is something else (priority?) + palette.set_indirect_color(i + 0x20, rgb_t(r, g, b)); + } + + uint8_t const *const lookup = memregion("tileattr")->base(); + for (int i = 0; i < 0x800; i++) + { + uint8_t const ctabentry = lookup[i] & 0x3f; + palette.set_pen_indirect(i, ctabentry); + } +} + +/* + * [2] + * x--- ---- priority? + * -x-- ---- more priority? + * \- eagle sprite in stage 4 sets this only, + * drawing should really go above the fg layer mountains + * (missing tile category?) + * --x- ---- flipy + * ---x ---- ? + * ---- x--- msb Y position? + * ---- -x-- msb X position? + */ +void portrait_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t priority) +{ + uint8_t const *source = m_spriteram; + uint8_t const *finish = source + 0x200; + + // TODO: is anything beyond byte [3] really just work RAM buffer? + for (; source < finish; source += 0x10) + { + uint8_t const attr = source[2]; + if (BIT(attr, 7) != priority) + continue; + uint16_t sy = source[0]; + uint16_t sx = source[1]; + uint8_t const tilenum = source[3]; + + // TODO: may be given by source[4] and/or source[5] instead + uint8_t color = ((tilenum & 0xff) >> 1) + 0x00; + + int const fy = BIT(attr, 5); + + if (BIT(attr, 2)) sx |= 0x100; + if (BIT(attr, 3)) sy |= 0x100; + + sx += (source - m_spriteram) - 8; + sx &= 0x1ff; + + // TODO: confirm Y calculation + // it expects to follow up whatever is the current scroll value (cfr. monkeys climbing trees in stage 1) + // but then there are various misc sprites that break this rule. Examples are: + // - player photo flash; + // - death animation sprites; + // - capturing photo frame in gameplay; + // PC=0x2828 is where all of these odd sprites happen, where: + // HL=ROM pointer for destination sprite pointer, IY=sprite pointer source + // where they copy the origin of the given sprite, read scroll buffer $9235-36 then apply offset, + // with [2] bits 7-6 set high and bits 5-4 copied from the source sprite. + // Note that this will break elsewhere by logically using any of the [2] bits, + // arguably SW does a very limited use to pinpoint what's the actual scroll disable condition, + // it just implicitly don't setup [4] to [7] ... + if ((source[5] & 0xf) == 0) + sy = (511 - 16) - sy; + else + sy = ((511 - m_scroll) - 16) - sy; + + sy &= 0x1ff; + + m_gfxdecode->gfx(0)->transpen( + bitmap, cliprect, + tilenum, color, + 0, fy, + sx, sy, + 7); + } +} + +uint32_t portrait_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + rectangle cliprect_scroll, cliprect_no_scroll; + + cliprect_scroll = cliprect_no_scroll = cliprect; + + // TODO: make clipping areas more readable + cliprect_no_scroll.min_x = cliprect_no_scroll.max_x - 111; + cliprect_scroll.max_x = cliprect_scroll.min_x + 319; + + // status bar + m_background->set_scrolly(0, 0); + m_foreground->set_scrolly(0, 0); + m_background->draw(screen, bitmap, cliprect_no_scroll, 0, 0); + m_foreground->draw(screen, bitmap, cliprect_no_scroll, 0, 0); + + // playfield + m_background->set_scrolly(0, m_scroll); + m_foreground->set_scrolly(0, m_scroll); + m_background->draw(screen, bitmap, cliprect_scroll, 0, 0); + draw_sprites(bitmap, cliprect_scroll, 0); + m_foreground->draw(screen, bitmap, cliprect_scroll, 0, 0); + draw_sprites(bitmap, cliprect_scroll, 1); + + return 0; +} void portrait_state::ctrl_w(uint8_t data) { - /* bits 4 and 5 are unknown */ + // bits 4 and 5 are unknown // TODO: condition for just displaying stored camera image // 0xf8 when capturing for the hi-score new pic, 0xb0 when displaying it from attract mode. @@ -115,11 +416,11 @@ void portrait_state::ctrl_w(uint8_t data) machine().bookkeeping().coin_counter_w(1, data & 0x02); machine().bookkeeping().coin_counter_w(2, data & 0x04); - /* the 2 lamps near the camera */ + // the 2 lamps near the camera m_lamps[0] = BIT(data, 3); m_lamps[1] = BIT(data, 6); - /* shows the black and white photo from the camera */ + // shows the black and white photo from the camera m_photo = BIT(data, 7); } @@ -132,16 +433,15 @@ void portrait_state::scroll_w(offs_t offset, uint8_t data) m_scroll += 256; } -void portrait_state::portrait_map(address_map &map) +void portrait_state::main_program_map(address_map &map) { map(0x0000, 0x7fff).rom(); - map(0x8000, 0x87ff).ram().w(FUNC(portrait_state::bgvideo_write)).share("bgvideoram"); - map(0x8800, 0x8fff).ram().w(FUNC(portrait_state::fgvideo_write)).share("fgvideoram"); - map(0x9000, 0x91ff).ram().share("spriteram"); + map(0x8000, 0x87ff).ram().w(FUNC(portrait_state::bgvideo_write)).share(m_bgvideoram); + map(0x8800, 0x8fff).ram().w(FUNC(portrait_state::fgvideo_write)).share(m_fgvideoram); + map(0x9000, 0x91ff).ram().share(m_spriteram); map(0x9200, 0x97ff).ram(); - map(0xa000, 0xa000).w("soundlatch", FUNC(generic_latch_8_device::write)); + map(0xa000, 0xa000).portr("DSW1").w("soundlatch", FUNC(generic_latch_8_device::write)); map(0xa010, 0xa010).nopw(); // more sound? Follows up whatever is happening on screen - map(0xa000, 0xa000).portr("DSW1"); map(0xa004, 0xa004).portr("DSW2"); map(0xa008, 0xa008).portr("SYSTEM").w(FUNC(portrait_state::ctrl_w)); map(0xa010, 0xa010).portr("INPUTS"); @@ -153,7 +453,7 @@ void portrait_state::portrait_map(address_map &map) } -void portrait_state::portrait_sound_map(address_map &map) +void portrait_state::audio_program_map(address_map &map) { map(0x0000, 0x0fff).rom(); } @@ -242,34 +542,36 @@ INPUT_PORTS_END static const gfx_layout tile_layout = { - 16,16, /* tile width, height */ - 1024, /* number of characters */ - 3, /* bits per pixel */ - { 0x0000*8, 0x4000*8, 0x8000*8 }, /* bitplane offsets */ + 16,16, // tile width, height + 1024, // number of characters + 3, // bits per pixel + { 0x0000*8, 0x4000*8, 0x8000*8 }, // bitplane offsets { RGN_FRAC(1,2)+7, RGN_FRAC(1,2)+6, RGN_FRAC(1,2)+5, RGN_FRAC(1,2)+4, RGN_FRAC(1,2)+3, RGN_FRAC(1,2)+2, RGN_FRAC(1,2)+1, RGN_FRAC(1,2)+0, 0, 1, 2, 3, 4, 5, 6, 7 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 8*9, 8*10, 8*11, 8*12, 8*13, 8*14, 8*15 }, - 8*16 /* character offset */ + 8*16 // character offset }; static GFXDECODE_START( gfx_portrait ) - GFXDECODE_ENTRY( "gfx1", 0x00000, tile_layout, 0, 0x800/8 ) + GFXDECODE_ENTRY( "tiles", 0x00000, tile_layout, 0, 0x800/8 ) GFXDECODE_END void portrait_state::portrait(machine_config &config) { - Z80(config, m_maincpu, 4000000); /* 4 MHz ? */ - m_maincpu->set_addrmap(AS_PROGRAM, &portrait_state::portrait_map); + Z80(config, m_maincpu, 4'000'000); // 4 MHz ? + m_maincpu->set_addrmap(AS_PROGRAM, &portrait_state::main_program_map); m_maincpu->set_vblank_int("screen", FUNC(portrait_state::irq0_line_hold)); - I8039(config, m_audiocpu, 3120000); /* ? */ - m_audiocpu->set_addrmap(AS_PROGRAM, &portrait_state::portrait_sound_map); + I8039(config, m_audiocpu, 3'120'000); // ? + m_audiocpu->set_addrmap(AS_PROGRAM, &portrait_state::audio_program_map); + + PIT8253(config, "pit0", 0); // TODO - // TODO: PIT8253 + PIT8253(config, "pit1", 0); // TODO NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); @@ -282,19 +584,19 @@ void portrait_state::portrait(machine_config &config) screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_portrait); - PALETTE(config, m_palette, FUNC(portrait_state::portrait_palette), 0x800, 0x40); + PALETTE(config, m_palette, FUNC(portrait_state::palette_init), 0x800, 0x40); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, "soundlatch"); - TMS5200(config, m_tms, 640000).add_route(ALL_OUTPUTS, "mono", 1.0); + TMS5200(config, m_tms, 640'000).add_route(ALL_OUTPUTS, "mono", 1.0); } ROM_START( portrait ) - ROM_REGION( 0x10000, "maincpu", 0 ) /* 64k for the cpu */ + ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "prt-p0.bin", 0x0000, 0x2000, CRC(a21874fa) SHA1(3db863f465a35d7d14dd71b47aa7dfe7b39fccf0) ) ROM_LOAD( "prt-p1.bin", 0x2000, 0x2000, CRC(4d4d7793) SHA1(f828950ebbf285fc92c65f24421a20ceacef1cb9) ) ROM_LOAD( "prt-p2.bin", 0x4000, 0x2000, CRC(83d88c9c) SHA1(c876f72b66537a49620fa27a5cb8a4aecd378f0a) ) @@ -304,7 +606,7 @@ ROM_START( portrait ) ROM_LOAD( "port_w.bin", 0x0000, 0x0800, CRC(d3a4e950) SHA1(0a399d43c7690d568874f3b1d55135f803fc223f) ) ROM_LOAD( "port_ma.bin", 0x0800, 0x0800, CRC(ee242e4f) SHA1(fb67e0d136927e04f4fa819f684c97b0d52ee48c) ) - ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_REGION( 0x20000, "tiles", 0 ) ROM_LOAD( "port_00.a1", 0x00000, 0x2000, CRC(eb3e1c12) SHA1(2d38b66f52546b40553244c8a5c961279559f5b6) ) ROM_LOAD( "port_10.b1", 0x02000, 0x2000, CRC(0f44e377) SHA1(1955f9f4deab2166f637f43c1f326bd65fc90f6a) ) @@ -326,7 +628,7 @@ ROM_START( portrait ) ROM_REGION( 0x0800, "user1", 0 ) // sound related? ROM_LOAD( "port_sa.bin", 0x0000, 0x0800, CRC(50510897) SHA1(8af0f42699602a5b33500968c958e3784e03377f) ) - ROM_REGION( 0x800, "tileattr", 0 ) // tile attributes + ROM_REGION( 0x800, "tileattr", 0 ) ROM_LOAD( "93z511.bin", 0x0000, 0x0800, CRC(d66d9036) SHA1(7a25efbd8f2f94a01aad9e2be9cb18da7b9ec1d1) ) ROM_REGION( 0x40, "proms", 0 ) // colors @@ -335,7 +637,7 @@ ROM_START( portrait ) ROM_END ROM_START( portraita ) - ROM_REGION( 0x10000, "maincpu", 0 ) /* 64k for the cpu */ + ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "portp0f.m1", 0x0000, 0x2000, CRC(333eace3) SHA1(8f02df09d8b50d7e37d5abf7d539624c59a7201e) ) ROM_LOAD( "portp0f.p1", 0x2000, 0x2000, CRC(fe258052) SHA1(f453eb05c68d61dfd644688732ff5c07366c68c0) ) ROM_LOAD( "portp2f.r1", 0x4000, 0x2000, CRC(bc0104d5) SHA1(7707b85cde2dc9bd95391d4e1dbed219c52618cd) ) @@ -345,7 +647,7 @@ ROM_START( portraita ) ROM_LOAD( "port_w.bin", 0x0000, 0x0800, CRC(d3a4e950) SHA1(0a399d43c7690d568874f3b1d55135f803fc223f) ) ROM_LOAD( "port_ma.bin", 0x0800, 0x0800, CRC(ee242e4f) SHA1(fb67e0d136927e04f4fa819f684c97b0d52ee48c) ) - ROM_REGION( 0x20000, "gfx1", 0 ) + ROM_REGION( 0x20000, "tiles", 0 ) ROM_LOAD( "port_00.a1", 0x00000, 0x2000, CRC(eb3e1c12) SHA1(2d38b66f52546b40553244c8a5c961279559f5b6) ) ROM_LOAD( "port_10.b1", 0x02000, 0x2000, CRC(0f44e377) SHA1(1955f9f4deab2166f637f43c1f326bd65fc90f6a) ) ROM_LOAD( "port_02.d1", 0x04000, 0x2000, CRC(bd93a3f9) SHA1(9cb479b8840cafd6043ff0cb9d5ca031dcd332ba) ) @@ -360,7 +662,7 @@ ROM_START( portraita ) ROM_LOAD( "port_05.g2", 0x18000, 0x2000, CRC(43ea7951) SHA1(df0ae7fa802365979514063e1d67cdd45ecada90) ) ROM_LOAD( "port_15.h2", 0x1a000, 0x2000, CRC(ab20b438) SHA1(ea5d60f6a9f06397bd0c6ee028b463c684090c01) ) - ROM_REGION( 0x800, "tileattr", 0 ) // tile attributes (see notes) + ROM_REGION( 0x800, "tileattr", 0 ) // (see notes) ROM_LOAD( "93z511.bin", 0x0000, 0x0800, CRC(d66d9036) SHA1(7a25efbd8f2f94a01aad9e2be9cb18da7b9ec1d1) ) ROM_REGION( 0x40, "proms", 0 ) // colors @@ -368,6 +670,8 @@ ROM_START( portraita ) ROM_LOAD( "port_pr2.n4", 0x20, 0x0020, CRC(008634f3) SHA1(7cde6b09ede672d562569866d944428198f2ba9c) ) ROM_END +} // anonymous namespace + -GAME( 1983, portrait, 0, portrait, portrait, portrait_state, empty_init, ROT270, "Olympia", "Portraits (set 1)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) -GAME( 1983, portraita,portrait, portrait, portrait, portrait_state, empty_init, ROT270, "Olympia", "Portraits (set 2)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) // harder set +GAME( 1983, portrait, 0, portrait, portrait, portrait_state, empty_init, ROT270, "Olympia", "Portraits (set 1)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) +GAME( 1983, portraita, portrait, portrait, portrait, portrait_state, empty_init, ROT270, "Olympia", "Portraits (set 2)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_IMPERFECT_GRAPHICS | MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) // harder set diff --git a/src/mame/olympia/portrait.h b/src/mame/olympia/portrait.h deleted file mode 100644 index 38c4d3de864..00000000000 --- a/src/mame/olympia/portrait.h +++ /dev/null @@ -1,72 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Steve Ellenoff, Pierpaolo Prazzoli, Angelo Salese -#ifndef MAME_OLYMPIA_PORTRAIT_H -#define MAME_OLYMPIA_PORTRAIT_H - -#pragma once - -#include "cpu/mcs48/mcs48.h" -#include "sound/tms5220.h" -#include "emupal.h" -#include "tilemap.h" - -class portrait_state : public driver_device -{ -public: - portrait_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_audiocpu(*this, "audiocpu") - , m_gfxdecode(*this, "gfxdecode") - , m_palette(*this, "palette") - , m_tms(*this, "tms") - , m_bgvideoram(*this, "bgvideoram") - , m_fgvideoram(*this, "fgvideoram") - , m_spriteram(*this, "spriteram") - , m_lamps(*this, "lamp%u", 0U) - , m_photo(*this, "photo") - { } - - static constexpr feature_type unemulated_features() { return feature::CAMERA; } - - void portrait(machine_config &config); - -protected: - virtual void machine_start() override { m_lamps.resolve(); m_photo.resolve(); } - virtual void video_start() override; - -private: - void ctrl_w(uint8_t data); - void scroll_w(offs_t offset, uint8_t data); - void bgvideo_write(offs_t offset, uint8_t data); - void fgvideo_write(offs_t offset, uint8_t data); - - TILE_GET_INFO_MEMBER(get_bg_tile_info); - TILE_GET_INFO_MEMBER(get_fg_tile_info); - - void portrait_palette(palette_device &palette) const; - - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - inline void get_tile_info( tile_data &tileinfo, int tile_index, const uint8_t *source ); - void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, u8 priority); - void portrait_map(address_map &map); - void portrait_sound_map(address_map &map); - - required_device m_maincpu; - required_device m_audiocpu; - required_device m_gfxdecode; - required_device m_palette; - required_device m_tms; - - required_shared_ptr m_bgvideoram; - required_shared_ptr m_fgvideoram; - required_shared_ptr m_spriteram; - output_finder<2> m_lamps; - output_finder<> m_photo; - - int m_scroll = 0; - tilemap_t *m_foreground = nullptr; - tilemap_t *m_background = nullptr; -}; - -#endif // MAME_OLYMPIA_PORTRAIT_H diff --git a/src/mame/olympia/portrait_v.cpp b/src/mame/olympia/portrait_v.cpp deleted file mode 100644 index a5ae385866d..00000000000 --- a/src/mame/olympia/portrait_v.cpp +++ /dev/null @@ -1,244 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Steve Ellenoff, Pierpaolo Prazzoli, Angelo Salese -/*************************************************************************** - - Portraits - video hardware emulation - -***************************************************************************/ - -#include "emu.h" -#include "portrait.h" - - -void portrait_state::bgvideo_write(offs_t offset, uint8_t data) -{ - m_background->mark_tile_dirty(offset/2); - m_bgvideoram[offset] = data; -} - -void portrait_state::fgvideo_write(offs_t offset, uint8_t data) -{ - m_foreground->mark_tile_dirty(offset/2); - m_fgvideoram[offset] = data; -} - -// NB: undisplayed areas gets filled at POST but never really used -// $8x36-$8x3f / $8x76-$8x7f / $8xb6-$8xbf / $8xf6-$8xff -// given that tilemap doesn't really cope well with live editing your best bet in debugging this is -// potentially to subscribe these unused areas to a mark_all_dirty() fn. -inline void portrait_state::get_tile_info( tile_data &tileinfo, int tile_index, const uint8_t *source ) -{ - int attr = source[tile_index*2+0]; - int tilenum = source[tile_index*2+1]; - int flags = 0; - int color = 0; - - // TODO: always set with bit 4 - if( attr & 0x20 ) flags = TILE_FLIPY; - - if (attr & 1) - tilenum += 0x200; - if (attr & 2) - tilenum += 0x100; - if (attr & 4) - tilenum ^= 0x300; - - // TODO: is the wild arrangement above related to how color upper banks should work? - // cfr. trees in stage 4 leaving holes against the other layer - - // TODO: kludgy - // at worst this is modified at mixing time, outputting sprite color for the status bar. - if (tilenum<0x100) - color = ((tilenum&0xfe) >> 1) + 0x00; - else - color = ((tilenum&0xfe) >> 1) + 0x80; - - tileinfo.set(0, tilenum, color, flags ); -} - -TILE_GET_INFO_MEMBER(portrait_state::get_bg_tile_info) -{ - get_tile_info(tileinfo, tile_index, m_bgvideoram ); -} - -TILE_GET_INFO_MEMBER(portrait_state::get_fg_tile_info) -{ - get_tile_info(tileinfo, tile_index, m_fgvideoram ); -} - -void portrait_state::video_start() -{ - m_background = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(portrait_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); - m_foreground = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(portrait_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); - - m_foreground->set_transparent_pen(7); - - save_item(NAME(m_scroll)); -} - -/* tileattr rom - - this appears to be divided into 2 0x400 banks - - 0x000 - 0x3ff relates to tiles 0x000-0x0ff - - 0x400 - 0x7ff relates to tiles 0x100-0x1ff, 0x200-0x2ff, and 0x300-0x3ff - - every 2 tiles are somehow related to 8 bytes in the data - - so tiles 0x00 and 0x01 use bytes 0x000-0x007 - 0x02 0x008 - 0x04 0x010 - 0x06 0x018 - 0x08 0x020 - 0x0a 0x028 - 0x0c 0x030 - 0x0e 0x038 - 0x10 0x040 - ....... - 0xfe and 0xff use bytes 0x3f8-0x3ff - etc. - - it's probably some kind of lookup table for the colours (6bpp = 8 colours, maybe every 2 tiles share the same 8 colours) - I guess either the bank (0/1) can be selected, or bank 0 is hardcoded to tiles 0x000-0x0ff (because tilemaps can use - these tiles too, so it's not a case of it being a sprite/tilemap lookup split) - - anyway.. this is why the portraits logo is broken across 3 areas (0x1f2, 0x2f2, 0x3f2) so that they can share the same - attributes from this rom - -*/ -void portrait_state::portrait_palette(palette_device &palette) const -{ - uint8_t const *const color_prom = memregion("proms")->base(); - - for (int i = 0; i < 0x20; i++) - { - int const data = (color_prom[i + 0] << 0) | (color_prom[i + 0x20] << 8); - - // TODO: experimental workbench, not using pal*bit intentionally. - // 13 valid bits: - // [+0x00] bit 0-3, bit 6-4 - // [+0x20] bit 0-2, bit 7-5 - // Only bit 0-3 seems to have a valid color ramp, is the rest actually bit mixed? - - int ii = (data >> 0) & 0x0f; - //int b = ((data >> 4) & 0x7) * ii; - //int r = ((data >> 8) & 0x7) * ii; - //int g = ((data >> 13) & 0x7) * ii; - int r = ii * 0x11; - int g = ii * 0x11; - int b = ii * 0x11; - - palette.set_indirect_color(i, rgb_t(r, g, b)); - - ii = (data >> 1) & 0x0f; - r = ii * 0x11; - g = ii * 0x11; - b = ii * 0x11; - - // ?? the lookup seems to reference 0x3f colours, unless 1 bit is something else (priority?) - palette.set_indirect_color(i + 0x20, rgb_t(r, g, b)); - } - - uint8_t const *const lookup = memregion("tileattr")->base(); - for (int i = 0; i < 0x800; i++) - { - uint8_t const ctabentry = lookup[i] & 0x3f; - palette.set_pen_indirect(i, ctabentry); - } -} - -/* - * [2] - * x--- ---- priority? - * -x-- ---- more priority? - * \- eagle sprite in stage 4 sets this only, - * drawing should really go above the fg layer mountains - * (missing tile category?) - * --x- ---- flipy - * ---x ---- ? - * ---- x--- msb Y position? - * ---- -x-- msb X position? - */ -void portrait_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, u8 priority) -{ - uint8_t *source = m_spriteram; - uint8_t *finish = source + 0x200; - - // TODO: is anything beyond byte [3] really just work RAM buffer? - for( ; source < finish; source += 0x10 ) - { - u8 attr = source[2]; - if (BIT(attr, 7) != priority) - continue; - u16 sy = source[0]; - u16 sx = source[1]; - u8 tilenum = source[3]; - - // TODO: may be given by source[4] and/or source[5] instead - u8 color = ((tilenum&0xff)>>1)+0x00; - - int fy = BIT(attr, 5); - - if (BIT(attr, 2)) sx |= 0x100; - if (BIT(attr, 3)) sy |= 0x100; - - sx += (source - m_spriteram) - 8; - sx &= 0x1ff; - - // TODO: confirm Y calculation - // it expects to follow up whatever is the current scroll value (cfr. monkeys climbing trees in stage 1) - // but then there are various misc sprites that breaks this rule. Examples are: - // - player photo flash; - // - death animation sprites; - // - capturing photo frame in gameplay; - // PC=0x2828 is where all of these odd sprites happens, where: - // HL=ROM pointer for destination sprite pointer, IY=sprite pointer source - // where they copy the origin of the given sprite, read scroll buffer $9235-36 then apply offset, - // with [2] bits 7-6 set high and bits 5-4 copied from the source sprite. - // Note that this will break elsewhere by logically using any of the [2] bits, - // arguably SW does a very limited use to pinpoint what's the actual scroll disable condition, - // it just implicitly don't setup [4] to [7] ... - if ((source[5] & 0xf) == 0) - sy = (511 - 16) - sy; - else - sy = ((511 - m_scroll) - 16) - sy; - - sy &= 0x1ff; - - m_gfxdecode->gfx(0)->transpen( - bitmap, cliprect, - tilenum, color, - 0, fy, - sx, sy, - 7); - } -} - -uint32_t portrait_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - rectangle cliprect_scroll, cliprect_no_scroll; - - cliprect_scroll = cliprect_no_scroll = cliprect; - - // TODO: make clipping areas more readable - cliprect_no_scroll.min_x = cliprect_no_scroll.max_x - 111; - cliprect_scroll.max_x = cliprect_scroll.min_x + 319; - - // status bar - m_background->set_scrolly(0, 0); - m_foreground->set_scrolly(0, 0); - m_background->draw(screen, bitmap, cliprect_no_scroll, 0, 0); - m_foreground->draw(screen, bitmap, cliprect_no_scroll, 0, 0); - - // playfield - m_background->set_scrolly(0, m_scroll); - m_foreground->set_scrolly(0, m_scroll); - m_background->draw(screen, bitmap, cliprect_scroll, 0, 0); - draw_sprites(bitmap, cliprect_scroll, 0); - m_foreground->draw(screen, bitmap, cliprect_scroll, 0, 0); - draw_sprites(bitmap, cliprect_scroll, 1); - - return 0; -} diff --git a/src/mame/recfranco/rfjailbrk.cpp b/src/mame/recfranco/rfjailbrk.cpp index d4a9677a7fa..f5af1ac4f3e 100644 --- a/src/mame/recfranco/rfjailbrk.cpp +++ b/src/mame/recfranco/rfjailbrk.cpp @@ -39,7 +39,7 @@ |_________________________________________________test_test___________________________________________| -JMP3, JMP4, JMP8, JMP9, and JMP10 are for setting up the baud rate of each OKI M82C51A USART (you can - configuse 1200, 2400, 4800, 9600, 19200 or 38400 bps. + configure 1200, 2400, 4800, 9600, 19200 or 38400 bps. ****************************************************************************************/ diff --git a/src/mame/skeleton/elcirculo.cpp b/src/mame/skeleton/elcirculo.cpp index 6876df515c8..ccf84934043 100644 --- a/src/mame/skeleton/elcirculo.cpp +++ b/src/mame/skeleton/elcirculo.cpp @@ -50,7 +50,9 @@ LD15 (_) ****************************************************************************************************************/ #include "emu.h" + #include "cpu/m6502/m6504.h" + #include "speaker.h" namespace { @@ -69,9 +71,40 @@ class elcirculo_state : public driver_device private: required_device m_maincpu; + + INTERRUPT_GEN_MEMBER(irq_gen); + + void program_map(address_map &map); }; +INTERRUPT_GEN_MEMBER(elcirculo_state::irq_gen) +{ + m_maincpu->set_input_line(M6504_IRQ_LINE, HOLD_LINE); +} + +void elcirculo_state::program_map(address_map &map) +{ + map.global_mask(0x1fff); + + map(0x0000, 0x01ff).ram(); + map(0x0200, 0x0200).portr("IN0"); + map(0x0201, 0x0201).portr("DSW1"); + // map(0x0400, 0x0401).w(); + // map(0x0600, 0x0601).w(); + map(0x1000, 0x17ff).mirror(0x800).rom().region("maincpu", 0); +} + INPUT_PORTS_START(elcirculo) + PORT_START("IN0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_START("DSW1") PORT_DIPUNKNOWN_DIPLOC(0x01, 0x01, "SW1:1") PORT_DIPUNKNOWN_DIPLOC(0x02, 0x02, "SW1:2") @@ -86,15 +119,17 @@ INPUT_PORTS_END void elcirculo_state::elcirculo(machine_config &config) { M6504(config, m_maincpu, 1'000'000); // R6504P, internal clock + m_maincpu->set_addrmap(AS_PROGRAM, &elcirculo_state::program_map); + m_maincpu->set_periodic_int(FUNC(elcirculo_state::irq_gen), attotime::from_hz(60)); // TODO: source of this SPEAKER(config, "mono").front_center(); } -ROM_START(elcirculo) - ROM_REGION(0x800, "maincpu", 0) - ROM_LOAD("tms2716c.ic2", 0x000, 0x800, CRC(7b5ae97f) SHA1(e7276d5d97328628889d216beac0b04216bf82c7)) +ROM_START( elcirculo ) + ROM_REGION( 0x800, "maincpu", 0 ) + ROM_LOAD( "tms2716c.ic2", 0x000, 0x800, CRC(7b5ae97f) SHA1(e7276d5d97328628889d216beac0b04216bf82c7) ) ROM_END -} // Anonymous namespace +} // anonymous namespace GAME(1980, elcirculo, 0, elcirculo, elcirculo, elcirculo_state, empty_init, ROT0, "Inder", "El Circulo", MACHINE_IS_SKELETON) diff --git a/src/mame/vtech/vsmilepro.cpp b/src/mame/vtech/vsmilepro.cpp index e497e1c74c8..9d7b401a5d8 100644 --- a/src/mame/vtech/vsmilepro.cpp +++ b/src/mame/vtech/vsmilepro.cpp @@ -13,7 +13,7 @@ In particular - It uses a LSI Zevio 1020 CPU + peripherals which comprises ARM926EJ-S CPU, - ZSP400 DPS, 3D graphics processor & 2D graphics processor + ZSP400 DSP, 3D graphics processor & 2D graphics processor - The CD controller is a Sony CXD3059AR ****************************************************************************/ @@ -23,8 +23,8 @@ #include "cpu/arm7/arm7.h" #include "imagedev/cdromimg.h" -#include "softlist.h" #include "cdrom.h" +#include "softlist.h" namespace { @@ -51,13 +51,13 @@ void vsmilpro_state::vsmilpro_map(address_map &map) } -/* Input ports */ +// Input ports static INPUT_PORTS_START( vsmilpro ) INPUT_PORTS_END void vsmilpro_state::vsmilpro(machine_config &config) { - /* basic machine hardware */ + // basic machine hardware ARM9(config, m_maincpu, 150000000); m_maincpu->set_addrmap(AS_PROGRAM, &vsmilpro_state::vsmilpro_map); @@ -66,7 +66,7 @@ void vsmilpro_state::vsmilpro(machine_config &config) SOFTWARE_LIST(config, "cd_list").set_original("vsmile_cd"); } -/* ROM definition */ +// ROM definition ROM_START( vsmilpro ) ROM_REGION( 0x200000, "maincpu", 0 ) ROM_LOAD( "70004.bin", 0x000000, 0x200000, CRC(b9161eac) SHA1(8d75fdeda8c4e228a0b1efd35011f9f667f9fb23) ) @@ -75,7 +75,7 @@ ROM_END } // anonymous namespace -/* Driver */ +// Driver // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS -COMP( 2007, vsmilpro, 0, 0, vsmilpro, vsmilpro, vsmilpro_state, empty_init, "VTech", "V.Smile Pro", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +COMP( 2007, vsmilpro, 0, 0, vsmilpro, vsmilpro, vsmilpro_state, empty_init, "VTech", "V.Smile Pro", MACHINE_IS_SKELETON ) From 83561ade8e9ccd39890d272ce1832dc0d9b05434 Mon Sep 17 00:00:00 2001 From: ClawGrip Date: Tue, 21 May 2024 18:28:51 +0200 Subject: [PATCH 3/7] =?UTF-8?q?midcoin/wallc.cpp:=20Add=20missing=20PLD=20?= =?UTF-8?q?to=20Brick=20Blast=20[Arcadedealer=20aka=20Edgar=20Sol=C3=A9=20?= =?UTF-8?q?aka=20Dios,=20Recreativas.org]=20(#12390)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also reformatted single line comments --- src/mame/midcoin/wallc.cpp | 63 ++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/src/mame/midcoin/wallc.cpp b/src/mame/midcoin/wallc.cpp index c02556bd9e5..9acdc76ee0b 100644 --- a/src/mame/midcoin/wallc.cpp +++ b/src/mame/midcoin/wallc.cpp @@ -293,8 +293,8 @@ void wallc_state::unkitpkr_out2_w(uint8_t data) void wallc_state::wallc_map(address_map &map) { map(0x0000, 0x7fff).rom(); - map(0x8000, 0x83ff).ram().w(FUNC(wallc_state::videoram_w)).mirror(0xc00).share("videoram"); /* 2114, 2114 */ - map(0xa000, 0xa3ff).ram(); /* 2114, 2114 */ + map(0x8000, 0x83ff).ram().w(FUNC(wallc_state::videoram_w)).mirror(0xc00).share("videoram"); // 2114, 2114 + map(0xa000, 0xa3ff).ram(); // 2114, 2114 map(0xb000, 0xb000).portr("DSW1"); map(0xb200, 0xb200).portr("SYSTEM"); @@ -310,8 +310,8 @@ void wallc_state::wallc_map(address_map &map) void wallc_state::unkitpkr_map(address_map &map) { map(0x0000, 0x7fff).rom(); - map(0x8000, 0x83ff).ram().w(FUNC(wallc_state::videoram_w)).mirror(0xc00).share("videoram"); /* 2114, 2114 */ - map(0xa000, 0xa3ff).ram(); /* 2114, 2114 */ + map(0x8000, 0x83ff).ram().w(FUNC(wallc_state::videoram_w)).mirror(0xc00).share("videoram"); // 2114, 2114 + map(0xa000, 0xa3ff).ram(); // 2114, 2114 map(0xb000, 0xb000).portr("DSW1"); map(0xb100, 0xb100).portr("IN1"); @@ -328,7 +328,7 @@ void wallc_state::unkitpkr_map(address_map &map) static INPUT_PORTS_START( wallc ) - PORT_START("SYSTEM") /* b200 */ + PORT_START("SYSTEM") // b200 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) //Right curve button; select current playfield in test mode PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) //not used ? PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) //service?? plays loud,high-pitched sound @@ -338,10 +338,10 @@ static INPUT_PORTS_START( wallc ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN3 ) //ok PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) //ok - PORT_START("DIAL") /* b400 - player position 8 bit analog input - value read is used as position of the player directly - what type of input is that ? DIAL ?*/ + PORT_START("DIAL") // b400 - player position 8 bit analog input - value read is used as position of the player directly - what type of input is that ? DIAL ? PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(3) PORT_REVERSE PORT_PLAYER(1) - PORT_START("DSW1") /* b000 */ + PORT_START("DSW1") // b000 PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:1,2") PORT_DIPSETTING( 0x03, "5" ) PORT_DIPSETTING( 0x02, "4" ) @@ -364,7 +364,7 @@ static INPUT_PORTS_START( wallc ) PORT_DIPSETTING( 0x80, "Free Play With Level Select" ) PORT_DIPSETTING( 0x00, DEF_STR( Normal ) ) - PORT_START("DSW2") /* b600 */ + PORT_START("DSW2") // b600 PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:1,2") PORT_DIPSETTING( 0x03, DEF_STR( 2C_1C ) ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) @@ -380,12 +380,12 @@ static INPUT_PORTS_START( wallc ) PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x10, DEF_STR( 1C_2C ) ) PORT_DIPSETTING( 0x20, DEF_STR( 1C_5C ) ) - PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW2:7" ) /* Shown as "Unused" in the manual */ - PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW2:8" ) /* Shown as "Unused" in the manual */ + PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW2:7" ) // Shown as "Unused" in the manual + PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW2:8" ) // Shown as "Unused" in the manual INPUT_PORTS_END static INPUT_PORTS_START( unkitpkr ) - PORT_START("DSW1") /* b000 */ + PORT_START("DSW1") // b000 PORT_DIPUNKNOWN_DIPLOC(0x01, 0x01, "SW1:1") PORT_DIPUNKNOWN_DIPLOC(0x02, 0x02, "SW1:2") PORT_DIPUNKNOWN_DIPLOC(0x04, 0x04, "SW1:3") @@ -395,7 +395,7 @@ static INPUT_PORTS_START( unkitpkr ) PORT_DIPUNKNOWN_DIPLOC(0x40, 0x40, "SW1:7") PORT_DIPUNKNOWN_DIPLOC(0x80, 0x80, "SW1:8") - PORT_START("IN1") /* b100 */ + PORT_START("IN1") // b100 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) // coin out @@ -405,7 +405,7 @@ static INPUT_PORTS_START( unkitpkr ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN3 ) - PORT_START("IN2") /* b200 */ + PORT_START("IN2") // b200 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_GAMBLE_BOOK ) @@ -415,7 +415,7 @@ static INPUT_PORTS_START( unkitpkr ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_POKER_HOLD4 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_POKER_HOLD5 ) - PORT_START("IN3") /* b300 */ + PORT_START("IN3") // b300 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_POKER_CANCEL ) @@ -425,7 +425,7 @@ static INPUT_PORTS_START( unkitpkr ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_GAMBLE_DEAL ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) - PORT_START("DSW2") /* b600 */ + PORT_START("DSW2") // b600 PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:1,2") // ok PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) PORT_DIPSETTING( 0x01, DEF_STR( 1C_2C ) ) @@ -448,7 +448,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( sidampkr ) PORT_INCLUDE(unkitpkr) - PORT_MODIFY("DSW1") /* b000 */ + PORT_MODIFY("DSW1") // b000 PORT_DIPNAME( 0x01, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("SW1:1") PORT_DIPSETTING( 0x00, DEF_STR( English ) ) PORT_DIPSETTING( 0x01, DEF_STR( French ) ) @@ -488,13 +488,13 @@ INPUT_PORTS_END static const gfx_layout charlayout = { - 8,8, /* 8*8 characters */ + 8,8, // 8*8 characters RGN_FRAC(1,3), - 3, /* 3 bits per pixel */ - { RGN_FRAC(0,3),RGN_FRAC(1,3),RGN_FRAC(2,3) }, /* the bitplanes are separated */ + 3, // 3 bits per pixel + { RGN_FRAC(0,3),RGN_FRAC(1,3),RGN_FRAC(2,3) }, // the bitplanes are separated { 7, 6, 5, 4, 3, 2, 1, 0 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 consecutive bytes */ + 8*8 // every char takes 8 consecutive bytes }; static GFXDECODE_START( gfx_wallc ) @@ -508,8 +508,8 @@ void wallc_state::init_wallc() for (uint32_t i = 0; i < 0x2000 * 2; i++) { - uint8_t c = ROM[ i ] ^ 0x55 ^ 0xff; /* NOTE: this can be shortened but now it fully reflects what the bigger module really does */ - c = bitswap<8>(c, 4,2,6,0,7,1,3,5); /* also swapped inside of the bigger module */ + uint8_t c = ROM[ i ] ^ 0x55 ^ 0xff; // NOTE: this can be shortened but now it fully reflects what the bigger module really does + c = bitswap<8>(c, 4,2,6,0,7,1,3,5); // also swapped inside of the bigger module ROM[ i ] = c; } } @@ -539,14 +539,14 @@ void wallc_state::init_wallca() void wallc_state::wallc(machine_config &config) { - /* basic machine hardware */ - Z80(config, m_maincpu, 12.288_MHz_XTAL / 4); /* 3.072 MHz ? */ + // basic machine hardware + Z80(config, m_maincpu, 12.288_MHz_XTAL / 4); // 3.072 MHz ? m_maincpu->set_addrmap(AS_PROGRAM, &wallc_state::wallc_map); m_maincpu->set_vblank_int("screen", FUNC(wallc_state::irq0_line_hold)); ADC0804(config, "adc", 640000).vin_callback().set_ioport("DIAL"); // clock not verified - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */); @@ -558,7 +558,7 @@ void wallc_state::wallc(machine_config &config) GFXDECODE(config, m_gfxdecode, "palette", gfx_wallc); PALETTE(config, "palette", FUNC(wallc_state::wallc_palette), 32); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); ay8912_device &aysnd(AY8912(config, "aysnd", 12288000 / 8)); aysnd.port_a_read_callback().set_ioport("DSW2"); @@ -580,7 +580,7 @@ void wallc_state::sidampkra(machine_config &config) subdevice("palette")->set_init(FUNC(wallc_state::unkitpkr_palette)); - /* sound hardware */ + // sound hardware subdevice("aysnd")->reset_routes().add_route(ALL_OUTPUTS, "mono", 0.50); } @@ -618,7 +618,7 @@ ROM_START( wallc ) ROM_LOAD( "74s288.c2", 0x0000, 0x0020, CRC(83e3e293) SHA1(a98c5e63b688de8d175adb6539e0cdc668f313fd) ) ROM_END -/* this set uses a different encryption, but the decrypted code is the same */ +// this set uses a different encryption, but the decrypted code is the same ROM_START( wallca ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "rom4.rom", 0x0000, 0x2000, CRC(ce43af1b) SHA1(c05419cb4aa57c6187b469573a3787d9123c4a05) ) @@ -635,7 +635,7 @@ ROM_END ROM_START( brkblast ) ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_LOAD( "fadesa-r0.6m", 0x0000, 0x4000, CRC(4e96ca15) SHA1(87f1a3538712aa3d6c3713b845679dd42a4ba5a4) ) + ROM_LOAD( "fadesa-r0.6m", 0x0000, 0x4000, CRC(4e96ca15) SHA1(87f1a3538712aa3d6c3713b845679dd42a4ba5a4) ) ROM_REGION( 0x3000, "gfx1", 0 ) ROM_LOAD( "rom3.rom", 0x0800, 0x0800, CRC(6634db73) SHA1(fe6104f974495a250e0cd14c0745eec8e44b8d3a) ) @@ -643,7 +643,10 @@ ROM_START( brkblast ) ROM_LOAD( "rom1.rom", 0x2800, 0x0800, CRC(3884fd4f) SHA1(47254c8828128ac48fc15f05b52fe4d42d4919e7) ) ROM_REGION( 0x0020, "proms", 0 ) - ROM_LOAD( "74s288.c2", 0x0000, 0x0020, CRC(83e3e293) SHA1(a98c5e63b688de8d175adb6539e0cdc668f313fd) ) + ROM_LOAD( "74s288.c2", 0x0000, 0x0020, CRC(83e3e293) SHA1(a98c5e63b688de8d175adb6539e0cdc668f313fd) ) + + ROM_REGION( 0x00eb, "plds", 0 ) + ROM_LOAD( "82s153.h8", 0x0000, 0x00eb, CRC(a6db7c28) SHA1(023f393c45ae35c0008f61af6c3a1b21f7fe7c79) ) // On the CPU subboard ROM_END From 80aaf80e99ccdeab2bb84d04c3d0a5eba935f3dc Mon Sep 17 00:00:00 2001 From: ClawGrip Date: Tue, 21 May 2024 18:29:30 +0200 Subject: [PATCH 4/7] Add a skeleton for a electromechanical arcade by Shoken (#12356) New not working machine ----------------------------- Ganbare Momotarou Oni Taiji [Museo del Recreativo] --- src/mame/mame.lst | 3 + src/mame/skeleton/ganbaremo.cpp | 147 ++++++++++++++++++++++++++++++++ 2 files changed, 150 insertions(+) create mode 100644 src/mame/skeleton/ganbaremo.cpp diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 44f20290197..52844a09f84 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -41855,6 +41855,9 @@ fs3216 // @source:skeleton/ft68m.cpp ft68m // +@source:skeleton/ganbaremo.cpp +ganbaremo // (c) ???? Shoken + @source:skeleton/gem_rp.cpp rp200 diff --git a/src/mame/skeleton/ganbaremo.cpp b/src/mame/skeleton/ganbaremo.cpp new file mode 100644 index 00000000000..2e1320f529f --- /dev/null +++ b/src/mame/skeleton/ganbaremo.cpp @@ -0,0 +1,147 @@ +// license:BSD-3-Clause +// copyright-holders: +/*************************************************************************************************** + + Skeleton driver for: + "Ganbare Momotarou Oni Taiji" (がんばれ ももたろう おにたいじ). Electromechanical arcade by Shoken. + + DISPLAY PCB + ______________________________________________________________________________________________ + |__ __________________ _________________ _____________ _____________ | + ||:| |·················| |················| |············| |············| | + ||:| ___________ ___________ ___________ ___________ ___________ ___________ | + ||:| |TD62783AP_| |_ULN2803A_| |_ULN2803A_| |_ULN2803A_| |_ULN2803A_| |JW25N-DC12V | + ||:| |___________|| + ||:| ___________ ___________ ___________ ___________ ___________ ___________ | + ||_| |TD62783AP_| |_ULN2803A_| |_ULN2803A_| |_ULN2803A_| |_ULN2803A_| |JW25N-DC12V __| + | |___________| |:|| + | ___________ ___________ ___________ ___________ | + | |SN74LS273N| |LC3517BSL_| |SN74LS138N| |JW25N-DC12V | + | ________ ______________ |___________| __| + | | Xtal | | EPROM | ___________ |:|| + | | 20.000 MHz |_____________| |JW25N-DC12V |:|| + | ___________ _________________ ___________ ___________ |___________| | + | |SN74LS74AN| | Z08040004PSC | |_74LS245N_| |_74LS240N_| ___________ | + | |_______________| ___________ ___________ |JW25N-DC12V | + | ___________ ___________ ___________ |_TPL521-4_| |_TPL521-4_| |___________| __| + | |74HC4020AP| |_SN74LS04N| |_SN74LS02N| ___________ |:|| + | |JW25N-DC12V |·|| + | SHOKEN M005 DISPLAY |___________| | + | _____________ ________ _______________ | + | |············| |·······| |··············| | + |_____________________________________________________________________________________________| + + SOUND PCB + ___________________________________________________________________________________________ + | ___________ ________ ________ ______ ____________ | + |__ |··········| |·······| |·······| |·····| |···········| : | + ||:| : | + ||:| _________________ (o)<- Reset switch ____ : | + | | D8255AC-2 | 8212CPA o o o <- LEDs : | + | |________________| _________ _________ _________________ __| + |__ _________________ SN74LS138N SN74LS00N | D8255AC-2 | |:|| + ||:| | Z08040004PSC | _________ _________ |________________| |:|| + ||:| |________________| SN74LS139AN SN74LS138N ________ _______ _________ |:|| + | _________ _________ _________ _________ |DIPSx6_| |DIPSx4| |ULN2803A| | + |__ SN74LS245N SN74LS244N |SN74LS10N SN74LS74AN _________________ _________ __| + ||:| ___________ _________ _________ _________ | D8255AC-2 | |ULN2803A| |:|| + ||:| | EPROM | SN74LS04N SN74LS04N SN74LS74AN |________________| |:|| + | |__________| _________ _________ _________ _________________ _________ |:|| + | ____ _________ SN74LS02N SN74LS32N SN74LS688N | AY38910A/P | |ULN2803A| | + | BATT LC3517BSL _________ _________ |________________| _________ __| + | _________ _________ SN74LS161AN SN74LS161AN | RELAY | |:|| + | |74HC00AP| SN74LS74AN ____________ Resonator |:|| + | _________ _________ _________ | EPROM | _________ _________ |:|| + | SN74LS161AN |TC4020BP| SN74LS09N |___________| |TC4020BP| |OKI M5205 _________ | + | |uPC2500H| __| + | Xtal 12.000 MHz _________ _________ _________ |:|| + | SN74LS161AN SN74LS161AN |_LM324N_| SHOKEN M904-A |:|| + |__________________________________________________________________________________________| + +*/ + +#include "emu.h" + +#include "cpu/z80/z80.h" +#include "machine/i8255.h" + +#include "sound/ay8910.h" +#include "sound/msm5205.h" + +#include "speaker.h" + +namespace { + +class ganbaremo_state : public driver_device +{ +public: + ganbaremo_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_audiocpu(*this, "audiocpu") + , m_ay8910(*this, "aysnd") + , m_5205(*this, "musicrom") + { + } + + void ganbaremo(machine_config &config); + +private: + required_device m_maincpu; + required_device m_audiocpu; + required_device m_ay8910; + required_device m_5205; +}; + +static INPUT_PORTS_START(ganbaremo) + PORT_START("DSW0") + PORT_DIPUNKNOWN_DIPLOC(0x01, 0x01, "SW0:1") + PORT_DIPUNKNOWN_DIPLOC(0x02, 0x02, "SW0:2") + PORT_DIPUNKNOWN_DIPLOC(0x04, 0x04, "SW0:3") + PORT_DIPUNKNOWN_DIPLOC(0x08, 0x08, "SW0:4") + PORT_DIPUNKNOWN_DIPLOC(0x10, 0x10, "SW0:5") + PORT_DIPUNKNOWN_DIPLOC(0x20, 0x20, "SW0:6") + + PORT_START("DSW1") + PORT_DIPUNKNOWN_DIPLOC(0x01, 0x01, "SW1:1") + PORT_DIPUNKNOWN_DIPLOC(0x02, 0x02, "SW1:2") + PORT_DIPUNKNOWN_DIPLOC(0x04, 0x04, "SW1:3") + PORT_DIPUNKNOWN_DIPLOC(0x08, 0x08, "SW1:4") +INPUT_PORTS_END + +void ganbaremo_state::ganbaremo(machine_config &config) +{ + Z80(config, m_maincpu, 12_MHz_XTAL / 4); // Guess + + I8255A(config, "pia1"); // NEC D8255AC-2 + I8255A(config, "pia2"); // NEC D8255AC-2 + I8255A(config, "pia3"); // NEC D8255AC-2 + + // Sound hardware + + Z80(config, m_audiocpu, 12_MHz_XTAL / 4); // Guess + + SPEAKER(config, "mono").front_center(); + + AY8910(config, m_ay8910, 12_MHz_XTAL / 8); // Guess + m_ay8910->port_a_read_callback().set_ioport("DSW0"); + m_ay8910->port_b_read_callback().set_ioport("DSW1"); + m_ay8910->add_route(ALL_OUTPUTS, "mono", 0.25); + + MSM5205(config, m_5205, XTAL(384'000)); +} + +ROM_START(ganbaremo) + ROM_REGION(0x08000, "maincpu", 0) + ROM_LOAD("m005_xx.bin", 0x00000, 0x08000, CRC(42a7aa23) SHA1(6140f4a7769ab35cb32e3079adbee6468f3ce880)) + + ROM_REGION(0x08000, "audiocpu", 0) + ROM_LOAD("m005_p5.bin", 0x00000, 0x08000, CRC(dddb97a6) SHA1(47465bb2cd26ddd0f80c729ef3bb3b187b684d97)) + + ROM_REGION(0x10000, "musicrom", 0) + ROM_LOAD("m005_v.bin", 0x00000, 0x10000, CRC(e3cb69a8) SHA1(a49878adae08d56d78d168367659ac322d7fb5eb)) +ROM_END + +} // anonymous namespace + +GAME(19??, ganbaremo, 0, ganbaremo, ganbaremo, ganbaremo_state, empty_init, ROT0, "Shoken", "Ganbare Momotarou Oni Taiji", MACHINE_IS_SKELETON_MECHANICAL) From 0fcf07aab31ca258199472b85ebb0e8fcbd39005 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Tue, 21 May 2024 18:37:02 +0200 Subject: [PATCH 5/7] skeleton/ganbaremo.cpp: added some preliminary mappings --- src/mame/skeleton/ganbaremo.cpp | 188 ++++++++++++++++++++++++++------ 1 file changed, 153 insertions(+), 35 deletions(-) diff --git a/src/mame/skeleton/ganbaremo.cpp b/src/mame/skeleton/ganbaremo.cpp index 2e1320f529f..9a8d50d7b1a 100644 --- a/src/mame/skeleton/ganbaremo.cpp +++ b/src/mame/skeleton/ganbaremo.cpp @@ -1,9 +1,11 @@ // license:BSD-3-Clause // copyright-holders: + /*************************************************************************************************** Skeleton driver for: "Ganbare Momotarou Oni Taiji" (がんばれ ももたろう おにたいじ). Electromechanical arcade by Shoken. + https://www.youtube.com/watch?v=jxri_Wmoyfs DISPLAY PCB ______________________________________________________________________________________________ @@ -58,18 +60,35 @@ | SN74LS161AN SN74LS161AN |_LM324N_| SHOKEN M904-A |:|| |__________________________________________________________________________________________| + +TODO: +- figure out interrupts +- figure out inputs +- hook up MSM5205 +- simulate mechanical pieces via layouts +- everything for the display PCB */ #include "emu.h" #include "cpu/z80/z80.h" #include "machine/i8255.h" - #include "sound/ay8910.h" #include "sound/msm5205.h" #include "speaker.h" + +// configurable logging +#define LOG_PORTS (1U << 1) + +// #define VERBOSE (LOG_GENERAL | LOG_PORTS) + +#include "logmacro.h" + +#define LOGPORTS(...) LOGMASKED(LOG_PORTS, __VA_ARGS__) + + namespace { class ganbaremo_state : public driver_device @@ -78,9 +97,7 @@ class ganbaremo_state : public driver_device ganbaremo_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") - , m_audiocpu(*this, "audiocpu") - , m_ay8910(*this, "aysnd") - , m_5205(*this, "musicrom") + , m_displaycpu(*this, "displaycpu") { } @@ -88,60 +105,161 @@ class ganbaremo_state : public driver_device private: required_device m_maincpu; - required_device m_audiocpu; - required_device m_ay8910; - required_device m_5205; + required_device m_displaycpu; + + void main_program_map(address_map &map); + void display_program_map(address_map &map); + void main_io_map(address_map &map); + void display_io_map(address_map &map); }; -static INPUT_PORTS_START(ganbaremo) + +void ganbaremo_state::main_program_map(address_map &map) +{ + map(0x0000, 0x7fff).rom(); + map(0x8000, 0x87ff).ram(); +} + +void ganbaremo_state::display_program_map(address_map &map) +{ + map(0x0000, 0x7fff).rom(); + map(0x8000, 0x87ff).ram(); +} + +void ganbaremo_state::main_io_map(address_map &map) +{ + map.global_mask(0xff); + + map(0x00, 0x03).rw("ppi1", FUNC(i8255_device::read), FUNC(i8255_device::write)); + map(0x20, 0x23).rw("ppi2", FUNC(i8255_device::read), FUNC(i8255_device::write)); + map(0x40, 0x43).rw("ppi3", FUNC(i8255_device::read), FUNC(i8255_device::write)); + map(0x60, 0x60).w("ay8910", FUNC(ay8910_device::address_w)); + map(0x61, 0x61).rw("ay8910", FUNC(ay8910_device::data_r), FUNC(ay8910_device::data_w)); + //map(0x80, 0x80).w +} + +void ganbaremo_state::display_io_map(address_map &map) +{ + map.global_mask(0xff); + + // map(0x00, 0x00).w + // map(0x20, 0x20).w + // map(0x40, 0x40).w + // map(0x80, 0x80).w + // map(0xc0, 0xc0).r +} + + +static INPUT_PORTS_START( ganbaremo ) + PORT_START("IN0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(1) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_PLAYER(1) + + PORT_START("IN1") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(2) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(2) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(2) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_PLAYER(2) + + PORT_START("IN2") // playing with these makes some sound effects / BGM play + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(3) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(3) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(3) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(3) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(3) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(3) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_PLAYER(3) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON8 ) PORT_PLAYER(3) + PORT_START("DSW0") - PORT_DIPUNKNOWN_DIPLOC(0x01, 0x01, "SW0:1") - PORT_DIPUNKNOWN_DIPLOC(0x02, 0x02, "SW0:2") - PORT_DIPUNKNOWN_DIPLOC(0x04, 0x04, "SW0:3") - PORT_DIPUNKNOWN_DIPLOC(0x08, 0x08, "SW0:4") - PORT_DIPUNKNOWN_DIPLOC(0x10, 0x10, "SW0:5") - PORT_DIPUNKNOWN_DIPLOC(0x20, 0x20, "SW0:6") + PORT_DIPUNKNOWN_DIPLOC(0x01, 0x00, "SW0:1") + PORT_DIPUNKNOWN_DIPLOC(0x02, 0x00, "SW0:2") + PORT_DIPUNKNOWN_DIPLOC(0x04, 0x00, "SW0:3") + PORT_DIPUNKNOWN_DIPLOC(0x08, 0x00, "SW0:4") + PORT_DIPUNKNOWN_DIPLOC(0x10, 0x00, "SW0:5") + PORT_DIPUNKNOWN_DIPLOC(0x20, 0x00, "SW0:6") + PORT_BIT( 0xc0, IP_ACTIVE_HIGH, IPT_UNKNOWN ) PORT_START("DSW1") - PORT_DIPUNKNOWN_DIPLOC(0x01, 0x01, "SW1:1") - PORT_DIPUNKNOWN_DIPLOC(0x02, 0x02, "SW1:2") - PORT_DIPUNKNOWN_DIPLOC(0x04, 0x04, "SW1:3") - PORT_DIPUNKNOWN_DIPLOC(0x08, 0x08, "SW1:4") + PORT_DIPUNKNOWN_DIPLOC(0x01, 0x00, "SW1:1") + PORT_DIPUNKNOWN_DIPLOC(0x02, 0x00, "SW1:2") + PORT_DIPUNKNOWN_DIPLOC(0x04, 0x00, "SW1:3") + PORT_DIPUNKNOWN_DIPLOC(0x08, 0x00, "SW1:4") + PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNKNOWN ) INPUT_PORTS_END + void ganbaremo_state::ganbaremo(machine_config &config) { Z80(config, m_maincpu, 12_MHz_XTAL / 4); // Guess + m_maincpu->set_addrmap(AS_PROGRAM, &ganbaremo_state::main_program_map); + m_maincpu->set_addrmap(AS_IO, &ganbaremo_state::main_io_map); + m_maincpu->set_periodic_int(FUNC(ganbaremo_state::irq0_line_hold), attotime::from_hz(60*4)); // TODO: proper IRQ ack - I8255A(config, "pia1"); // NEC D8255AC-2 - I8255A(config, "pia2"); // NEC D8255AC-2 - I8255A(config, "pia3"); // NEC D8255AC-2 + Z80(config, m_displaycpu, 12_MHz_XTAL / 4); // Guess + m_displaycpu->set_addrmap(AS_PROGRAM, &ganbaremo_state::display_program_map); + m_displaycpu->set_addrmap(AS_IO, &ganbaremo_state::display_io_map); - // Sound hardware + i8255_device &ppi1(I8255A(config, "ppi1")); // NEC D8255AC-2, inputs + ppi1.in_pa_callback().set([this] () { LOGPORTS("%s: PPI1 port A in\n", machine().describe_context()); return ioport("IN0")->read(); }); + ppi1.in_pb_callback().set([this] () { LOGPORTS("%s: PPI1 port B in\n", machine().describe_context()); return ioport("IN1")->read(); }); + ppi1.in_pc_callback().set([this] () { LOGPORTS("%s: PPI1 port C in\n", machine().describe_context()); return ioport("IN2")->read(); }); + ppi1.out_pa_callback().set([this] (uint8_t data) { LOGPORTS("%s: PPI1 port A out %02x\n", machine().describe_context(), data); }); // doesn't seem to be written + ppi1.out_pb_callback().set([this] (uint8_t data) { LOGPORTS("%s: PPI1 port B out %02x\n", machine().describe_context(), data); }); // doesn't seem to be written + ppi1.out_pc_callback().set([this] (uint8_t data) { LOGPORTS("%s: PPI1 port C out %02x\n", machine().describe_context(), data); }); // doesn't seem to be written - Z80(config, m_audiocpu, 12_MHz_XTAL / 4); // Guess + i8255_device &ppi2(I8255A(config, "ppi2")); // NEC D8255AC-2, comms to display CPU and/or MSM5205 commands? + ppi2.in_pa_callback().set([this] () { LOGPORTS("%s: PPI2 port A in\n", machine().describe_context()); return uint8_t(0); }); // doesn't seem to be read + ppi2.in_pb_callback().set([this] () { LOGPORTS("%s: PPI2 port B in\n", machine().describe_context()); return uint8_t(0); }); // doesn't seem to be read + ppi2.in_pc_callback().set([this] () { LOGPORTS("%s: PPI2 port C in\n", machine().describe_context()); return uint8_t(0); }); // doesn't seem to be read + ppi2.out_pa_callback().set([this] (uint8_t data) { LOGPORTS("%s: PPI2 port A out %02x\n", machine().describe_context(), data); }); // written + ppi2.out_pb_callback().set([this] (uint8_t data) { LOGPORTS("%s: PPI2 port B out %02x\n", machine().describe_context(), data); }); // written + ppi2.out_pc_callback().set([this] (uint8_t data) { LOGPORTS("%s: PPI2 port C out %02x\n", machine().describe_context(), data); }); // written + i8255_device &ppi3(I8255A(config, "ppi3")); // NEC D8255AC-2, DSW + ppi3.in_pa_callback().set([this] () { LOGPORTS("%s: PPI3 port A in\n", machine().describe_context()); return machine().rand(); }); + ppi3.in_pb_callback().set([this] () { LOGPORTS("%s: PPI3 port B in\n", machine().describe_context()); return machine().rand(); }); + ppi3.in_pc_callback().set([this] () { LOGPORTS("%s: PPI3 port C in\n", machine().describe_context()); return uint8_t(0); }); // doesn't seem to be read + ppi3.out_pa_callback().set([this] (uint8_t data) { LOGPORTS("%s: PPI3 port A out %02x\n", machine().describe_context(), data); }); // doesn't seem to be written + ppi3.out_pb_callback().set([this] (uint8_t data) { LOGPORTS("%s: PPI3 port B out %02x\n", machine().describe_context(), data); }); // doesn't seem to be written + ppi3.out_pc_callback().set([this] (uint8_t data) { LOGPORTS("%s: PPI3 port C out %02x\n", machine().describe_context(), data); }); // doesn't seem to be written + + // Sound hardware SPEAKER(config, "mono").front_center(); - AY8910(config, m_ay8910, 12_MHz_XTAL / 8); // Guess - m_ay8910->port_a_read_callback().set_ioport("DSW0"); - m_ay8910->port_b_read_callback().set_ioport("DSW1"); - m_ay8910->add_route(ALL_OUTPUTS, "mono", 0.25); + ay8910_device &ay(AY8910(config, "ay8910", 12_MHz_XTAL / 8)); // Guess + ay.port_a_read_callback().set([this] () { LOGPORTS("%s: AY port A in\n", machine().describe_context()); return uint8_t(0); }); // doesn't seem to be read + ay.port_b_read_callback().set([this] () { LOGPORTS("%s: AY port B in\n", machine().describe_context()); return uint8_t(0); }); // doesn't seem to be read + ay.port_a_write_callback().set([this] (uint8_t data) { LOGPORTS("%s: AY port A out %02x\n", machine().describe_context(), data); }); // rarely written + ay.port_b_write_callback().set([this] (uint8_t data) { LOGPORTS("%s: AY port B out %02x\n", machine().describe_context(), data); }); // rarely written + ay.add_route(ALL_OUTPUTS, "mono", 0.25); - MSM5205(config, m_5205, XTAL(384'000)); + MSM5205(config, "msm5205", XTAL(384'000)); } -ROM_START(ganbaremo) - ROM_REGION(0x08000, "maincpu", 0) - ROM_LOAD("m005_xx.bin", 0x00000, 0x08000, CRC(42a7aa23) SHA1(6140f4a7769ab35cb32e3079adbee6468f3ce880)) - ROM_REGION(0x08000, "audiocpu", 0) - ROM_LOAD("m005_p5.bin", 0x00000, 0x08000, CRC(dddb97a6) SHA1(47465bb2cd26ddd0f80c729ef3bb3b187b684d97)) +ROM_START( ganbaremo ) + ROM_REGION( 0x08000, "maincpu", 0 ) + ROM_LOAD( "m005_p5.bin", 0x00000, 0x08000, CRC(dddb97a6) SHA1(47465bb2cd26ddd0f80c729ef3bb3b187b684d97) ) - ROM_REGION(0x10000, "musicrom", 0) - ROM_LOAD("m005_v.bin", 0x00000, 0x10000, CRC(e3cb69a8) SHA1(a49878adae08d56d78d168367659ac322d7fb5eb)) + ROM_REGION( 0x08000, "displaycpu", 0 ) + ROM_LOAD( "m005_xx.bin", 0x00000, 0x08000, CRC(42a7aa23) SHA1(6140f4a7769ab35cb32e3079adbee6468f3ce880) ) + + ROM_REGION( 0x10000, "samples", 0) + ROM_LOAD( "m005_v.bin", 0x00000, 0x10000, CRC(e3cb69a8) SHA1(a49878adae08d56d78d168367659ac322d7fb5eb) ) ROM_END } // anonymous namespace + GAME(19??, ganbaremo, 0, ganbaremo, ganbaremo, ganbaremo_state, empty_init, ROT0, "Shoken", "Ganbare Momotarou Oni Taiji", MACHINE_IS_SKELETON_MECHANICAL) From d8610cccfac825ce55ccd6de75c5efe1c51d0338 Mon Sep 17 00:00:00 2001 From: Hatsune Mike Date: Wed, 22 May 2024 03:44:24 +0900 Subject: [PATCH 6/7] atlus/cave.cpp: Added Jumbo Godzilla. (#12286) New working systems --------------------- Jumbo Godzilla [Moffitt] --- src/mame/atlus/cave.cpp | 132 ++++++++++++++++++++++++++++++++++++++++ src/mame/atlus/cave.h | 3 + src/mame/mame.lst | 1 + 3 files changed, 136 insertions(+) diff --git a/src/mame/atlus/cave.cpp b/src/mame/atlus/cave.cpp index c5193da93b4..5c8b76bcb0e 100644 --- a/src/mame/atlus/cave.cpp +++ b/src/mame/atlus/cave.cpp @@ -22,6 +22,7 @@ Year + Game License PCB Tilemaps Sprites ----------------------------------------------------------------------------------------- 94 Mazinger Z Banpresto BP943A 038 9335EX706 013 9341E7009 Z80 94 Power Instinct 2 Atlus AT047G2-B 038 9429WX709 013 9341E7009 Z80 NMK 112 +95 Jumbo Godzilla Toho N-42 EM 038 9345E7008 013 9442WX002 95 Gogetsuji Legends Atlus AT047G2-B 038 9429WX709 013 9341E7009 Z80 NMK 112 95 Metamoqester Banpresto BP947A 038 9437WX711 013 9346E7002 Z80 95 Sailor Moon Banpresto BP945A 038 9437WX711 013 9346E7002 Z80 @@ -1229,6 +1230,61 @@ void cave_state::paccarn_map(address_map &map) map(0xe00001, 0xe00001).w(FUNC(cave_state::tjumpman_eeprom_w)); // EEPROM } +/*************************************************************************** + Jumbo Godzilla + + The cabinet is a chibi proportioned godzilla plastic/fiberglass sculpture, + where the player enters from the sides. + + The whole cabinet has the ability to gently roll from side to side, in an + imitation of Godzilla's stomping. + + There are light-up attack buttons arranged around the screen, like so: + + (diagram not drawn to scale) + ____________________________ + | | + [Red Button] | | [Red Button] + Tai | | Shippo + Atari | | Kougeki + (Body Slam) | | (Tail Attack) + | 19" Monitor | + [Blue Button] | | [Blue Button] + Nissen | | Nissen + Kougeki | | Kougeki + (Heat Ray Attack) | | (Heat Ray Attack) + |____________________________| + + ( Blue Speaker ) + + To the sides of the screen area there are blue spinning lamps like you'd + see atop a police patrol car. + + The buttons are lit when an attack is available. Upon pressing them, the + button lamps turn off, while the spinning lamps activate during the attack. + +***************************************************************************/ + +void cave_state::jumbogod_leds_w(u8 data) +{ + // Numbering of attack button light outputs is guessed based upon the + // ordering of the button inputs in the test menu; in-game they all + // appear to be activated at once, so disambiguation is challenging. + m_led_outputs[0] = BIT(data, 0); // tai atari / body slam + m_led_outputs[1] = BIT(data, 1); // nissen kougeki / atomic breath + m_led_outputs[2] = BIT(data, 2); // shippo kougeki / tail attack + m_led_outputs[3] = BIT(data, 3); // nissen kougeki / atomic breath + m_led_outputs[4] = BIT(data, 4); // motor & spinning lamps +} + +void cave_state::jumbogod_map(address_map &map) +{ + pacslot_map(map); + + map(0x900001, 0x900001).rw("oki2", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // M6295 + map(0xc00001, 0xc00001).w(FUNC(cave_state::jumbogod_leds_w)); // Leds +} + /*************************************************************************** Uo Poko ***************************************************************************/ @@ -1756,6 +1812,25 @@ static INPUT_PORTS_START( paccarn ) PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME( "Bet 12" ) INPUT_PORTS_END +static INPUT_PORTS_START( jumbogod ) + PORT_START("IN0") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10) // credits (impulse needed to coin up reliably) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, do_read) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME( "Tai Atari (Body Slam)" ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME( "Shippo Kougeki (Tail Attack)") // not a mistake; it is #3 by the game's test menu. + PORT_BIT( 0xC0, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("IN1") + PORT_SERVICE( 0x01, IP_ACTIVE_LOW ) // must stay on during service mode + PORT_BIT( 0x06, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_TOGGLE PORT_NAME( "Self Test" ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME( "Nissen Kougeki (Atomic Breath) 1" ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME( "Nissen Kougeki (Atomic Breath) 2" ) + PORT_BIT( 0xC0, IP_ACTIVE_LOW, IPT_UNKNOWN ) +INPUT_PORTS_END + static INPUT_PORTS_START( ppsatan ) PORT_START("SYSTEM") // $200000 PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) @@ -2488,15 +2563,24 @@ void cave_state::pacslot(machine_config &config) void cave_state::paceight(machine_config &config) { pacslot(config); + m_maincpu->set_addrmap(AS_PROGRAM, &cave_state::paceight_map); } void cave_state::paccarn(machine_config &config) { pacslot(config); + m_maincpu->set_addrmap(AS_PROGRAM, &cave_state::paccarn_map); } +void cave_state::jumbogod(machine_config &config) +{ + pacslot(config); + + m_maincpu->set_addrmap(AS_PROGRAM, &cave_state::jumbogod_map); +} + /*************************************************************************** Poka Poka Satan ***************************************************************************/ @@ -4099,6 +4183,52 @@ ROM_START( nmaster ) ROM_END + +/*************************************************************************** + + Jumbo Godzilla by Namco, licensed by Toho Co.,LTD. + Namco N-42 EM VIDEO PCB + + TMP 68HC000P-16 + + 013 9442WX002 + 038 9345E7008 + + OKI M6295 x 2 + + Battery + 93C46 EEPROM (at U24) + + 28MHz XTAL + + ROM Locations and general memory map match Pac-Slot, but OKI #2 is put to use. + +***************************************************************************/ + +ROM_START( jumbogod ) + ROM_REGION( 0x080000, "maincpu", 0 ) /* 68000 code */ + ROM_LOAD16_WORD_SWAP( "jg1-mpro.u41", 0x00000, 0x80000, CRC(e57c842b) SHA1(a85ed036c36215d20ff95f5aaafdc5d5ef6bb94a) ) + + ROM_REGION( 0x100000, "sprites0", 0 ) /* Sprites: * 2 */ + ROM_LOAD16_BYTE( "jg1-obj0.u52", 0x00000, 0x80000, CRC(6ee8b190) SHA1(5dc3f8ee6ed71f80e0b1612c9440d1dd100c1181) ) + ROM_LOAD16_BYTE( "jg1-obj1.u53", 0x00001, 0x80000, CRC(460658cd) SHA1(2af915b161355907025f0705a44bf0de8e6c7dcd) ) + + ROM_REGION( 0x100000, "layer0", 0 ) /* Layer 0 */ + ROM_LOAD16_BYTE( "jg1-cha0.u60", 0x00000, 0x80000, CRC(88a86c34) SHA1(f2e9e235cfde9b8afc79fc88e5b7090ba134445b) ) + ROM_LOAD16_BYTE( "jg1-cha1.u61", 0x00001, 0x80000, CRC(55bd8830) SHA1(efecb20bb699b05bcefa011402d0dcc234e2696a) ) + + ROM_REGION( 0x40000, "oki1", 0 ) /* OKIM6295 #1 Samples */ + ROM_LOAD( "jg1-voi1.u27", 0x00000, 0x40000, CRC(94d1361a) SHA1(b693bff50cbbf75328959508fd912bd3061a2677) ) + + ROM_REGION( 0x40000, "oki2", 0 ) /* OKIM6295 #2 Samples */ + ROM_LOAD( "jg1-voi2.u32", 0x00000, 0x40000, CRC(82d40b9a) SHA1(4d8e7d994da96a40918ee9791a31d8c189b38e40) ) + + ROM_REGION( 0x117 * 3, "plds", 0 ) + // Unlike N-44, there is a socketed 74LS138 at U1, instead of a GAL16V8. + ROM_LOAD( "k38.u3", 0x117*1, 0x117, NO_DUMP ) // GAL16V8B-15LP (Protected) + ROM_LOAD( "k38.u51", 0x117*2, 0x117, NO_DUMP ) // GAL16V8B-15LP (Protected) Probably matches paceight +ROM_END + /*************************************************************************** Pac-Slot by Namco, 1996 (according to http://pacman.com/ja/museum/index.html) @@ -5444,6 +5574,8 @@ GAME( 1994, pwrinst2j, pwrinst2, pwrinst2, metmqstr, cave_z80_state, init_pwrin GAME( 1994, mazinger, 0, mazinger, cave, cave_z80_state, init_mazinger, ROT90, "Banpresto / Dynamic Pl. Toei Animation", "Mazinger Z (World)", MACHINE_SUPPORTS_SAVE ) // 1994/06/27 08:00 GAME( 1994, mazingerj, mazinger, mazinger, cave, cave_z80_state, init_mazinger, ROT90, "Banpresto / Dynamic Pl. Toei Animation", "Mazinger Z (Japan)", MACHINE_SUPPORTS_SAVE ) // 1994/06/27 08:00 +GAME( 1995, jumbogod, 0, jumbogod, jumbogod, cave_state, init_tjumpman, ROT0, "Namco", "Jumbo Godzilla", MACHINE_SUPPORTS_SAVE ) + // Version/Date string is stored at 68000 ROM 0x400-0x41f GAME( 1995, donpachi, 0, donpachi, cave, cave_state, init_donpachi, ROT270, "Cave (Atlus license)", "DonPachi (US)", MACHINE_SUPPORTS_SAVE ) // Ver.1.12 1995/05/2x XXXXX GAME( 1995, donpachij, donpachi, donpachi, cave, cave_state, init_donpachi, ROT270, "Cave (Atlus license)", "DonPachi (Japan)", MACHINE_SUPPORTS_SAVE ) // Ver.1.01 1995/05/11 diff --git a/src/mame/atlus/cave.h b/src/mame/atlus/cave.h index 04cc9772ced..bc0639834a4 100644 --- a/src/mame/atlus/cave.h +++ b/src/mame/atlus/cave.h @@ -67,6 +67,7 @@ class cave_state : public driver_device void esprade(machine_config &config); void gaia(machine_config &config); void guwange(machine_config &config); + void jumbogod(machine_config &config); void korokoro(machine_config &config); void paccarn(machine_config &config); void paceight(machine_config &config); @@ -197,6 +198,7 @@ class cave_state : public driver_device void gaia_coin_w(u8 data); u16 donpachi_videoregs_r(offs_t offset); template void videoregs_w(offs_t offset, u16 data, u16 mem_mask); + void jumbogod_leds_w(u8 data); void korokoro_leds_w(offs_t offset, u16 data, u16 mem_mask); void tjumpman_leds_w(u8 data); void pacslot_leds_w(u8 data); @@ -243,6 +245,7 @@ class cave_state : public driver_device void esprade_map(address_map &map); void gaia_map(address_map &map); void guwange_map(address_map &map); + void jumbogod_map(address_map &map); void korokoro_map(address_map &map); void paccarn_map(address_map &map); void paceight_map(address_map &map); diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 52844a09f84..e70e5422abb 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -2197,6 +2197,7 @@ gaia // (c) 1999 Noise Factory guwange // (c) 1999 Atlus/Cave guwanges // (c) 1999 Atlus/Cave hotdogst // (c) 1996 Marble +jumbogod // (c) 1995 Namco / Toho korokoro // (c) 1999 Takumi mazinger // (c) 1994 Banpresto (country is in EEPROM) mazingerj // (c) 1994 Banpresto (country is in EEPROM) From c83e1c5aa144542a95b94f704a1d16faa3d8ab45 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Wed, 22 May 2024 05:43:24 +1000 Subject: [PATCH 7/7] Cleanup: * olympia/dday.cpp: Correctly size the inappropriately named "color RAM". * util/cdrom.cpp, formats/fs_fat.cpp: More const, less copying. --- hash/bkrankp_cart.xml | 2 +- src/devices/sound/gb.cpp | 15 ++-- src/devices/sound/gb.h | 2 + src/lib/formats/fs_fat.cpp | 60 ++++++++------- src/lib/util/cdrom.cpp | 147 +++++++++++++++++++------------------ src/lib/util/cdrom.h | 13 +++- src/mame/nintendo/gba.cpp | 4 +- src/mame/olympia/dday.cpp | 18 ++--- 8 files changed, 142 insertions(+), 119 deletions(-) diff --git a/hash/bkrankp_cart.xml b/hash/bkrankp_cart.xml index a9d29a56db3..607765065d1 100644 --- a/hash/bkrankp_cart.xml +++ b/hash/bkrankp_cart.xml @@ -217,8 +217,8 @@ Known carts: Disney Dream Hit Song 2015 Bandai - + diff --git a/src/devices/sound/gb.cpp b/src/devices/sound/gb.cpp index ea537870907..e2e28e4d1d3 100644 --- a/src/devices/sound/gb.cpp +++ b/src/devices/sound/gb.cpp @@ -510,8 +510,9 @@ void agb_apu_device::update_wave_channel(struct SOUND &snd, uint64_t cycles) { if (snd.on) { - const uint8_t level_table[8] = {0, 4, 2, 1, 3, 3, 3, 3}; - // compensate for left over cycles + constexpr uint8_t level_table[8] = { 0, 4, 2, 1, 3, 3, 3, 3 }; + + // compensate for leftover cycles if (snd.cycles_left > 0) { if (cycles <= snd.cycles_left) @@ -523,7 +524,6 @@ void agb_apu_device::update_wave_channel(struct SOUND &snd, uint64_t cycles) else { // Emit samples - cycles -= snd.cycles_left; snd.cycles_left = 0; } @@ -553,10 +553,10 @@ void agb_apu_device::update_wave_channel(struct SOUND &snd, uint64_t cycles) snd.current_sample >>= 4; } snd.current_sample = (snd.current_sample & 0x0f) - 8; - snd.signal = level ? (snd.current_sample * level) / 4 : 0; + snd.signal = level ? ((snd.current_sample * level) / 4) : 0; cycles %= distance; - snd.sample_reading = cycles ? false : true; + snd.sample_reading = !cycles; snd.frequency_counter = snd.frequency + cycles; } @@ -750,12 +750,11 @@ u8 agb_apu_device::sound_r(offs_t offset) if ((offset >= AUD3W0) && (offset <= AUD3WF)) return wave_r(offset - AUD3W0); - static const uint8_t read_mask[0x40] = - { + static constexpr uint8_t read_mask[0x40] = { 0x80, 0x3f, 0x00, 0xff, 0xbf, 0xff, 0x3f, 0x00, 0xff, 0xbf, 0x1f, 0xff, 0x1f, 0xff, 0xbf, 0xff, 0xff, 0x00, 0x00, 0xbf, 0x00, 0x00, 0x70, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; // Make sure we are up to date. m_channel->update(); diff --git a/src/devices/sound/gb.h b/src/devices/sound/gb.h index dd5204dee6b..87e9c8ae7b2 100644 --- a/src/devices/sound/gb.h +++ b/src/devices/sound/gb.h @@ -199,6 +199,7 @@ class cgb04_apu_device : public gameboy_sound_device virtual void update_wave_channel(struct SOUND &snd, uint64_t cycles) override; }; + class agb_apu_device : public cgb04_apu_device { public: @@ -215,6 +216,7 @@ class agb_apu_device : public cgb04_apu_device virtual void update_wave_channel(struct SOUND &snd, uint64_t cycles) override; }; + DECLARE_DEVICE_TYPE(DMG_APU, dmg_apu_device) //DECLARE_DEVICE_TYPE(CGB02_APU, cgb02_apu_device) DECLARE_DEVICE_TYPE(CGB04_APU, cgb04_apu_device) diff --git a/src/lib/formats/fs_fat.cpp b/src/lib/formats/fs_fat.cpp index fe9a7b949c4..3ccd4a5bca7 100644 --- a/src/lib/formats/fs_fat.cpp +++ b/src/lib/formats/fs_fat.cpp @@ -150,6 +150,8 @@ #include #include +#include + using namespace fs; @@ -287,9 +289,9 @@ class impl : public filesystem_t std::optional find_entity(const std::vector &path) const; directory_span::ptr find_directory(std::vector::const_iterator path_begin, std::vector::const_iterator path_end) const; std::optional find_child(const directory_span ¤t_dir, std::string_view target) const; - void iterate_directory_entries(const directory_span &dir, const std::function &callback) const; - bool is_valid_short_filename(std::string &filename); - err_t build_direntry_filename(std::string &filename, std::string &fname); + template void iterate_directory_entries(const directory_span &dir, T &&callback) const; + bool is_valid_short_filename(std::string const &filename); + err_t build_direntry_filename(std::string const &filename, std::string &fname); err_t file_create_root(std::string &fname, u8 attributes = 0); err_t file_create_directory(directory_entry &dirent, std::string &fname, u8 attributes = 0); err_t file_create_sector(u32 sector, std::string &fname, u8 attributes); @@ -350,7 +352,7 @@ class subdirectory_span : public directory_span namespace { bool validate_filename(std::string_view name) { - auto is_invalid_filename_char = [](char ch) + auto const is_invalid_filename_char = [] (char ch) { return ch == '\0' || strchr("\\/:*?\"<>|", ch); }; @@ -450,8 +452,8 @@ char fs::fat_image::directory_separator() const std::vector fs::fat_image::volume_meta_description() const { std::vector results; - results.emplace_back(meta_name::name, "UNTITLED", false, [](const meta_value &m) { return validate_filename(m.as_string()); }, "Volume name"); - results.emplace_back(meta_name::oem_name, "", false, [](const meta_value &m) { return m.as_string().size() <= 8; }, "OEM name, up to 8 characters"); + results.emplace_back(meta_name::name, "UNTITLED", false, [] (const meta_value &m) { return validate_filename(m.as_string()); }, "Volume name"); + results.emplace_back(meta_name::oem_name, "", false, [] (const meta_value &m) { return m.as_string().size() <= 8; }, "OEM name, up to 8 characters"); return results; } @@ -463,7 +465,7 @@ std::vector fs::fat_image::volume_meta_description() const std::vector fs::fat_image::file_meta_description() const { std::vector results; - results.emplace_back(meta_name::name, "", false, [](const meta_value &m) { return validate_filename(m.as_string()); }, "File name"); + results.emplace_back(meta_name::name, "", false, [] (const meta_value &m) { return validate_filename(m.as_string()); }, "File name"); results.emplace_back(meta_name::creation_date, util::arbitrary_datetime::now(), false, nullptr, "Creation time"); results.emplace_back(meta_name::modification_date, util::arbitrary_datetime::now(), false, nullptr, "Modification time"); results.emplace_back(meta_name::length, 0, true, nullptr, "Size of the file in bytes"); @@ -478,7 +480,7 @@ std::vector fs::fat_image::file_meta_description() const std::vector fs::fat_image::directory_meta_description() const { std::vector results; - results.emplace_back(meta_name::name, "", false, [](const meta_value &m) { return validate_filename(m.as_string()); }, "File name"); + results.emplace_back(meta_name::name, "", false, [] (const meta_value &m) { return validate_filename(m.as_string()); }, "File name"); results.emplace_back(meta_name::creation_date, util::arbitrary_datetime::now(), false, nullptr, "Creation time"); results.emplace_back(meta_name::modification_date, util::arbitrary_datetime::now(), false, nullptr, "Modification time"); return results; @@ -577,7 +579,7 @@ meta_data impl::volume_metadata() // Get the volume label from the root directory, not the extended BPB (whose name field may not be kept up-to-date even when it exists) meta_data results; - auto callback = [&results](const directory_entry &dirent) + auto const callback = [&results] (const directory_entry &dirent) { if (dirent.is_volume_label()) { @@ -620,7 +622,7 @@ std::pair> impl::directory_contents(const std::vec return std::make_pair(ERR_NOT_FOUND, std::vector()); std::vector results; - auto callback = [&results](const directory_entry &dirent) + auto const callback = [&results] (const directory_entry &dirent) { if (!dirent.is_volume_label()) { @@ -664,7 +666,7 @@ std::pair> impl::file_read(const std::vector } -bool impl::is_valid_short_filename(std::string &filename) +bool impl::is_valid_short_filename(std::string const &filename) { /* Valid characters in DOS file names: @@ -680,7 +682,7 @@ bool impl::is_valid_short_filename(std::string &filename) } -err_t impl::build_direntry_filename(std::string &filename, std::string &fname) +err_t impl::build_direntry_filename(std::string const &filename, std::string &fname) { std::regex filename_regex("([A-Z0-9!#\\$%&\\(\\)\\-@^_`\\{\\}~]{0,8})(\\.([A-Z0-9!#\\$%&\\(\\)\\-@^_`\\{\\}~]{0,3}))?"); std::smatch smatch; @@ -712,14 +714,16 @@ err_t impl::file_create(const std::vector &path, const meta_data &m if (path.empty()) { return file_create_root(fname); - } else { + } + else + { // Make sure that all parts of the path exist, creating the path parts as needed. std::optional dirent = find_entity(path); if (!dirent) { std::vector partial_path; - std::optional parent_entry = { }; - for (auto path_part : path) + std::optional parent_entry; + for (auto const &path_part : path) { partial_path.emplace_back(path_part); std::optional dir_entry = find_entity(partial_path); @@ -733,8 +737,8 @@ err_t impl::file_create(const std::vector &path, const meta_data &m if (err != ERR_OK) return err; err = !parent_entry ? - file_create_root(part_fname, directory_entry::ATTR_DIRECTORY) : - file_create_directory(parent_entry.value(), part_fname, directory_entry::ATTR_DIRECTORY); + file_create_root(part_fname, directory_entry::ATTR_DIRECTORY) : + file_create_directory(parent_entry.value(), part_fname, directory_entry::ATTR_DIRECTORY); if (err != ERR_OK) return err; @@ -759,7 +763,7 @@ err_t impl::file_create(const std::vector &path, const meta_data &m return ERR_INVALID; } - return file_create_directory(dirent.value(), fname); + return file_create_directory(*dirent, fname); } } @@ -825,7 +829,8 @@ err_t impl::file_create_directory(directory_entry &dirent, std::string &fname, u u32 current_cluster = dirent.start_cluster(); do { const u32 first_sector = first_cluster_sector(current_cluster); - for (int i = 0; i < m_sectors_per_cluster; i++) { + for (int i = 0; i < m_sectors_per_cluster; i++) + { err_t err = file_create_sector(first_sector + i, fname, attributes); if (err != ERR_NOT_FOUND) return err; @@ -833,7 +838,8 @@ err_t impl::file_create_directory(directory_entry &dirent, std::string &fname, u // File could not be created yet. Move to next cluster, allocating a new cluster when needed. u32 next_cluster = get_next_cluster(current_cluster); - if (next_cluster >= m_last_valid_cluster) { + if (next_cluster >= m_last_valid_cluster) + { next_cluster = find_free_cluster(); if (next_cluster == 0) return ERR_NO_SPACE; @@ -861,7 +867,8 @@ u32 impl::first_cluster_sector(u32 cluster) void impl::clear_cluster_sectors(u32 cluster, u8 fill_byte) { const u32 sector = first_cluster_sector(cluster); - for (int i = 0; i < m_sectors_per_cluster; i++) { + for (int i = 0; i < m_sectors_per_cluster; i++) + { auto dirblk = m_blockdev.get(sector + i); for (int offset = 0; offset < m_bytes_per_sector; offset++) dirblk.w8(offset, fill_byte); @@ -1095,7 +1102,8 @@ void impl::set_next_cluster(u32 cluster, u32 next_cluster) next_cluster = next_cluster >> bit_count; current_bit += bit_count; // Write back to backing blocks - for (int i = 0; i < m_fat_count; i++) { + for (int i = 0; i < m_fat_count; i++) + { u32 fat_sector = m_fat_start_sector + (i * m_fat_sector_count) + (byte_pos / m_bytes_per_sector); auto fatblk = m_blockdev.get(fat_sector); fatblk.w8(byte_pos % m_bytes_per_sector, m_file_allocation_table[byte_pos]); @@ -1113,7 +1121,8 @@ u32 impl::find_free_cluster() u32 data_starting_sector = m_starting_sector + m_reserved_sector_count + fat_sector_count + root_directory_sector_count; u32 data_cluster_count = (m_sector_count - data_starting_sector) / m_sectors_per_cluster; - for (u32 cluster = FIRST_VALID_CLUSTER; cluster < (data_cluster_count + 2); cluster++) { + for (u32 cluster = FIRST_VALID_CLUSTER; cluster < (data_cluster_count + 2); cluster++) + { u32 entry_bit_position = cluster * m_bits_per_fat_entry; if (entry_bit_position + m_bits_per_fat_entry <= m_file_allocation_table.size() * 8) @@ -1191,7 +1200,7 @@ directory_span::ptr impl::find_directory(std::vector::const_iterato std::optional impl::find_child(const directory_span ¤t_dir, std::string_view target) const { std::optional result; - auto callback = [&result, target](const directory_entry &dirent) + auto const callback = [&result, target] (const directory_entry &dirent) { bool found = dirent.name() == target; if (found) @@ -1207,7 +1216,8 @@ std::optional impl::find_child(const directory_span ¤t_di // impl::iterate_directory_entries //------------------------------------------------- -void impl::iterate_directory_entries(const directory_span &dir, const std::function &callback) const +template +void impl::iterate_directory_entries(const directory_span &dir, T &&callback) const { std::vector sectors = dir.get_directory_sectors(); for (u32 sector : sectors) diff --git a/src/lib/util/cdrom.cpp b/src/lib/util/cdrom.cpp index d9074bfd838..76f3fe55155 100644 --- a/src/lib/util/cdrom.cpp +++ b/src/lib/util/cdrom.cpp @@ -181,7 +181,7 @@ cdrom_file::cdrom_file(std::string_view inputfile) track.logframeofs = track.pregap; } - if ((cdtoc.flags & CD_FLAG_MULTISESSION) && cdtrack_info.track[i].leadin != -1) + if ((cdtoc.flags & CD_FLAG_MULTISESSION) && (cdtrack_info.track[i].leadin != -1)) logofs += cdtrack_info.track[i].leadin; track.physframeofs = physofs; @@ -199,24 +199,26 @@ cdrom_file::cdrom_file(std::string_view inputfile) logofs += cdtrack_info.track[i].leadout; if (EXTRA_VERBOSE) + { printf("session %d track %02d is format %d subtype %d datasize %d subsize %d frames %d extraframes %d pregap %d pgmode %d presize %d postgap %d logofs %d physofs %d chdofs %d logframes %d pad %d\n", - track.session+1, - i+1, - track.trktype, - track.subtype, - track.datasize, - track.subsize, - track.frames, - track.extraframes, - track.pregap, - track.pgtype, - track.pgdatasize, - track.postgap, - track.logframeofs, - track.physframeofs, - track.chdframeofs, - track.logframes, - track.padframes); + track.session + 1, + i + 1, + track.trktype, + track.subtype, + track.datasize, + track.subsize, + track.frames, + track.extraframes, + track.pregap, + track.pgtype, + track.pgdatasize, + track.postgap, + track.logframeofs, + track.physframeofs, + track.chdframeofs, + track.logframes, + track.padframes); + } } // fill out dummy entries for the last track to help our search @@ -299,24 +301,26 @@ cdrom_file::cdrom_file(chd_file *_chd) logofs += track.frames; if (EXTRA_VERBOSE) + { printf("session %d track %02d is format %d subtype %d datasize %d subsize %d frames %d extraframes %d pregap %d pgmode %d presize %d postgap %d logofs %d physofs %d chdofs %d logframes %d pad %d\n", - track.session+1, - i+1, - track.trktype, - track.subtype, - track.datasize, - track.subsize, - track.frames, - track.extraframes, - track.pregap, - track.pgtype, - track.pgdatasize, - track.postgap, - track.logframeofs, - track.physframeofs, - track.chdframeofs, - track.logframes, - track.padframes); + track.session + 1, + i + 1, + track.trktype, + track.subtype, + track.datasize, + track.subsize, + track.frames, + track.extraframes, + track.pregap, + track.pgtype, + track.pgdatasize, + track.postgap, + track.logframeofs, + track.physframeofs, + track.chdframeofs, + track.logframes, + track.padframes); + } } // fill out dummy entries for the last track to help our search @@ -916,7 +920,7 @@ std::error_condition cdrom_file::parse_metadata(chd_file *chd, toc &toc) std::fill(std::begin(pgtype), std::end(pgtype), 0); std::fill(std::begin(pgsub), std::end(pgsub), 0); - /* fetch the metadata for this track */ + // fetch the metadata for this track if (!chd->read_metadata(CDROM_TRACK_METADATA_TAG, toc.numtrks, metadata)) { if (sscanf(metadata.c_str(), CDROM_TRACK_METADATA_FORMAT, &tracknum, type, subtype, &frames) != 4) @@ -929,11 +933,10 @@ std::error_condition cdrom_file::parse_metadata(chd_file *chd, toc &toc) } else { - /* fall through to GD-ROM detection */ + // fall through to GD-ROM detection err = chd->read_metadata(GDROM_OLD_METADATA_TAG, toc.numtrks, metadata); if (!err) - /* legacy GDROM track was detected */ - toc.flags |= CD_FLAG_GDROMLE; + toc.flags |= CD_FLAG_GDROMLE; // legacy GDROM track was detected else err = chd->read_metadata(GDROM_TRACK_METADATA_TAG, toc.numtrks, metadata); @@ -951,25 +954,25 @@ std::error_condition cdrom_file::parse_metadata(chd_file *chd, toc &toc) track = &toc.tracks[tracknum - 1]; - /* extract the track type and determine the data size */ + // extract the track type and determine the data size track->trktype = CD_TRACK_MODE1; track->datasize = 0; convert_type_string_to_track_info(type, track); if (track->datasize == 0) return chd_file::error::INVALID_DATA; - /* extract the subtype and determine the subcode data size */ + // extract the subtype and determine the subcode data size track->subtype = CD_SUB_NONE; track->subsize = 0; convert_subtype_string_to_track_info(subtype, track); - /* set the frames and extra frames data */ + // set the frames and extra frames data track->frames = frames; track->padframes = padframes; int padded = (frames + TRACK_PADDING - 1) / TRACK_PADDING; track->extraframes = padded * TRACK_PADDING - frames; - /* set the pregap info */ + // set the pregap info track->pregap = pregap; track->pgtype = CD_TRACK_MODE1; track->pgsub = CD_SUB_NONE; @@ -1515,7 +1518,7 @@ uint64_t cdrom_file::get_file_size(std::string_view filename) * @return An int. */ -int cdrom_file::tokenize( const char *linebuffer, int i, int linebuffersize, char *token, int tokensize ) +int cdrom_file::tokenize(const char *linebuffer, int i, int linebuffersize, char *token, int tokensize) { int j = 0; bool singlequote = false; @@ -1569,19 +1572,19 @@ int cdrom_file::tokenize( const char *linebuffer, int i, int linebuffersize, cha * @return An int. */ -int cdrom_file::msf_to_frames( char *token ) +int cdrom_file::msf_to_frames(const char *token) { int m = 0; int s = 0; int f = 0; - if( sscanf( token, "%d:%d:%d", &m, &s, &f ) == 1 ) + if (sscanf(token, "%d:%d:%d", &m, &s, &f ) == 1) { f = m; } else { - /* convert to just frames */ + // convert to just frames s += (m * 60); f += (s * 75); } @@ -2318,7 +2321,7 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto /* get pregap time */ TOKENIZE - session_pregap = msf_to_frames( token ); + session_pregap = msf_to_frames(token); } else if (!strncmp(linebuffer+i, "LEAD-OUT", 8)) { @@ -2332,7 +2335,7 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto /* get lead-out time */ TOKENIZE - int leadout_offset = msf_to_frames( token ); + int leadout_offset = msf_to_frames(token); outinfo.track[trknum].leadout = leadout_offset; } else if (!strncmp(linebuffer+i, "LEAD-IN", 7)) @@ -2345,7 +2348,7 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto /* get lead-in time */ TOKENIZE - leadin = msf_to_frames( token ); + leadin = msf_to_frames(token); } else if (is_gdrom && !strncmp(linebuffer+i, "SINGLE-DENSITY AREA", 19)) { @@ -2479,7 +2482,7 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto /* get index */ TOKENIZE - frames = msf_to_frames( token ); + frames = msf_to_frames(token); if (idx < 0 || idx > MAX_INDEX) { @@ -2509,7 +2512,7 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto /* get index */ TOKENIZE - frames = msf_to_frames( token ); + frames = msf_to_frames(token); outtoc.tracks[trknum].pregap = frames; } @@ -2519,7 +2522,7 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto /* get index */ TOKENIZE - frames = msf_to_frames( token ); + frames = msf_to_frames(token); outtoc.tracks[trknum].postgap = frames; } @@ -2719,24 +2722,26 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto } if (EXTRA_VERBOSE) + { for (trknum = 0; trknum < outtoc.numtrks; trknum++) { printf("session %d trk %d: %d frames @ offset %d, pad=%d, split=%d, area=%d, phys=%d, pregap=%d, pgtype=%d, pgdatasize=%d, idx0=%d, idx1=%d, dataframes=%d\n", - outtoc.tracks[trknum].session+1, - trknum+1, - outtoc.tracks[trknum].frames, - outinfo.track[trknum].offset, - outtoc.tracks[trknum].padframes, - outtoc.tracks[trknum].splitframes, - outtoc.tracks[trknum].multicuearea, - outtoc.tracks[trknum].physframeofs, - outtoc.tracks[trknum].pregap, - outtoc.tracks[trknum].pgtype, - outtoc.tracks[trknum].pgdatasize, - outinfo.track[trknum].idx[0], - outinfo.track[trknum].idx[1], - outtoc.tracks[trknum].frames - outtoc.tracks[trknum].padframes); + outtoc.tracks[trknum].session + 1, + trknum + 1, + outtoc.tracks[trknum].frames, + outinfo.track[trknum].offset, + outtoc.tracks[trknum].padframes, + outtoc.tracks[trknum].splitframes, + outtoc.tracks[trknum].multicuearea, + outtoc.tracks[trknum].physframeofs, + outtoc.tracks[trknum].pregap, + outtoc.tracks[trknum].pgtype, + outtoc.tracks[trknum].pgdatasize, + outinfo.track[trknum].idx[0], + outinfo.track[trknum].idx[1], + outtoc.tracks[trknum].frames - outtoc.tracks[trknum].padframes); } + } return std::error_condition(); } @@ -2913,7 +2918,7 @@ std::error_condition cdrom_file::parse_toc(std::string_view tocfname, toc &outto else if (isdigit((uint8_t)token[0])) { /* convert the time to an offset */ - f = msf_to_frames( token ); + f = msf_to_frames(token); f *= (outtoc.tracks[trknum].datasize + outtoc.tracks[trknum].subsize); } @@ -2929,7 +2934,7 @@ std::error_condition cdrom_file::parse_toc(std::string_view tocfname, toc &outto if (isdigit((uint8_t)token[0])) { // this could be the length or an offset from the previous field. - f = msf_to_frames( token ); + f = msf_to_frames(token); TOKENIZE @@ -2941,7 +2946,7 @@ std::error_condition cdrom_file::parse_toc(std::string_view tocfname, toc &outto outinfo.track[trknum].offset += f; // this is the length. - f = msf_to_frames( token ); + f = msf_to_frames(token); } } else if( trknum == 0 && outinfo.track[trknum].offset != 0 ) @@ -2991,7 +2996,7 @@ std::error_condition cdrom_file::parse_toc(std::string_view tocfname, toc &outto /* get index */ TOKENIZE - frames = msf_to_frames( token ); + frames = msf_to_frames(token); outtoc.tracks[trknum].pregap = frames; } diff --git a/src/lib/util/cdrom.h b/src/lib/util/cdrom.h index dd62badeff1..b11ecb5b3ba 100644 --- a/src/lib/util/cdrom.h +++ b/src/lib/util/cdrom.h @@ -16,6 +16,12 @@ #include "ioprocs.h" #include "osdcore.h" +#include +#include +#include +#include + + class cdrom_file { public: // tracks are padded to a multiple of this many frames @@ -159,7 +165,8 @@ class cdrom_file { static std::error_condition parse_toc(std::string_view tocfname, toc &outtoc, track_input_info &outinfo); int get_last_session() const { return cdtoc.numsessions ? cdtoc.numsessions : 1; } int get_last_track() const { return cdtoc.numtrks; } - int get_adr_control(int track) const { + int get_adr_control(int track) const + { if (track == 0xaa) track = get_last_track() - 1; // use last track's flags int adrctl = (CD_FLAG_ADR_START_TIME << 4) | (cdtoc.tracks[track].control_flags & 0x0f); @@ -282,8 +289,8 @@ class cdrom_file { static std::string get_file_path(std::string &path); static uint64_t get_file_size(std::string_view filename); - static int tokenize( const char *linebuffer, int i, int linebuffersize, char *token, int tokensize ); - static int msf_to_frames( char *token ); + static int tokenize(const char *linebuffer, int i, int linebuffersize, char *token, int tokensize); + static int msf_to_frames(const char *token); static uint32_t parse_wav_sample(std::string_view filename, uint32_t *dataoffs); static uint16_t read_uint16(FILE *infile); static uint32_t read_uint32(FILE *infile); diff --git a/src/mame/nintendo/gba.cpp b/src/mame/nintendo/gba.cpp index 7730b2a699a..93401f513c6 100644 --- a/src/mame/nintendo/gba.cpp +++ b/src/mame/nintendo/gba.cpp @@ -1453,7 +1453,7 @@ static void gba_cart(device_slot_interface &device) void gba_state::gbadv(machine_config &config) { - ARM7(config, m_maincpu, XTAL(4'194'304) * 4); // 4.194304MHz * 4 + ARM7(config, m_maincpu, 4.194304_MHz_XTAL * 4); m_maincpu->set_addrmap(AS_PROGRAM, &gba_state::gba_map); gba_lcd_device &lcd(GBA_LCD(config, "lcd", 0)); @@ -1465,7 +1465,7 @@ void gba_state::gbadv(machine_config &config) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - AGB_APU(config, m_gbsound, XTAL(4'194'304)); + AGB_APU(config, m_gbsound, 4.194304_MHz_XTAL); m_gbsound->add_route(0, "lspeaker", 0.5); m_gbsound->add_route(1, "rspeaker", 0.5); diff --git a/src/mame/olympia/dday.cpp b/src/mame/olympia/dday.cpp index ad6db7ab5a0..1b7b006e930 100644 --- a/src/mame/olympia/dday.cpp +++ b/src/mame/olympia/dday.cpp @@ -73,7 +73,7 @@ class dday_state : public driver_device m_textvideoram(*this, "textvideoram"), m_fgvideoram(*this, "fgvideoram"), m_bgvideoram(*this, "bgvideoram"), - m_colorram(*this, "colorram"), + m_colorram(*this, "colorram", 0x400 >> 5, ENDIANNESS_LITTLE), m_sl_map(*this, "sl_map"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), @@ -93,7 +93,7 @@ class dday_state : public driver_device required_shared_ptr m_textvideoram; required_shared_ptr m_fgvideoram; required_shared_ptr m_bgvideoram; - required_shared_ptr m_colorram; + memory_share_creator m_colorram; required_region_ptr m_sl_map; required_device m_maincpu; @@ -273,8 +273,8 @@ TILE_GET_INFO_MEMBER(dday_state::get_bg_tile_info) TILE_GET_INFO_MEMBER(dday_state::get_fg_tile_info) { - int const flipx = m_colorram[tile_index & 0x03e0] & 0x01; - int const code = m_fgvideoram[flipx ? tile_index ^ 0x1f : tile_index]; + int const flipx = m_colorram[tile_index >> 5] & 0x01; + int const code = m_fgvideoram[flipx ? (tile_index ^ 0x1f) : tile_index]; tileinfo.set(2, code, code >> 5, flipx ? TILE_FLIPX : 0); } @@ -288,8 +288,8 @@ TILE_GET_INFO_MEMBER(dday_state::get_sl_tile_info) { uint8_t *sl_map = &m_sl_map[(m_sl_image & 0x07) * 0x0200]; - int const flipx = (tile_index >> 4) & 0x01; - int const sl_flipx = (m_sl_image >> 3) & 0x01; + int const flipx = BIT(tile_index, 4); + int const sl_flipx = BIT(m_sl_image, 3); // bit 4 is really a flip indicator. Need to shift bits 5-9 to the right by 1 tile_index = ((tile_index & 0x03e0) >> 1) | (tile_index & 0x0f); @@ -351,7 +351,7 @@ void dday_state::colorram_w(offs_t offset, uint8_t data) { offset &= 0x03e0; - m_colorram[offset & 0x3e0] = data; + m_colorram[offset >> 5] = data; for (int i = 0; i < 0x20; i++) m_fg_tilemap->mark_tile_dirty(offset + i); @@ -359,7 +359,7 @@ void dday_state::colorram_w(offs_t offset, uint8_t data) uint8_t dday_state::colorram_r(offs_t offset) { - return m_colorram[offset & 0x03e0]; + return m_colorram[offset >> 5]; } @@ -438,7 +438,7 @@ void dday_state::program_map(address_map &map) map(0x5000, 0x53ff).ram().w(FUNC(dday_state::textvideoram_w)).share(m_textvideoram); map(0x5400, 0x57ff).ram().w(FUNC(dday_state::fgvideoram_w)).share(m_fgvideoram); map(0x5800, 0x5bff).ram().w(FUNC(dday_state::bgvideoram_w)).share(m_bgvideoram); - map(0x5c00, 0x5fff).rw(FUNC(dday_state::colorram_r), FUNC(dday_state::colorram_w)).share(m_colorram); + map(0x5c00, 0x5fff).rw(FUNC(dday_state::colorram_r), FUNC(dday_state::colorram_w)); map(0x6000, 0x63ff).ram(); map(0x6400, 0x6401).mirror(0x000e).w(m_ay1, FUNC(ay8912_device::address_data_w)); map(0x6800, 0x6801).w("ay2", FUNC(ay8912_device::address_data_w));