From 54859a237a3791356fc56c38ad75d17d67e6e1dc Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sun, 12 May 2024 04:02:38 +1000 Subject: [PATCH 01/16] cpu/upd7725: Mask address for data RAM accesses. [dink] --- src/devices/cpu/upd7725/upd7725.cpp | 6 +++--- src/devices/cpu/upd7725/upd7725.h | 28 ++++++++++++++-------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/devices/cpu/upd7725/upd7725.cpp b/src/devices/cpu/upd7725/upd7725.cpp index 45f685c1370..c8d079cc84c 100644 --- a/src/devices/cpu/upd7725/upd7725.cpp +++ b/src/devices/cpu/upd7725/upd7725.cpp @@ -384,7 +384,7 @@ void necdsp_device::exec_op(uint32_t opcode) { case 12: regs.idb = bitswap<16>(regs.si, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); break; //LSB = first bit in from serial, 'reversed' SI register order case 13: regs.idb = regs.k; break; case 14: regs.idb = regs.l; break; - case 15: regs.idb = dataRAM[regs.dp]; break; + case 15: regs.idb = dataRAM[regs.dp & 0x07ff]; break; } if(alu) { @@ -573,10 +573,10 @@ void necdsp_device::exec_ld(uint32_t opcode) { case 9: regs.so = id; break; //MSB first output, output tapped at bit 15 shifting left case 10: regs.k = id; break; case 11: regs.k = id; regs.l = m_data.read_word(regs.rp); break; - case 12: regs.l = id; regs.k = dataRAM[regs.dp | 0x40]; break; + case 12: regs.l = id; regs.k = dataRAM[(regs.dp & 0x7ff) | 0x40]; break; case 13: regs.l = id; break; case 14: regs.trb = id; break; - case 15: dataRAM[regs.dp] = id; break; + case 15: dataRAM[regs.dp & 0x7ff] = id; break; } } diff --git a/src/devices/cpu/upd7725/upd7725.h b/src/devices/cpu/upd7725/upd7725.h index ed17af002eb..e1f7703c369 100644 --- a/src/devices/cpu/upd7725/upd7725.h +++ b/src/devices/cpu/upd7725/upd7725.h @@ -43,18 +43,18 @@ class necdsp_device : public cpu_device // construction/destruction necdsp_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, uint32_t abits, uint32_t dbits); - // device-level overrides + // device_t implementation virtual void device_start() override; virtual void device_reset() override; - // device_execute_interface overrides + // device_execute_interface implementation virtual uint32_t execute_min_cycles() const noexcept override; virtual uint32_t execute_max_cycles() const noexcept override; virtual uint32_t execute_input_lines() const noexcept override; virtual void execute_run() override; virtual void execute_set_input(int inputnum, int state) override; - // device_memory_interface overrides + // device_memory_interface implementation virtual space_config_vector memory_space_config() const override; // device_state_interface overrides @@ -62,7 +62,7 @@ class necdsp_device : public cpu_device virtual void state_export(const device_state_entry &entry) override; virtual void state_string_export(const device_state_entry &entry, std::string &str) const override; - // device_disasm_interface overrides + // device_disasm_interface implementation virtual std::unique_ptr create_disassembler() override; // inline data @@ -75,12 +75,12 @@ class necdsp_device : public cpu_device { bool s1, s0, c, z, ov1, ov0; - inline operator unsigned() const + operator unsigned() const { - return (s1 << 5) + (s0 << 4) + (c << 3) + (z << 2) + (ov1 << 1) + (ov0 << 0); + return (s1 << 5) | (s0 << 4) | (c << 3) | (z << 2) | (ov1 << 1) | (ov0 << 0); } - inline unsigned operator=(unsigned d) + unsigned operator=(unsigned d) { s1 = d & 0x20; s0 = d & 0x10; c = d & 0x08; z = d & 0x04; ov1 = d & 0x02; ov0 = d & 0x01; return d; @@ -91,14 +91,14 @@ class necdsp_device : public cpu_device { bool rqm, usf1, usf0, drs, dma, drc, soc, sic, ei, p1, p0; - inline operator unsigned() const + operator unsigned() const { - return (rqm << 15) + (usf1 << 14) + (usf0 << 13) + (drs << 12) - + (dma << 11) + (drc << 10) + (soc << 9) + (sic << 8) - + (ei << 7) + (p1 << 1) + (p0 << 0); + return (rqm << 15) | (usf1 << 14) | (usf0 << 13) | (drs << 12) + | (dma << 11) | (drc << 10) | (soc << 9) | (sic << 8) + | (ei << 7) | (p1 << 1) | (p0 << 0); } - inline unsigned operator=(unsigned d) + unsigned operator=(unsigned d) { rqm = d & 0x8000; usf1 = d & 0x4000; usf0 = d & 0x2000; drs = d & 0x1000; dma = d & 0x0800; drc = d & 0x0400; soc = d & 0x0200; sic = d & 0x0100; @@ -175,8 +175,8 @@ class upd96050_device : public necdsp_device // construction/destruction upd96050_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - uint16_t dataram_r(uint16_t addr) { return dataRAM[addr]; } - void dataram_w(uint16_t addr, uint16_t data) { dataRAM[addr] = data; } + uint16_t dataram_r(uint16_t addr) { return dataRAM[addr & 0x07ff]; } + void dataram_w(uint16_t addr, uint16_t data) { dataRAM[addr & 0x07ff] = data; } }; // device type definition From 6d4287455ca57de56a5fab17a1e96ad000a17a11 Mon Sep 17 00:00:00 2001 From: ClawGrip Date: Sat, 11 May 2024 22:43:25 +0200 Subject: [PATCH 02/16] rockwell/aim65.cpp: Add Siemens PC100 as an AIM 65 BIOS [OldComputers ES] (#12361) * Also reformatted single line comments and removed comments about available software, which belong in a software list. --- src/mame/rockwell/aim65.cpp | 55 ++++++++++++++----------------------- 1 file changed, 20 insertions(+), 35 deletions(-) diff --git a/src/mame/rockwell/aim65.cpp b/src/mame/rockwell/aim65.cpp index 827ef9d90a0..5edebb95d83 100644 --- a/src/mame/rockwell/aim65.cpp +++ b/src/mame/rockwell/aim65.cpp @@ -43,21 +43,21 @@ static constexpr XTAL AIM65_CLOCK(4_MHz_XTAL / 4); ADDRESS MAPS ***************************************************************************/ -/* Note: RAM is mapped dynamically in machine/aim65.c */ +// Note: RAM is mapped dynamically in machine/aim65.c void aim65_state::mem_map(address_map &map) { - map(0x1000, 0x3fff).noprw(); /* User available expansions */ - map(0x4000, 0x7fff).rom(); /* 4 ROM sockets in 16K PROM/ROM module */ - map(0x8000, 0x9fff).noprw(); /* User available expansions */ + map(0x1000, 0x3fff).noprw(); // User available expansions + map(0x4000, 0x7fff).rom(); // 4 ROM sockets in 16K PROM/ROM module + map(0x8000, 0x9fff).noprw(); // User available expansions map(0xa000, 0xa00f).mirror(0x3f0).m(m_via1, FUNC(via6522_device::map)); // user via map(0xa400, 0xa47f).m(m_riot, FUNC(mos6532_device::ram_map)); map(0xa480, 0xa497).m(m_riot, FUNC(mos6532_device::io_map)); - map(0xa498, 0xa7ff).noprw(); /* Not available */ + map(0xa498, 0xa7ff).noprw(); // Not available map(0xa800, 0xa80f).mirror(0x3f0).m(m_via0, FUNC(via6522_device::map)); // system via map(0xac00, 0xac03).rw(m_pia, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); - map(0xac04, 0xac43).ram(); /* PIA RAM */ - map(0xac44, 0xafff).noprw(); /* Not available */ - map(0xb000, 0xffff).rom(); /* 5 ROM sockets */ + map(0xac04, 0xac43).ram(); // PIA RAM + map(0xac44, 0xafff).noprw(); // Not available + map(0xb000, 0xffff).rom(); // 5 ROM sockets } @@ -213,13 +213,13 @@ DEVICE_INPUT_DEFAULTS_END void aim65_state::aim65(machine_config &config) { - /* basic machine hardware */ - M6502(config, m_maincpu, AIM65_CLOCK); /* 1 MHz */ + // basic machine hardware + M6502(config, m_maincpu, AIM65_CLOCK); // 1 MHz m_maincpu->set_addrmap(AS_PROGRAM, &aim65_state::mem_map); config.set_default_layout(layout_aim65); - /* alpha-numeric display */ + // alpha-numeric display DL1416T(config, m_ds[0], u32(0)); m_ds[0]->update().set(FUNC(aim65_state::update_ds<1>)); DL1416T(config, m_ds[1], u32(0)); @@ -234,7 +234,7 @@ void aim65_state::aim65(machine_config &config) // pseudo-"screen" for the thermal printer. Index 0. screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(60); - screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */ + screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate screen.set_screen_update(FUNC(aim65_state::screen_update)); screen.set_size(160, 200); screen.set_visarea_full(); @@ -242,10 +242,10 @@ void aim65_state::aim65(machine_config &config) PALETTE(config, m_palette, FUNC(aim65_state::aim65_palette), 2); - /* Sound - wave sound only */ + // Sound - wave sound only SPEAKER(config, "mono").front_center(); - /* other devices */ + // other devices MOS6532(config, m_riot, AIM65_CLOCK); m_riot->pa_wr_callback().set([this] (u8 data) { m_riot_port_a = data; }); m_riot->pb_rd_callback().set([this] () { return aim65_state::z33_pb_r(); }); @@ -287,16 +287,16 @@ void aim65_state::aim65(machine_config &config) GENERIC_SOCKET(config, "z25", generic_plain_slot, "aim65_z25_cart", "z25").set_device_load(FUNC(aim65_state::z25_load)); GENERIC_SOCKET(config, "z24", generic_plain_slot, "aim65_z24_cart", "z24").set_device_load(FUNC(aim65_state::z24_load)); - /* PROM/ROM module sockets */ + // PROM/ROM module sockets GENERIC_SOCKET(config, "z12", generic_plain_slot, "rm65_z12_cart", "z12").set_device_load(FUNC(aim65_state::z12_load)); GENERIC_SOCKET(config, "z13", generic_plain_slot, "rm65_z13_cart", "z13").set_device_load(FUNC(aim65_state::z13_load)); GENERIC_SOCKET(config, "z14", generic_plain_slot, "rm65_z14_cart", "z14").set_device_load(FUNC(aim65_state::z14_load)); GENERIC_SOCKET(config, "z15", generic_plain_slot, "rm65_z15_cart", "z15").set_device_load(FUNC(aim65_state::z15_load)); - /* internal ram */ + // internal ram RAM(config, RAM_TAG).set_default_size("4K").set_extra_options("1K,2K,3K"); - /* Software lists */ + // Software lists SOFTWARE_LIST(config, "cart_list").set_original("aim65_cart"); } @@ -313,26 +313,11 @@ ROM_START( aim65 ) ROM_SYSTEM_BIOS(1, "dynatem", "Dynatem AIM-65") ROMX_LOAD("dynaim65.z23", 0xe000, 0x1000, CRC(90e44afe) SHA1(78e38601edf6bfc787b58750555a636b0cf74c5c), ROM_BIOS(1)) ROMX_LOAD("dynaim65.z22", 0xf000, 0x1000, CRC(83e1c6e7) SHA1(444134043edd83385bd70434cb100269901c4417), ROM_BIOS(1)) + ROM_SYSTEM_BIOS(2, "spc100", "Siemens PC100") + ROMX_LOAD("pc100.z23", 0xe000, 0x1000, CRC(90e44afe) SHA1(78e38601edf6bfc787b58750555a636b0cf74c5c), ROM_BIOS(2)) + ROMX_LOAD("pc100.z22", 0xf000, 0x1000, CRC(aa07742a) SHA1(3b9bee24a00cf23b7b50cee97ccc12e3fa9da1ea), ROM_BIOS(2)) ROM_END -/* Currently dumped and available software: - * - * Name Loc CRC32 SHA1 - * ------------------------------------------------------------------------ - * Assembler Z24 0878b399 483e92b57d64be51643a9f6490521a8572aa2f68 - * Basic V1.1 Z25 d7b42d2a 4bbdb28d332429825adea0266ed9192786d9e392 - * Basic V1.1 Z26 36a61f39 f5ce0126cb594a565e730973fd140d03c298cefa - * Forth V1.3 Z25 0671d019 dd2a1613e435c833634100cf4a22c6cff70c7a26 - * Forth V1.3 Z26 a80ad472 42a2e8c86829a2fe48090e6665ff9fe25b12b070 - * Mathpack Z24 4889af55 5e9541ddfc06e3802d09b30d1bd89c5da914c76e - * Monitor Z22 d01914b0 e5b5ddd4cd43cce073a718ee4ba5221f2bc84eaf - * Monitor Z23 90e44afe 78e38601edf6bfc787b58750555a636b0cf74c5c - * Monitor Dynatem Z22 83e1c6e7 444134043edd83385bd70434cb100269901c4417 - * PL/65 V1.0 Z25 76dcf864 e937c54ed109401f796640cd45b27dfefb76667e - * PL/65 V1.0 Z26 2ac71abd 6df5e3125bebefac80d51d9337555f54bdf0d8ea - * - */ - /*************************************************************************** GAME DRIVERS From a7223092bdb6902b00acbc2b0ac53fa0e610cec7 Mon Sep 17 00:00:00 2001 From: cam900 Date: Sun, 12 May 2024 05:47:41 +0900 Subject: [PATCH 03/16] seta/downtown.cpp: Cleanups (#12359) - Use logmacro for logging functions - Split driver class related to Tilemap chip, X1-010 soundchip - Use C++ style comments for single line comments - Fix naming for ROM region and shared RAM tags - Reduce literal tag usages - Fix PCMMUTE bit for calibr50 - Suppress side effects for debugger reads --- src/mame/seta/downtown.cpp | 631 +++++++++++++++++++------------------ 1 file changed, 331 insertions(+), 300 deletions(-) diff --git a/src/mame/seta/downtown.cpp b/src/mame/seta/downtown.cpp index 8a43384794f..e7d45a7cbba 100644 --- a/src/mame/seta/downtown.cpp +++ b/src/mame/seta/downtown.cpp @@ -322,23 +322,28 @@ P1-049-A #include "speaker.h" #include "tilemap.h" +#define LOG_PROT (1U << 1) + +#define LOG_ALL (LOG_PROT) + +#define VERBOSE (0) +#include "logmacro.h" + +#define LOGPROT(...) LOGMASKED(LOG_PROT, __VA_ARGS__) namespace { -class downtown_state : public driver_device +class tndrcade_state : public driver_device { public: - downtown_state(const machine_config &mconfig, device_type type, const char *tag) : + tndrcade_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_subcpu(*this, "sub"), m_screen(*this, "screen"), m_spritegen(*this, "spritegen"), - m_tiles(*this, "tiles"), m_palette(*this, "palette"), m_soundlatch(*this, "soundlatch%u", 1U), - m_x1snd(*this, "x1snd"), - m_rot(*this, "ROT%u", 1), m_p1(*this, "P1"), m_p2(*this, "P2"), m_dsw(*this, "DSW"), @@ -348,31 +353,39 @@ class downtown_state : public driver_device m_subbank(*this, "subbank") { } - void calibr50(machine_config &config); - void downtown(machine_config &config); - void metafox(machine_config &config); - void arbalest(machine_config &config); void tndrcade(machine_config &config); - void twineagl(machine_config &config); - - void init_downtown(); - void init_twineagl(); - void init_metafox(); - void init_arbalest(); protected: virtual void machine_start() override; + u16 ipl1_ack_r(); + void ipl1_ack_w(u16 data = 0); + + void seta_coin_lockout_w(u8 data); + X1_001_SPRITE_GFXBANK_CB_MEMBER(setac_gfxbank_callback); + u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + u8 sharedram_68000_r(offs_t offset); + void sharedram_68000_w(offs_t offset, u8 data); + void sub_ctrl_w(offs_t offset, u8 data); + void sub_bankswitch_w(u8 data); + void sub_bankswitch_lockout_w(u8 data); + u8 ff_r(); + u8 dsw1_r(); + u8 dsw2_r(); + + TIMER_DEVICE_CALLBACK_MEMBER(tndrcade_sub_interrupt); + + void tndrcade_map(address_map &map); + void tndrcade_sub_map(address_map &map); + required_device m_maincpu; required_device m_subcpu; required_device m_screen; required_device m_spritegen; - optional_device m_tiles; required_device m_palette; optional_device_array m_soundlatch; - optional_device m_x1snd; - optional_ioport_array<2> m_rot; optional_ioport m_p1; optional_ioport m_p2; required_ioport m_dsw; @@ -384,29 +397,38 @@ class downtown_state : public driver_device required_memory_bank m_subbank; u8 m_sub_ctrl_data = 0; - u8 m_twineagl_xram[8] = { }; - u8 m_twineagl_tilebank[4] = { }; +}; - std::unique_ptr m_downtown_protection; +class downtown_state : public tndrcade_state +{ +public: + downtown_state(const machine_config &mconfig, device_type type, const char *tag) : + tndrcade_state(mconfig, type, tag), + m_tiles(*this, "tiles"), + m_x1snd(*this, "x1snd"), + m_rot(*this, "ROT%u", 1) + { } - u16 ipl1_ack_r(); - void ipl1_ack_w(u16 data = 0); + void calibr50(machine_config &config); + void downtown(machine_config &config); + void metafox(machine_config &config); + void arbalest(machine_config &config); + void twineagl(machine_config &config); + + void init_downtown(); + void init_twineagl(); + void init_metafox(); + void init_arbalest(); + +protected: u16 ipl2_ack_r(); void ipl2_ack_w(u16 data = 0); - void seta_coin_lockout_w(u8 data); - X1_001_SPRITE_GFXBANK_CB_MEMBER(setac_gfxbank_callback); - u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + u32 screen_update_downtown(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void vram_layer0_vctrl_raster_trampoline_w(offs_t offset, u16 data, u16 mem_mask); u16 metafox_protection_r(offs_t offset); void twineagl_tilebank_w(offs_t offset, u8 data); - u8 sharedram_68000_r(offs_t offset); - void sharedram_68000_w(offs_t offset, u8 data); - void sub_ctrl_w(offs_t offset, u8 data); - void sub_bankswitch_w(u8 data); - void sub_bankswitch_lockout_w(u8 data); - u8 ff_r(); u8 downtown_ip_r(offs_t offset); void calibr50_sub_bankswitch_w(u8 data); void calibr50_soundlatch2_w(u8 data); @@ -417,14 +439,11 @@ class downtown_state : public driver_device u16 downtown_protection_r(offs_t offset); void downtown_protection_w(offs_t offset, u16 data, u16 mem_mask = ~0); u16 arbalest_debug_r(); - u8 dsw1_r(); - u8 dsw2_r(); DECLARE_MACHINE_RESET(calibr50); u16 twineagl_tile_offset(u16 code); TIMER_DEVICE_CALLBACK_MEMBER(seta_sub_interrupt); - TIMER_DEVICE_CALLBACK_MEMBER(tndrcade_sub_interrupt); TIMER_DEVICE_CALLBACK_MEMBER(calibr50_interrupt); void calibr50_map(address_map &map); @@ -432,9 +451,17 @@ class downtown_state : public driver_device void downtown_map(address_map &map); void downtown_sub_map(address_map &map); void metafox_sub_map(address_map &map); - void tndrcade_map(address_map &map); - void tndrcade_sub_map(address_map &map); void twineagl_sub_map(address_map &map); + + required_device m_tiles; + required_device m_x1snd; + + optional_ioport_array<2> m_rot; + + u8 m_twineagl_xram[8] = { }; + u8 m_twineagl_tilebank[4] = { }; + + std::unique_ptr m_downtown_protection; }; class usclssic_state : public downtown_state @@ -501,7 +528,7 @@ u16 usclssic_state::tile_offset(u16 code) return m_tiles_offset + code; } -X1_001_SPRITE_GFXBANK_CB_MEMBER(downtown_state::setac_gfxbank_callback) +X1_001_SPRITE_GFXBANK_CB_MEMBER(tndrcade_state::setac_gfxbank_callback) { const int bank = (color & 0x06) >> 1; code = (code & 0x3fff) + (bank * 0x4000); @@ -575,30 +602,33 @@ void usclssic_state::usclssic_set_pens() ***************************************************************************/ -u32 downtown_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +u32 tndrcade_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - if (m_tiles.found()) - { - const rectangle &visarea = screen.visible_area(); - const int vis_dimy = visarea.max_y - visarea.min_y + 1; + bitmap.fill(0x1f0, cliprect); + m_spritegen->draw_sprites(screen, bitmap, cliprect, 0x1000); - const int flip = m_spritegen->is_flipped(); - m_tiles->set_flip(flip ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0); + return 0; +} + +u32 downtown_state::screen_update_downtown(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + const rectangle &visarea = screen.visible_area(); + const int vis_dimy = visarea.max_y - visarea.min_y + 1; - /* the hardware wants different scroll values when flipped */ + const int flip = m_spritegen->is_flipped(); + m_tiles->set_flip(flip ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0); - /* bg x scroll flip - metafox 0000 025d = 0, $400-$1a3 = $400 - $190 - $13 - eightfrc ffe8 0272 - fff0 0260 = -$10, $400-$190 -$10 - ffe8 0272 = -$18, $400-$190 -$18 + $1a */ + // the hardware wants different scroll values when flipped - m_tiles->update_scroll(vis_dimy, flip); + /* bg x scroll flip + metafox 0000 025d = 0, $400-$1a3 = $400 - $190 - $13 + eightfrc ffe8 0272 + fff0 0260 = -$10, $400-$190 -$10 + ffe8 0272 = -$18, $400-$190 -$18 + $1a */ - m_tiles->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); - } - else - bitmap.fill(0x1f0, cliprect); + m_tiles->update_scroll(vis_dimy, flip); + + m_tiles->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); m_spritegen->draw_sprites(screen, bitmap, cliprect, 0x1000); @@ -608,7 +638,7 @@ u32 downtown_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c u32 usclssic_state::screen_update_usclssic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { usclssic_set_pens(); - return screen_update(screen, bitmap, cliprect); + return screen_update_downtown(screen, bitmap, cliprect); } @@ -627,12 +657,12 @@ u32 usclssic_state::screen_update_usclssic(screen_device &screen, bitmap_ind16 & */ -u8 downtown_state::sharedram_68000_r(offs_t offset) +u8 tndrcade_state::sharedram_68000_r(offs_t offset) { return m_sharedram[offset]; } -void downtown_state::sharedram_68000_w(offs_t offset, u8 data) +void tndrcade_state::sharedram_68000_w(offs_t offset, u8 data) { m_sharedram[offset] = data & 0xff; } @@ -644,7 +674,7 @@ void downtown_state::sharedram_68000_w(offs_t offset, u8 data) */ -void downtown_state::sub_ctrl_w(offs_t offset, u8 data) +void tndrcade_state::sub_ctrl_w(offs_t offset, u8 data) { switch (offset) { @@ -668,20 +698,20 @@ void downtown_state::sub_ctrl_w(offs_t offset, u8 data) } -/* DSW reading for 8 bit CPUs */ +// DSW reading for 8 bit CPUs -u8 downtown_state::dsw1_r() +u8 tndrcade_state::dsw1_r() { return (m_dsw->read() >> 8) & 0xff; } -u8 downtown_state::dsw2_r() +u8 tndrcade_state::dsw2_r() { return (m_dsw->read() >> 0) & 0xff; } -void downtown_state::seta_coin_lockout_w(u8 data) +void tndrcade_state::seta_coin_lockout_w(u8 data) { machine().bookkeeping().coin_counter_w(0, BIT(data, 0)); machine().bookkeeping().coin_counter_w(1, BIT(data, 1)); @@ -697,14 +727,14 @@ void downtown_state::seta_coin_lockout_w(u8 data) ***************************************************************************/ -u16 downtown_state::ipl1_ack_r() +u16 tndrcade_state::ipl1_ack_r() { if (!machine().side_effects_disabled()) ipl1_ack_w(); return 0; } -void downtown_state::ipl1_ack_w(u16 data) +void tndrcade_state::ipl1_ack_w(u16 data) { m_maincpu->set_input_line(2, CLEAR_LINE); } @@ -734,22 +764,22 @@ void downtown_state::ipl2_ack_w(u16 data) writing to sharedram! */ -void downtown_state::tndrcade_map(address_map &map) +void tndrcade_state::tndrcade_map(address_map &map) { map(0x000000, 0x07ffff).rom(); // ROM - map(0x200000, 0x200001).w(FUNC(downtown_state::ipl1_ack_w)); + map(0x200000, 0x200001).w(FUNC(tndrcade_state::ipl1_ack_w)); map(0x280000, 0x280001).nopw(); // ? 0 / 1 (sub cpu related?) map(0x300000, 0x300001).nopw(); // ? 0 / 1 - map(0x380000, 0x3803ff).ram().share("palette").w("palette", FUNC(palette_device::write16)); // Palette + map(0x380000, 0x3803ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); // Palette map(0x400000, 0x400000).w(m_spritegen, FUNC(x1_001_device::spritebgflag_w8)); map(0x600000, 0x6005ff).ram().rw(m_spritegen, FUNC(x1_001_device::spriteylow_r16), FUNC(x1_001_device::spriteylow_w16)); // Sprites Y map(0x600600, 0x600607).ram().rw(m_spritegen, FUNC(x1_001_device::spritectrl_r16), FUNC(x1_001_device::spritectrl_w16)); - map(0x800000, 0x800007).w(FUNC(downtown_state::sub_ctrl_w)).umask16(0x00ff); // Sub CPU Control? - map(0xa00000, 0xa00fff).rw(FUNC(downtown_state::sharedram_68000_r), FUNC(downtown_state::sharedram_68000_w)).umask16(0x00ff); // Shared RAM + map(0x800000, 0x800007).w(FUNC(tndrcade_state::sub_ctrl_w)).umask16(0x00ff); // Sub CPU Control? + map(0xa00000, 0xa00fff).rw(FUNC(tndrcade_state::sharedram_68000_r), FUNC(tndrcade_state::sharedram_68000_w)).umask16(0x00ff); // Shared RAM map(0xc00000, 0xc03fff).ram().rw(m_spritegen, FUNC(x1_001_device::spritecode_r16), FUNC(x1_001_device::spritecode_w16)); // Sprites Code + X + Attr - map(0xe00000, 0xe03fff).ram().share("share1"); // RAM (Mirrored?) - map(0xffc000, 0xffffff).ram().share("share1"); // RAM (Mirrored?) + map(0xe00000, 0xe03fff).ram().share("mainram"); // RAM (Mirrored?) + map(0xffc000, 0xffffff).ram().share("mainram"); // RAM (Mirrored?) } @@ -777,7 +807,7 @@ void downtown_state::downtown_map(address_map &map) map(0x500001, 0x500001).w(FUNC(downtown_state::twineagl_ctrl_w)); map(0x600001, 0x600001).r(FUNC(downtown_state::dsw1_r)); map(0x600003, 0x600003).r(FUNC(downtown_state::dsw2_r)); - map(0x700000, 0x7003ff).ram().share("palette").w("palette", FUNC(palette_device::write16)); // Palette + map(0x700000, 0x7003ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); // Palette map(0x800000, 0x800005).w(m_tiles, FUNC(x1_012_device::vctrl_w));// VRAM Ctrl map(0x900000, 0x903fff).ram().w(m_tiles, FUNC(x1_012_device::vram_w)).share("tiles"); // VRAM map(0xa00000, 0xa00007).w(FUNC(downtown_state::sub_ctrl_w)).umask16(0x00ff); // Sub CPU Control? @@ -804,7 +834,7 @@ void downtown_state::calibr50_map(address_map &map) map(0x500000, 0x500001).nopw(); // ? map(0x600001, 0x600001).r(FUNC(downtown_state::dsw1_r)); map(0x600003, 0x600003).r(FUNC(downtown_state::dsw2_r)); - map(0x700000, 0x7003ff).ram().share("palette").w("palette", FUNC(palette_device::write16)); // Palette + map(0x700000, 0x7003ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); // Palette map(0x800000, 0x800005).w(FUNC(downtown_state::vram_layer0_vctrl_raster_trampoline_w));// VRAM Ctrl map(0x900000, 0x903fff).ram().w(m_tiles, FUNC(x1_012_device::vram_w)).share("tiles"); // VRAM map(0x904000, 0x904fff).ram(); // @@ -876,12 +906,11 @@ void usclssic_state::lockout_w(u8 data) void usclssic_state::usclssic_map(address_map &map) { map(0x000000, 0x07ffff).rom(); // ROM - map(0xff0000, 0xffffff).ram(); // RAM map(0x800000, 0x8005ff).ram().rw(m_spritegen, FUNC(x1_001_device::spriteylow_r16), FUNC(x1_001_device::spriteylow_w16)); // Sprites Y map(0x800600, 0x800607).ram().rw(m_spritegen, FUNC(x1_001_device::spritectrl_r16), FUNC(x1_001_device::spritectrl_w16)); map(0x900000, 0x900000).w(m_spritegen, FUNC(x1_001_device::spritebgflag_w8)); map(0xa00000, 0xa00005).rw(m_tiles, FUNC(x1_012_device::vctrl_r), FUNC(x1_012_device::vctrl_w)); // VRAM Ctrl - map(0xb00000, 0xb003ff).ram().share("paletteram"); // Palette + map(0xb00000, 0xb003ff).ram().share(m_paletteram); // Palette map(0xb40000, 0xb40007).r(m_upd4701, FUNC(upd4701_device::read_xy)).umask16(0x00ff); map(0xb40001, 0xb40001).w(FUNC(usclssic_state::lockout_w)); // Coin Lockout + Tiles Banking map(0xb4000a, 0xb4000b).w(FUNC(usclssic_state::ipl1_ack_w)); @@ -894,6 +923,7 @@ void usclssic_state::usclssic_map(address_map &map) map(0xd00000, 0xd03fff).ram().w(m_tiles, FUNC(x1_012_device::vram_w)).share("tiles"); // VRAM map(0xd04000, 0xd04fff).ram(); // map(0xe00000, 0xe00fff).ram(); // NVRAM? (odd bytes) + map(0xff0000, 0xffffff).ram(); // RAM } @@ -903,12 +933,12 @@ void usclssic_state::usclssic_map(address_map &map) ***************************************************************************/ -void downtown_state::sub_bankswitch_w(u8 data) +void tndrcade_state::sub_bankswitch_w(u8 data) { m_subbank->set_entry(data >> 4); } -void downtown_state::sub_bankswitch_lockout_w(u8 data) +void tndrcade_state::sub_bankswitch_lockout_w(u8 data) { sub_bankswitch_w(data); seta_coin_lockout_w(data); @@ -922,23 +952,23 @@ void downtown_state::sub_bankswitch_lockout_w(u8 data) Thundercade ***************************************************************************/ -u8 downtown_state::ff_r(){return 0xff;} +u8 tndrcade_state::ff_r(){return 0xff;} -void downtown_state::tndrcade_sub_map(address_map &map) +void tndrcade_state::tndrcade_sub_map(address_map &map) { map(0x0000, 0x01ff).ram(); // RAM - map(0x0800, 0x0800).r(FUNC(downtown_state::ff_r)); // ? (bits 0/1/2/3: 1 -> do test 0-ff/100-1e0/5001-57ff/banked rom) + map(0x0800, 0x0800).r(FUNC(tndrcade_state::ff_r)); // ? (bits 0/1/2/3: 1 -> do test 0-ff/100-1e0/5001-57ff/banked rom) //map(0x0800, 0x0800).r(m_soundlatch[0], FUNC(generic_latch_8_device::read)); // //map(0x0801, 0x0801).r(m_soundlatch[1], FUNC(generic_latch_8_device::read)); // map(0x1000, 0x1000).portr("P1"); // P1 - map(0x1000, 0x1000).w(FUNC(downtown_state::sub_bankswitch_lockout_w)); // ROM Bank + Coin Lockout + map(0x1000, 0x1000).w(FUNC(tndrcade_state::sub_bankswitch_lockout_w)); // ROM Bank + Coin Lockout map(0x1001, 0x1001).portr("P2"); // P2 map(0x1002, 0x1002).portr("COINS"); // Coins map(0x2000, 0x2001).rw("ym1", FUNC(ym2203_device::read), FUNC(ym2203_device::write)); map(0x3000, 0x3001).w("ym2", FUNC(ym3812_device::write)); - map(0x5000, 0x57ff).ram().share("sharedram"); // Shared RAM + map(0x5000, 0x57ff).ram().share(m_sharedram); // Shared RAM map(0x6000, 0x7fff).rom(); // ROM - map(0x8000, 0xbfff).bankr("subbank"); // Banked ROM + map(0x8000, 0xbfff).bankr(m_subbank); // Banked ROM map(0xc000, 0xffff).rom(); // ROM } @@ -956,9 +986,9 @@ void downtown_state::twineagl_sub_map(address_map &map) map(0x1000, 0x1000).w(FUNC(downtown_state::sub_bankswitch_lockout_w)); // ROM Bank + Coin Lockout map(0x1001, 0x1001).portr("P2"); // P2 map(0x1002, 0x1002).portr("COINS"); // Coins - map(0x5000, 0x57ff).ram().share("sharedram"); // Shared RAM + map(0x5000, 0x57ff).ram().share(m_sharedram); // Shared RAM map(0x7000, 0x7fff).rom(); // ROM - map(0x8000, 0xbfff).bankr("subbank"); // Banked ROM + map(0x8000, 0xbfff).bankr(m_subbank); // Banked ROM map(0xc000, 0xffff).rom(); // ROM } @@ -997,9 +1027,9 @@ void downtown_state::downtown_sub_map(address_map &map) map(0x0801, 0x0801).r(m_soundlatch[1], FUNC(generic_latch_8_device::read)); // map(0x1000, 0x1007).r(FUNC(downtown_state::downtown_ip_r)); // Input Ports map(0x1000, 0x1000).w(FUNC(downtown_state::sub_bankswitch_lockout_w)); // ROM Bank + Coin Lockout - map(0x5000, 0x57ff).ram().share("sharedram"); // Shared RAM + map(0x5000, 0x57ff).ram().share(m_sharedram); // Shared RAM map(0x7000, 0x7fff).rom(); // ROM - map(0x8000, 0xbfff).bankr("subbank"); // Banked ROM + map(0x8000, 0xbfff).bankr(m_subbank); // Banked ROM map(0xc000, 0xffff).rom(); // ROM } @@ -1026,8 +1056,8 @@ void downtown_state::calibr50_sub_bankswitch_w(u8 data) if (!BIT(data, 2)) m_subcpu->set_input_line(m65c02_device::IRQ_LINE, CLEAR_LINE); - // Bit 1: PCMMUTE - m_x1snd->set_output_gain(ALL_OUTPUTS, BIT(data, 0) ? 0.0f : 1.0f); + // Bit 1: /PCMMUTE + m_x1snd->set_output_gain(ALL_OUTPUTS, BIT(data, 1) ? 1.0f : 0.0f); } void downtown_state::calibr50_soundlatch2_w(u8 data) @@ -1043,7 +1073,7 @@ void downtown_state::calibr50_sub_map(address_map &map) NAME([this](offs_t offset, u8 data) { m_x1snd->write(offset ^ 0x1000, data); })); // Sound map(0x4000, 0x4000).r(m_soundlatch[0], FUNC(generic_latch_8_device::read)); // From Main CPU map(0x4000, 0x4000).w(FUNC(downtown_state::calibr50_sub_bankswitch_w)); // Bankswitching - map(0x8000, 0xbfff).bankr("subbank"); // Banked ROM + map(0x8000, 0xbfff).bankr(m_subbank); // Banked ROM map(0xc000, 0xffff).rom(); // ROM map(0xc000, 0xc000).w(FUNC(downtown_state::calibr50_soundlatch2_w)); // To Main CPU } @@ -1063,9 +1093,9 @@ void downtown_state::metafox_sub_map(address_map &map) map(0x1002, 0x1002).portr("P1"); // P1 //map(0x1004, 0x1004).nopr(); // ? map(0x1006, 0x1006).portr("P2"); // P2 - map(0x5000, 0x57ff).ram().share("sharedram"); // Shared RAM + map(0x5000, 0x57ff).ram().share(m_sharedram); // Shared RAM map(0x7000, 0x7fff).rom(); // ROM - map(0x8000, 0xbfff).bankr("subbank"); // Banked ROM + map(0x8000, 0xbfff).bankr(m_subbank); // Banked ROM map(0xc000, 0xffff).rom(); // ROM } @@ -1152,16 +1182,16 @@ static INPUT_PORTS_START( arbalest ) PORT_INCLUDE(common_type2) PORT_START("DSW") // 2 DSWs - $600001 & 3.b - PORT_DIPNAME( 0x0001, 0x0001, "Licensed To" ) PORT_DIPLOCATION("SW1:1") /* Manual states "Don't Touch" */ + PORT_DIPNAME( 0x0001, 0x0001, "Licensed To" ) PORT_DIPLOCATION("SW1:1") // Manual states "Don't Touch" PORT_DIPSETTING( 0x0000, "Taito" ) PORT_CONDITION("DSW",0x4000,NOTEQUALS,0x4000) PORT_DIPSETTING( 0x0001, "Jordan" ) PORT_CONDITION("DSW",0x4000,NOTEQUALS,0x4000) PORT_DIPSETTING( 0x0000, "Taito" ) PORT_CONDITION("DSW",0x4000,EQUALS,0x4000) - PORT_DIPSETTING( 0x0001, "Romstar" ) PORT_CONDITION("DSW",0x4000,EQUALS,0x4000) /* Manual shows DSW1-1=Off & DSW2-7=Off */ + PORT_DIPSETTING( 0x0001, "Romstar" ) PORT_CONDITION("DSW",0x4000,EQUALS,0x4000) // Manual shows DSW1-1=Off & DSW2-7=Off PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:2") PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) PORT_SERVICE_DIPLOC( 0x0004, IP_ACTIVE_LOW, "SW1:3" ) - PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:4") /* Manual states "Don't Touch" */ + PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:4") // Manual states "Don't Touch" PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0008, DEF_STR( On ) ) PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:5,6") @@ -1197,10 +1227,10 @@ static INPUT_PORTS_START( arbalest ) PORT_DIPSETTING( 0x0000, "2" ) PORT_DIPSETTING( 0x3000, "3" ) PORT_DIPSETTING( 0x2000, "5" ) - PORT_DIPNAME( 0x4000, 0x4000, "Licensor Option" ) PORT_DIPLOCATION("SW2:7") /* Manual states "Don't Touch" */ + PORT_DIPNAME( 0x4000, 0x4000, "Licensor Option" ) PORT_DIPLOCATION("SW2:7") // Manual states "Don't Touch" PORT_DIPSETTING( 0x4000, "Option 1" ) PORT_DIPSETTING( 0x0000, "Option 2" ) - PORT_DIPNAME( 0x8000, 0x8000, "Coinage Type" ) PORT_DIPLOCATION("SW2:8") /* Manual states "Don't Touch" */ + PORT_DIPNAME( 0x8000, 0x8000, "Coinage Type" ) PORT_DIPLOCATION("SW2:8") // Manual states "Don't Touch" PORT_DIPSETTING( 0x8000, "Coin Mode 1" ) PORT_DIPSETTING( 0x0000, "Coin Mode 2" ) INPUT_PORTS_END @@ -1214,11 +1244,11 @@ static INPUT_PORTS_START( calibr50 ) PORT_INCLUDE(common_type2) PORT_START("DSW") //2 DSWs - $600001 & 3.b - PORT_DIPNAME( 0x0001, 0x0001, "Copyright / License" ) PORT_DIPLOCATION("SW1:1") /* Romstar's Manual states "Don't Touch" */ + PORT_DIPNAME( 0x0001, 0x0001, "Copyright / License" ) PORT_DIPLOCATION("SW1:1") // Romstar's Manual states "Don't Touch" PORT_DIPSETTING( 0x0000, "Seta (Japan only)" ) PORT_CONDITION("DSW",0x4000,NOTEQUALS,0x4000) PORT_DIPSETTING( 0x0001, "Seta USA / Romstar" ) PORT_CONDITION("DSW",0x4000,NOTEQUALS,0x4000) PORT_DIPSETTING( 0x0000, "Seta / Taito" ) PORT_CONDITION("DSW",0x4000,EQUALS,0x4000) - PORT_DIPSETTING( 0x0001, "Seta USA / Taito America" ) PORT_CONDITION("DSW",0x4000,EQUALS,0x4000) /* Romstar's Manual shows DSW1-1=Off & DSW2-7=Off */ + PORT_DIPSETTING( 0x0001, "Seta USA / Taito America" ) PORT_CONDITION("DSW",0x4000,EQUALS,0x4000) // Romstar's Manual shows DSW1-1=Off & DSW2-7=Off PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:2") PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) @@ -1261,10 +1291,10 @@ static INPUT_PORTS_START( calibr50 ) PORT_DIPNAME( 0x2000, 0x2000, "Erase Backup Ram" ) PORT_DIPLOCATION("SW2:6") PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) PORT_DIPSETTING( 0x2000, DEF_STR( On ) ) - PORT_DIPNAME( 0x4000, 0x4000, "Licensor Option" ) PORT_DIPLOCATION("SW2:7") /* Romstar's Manual states "Don't Touch" */ + PORT_DIPNAME( 0x4000, 0x4000, "Licensor Option" ) PORT_DIPLOCATION("SW2:7") // Romstar's Manual states "Don't Touch" PORT_DIPSETTING( 0x4000, "Option 1" ) PORT_DIPSETTING( 0x0000, "Option 2" ) - PORT_DIPNAME( 0x8000, 0x8000, "Coinage Type" ) PORT_DIPLOCATION("SW2:8") /* Romstar's Manual states "Don't Touch" */ + PORT_DIPNAME( 0x8000, 0x8000, "Coinage Type" ) PORT_DIPLOCATION("SW2:8") // Romstar's Manual states "Don't Touch" PORT_DIPSETTING( 0x8000, "Coin Mode 1" ) PORT_DIPSETTING( 0x0000, "Coin Mode 2" ) @@ -1283,7 +1313,7 @@ static INPUT_PORTS_START( downtown ) PORT_INCLUDE(common_type2) PORT_START("DSW") //2 DSWs - $600001 & 3.b - PORT_DIPNAME( 0x0001, 0x0000, "Sales" ) PORT_DIPLOCATION("SW1:1") /* Manual for USA version says "Always Off" */ + PORT_DIPNAME( 0x0001, 0x0000, "Sales" ) PORT_DIPLOCATION("SW1:1") // Manual for USA version says "Always Off" PORT_DIPSETTING( 0x0001, "Japan Only" ) PORT_DIPSETTING( 0x0000, DEF_STR( World ) ) PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:2") @@ -1329,10 +1359,10 @@ static INPUT_PORTS_START( downtown ) PORT_DIPSETTING( 0x3000, "3" ) PORT_DIPSETTING( 0x0000, "4" ) PORT_DIPSETTING( 0x2000, "5" ) - PORT_DIPNAME( 0x4000, 0x0000, "World License" ) PORT_DIPLOCATION("SW2:7") /* Manual for USA version says "Unused" */ + PORT_DIPNAME( 0x4000, 0x0000, "World License" ) PORT_DIPLOCATION("SW2:7") // Manual for USA version says "Unused" PORT_DIPSETTING( 0x4000, "Romstar" ) PORT_DIPSETTING( 0x0000, "Taito" ) - PORT_DIPNAME( 0x8000, 0x8000, "Coinage Type" ) PORT_DIPLOCATION("SW2:8") /* Manual for USA version says "Unused" */ + PORT_DIPNAME( 0x8000, 0x8000, "Coinage Type" ) PORT_DIPLOCATION("SW2:8") // Manual for USA version says "Unused" PORT_DIPSETTING( 0x8000, "1" ) PORT_DIPSETTING( 0x0000, "2" ) @@ -1353,11 +1383,11 @@ static INPUT_PORTS_START( metafox ) PORT_INCLUDE(common_type2) PORT_START("DSW") //$600001 & 3.b - PORT_DIPNAME( 0x0001, 0x0001, "Copyright / License" ) PORT_DIPLOCATION("SW1:1") /* Romstar's Manual states "Don't Touch" */ + PORT_DIPNAME( 0x0001, 0x0001, "Copyright / License" ) PORT_DIPLOCATION("SW1:1") // Romstar's Manual states "Don't Touch" PORT_DIPSETTING( 0x0000, "Seta USA / Taito America" ) PORT_CONDITION("DSW",0x4000,NOTEQUALS,0x4000) PORT_DIPSETTING( 0x0001, "Seta / Jordan I.S." ) PORT_CONDITION("DSW",0x4000,NOTEQUALS,0x4000) PORT_DIPSETTING( 0x0000, "Seta / Taito" ) PORT_CONDITION("DSW",0x4000,EQUALS,0x4000) - PORT_DIPSETTING( 0x0001, "Seta USA / Romstar" ) PORT_CONDITION("DSW",0x4000,EQUALS,0x4000) /* Romstar's Manual shows DSW1-1=Off & DSW2-7=Off */ + PORT_DIPSETTING( 0x0001, "Seta USA / Romstar" ) PORT_CONDITION("DSW",0x4000,EQUALS,0x4000) // Romstar's Manual shows DSW1-1=Off & DSW2-7=Off PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:2") PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) @@ -1398,10 +1428,10 @@ static INPUT_PORTS_START( metafox ) PORT_DIPSETTING( 0x0000, "2" ) PORT_DIPSETTING( 0x3000, "3" ) PORT_DIPSETTING( 0x2000, "5" ) - PORT_DIPNAME( 0x4000, 0x4000, "Licensor Option" ) PORT_DIPLOCATION("SW2:7") /* Romstar's Manual states "Don't Touch" */ + PORT_DIPNAME( 0x4000, 0x4000, "Licensor Option" ) PORT_DIPLOCATION("SW2:7") // Romstar's Manual states "Don't Touch" PORT_DIPSETTING( 0x4000, "Option 1" ) PORT_DIPSETTING( 0x0000, "Option 2" ) - PORT_DIPNAME( 0x8000, 0x8000, "Coinage Type" ) PORT_DIPLOCATION("SW2:8") /* Romstar's Manual states "Don't Touch" */ + PORT_DIPNAME( 0x8000, 0x8000, "Coinage Type" ) PORT_DIPLOCATION("SW2:8") // Romstar's Manual states "Don't Touch" PORT_DIPSETTING( 0x8000, "Coin Mode 1" ) PORT_DIPSETTING( 0x0000, "Coin Mode 2" ) INPUT_PORTS_END @@ -1513,16 +1543,16 @@ static INPUT_PORTS_START( twineagl ) // Most likely these are overwritten by the lead JPs that the board has // (4x3 near SW2 at J2, 2x3 near two empty ROM sockets U31/U37 at C10). PORT_START("DSW") //2 DSWs - $600001 & 3.b - PORT_DIPNAME( 0x0001, 0x0001, "Copyright / License" ) PORT_DIPLOCATION("SW1:1") /* Always "Seta" if sim. players = 1 */ + PORT_DIPNAME( 0x0001, 0x0001, "Copyright / License" ) PORT_DIPLOCATION("SW1:1") // Always "Seta" if sim. players = 1 PORT_DIPSETTING( 0x0000, "Taito America / Romstar" ) PORT_CONDITION("DSW",0x4000,NOTEQUALS,0x4000) - PORT_DIPSETTING( 0x0001, "Taito Corp Japan" ) PORT_CONDITION("DSW",0x4000,NOTEQUALS,0x4000) /* "World" Copyright */ + PORT_DIPSETTING( 0x0001, "Taito Corp Japan" ) PORT_CONDITION("DSW",0x4000,NOTEQUALS,0x4000) // "World" Copyright PORT_DIPSETTING( 0x0000, "Taito America" ) PORT_CONDITION("DSW",0x4000,EQUALS,0x4000) - PORT_DIPSETTING( 0x0001, "Seta / Taito" ) PORT_CONDITION("DSW",0x4000,EQUALS,0x4000) /* Japan Only Notice */ + PORT_DIPSETTING( 0x0001, "Seta / Taito" ) PORT_CONDITION("DSW",0x4000,EQUALS,0x4000) // Japan Only Notice PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:2") PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) PORT_SERVICE_DIPLOC( 0x0004, IP_ACTIVE_LOW, "SW1:3" ) - PORT_DIPNAME( 0x0008, 0x0000, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:4") /* Only if simultaneous players = 1 */ + PORT_DIPNAME( 0x0008, 0x0000, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:4") // Only if simultaneous players = 1 PORT_DIPSETTING( 0x0000, DEF_STR( Upright ) ) PORT_DIPSETTING( 0x0008, DEF_STR( Cocktail ) ) PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:5,6") @@ -1558,10 +1588,10 @@ static INPUT_PORTS_START( twineagl ) PORT_DIPSETTING( 0x0000, "2" ) PORT_DIPSETTING( 0x3000, "3" ) PORT_DIPSETTING( 0x2000, "5" ) - PORT_DIPNAME( 0x4000, 0x0000, "Licensor Option" ) PORT_DIPLOCATION("SW2:7") /* Manual states "Don't Touch" */ + PORT_DIPNAME( 0x4000, 0x0000, "Licensor Option" ) PORT_DIPLOCATION("SW2:7") // Manual states "Don't Touch" PORT_DIPSETTING( 0x4000, "Option 1" ) PORT_DIPSETTING( 0x0000, "Option 2" ) - PORT_DIPNAME( 0x8000, 0x8000, "Coinage Type" ) PORT_DIPLOCATION("SW2:8") /* Manual states "Don't Touch" */ + PORT_DIPNAME( 0x8000, 0x8000, "Coinage Type" ) PORT_DIPLOCATION("SW2:8") // Manual states "Don't Touch" PORT_DIPSETTING( 0x8000, "Coin Mode 1" ) PORT_DIPSETTING( 0x0000, "Coin Mode 2" ) INPUT_PORTS_END @@ -1579,16 +1609,16 @@ static INPUT_PORTS_START( usclssic ) PORT_START("TRACKY") PORT_BIT( 0xfff, 0x000, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(usclssic_state, trackball_y_r) - PORT_START("TRACK1_X") /* muxed port 0 */ + PORT_START("TRACK1_X") // muxed port 0 PORT_BIT( 0xfff, 0x000, IPT_TRACKBALL_X ) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) - PORT_START("TRACK1_Y") /* muxed port 0 */ + PORT_START("TRACK1_Y") // muxed port 0 PORT_BIT( 0xfff, 0x000, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) - PORT_START("TRACK2_X") /* muxed port 1 */ + PORT_START("TRACK2_X") // muxed port 1 PORT_BIT( 0xfff, 0x000, IPT_TRACKBALL_X ) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) PORT_COCKTAIL - PORT_START("TRACK2_Y") /* muxed port 1 */ + PORT_START("TRACK2_Y") // muxed port 1 PORT_BIT( 0xfff, 0x000, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) PORT_COCKTAIL PORT_START("BUTTONS") @@ -1666,10 +1696,10 @@ or 6 planes deep and are stored in a wealth of formats. ***************************************************************************/ - /* First the 4 bit tiles */ + // First the 4 bit tiles -/* The tilemap bitplanes are packed togheter */ +// The tilemap bitplanes are packed togheter static const gfx_layout layout_tilemap = { 16,16, @@ -1682,7 +1712,7 @@ static const gfx_layout layout_tilemap = }; -/* The sprite bitplanes are separated (but there are 2 per rom) */ +// The sprite bitplanes are separated (but there are 2 per rom) static const gfx_layout layout_sprites = { 16,16, @@ -1695,10 +1725,10 @@ static const gfx_layout layout_sprites = }; - /* Then the 6 bit tiles */ + // Then the 6 bit tiles -/* The tilemap bitplanes are packed together */ +// The tilemap bitplanes are packed together static const gfx_layout layout_tilemap_6bpp = { 16,16, @@ -1716,7 +1746,7 @@ static const gfx_layout layout_tilemap_6bpp = ***************************************************************************/ static GFXDECODE_START( gfx_downtown ) - GFXDECODE_ENTRY( "gfx2", 0, layout_tilemap, 0, 32 ) // [0] Layer 1 + GFXDECODE_ENTRY( "tiles", 0, layout_tilemap, 0, 32 ) // [0] Layer 1 GFXDECODE_END /*************************************************************************** @@ -1724,7 +1754,7 @@ GFXDECODE_END ***************************************************************************/ static GFXDECODE_START( gfx_sprites ) - GFXDECODE_ENTRY( "gfx1", 0, layout_sprites, 0, 32 ) // Sprites + GFXDECODE_ENTRY( "sprites", 0, layout_sprites, 0, 32 ) // Sprites GFXDECODE_END @@ -1734,8 +1764,8 @@ GFXDECODE_END ***************************************************************************/ static GFXDECODE_START( gfx_usclssic ) - GFXDECODE_ENTRY( "gfx2", 0, layout_tilemap_6bpp, 512+64*32*0, 32 ) // [0] Layer 1 - GFXDECODE_ENTRY( "gfx2", 0, layout_tilemap_6bpp, 512+64*32*1, 32 ) // [1] Layer 1 + GFXDECODE_ENTRY( "tiles", 0, layout_tilemap_6bpp, 512+64*32*0, 32 ) // [0] Layer 1 + GFXDECODE_ENTRY( "tiles", 0, layout_tilemap_6bpp, 512+64*32*1, 32 ) // [1] Layer 1 GFXDECODE_END @@ -1761,7 +1791,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(downtown_state::seta_sub_interrupt) Thundercade ***************************************************************************/ -TIMER_DEVICE_CALLBACK_MEMBER(downtown_state::tndrcade_sub_interrupt) +TIMER_DEVICE_CALLBACK_MEMBER(tndrcade_state::tndrcade_sub_interrupt) { int scanline = param; @@ -1772,44 +1802,44 @@ TIMER_DEVICE_CALLBACK_MEMBER(downtown_state::tndrcade_sub_interrupt) m_subcpu->set_input_line(m65c02_device::IRQ_LINE, ASSERT_LINE); } -void downtown_state::tndrcade(machine_config &config) +void tndrcade_state::tndrcade(machine_config &config) { - /* basic machine hardware */ - M68000(config, m_maincpu, 16_MHz_XTAL / 2); /* 8 MHz */ - m_maincpu->set_addrmap(AS_PROGRAM, &downtown_state::tndrcade_map); + // basic machine hardware + M68000(config, m_maincpu, 16_MHz_XTAL / 2); // 8 MHz + m_maincpu->set_addrmap(AS_PROGRAM, &tndrcade_state::tndrcade_map); - M65C02(config, m_subcpu, 16_MHz_XTAL / 8); /* 2 MHz */ - m_subcpu->set_addrmap(AS_PROGRAM, &downtown_state::tndrcade_sub_map); - TIMER(config, "scantimer").configure_scanline(FUNC(downtown_state::tndrcade_sub_interrupt), "screen", 0, 1); + M65C02(config, m_subcpu, 16_MHz_XTAL / 8); // 2 MHz + m_subcpu->set_addrmap(AS_PROGRAM, &tndrcade_state::tndrcade_sub_map); + TIMER(config, "scantimer").configure_scanline(FUNC(tndrcade_state::tndrcade_sub_interrupt), "screen", 0, 1); X1_001(config, m_spritegen, 16_MHz_XTAL, m_palette, gfx_sprites); - m_spritegen->set_gfxbank_callback(FUNC(downtown_state::setac_gfxbank_callback)); + m_spritegen->set_gfxbank_callback(FUNC(tndrcade_state::setac_gfxbank_callback)); // position kludges m_spritegen->set_fg_xoffsets(0, 0); // correct (start grid, wall at beginning of game) m_spritegen->set_fg_yoffsets(-0x12, 0x0e); m_spritegen->set_bg_yoffsets(0x1, -0x1); - /* 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(0)); screen.set_size(64*8, 32*8); screen.set_visarea(0*8, 48*8-1, 2*8, 30*8-1); - screen.set_screen_update(FUNC(downtown_state::screen_update)); + screen.set_screen_update(FUNC(tndrcade_state::screen_update)); screen.set_palette(m_palette); screen.screen_vblank().set_inputline(m_maincpu, 2, ASSERT_LINE); PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 512); // sprites only - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); - ym2203_device &ym1(YM2203(config, "ym1", 16_MHz_XTAL / 4)); /* 4 MHz */ - ym1.port_a_read_callback().set(FUNC(downtown_state::dsw1_r)); /* input A: DSW 1 */ - ym1.port_b_read_callback().set(FUNC(downtown_state::dsw2_r)); /* input B: DSW 2 */ + ym2203_device &ym1(YM2203(config, "ym1", 16_MHz_XTAL / 4)); // 4 MHz + ym1.port_a_read_callback().set(FUNC(tndrcade_state::dsw1_r)); // input A: DSW 1 + ym1.port_b_read_callback().set(FUNC(tndrcade_state::dsw2_r)); // input B: DSW 2 ym1.add_route(ALL_OUTPUTS, "mono", 0.35); - ym3812_device &ym2(YM3812(config, "ym2", 16_MHz_XTAL / 4)); /* 4 MHz */ + ym3812_device &ym2(YM3812(config, "ym2", 16_MHz_XTAL / 4)); // 4 MHz ym2.add_route(ALL_OUTPUTS, "mono", 0.5); } @@ -1822,15 +1852,15 @@ void downtown_state::tndrcade(machine_config &config) the sub cpu reads the ip at different locations, the visible area seems different. */ -/* twineagl lev 3 = lev 2 + lev 1 ! */ +// twineagl lev 3 = lev 2 + lev 1 ! void downtown_state::twineagl(machine_config &config) { - /* basic machine hardware */ - M68000(config, m_maincpu, 16_MHz_XTAL / 2); /* 8 MHz */ + // basic machine hardware + M68000(config, m_maincpu, 16_MHz_XTAL / 2); // 8 MHz m_maincpu->set_addrmap(AS_PROGRAM, &downtown_state::downtown_map); - M65C02(config, m_subcpu, 16_MHz_XTAL / 8); /* 2 MHz */ + M65C02(config, m_subcpu, 16_MHz_XTAL / 8); // 2 MHz m_subcpu->set_addrmap(AS_PROGRAM, &downtown_state::twineagl_sub_map); TIMER(config, "s_scantimer").configure_scanline(FUNC(downtown_state::seta_sub_interrupt), "screen", 0, 1); @@ -1841,13 +1871,13 @@ void downtown_state::twineagl(machine_config &config) m_spritegen->set_fg_yoffsets(-0x12, 0x0e); m_spritegen->set_bg_yoffsets(0x1, -0x1); - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(57.42); // Possibly lower than 60Hz, Correct? screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); screen.set_size(64*8, 32*8); screen.set_visarea(0*8, 48*8-1, 1*8, 31*8-1); - screen.set_screen_update(FUNC(downtown_state::screen_update)); + screen.set_screen_update(FUNC(downtown_state::screen_update_downtown)); screen.set_palette(m_palette); screen.screen_vblank().set_inputline(m_maincpu, 3, ASSERT_LINE); @@ -1858,13 +1888,13 @@ void downtown_state::twineagl(machine_config &config) PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 512); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, m_soundlatch[0]); GENERIC_LATCH_8(config, m_soundlatch[1]); - X1_010(config, m_x1snd, 16_MHz_XTAL); /* 16 MHz */ + X1_010(config, m_x1snd, 16_MHz_XTAL); // 16 MHz m_x1snd->add_route(ALL_OUTPUTS, "mono", 0.5); } @@ -1873,15 +1903,15 @@ void downtown_state::twineagl(machine_config &config) DownTown ***************************************************************************/ -/* downtown lev 3 = lev 2 + lev 1 ! */ +// downtown lev 3 = lev 2 + lev 1 ! void downtown_state::downtown(machine_config &config) { - /* basic machine hardware */ - M68000(config, m_maincpu, 16_MHz_XTAL / 2); /* verified on pcb */ + // basic machine hardware + M68000(config, m_maincpu, 16_MHz_XTAL / 2); // verified on pcb m_maincpu->set_addrmap(AS_PROGRAM, &downtown_state::downtown_map); - M65C02(config, m_subcpu, 16_MHz_XTAL / 8); /* verified on pcb */ + M65C02(config, m_subcpu, 16_MHz_XTAL / 8); // verified on pcb m_subcpu->set_addrmap(AS_PROGRAM, &downtown_state::downtown_sub_map); TIMER(config, "s_scantimer").configure_scanline(FUNC(downtown_state::seta_sub_interrupt), "screen", 0, 1); @@ -1892,13 +1922,13 @@ void downtown_state::downtown(machine_config &config) m_spritegen->set_fg_yoffsets(-0x12, 0x0e); m_spritegen->set_bg_yoffsets(0x1, -0x1); - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); - screen.set_refresh_hz(57.42); /* verified on pcb */ + screen.set_refresh_hz(57.42); // verified on pcb screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); screen.set_size(64*8, 32*8); screen.set_visarea(0*8, 48*8-1, 1*8, 31*8-1); - screen.set_screen_update(FUNC(downtown_state::screen_update)); + screen.set_screen_update(FUNC(downtown_state::screen_update_downtown)); screen.set_palette(m_palette); screen.screen_vblank().set_inputline(m_maincpu, 2, ASSERT_LINE); @@ -1909,13 +1939,13 @@ void downtown_state::downtown(machine_config &config) PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 512); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, m_soundlatch[0]); GENERIC_LATCH_8(config, m_soundlatch[1]); - X1_010(config, m_x1snd, 16_MHz_XTAL); /* 16 MHz */ + X1_010(config, m_x1snd, 16_MHz_XTAL); // 16 MHz m_x1snd->add_route(ALL_OUTPUTS, "mono", 0.50); } @@ -1955,14 +1985,14 @@ void usclssic_state::machine_start() void usclssic_state::usclssic(machine_config &config) { - /* basic machine hardware */ - M68000(config, m_maincpu, 16_MHz_XTAL / 2); /* 8 MHz */ + // basic machine hardware + M68000(config, m_maincpu, 16_MHz_XTAL / 2); // 8 MHz m_maincpu->set_addrmap(AS_PROGRAM, &usclssic_state::usclssic_map); TIMER(config, "scantimer").configure_scanline(FUNC(usclssic_state::calibr50_interrupt), "screen", 0, 1); WATCHDOG_TIMER(config, "watchdog"); - M65C02(config, m_subcpu, 16_MHz_XTAL / 8); /* 2 MHz */ + M65C02(config, m_subcpu, 16_MHz_XTAL / 8); // 2 MHz m_subcpu->set_addrmap(AS_PROGRAM, &usclssic_state::calibr50_sub_map); UPD4701A(config, m_upd4701); @@ -1983,7 +2013,7 @@ void usclssic_state::usclssic(machine_config &config) m_spritegen->set_fg_yoffsets(-0x12, 0x0e); m_spritegen->set_bg_yoffsets(0x1, -0x1); - /* 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(0)); @@ -2000,14 +2030,14 @@ void usclssic_state::usclssic(machine_config &config) PALETTE(config, m_palette, FUNC(usclssic_state::usclssic_palette), 16*32 + 64*32*2, 0x400); // sprites, layer - layer is 6 planes deep - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, m_soundlatch[0]); m_soundlatch[0]->data_pending_callback().set_inputline(m_subcpu, m65c02_device::NMI_LINE); m_soundlatch[0]->set_separate_acknowledge(true); - X1_010(config, m_x1snd, 16_MHz_XTAL); /* 16 MHz */ + X1_010(config, m_x1snd, 16_MHz_XTAL); // 16 MHz m_x1snd->add_route(ALL_OUTPUTS, "mono", 0.5); } @@ -2023,8 +2053,8 @@ void usclssic_state::usclssic(machine_config &config) void downtown_state::calibr50(machine_config &config) { - /* basic machine hardware */ - M68000(config, m_maincpu, 16_MHz_XTAL / 2); /* verified on pcb */ + // basic machine hardware + M68000(config, m_maincpu, 16_MHz_XTAL / 2); // verified on pcb m_maincpu->set_addrmap(AS_PROGRAM, &downtown_state::calibr50_map); TIMER(config, "scantimer").configure_scanline(FUNC(downtown_state::calibr50_interrupt), "screen", 0, 1); @@ -2032,7 +2062,7 @@ void downtown_state::calibr50(machine_config &config) NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); - M65C02(config, m_subcpu, 16_MHz_XTAL / 8); /* verified on pcb */ + M65C02(config, m_subcpu, 16_MHz_XTAL / 8); // verified on pcb m_subcpu->set_addrmap(AS_PROGRAM, &downtown_state::calibr50_sub_map); m_subcpu->set_periodic_int(FUNC(downtown_state::irq0_line_assert), attotime::from_hz(4*60)); // IRQ: 4/frame @@ -2049,13 +2079,13 @@ void downtown_state::calibr50(machine_config &config) m_spritegen->set_fg_yoffsets(-0x12, 0x0e); m_spritegen->set_bg_yoffsets(0x1, -0x1); - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); - screen.set_refresh_hz(57.42); /* verified on pcb */ + screen.set_refresh_hz(57.42); // verified on pcb screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); screen.set_size(64*8, 32*8); screen.set_visarea(0*8, 48*8-1, 1*8, 31*8-1); - screen.set_screen_update(FUNC(downtown_state::screen_update)); + screen.set_screen_update(FUNC(downtown_state::screen_update_downtown)); screen.set_palette(m_palette); //screen.set_video_attributes(VIDEO_UPDATE_SCANLINE); @@ -2065,7 +2095,7 @@ void downtown_state::calibr50(machine_config &config) PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 512); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, m_soundlatch[0]); @@ -2074,7 +2104,7 @@ void downtown_state::calibr50(machine_config &config) GENERIC_LATCH_8(config, m_soundlatch[1]); - X1_010(config, m_x1snd, 16_MHz_XTAL); /* 16 MHz */ + X1_010(config, m_x1snd, 16_MHz_XTAL); // 16 MHz m_x1snd->add_route(ALL_OUTPUTS, "mono", 0.50); } @@ -2083,15 +2113,15 @@ void downtown_state::calibr50(machine_config &config) Meta Fox ***************************************************************************/ -/* metafox lev 3 = lev 2 + lev 1 ! */ +// metafox lev 3 = lev 2 + lev 1 ! void downtown_state::metafox(machine_config &config) { - /* basic machine hardware */ - M68000(config, m_maincpu, 16000000/2); /* 8 MHz */ + // basic machine hardware + M68000(config, m_maincpu, 16000000/2); // 8 MHz m_maincpu->set_addrmap(AS_PROGRAM, &downtown_state::downtown_map); - M65C02(config, m_subcpu, 16000000/8); /* 2 MHz */ + M65C02(config, m_subcpu, 16000000/8); // 2 MHz m_subcpu->set_addrmap(AS_PROGRAM, &downtown_state::metafox_sub_map); TIMER(config, "s_scantimer").configure_scanline(FUNC(downtown_state::seta_sub_interrupt), "screen", 0, 1); @@ -2102,13 +2132,13 @@ void downtown_state::metafox(machine_config &config) m_spritegen->set_fg_yoffsets(-0x12, 0x0e); m_spritegen->set_bg_yoffsets(0x1, -0x1); - /* 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(0)); screen.set_size(64*8, 32*8); screen.set_visarea(0*8, 48*8-1, 2*8, 30*8-1); - screen.set_screen_update(FUNC(downtown_state::screen_update)); + screen.set_screen_update(FUNC(downtown_state::screen_update_downtown)); screen.set_palette(m_palette); screen.screen_vblank().set_inputline(m_maincpu, 3, ASSERT_LINE); @@ -2119,13 +2149,13 @@ void downtown_state::metafox(machine_config &config) PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 512); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, m_soundlatch[0]); GENERIC_LATCH_8(config, m_soundlatch[1]); - X1_010(config, m_x1snd, 16000000); /* 16 MHz */ + X1_010(config, m_x1snd, 16000000); // 16 MHz m_x1snd->add_route(ALL_OUTPUTS, "mono", 0.5); } @@ -2148,17 +2178,17 @@ void downtown_state::arbalest(machine_config &config) #define ROM_LOAD24_BYTE(name, offset,length,hash) ROMX_LOAD(name, offset, length, hash, ROM_SKIP(2)) ROM_START( tndrcade ) - ROM_REGION( 0x080000, "maincpu", 0 ) /* 68000 Code */ + ROM_REGION( 0x080000, "maincpu", 0 ) // 68000 Code ROM_LOAD16_BYTE( "ua0-4.u19", 0x000000, 0x020000, CRC(73bd63eb) SHA1(5d410d2a77f1c3c4c37a9fe1e56019335891fe67) ) ROM_LOAD16_BYTE( "ua0-2.u17", 0x000001, 0x020000, CRC(e96194b1) SHA1(c5084d06a2e4f7ba3112be1ccc314f7d712bb45e) ) ROM_LOAD16_BYTE( "ua0-3.u18", 0x040000, 0x020000, CRC(0a7b1c41) SHA1(ede14ac08d7e63972c21fd2d0717276e73153f18) ) ROM_LOAD16_BYTE( "ua0-1.u16", 0x040001, 0x020000, CRC(fa906626) SHA1(a1d28328afa8dda98dd20f3f5a19c0dbf2ebaf36) ) - ROM_REGION( 0x02c000, "sub", 0 ) /* 65c02 Code */ + ROM_REGION( 0x02c000, "sub", 0 ) // 65c02 Code ROM_LOAD( "ua10-5.u24", 0x004000, 0x020000, CRC(8eff6122) SHA1(1adc1643018e612df85643014b78525106478889) ) // $1fffd=2 (country code) ROM_RELOAD( 0x00c000, 0x020000 ) - ROM_REGION( 0x200000, "gfx1", 0 ) /* Sprites */ + ROM_REGION( 0x200000, "sprites", 0 ) ROM_LOAD( "ua0-10.u12", 0x000000, 0x040000, CRC(aa7b6757) SHA1(9157cc930760c846cce95e18bf38e7ea241f7a8e) ) ROM_LOAD( "ua0-11.u13", 0x040000, 0x040000, CRC(11eaf931) SHA1(ba1dfc4b0f87b1bbdc6c2e36deaecda2b4655d57) ) ROM_LOAD( "ua0-12.u14", 0x080000, 0x040000, CRC(00b5381c) SHA1(6fc3138dd0e2b3f99872b1f0d177094df5bed39d) ) @@ -2170,17 +2200,17 @@ ROM_START( tndrcade ) ROM_END ROM_START( tndrcadej ) - ROM_REGION( 0x080000, "maincpu", 0 ) /* 68000 Code */ + ROM_REGION( 0x080000, "maincpu", 0 ) // 68000 Code ROM_LOAD16_BYTE( "ua0-4.u19", 0x000000, 0x020000, CRC(73bd63eb) SHA1(5d410d2a77f1c3c4c37a9fe1e56019335891fe67) ) ROM_LOAD16_BYTE( "ua0-2.u17", 0x000001, 0x020000, CRC(e96194b1) SHA1(c5084d06a2e4f7ba3112be1ccc314f7d712bb45e) ) ROM_LOAD16_BYTE( "ua0-3.u18", 0x040000, 0x020000, CRC(0a7b1c41) SHA1(ede14ac08d7e63972c21fd2d0717276e73153f18) ) ROM_LOAD16_BYTE( "ua0-1.u16", 0x040001, 0x020000, CRC(fa906626) SHA1(a1d28328afa8dda98dd20f3f5a19c0dbf2ebaf36) ) - ROM_REGION( 0x02c000, "sub", 0 ) /* 65c02 Code */ + ROM_REGION( 0x02c000, "sub", 0 ) // 65c02 Code ROM_LOAD( "thcade5.u24", 0x004000, 0x020000, CRC(8cb9df7b) SHA1(5b504657f4cc1ea265913ff670aed108ceddba46) ) // $1fffd=1 (country code jp) ROM_RELOAD( 0x00c000, 0x020000 ) - ROM_REGION( 0x200000, "gfx1", 0 ) /* Sprites */ + ROM_REGION( 0x200000, "sprites", 0 ) ROM_LOAD( "ua0-10.u12", 0x000000, 0x040000, CRC(aa7b6757) SHA1(9157cc930760c846cce95e18bf38e7ea241f7a8e) ) ROM_LOAD( "ua0-11.u13", 0x040000, 0x040000, CRC(11eaf931) SHA1(ba1dfc4b0f87b1bbdc6c2e36deaecda2b4655d57) ) ROM_LOAD( "ua0-12.u14", 0x080000, 0x040000, CRC(00b5381c) SHA1(6fc3138dd0e2b3f99872b1f0d177094df5bed39d) ) @@ -2192,151 +2222,151 @@ ROM_START( tndrcadej ) ROM_END ROM_START( twineagl ) - ROM_REGION( 0x0a0000, "maincpu", 0 ) /* 68000 Code */ + ROM_REGION( 0x0a0000, "maincpu", 0 ) // 68000 Code ROM_LOAD16_WORD( "ua2-1", 0x000000, 0x080000, CRC(5c3fe531) SHA1(e484dad25cda906fb1b0606fb10ae50056c64e6a) ) - ROM_REGION( 0x010000, "sub", 0 ) /* 65c02 Code */ + ROM_REGION( 0x010000, "sub", 0 ) // 65c02 Code ROM_LOAD( "ua2-2", 0x006000, 0x002000, CRC(783ca84e) SHA1(21e19f74812de50e98b755dd1f68c187dd1e7e81) ) ROM_RELOAD( 0x008000, 0x002000 ) ROM_RELOAD( 0x00a000, 0x002000 ) ROM_RELOAD( 0x00c000, 0x002000 ) ROM_RELOAD( 0x00e000, 0x002000 ) - ROM_REGION( 0x100000, "gfx1", 0 ) /* Sprites */ + ROM_REGION( 0x100000, "sprites", 0 ) ROM_LOAD16_BYTE( "ua2-4", 0x000000, 0x040000, CRC(8b7532d6) SHA1(ec42d21bc44f004282f822b3da36b5442eabd87a) ) ROM_LOAD16_BYTE( "ua2-3", 0x000001, 0x040000, CRC(1124417a) SHA1(c908f51b943188946486c639a0cb9712114b5437) ) ROM_LOAD16_BYTE( "ua2-6", 0x080000, 0x040000, CRC(99d8dbba) SHA1(ac2a3c5cad23e0207eba52935c72e23203c8e0af) ) ROM_LOAD16_BYTE( "ua2-5", 0x080001, 0x040000, CRC(6e450d28) SHA1(d0050afcc3f425ac70768271c9d2d55ab7fba622) ) - ROM_REGION( 0x200000, "gfx2", 0 ) /* Layer 1 */ + ROM_REGION( 0x200000, "tiles", 0 ) ROM_LOAD16_BYTE( "ua2-7", 0x000001, 0x080000, CRC(fce56907) SHA1(5d0d2d6dfdbadb21f1d61d84b8992ec0e527e18d) ) ROM_LOAD16_BYTE( "ua2-8", 0x000000, 0x080000, CRC(7d3a8d73) SHA1(d6a0bea124d7d228818f8ea8c804ad2ba8cead4b) ) ROM_LOAD16_BYTE( "ua2-9", 0x100001, 0x080000, CRC(a451eae9) SHA1(c236c92d9ecf56f8d8f4a5ee493e3791be0d3db4) ) ROM_LOAD16_BYTE( "ua2-10", 0x100000, 0x080000, CRC(5bbe1f56) SHA1(309bc43884816dafeb0f47e71ff5272d4d7cac54) ) - ROM_REGION( 0x100000, "x1snd", 0 ) /* Samples */ + ROM_REGION( 0x100000, "x1snd", 0 ) // Samples ROM_LOAD( "ua2-11", 0x000000, 0x080000, CRC(624e6057) SHA1(0e8e4d4b6bc5febf5ca83eea92e3ed06f16e7df0) ) ROM_LOAD( "ua2-12", 0x080000, 0x080000, CRC(3068ff64) SHA1(7c06a48a99ebb9e7f3709f25bd0caa4c9d7a2688) ) ROM_END ROM_START( downtown ) - ROM_REGION( 0x0a0000, "maincpu", 0 ) /* 68000 Code */ - ROM_LOAD16_BYTE( "ud2-001-000.3c", 0x000000, 0x040000, CRC(f1965260) SHA1(c0560342238d75f9b81ae9f3408cacfbcd331529) ) /* 40 pin MASK rom */ - ROM_LOAD16_BYTE( "ud2-001-003.11c", 0x000001, 0x040000, CRC(e7d5fa5f) SHA1(48612514598711aa73bf75243c842f0aca72f3d0) ) /* 40 pin MASK rom */ + ROM_REGION( 0x0a0000, "maincpu", 0 ) // 68000 Code + ROM_LOAD16_BYTE( "ud2-001-000.3c", 0x000000, 0x040000, CRC(f1965260) SHA1(c0560342238d75f9b81ae9f3408cacfbcd331529) ) // 40 pin MASK rom + ROM_LOAD16_BYTE( "ud2-001-003.11c", 0x000001, 0x040000, CRC(e7d5fa5f) SHA1(48612514598711aa73bf75243c842f0aca72f3d0) ) // 40 pin MASK rom ROM_LOAD16_BYTE( "ud2001002.9b", 0x080000, 0x010000, CRC(a300e3ac) SHA1(958cb121787444cdc6938fc5aad1e92238e39c13) ) ROM_LOAD16_BYTE( "ud2001001.8b", 0x080001, 0x010000, CRC(d2918094) SHA1(c135939ad12e3cf0688db148c49f99e757ad7b0d) ) - ROM_REGION( 0x04c000, "sub", 0 ) /* 65c02 Code */ - ROM_LOAD( "ud2-002-004.17c", 0x004000, 0x040000, CRC(bbd538b1) SHA1(de4c43bfc4004a14f9f66b5e8ff192b00c45c003) ) /* 40 pin MASK rom */ + ROM_REGION( 0x04c000, "sub", 0 ) // 65c02 Code + ROM_LOAD( "ud2-002-004.17c", 0x004000, 0x040000, CRC(bbd538b1) SHA1(de4c43bfc4004a14f9f66b5e8ff192b00c45c003) ) // 40 pin MASK rom ROM_RELOAD( 0x00c000, 0x040000 ) - ROM_REGION( 0x200000, "gfx1", 0 ) /* Sprites */ - ROM_LOAD16_BYTE( "ud2-001-005-t01.2n", 0x000000, 0x080000, CRC(77e6d249) SHA1(cdf67211cd447858293188511e826640fe24078b) ) /* 32 pin MASK rom */ - ROM_LOAD16_BYTE( "ud2-001-006-t02.3n", 0x000001, 0x080000, CRC(6e381bf2) SHA1(ba46e019d2991dec539444ef7376fe0e9a6a8b75) ) /* 32 pin MASK rom */ - ROM_LOAD16_BYTE( "ud2-001-007-t03.5n", 0x100000, 0x080000, CRC(737b4971) SHA1(2a034011b0ac03d532a89b544f4eec497ac7ee80) ) /* 32 pin MASK rom */ - ROM_LOAD16_BYTE( "ud2-001-008-t04.6n", 0x100001, 0x080000, CRC(99b9d757) SHA1(c3a763993305110ec2a0b231d75fbef4c385d21b) ) /* 32 pin MASK rom */ + ROM_REGION( 0x200000, "sprites", 0 ) + ROM_LOAD16_BYTE( "ud2-001-005-t01.2n", 0x000000, 0x080000, CRC(77e6d249) SHA1(cdf67211cd447858293188511e826640fe24078b) ) // 32 pin MASK rom + ROM_LOAD16_BYTE( "ud2-001-006-t02.3n", 0x000001, 0x080000, CRC(6e381bf2) SHA1(ba46e019d2991dec539444ef7376fe0e9a6a8b75) ) // 32 pin MASK rom + ROM_LOAD16_BYTE( "ud2-001-007-t03.5n", 0x100000, 0x080000, CRC(737b4971) SHA1(2a034011b0ac03d532a89b544f4eec497ac7ee80) ) // 32 pin MASK rom + ROM_LOAD16_BYTE( "ud2-001-008-t04.6n", 0x100001, 0x080000, CRC(99b9d757) SHA1(c3a763993305110ec2a0b231d75fbef4c385d21b) ) // 32 pin MASK rom - ROM_REGION( 0x100000, "gfx2", 0 ) /* Layer 1 */ - ROM_LOAD16_BYTE( "ud2-001-009-t05.8n", 0x000000, 0x080000, CRC(aee6c581) SHA1(5b2150a308ca12eea8148d0bbff663b3baf0c831) ) /* 32 pin MASK rom */ - ROM_LOAD16_BYTE( "ud2-001-010-t06.9n", 0x000001, 0x080000, CRC(3d399d54) SHA1(7d9036e73fbf0e9c3b976336e3e4786b17b2f4fc) ) /* 32 pin MASK rom */ + ROM_REGION( 0x100000, "tiles", 0 ) + ROM_LOAD16_BYTE( "ud2-001-009-t05.8n", 0x000000, 0x080000, CRC(aee6c581) SHA1(5b2150a308ca12eea8148d0bbff663b3baf0c831) ) // 32 pin MASK rom + ROM_LOAD16_BYTE( "ud2-001-010-t06.9n", 0x000001, 0x080000, CRC(3d399d54) SHA1(7d9036e73fbf0e9c3b976336e3e4786b17b2f4fc) ) // 32 pin MASK rom - ROM_REGION( 0x080000, "x1snd", 0 ) /* Samples */ - ROM_LOAD( "ud2-001-011-t07.14n", 0x000000, 0x080000, CRC(9c9ff69f) SHA1(3840b654f4f709bc4c03dfe4ee79369d5c70dd62) ) /* 32 pin MASK rom */ + ROM_REGION( 0x080000, "x1snd", 0 ) // Samples + ROM_LOAD( "ud2-001-011-t07.14n", 0x000000, 0x080000, CRC(9c9ff69f) SHA1(3840b654f4f709bc4c03dfe4ee79369d5c70dd62) ) // 32 pin MASK rom ROM_END ROM_START( downtown2 ) - ROM_REGION( 0x0a0000, "maincpu", 0 ) /* 68000 Code */ - ROM_LOAD16_BYTE( "ud2-001-000.3c", 0x000000, 0x040000, CRC(f1965260) SHA1(c0560342238d75f9b81ae9f3408cacfbcd331529) ) /* 40 pin MASK rom */ - ROM_LOAD16_BYTE( "ud2-001-003.11c", 0x000001, 0x040000, CRC(e7d5fa5f) SHA1(48612514598711aa73bf75243c842f0aca72f3d0) ) /* 40 pin MASK rom */ + ROM_REGION( 0x0a0000, "maincpu", 0 ) // 68000 Code + ROM_LOAD16_BYTE( "ud2-001-000.3c", 0x000000, 0x040000, CRC(f1965260) SHA1(c0560342238d75f9b81ae9f3408cacfbcd331529) ) // 40 pin MASK rom + ROM_LOAD16_BYTE( "ud2-001-003.11c", 0x000001, 0x040000, CRC(e7d5fa5f) SHA1(48612514598711aa73bf75243c842f0aca72f3d0) ) // 40 pin MASK rom ROM_LOAD16_BYTE( "ud2000002.9b", 0x080000, 0x010000, CRC(ca976b24) SHA1(3b2e362f414b0103dd02c9af6a5d480ec2cf9ca3) ) ROM_LOAD16_BYTE( "ud2000001.8b", 0x080001, 0x010000, CRC(1708aebd) SHA1(337a9e8d5da5b13a7ea4ee728de6b82fe92e16c5) ) - ROM_REGION( 0x04c000, "sub", 0 ) /* 65c02 Code */ - ROM_LOAD( "ud2-002-004.17c", 0x004000, 0x040000, CRC(bbd538b1) SHA1(de4c43bfc4004a14f9f66b5e8ff192b00c45c003) ) /* 40 pin MASK rom */ + ROM_REGION( 0x04c000, "sub", 0 ) // 65c02 Code + ROM_LOAD( "ud2-002-004.17c", 0x004000, 0x040000, CRC(bbd538b1) SHA1(de4c43bfc4004a14f9f66b5e8ff192b00c45c003) ) // 40 pin MASK rom ROM_RELOAD( 0x00c000, 0x040000 ) - ROM_REGION( 0x200000, "gfx1", 0 ) /* Sprites */ - ROM_LOAD16_BYTE( "ud2-001-005-t01.2n", 0x000000, 0x080000, CRC(77e6d249) SHA1(cdf67211cd447858293188511e826640fe24078b) ) /* 32 pin MASK rom */ - ROM_LOAD16_BYTE( "ud2-001-006-t02.3n", 0x000001, 0x080000, CRC(6e381bf2) SHA1(ba46e019d2991dec539444ef7376fe0e9a6a8b75) ) /* 32 pin MASK rom */ - ROM_LOAD16_BYTE( "ud2-001-007-t03.5n", 0x100000, 0x080000, CRC(737b4971) SHA1(2a034011b0ac03d532a89b544f4eec497ac7ee80) ) /* 32 pin MASK rom */ - ROM_LOAD16_BYTE( "ud2-001-008-t04.6n", 0x100001, 0x080000, CRC(99b9d757) SHA1(c3a763993305110ec2a0b231d75fbef4c385d21b) ) /* 32 pin MASK rom */ + ROM_REGION( 0x200000, "sprites", 0 ) + ROM_LOAD16_BYTE( "ud2-001-005-t01.2n", 0x000000, 0x080000, CRC(77e6d249) SHA1(cdf67211cd447858293188511e826640fe24078b) ) // 32 pin MASK rom + ROM_LOAD16_BYTE( "ud2-001-006-t02.3n", 0x000001, 0x080000, CRC(6e381bf2) SHA1(ba46e019d2991dec539444ef7376fe0e9a6a8b75) ) // 32 pin MASK rom + ROM_LOAD16_BYTE( "ud2-001-007-t03.5n", 0x100000, 0x080000, CRC(737b4971) SHA1(2a034011b0ac03d532a89b544f4eec497ac7ee80) ) // 32 pin MASK rom + ROM_LOAD16_BYTE( "ud2-001-008-t04.6n", 0x100001, 0x080000, CRC(99b9d757) SHA1(c3a763993305110ec2a0b231d75fbef4c385d21b) ) // 32 pin MASK rom - ROM_REGION( 0x100000, "gfx2", 0 ) /* Layer 1 */ - ROM_LOAD16_BYTE( "ud2-001-009-t05.8n", 0x000000, 0x080000, CRC(aee6c581) SHA1(5b2150a308ca12eea8148d0bbff663b3baf0c831) ) /* 32 pin MASK rom */ - ROM_LOAD16_BYTE( "ud2-001-010-t06.9n", 0x000001, 0x080000, CRC(3d399d54) SHA1(7d9036e73fbf0e9c3b976336e3e4786b17b2f4fc) ) /* 32 pin MASK rom */ + ROM_REGION( 0x100000, "tiles", 0 ) + ROM_LOAD16_BYTE( "ud2-001-009-t05.8n", 0x000000, 0x080000, CRC(aee6c581) SHA1(5b2150a308ca12eea8148d0bbff663b3baf0c831) ) // 32 pin MASK rom + ROM_LOAD16_BYTE( "ud2-001-010-t06.9n", 0x000001, 0x080000, CRC(3d399d54) SHA1(7d9036e73fbf0e9c3b976336e3e4786b17b2f4fc) ) // 32 pin MASK rom - ROM_REGION( 0x080000, "x1snd", 0 ) /* Samples */ - ROM_LOAD( "ud2-001-011-t07.14n", 0x000000, 0x080000, CRC(9c9ff69f) SHA1(3840b654f4f709bc4c03dfe4ee79369d5c70dd62) ) /* 32 pin MASK rom */ + ROM_REGION( 0x080000, "x1snd", 0 ) // Samples + ROM_LOAD( "ud2-001-011-t07.14n", 0x000000, 0x080000, CRC(9c9ff69f) SHA1(3840b654f4f709bc4c03dfe4ee79369d5c70dd62) ) // 32 pin MASK rom ROM_END ROM_START( downtownj ) - ROM_REGION( 0x0a0000, "maincpu", 0 ) /* 68000 Code */ - ROM_LOAD16_BYTE( "ud2-001-000.3c", 0x000000, 0x040000, CRC(f1965260) SHA1(c0560342238d75f9b81ae9f3408cacfbcd331529) ) /* 40 pin MASK rom */ - ROM_LOAD16_BYTE( "ud2-001-003.11c", 0x000001, 0x040000, CRC(e7d5fa5f) SHA1(48612514598711aa73bf75243c842f0aca72f3d0) ) /* 40 pin MASK rom */ + ROM_REGION( 0x0a0000, "maincpu", 0 ) // 68000 Code + ROM_LOAD16_BYTE( "ud2-001-000.3c", 0x000000, 0x040000, CRC(f1965260) SHA1(c0560342238d75f9b81ae9f3408cacfbcd331529) ) // 40 pin MASK rom + ROM_LOAD16_BYTE( "ud2-001-003.11c", 0x000001, 0x040000, CRC(e7d5fa5f) SHA1(48612514598711aa73bf75243c842f0aca72f3d0) ) // 40 pin MASK rom ROM_LOAD16_BYTE( "u37.9b", 0x080000, 0x010000, CRC(73047657) SHA1(731663101d809170aad3cd39e901ef494494c5a1) ) ROM_LOAD16_BYTE( "u31.8b", 0x080001, 0x010000, CRC(6a050240) SHA1(6a1a305b7d32bb2ad17842b4eeabc891fce02160) ) - ROM_REGION( 0x04c000, "sub", 0 ) /* 65c02 Code */ - ROM_LOAD( "ud2-002-004.17c", 0x004000, 0x040000, CRC(bbd538b1) SHA1(de4c43bfc4004a14f9f66b5e8ff192b00c45c003) ) /* 40 pin MASK rom */ + ROM_REGION( 0x04c000, "sub", 0 ) // 65c02 Code + ROM_LOAD( "ud2-002-004.17c", 0x004000, 0x040000, CRC(bbd538b1) SHA1(de4c43bfc4004a14f9f66b5e8ff192b00c45c003) ) // 40 pin MASK rom ROM_RELOAD( 0x00c000, 0x040000 ) - ROM_REGION( 0x200000, "gfx1", 0 ) /* Sprites */ - ROM_LOAD16_BYTE( "ud2-001-005-t01.2n", 0x000000, 0x080000, CRC(77e6d249) SHA1(cdf67211cd447858293188511e826640fe24078b) ) /* 32 pin MASK rom */ - ROM_LOAD16_BYTE( "ud2-001-006-t02.3n", 0x000001, 0x080000, CRC(6e381bf2) SHA1(ba46e019d2991dec539444ef7376fe0e9a6a8b75) ) /* 32 pin MASK rom */ - ROM_LOAD16_BYTE( "ud2-001-007-t03.5n", 0x100000, 0x080000, CRC(737b4971) SHA1(2a034011b0ac03d532a89b544f4eec497ac7ee80) ) /* 32 pin MASK rom */ - ROM_LOAD16_BYTE( "ud2-001-008-t04.6n", 0x100001, 0x080000, CRC(99b9d757) SHA1(c3a763993305110ec2a0b231d75fbef4c385d21b) ) /* 32 pin MASK rom */ + ROM_REGION( 0x200000, "sprites", 0 ) + ROM_LOAD16_BYTE( "ud2-001-005-t01.2n", 0x000000, 0x080000, CRC(77e6d249) SHA1(cdf67211cd447858293188511e826640fe24078b) ) // 32 pin MASK rom + ROM_LOAD16_BYTE( "ud2-001-006-t02.3n", 0x000001, 0x080000, CRC(6e381bf2) SHA1(ba46e019d2991dec539444ef7376fe0e9a6a8b75) ) // 32 pin MASK rom + ROM_LOAD16_BYTE( "ud2-001-007-t03.5n", 0x100000, 0x080000, CRC(737b4971) SHA1(2a034011b0ac03d532a89b544f4eec497ac7ee80) ) // 32 pin MASK rom + ROM_LOAD16_BYTE( "ud2-001-008-t04.6n", 0x100001, 0x080000, CRC(99b9d757) SHA1(c3a763993305110ec2a0b231d75fbef4c385d21b) ) // 32 pin MASK rom - ROM_REGION( 0x100000, "gfx2", 0 ) /* Layer 1 */ - ROM_LOAD16_BYTE( "ud2-001-009-t05.8n", 0x000000, 0x080000, CRC(aee6c581) SHA1(5b2150a308ca12eea8148d0bbff663b3baf0c831) ) /* 32 pin MASK rom */ - ROM_LOAD16_BYTE( "ud2-001-010-t06.9n", 0x000001, 0x080000, CRC(3d399d54) SHA1(7d9036e73fbf0e9c3b976336e3e4786b17b2f4fc) ) /* 32 pin MASK rom */ + ROM_REGION( 0x100000, "tiles", 0 ) + ROM_LOAD16_BYTE( "ud2-001-009-t05.8n", 0x000000, 0x080000, CRC(aee6c581) SHA1(5b2150a308ca12eea8148d0bbff663b3baf0c831) ) // 32 pin MASK rom + ROM_LOAD16_BYTE( "ud2-001-010-t06.9n", 0x000001, 0x080000, CRC(3d399d54) SHA1(7d9036e73fbf0e9c3b976336e3e4786b17b2f4fc) ) // 32 pin MASK rom - ROM_REGION( 0x080000, "x1snd", 0 ) /* Samples */ - ROM_LOAD( "ud2-001-011-t07.14n", 0x000000, 0x080000, CRC(9c9ff69f) SHA1(3840b654f4f709bc4c03dfe4ee79369d5c70dd62) ) /* 32 pin MASK rom */ + ROM_REGION( 0x080000, "x1snd", 0 ) // Samples + ROM_LOAD( "ud2-001-011-t07.14n", 0x000000, 0x080000, CRC(9c9ff69f) SHA1(3840b654f4f709bc4c03dfe4ee79369d5c70dd62) ) // 32 pin MASK rom ROM_END ROM_START( downtownp ) - ROM_REGION( 0x0a0000, "maincpu", 0 ) /* 68000 Code */ - ROM_LOAD16_BYTE( "ud2-001-000.3c", 0x000000, 0x040000, CRC(f1965260) SHA1(c0560342238d75f9b81ae9f3408cacfbcd331529) ) /* 40 pin MASK rom */ - ROM_LOAD16_BYTE( "ud2-001-003.11c", 0x000001, 0x040000, CRC(e7d5fa5f) SHA1(48612514598711aa73bf75243c842f0aca72f3d0) ) /* 40 pin MASK rom */ - ROM_LOAD16_BYTE( "ud2_even_v061.9b", 0x080000, 0x010000, CRC(251d6552) SHA1(0f78bf142db826e956f670ba81102804e88fa2ed) ) /* handwritten label UD2 EVEN V0.61 2/13 */ - ROM_LOAD16_BYTE( "ud2_odd_v061.8b", 0x080001, 0x010000, CRC(6394a7c0) SHA1(9f5099b32b3c3e100441f6c0ccbe88c19b01a9e5) ) /* handwritten label UD2 ODD V0.61 2/13 */ - - ROM_REGION( 0x04c000, "sub", 0 ) /* 65c02 Code */ - ROM_LOAD( "ud2-002-004.17c", 0x004000, 0x040000, CRC(bbd538b1) SHA1(de4c43bfc4004a14f9f66b5e8ff192b00c45c003) ) /* 40 pin MASK rom */ + ROM_REGION( 0x0a0000, "maincpu", 0 ) // 68000 Code + ROM_LOAD16_BYTE( "ud2-001-000.3c", 0x000000, 0x040000, CRC(f1965260) SHA1(c0560342238d75f9b81ae9f3408cacfbcd331529) ) // 40 pin MASK rom + ROM_LOAD16_BYTE( "ud2-001-003.11c", 0x000001, 0x040000, CRC(e7d5fa5f) SHA1(48612514598711aa73bf75243c842f0aca72f3d0) ) // 40 pin MASK rom + ROM_LOAD16_BYTE( "ud2_even_v061.9b", 0x080000, 0x010000, CRC(251d6552) SHA1(0f78bf142db826e956f670ba81102804e88fa2ed) ) // handwritten label UD2 EVEN V0.61 2/13 + ROM_LOAD16_BYTE( "ud2_odd_v061.8b", 0x080001, 0x010000, CRC(6394a7c0) SHA1(9f5099b32b3c3e100441f6c0ccbe88c19b01a9e5) ) // handwritten label UD2 ODD V0.61 2/13 + + ROM_REGION( 0x04c000, "sub", 0 ) // 65c02 Code + ROM_LOAD( "ud2-002-004.17c", 0x004000, 0x040000, CRC(bbd538b1) SHA1(de4c43bfc4004a14f9f66b5e8ff192b00c45c003) ) // 40 pin MASK rom ROM_RELOAD( 0x00c000, 0x040000 ) - ROM_REGION( 0x200000, "gfx1", 0 ) /* Sprites */ - ROM_LOAD16_BYTE( "ud2-001-005-t01.2n", 0x000000, 0x080000, CRC(77e6d249) SHA1(cdf67211cd447858293188511e826640fe24078b) ) /* 32 pin MASK rom */ - ROM_LOAD16_BYTE( "ud2-001-006-t02.3n", 0x000001, 0x080000, CRC(6e381bf2) SHA1(ba46e019d2991dec539444ef7376fe0e9a6a8b75) ) /* 32 pin MASK rom */ - ROM_LOAD16_BYTE( "ud2-001-007-t03.5n", 0x100000, 0x080000, CRC(737b4971) SHA1(2a034011b0ac03d532a89b544f4eec497ac7ee80) ) /* 32 pin MASK rom */ - ROM_LOAD16_BYTE( "ud2-001-008-t04.6n", 0x100001, 0x080000, CRC(99b9d757) SHA1(c3a763993305110ec2a0b231d75fbef4c385d21b) ) /* 32 pin MASK rom */ + ROM_REGION( 0x200000, "sprites", 0 ) + ROM_LOAD16_BYTE( "ud2-001-005-t01.2n", 0x000000, 0x080000, CRC(77e6d249) SHA1(cdf67211cd447858293188511e826640fe24078b) ) // 32 pin MASK rom + ROM_LOAD16_BYTE( "ud2-001-006-t02.3n", 0x000001, 0x080000, CRC(6e381bf2) SHA1(ba46e019d2991dec539444ef7376fe0e9a6a8b75) ) // 32 pin MASK rom + ROM_LOAD16_BYTE( "ud2-001-007-t03.5n", 0x100000, 0x080000, CRC(737b4971) SHA1(2a034011b0ac03d532a89b544f4eec497ac7ee80) ) // 32 pin MASK rom + ROM_LOAD16_BYTE( "ud2-001-008-t04.6n", 0x100001, 0x080000, CRC(99b9d757) SHA1(c3a763993305110ec2a0b231d75fbef4c385d21b) ) // 32 pin MASK rom - ROM_REGION( 0x100000, "gfx2", 0 ) /* Layer 1 */ - ROM_LOAD16_BYTE( "ud2-001-009-t05.8n", 0x000000, 0x080000, CRC(aee6c581) SHA1(5b2150a308ca12eea8148d0bbff663b3baf0c831) ) /* 32 pin MASK rom */ - ROM_LOAD16_BYTE( "ud2-001-010-t06.9n", 0x000001, 0x080000, CRC(3d399d54) SHA1(7d9036e73fbf0e9c3b976336e3e4786b17b2f4fc) ) /* 32 pin MASK rom */ + ROM_REGION( 0x100000, "tiles", 0 ) + ROM_LOAD16_BYTE( "ud2-001-009-t05.8n", 0x000000, 0x080000, CRC(aee6c581) SHA1(5b2150a308ca12eea8148d0bbff663b3baf0c831) ) // 32 pin MASK rom + ROM_LOAD16_BYTE( "ud2-001-010-t06.9n", 0x000001, 0x080000, CRC(3d399d54) SHA1(7d9036e73fbf0e9c3b976336e3e4786b17b2f4fc) ) // 32 pin MASK rom - ROM_REGION( 0x080000, "x1snd", 0 ) /* Samples */ - ROM_LOAD( "ud2-001-011-t07.14n", 0x000000, 0x080000, CRC(9c9ff69f) SHA1(3840b654f4f709bc4c03dfe4ee79369d5c70dd62) ) /* 32 pin MASK rom */ + ROM_REGION( 0x080000, "x1snd", 0 ) // Samples + ROM_LOAD( "ud2-001-011-t07.14n", 0x000000, 0x080000, CRC(9c9ff69f) SHA1(3840b654f4f709bc4c03dfe4ee79369d5c70dd62) ) // 32 pin MASK rom ROM_END ROM_START( usclssic ) - ROM_REGION( 0x080000, "maincpu", 0 ) /* 68000 Code */ + ROM_REGION( 0x080000, "maincpu", 0 ) // 68000 Code ROM_LOAD16_BYTE( "ue2001.u20", 0x000000, 0x020000, CRC(18b41421) SHA1(74e96071d46eda152aaa82cf87d09203f225b504) ) ROM_LOAD16_BYTE( "ue2000.u14", 0x000001, 0x020000, CRC(69454bc2) SHA1(19a3b6ca65770353401544c50e04d895e391612c) ) ROM_LOAD16_BYTE( "ue2002.u22", 0x040000, 0x020000, CRC(a7bbe248) SHA1(8f7ffeffb8b6ef0e1ab5e7fbba31a1b97bbd7f8c) ) ROM_LOAD16_BYTE( "ue2003.u30", 0x040001, 0x020000, CRC(29601906) SHA1(9cdf2d80a72317a4eb7a335aaaae381822da24b1) ) - ROM_REGION( 0x04c000, "sub", 0 ) /* 65c02 Code */ + ROM_REGION( 0x04c000, "sub", 0 ) // 65c02 Code ROM_LOAD( "ue002u61.004", 0x004000, 0x040000, CRC(476e9f60) SHA1(940c09eb472652a88d5d34130270ff55a5f5ba27) ) ROM_RELOAD( 0x00c000, 0x040000 ) - ROM_REGION( 0x200000, "gfx1", 0 ) /* Sprites */ + ROM_REGION( 0x200000, "sprites", 0 ) ROM_LOAD16_BYTE( "ue001009.119", 0x000000, 0x080000, CRC(dc065204) SHA1(0478b8126cd3ce3dee64cb7de2b30b509636eb1a) ) ROM_LOAD16_BYTE( "ue001008.118", 0x000001, 0x080000, CRC(5947d9b5) SHA1(de3a63c55b558451bbbe98bf8d71561ba32c5e60) ) ROM_LOAD16_BYTE( "ue001007.117", 0x100000, 0x080000, CRC(b48a885c) SHA1(8c0d458d6967c2ff4bdcf37aaa8025341fe90bbc) ) ROM_LOAD16_BYTE( "ue001006.116", 0x100001, 0x080000, CRC(a6ab6ef4) SHA1(9f54f116d1d8e54d64ba541195baa66c5ca960bd) ) - ROM_REGION( 0x600000, "gfx2", 0 ) /* Layer 1 */ + ROM_REGION( 0x600000, "tiles", 0 ) ROM_LOAD24_BYTE( "ue001010.120", 0x000000, 0x080000, CRC(dd683031) SHA1(06ed38a243666c1acaf8eb3fdba51d18fc2a70bc) ) // planes 01 ROM_LOAD24_BYTE( "ue001011.121", 0x180000, 0x080000, CRC(0e27bc49) SHA1(f9ec4f4c15c86f608607a5ec916f5182a8e265fa) ) ROM_LOAD24_BYTE( "ue001012.122", 0x300000, 0x080000, CRC(961dfcdc) SHA1(9de95692860abd4206db22ad7ade9f02f0c03506) ) @@ -2352,95 +2382,95 @@ ROM_START( usclssic ) ROM_LOAD24_BYTE( "ue001020.130", 0x300002, 0x080000, CRC(bc07403f) SHA1(f994b6d1dee23f5dabdb328f955f4380a8ca9d52) ) ROM_LOAD24_BYTE( "ue001021.131", 0x480002, 0x080000, CRC(98c03efd) SHA1(761c51d5573e6f35c48b8b9ee5d88cbde02e92a7) ) - ROM_REGION( 0x400, "proms", 0 ) /* Extra Colours */ + ROM_REGION( 0x400, "proms", 0 ) // Extra Colours ROM_LOAD16_BYTE( "ue1-022.prm", 0x000, 0x200, CRC(1a23129e) SHA1(110eb54ab83ecb8375164a5c96f522b2737c379c) ) ROM_LOAD16_BYTE( "ue1-023.prm", 0x001, 0x200, CRC(a13192a4) SHA1(86e312e0f7400b7fa08fbe8fced1eb95a32502ca) ) - ROM_REGION( 0x080000, "x1snd", 0 ) /* Samples */ + ROM_REGION( 0x080000, "x1snd", 0 ) // Samples ROM_LOAD( "ue001005.132", 0x000000, 0x080000, CRC(c5fea37c) SHA1(af4f09dd36af06e50262f607ff14eedc33beffd2) ) ROM_END ROM_START( calibr50 ) - ROM_REGION( 0x0a0000, "maincpu", 0 ) /* 68000 Code */ + ROM_REGION( 0x0a0000, "maincpu", 0 ) // 68000 Code ROM_LOAD16_BYTE( "uh-002-001.3b", 0x000000, 0x040000, CRC(eb92e7ed) SHA1(2aee8a7bce549ef7d7b35d1c248ebbdbc906e38d) ) ROM_LOAD16_BYTE( "uh-002-004.11b", 0x000001, 0x040000, CRC(5a0ed31e) SHA1(d6ee7654354ac9f1dc7add1ef9f68a147b6f2953) ) ROM_LOAD16_BYTE( "uh_001_003.9b", 0x080000, 0x010000, CRC(0d30d09f) SHA1(8a48511b628e85b72fda0968d813f4faebd0c418) ) ROM_LOAD16_BYTE( "uh_001_002.7b", 0x080001, 0x010000, CRC(7aecc3f9) SHA1(2454d9c758fa623d4d81a9230871b67d31d16cef) ) - ROM_REGION( 0x04c000, "sub", 0 ) /* 65c02 Code */ + ROM_REGION( 0x04c000, "sub", 0 ) // 65c02 Code ROM_LOAD( "uh-001-005.17e", 0x004000, 0x040000, CRC(4a54c085) SHA1(f53ff257ce3d95f945a6befcfb61f1b570f0eafe) ) ROM_RELOAD( 0x00c000, 0x040000 ) - ROM_REGION( 0x200000, "gfx1", 0 ) /* Sprites */ + ROM_REGION( 0x200000, "sprites", 0 ) ROM_LOAD16_BYTE( "uh-001-006.2m", 0x000000, 0x080000, CRC(fff52f91) SHA1(fd7807e9a8dd5a88df1fcd13746b44a33adbc0fa) ) ROM_LOAD16_BYTE( "uh-001-007.4m", 0x000001, 0x080000, CRC(b6c19f71) SHA1(eb8bbaeaf4af07e178100ff16b228b537aa36272) ) ROM_LOAD16_BYTE( "uh-001-008.5m", 0x100000, 0x080000, CRC(7aae07ef) SHA1(1db666db20efce1efe5b5769b8e3c78bbf508466) ) ROM_LOAD16_BYTE( "uh-001-009.6m", 0x100001, 0x080000, CRC(f85da2c5) SHA1(d090e49b3a897729c7fb05f9386939448fe1d3d9) ) - ROM_REGION( 0x100000, "gfx2", 0 ) /* Layer 1 */ + ROM_REGION( 0x100000, "tiles", 0 ) ROM_LOAD16_BYTE( "uh-001-010.8m", 0x000000, 0x080000, CRC(f986577a) SHA1(8f6c2fca271fed21a1c04e93c3f50dc41348ae30) ) ROM_LOAD16_BYTE( "uh-001-011.9m", 0x000001, 0x080000, CRC(08620052) SHA1(e2ab49dbabc139e6b276401340085ccab1ae3892) ) - ROM_REGION( 0x100000, "x1snd", 0 ) /* Samples */ + ROM_REGION( 0x100000, "x1snd", 0 ) // Samples ROM_LOAD( "uh-001-013.12m", 0x000000, 0x080000, CRC(09ec0df6) SHA1(57c68d05074ea4a1e133be2ce6e25c594f04a712) ) ROM_LOAD( "uh-001-012.11m", 0x080000, 0x080000, CRC(bb996547) SHA1(0c8f570ef4454b10a023e0c463001c22a8cf99cd) ) ROM_END ROM_START( arbalest ) - ROM_REGION( 0x0a0000, "maincpu", 0 ) /* 68000 Code */ - ROM_LOAD16_BYTE( "uk-001-003", 0x000000, 0x040000, CRC(ee878a2c) SHA1(f7d5817015382ce6af317c02746b473ec798bb4f) ) /* Mask ROM on P1-037A sub PCB */ - ROM_LOAD16_BYTE( "uk-001-004", 0x000001, 0x040000, CRC(902bb4e3) SHA1(e37a361a7c03aee2d6ac8c96c2dd6c1e411b46fb) ) /* Mask ROM on P1-037A sub PCB */ + ROM_REGION( 0x0a0000, "maincpu", 0 ) // 68000 Code + ROM_LOAD16_BYTE( "uk-001-003", 0x000000, 0x040000, CRC(ee878a2c) SHA1(f7d5817015382ce6af317c02746b473ec798bb4f) ) // Mask ROM on P1-037A sub PCB + ROM_LOAD16_BYTE( "uk-001-004", 0x000001, 0x040000, CRC(902bb4e3) SHA1(e37a361a7c03aee2d6ac8c96c2dd6c1e411b46fb) ) // Mask ROM on P1-037A sub PCB - ROM_REGION( 0x010000, "sub", 0 ) /* 65c02 Code */ - /* Label is correct, 1st & 2nd halves identical is correct. Chip is a 27128 - Verified on 2 different PCBs */ - ROM_LOAD( "uk6005", 0x006000, 0x004000, CRC(48c73a4a) SHA1(1284ae7236a82a5898a57ec0451b7dcc4d409099) ) /* EPROM on P1-037A sub PCB */ + ROM_REGION( 0x010000, "sub", 0 ) // 65c02 Code + // Label is correct, 1st & 2nd halves identical is correct. Chip is a 27128 - Verified on 2 different PCBs + ROM_LOAD( "uk6005", 0x006000, 0x004000, CRC(48c73a4a) SHA1(1284ae7236a82a5898a57ec0451b7dcc4d409099) ) // EPROM on P1-037A sub PCB ROM_RELOAD( 0x00a000, 0x004000 ) ROM_RELOAD( 0x00e000, 0x002000 ) - ROM_REGION( 0x100000, "gfx1", 0 ) /* Sprites */ + ROM_REGION( 0x100000, "sprites", 0 ) ROM_LOAD16_BYTE( "uk001.06", 0x000000, 0x040000, CRC(11c75746) SHA1(7faf9a26534397d21211d5ef25ca53c4eb286474) ) ROM_LOAD16_BYTE( "uk001.07", 0x000001, 0x040000, CRC(01b166c7) SHA1(d1b5b73a55025a264a22dd950ea79ba8172c4bed) ) ROM_LOAD16_BYTE( "uk001.08", 0x080000, 0x040000, CRC(78d60ba3) SHA1(c4fa546e4ca637d67ecc1b085b91c753606ccdb3) ) ROM_LOAD16_BYTE( "uk001.09", 0x080001, 0x040000, CRC(b4748ae0) SHA1(a71e671754ed5bba737f0b5f7be510a23d5e925c) ) - ROM_REGION( 0x200000, "gfx2", 0 ) /* Layer 1 */ - ROM_LOAD16_BYTE( "uk-001-010-t26", 0x000000, 0x080000, CRC(c1e2f823) SHA1(892473351e7b590c59c578047a67fc235bd31e02) ) /* Mask ROM on P1-036A sub PCB */ - ROM_LOAD16_BYTE( "uk-001-011-t27", 0x100000, 0x080000, CRC(09dfe56a) SHA1(077627627d3cb8f79ffdd83e46157bd3c473c4a1) ) /* Mask ROM on P1-036A sub PCB */ - ROM_LOAD16_BYTE( "uk-001-012-t28", 0x000001, 0x080000, CRC(818a4085) SHA1(fd8b5658fc7f5fa6d3daebb4be17aeabd60c9028) ) /* Mask ROM on P1-036A sub PCB */ - ROM_LOAD16_BYTE( "uk-001-013-t29", 0x100001, 0x080000, CRC(771fa164) SHA1(a91214318808f991846a828f0e309c0ff430245e) ) /* Mask ROM on P1-036A sub PCB */ + ROM_REGION( 0x200000, "tiles", 0 ) + ROM_LOAD16_BYTE( "uk-001-010-t26", 0x000000, 0x080000, CRC(c1e2f823) SHA1(892473351e7b590c59c578047a67fc235bd31e02) ) // Mask ROM on P1-036A sub PCB + ROM_LOAD16_BYTE( "uk-001-011-t27", 0x100000, 0x080000, CRC(09dfe56a) SHA1(077627627d3cb8f79ffdd83e46157bd3c473c4a1) ) // Mask ROM on P1-036A sub PCB + ROM_LOAD16_BYTE( "uk-001-012-t28", 0x000001, 0x080000, CRC(818a4085) SHA1(fd8b5658fc7f5fa6d3daebb4be17aeabd60c9028) ) // Mask ROM on P1-036A sub PCB + ROM_LOAD16_BYTE( "uk-001-013-t29", 0x100001, 0x080000, CRC(771fa164) SHA1(a91214318808f991846a828f0e309c0ff430245e) ) // Mask ROM on P1-036A sub PCB - ROM_REGION( 0x100000, "x1snd", 0 ) /* Samples */ - ROM_LOAD( "uk-001-015-t31", 0x000000, 0x080000, CRC(ce9df5dd) SHA1(91d879b774b5b367adb5bd511fda827bc0bae0a9) ) /* Mask ROM on P1-036A sub PCB */ - ROM_LOAD( "uk-001-014-t30", 0x080000, 0x080000, CRC(016b844a) SHA1(1fe091233746ced358292014393896af730f5940) ) /* Mask ROM on P1-036A sub PCB */ + ROM_REGION( 0x100000, "x1snd", 0 ) // Samples + ROM_LOAD( "uk-001-015-t31", 0x000000, 0x080000, CRC(ce9df5dd) SHA1(91d879b774b5b367adb5bd511fda827bc0bae0a9) ) // Mask ROM on P1-036A sub PCB + ROM_LOAD( "uk-001-014-t30", 0x080000, 0x080000, CRC(016b844a) SHA1(1fe091233746ced358292014393896af730f5940) ) // Mask ROM on P1-036A sub PCB ROM_END ROM_START( metafox ) - ROM_REGION( 0x0a0000, "maincpu", 0 ) /* 68000 Code */ + ROM_REGION( 0x0a0000, "maincpu", 0 ) // 68000 Code ROM_LOAD16_BYTE( "p1003161", 0x000000, 0x040000, CRC(4fd6e6a1) SHA1(11a830d76ef737bcfac73d0958425fe4329f0dcd) ) ROM_LOAD16_BYTE( "p1004162", 0x000001, 0x040000, CRC(b6356c9a) SHA1(182a1ea9f0643b05b14ad2a2cd820f5ca2086c4c) ) ROM_LOAD16_BYTE( "up001002", 0x080000, 0x010000, CRC(ce91c987) SHA1(63546fa1342371a7080ac3cf59b41a01ac313c8c) ) ROM_LOAD16_BYTE( "up001001", 0x080001, 0x010000, CRC(0db7a505) SHA1(d593da2f7d8b54724cae017cbabc3c0909893da1) ) - ROM_REGION( 0x010000, "sub", 0 ) /* 65c02 Code */ + ROM_REGION( 0x010000, "sub", 0 ) // 65c02 Code ROM_LOAD( "up001005", 0x006000, 0x002000, CRC(2ac5e3e3) SHA1(b794554cd25bdd48a21a0a2861daf8369e798ce8) ) ROM_RELOAD( 0x008000, 0x002000 ) ROM_RELOAD( 0x00a000, 0x002000 ) ROM_RELOAD( 0x00c000, 0x002000 ) ROM_RELOAD( 0x00e000, 0x002000 ) - ROM_REGION( 0x100000, "gfx1", 0 ) /* Sprites */ + ROM_REGION( 0x100000, "sprites", 0 ) ROM_LOAD16_BYTE( "p1006163", 0x000000, 0x040000, CRC(80f69c7c) SHA1(df323e801ebec6316ba17fe0371f7c87fad19295) ) ROM_LOAD16_BYTE( "p1007164", 0x000001, 0x040000, CRC(d137e1a3) SHA1(0e0234f1d0adb7db6d0508263e3b0b31fe7071b9) ) ROM_LOAD16_BYTE( "p1008165", 0x080000, 0x040000, CRC(57494f2b) SHA1(28d620254e81d7e63dfed07b29b252b975a81248) ) ROM_LOAD16_BYTE( "p1009166", 0x080001, 0x040000, CRC(8344afd2) SHA1(7348b423405ad00b9240d152b119cf5341754815) ) - ROM_REGION( 0x200000, "gfx2", 0 ) /* Layer 1 */ + ROM_REGION( 0x200000, "tiles", 0 ) ROM_LOAD16_BYTE( "up001010", 0x000000, 0x080000, CRC(bfbab472) SHA1(d3e7b20d14de48134c4fbe3da31feb928c1c655b) ) ROM_LOAD16_BYTE( "up001011", 0x100000, 0x080000, CRC(26cea381) SHA1(b4bfd2a13ef6051376fe3ed57e2331a072970f86) ) ROM_LOAD16_BYTE( "up001012", 0x000001, 0x080000, CRC(fed2c5f9) SHA1(81f0f19a500b665c937f5431000ebde7abd97c30) ) ROM_LOAD16_BYTE( "up001013", 0x100001, 0x080000, CRC(adabf9ea) SHA1(db28e4e565e567a97a6b05a4803a55a403e24a0e) ) - ROM_REGION( 0x100000, "x1snd", 0 ) /* Samples */ + ROM_REGION( 0x100000, "x1snd", 0 ) // Samples ROM_LOAD( "up001015", 0x000000, 0x080000, CRC(2e20e39f) SHA1(6f8bd4a76ed5c2150015698e7a98044d060157be) ) ROM_LOAD( "up001014", 0x080000, 0x080000, CRC(fca6315e) SHA1(cef2385ec43f8b7a2d655b42c18ef44e46ff7364) ) ROM_END @@ -2475,7 +2505,7 @@ u16 downtown_state::twineagl_debug_r() return 0; } -void downtown_state::machine_start() +void tndrcade_state::machine_start() { u8 *rom = memregion("sub")->base(); const u32 max = (memregion("sub")->bytes() - 0xc000) / 0x4000; @@ -2490,17 +2520,18 @@ void downtown_state::machine_start() m_subbank->configure_entries(0, 16, &rom[0xc000], 0); // Not bankswitched : for avoid crashing when accessing bank functions } -/* Extra RAM ? Check code at 0x00ba90 */ -/* 2000F8 = A3 enables it, 2000F8 = 00 disables? see downtown too */ +// Extra RAM ? Check code at 0x00ba90 +// 2000F8 = A3 enables it, 2000F8 = 00 disables? see downtown too u16 downtown_state::twineagl_200100_r(offs_t offset) { // protection check at boot - logerror("%04x: twineagl_200100_r %d\n",m_maincpu->pc(), offset); + if (!machine().side_effects_disabled()) + LOGPROT("%04x: twineagl_200100_r %d\n",m_maincpu->pc(), offset); return m_twineagl_xram[offset]; } void downtown_state::twineagl_200100_w(offs_t offset, u16 data, u16 mem_mask) { - logerror("%04x: twineagl_200100_w %d = %02x\n",m_maincpu->pc(), offset,data); + LOGPROT("%04x: twineagl_200100_w %d = %02x\n",m_maincpu->pc(), offset,data); if (ACCESSING_BITS_0_7) { @@ -2510,16 +2541,16 @@ void downtown_state::twineagl_200100_w(offs_t offset, u16 data, u16 mem_mask) void downtown_state::init_twineagl() { - /* debug? */ + // debug? m_maincpu->space(AS_PROGRAM).install_read_handler(0x800000, 0x8000ff, read16smo_delegate(*this, FUNC(downtown_state::twineagl_debug_r))); - /* This allows 2 simultaneous players and the use of the "Copyright" Dip Switch. */ + // This allows 2 simultaneous players and the use of the "Copyright" Dip Switch. m_maincpu->space(AS_PROGRAM).install_read_handler(0x200100, 0x20010f, read16sm_delegate(*this, FUNC(downtown_state::twineagl_200100_r))); m_maincpu->space(AS_PROGRAM).install_write_handler(0x200100, 0x20010f, write16s_delegate(*this, FUNC(downtown_state::twineagl_200100_w))); } -/* Protection? NVRAM is handled writing commands here */ +// Protection? NVRAM is handled writing commands here u16 downtown_state::downtown_protection_r(offs_t offset) { const int job = m_downtown_protection[0xf8/2] & 0xff; @@ -2552,7 +2583,7 @@ void downtown_state::init_downtown() // initializing with 0xff is enough for host CPU to catch up and default it with sensible defaults. for (int i = 0; i < 0x100; i++) m_downtown_protection[i] = 0xff; - save_pointer(NAME(m_downtown_protection), 0x200/2); + save_pointer(NAME(m_downtown_protection), 0x100); m_maincpu->space(AS_PROGRAM).install_read_handler(0x200000, 0x2001ff, read16sm_delegate(*this, FUNC(downtown_state::downtown_protection_r))); m_maincpu->space(AS_PROGRAM).install_write_handler(0x200000, 0x2001ff, write16s_delegate(*this, FUNC(downtown_state::downtown_protection_w))); @@ -2617,8 +2648,8 @@ void downtown_state::init_metafox() ***************************************************************************/ -GAME( 1987, tndrcade, 0, tndrcade, tndrcade, downtown_state, empty_init, ROT270, "Seta (Taito license)", "Thundercade / Twin Formation" , 0) // Title/License: DSW -GAME( 1987, tndrcadej, tndrcade, tndrcade, tndrcadj, downtown_state, empty_init, ROT270, "Seta (Taito license)", "Tokusyu Butai U.A.G. (Japan)" , 0) // License: DSW +GAME( 1987, tndrcade, 0, tndrcade, tndrcade, tndrcade_state, empty_init, ROT270, "Seta (Taito license)", "Thundercade / Twin Formation" , 0) // Title/License: DSW +GAME( 1987, tndrcadej, tndrcade, tndrcade, tndrcadj, tndrcade_state, empty_init, ROT270, "Seta (Taito license)", "Tokusyu Butai U.A.G. (Japan)" , 0) // License: DSW GAME( 1988, twineagl, 0, twineagl, twineagl, downtown_state, init_twineagl, ROT270, "Seta (Taito license)", "Twin Eagle - Revenge Joe's Brother" , 0) // Country/License: DSW From c83f2549bb26e9ddc508ae3538ffa5cdd968ddd7 Mon Sep 17 00:00:00 2001 From: cam900 Date: Mon, 13 May 2024 02:09:55 +0900 Subject: [PATCH 04/16] misc/micro3d.cpp: Cleanups: (#12335) - Use C++ style comments for single line comments - Use reference instead pointers - Add missing items into save state - Reduce unnecessary lines - Fix variable and function namings - Suppress side effects for debugger reads - Use array for noise generator - Constantize variables - Reduce preprocessor defines --- src/mame/misc/micro3d.cpp | 106 +++++++++++------------ src/mame/misc/micro3d.h | 68 ++++++++------- src/mame/misc/micro3d_a.cpp | 106 ++++++++++++----------- src/mame/misc/micro3d_a.h | 4 +- src/mame/misc/micro3d_m.cpp | 115 +++++++++++++------------ src/mame/misc/micro3d_v.cpp | 164 +++++++++++++++++++----------------- 6 files changed, 292 insertions(+), 271 deletions(-) diff --git a/src/mame/misc/micro3d.cpp b/src/mame/misc/micro3d.cpp index f7542bf01b6..2238f0eaac1 100644 --- a/src/mame/misc/micro3d.cpp +++ b/src/mame/misc/micro3d.cpp @@ -208,18 +208,18 @@ void micro3d_state::hostmem(address_map &map) { map(0x000000, 0x143fff).rom(); map(0x200000, 0x20ffff).ram().share("nvram"); - map(0x800000, 0x83ffff).ram().share("shared_ram"); + map(0x800000, 0x83ffff).ram().share(m_shared_ram); map(0x900000, 0x900001).w(FUNC(micro3d_state::host_drmath_int_w)); map(0x920000, 0x920001).portr("INPUTS_C_D"); map(0x940000, 0x940001).portr("INPUTS_A_B"); - map(0x960000, 0x960001).w(FUNC(micro3d_state::micro3d_reset_w)); + map(0x960000, 0x960001).w(FUNC(micro3d_state::reset_w)); map(0x980001, 0x980001).rw("adc", FUNC(adc0844_device::read), FUNC(adc0844_device::write)); map(0x9a0000, 0x9a0007).rw(m_vgb, FUNC(tms34010_device::host_r), FUNC(tms34010_device::host_w)); - map(0x9c0000, 0x9c0001).noprw(); /* Lamps */ + map(0x9c0000, 0x9c0001).noprw(); // Lamps map(0x9e0000, 0x9e002f).rw("mfp", FUNC(mc68901_device::read), FUNC(mc68901_device::write)).umask16(0xff00); map(0xa00000, 0xa0003f).rw(m_duart, FUNC(mc68681_device::read), FUNC(mc68681_device::write)).umask16(0xff00); - map(0xa20000, 0xa20001).r(FUNC(micro3d_state::micro3d_encoder_h_r)); - map(0xa40002, 0xa40003).r(FUNC(micro3d_state::micro3d_encoder_l_r)); + map(0xa20000, 0xa20001).r(FUNC(micro3d_state::encoder_h_r)); + map(0xa40002, 0xa40003).r(FUNC(micro3d_state::encoder_l_r)); } @@ -231,12 +231,12 @@ void micro3d_state::hostmem(address_map &map) void micro3d_state::vgbmem(address_map &map) { - map(0x00000000, 0x007fffff).ram().share("sprite_vram"); + map(0x00000000, 0x007fffff).ram().share(m_sprite_vram); map(0x00800000, 0x00bfffff).ram(); map(0x00c00000, 0x00c0000f).portr("VGB_SW"); - map(0x00e00000, 0x00e0000f).w(FUNC(micro3d_state::micro3d_xfer3dk_w)); + map(0x00e00000, 0x00e0000f).w(FUNC(micro3d_state::xfer3dk_w)); map(0x02000000, 0x0200ffff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); // clut - map(0x02600000, 0x0260000f).w(FUNC(micro3d_state::micro3d_creg_w)); + map(0x02600000, 0x0260000f).w(FUNC(micro3d_state::creg_w)); map(0x02c00000, 0x02c0003f).r(FUNC(micro3d_state::vgb_uart_r)).umask16(0x00ff); map(0x02e00000, 0x02e0003f).w(FUNC(micro3d_state::vgb_uart_w)).umask16(0x00ff); map(0x03800000, 0x03dfffff).rom().region("tms_gfx", 0); @@ -259,16 +259,16 @@ void micro3d_state::drmath_prg(address_map &map) void micro3d_state::drmath_data(address_map &map) { map(0x00000000, 0x000fffff).rom().region("drmath", 0); - map(0x00800000, 0x0083ffff).rw(FUNC(micro3d_state::micro3d_shared_r), FUNC(micro3d_state::micro3d_shared_w)); map(0x00400000, 0x004fffff).ram(); map(0x00500000, 0x005fffff).ram(); + map(0x00800000, 0x0083ffff).rw(FUNC(micro3d_state::shared_r), FUNC(micro3d_state::shared_w)); map(0x00a00000, 0x00a00003).w(FUNC(micro3d_state::drmath_int_w)); - map(0x01000000, 0x01000003).w(FUNC(micro3d_state::micro3d_mac1_w)); - map(0x01000004, 0x01000007).rw(FUNC(micro3d_state::micro3d_mac2_r), FUNC(micro3d_state::micro3d_mac2_w)); - map(0x01200000, 0x01203fff).ram().share("mac_sram"); - map(0x01400000, 0x01400003).rw(FUNC(micro3d_state::micro3d_pipe_r), FUNC(micro3d_state::micro3d_fifo_w)); + map(0x01000000, 0x01000003).w(FUNC(micro3d_state::mac1_w)); + map(0x01000004, 0x01000007).rw(FUNC(micro3d_state::mac2_r), FUNC(micro3d_state::mac2_w)); + map(0x01200000, 0x01203fff).ram().share(m_mac_sram); + map(0x01400000, 0x01400003).rw(FUNC(micro3d_state::pipe_r), FUNC(micro3d_state::fifo_w)); map(0x01600000, 0x01600003).w(FUNC(micro3d_state::drmath_intr2_ack)); - map(0x01800000, 0x01800003).w(FUNC(micro3d_state::micro3d_alt_fifo_w)); + map(0x01800000, 0x01800003).w(FUNC(micro3d_state::alt_fifo_w)); map(0x03fffff0, 0x03ffffff).rw("scc", FUNC(z80scc_device::ab_dc_r), FUNC(z80scc_device::ab_dc_w)).umask32(0x000000ff); } @@ -287,9 +287,9 @@ void micro3d_state::soundmem_io(address_map &map) { map(0x0000, 0x07ff).ram(); map(0xfd00, 0xfd01).rw("ym2151", FUNC(ym2151_device::read), FUNC(ym2151_device::write)); - map(0xfe00, 0xfe00).w(FUNC(micro3d_state::micro3d_upd7759_w)); - map(0xff00, 0xff00).w(FUNC(micro3d_state::micro3d_snd_dac_a)); - map(0xff01, 0xff01).w(FUNC(micro3d_state::micro3d_snd_dac_b)); + map(0xfe00, 0xfe00).w(FUNC(micro3d_state::upd7759_w)); + map(0xff00, 0xff00).w(FUNC(micro3d_state::snd_dac_a)); + map(0xff01, 0xff01).w(FUNC(micro3d_state::snd_dac_b)); } void micro3d_state::cpu_space_map(address_map &map) @@ -309,7 +309,7 @@ void micro3d_state::micro3d(machine_config &config) { M68000(config, m_maincpu, 32_MHz_XTAL / 2); m_maincpu->set_addrmap(AS_PROGRAM, µ3d_state::hostmem); - m_maincpu->set_vblank_int("screen", FUNC(micro3d_state::micro3d_vblank)); + m_maincpu->set_vblank_int("screen", FUNC(micro3d_state::vblank)); m_maincpu->set_addrmap(m68000_base_device::AS_CPU_SPACE, µ3d_state::cpu_space_map); TMS34010(config, m_vgb, 40_MHz_XTAL); @@ -331,10 +331,10 @@ void micro3d_state::micro3d(machine_config &config) I8051(config, m_audiocpu, 11.0592_MHz_XTAL); m_audiocpu->set_addrmap(AS_PROGRAM, µ3d_state::soundmem_prg); m_audiocpu->set_addrmap(AS_IO, µ3d_state::soundmem_io); - m_audiocpu->port_in_cb<1>().set(FUNC(micro3d_state::micro3d_sound_p1_r)); - m_audiocpu->port_out_cb<1>().set(FUNC(micro3d_state::micro3d_sound_p1_w)); - m_audiocpu->port_in_cb<3>().set(FUNC(micro3d_state::micro3d_sound_p3_r)); - m_audiocpu->port_out_cb<3>().set(FUNC(micro3d_state::micro3d_sound_p3_w)); + m_audiocpu->port_in_cb<1>().set(FUNC(micro3d_state::sound_p1_r)); + m_audiocpu->port_out_cb<1>().set(FUNC(micro3d_state::sound_p1_w)); + m_audiocpu->port_in_cb<3>().set(FUNC(micro3d_state::sound_p3_r)); + m_audiocpu->port_out_cb<3>().set(FUNC(micro3d_state::sound_p3_w)); MC68681(config, m_duart, 3.6864_MHz_XTAL); m_duart->irq_cb().set(FUNC(micro3d_state::duart_irq_handler)); @@ -390,13 +390,13 @@ void micro3d_state::micro3d(machine_config &config) ym2151.add_route(0, "lspeaker", 0.35); ym2151.add_route(1, "rspeaker", 0.35); - MICRO3D_SOUND(config, m_noise_1); - m_noise_1->add_route(0, "lspeaker", 1.0); - m_noise_1->add_route(1, "rspeaker", 1.0); + MICRO3D_SOUND(config, m_noise[0]); + m_noise[0]->add_route(0, "lspeaker", 1.0); + m_noise[0]->add_route(1, "rspeaker", 1.0); - MICRO3D_SOUND(config, m_noise_2); - m_noise_2->add_route(0, "lspeaker", 1.0); - m_noise_2->add_route(1, "rspeaker", 1.0); + MICRO3D_SOUND(config, m_noise[1]); + m_noise[1]->add_route(0, "lspeaker", 1.0); + m_noise[1]->add_route(1, "rspeaker", 1.0); } void micro3d_state::botss11(machine_config &config) @@ -413,7 +413,7 @@ void micro3d_state::botss11(machine_config &config) *************************************/ ROM_START( f15se ) - /* Host PCB (MPG DW-00011C-0011-01) */ + // Host PCB (MPG DW-00011C-0011-01) ROM_REGION( 0x180000, "maincpu", 0 ) ROM_LOAD16_BYTE( "110-00001-600.u67", 0x000001, 0x20000, CRC(da507ec7) SHA1(24fb80aa7157a97b53a6efa8f2477aacd0cd621f) ) ROM_LOAD16_BYTE( "110-00001-601.u91", 0x000000, 0x20000, CRC(f47648c6) SHA1(a5eac6fcde52ebf750cfcdcf151fcbd859146296) ) @@ -427,7 +427,7 @@ ROM_START( f15se ) ROM_LOAD16_BYTE( "110-00001-009.u95", 0x100000, 0x20000, CRC(33e3b473) SHA1(66deda79ba94f0ed722b399b3fc6062dcdd1a6c9) ) ROM_FILL( 0x140000, 0x40000, 0xff ) - /* Dr Math PCB (MPG 010-00002-001) */ + // Dr Math PCB (MPG 010-00002-001) ROM_REGION32_BE( 0x100000, "drmath", 0 ) ROM_LOAD64_BYTE( "110-00001-222.u134", 0x00000, 0x08000, CRC(1aa391a4) SHA1(8bf80c0d0d9a85cbec9d8e18f6b5fc83989c86ce) ) ROM_LOAD64_BYTE( "110-00001-225.u126", 0x00001, 0x08000, CRC(bf6eb5a1) SHA1(94320581917ce36ae50ea0ecb53af9e12999e2b1) ) @@ -444,7 +444,7 @@ ROM_START( f15se ) ROM_LOAD16_BYTE( "110-00001-016.u167", 0x40001, 0x20000, CRC(5db4f677) SHA1(25a6fe4c562e4fa4225aa4687dd41920b614e591) ) ROM_LOAD16_BYTE( "110-00001-017.u160", 0x40000, 0x20000, CRC(47f9a868) SHA1(7c8a9355893e4a3f3846fd05e0237ffd1404ffee) ) - /* Video Graphics PCB (MPG DW-010-00003-001) */ + // Video Graphics PCB (MPG DW-010-00003-001) ROM_REGION16_LE( 0x40000, "tms34010", 0 ) ROM_LOAD16_BYTE( "110-00002-101.u101", 0x00000, 0x20000, CRC(e99fac71) SHA1(98d1d2134fabc1bad637cbe42cbe9cdc20b32126) ) ROM_LOAD16_BYTE( "110-00002-104.u97", 0x00001, 0x20000, CRC(78b9b7c7) SHA1(4bce993dd3aea126e3a9d42ee8c68b8ab47fdba7) ) @@ -457,7 +457,7 @@ ROM_START( f15se ) ROM_LOAD16_BYTE( "110-00002-103.u114", 0x80000, 0x20000, CRC(4d8e8f54) SHA1(d8a23b5fd00ab919dc6d63fc72824d1293073813) ) ROM_LOAD16_BYTE( "110-00002-102.u108", 0x80001, 0x20000, CRC(f6488e31) SHA1(d2f9304cc59f5523007592ae76ddd56107cc29e8) ) - /* Sound PCB (MPG 010-00018-002) */ + // Sound PCB (MPG 010-00018-002) ROM_REGION( 0x08000, "audiocpu", 0 ) ROM_LOAD( "110-00004-001.u2", 0x000000, 0x08000, CRC(705685a9) SHA1(311f7cac126a19e8bd555ebf31ff4ec4680ddfa4) ) @@ -466,7 +466,7 @@ ROM_START( f15se ) ROM_END ROM_START( f15se22 ) - /* Host PCB (MPG DW-00011C-0011-01) */ + // Host PCB (MPG DW-00011C-0011-01) ROM_REGION( 0x180000, "maincpu", 0 ) ROM_LOAD16_BYTE( "host.u67", 0x000001, 0x20000, CRC(8f495ceb) SHA1(90998ad67e76928ed1a6cae56038b98d1aa2e7b0) ) ROM_LOAD16_BYTE( "host.u91", 0x000000, 0x20000, CRC(dfae5ec3) SHA1(29306eed5047e39a0a2350e61ab7126a84cb710b) ) @@ -480,7 +480,7 @@ ROM_START( f15se22 ) ROM_LOAD16_BYTE( "110-00001-009.u95", 0x100000, 0x20000, CRC(33e3b473) SHA1(66deda79ba94f0ed722b399b3fc6062dcdd1a6c9) ) ROM_FILL( 0x140000, 0x40000, 0xff ) - /* Dr Math PCB (MPG 010-00002-001) */ + // Dr Math PCB (MPG 010-00002-001) ROM_REGION32_BE( 0x100000, "drmath", 0 ) ROM_LOAD64_BYTE( "122.dth", 0x00000, 0x08000, CRC(9d2032cf) SHA1(8430816756ea92bbe86b94eaa24a6071bf0ef879) ) ROM_LOAD64_BYTE( "125.dth", 0x00001, 0x08000, CRC(7718487c) SHA1(609106f55601f84095b64ce2484107779da89149) ) @@ -497,7 +497,7 @@ ROM_START( f15se22 ) ROM_LOAD16_BYTE( "110-00001-016.u167", 0x40001, 0x20000, CRC(5db4f677) SHA1(25a6fe4c562e4fa4225aa4687dd41920b614e591) ) ROM_LOAD16_BYTE( "110-00001-017.u160", 0x40000, 0x20000, CRC(47f9a868) SHA1(7c8a9355893e4a3f3846fd05e0237ffd1404ffee) ) - /* Video Graphics PCB (MPG DW-010-00003-001) */ + // Video Graphics PCB (MPG DW-010-00003-001) ROM_REGION16_LE( 0x40000, "tms34010", 0 ) ROM_LOAD16_BYTE( "110-00002-101.u101", 0x00000, 0x20000, CRC(e99fac71) SHA1(98d1d2134fabc1bad637cbe42cbe9cdc20b32126) ) ROM_LOAD16_BYTE( "110-00002-104.u97", 0x00001, 0x20000, CRC(78b9b7c7) SHA1(4bce993dd3aea126e3a9d42ee8c68b8ab47fdba7) ) @@ -510,7 +510,7 @@ ROM_START( f15se22 ) ROM_LOAD16_BYTE( "110-00002-103.u114", 0x80000, 0x20000, CRC(4d8e8f54) SHA1(d8a23b5fd00ab919dc6d63fc72824d1293073813) ) ROM_LOAD16_BYTE( "110-00002-102.u108", 0x80001, 0x20000, CRC(f6488e31) SHA1(d2f9304cc59f5523007592ae76ddd56107cc29e8) ) - /* Sound PCB (MPG 010-00018-002) */ + // Sound PCB (MPG 010-00018-002) ROM_REGION( 0x08000, "audiocpu", 0 ) ROM_LOAD( "110-00004-001.u2", 0x000000, 0x08000, CRC(705685a9) SHA1(311f7cac126a19e8bd555ebf31ff4ec4680ddfa4) ) @@ -519,7 +519,7 @@ ROM_START( f15se22 ) ROM_END ROM_START( f15se21 ) - /* Host PCB (MPG DW-00011C-0011-01) */ + // Host PCB (MPG DW-00011C-0011-01) ROM_REGION( 0x180000, "maincpu", 0 ) ROM_LOAD16_BYTE( "110-00001-500.u67", 0x000001, 0x20000, CRC(6c26806d) SHA1(7cfd2b3b92b0fc6627c92a2013a317ca5abc66a0) ) ROM_LOAD16_BYTE( "110-00001-501.u91", 0x000000, 0x20000, CRC(81f02bf7) SHA1(09976746fe4d9c88bd8840f6e7addb09226aa54b) ) @@ -533,7 +533,7 @@ ROM_START( f15se21 ) ROM_LOAD16_BYTE( "110-00001-009.u95", 0x100000, 0x20000, CRC(33e3b473) SHA1(66deda79ba94f0ed722b399b3fc6062dcdd1a6c9) ) ROM_FILL( 0x140000, 0x40000, 0xff ) - /* Video Graphics PCB (MPG DW-010-00003-001) */ + // Video Graphics PCB (MPG DW-010-00003-001) ROM_REGION16_LE( 0x40000, "tms34010", 0 ) ROM_LOAD16_BYTE( "001.vgb", 0x000000, 0x20000, CRC(810c142d) SHA1(d37e5ecd716dda65d43cec7bca524c59d3dc9803) ) ROM_LOAD16_BYTE( "004.vgb", 0x000001, 0x20000, CRC(b69e1260) SHA1(1a2b69ea7c96b0293b24d87ea46bd4b1d4c56a66) ) @@ -546,7 +546,7 @@ ROM_START( f15se21 ) ROM_LOAD16_BYTE( "110-00002-103.u114", 0x80000, 0x20000, CRC(4d8e8f54) SHA1(d8a23b5fd00ab919dc6d63fc72824d1293073813) ) ROM_LOAD16_BYTE( "110-00002-102.u108", 0x80001, 0x20000, CRC(f6488e31) SHA1(d2f9304cc59f5523007592ae76ddd56107cc29e8) ) - /* Dr Math PCB (MPG 010-00002-001) */ + // Dr Math PCB (MPG 010-00002-001) ROM_REGION32_BE( 0x100000, "drmath", 0 ) ROM_LOAD64_BYTE( "122.dth", 0x00000, 0x08000, CRC(9d2032cf) SHA1(8430816756ea92bbe86b94eaa24a6071bf0ef879) ) ROM_LOAD64_BYTE( "125.dth", 0x00001, 0x08000, CRC(7718487c) SHA1(609106f55601f84095b64ce2484107779da89149) ) @@ -563,7 +563,7 @@ ROM_START( f15se21 ) ROM_LOAD16_BYTE( "110-00001-016.u167", 0x40001, 0x20000, CRC(5db4f677) SHA1(25a6fe4c562e4fa4225aa4687dd41920b614e591) ) ROM_LOAD16_BYTE( "110-00001-017.u160", 0x40000, 0x20000, CRC(47f9a868) SHA1(7c8a9355893e4a3f3846fd05e0237ffd1404ffee) ) - /* Sound PCB (MPG 010-00018-002) */ + // Sound PCB (MPG 010-00018-002) ROM_REGION( 0x08000, "audiocpu", 0 ) ROM_LOAD( "110-00004-001.u2", 0x000000, 0x08000, CRC(705685a9) SHA1(311f7cac126a19e8bd555ebf31ff4ec4680ddfa4) ) @@ -572,7 +572,7 @@ ROM_START( f15se21 ) ROM_END ROM_START( botss ) - /* Host PCB (MPG DW-00011C-0011-01) */ + // Host PCB (MPG DW-00011C-0011-01) ROM_REGION( 0x180000, "maincpu", 0 ) ROM_LOAD16_BYTE( "110-00153-100.u67", 0x000001, 0x20000, CRC(338aa9c3) SHA1(3d10329a5df80ab1761fd3953eb3872a72f26bef) ) ROM_LOAD16_BYTE( "110-00153-101.u91", 0x000000, 0x20000, CRC(3278279e) SHA1(570935988c776283cdcd5aa13d71a75f0a466099) ) @@ -586,7 +586,7 @@ ROM_START( botss ) ROM_LOAD16_BYTE( "110-00013-009.u95", 0x100000, 0x20000, CRC(6c595d1e) SHA1(89fdc30166ba1e9706798547195bdf6875a02e96) ) ROM_FILL( 0x140000, 0x40000, 0xff ) - /* Dr Math PCB (MPG 010-00002-001) */ + // Dr Math PCB (MPG 010-00002-001) ROM_REGION32_BE( 0x100000, "drmath", 0 ) ROM_LOAD64_BYTE( "110-00013-122.u134", 0x000000, 0x08000, CRC(bf60c487) SHA1(5ce80e89d9a24b627b0e97bf36a4e71c2eff4324) ) ROM_LOAD64_BYTE( "110-00013-125.u126", 0x000001, 0x08000, CRC(b0dccf4a) SHA1(e8bfd622c006985b724cdbd3ad14c33e9ed27c6c) ) @@ -607,7 +607,7 @@ ROM_START( botss ) ROM_LOAD16_BYTE( "110-00023-201.u101", 0x000000, 0x20000, CRC(7dc05f7d) SHA1(4d202b229cf4690d92491311e9ff14034b19c35c) ) ROM_LOAD16_BYTE( "110-00023-204.u97", 0x000001, 0x20000, CRC(925fd08a) SHA1(fb06413debbffcd63b018f374f25b0d8e419c739) ) - /* Video Graphics PCB (MPG DW-010-00002-002) */ + // Video Graphics PCB (MPG DW-010-00002-002) ROM_REGION16_LE( 0xc0000, "tms_gfx", 0 ) ROM_LOAD16_BYTE( "110-00023-205.u124", 0x000000, 0x20000, CRC(5482e0c4) SHA1(492afac1862f2899cd734d1e57ca978ed6a906d5) ) ROM_LOAD16_BYTE( "110-00023-206.u121", 0x000001, 0x20000, CRC(a55e5d19) SHA1(86fbcb425103ae9fff381357339af349848fc3f2) ) @@ -616,7 +616,7 @@ ROM_START( botss ) ROM_LOAD16_BYTE( "110-00023-203.u114", 0x080000, 0x20000, CRC(b1dacbb1) SHA1(323531b6919eed4a963d6aad871f1fd34203e698) ) ROM_LOAD16_BYTE( "110-00023-202.u108", 0x080001, 0x20000, CRC(ac0d3179) SHA1(f4c67d59d913ead0f8a6d42e2ca66857ebf01602) ) - /* Sound PCB (MPG 010-00018-002) */ + // Sound PCB (MPG 010-00018-002) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "110-00014-001.u2", 0x000000, 0x08000, CRC(307fcb6d) SHA1(0cf63a39ac8920be6532974311804529d7218545) ) @@ -624,16 +624,16 @@ ROM_START( botss ) ROM_LOAD( "110-00013-001.u17", 0x000000, 0x40000, CRC(015a0b17) SHA1(f229c9aa59f0e6b25b818f9513997a8685e33982) ) ROM_REGION( 0x10000, "plds", 0 ) - /* Host */ - ROM_LOAD( "120-00001-306.u77", 0x000000, 0x00310, CRC(60282a45) SHA1(8621b64fa00fa556c09d7d1566480cd442a8e655) ) /* AmPAL23S8-20 */ + // Host + ROM_LOAD( "120-00001-306.u77", 0x000000, 0x00310, CRC(60282a45) SHA1(8621b64fa00fa556c09d7d1566480cd442a8e655) ) // AmPAL23S8-20 - /* Dr. Math */ - ROM_LOAD( "mac1_u173_a.bin", 0x000000, 0x014c7, CRC(78040232) SHA1(c9adc1db76b4ee5ee08f4a11caae77993b23cc30) ) /* EPS448 */ - ROM_LOAD( "mac2_u166_a.bin", 0x000000, 0x014c7, CRC(c85c4c66) SHA1(fab07ad0611de7d2c2af9b6fa262d574e238bd9f) ) /* EPS448 */ + // Dr. Math + ROM_LOAD( "mac1_u173_a.bin", 0x000000, 0x014c7, CRC(78040232) SHA1(c9adc1db76b4ee5ee08f4a11caae77993b23cc30) ) // EPS448 + ROM_LOAD( "mac2_u166_a.bin", 0x000000, 0x014c7, CRC(c85c4c66) SHA1(fab07ad0611de7d2c2af9b6fa262d574e238bd9f) ) // EPS448 ROM_END ROM_START( botss11 ) - /* Host PCB (MPG DW-00011C-0011-02) */ + // Host PCB (MPG DW-00011C-0011-02) ROM_REGION( 0x180000, "maincpu", 0 ) ROM_LOAD16_BYTE( "110-00013-300.u67", 0x000001, 0x20000, CRC(7f74362a) SHA1(41611ba8e6eb5d6b3dfe88e1cede7d9fb5472e40) ) ROM_LOAD16_BYTE( "110-00013-301.u91", 0x000000, 0x20000, CRC(a8100d1e) SHA1(69d3cac6f67563c0796560f7b874d7660720027d) ) @@ -647,7 +647,7 @@ ROM_START( botss11 ) ROM_LOAD16_BYTE( "110-00013-109.u95", 0x100000, 0x20000, CRC(6c595d1e) SHA1(89fdc30166ba1e9706798547195bdf6875a02e96) ) ROM_FILL( 0x140000, 0x40000, 0xff ) - /* Dr Math PCB (MPG 010-00002-001) */ + // Dr Math PCB (MPG 010-00002-001) ROM_REGION32_BE( 0x100000, "drmath", 0 ) ROM_LOAD64_BYTE( "110-00013-122.u134", 0x000000, 0x08000, CRC(bf60c487) SHA1(5ce80e89d9a24b627b0e97bf36a4e71c2eff4324) ) ROM_LOAD64_BYTE( "110-00013-125.u126", 0x000001, 0x08000, CRC(b0dccf4a) SHA1(e8bfd622c006985b724cdbd3ad14c33e9ed27c6c) ) @@ -668,7 +668,7 @@ ROM_START( botss11 ) ROM_LOAD16_BYTE( "110-00023-101.u101", 0x000000, 0x20000, CRC(6aada23d) SHA1(85dbf9b20e4f17cb21922637763654d6cae80dfd) ) ROM_LOAD16_BYTE( "110-00023-104.u97", 0x000001, 0x20000, CRC(715cac9d) SHA1(2aa0c563dc1fe4d02fa1ecbaed16f720f899fdc4) ) - /* Video Graphics PCB (MPG DW-010-00002-002) */ + // Video Graphics PCB (MPG DW-010-00002-002) ROM_REGION16_LE( 0xc0000, "tms_gfx", 0 ) ROM_LOAD16_BYTE( "110-00023-105.u124", 0x000000, 0x20000, CRC(5482e0c4) SHA1(492afac1862f2899cd734d1e57ca978ed6a906d5) ) ROM_LOAD16_BYTE( "110-00023-106.u121", 0x000001, 0x20000, CRC(a55e5d19) SHA1(86fbcb425103ae9fff381357339af349848fc3f2) ) @@ -677,7 +677,7 @@ ROM_START( botss11 ) ROM_LOAD16_BYTE( "110-00023-103.u114", 0x080000, 0x20000, CRC(4e486e70) SHA1(04ee16cfadd43dbe9ed5bd8330c21a718d63a8f4) ) ROM_LOAD16_BYTE( "110-00023-102.u108", 0x080001, 0x20000, CRC(441e8490) SHA1(6cfe30cea3fa297b71e881fbddad6d65a96e4386) ) - /* Sound PCB (MPG 010-00018-002) */ + // Sound PCB (MPG 010-00018-002) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "110-00014-001.u2", 0x000000, 0x08000, CRC(307fcb6d) SHA1(0cf63a39ac8920be6532974311804529d7218545) ) diff --git a/src/mame/misc/micro3d.h b/src/mame/misc/micro3d.h index c5d9ae696f3..79a8e7a916a 100644 --- a/src/mame/misc/micro3d.h +++ b/src/mame/misc/micro3d.h @@ -40,8 +40,7 @@ class micro3d_state : public driver_device m_vgb_uart(*this, "uart"), m_palette(*this, "palette"), m_duart(*this, "duart"), - m_noise_1(*this, "noise_1"), - m_noise_2(*this, "noise_2"), + m_noise(*this, "noise_%u", 1U), m_adc(*this, "adc"), m_vertex(*this, "vertex"), m_sound_sw(*this, "SOUND_SW"), @@ -93,8 +92,7 @@ class micro3d_state : public driver_device required_device m_vgb_uart; required_device m_palette; required_device m_duart; - required_device m_noise_1; - required_device m_noise_2; + required_device_array m_noise; optional_device m_adc; required_memory_region m_vertex; @@ -106,13 +104,13 @@ class micro3d_state : public driver_device required_shared_ptr m_shared_ram; uint8_t m_m68681_tx0 = 0; - /* Sound */ + // Sound uint8_t m_sound_port_latch[4]{}; - /* Hardware version-check latch for BOTSS 1.1a */ + // Hardware version-check latch for BOTSS 1.1a uint8_t m_botss_latch = 0; - /* MAC */ + // MAC required_shared_ptr m_mac_sram; emu_timer *m_mac_done_timer = nullptr; uint32_t m_sram_r_addr = 0; @@ -122,18 +120,18 @@ class micro3d_state : public driver_device uint32_t m_mac_stat = 0; uint32_t m_mac_inst = 0; - /* 2D video */ + // 2D video required_shared_ptr m_sprite_vram; uint16_t m_creg = 0; uint16_t m_xfer3dk = 0; - /* 3D pipeline */ + // 3D pipeline uint32_t m_pipe_data = 0; uint32_t m_pipeline_state = 0; int32_t m_vtx_fifo[512]{}; uint32_t m_fifo_idx = 0; uint32_t m_draw_cmd = 0; - int m_draw_state = 0; + uint32_t m_draw_state = 0; int32_t m_x_min = 0; int32_t m_x_max = 0; int32_t m_y_min = 0; @@ -142,43 +140,43 @@ class micro3d_state : public driver_device int32_t m_z_max = 0; int32_t m_x_mid = 0; int32_t m_y_mid = 0; - int m_dpram_bank = 0; + uint32_t m_dpram_bank = 0; uint32_t m_draw_dpram[1024]{}; std::unique_ptr m_frame_buffers[2]; std::unique_ptr m_tmp_buffer; - int m_drawing_buffer = 0; - int m_display_buffer = 0; + uint8_t m_drawing_buffer = 0; + uint8_t m_display_buffer = 0; void vgb_uart_w(offs_t offset, uint8_t data); uint8_t vgb_uart_r(offs_t offset); - void micro3d_mac1_w(uint32_t data); - uint32_t micro3d_mac2_r(); - void micro3d_mac2_w(uint32_t data); - uint16_t micro3d_encoder_h_r(); - uint16_t micro3d_encoder_l_r(); + void mac1_w(uint32_t data); + uint32_t mac2_r(); + void mac2_w(uint32_t data); + uint16_t encoder_h_r(); + uint16_t encoder_l_r(); uint8_t adc_volume_r(); uint16_t botss_140000_r(); uint16_t botss_180000_r(); - void micro3d_reset_w(uint16_t data); + void reset_w(uint16_t data); void host_drmath_int_w(uint16_t data); - void micro3d_shared_w(offs_t offset, uint32_t data); - uint32_t micro3d_shared_r(offs_t offset); + void shared_w(offs_t offset, uint32_t data); + uint32_t shared_r(offs_t offset); void drmath_int_w(uint32_t data); void drmath_intr2_ack(uint32_t data); - void micro3d_creg_w(uint16_t data); - void micro3d_xfer3dk_w(uint16_t data); - void micro3d_fifo_w(uint32_t data); - void micro3d_alt_fifo_w(uint32_t data); - uint32_t micro3d_pipe_r(); - void micro3d_snd_dac_a(uint8_t data); - void micro3d_snd_dac_b(uint8_t data); - void micro3d_sound_p1_w(uint8_t data); - void micro3d_sound_p3_w(uint8_t data); - uint8_t micro3d_sound_p1_r(); - uint8_t micro3d_sound_p3_r(); - INTERRUPT_GEN_MEMBER(micro3d_vblank); + void creg_w(uint16_t data); + void xfer3dk_w(uint16_t data); + void fifo_w(uint32_t data); + void alt_fifo_w(uint32_t data); + uint32_t pipe_r(); + void snd_dac_a(uint8_t data); + void snd_dac_b(uint8_t data); + void sound_p1_w(uint8_t data); + void sound_p3_w(uint8_t data); + uint8_t sound_p1_r(); + uint8_t sound_p3_r(); + INTERRUPT_GEN_MEMBER(vblank); TIMER_CALLBACK_MEMBER(mac_done_callback); - void micro3d_upd7759_w(uint8_t data); + void upd7759_w(uint8_t data); void duart_irq_handler(int state); uint8_t duart_input_r(); void duart_output_w(uint8_t data); @@ -186,7 +184,7 @@ class micro3d_state : public driver_device void tms_interrupt(int state); TMS340X0_SCANLINE_IND16_CB_MEMBER(scanline_update); - /* 3D graphics */ + // 3D graphics int inside(micro3d_vtx *v, enum planes plane); micro3d_vtx intersect(micro3d_vtx *v1, micro3d_vtx *v2, enum planes plane); inline void write_span(uint32_t y, uint32_t x); diff --git a/src/mame/misc/micro3d_a.cpp b/src/mame/misc/micro3d_a.cpp index b0dc9eb4900..91674ada07f 100644 --- a/src/mame/misc/micro3d_a.cpp +++ b/src/mame/misc/micro3d_a.cpp @@ -12,7 +12,7 @@ #include "micro3d_a.h" -#define MM5837_CLOCK 100000 +static constexpr u32 MM5837_CLOCK = 100000; /************************************* @@ -21,7 +21,7 @@ * *************************************/ -/* Borrowed from segasnd.c */ +// Borrowed from segasnd.c inline void micro3d_sound_device::m3d_filter_state::configure(double r, double c) { capval = 0; @@ -52,7 +52,7 @@ inline double micro3d_sound_device::m3d_filter_state::step_cr_filter(double inpu void micro3d_sound_device::lp_filter::init(double fsval) { - /* Section 1 */ + // Section 1 proto_coef[0].a0 = 1.0; proto_coef[0].a1 = 0; proto_coef[0].a2 = 0; @@ -60,7 +60,7 @@ void micro3d_sound_device::lp_filter::init(double fsval) proto_coef[0].b1 = 0.765367; proto_coef[0].b2 = 1.0; - /* Section 2 */ + // Section 2 proto_coef[1].a0 = 1.0; proto_coef[1].a1 = 0; proto_coef[1].a2 = 0; @@ -73,27 +73,23 @@ void micro3d_sound_device::lp_filter::init(double fsval) std::fill(std::begin(history), std::end(history), 0); } -static void prewarp(double *a0, double *a1, double *a2,double fc, double fs) +static void prewarp(double &a0, double &a1, double &a2, double fc, double fs) { - double wp, pi; + double pi = 4.0 * atan(1.0); + double wp = 2.0 * fs * tan(pi * fc / fs); - pi = 4.0 * atan(1.0); - wp = 2.0 * fs * tan(pi * fc / fs); - - *a2 = *a2 / (wp * wp); - *a1 = *a1 / wp; + a2 = a2 / (wp * wp); + a1 = a1 / wp; } static void bilinear(double a0, double a1, double a2, double b0, double b1, double b2, - double *k, double fs, float *coef) + double &k, double fs, float *coef) { - double ad, bd; - - ad = 4. * a2 * fs * fs + 2. * a1 * fs + a0; - bd = 4. * b2 * fs * fs + 2. * b1* fs + b0; + double ad = 4. * a2 * fs * fs + 2. * a1 * fs + a0; + double bd = 4. * b2 * fs * fs + 2. * b1* fs + b0; - *k *= ad/bd; + k *= ad / bd; *coef++ = (2. * b0 - 8. * b2 * fs * fs) / bd; *coef++ = (4. * b2 * fs * fs - 2. * b1 * fs + b0) / bd; @@ -116,9 +112,9 @@ void micro3d_sound_device::lp_filter::recompute(double k, double q, double fc) double b1 = proto_coef[nInd].b1 / q; double b2 = proto_coef[nInd].b2; - prewarp(&a0, &a1, &a2, fc, fs); - prewarp(&b0, &b1, &b2, fc, fs); - bilinear(a0, a1, a2, b0, b1, b2, &k, fs, c); + prewarp(a0, a1, a2, fc, fs); + prewarp(b0, b1, b2, fc, fs); + bilinear(a0, a1, a2, b0, b1, b2, k, fs, c); c += 4; } @@ -128,13 +124,10 @@ void micro3d_sound_device::lp_filter::recompute(double k, double q, double fc) void micro3d_sound_device::noise_sh_w(u8 data) { - if (~data & 8) + if (BIT(~data, 3)) { if (m_dac_data != m_dac[data & 3]) { - double q; - double fc; - m_stream->update(); m_dac[data & 3] = m_dac_data; @@ -144,8 +137,8 @@ void micro3d_sound_device::noise_sh_w(u8 data) else m_gain = expf(-(float)(m_dac[VCA]) / 25.0f) * 10.0f; - q = 0.75/255 * (255 - m_dac[VCQ]) + 0.1; - fc = 4500.0/255 * (255 - m_dac[VCF]) + 100; + double q = 0.75/255 * (255 - m_dac[VCQ]) + 0.1; + double fc = 4500.0/255 * (255 - m_dac[VCF]) + 100; m_filter.recompute(m_gain, q, fc); } @@ -182,7 +175,7 @@ micro3d_sound_device::micro3d_sound_device(const machine_config &mconfig, const void micro3d_sound_device::device_start() { - /* Allocate the stream */ + // Allocate the stream m_stream = stream_alloc(0, 2, machine().sample_rate()); m_filter.init(machine().sample_rate()); @@ -191,6 +184,28 @@ void micro3d_sound_device::device_start() m_noise_filters[2].configure(2.7e3 + 270, 0.15e-6); m_noise_filters[3].configure(2.7e3 + 0, 0.082e-6); // m_noise_filters[4].configure(33e3, 0.1e-6); + + save_item(NAME(m_dac_data)); + save_item(NAME(m_dac)); + save_item(NAME(m_gain)); + save_item(NAME(m_noise_shift)); + save_item(NAME(m_noise_value)); + save_item(NAME(m_noise_subcount)); + + save_item(NAME(m_filter.history)); + save_item(NAME(m_filter.coef)); + save_item(NAME(m_filter.fs)); + for (int i = 0; i < 2; i++) + { + save_item(NAME(m_filter.proto_coef[i].a0), i); + save_item(NAME(m_filter.proto_coef[i].a1), i); + save_item(NAME(m_filter.proto_coef[i].a2), i); + save_item(NAME(m_filter.proto_coef[i].b0), i); + save_item(NAME(m_filter.proto_coef[i].b1), i); + save_item(NAME(m_filter.proto_coef[i].b2), i); + } + save_item(STRUCT_MEMBER(m_noise_filters, capval)); + save_item(STRUCT_MEMBER(m_noise_filters, exponent)); } //------------------------------------------------- @@ -213,30 +228,25 @@ void micro3d_sound_device::device_reset() void micro3d_sound_device::sound_stream_update(sound_stream &stream, std::vector const &inputs, std::vector &outputs) { lp_filter *iir = &m_filter; - float pan_l, pan_r; auto &fl = outputs[0]; auto &fr = outputs[1]; - /* Clear the buffers */ + // Clear the buffers fl.fill(0); fr.fill(0); if (m_gain == 0) return; - pan_l = (float)(255 - m_dac[PAN]) / 255.0f; - pan_r = (float)(m_dac[PAN]) / 255.0f; + float pan_l = (float)(255 - m_dac[PAN]) / 255.0f; + float pan_r = (float)(m_dac[PAN]) / 255.0f; for (int sampindex = 0; sampindex < fl.samples(); sampindex++) { - unsigned int i; - float *hist1_ptr,*hist2_ptr,*coef_ptr; - float output,new_hist,history1,history2; - float input, white; int step; - /* Update the noise source */ + // Update the noise source for (step = 2000000 / (2000000/8); step >= m_noise_subcount; step -= m_noise_subcount) { m_noise_shift = (m_noise_shift << 1) | (((m_noise_shift >> 13) ^ (m_noise_shift >> 16)) & 1); @@ -244,10 +254,10 @@ void micro3d_sound_device::sound_stream_update(sound_stream &stream, std::vector m_noise_subcount = 2000000 / MM5837_CLOCK; } m_noise_subcount -= step; - input = (float)m_noise_value - 0.5f; - white = input; + float input = (float)m_noise_value - 0.5f; + float white = input; - /* Pink noise filtering */ + // Pink noise filtering m_noise_filters[0].capval = 0.99765 * m_noise_filters[0].capval + input * 0.0990460; m_noise_filters[1].capval = 0.96300 * m_noise_filters[1].capval + input * 0.2965164; m_noise_filters[2].capval = 0.57000 * m_noise_filters[2].capval + input * 1.0526913; @@ -256,21 +266,21 @@ void micro3d_sound_device::sound_stream_update(sound_stream &stream, std::vector input += white; input *= 200.0f; - coef_ptr = &iir->coef[0]; + float *coef_ptr = &iir->coef[0]; - hist1_ptr = &iir->history[0]; - hist2_ptr = hist1_ptr + 1; + float *hist1_ptr = &iir->history[0]; + float *hist2_ptr = hist1_ptr + 1; - /* 1st number of coefficients array is overall input scale factor, * or filter gain */ - output = input * (*coef_ptr++); + // 1st number of coefficients array is overall input scale factor, * or filter gain + float output = input * (*coef_ptr++); - for (i = 0 ; i < 2; i++) + for (u32 i = 0 ; i < 2; i++) { - history1 = *hist1_ptr; - history2 = *hist2_ptr; + float history1 = *hist1_ptr; + float history2 = *hist2_ptr; output = output - history1 * (*coef_ptr++); - new_hist = output - history2 * (*coef_ptr++); + float new_hist = output - history2 * (*coef_ptr++); output = new_hist + history1 * (*coef_ptr++); output = output + history2 * (*coef_ptr++); diff --git a/src/mame/misc/micro3d_a.h b/src/mame/misc/micro3d_a.h index 5e533e9e123..fd3908afd46 100644 --- a/src/mame/misc/micro3d_a.h +++ b/src/mame/misc/micro3d_a.h @@ -36,8 +36,8 @@ class micro3d_sound_device : public device_t, public device_sound_interface struct biquad { - double a0, a1, a2; /* Numerator coefficients */ - double b0, b1, b2; /* Denominator coefficients */ + double a0, a1, a2; // Numerator coefficients + double b0, b1, b2; // Denominator coefficients }; struct lp_filter diff --git a/src/mame/misc/micro3d_m.cpp b/src/mame/misc/micro3d_m.cpp index 2c268246dec..3d2b413a57a 100644 --- a/src/mame/misc/micro3d_m.cpp +++ b/src/mame/misc/micro3d_m.cpp @@ -22,7 +22,7 @@ * *************************************/ -#define MAC_CLK XTAL(10'000'000) +static constexpr XTAL MAC_CLK = XTAL(10'000'000); #define VTXROM_FMT(x) (((x) << 14) | ((x) & (1 << 15) ? 0xc0000000 : 0)) @@ -64,7 +64,7 @@ uint8_t micro3d_state::duart_input_r() */ void micro3d_state::duart_output_w(uint8_t data) { - m_audiocpu->set_input_line(INPUT_LINE_RESET, data & 0x20 ? CLEAR_LINE : ASSERT_LINE); + m_audiocpu->set_input_line(INPUT_LINE_RESET, BIT(data, 5) ? CLEAR_LINE : ASSERT_LINE); } @@ -109,9 +109,7 @@ inline constexpr int64_t micro3d_state::micro3d_vtx::dot_product(micro3d_vtx con static inline int64_t normalised_multiply(int32_t a, int32_t b) { - int64_t result; - - result = (int64_t)a * (int64_t)b; + int64_t const result = (int64_t)a * (int64_t)b; return result >> 14; } @@ -121,41 +119,35 @@ TIMER_CALLBACK_MEMBER(micro3d_state::mac_done_callback) m_mac_stat = 0; } -void micro3d_state::micro3d_mac1_w(uint32_t data) +void micro3d_state::mac1_w(uint32_t data) { m_vtx_addr = (data & 0x3ffff); m_sram_w_addr = (data >> 18) & 0xfff; } -uint32_t micro3d_state::micro3d_mac2_r() +uint32_t micro3d_state::mac2_r() { return (m_mac_inst << 1) | m_mac_stat; } -void micro3d_state::micro3d_mac2_w(uint32_t data) +void micro3d_state::mac2_w(uint32_t data) { uint32_t cnt = data & 0xff; - uint32_t inst = (data >> 8) & 0x1f; + uint32_t const inst = (data >> 8) & 0x1f; uint32_t mac_cycles = 1; - uint32_t mrab11; - uint32_t vtx_addr; - uint32_t sram_r_addr; - uint32_t sram_w_addr; - uint32_t *mac_sram; - m_mac_stat = BIT(data, 13); m_mac_inst = inst & 0x7; m_mrab11 = (data >> 18) & (1 << 11); m_sram_r_addr = (data >> 18) & 0xfff; - mrab11 = m_mrab11; - vtx_addr = m_vtx_addr; - sram_r_addr = m_sram_r_addr; - sram_w_addr = m_sram_w_addr; - mac_sram = m_mac_sram; + uint32_t const mrab11 = m_mrab11; + uint32_t vtx_addr = m_vtx_addr; + uint32_t sram_r_addr = m_sram_r_addr; + uint32_t sram_w_addr = m_sram_w_addr; + uint32_t *mac_sram = m_mac_sram; - if (data & (1 << 14)) + if (BIT(data, 14)) m_drmath->set_input_line(AM29000_INTR0, CLEAR_LINE); switch (inst) @@ -168,10 +160,9 @@ void micro3d_state::micro3d_mac2_w(uint32_t data) case 0x09: cnt += 0x100; [[fallthrough]]; case 0x08: { - int i; const uint16_t *rom = (uint16_t*)m_vertex->base(); - for (i = 0; i <= cnt; ++i) + for (int i = 0; i <= cnt; ++i) { int64_t acc; micro3d_vtx v1; @@ -207,10 +198,9 @@ void micro3d_state::micro3d_mac2_w(uint32_t data) case 0x0d: cnt += 0x100; [[fallthrough]]; case 0x0c: { - int i; const uint16_t *rom = (uint16_t*)m_vertex->base(); - for (i = 0; i <= cnt; ++i) + for (int i = 0; i <= cnt; ++i) { int64_t acc; micro3d_vtx v1; @@ -240,10 +230,9 @@ void micro3d_state::micro3d_mac2_w(uint32_t data) } case 0x0f: { - int i; const uint16_t *rom = (uint16_t*)m_vertex->base(); - for (i = 0; i <= cnt; ++i, vtx_addr += 4) + for (int i = 0; i <= cnt; ++i, vtx_addr += 4) { mac_sram[sram_w_addr++] = VTXROM_FMT(rom[vtx_addr + 0]); mac_sram[sram_w_addr++] = VTXROM_FMT(rom[vtx_addr + 1]); @@ -254,7 +243,7 @@ void micro3d_state::micro3d_mac2_w(uint32_t data) mac_cycles = 8 * cnt; break; } - /* Dot product of SRAM vectors with single SRAM vector */ + // Dot product of SRAM vectors with single SRAM vector case 0x11: cnt += 0x100; [[fallthrough]]; case 0x10: { @@ -279,7 +268,7 @@ void micro3d_state::micro3d_mac2_w(uint32_t data) mac_cycles = 10 * cnt; break; } - /* Dot product of SRAM vectors with SRAM vectors */ + // Dot product of SRAM vectors with SRAM vectors case 0x16: cnt += 0x100; [[fallthrough]]; case 0x15: cnt += 0x100; [[fallthrough]]; case 0x14: @@ -310,7 +299,7 @@ void micro3d_state::micro3d_mac2_w(uint32_t data) break; } - /* TODO: Calculate a better estimate for timing */ + // TODO: Calculate a better estimate for timing if (m_mac_stat) m_mac_done_timer->adjust(attotime::from_hz(MAC_CLK) * mac_cycles); @@ -327,18 +316,18 @@ void micro3d_state::micro3d_mac2_w(uint32_t data) * *************************************/ -uint16_t micro3d_state::micro3d_encoder_h_r() +uint16_t micro3d_state::encoder_h_r() { - uint16_t x_encoder = m_joystick_x.read_safe(0); - uint16_t y_encoder = m_joystick_y.read_safe(0); + uint16_t const x_encoder = m_joystick_x.read_safe(0); + uint16_t const y_encoder = m_joystick_y.read_safe(0); return (y_encoder & 0xf00) | ((x_encoder & 0xf00) >> 8); } -uint16_t micro3d_state::micro3d_encoder_l_r() +uint16_t micro3d_state::encoder_l_r() { - uint16_t x_encoder = m_joystick_x.read_safe(0); - uint16_t y_encoder = m_joystick_y.read_safe(0); + uint16_t const x_encoder = m_joystick_x.read_safe(0); + uint16_t const y_encoder = m_joystick_y.read_safe(0); return ((y_encoder & 0xff) << 8) | (x_encoder & 0xff); } @@ -355,13 +344,15 @@ int micro3d_state::botss_hwchk_r() uint16_t micro3d_state::botss_140000_r() { - m_botss_latch = 0; + if (!machine().side_effects_disabled()) + m_botss_latch = 0; return 0xffff; } uint16_t micro3d_state::botss_180000_r() { - m_botss_latch = 1; + if (!machine().side_effects_disabled()) + m_botss_latch = 1; return 0xffff; } @@ -371,12 +362,11 @@ uint16_t micro3d_state::botss_180000_r() * *************************************/ -void micro3d_state::micro3d_reset_w(uint16_t data) +void micro3d_state::reset_w(uint16_t data) { - data >>= 8; - m_drmath->set_input_line(INPUT_LINE_RESET, data & 1 ? CLEAR_LINE : ASSERT_LINE); - m_vgb->set_input_line(INPUT_LINE_RESET, data & 2 ? CLEAR_LINE : ASSERT_LINE); - /* TODO: Joystick reset? */ + m_drmath->set_input_line(INPUT_LINE_RESET, BIT(data, 8) ? CLEAR_LINE : ASSERT_LINE); + m_vgb->set_input_line(INPUT_LINE_RESET, BIT(data, 9) ? CLEAR_LINE : ASSERT_LINE); + // TODO: Joystick reset? } void micro3d_state::host_drmath_int_w(uint16_t data) @@ -392,13 +382,13 @@ void micro3d_state::host_drmath_int_w(uint16_t data) * *************************************/ -void micro3d_state::micro3d_shared_w(offs_t offset, uint32_t data) +void micro3d_state::shared_w(offs_t offset, uint32_t data) { m_shared_ram[offset * 2 + 1] = data & 0xffff; m_shared_ram[offset * 2 + 0] = data >> 16; } -uint32_t micro3d_state::micro3d_shared_r(offs_t offset) +uint32_t micro3d_state::shared_r(offs_t offset) { return (m_shared_ram[offset * 2] << 16) | m_shared_ram[offset * 2 + 1]; } @@ -432,26 +422,25 @@ void micro3d_state::drmath_intr2_ack(uint32_t data) ***************************************************************************/ -void micro3d_state::micro3d_snd_dac_a(uint8_t data) +void micro3d_state::snd_dac_a(uint8_t data) { - m_noise_1->dac_w(data); - m_noise_2->dac_w(data); + m_noise[0]->dac_w(data); + m_noise[1]->dac_w(data); } -void micro3d_state::micro3d_snd_dac_b(uint8_t data) +void micro3d_state::snd_dac_b(uint8_t data) { - /* TODO: This controls upd7759 volume */ + // TODO: This controls upd7759 volume } -void micro3d_state::micro3d_sound_p1_w(uint8_t data) +void micro3d_state::sound_p1_w(uint8_t data) { m_sound_port_latch[1] = data; - micro3d_sound_device *noise = (data & 4) ? m_noise_2 : m_noise_1; - noise->noise_sh_w(data); + m_noise[BIT(data, 2)]->noise_sh_w(data); } -void micro3d_state::micro3d_sound_p3_w(uint8_t data) +void micro3d_state::sound_p3_w(uint8_t data) { // preserve RXD input m_sound_port_latch[3] = (m_sound_port_latch[3] & 1) | (data & ~1); @@ -461,17 +450,17 @@ void micro3d_state::micro3d_sound_p3_w(uint8_t data) m_upd7759->reset_w(!BIT(data, 4)); } -uint8_t micro3d_state::micro3d_sound_p1_r() +uint8_t micro3d_state::sound_p1_r() { return (m_sound_port_latch[1] & 0x7f) | m_sound_sw->read(); } -uint8_t micro3d_state::micro3d_sound_p3_r() +uint8_t micro3d_state::sound_p3_r() { return (m_sound_port_latch[3] & 0xf7) | (m_upd7759->busy_r() ? 0x08 : 0); } -void micro3d_state::micro3d_upd7759_w(uint8_t data) +void micro3d_state::upd7759_w(uint8_t data) { m_upd7759->port_w(data); m_upd7759->start_w(0); @@ -503,7 +492,7 @@ void micro3d_state::init_botss() { address_space &space = m_maincpu->space(AS_PROGRAM); - /* Required to pass the hardware version check */ + // Required to pass the hardware version check space.install_read_handler(0x140000, 0x140001, read16smo_delegate(*this, FUNC(micro3d_state::botss_140000_r))); space.install_read_handler(0x180000, 0x180001, read16smo_delegate(*this, FUNC(micro3d_state::botss_180000_r))); @@ -513,6 +502,16 @@ void micro3d_state::init_botss() void micro3d_state::machine_start() { m_mac_done_timer = timer_alloc(FUNC(micro3d_state::mac_done_callback), this); + + save_item(NAME(m_m68681_tx0)); + save_item(NAME(m_sound_port_latch)); + save_item(NAME(m_botss_latch)); + save_item(NAME(m_sram_r_addr)); + save_item(NAME(m_sram_w_addr)); + save_item(NAME(m_vtx_addr)); + save_item(NAME(m_mrab11)); + save_item(NAME(m_mac_stat)); + save_item(NAME(m_mac_inst)); } void micro3d_state::machine_reset() diff --git a/src/mame/misc/micro3d_v.cpp b/src/mame/misc/micro3d_v.cpp index 525686801d9..ccdafc19e9b 100644 --- a/src/mame/misc/micro3d_v.cpp +++ b/src/mame/misc/micro3d_v.cpp @@ -16,6 +16,8 @@ #include "cpu/am29000/am29000.h" +#include + /************************************* * @@ -41,10 +43,36 @@ enum void micro3d_state::video_start() { - /* Allocate 512x12 x 2 3D frame buffers */ - m_frame_buffers[0] = std::make_unique(1024 * 512); - m_frame_buffers[1] = std::make_unique(1024 * 512); + // Allocate 512x12 x 2 3D frame buffers + for (int i = 0; i < 2; i++) + { + m_frame_buffers[i] = std::make_unique(1024 * 512); + save_pointer(NAME(m_frame_buffers[i]), 1024 * 512, i); + } + m_tmp_buffer = std::make_unique(1024 * 512); + save_pointer(NAME(m_tmp_buffer), 1024 * 512); + + save_item(NAME(m_creg)); + save_item(NAME(m_xfer3dk)); + save_item(NAME(m_pipe_data)); + save_item(NAME(m_pipeline_state)); + save_item(NAME(m_vtx_fifo)); + save_item(NAME(m_fifo_idx)); + save_item(NAME(m_draw_cmd)); + save_item(NAME(m_draw_state)); + save_item(NAME(m_x_min)); + save_item(NAME(m_x_max)); + save_item(NAME(m_y_min)); + save_item(NAME(m_y_max)); + save_item(NAME(m_z_min)); + save_item(NAME(m_z_max)); + save_item(NAME(m_x_mid)); + save_item(NAME(m_y_mid)); + save_item(NAME(m_dpram_bank)); + save_item(NAME(m_draw_dpram)); + save_item(NAME(m_drawing_buffer)); + save_item(NAME(m_display_buffer)); } @@ -69,14 +97,14 @@ TMS340X0_SCANLINE_IND16_CB_MEMBER(micro3d_state::scanline_update) uint16_t const *const src = &m_sprite_vram[(params->rowaddr << 8) & 0x7fe00]; uint16_t *dest = &bitmap.pix(scanline); int coladdr = params->coladdr; - int sd_11_7 = (m_creg & 0x1f) << 7; + int const sd_11_7 = (m_creg & 0x1f) << 7; scanline = std::max((scanline - params->veblnk), 0); uint16_t const *frame_src = m_frame_buffers[m_display_buffer].get() + (scanline << 10); - /* TODO: XFER3DK - X/Y offsets for 3D */ + // TODO: XFER3DK - X/Y offsets for 3D - /* Copy the non-blanked portions of this scanline */ + // Copy the non-blanked portions of this scanline for (int x = params->heblnk; x < params->hsblnk; x += 2) { uint16_t pix = src[coladdr++ & 0x1ff]; @@ -102,7 +130,7 @@ TMS340X0_SCANLINE_IND16_CB_MEMBER(micro3d_state::scanline_update) } } -void micro3d_state::micro3d_creg_w(uint16_t data) +void micro3d_state::creg_w(uint16_t data) { if (~data & 0x80) m_vgb->set_input_line(0, CLEAR_LINE); @@ -110,7 +138,7 @@ void micro3d_state::micro3d_creg_w(uint16_t data) m_creg = data; } -void micro3d_state::micro3d_xfer3dk_w(uint16_t data) +void micro3d_state::xfer3dk_w(uint16_t data) { m_xfer3dk = data; } @@ -234,31 +262,30 @@ micro3d_state::micro3d_vtx micro3d_state::intersect(micro3d_vtx *v1, micro3d_vtx inline void micro3d_state::write_span(uint32_t y, uint32_t x) { - uint32_t *draw_dpram = m_draw_dpram; - int addr = y << 1; + int const addr = y << 1; - if (draw_dpram[addr] == 0x3ff000) + if (m_draw_dpram[addr] == 0x3ff000) { - draw_dpram[addr] = (x << 12) | x; + m_draw_dpram[addr] = (x << 12) | x; } else { - /* Check start */ + // Check start if (x < (m_draw_dpram[addr] & 0x3ff)) { - draw_dpram[addr] &= ~0x3ff; - draw_dpram[addr] |= x; + m_draw_dpram[addr] &= ~0x3ff; + m_draw_dpram[addr] |= x; } - /* Check end */ - if (x > (draw_dpram[addr] >> 12)) + // Check end + if (x > (m_draw_dpram[addr] >> 12)) { - draw_dpram[addr] &= ~0x3ff000; - draw_dpram[addr] |= (x << 12); + m_draw_dpram[addr] &= ~0x3ff000; + m_draw_dpram[addr] |= (x << 12); } } } -/* This is the same algorithm used in the 3D tests */ +// This is the same algorithm used in the 3D tests void micro3d_state::draw_line(uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2) { uint32_t tmp2; @@ -270,15 +297,8 @@ void micro3d_state::draw_line(uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2 if (x2 < x1) { - uint32_t tmp; - - tmp = x1; - x1 = x2; - x2 = tmp; - - tmp = y1; - y1 = y2; - y2 = tmp; + std::swap(x1, x2); + std::swap(y1, y2); } dx = x2 - x1; @@ -364,16 +384,14 @@ void micro3d_state::draw_line(uint32_t x1, uint32_t y1, uint32_t x2, uint32_t y2 void micro3d_state::rasterise_spans(uint32_t min_y, uint32_t max_y, uint32_t attr) { - int y; - int color = attr & 0xfff; + int const color = attr & 0xfff; if ((attr >> 24) == 0x85) { - for (y = min_y; y <= max_y; ++y) + for (int y = min_y; y <= max_y; ++y) { - int x; - int addr = y << 1; - uint16_t *dest = &m_tmp_buffer[y * 1024]; + int const addr = y << 1; + uint16_t *const dest = &m_tmp_buffer[y * 1024]; if (m_draw_dpram[addr] == 0x3ff000) { @@ -381,10 +399,10 @@ void micro3d_state::rasterise_spans(uint32_t min_y, uint32_t max_y, uint32_t att } else { - int start = m_draw_dpram[addr] & 0x3ff; - int end = (m_draw_dpram[addr] >> 12) & 0x3ff; + int const start = m_draw_dpram[addr] & 0x3ff; + int const end = (m_draw_dpram[addr] >> 12) & 0x3ff; - for (x = start; x <= end; ++x) + for (int x = start; x <= end; ++x) dest[x] = color; } } @@ -410,11 +428,10 @@ void micro3d_state::rasterise_spans(uint32_t min_y, uint32_t max_y, uint32_t att int noise_val = (attr >> 12) & 0x3ff; int noise_taps = 0; - for (y = min_y; y <= max_y; ++y) + for (int y = min_y; y <= max_y; ++y) { - int x; - int addr = y << 1; - uint16_t *dest = &m_tmp_buffer[y * 1024]; + int const addr = y << 1; + uint16_t *const dest = &m_tmp_buffer[y * 1024]; if (m_draw_dpram[addr] == 0x3ff000) { @@ -422,10 +439,10 @@ void micro3d_state::rasterise_spans(uint32_t min_y, uint32_t max_y, uint32_t att } else { - int start = m_draw_dpram[addr] & 0x3ff; - int end = (m_draw_dpram[addr] >> 12) & 0x3ff; + int const start = m_draw_dpram[addr] & 0x3ff; + int const end = (m_draw_dpram[addr] >> 12) & 0x3ff; - for (x = start; x <= end; ++x) + for (int x = start; x <= end; ++x) { int fb; @@ -444,27 +461,26 @@ int micro3d_state::clip_triangle(micro3d_vtx *v, micro3d_vtx *vout, int num_vert { micro3d_vtx clip_out[10]; - int i; int prev_i = num_vertices - 1; int clip_verts = 0; - for (i = 0; i < num_vertices; ++i) + for (int i = 0; i < num_vertices; ++i) { int v1_in = inside(&v[i], plane); int v2_in = inside(&v[prev_i], plane); - /* Edge is inside */ + // Edge is inside if (v1_in && v2_in) { clip_out[clip_verts++] = v[i]; } - /* Edge is leaving */ + // Edge is leaving else if (v1_in && !v2_in) { clip_out[clip_verts++] = intersect(&v[i], &v[prev_i], plane); clip_out[clip_verts++] = v[i]; } - /* Edge is entering */ + // Edge is entering else if (!v1_in && v2_in) { clip_out[clip_verts++] = intersect(&v[i], &v[prev_i], plane); @@ -479,13 +495,12 @@ int micro3d_state::clip_triangle(micro3d_vtx *v, micro3d_vtx *vout, int num_vert void micro3d_state::draw_triangles(uint32_t attr) { - int i; bool triangles = false; - int vertices = m_fifo_idx / 3; + int const vertices = m_fifo_idx / 3; int min_y = 0x3ff; int max_y = 0; - /* This satisifes the burst write test */ + // This satisifes the burst write test if (vertices == 0) { int y; @@ -497,10 +512,9 @@ void micro3d_state::draw_triangles(uint32_t attr) return; } - /* Draw triangles as fans */ - for (i = 2; i < vertices; ++i) + // Draw triangles as fans + for (int i = 2; i < vertices; ++i) { - int k; int clip_vertices = 3; micro3d_vtx vo, vm, vn; @@ -522,25 +536,25 @@ void micro3d_state::draw_triangles(uint32_t attr) vclip_list[1] = vm; vclip_list[2] = vn; - /* Clip against near Z and far Z planes */ + // Clip against near Z and far Z planes clip_vertices = clip_triangle(vclip_list, vclip_list, clip_vertices, CLIP_Z_MIN); clip_vertices = clip_triangle(vclip_list, vclip_list, clip_vertices, CLIP_Z_MAX); - /* Perform perspective divide */ - for (k = 0; k < clip_vertices; ++k) + // Perform perspective divide + for (int k = 0; k < clip_vertices; ++k) { vclip_list[k].x = vclip_list[k].x * m_z_min / vclip_list[k].z; vclip_list[k].y = vclip_list[k].y * m_z_min / vclip_list[k].z; vclip_list[k].z = 0; } - /* Perform screen-space clipping */ + // Perform screen-space clipping clip_vertices = clip_triangle(vclip_list, vclip_list, clip_vertices, CLIP_Y_MAX); clip_vertices = clip_triangle(vclip_list, vclip_list, clip_vertices, CLIP_X_MIN); clip_vertices = clip_triangle(vclip_list, vclip_list, clip_vertices, CLIP_X_MAX); clip_vertices = clip_triangle(vclip_list, vclip_list, clip_vertices, CLIP_Y_MIN); - /* Rasterise */ + // Rasterise if (clip_vertices >= 3) { micro3d_vtx a = vclip_list[0]; @@ -554,7 +568,7 @@ void micro3d_state::draw_triangles(uint32_t attr) b.x += m_x_mid; b.y += m_y_mid; - /* Keep track of the y-extents so we don't have to scan every line later */ + // Keep track of the y-extents so we don't have to scan every line later if (a.y < min_y) min_y = a.y; if (a.y > max_y) @@ -565,10 +579,10 @@ void micro3d_state::draw_triangles(uint32_t attr) if (b.y > max_y) max_y = b.y; - /* Draw the first line of the triangle/fan */ + // Draw the first line of the triangle/fan draw_line(a.x, a.y, b.x, b.y); - for (k = 2; k < clip_vertices; ++k) + for (int k = 2; k < clip_vertices; ++k) { micro3d_vtx c = vclip_list[k]; @@ -617,9 +631,9 @@ bc000000-1fc DPRAM address for read access ******************************************************************************/ -void micro3d_state::micro3d_fifo_w(uint32_t data) +void micro3d_state::fifo_w(uint32_t data) { - uint32_t opcode = data >> 24; + uint32_t const opcode = data >> 24; switch (m_draw_state) { @@ -642,14 +656,13 @@ void micro3d_state::micro3d_fifo_w(uint32_t data) } case 0xbc: { - uint32_t dpram_r_addr = (((data & 0x01ff) << 1) | m_dpram_bank); + uint32_t const dpram_r_addr = (((data & 0x01ff) << 1) | m_dpram_bank); m_pipe_data = m_draw_dpram[dpram_r_addr]; m_drmath->set_input_line(AM29000_INTR1, ASSERT_LINE); break; } case 0x80: { - int addr; m_fifo_idx = 0; m_draw_state = STATE_DRAW_VTX_DATA; @@ -657,19 +670,19 @@ void micro3d_state::micro3d_fifo_w(uint32_t data) * TODO: Not sure this is the right place for it - * causes monitor mode draw tests to fail */ - for (addr = 0; addr < 512; ++addr) + for (int addr = 0; addr < 512; ++addr) m_draw_dpram[addr << 1] = 0x3ff000; break; } case 0xf8: { - /* 3D pipeline health LEDs toggle */ + // 3D pipeline health LEDs toggle break; } case 0xd8: { - /* TODO: We shouldn't need this extra buffer - is there some sort of sync missing? */ + // TODO: We shouldn't need this extra buffer - is there some sort of sync missing? memcpy(m_frame_buffers[m_drawing_buffer].get(), m_tmp_buffer.get(), 512*1024*2); m_drawing_buffer ^= 1; m_vgb->set_input_line(0, ASSERT_LINE); @@ -717,18 +730,19 @@ void micro3d_state::micro3d_fifo_w(uint32_t data) } } -void micro3d_state::micro3d_alt_fifo_w(uint32_t data) +void micro3d_state::alt_fifo_w(uint32_t data) { m_vtx_fifo[m_fifo_idx++] = VTX_SEX(data); } -uint32_t micro3d_state::micro3d_pipe_r() +uint32_t micro3d_state::pipe_r() { - m_drmath->set_input_line(AM29000_INTR1, CLEAR_LINE); + if (!machine().side_effects_disabled()) + m_drmath->set_input_line(AM29000_INTR1, CLEAR_LINE); return m_pipe_data; } -INTERRUPT_GEN_MEMBER(micro3d_state::micro3d_vblank) +INTERRUPT_GEN_MEMBER(micro3d_state::vblank) { // mc68901_int_gen(machine(), GPIP7); From 6a3b5bb7818ab26cf2288fc086d1ecfcab8d30b3 Mon Sep 17 00:00:00 2001 From: cam900 Date: Mon, 13 May 2024 02:11:39 +0900 Subject: [PATCH 05/16] promat/3x3puzzl.cpp: Cleanups (#12324) - Use generic gfx decoding layouts - Use array for Tile RAM and Tilemap - Use C++ style comments for single line comments - Fix spacing - Reduce preprocessor defines --- src/mame/promat/3x3puzzl.cpp | 240 ++++++++++++++--------------------- 1 file changed, 95 insertions(+), 145 deletions(-) diff --git a/src/mame/promat/3x3puzzl.cpp b/src/mame/promat/3x3puzzl.cpp index da2fe4e7eb5..8cbc3b16086 100644 --- a/src/mame/promat/3x3puzzl.cpp +++ b/src/mame/promat/3x3puzzl.cpp @@ -51,16 +51,12 @@ has adult graphics (sets provided are 'Normal' and 'Enterprise') namespace { -#define MAIN_CLOCK XTAL(10'000'000) - class _3x3puzzle_state : public driver_device { public: _3x3puzzle_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) - , m_videoram1(*this, "videoram1") - , m_videoram2(*this, "videoram2") - , m_videoram3(*this, "videoram3") + , m_videoram(*this, "videoram%u", 1U) , m_maincpu(*this, "maincpu") , m_oki(*this, "oki") , m_gfxdecode(*this, "gfxdecode") @@ -75,14 +71,10 @@ class _3x3puzzle_state : public driver_device virtual void machine_reset() override; private: - /* memory pointers */ - required_shared_ptr m_videoram1; - required_shared_ptr m_videoram2; - required_shared_ptr m_videoram3; + // memory pointers + required_shared_ptr_array m_videoram; - uint16_t m_videoram1_buffer[0x800/2]; - uint16_t m_videoram2_buffer[0x1000/2]; - uint16_t m_videoram3_buffer[0x1000/2]; + std::unique_ptr m_videoram_buffer[3]; // devices required_device m_maincpu; @@ -93,14 +85,10 @@ class _3x3puzzle_state : public driver_device // screen updates uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - /* video-related */ - tilemap_t *m_tilemap1 = nullptr; - tilemap_t *m_tilemap2 = nullptr; - tilemap_t *m_tilemap3 = nullptr; + // video-related + tilemap_t *m_tilemap[3] = {nullptr, nullptr, nullptr}; - TILE_GET_INFO_MEMBER(get_tile1_info); - TILE_GET_INFO_MEMBER(get_tile2_info); - TILE_GET_INFO_MEMBER(get_tile3_info); + template TILE_GET_INFO_MEMBER(get_tile_info); int m_oki_bank = 0; uint16_t m_gfx_control = 0; @@ -113,34 +101,15 @@ class _3x3puzzle_state : public driver_device }; - -TILE_GET_INFO_MEMBER(_3x3puzzle_state::get_tile1_info) +template +TILE_GET_INFO_MEMBER(_3x3puzzle_state::get_tile_info) { - uint16_t code = m_videoram1_buffer[tile_index]; - tileinfo.set(0, - code, + tileinfo.set(Which, + m_videoram_buffer[Which][tile_index], 0, 0); } -TILE_GET_INFO_MEMBER(_3x3puzzle_state::get_tile2_info) -{ - uint16_t code = m_videoram2_buffer[tile_index]; - tileinfo.set(1, - code, - 1, - 0); -} - -TILE_GET_INFO_MEMBER(_3x3puzzle_state::get_tile3_info) -{ - uint16_t code = m_videoram3_buffer[tile_index]; - tileinfo.set(2, - code, - 2, - 0); -} - void _3x3puzzle_state::gfx_ctrl_w(offs_t offset, uint16_t data, uint16_t mem_mask) { // does this have registers to control when the actual tile/palette @@ -155,7 +124,7 @@ void _3x3puzzle_state::gfx_ctrl_w(offs_t offset, uint16_t data, uint16_t mem_mas //printf("%04x\n",data&0xc7); COMBINE_DATA(&m_gfx_control); - if ( BIT(data,4) ) + if (BIT(data, 4)) { m_screen->set_visible_area(0*8, 64*8-1, 0*8, 30*8-1); } @@ -164,53 +133,55 @@ void _3x3puzzle_state::gfx_ctrl_w(offs_t offset, uint16_t data, uint16_t mem_mas m_screen->set_visible_area(0*8, 40*8-1, 0*8, 30*8-1); } - if ( (data&0x06) != m_oki_bank ) + if ((data & 0x06) != m_oki_bank) { - m_oki_bank = data &0x6; + m_oki_bank = data & 0x06; m_oki->set_rom_bank(m_oki_bank >> 1); } } void _3x3puzzle_state::tilemap1_scrollx_w(uint16_t data) { - m_tilemap1->set_scrollx(data); + m_tilemap[0]->set_scrollx(data); } void _3x3puzzle_state::tilemap1_scrolly_w(uint16_t data) { - m_tilemap1->set_scrolly(data); + m_tilemap[0]->set_scrolly(data); } void _3x3puzzle_state::video_start() { - m_tilemap1 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(_3x3puzzle_state::get_tile1_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); - m_tilemap2 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(_3x3puzzle_state::get_tile2_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); - m_tilemap3 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(_3x3puzzle_state::get_tile3_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); - m_tilemap2->set_transparent_pen(0); - m_tilemap3->set_transparent_pen(0); + for (int i = 0; i < 3; i++) + { + size_t const videoram_size = m_videoram[i].length(); + m_videoram_buffer[i] = make_unique_clear(videoram_size); + save_pointer(NAME(m_videoram_buffer[i]), videoram_size, i); + } + m_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(_3x3puzzle_state::get_tile_info<0>)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); + m_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(_3x3puzzle_state::get_tile_info<1>)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); + m_tilemap[2] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(_3x3puzzle_state::get_tile_info<2>)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); + m_tilemap[1]->set_transparent_pen(0); + m_tilemap[2]->set_transparent_pen(0); } -uint32_t _3x3puzzle_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect ) +uint32_t _3x3puzzle_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - m_tilemap1->draw(screen, bitmap, cliprect, 0, 1); - m_tilemap2->draw(screen, bitmap, cliprect, 0, 2); - m_tilemap3->draw(screen, bitmap, cliprect, 0, 3); + m_tilemap[0]->draw(screen, bitmap, cliprect, 0, 0); + m_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0); + m_tilemap[2]->draw(screen, bitmap, cliprect, 0, 0); // guess based on register use and Casanova intro - if (m_gfx_control&0x20) + if (BIT(m_gfx_control, 5)) { - for (int offset=0;offset<0x800/2;offset++) + for (int i = 0; i < 3; i++) { - m_videoram1_buffer[offset] = m_videoram1[offset]; - m_tilemap1->mark_tile_dirty(offset); - } - - for (int offset=0;offset<0x1000/2;offset++) - { - m_videoram2_buffer[offset] = m_videoram2[offset]; - m_tilemap2->mark_tile_dirty(offset); - m_videoram3_buffer[offset] = m_videoram3[offset]; - m_tilemap3->mark_tile_dirty(offset); + size_t const videoram_size = m_videoram[i].length(); + for (size_t offset = 0; offset < videoram_size; offset++) + { + m_videoram_buffer[i][offset] = m_videoram[i][offset]; + m_tilemap[i]->mark_tile_dirty(offset); + } } } @@ -221,9 +192,9 @@ void _3x3puzzle_state::_3x3puzzle_map(address_map &map) { map(0x000000, 0x07ffff).rom(); map(0x100000, 0x10ffff).ram(); - map(0x200000, 0x2007ff).ram().share("videoram1"); - map(0x201000, 0x201fff).ram().share("videoram2"); - map(0x202000, 0x202fff).ram().share("videoram3"); + map(0x200000, 0x2007ff).ram().share(m_videoram[0]); + map(0x201000, 0x201fff).ram().share(m_videoram[1]); + map(0x202000, 0x202fff).ram().share(m_videoram[2]); map(0x280000, 0x280001).portr("VBLANK"); map(0x300000, 0x3005ff).ram().w("palette", FUNC(palette_device::write16)).share("palette"); map(0x400000, 0x400001).w(FUNC(_3x3puzzle_state::tilemap1_scrollx_w)); @@ -321,12 +292,12 @@ static INPUT_PORTS_START( casanova ) PORT_MODIFY("SYS") PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 ) - PORT_MODIFY("DSW01") /* Do NOT trust "DIP INFO" for correct settings! At least Coinage is WRONG! */ + PORT_MODIFY("DSW01") // Do NOT trust "DIP INFO" for correct settings! At least Coinage is WRONG! PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2") - PORT_DIPSETTING( 0x0002, DEF_STR( 1C_2C ) ) /* Dip info shows 2 Coins / Credit */ + PORT_DIPSETTING( 0x0002, DEF_STR( 1C_2C ) ) // Dip info shows 2 Coins / Credit PORT_DIPSETTING( 0x0003, DEF_STR( 1C_1C ) ) - PORT_DIPSETTING( 0x0001, DEF_STR( 2C_1C ) ) /* Dip info shows 3 Coins / Credit */ - PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) /* Dip info shows 5 Coins / Credit */ + PORT_DIPSETTING( 0x0001, DEF_STR( 2C_1C ) ) // Dip info shows 3 Coins / Credit + PORT_DIPSETTING( 0x0000, DEF_STR( 3C_1C ) ) // Dip info shows 5 Coins / Credit PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4") PORT_DIPSETTING( 0x0008, DEF_STR( Easy ) ) PORT_DIPSETTING( 0x000c, DEF_STR( Normal ) ) @@ -340,7 +311,7 @@ static INPUT_PORTS_START( casanova ) PORT_DIPNAME( 0x0080, 0x0080, "Dip Info" ) PORT_DIPLOCATION("SW1:8") PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPUNUSED_DIPLOC( 0x0100, 0x0100, "SW2:1" ) /* DSW2 bank, not used? */ + PORT_DIPUNUSED_DIPLOC( 0x0100, 0x0100, "SW2:1" ) // DSW2 bank, not used? PORT_DIPUNUSED_DIPLOC( 0x0200, 0x0200, "SW2:2" ) PORT_DIPUNUSED_DIPLOC( 0x0400, 0x0400, "SW2:3" ) PORT_DIPUNUSED_DIPLOC( 0x0800, 0x0800, "SW2:4" ) @@ -351,33 +322,10 @@ static INPUT_PORTS_START( casanova ) INPUT_PORTS_END -static const gfx_layout tiles16x16x8_layout = -{ - 16,16, - RGN_FRAC(1,1), - 8, - { 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, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - { 0*128, 1*128, 2*128, 3*128, 4*128, 5*128, 6*128, 7*128, 8*128, 9*128,10*128,11*128,12*128,13*128,14*128,15*128 }, - 128*16 -}; - -static const gfx_layout tiles8x8_layout = -{ - 8,8, - RGN_FRAC(1,1), - 8 , - { 0,1,2,3,4,5,6,7 }, - { 3*8,2*8,1*8,0*8,7*8,6*8,5*8,4*8 }, - { 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64 }, - 8*64 -}; - - static GFXDECODE_START( gfx_3x3puzzle ) - GFXDECODE_ENTRY( "gfx1", 0, tiles16x16x8_layout, 0, 3 ) - GFXDECODE_ENTRY( "gfx2", 0, tiles8x8_layout, 0, 3 ) - GFXDECODE_ENTRY( "gfx3", 0, tiles8x8_layout, 0, 3 ) + GFXDECODE_ENTRY( "tiles1", 0, gfx_16x16x8_raw, 0x000, 1 ) + GFXDECODE_ENTRY( "tiles2", 0, gfx_8x8x8_raw, 0x100, 1 ) + GFXDECODE_ENTRY( "tiles3", 0, gfx_8x8x8_raw, 0x200, 1 ) GFXDECODE_END void _3x3puzzle_state::machine_start() @@ -395,12 +343,14 @@ void _3x3puzzle_state::machine_reset() void _3x3puzzle_state::_3x3puzzle(machine_config &config) { - /* basic machine hardware */ + constexpr XTAL MAIN_CLOCK = XTAL(10'000'000); + + // basic machine hardware M68000(config, m_maincpu, MAIN_CLOCK); m_maincpu->set_addrmap(AS_PROGRAM, &_3x3puzzle_state::_3x3puzzle_map); m_maincpu->set_vblank_int("screen", FUNC(_3x3puzzle_state::irq4_line_hold)); - /* 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)); @@ -412,7 +362,7 @@ void _3x3puzzle_state::_3x3puzzle(machine_config &config) PALETTE(config, "palette").set_format(palette_device::xBGR_555, 0x600 / 2); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); OKIM6295(config, m_oki, XTAL(4'000'000)/4, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "mono", 1.0); } @@ -425,69 +375,69 @@ void _3x3puzzle_state::_3x3puzzle(machine_config &config) ***************************************************************************/ ROM_START( 3x3puzzl ) - ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 code */ + ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "1.bin", 0x000000, 0x20000, CRC(e9c39ee7) SHA1(8557eeaff33ac8e11fd545482bd9e48f9a58eba3) ) ROM_LOAD16_BYTE( "2.bin", 0x000001, 0x20000, CRC(524963be) SHA1(05428ccc823c35b6c4d182a1dff1c9aa6b71e616) ) - ROM_REGION( 0x200000, "gfx1", ROMREGION_ERASE00 ) + ROM_REGION( 0x200000, "tiles1", ROMREGION_ERASE00 ) ROM_LOAD32_BYTE("3.bin", 0x000000, 0x080000, CRC(53c2aa6a) SHA1(d2ebb10eb8311ff5226793e7b373e152b21c602c) ) ROM_LOAD32_BYTE("4.bin", 0x000001, 0x080000, CRC(fb0b76fd) SHA1(23c9a5979452c21381107641d5cd49b34ad00471) ) ROM_LOAD32_BYTE("5.bin", 0x000002, 0x080000, CRC(b6c1e108) SHA1(44c97e0582b9ee85465040d56eda9efd06c25533) ) ROM_LOAD32_BYTE("6.bin", 0x000003, 0x080000, CRC(47cb0e8e) SHA1(13d39b1eb4fcfeafc8d821871750f37377449b80) ) - ROM_REGION( 0x080000, "gfx2", ROMREGION_ERASE00 ) - ROM_LOAD32_BYTE("7.bin", 0x000000, 0x020000, CRC(45b1f58b) SHA1(7faee993b87ef14eef1c5ba3fcc7d0747494dbf5) ) - ROM_LOAD32_BYTE("8.bin", 0x000001, 0x020000, CRC(c0d404a7) SHA1(7991e711f6933bc3809f3c562e21a775a9a2dcf3) ) - ROM_LOAD32_BYTE("9.bin", 0x000002, 0x020000, CRC(6b303aa9) SHA1(1750da9148978f59904c2bf9e99f967e5bdd5a92) ) - ROM_LOAD32_BYTE("10.bin", 0x000003, 0x020000, CRC(6d0107bc) SHA1(a6f30a482586136304af510eee0a93df450673bd) ) + ROM_REGION( 0x080000, "tiles2", ROMREGION_ERASE00 ) + ROM_LOAD32_BYTE("7.bin", 0x000003, 0x020000, CRC(45b1f58b) SHA1(7faee993b87ef14eef1c5ba3fcc7d0747494dbf5) ) + ROM_LOAD32_BYTE("8.bin", 0x000002, 0x020000, CRC(c0d404a7) SHA1(7991e711f6933bc3809f3c562e21a775a9a2dcf3) ) + ROM_LOAD32_BYTE("9.bin", 0x000001, 0x020000, CRC(6b303aa9) SHA1(1750da9148978f59904c2bf9e99f967e5bdd5a92) ) + ROM_LOAD32_BYTE("10.bin", 0x000000, 0x020000, CRC(6d0107bc) SHA1(a6f30a482586136304af510eee0a93df450673bd) ) - ROM_REGION( 0x080000, "gfx3", ROMREGION_ERASE00 ) - ROM_LOAD32_BYTE("11.bin", 0x000000, 0x020000, CRC(e124c0b5) SHA1(9b819691b7ca7f0561f4fce05083c8507e138bfe) ) - ROM_LOAD32_BYTE("12.bin", 0x000001, 0x020000, CRC(ae4a8707) SHA1(f54337e4b666dc2f38df0ea96e9c8f4d7c4ebe52) ) - ROM_LOAD32_BYTE("13.bin", 0x000002, 0x020000, CRC(f06925d1) SHA1(a45b72da57c7d967dec2fcad12e6a7864f5442e8) ) - ROM_LOAD32_BYTE("14.bin", 0x000003, 0x020000, CRC(07252636) SHA1(00730c203e20af9e18a792e26de7aeac5d090ebf) ) + ROM_REGION( 0x080000, "tiles3", ROMREGION_ERASE00 ) + ROM_LOAD32_BYTE("11.bin", 0x000003, 0x020000, CRC(e124c0b5) SHA1(9b819691b7ca7f0561f4fce05083c8507e138bfe) ) + ROM_LOAD32_BYTE("12.bin", 0x000002, 0x020000, CRC(ae4a8707) SHA1(f54337e4b666dc2f38df0ea96e9c8f4d7c4ebe52) ) + ROM_LOAD32_BYTE("13.bin", 0x000001, 0x020000, CRC(f06925d1) SHA1(a45b72da57c7d967dec2fcad12e6a7864f5442e8) ) + ROM_LOAD32_BYTE("14.bin", 0x000000, 0x020000, CRC(07252636) SHA1(00730c203e20af9e18a792e26de7aeac5d090ebf) ) - ROM_REGION(0x80000, "oki", 0 ) + ROM_REGION( 0x80000, "oki", 0 ) ROM_LOAD("15.bin", 0x000000, 0x080000, CRC(d3aff355) SHA1(117f7bbd6cab370f65e308d78291732dfc079365) ) ROM_END ROM_START( 3x3puzzla ) - ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 code */ + ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "1a.bin", 0x000000, 0x20000, CRC(425c5896) SHA1(78d709b729f160b1e20a61a795361113dbb4fb52) ) ROM_LOAD16_BYTE( "2a.bin", 0x000001, 0x20000, CRC(4db710b7) SHA1(df7a3496aac9cfdaee4fd504d88772b07a8fdb2b) ) - ROM_REGION( 0x200000, "gfx1", ROMREGION_ERASE00 ) + ROM_REGION( 0x200000, "tiles1", ROMREGION_ERASE00 ) ROM_LOAD32_BYTE("3a.bin", 0x000000, 0x080000, CRC(33bff952) SHA1(11d06462041e7cf8aa2ae422ed74ba23f6934478) ) ROM_LOAD32_BYTE("4a.bin", 0x000001, 0x080000, CRC(222996d8) SHA1(fb8fd45a43e78dd9700ffb46fa886f62e7c32e61) ) ROM_LOAD32_BYTE("5a.bin", 0x000002, 0x080000, CRC(5b209844) SHA1(8a34958ecd9c26272708237028e279dd347c729f) ) ROM_LOAD32_BYTE("6a.bin", 0x000003, 0x080000, CRC(f1136bba) SHA1(486c41bd08c4039bfe46500540fc4ae0f1497232) ) - ROM_REGION( 0x080000, "gfx2", ROMREGION_ERASE00 ) - ROM_LOAD32_BYTE("7.bin", 0x000000, 0x020000, CRC(45b1f58b) SHA1(7faee993b87ef14eef1c5ba3fcc7d0747494dbf5) ) - ROM_LOAD32_BYTE("8.bin", 0x000001, 0x020000, CRC(c0d404a7) SHA1(7991e711f6933bc3809f3c562e21a775a9a2dcf3) ) - ROM_LOAD32_BYTE("9.bin", 0x000002, 0x020000, CRC(6b303aa9) SHA1(1750da9148978f59904c2bf9e99f967e5bdd5a92) ) - ROM_LOAD32_BYTE("10.bin", 0x000003, 0x020000, CRC(6d0107bc) SHA1(a6f30a482586136304af510eee0a93df450673bd) ) + ROM_REGION( 0x080000, "tiles2", ROMREGION_ERASE00 ) + ROM_LOAD32_BYTE("7.bin", 0x000003, 0x020000, CRC(45b1f58b) SHA1(7faee993b87ef14eef1c5ba3fcc7d0747494dbf5) ) + ROM_LOAD32_BYTE("8.bin", 0x000002, 0x020000, CRC(c0d404a7) SHA1(7991e711f6933bc3809f3c562e21a775a9a2dcf3) ) + ROM_LOAD32_BYTE("9.bin", 0x000001, 0x020000, CRC(6b303aa9) SHA1(1750da9148978f59904c2bf9e99f967e5bdd5a92) ) + ROM_LOAD32_BYTE("10.bin", 0x000000, 0x020000, CRC(6d0107bc) SHA1(a6f30a482586136304af510eee0a93df450673bd) ) - ROM_REGION( 0x080000, "gfx3", ROMREGION_ERASE00 ) - ROM_LOAD32_BYTE("11.bin", 0x000000, 0x020000, CRC(e124c0b5) SHA1(9b819691b7ca7f0561f4fce05083c8507e138bfe) ) - ROM_LOAD32_BYTE("12.bin", 0x000001, 0x020000, CRC(ae4a8707) SHA1(f54337e4b666dc2f38df0ea96e9c8f4d7c4ebe52) ) - ROM_LOAD32_BYTE("13.bin", 0x000002, 0x020000, CRC(f06925d1) SHA1(a45b72da57c7d967dec2fcad12e6a7864f5442e8) ) - ROM_LOAD32_BYTE("14.bin", 0x000003, 0x020000, CRC(07252636) SHA1(00730c203e20af9e18a792e26de7aeac5d090ebf) ) + ROM_REGION( 0x080000, "tiles3", ROMREGION_ERASE00 ) + ROM_LOAD32_BYTE("11.bin", 0x000003, 0x020000, CRC(e124c0b5) SHA1(9b819691b7ca7f0561f4fce05083c8507e138bfe) ) + ROM_LOAD32_BYTE("12.bin", 0x000002, 0x020000, CRC(ae4a8707) SHA1(f54337e4b666dc2f38df0ea96e9c8f4d7c4ebe52) ) + ROM_LOAD32_BYTE("13.bin", 0x000001, 0x020000, CRC(f06925d1) SHA1(a45b72da57c7d967dec2fcad12e6a7864f5442e8) ) + ROM_LOAD32_BYTE("14.bin", 0x000000, 0x020000, CRC(07252636) SHA1(00730c203e20af9e18a792e26de7aeac5d090ebf) ) - ROM_REGION(0x80000, "oki", 0 ) + ROM_REGION( 0x80000, "oki", 0 ) ROM_LOAD("15.bin", 0x000000, 0x080000, CRC(d3aff355) SHA1(117f7bbd6cab370f65e308d78291732dfc079365) ) ROM_END ROM_START( casanova ) - ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 Code */ + ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 Code ROM_LOAD16_BYTE( "casanova.u7", 0x00001, 0x40000, CRC(869c2bf2) SHA1(58d349fa92880b20e9a58c576002972e46cd7eb2) ) ROM_LOAD16_BYTE( "casanova.u8", 0x00000, 0x40000, CRC(9df77f4b) SHA1(e2da1440406be715b349c9bf5263cb7bd8ef69d9) ) - ROM_REGION( 0x0c0000, "oki", 0 ) /* Samples */ + ROM_REGION( 0x0c0000, "oki", 0 ) // Samples ROM_LOAD( "casanova.su2", 0x00000, 0x80000, CRC(84a8320e) SHA1(4d0b4120174b2aa726db8e324d5614e3f0cefe95) ) ROM_LOAD( "casanova.su3", 0x80000, 0x40000, CRC(334a2d1a) SHA1(d3eb5627a711a78c52a1fdd573a7f91442ccfa49) ) - ROM_REGION( 0x400000, "gfx1", 0 ) + ROM_REGION( 0x400000, "tiles1", 0 ) ROM_LOAD32_BYTE( "casanova.u23", 0x000000, 0x80000, CRC(4bd4e5b1) SHA1(13759d086ef2dba26129022bade12be11b81258e) ) ROM_LOAD32_BYTE( "casanova.u25", 0x000001, 0x80000, CRC(5461811b) SHA1(03301c836ba378e527867de25ee15abd3a0434ac)) ROM_LOAD32_BYTE( "casanova.u27", 0x000002, 0x80000, CRC(dd178379) SHA1(990109db9d0ce693cf7371109cb0d4745b8dde59)) @@ -497,17 +447,17 @@ ROM_START( casanova ) ROM_LOAD32_BYTE( "casanova.u85", 0x200002, 0x80000, CRC(113c6e3a) SHA1(e90d78c4415d244004734a481501f8040f8aa468) ) ROM_LOAD32_BYTE( "casanova.u87", 0x200003, 0x80000, CRC(61bd80f8) SHA1(13b93f2638c37a5dec5b4016c058f486f9cbadae) ) - ROM_REGION( 0x200000, "gfx2", 0 ) - ROM_LOAD32_BYTE( "casanova.u39", 0x000003, 0x80000, CRC(97d4095a) SHA1(4b1fde984025fae240bf64f812d67bc9cbf3a60c) ) - ROM_LOAD32_BYTE( "casanova.u41", 0x000002, 0x80000, CRC(95f67e82) SHA1(34b4350efbe22eb57871b009016adc2660842030) ) - ROM_LOAD32_BYTE( "casanova.u43", 0x000001, 0x80000, CRC(1462d7d6) SHA1(5637c2d0df5866b72d0c8804f23694fa5a025c8d) ) - ROM_LOAD32_BYTE( "casanova.u45", 0x000000, 0x80000, CRC(530d78bc) SHA1(56d6f593da9211d4785f35a9796d593beeb6b224) ) - - ROM_REGION( 0x200000, "gfx3", 0 ) - ROM_LOAD32_BYTE( "casanova.u48", 0x000003, 0x80000, CRC(af9f59c5) SHA1(8620579045632ec6a4cd8fc4bff48428c94c8139) ) - ROM_LOAD32_BYTE( "casanova.u50", 0x000002, 0x80000, CRC(c73b5e98) SHA1(07d0be244aba084bd1ef099b547fe1c8e813cbeb) ) - ROM_LOAD32_BYTE( "casanova.u52", 0x000001, 0x80000, CRC(708f779c) SHA1(2272be3971d8983695f9fa7c840d94bdc0e4b0e6) ) - ROM_LOAD32_BYTE( "casanova.u54", 0x000000, 0x80000, CRC(e60bf0db) SHA1(503738b3b83a37ff812beed6c71e915072e5b10f) ) + ROM_REGION( 0x200000, "tiles2", 0 ) + ROM_LOAD32_BYTE( "casanova.u39", 0x000000, 0x80000, CRC(97d4095a) SHA1(4b1fde984025fae240bf64f812d67bc9cbf3a60c) ) + ROM_LOAD32_BYTE( "casanova.u41", 0x000001, 0x80000, CRC(95f67e82) SHA1(34b4350efbe22eb57871b009016adc2660842030) ) + ROM_LOAD32_BYTE( "casanova.u43", 0x000002, 0x80000, CRC(1462d7d6) SHA1(5637c2d0df5866b72d0c8804f23694fa5a025c8d) ) + ROM_LOAD32_BYTE( "casanova.u45", 0x000003, 0x80000, CRC(530d78bc) SHA1(56d6f593da9211d4785f35a9796d593beeb6b224) ) + + ROM_REGION( 0x200000, "tiles3", 0 ) + ROM_LOAD32_BYTE( "casanova.u48", 0x000000, 0x80000, CRC(af9f59c5) SHA1(8620579045632ec6a4cd8fc4bff48428c94c8139) ) + ROM_LOAD32_BYTE( "casanova.u50", 0x000001, 0x80000, CRC(c73b5e98) SHA1(07d0be244aba084bd1ef099b547fe1c8e813cbeb) ) + ROM_LOAD32_BYTE( "casanova.u52", 0x000002, 0x80000, CRC(708f779c) SHA1(2272be3971d8983695f9fa7c840d94bdc0e4b0e6) ) + ROM_LOAD32_BYTE( "casanova.u54", 0x000003, 0x80000, CRC(e60bf0db) SHA1(503738b3b83a37ff812beed6c71e915072e5b10f) ) ROM_END } // anonymous namespace From ef900070fa61b66dc518017efd4207ba057d2c0a Mon Sep 17 00:00:00 2001 From: cam900 Date: Mon, 13 May 2024 02:13:32 +0900 Subject: [PATCH 06/16] promat/1945kiii.cpp: Use generic gfx decode layout, Cleanups: (#12323) - Use C++ style comment for single line comments - Reduce preprocessor defines - Constantize variables --- src/mame/promat/1945kiii.cpp | 134 ++++++++++++++++------------------- 1 file changed, 61 insertions(+), 73 deletions(-) diff --git a/src/mame/promat/1945kiii.cpp b/src/mame/promat/1945kiii.cpp index 3030aa47bb0..8c230999e69 100644 --- a/src/mame/promat/1945kiii.cpp +++ b/src/mame/promat/1945kiii.cpp @@ -109,8 +109,6 @@ SPR800E on the Solite Spirits PCB silkscreened PROMAT SPR800E ES928 namespace { -#define MASTER_CLOCK XTAL(16'000'000) - class k3_state : public driver_device { @@ -149,13 +147,13 @@ class k3_state : public driver_device void flagrall_map(address_map &map); void k3_base_map(address_map &map); - /* devices */ + // devices optional_device_array m_oki; - /* memory pointers */ + // memory pointers required_shared_ptr_array m_spriteram; required_shared_ptr m_bgram; - /* video-related */ + // video-related std::unique_ptr m_spriteram_buffer[2]{}; std::unique_ptr m_bgram_buffer{}; bool m_refresh = false; @@ -193,12 +191,12 @@ void k3_state::k3_drawgfx(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_eleme u32 code,u32 color,bool flipx,bool flipy,int offsx,int offsy, u8 transparent_color, bool flicker) { - /* Start drawing */ + // Start drawing const u16 pal = gfx->colorbase() + gfx->granularity() * (color % gfx->colors()); - const u8 *source_base = gfx->get_data(code % gfx->elements()); + const u8 *const source_base = gfx->get_data(code % gfx->elements()); - int xinc = flipx ? -1 : 1; - int yinc = flipy ? -1 : 1; + int const xinc = flipx ? -1 : 1; + int const yinc = flipy ? -1 : 1; int x_index_base = flipx ? gfx->width() - 1 : 0; int y_index = flipy ? gfx->height() - 1 : 0; @@ -242,7 +240,7 @@ void k3_state::k3_drawgfx(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_eleme int x_index = x_index_base; for (int x = sx; x < ex; x++) { - u8 c = source[x_index]; + u8 const c = source[x_index]; if (c != transparent_color) { if (flicker) // verified from PCB (reference : https://www.youtube.com/watch?v=ooXyyvpW1O0) @@ -268,9 +266,9 @@ void k3_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) const u32 max_cycle = m_screen->width() * m_screen->height(); // max usable cycle for sprites, TODO : related to whole screen? u32 cycle = 0; gfx_element *gfx = m_gfxdecode->gfx(0); - u16 *source = m_spriteram_buffer[0].get(); - u16 *source2 = m_spriteram_buffer[1].get(); - u16 *finish = source + (m_spriteram[0].bytes() / 2); + const u16 *source = m_spriteram_buffer[0].get(); + const u16 *source2 = m_spriteram_buffer[1].get(); + const u16 *finish = source + (m_spriteram[0].bytes() / 2); while (source < finish) { @@ -278,10 +276,10 @@ void k3_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) if (cycle > max_cycle) break; - int xpos = (source[0] & 0xff00) >> 8 | (source2[0] & 0x0001) << 8; - int ypos = (source[0] & 0x00ff) >> 0; - u32 tileno = (source2[0] & 0x7ffe) >> 1; - bool flicker = BIT(source2[0], 15); + const int xpos = (source[0] & 0xff00) >> 8 | (source2[0] & 0x0001) << 8; + const int ypos = (source[0] & 0x00ff) >> 0; + const u32 tileno = (source2[0] & 0x7ffe) >> 1; + const bool flicker = BIT(source2[0], 15); k3_drawgfx(bitmap, cliprect, gfx, tileno, 1, false, false, xpos, ypos, 0, flicker); k3_drawgfx(bitmap, cliprect, gfx, tileno, 1, false, false, xpos, ypos - 0x100, 0, flicker); // wrap @@ -431,7 +429,7 @@ static INPUT_PORTS_START( k3 ) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START2 ) - PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* Are these used at all? */ + PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Are these used at all? PORT_START("DSW") PORT_DIPNAME( 0x007, 0x0007, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3") @@ -493,7 +491,7 @@ static INPUT_PORTS_START( k3old ) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START2 ) - PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* Are these used at all? */ + PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Are these used at all? PORT_START("DSW") PORT_DIPNAME( 0x007, 0x0007, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3") @@ -551,7 +549,7 @@ static INPUT_PORTS_START( solite ) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START2 ) - PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* Are these used at all? */ + PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Are these used at all? PORT_START("DSW") PORT_DIPNAME( 0x007, 0x0007, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3") @@ -645,23 +643,13 @@ static INPUT_PORTS_START( flagrall ) INPUT_PORTS_END -static const gfx_layout k3_layout = -{ - 16,16, - RGN_FRAC(1,1), - 8, - { STEP8(0,1) }, - { STEP16(0,8) }, - { STEP16(0,8*16) }, - 16*128, -}; - - static GFXDECODE_START( gfx_1945kiii ) - GFXDECODE_ENTRY( "gfx1", 0, k3_layout, 0x000, 2 ) /* sprites */ - GFXDECODE_ENTRY( "gfx2", 0, k3_layout, 0x000, 2 ) /* bg tiles */ + GFXDECODE_ENTRY( "sprites", 0, gfx_16x16x8_raw, 0x000, 2 ) // sprites + GFXDECODE_ENTRY( "tiles", 0, gfx_16x16x8_raw, 0x000, 2 ) // bg tiles GFXDECODE_END +static constexpr XTAL MASTER_CLOCK = XTAL(16'000'000); + void k3_state::flagrall(machine_config &config) { @@ -680,7 +668,7 @@ void k3_state::flagrall(machine_config &config) SPEAKER(config, "mono").front_center(); - OKIM6295(config, m_oki[0], MASTER_CLOCK/16, okim6295_device::PIN7_HIGH); /* dividers? */ + OKIM6295(config, m_oki[0], MASTER_CLOCK/16, okim6295_device::PIN7_HIGH); // dividers? m_oki[0]->add_route(ALL_OUTPUTS, "mono", 1.0); } @@ -691,7 +679,7 @@ void k3_state::k3(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &k3_state::k3_map); - OKIM6295(config, m_oki[1], MASTER_CLOCK/16, okim6295_device::PIN7_HIGH); /* dividers? */ + OKIM6295(config, m_oki[1], MASTER_CLOCK/16, okim6295_device::PIN7_HIGH); // dividers? m_oki[1]->add_route(ALL_OUTPUTS, "mono", 1.0); m_screen->set_raw(XTAL(27'000'000)/4, 432, 0, 320, 262, 0, 224); // ~60Hz @@ -700,65 +688,65 @@ void k3_state::k3(machine_config &config) ROM_START( 1945kiii ) - ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */ - ROM_LOAD16_BYTE( "prg-1.u51", 0x00001, 0x80000, CRC(6b345f27) SHA1(60867fa0e2ea7ebdd4b8046315ee0c83e5cf0d74) ) /* identical halves */ - ROM_LOAD16_BYTE( "prg-2.u52", 0x00000, 0x80000, CRC(ce09b98c) SHA1(a06bb712b9cf2249cc535de4055b14a21c68e0c5) ) /* identical halves */ + ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 Code + ROM_LOAD16_BYTE( "prg-1.u51", 0x00001, 0x80000, CRC(6b345f27) SHA1(60867fa0e2ea7ebdd4b8046315ee0c83e5cf0d74) ) // identical halves + ROM_LOAD16_BYTE( "prg-2.u52", 0x00000, 0x80000, CRC(ce09b98c) SHA1(a06bb712b9cf2249cc535de4055b14a21c68e0c5) ) // identical halves - ROM_REGION( 0x080000, "oki2", 0 ) /* Samples */ + ROM_REGION( 0x080000, "oki2", 0 ) // Samples ROM_LOAD( "snd-2.su4", 0x00000, 0x80000, CRC(47e3952e) SHA1(d56524621a3f11981e4434e02f5fdb7e89fff0b4) ) - ROM_REGION( 0x080000, "oki1", 0 ) /* Samples */ + ROM_REGION( 0x080000, "oki1", 0 ) // Samples ROM_LOAD( "snd-1.su7", 0x00000, 0x80000, CRC(bbb7f0ff) SHA1(458cf3a0c2d42110bc2427db675226c6b8d30999) ) - ROM_REGION( 0x400000, "gfx1", 0 ) // sprites + ROM_REGION( 0x400000, "sprites", 0 ) ROM_LOAD32_WORD( "m16m-1.u62", 0x000000, 0x200000, CRC(0b9a6474) SHA1(6110ecb17d0fef25935986af9a251fc6e88e3993) ) ROM_LOAD32_WORD( "m16m-2.u63", 0x000002, 0x200000, CRC(368a8c2e) SHA1(4b1f360c4a3a86d922035774b2c712be810ec548) ) - ROM_REGION( 0x200000, "gfx2", 0 ) // bg tiles + ROM_REGION( 0x200000, "tiles", 0 ) ROM_LOAD( "m16m-3.u61", 0x00000, 0x200000, CRC(32fc80dd) SHA1(bee32493a250e9f21997114bba26b9535b1b636c) ) ROM_END ROM_START( 1945kiiin ) - ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */ - ROM_LOAD16_BYTE( "u34", 0x00001, 0x80000, CRC(d0cf4f03) SHA1(3455927221afae5103c02b12c1b855f416c47e91) ) /* 27C040 ROM had no label - identical halves */ - ROM_LOAD16_BYTE( "u35", 0x00000, 0x80000, CRC(056c64ed) SHA1(b0eddad9c950676b94316d3aeb32f3ed4b9ade0f) ) /* 27C040 ROM had no label - identical halves */ + ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 Code + ROM_LOAD16_BYTE( "u34", 0x00001, 0x80000, CRC(d0cf4f03) SHA1(3455927221afae5103c02b12c1b855f416c47e91) ) // 27C040 ROM had no label - identical halves + ROM_LOAD16_BYTE( "u35", 0x00000, 0x80000, CRC(056c64ed) SHA1(b0eddad9c950676b94316d3aeb32f3ed4b9ade0f) ) // 27C040 ROM had no label - identical halves - ROM_REGION( 0x080000, "oki2", 0 ) /* Samples */ - ROM_LOAD( "snd-2.su4", 0x00000, 0x80000, CRC(47e3952e) SHA1(d56524621a3f11981e4434e02f5fdb7e89fff0b4) ) /* ROM had no label, but same data as SND-2.SU4 */ + ROM_REGION( 0x080000, "oki2", 0 ) // Samples + ROM_LOAD( "snd-2.su4", 0x00000, 0x80000, CRC(47e3952e) SHA1(d56524621a3f11981e4434e02f5fdb7e89fff0b4) ) // ROM had no label, but same data as SND-2.SU4 - ROM_REGION( 0x080000, "oki1", 0 ) /* Samples */ - ROM_LOAD( "snd-1.su7", 0x00000, 0x80000, CRC(bbb7f0ff) SHA1(458cf3a0c2d42110bc2427db675226c6b8d30999) ) /* ROM had no label, but same data as SND-1.SU7 */ + ROM_REGION( 0x080000, "oki1", 0 ) // Samples + ROM_LOAD( "snd-1.su7", 0x00000, 0x80000, CRC(bbb7f0ff) SHA1(458cf3a0c2d42110bc2427db675226c6b8d30999) ) // ROM had no label, but same data as SND-1.SU7 - ROM_REGION( 0x400000, "gfx1", 0 ) // sprites - ROM_LOAD32_BYTE( "u5", 0x000000, 0x080000, CRC(f328f85e) SHA1(fe1e1b86a77a9b6da0f69b20da64e69b874d8ef9) ) /* These 4 27C040 ROMs had no label */ + ROM_REGION( 0x400000, "sprites", 0 ) + ROM_LOAD32_BYTE( "u5", 0x000000, 0x080000, CRC(f328f85e) SHA1(fe1e1b86a77a9b6da0f69b20da64e69b874d8ef9) ) // These 4 27C040 ROMs had no label ROM_LOAD32_BYTE( "u6", 0x000001, 0x080000, CRC(cfdabf1b) SHA1(9822def10e5213d1b5c86034637481b5349bfb70) ) ROM_LOAD32_BYTE( "u7", 0x000002, 0x080000, CRC(59a6a944) SHA1(20a109edddd8ab9530b94b3b2d2f8a85af2c08f8) ) ROM_LOAD32_BYTE( "u8", 0x000003, 0x080000, CRC(59995aaf) SHA1(29c2c638b0dd2bf1e79707ea6f5b38b37f45b822) ) - ROM_LOAD32_BYTE( "u58", 0x200000, 0x080000, CRC(6acf2ce4) SHA1(4b18678a9e03beb24494270d19c57bca32a72592) ) /* These 4 27C040 ROMs had no label */ + ROM_LOAD32_BYTE( "u58", 0x200000, 0x080000, CRC(6acf2ce4) SHA1(4b18678a9e03beb24494270d19c57bca32a72592) ) // These 4 27C040 ROMs had no label ROM_LOAD32_BYTE( "u59", 0x200001, 0x080000, CRC(ca6ff210) SHA1(d7e476bb41c193654495f5ed6ba39980cb3660bc) ) ROM_LOAD32_BYTE( "u60", 0x200002, 0x080000, CRC(91eb038a) SHA1(b24082ba1675e87881a321ba87e079a1a027dfa4) ) ROM_LOAD32_BYTE( "u61", 0x200003, 0x080000, CRC(1b358c6d) SHA1(1abe6422b420fd064a32ed9ca9a28c85996d4e57) ) - ROM_REGION( 0x200000, "gfx2", 0 ) - ROM_LOAD32_BYTE( "5.u102", 0x000000, 0x80000, CRC(91b70a6b) SHA1(e53f62212d6e3ab5f892944b1933385a85e0ba8a) ) /* These 4 ROMs had no label */ - ROM_LOAD32_BYTE( "6.u103", 0x000001, 0x80000, CRC(7b5bfb85) SHA1(ef59d64513c7f7e6ee3dcc9bb7bb0e14a71ca957) ) /* Same data as M16M-3.U61, just split up */ + ROM_REGION( 0x200000, "tiles", 0 ) + ROM_LOAD32_BYTE( "5.u102", 0x000000, 0x80000, CRC(91b70a6b) SHA1(e53f62212d6e3ab5f892944b1933385a85e0ba8a) ) // These 4 ROMs had no label + ROM_LOAD32_BYTE( "6.u103", 0x000001, 0x80000, CRC(7b5bfb85) SHA1(ef59d64513c7f7e6ee3dcc9bb7bb0e14a71ca957) ) // Same data as M16M-3.U61, just split up ROM_LOAD32_BYTE( "7.u104", 0x000002, 0x80000, CRC(cdafcedf) SHA1(82becd002a16185220131085db6576eb763429c8) ) ROM_LOAD32_BYTE( "8.u105", 0x000003, 0x80000, CRC(2c3895d5) SHA1(ab5837d996c1bb70071db02f07412c182d7547f8) ) ROM_END ROM_START( 1945kiiio ) - ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */ - ROM_LOAD16_BYTE( "3.u34", 0x00001, 0x80000, CRC(5515baa0) SHA1(6fd4c9b7cc27035d6baaafa73f5f5930bfde62a4) ) /* 0x40000 to 0x7FFFF 0x00 padded */ - ROM_LOAD16_BYTE( "4.u35", 0x00000, 0x80000, CRC(fd177664) SHA1(0ea1854be8d88577129546a56d13bcdc4739ae52) ) /* 0x40000 to 0x7FFFF 0x00 padded */ + ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 Code + ROM_LOAD16_BYTE( "3.u34", 0x00001, 0x80000, CRC(5515baa0) SHA1(6fd4c9b7cc27035d6baaafa73f5f5930bfde62a4) ) // 0x40000 to 0x7FFFF 0x00 padded + ROM_LOAD16_BYTE( "4.u35", 0x00000, 0x80000, CRC(fd177664) SHA1(0ea1854be8d88577129546a56d13bcdc4739ae52) ) // 0x40000 to 0x7FFFF 0x00 padded - ROM_REGION( 0x080000, "oki2", 0 ) /* Samples */ + ROM_REGION( 0x080000, "oki2", 0 ) // Samples ROM_LOAD( "s21.su5", 0x00000, 0x80000, CRC(9d96fd55) SHA1(80025cc2c44e8cd938620818e0b0974026377f5c) ) - ROM_REGION( 0x080000, "oki1", 0 ) /* Samples */ + ROM_REGION( 0x080000, "oki1", 0 ) // Samples ROM_LOAD( "s13.su4", 0x00000, 0x80000, CRC(d45aec3b) SHA1(fc182a10e19687eb2f2f4a1d2ad976814185f0fc) ) - ROM_REGION( 0x400000, "gfx1", 0 ) // sprites + ROM_REGION( 0x400000, "sprites", 0 ) ROM_LOAD32_BYTE( "9.u5", 0x000000, 0x080000, CRC(be0f432e) SHA1(7d63f97a8cb38c5351f2cd2f720de16a0c4ab1d7) ) ROM_LOAD32_BYTE( "10.u6", 0x000001, 0x080000, CRC(cf9127b2) SHA1(e02f436662f47d8bb5a9d726889c6e86cf64bdcf) ) ROM_LOAD32_BYTE( "11.u7", 0x000002, 0x080000, CRC(644ee8cc) SHA1(1742e31ba48a93c005cce0dc575d9b5d739d1dce) ) @@ -769,25 +757,25 @@ ROM_START( 1945kiiio ) ROM_LOAD32_BYTE( "15.u60", 0x200002, 0x080000, CRC(86ab6c7c) SHA1(59acaee6ba78a22f1423832a116ad41e19522aa1) ) ROM_LOAD32_BYTE( "16.u61", 0x200003, 0x080000, CRC(ff419080) SHA1(542819bdd60976bddfa96570321ba3f7fb6fbf23) ) - ROM_REGION( 0x200000, "gfx2", 0 ) // bg tiles - ROM_LOAD32_BYTE( "5.u102", 0x000000, 0x80000, CRC(91b70a6b) SHA1(e53f62212d6e3ab5f892944b1933385a85e0ba8a) ) /* Same data as M16M-3.U61, just split up */ + ROM_REGION( 0x200000, "tiles", 0 ) + ROM_LOAD32_BYTE( "5.u102", 0x000000, 0x80000, CRC(91b70a6b) SHA1(e53f62212d6e3ab5f892944b1933385a85e0ba8a) ) // Same data as M16M-3.U61, just split up ROM_LOAD32_BYTE( "6.u103", 0x000001, 0x80000, CRC(7b5bfb85) SHA1(ef59d64513c7f7e6ee3dcc9bb7bb0e14a71ca957) ) ROM_LOAD32_BYTE( "7.u104", 0x000002, 0x80000, CRC(cdafcedf) SHA1(82becd002a16185220131085db6576eb763429c8) ) ROM_LOAD32_BYTE( "8.u105", 0x000003, 0x80000, CRC(2c3895d5) SHA1(ab5837d996c1bb70071db02f07412c182d7547f8) ) ROM_END ROM_START( slspirit ) - ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */ + ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 Code ROM_LOAD16_BYTE( "3.u34", 0x00001, 0x40000, CRC(b5ac3272) SHA1(da223ef3b006be03a11559e00ae9d7bbd2d06ee5) ) ROM_LOAD16_BYTE( "4.u35", 0x00000, 0x40000, CRC(86397bcb) SHA1(562dbb82c363039152aa574df72f73e9f71805d9) ) - ROM_REGION( 0x080000, "oki2", 0 ) /* Samples */ + ROM_REGION( 0x080000, "oki2", 0 ) // Samples ROM_LOAD( "s21.su5", 0x00000, 0x80000, CRC(d4cbc27c) SHA1(feffa530baa4d70788a3598a12761827694a6275) ) - ROM_REGION( 0x080000, "oki1", 0 ) /* Samples */ + ROM_REGION( 0x080000, "oki1", 0 ) // Samples ROM_LOAD( "s13.su4", 0x00000, 0x80000, CRC(d9c63d55) SHA1(7fd2fc08c859947dd4b1490132597ae23fcbed36) ) - ROM_REGION( 0x400000, "gfx1", 0 ) // sprites + ROM_REGION( 0x400000, "sprites", 0 ) ROM_LOAD32_BYTE( "9.u5", 0x000000, 0x080000, CRC(4742aa38) SHA1(6e8d53afe7a6a5d60c135dd6a283d5bb47821f48) ) ROM_LOAD32_BYTE( "10.u6", 0x000001, 0x080000, CRC(c137fb33) SHA1(6798bc4569bdcab02c2b16315c8827268e5674eb) ) ROM_LOAD32_BYTE( "11.u7", 0x000002, 0x080000, CRC(d0593a03) SHA1(544e345e0849239b8156df8c50568bb2e2685bd3) ) @@ -798,7 +786,7 @@ ROM_START( slspirit ) ROM_LOAD32_BYTE( "15.u60", 0x200002, 0x080000, CRC(31f9b034) SHA1(d3224d9f11236fcaa65d477b87c46bea8a69db01) ) ROM_LOAD32_BYTE( "16.u61", 0x200003, 0x080000, CRC(c1fc95e5) SHA1(2597e8553deb751d1a199c4eb3f321f0564b9c76) ) - ROM_REGION( 0x200000, "gfx2", 0 ) // bg tiles + ROM_REGION( 0x200000, "tiles", 0 ) ROM_LOAD32_BYTE( "5.u102", 0x000000, 0x80000, CRC(9f0855a6) SHA1(13aa54641eb188f604cf32bb462331fab4c1bf68) ) ROM_LOAD32_BYTE( "6.u103", 0x000001, 0x80000, CRC(0dda4489) SHA1(cfad31e58adf5aea51c528fb5d7a2f076e6cf0bf) ) ROM_LOAD32_BYTE( "7.u104", 0x000002, 0x80000, CRC(6208cdc7) SHA1(242a93db057b6c01f0031cc8fd33da76baf6c879) ) @@ -807,16 +795,16 @@ ROM_END ROM_START( flagrall ) - ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */ + ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 Code ROM_LOAD16_BYTE( "11_u34.bin", 0x00001, 0x40000, CRC(24dd439d) SHA1(88857ad5ed69f29de86702dcc746d35b69b3b93d) ) ROM_LOAD16_BYTE( "12_u35.bin", 0x00000, 0x40000, CRC(373b71a5) SHA1(be9ab93129e2ffd9bfe296c341dbdf47f1949ac7) ) - ROM_REGION( 0x100000, "oki1", 0 ) /* Samples */ + ROM_REGION( 0x100000, "oki1", 0 ) // Samples // 3x banks ROM_LOAD( "13_su4.bin", 0x00000, 0x80000, CRC(7b0630b3) SHA1(c615e6630ffd12c122762751c25c249393bf7abd) ) ROM_LOAD( "14_su6.bin", 0x80000, 0x40000, CRC(593b038f) SHA1(b00dcf321fe541ee52c34b79e69c44f3d7a9cd7c) ) - ROM_REGION( 0x300000, "gfx1", 0 ) // sprites + ROM_REGION( 0x300000, "sprites", 0 ) ROM_LOAD32_BYTE( "1_u5.bin", 0x000000, 0x080000, CRC(9377704b) SHA1(ac516a8ba6d1a70086469504c2a46d47a1f4560b) ) ROM_LOAD32_BYTE( "5_u6.bin", 0x000001, 0x080000, CRC(1ac0bd0c) SHA1(ab71bb84e61f5c7168601695f332a8d4a30d9948) ) ROM_LOAD32_BYTE( "2_u7.bin", 0x000002, 0x080000, CRC(5f6db2b3) SHA1(84caa019d3b75be30a14d19ccc2f28e5e94028bd) ) @@ -827,7 +815,7 @@ ROM_START( flagrall ) ROM_LOAD32_BYTE( "7_u60.bin", 0x200002, 0x040000, CRC(f187a7bf) SHA1(f4ce9ac9fe376250fe426de6ee404fc7841ef08a) ) ROM_LOAD32_BYTE( "8_u61.bin", 0x200003, 0x040000, CRC(b73fa441) SHA1(a5a3533563070c870276ead5e2f9cb9aaba303cc)) - ROM_REGION( 0x100000, "gfx2", 0 ) // bg tiles + ROM_REGION( 0x100000, "tiles", 0 ) ROM_LOAD( "10_u102.bin", 0x00000, 0x80000, CRC(b1fd3279) SHA1(4a75581e13d43bef441ce81eae518c2f6bc1d5f8) ) ROM_LOAD( "9_u103.bin", 0x80000, 0x80000, CRC(01e6d654) SHA1(821d61a5b16f5cb76e2a805c8504db1ef38c3a48) ) ROM_END From 67fbf437fb349794b6ff1f2659556729a7eeb3b3 Mon Sep 17 00:00:00 2001 From: cam900 Date: Mon, 13 May 2024 02:19:22 +0900 Subject: [PATCH 07/16] midway/midzeus.cpp: Split driver state class per IO config, Cleanups: (#12318) - Use C++ style comments for single line comments - Use logerror.h for logging function - Reduce unnecessary lines, Constantize variables - Reduce preprocessor defines - Fix naming for ROM region and tags - Reduce runtime tag lookups - Move driver init code into machine_start and address map --- src/mame/midway/midzeus.cpp | 695 +++++++++++++++++++--------------- src/mame/midway/midzeus.h | 127 +++---- src/mame/midway/midzeus_v.cpp | 397 +++++++++---------- 3 files changed, 647 insertions(+), 572 deletions(-) diff --git a/src/mame/midway/midzeus.cpp b/src/mame/midway/midzeus.cpp index f2e6ab042d8..8cc955d972d 100644 --- a/src/mame/midway/midzeus.cpp +++ b/src/mame/midway/midzeus.cpp @@ -44,46 +44,43 @@ The Grid v1.2 10/18/2000 #include "crusnexo.lh" +static constexpr int BEAM_DY = 3; +static constexpr int BEAM_DX = 3; +static constexpr int BEAM_XOFFS = 40; // table in the code indicates an offset of 20 with a beam height of 7 + #define LOG_FIREWIRE (1U << 1) #define LOG_DISK (1U << 2) #define LOG_DISK_JR (1U << 3) -#define LOG_UNKNOWN (1U << 4) +#define LOG_TMS32032 (1U << 4) +#define LOG_INPUT (1U << 5) +#define LOG_CMOS (1U << 6) +#define LOG_UNKNOWN (1U << 7) #define VERBOSE (LOG_FIREWIRE) #include "logmacro.h" -#define CPU_CLOCK XTAL(60'000'000) - /************************************************************************* Driver for Midway Zeus2 games **************************************************************************/ class midzeus2_state : public midzeus_state { -public: +protected: midzeus2_state(const machine_config &mconfig, device_type type, const char *tag) : midzeus_state(mconfig, type, tag) , m_zeus(*this, "zeus2") + , m_m48t35(*this, "m48t35") , m_fw_link(*this, "fw_link") , m_fw_phy(*this, "fw_phy") - , m_leds(*this, "led%u", 0U) - , m_lamps(*this, "lamp%u", 0U) + , m_io_keypad(*this, "KEYPAD") { } - void thegrid(machine_config &config); - void crusnexo(machine_config &config); - void midzeus2(machine_config &config); - - void init_crusnexo(); - void init_thegrid(); - -private: virtual void machine_start() override { midzeus_state::machine_start(); - m_leds.resolve(); - m_lamps.resolve(); + m_mainbank->configure_entries(0, 3, memregion("bankeddata")->base(), 0x400000*4); + m_mainbank->set_entry(0); save_item(NAME(m_disk_asic)); save_item(NAME(m_fw_int_enable)); @@ -101,32 +98,109 @@ class midzeus2_state : public midzeus_state virtual void video_start() override {} - void zeus2_map(address_map &map); - uint32_t disk_asic_r(offs_t offset); void disk_asic_w(offs_t offset, uint32_t data); void firewire_irq(int state); void zeus_irq(int state); - uint32_t zeus2_timekeeper_r(offs_t offset); - void zeus2_timekeeper_w(offs_t offset, uint32_t data); - uint32_t crusnexo_leds_r(offs_t offset); - void crusnexo_leds_w(offs_t offset, uint32_t data); + uint32_t zpram_r(offs_t offset); + void zpram_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); + uint32_t timekeeper_r(offs_t offset); + void timekeeper_w(offs_t offset, uint32_t data); void update_firewire_irq(); - uint32_t m_disk_asic[0x10]; + void zeus2_map(address_map &map); + void midzeus2(machine_config &config); + + uint32_t m_disk_asic[0x10]{}; int m_fw_int_enable = 0; int m_fw_int = 0; required_device m_zeus; + required_device m_m48t35; required_device m_fw_link; required_device m_fw_phy; + + required_ioport m_io_keypad; +}; + + +class crusnexo_state : public midzeus2_state +{ +public: + crusnexo_state(const machine_config &mconfig, device_type type, const char *tag) + : midzeus2_state(mconfig, type, tag) + , m_digits(*this, "digit%u", 0U) + , m_leds(*this, "led%u", 0U) + , m_lamps(*this, "lamp%u", 0U) + , m_io_analog(*this, "ANALOG%u", 0U) + { } + + void crusnexo(machine_config &config); + + DECLARE_CUSTOM_INPUT_MEMBER(keypad_r); + +protected: + virtual void machine_start() override + { + midzeus2_state::machine_start(); + + m_digits.resolve(); + m_leds.resolve(); + m_lamps.resolve(); + + save_item(NAME(m_keypad_select)); + save_item(NAME(m_crusnexo_leds_select)); + } + +private: + uint32_t crusnexo_leds_r(offs_t offset); + void crusnexo_leds_w(offs_t offset, uint32_t data); + void keypad_select_w(offs_t offset, uint32_t data); + uint32_t analog_r(offs_t offset); + void analog_w(uint32_t data); + + void crusnexo_map(address_map &map); + + uint8_t m_keypad_select = 0; + uint8_t m_crusnexo_leds_select = 0; + + output_finder<7> m_digits; output_finder<32> m_leds; output_finder<8> m_lamps; + required_ioport_array<4> m_io_analog; }; +class thegrid_state : public midzeus2_state +{ +public: + thegrid_state(const machine_config &mconfig, device_type type, const char *tag) + : midzeus2_state(mconfig, type, tag) + , m_io_49way_x(*this, "49WAYX") + , m_io_49way_y(*this, "49WAYY") + , m_io_trackx(*this, "TRACKX") + , m_io_tracky(*this, "TRACKY") + { } + + void thegrid(machine_config &config); + + DECLARE_CUSTOM_INPUT_MEMBER(custom_49way_r); + +private: + uint32_t trackball_r(offs_t offset); + uint32_t grid_keypad_r(offs_t offset); + + void thegrid_map(address_map &map); + + required_ioport m_io_49way_x; + required_ioport m_io_49way_y; + required_ioport m_io_trackx; + required_ioport m_io_tracky; +}; + + /************************************* @@ -137,30 +211,32 @@ class midzeus2_state : public midzeus_state void midzeus_state::machine_start() { - m_digits.resolve(); - m_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate()); m_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate()); - m_gun_timer[0] = timer_alloc(FUNC(midzeus_state::invasn_gun_callback), this); - m_gun_timer[1] = timer_alloc(FUNC(midzeus_state::invasn_gun_callback), this); - m_display_irq_off_timer = timer_alloc(FUNC(midzeus_state::display_irq_off), this); - save_item(NAME(m_crusnexo_leds_select)); save_item(NAME(m_disk_asic_jr)); save_item(NAME(m_cmos_protected)); +} + +void invasnab_state::machine_start() +{ + midzeus_state::machine_start(); + + m_gun_timer[0] = timer_alloc(FUNC(invasnab_state::invasn_gun_callback), this); + m_gun_timer[1] = timer_alloc(FUNC(invasnab_state::invasn_gun_callback), this); + save_item(NAME(m_gun_control)); save_item(NAME(m_gun_irq_state)); save_item(NAME(m_gun_x)); save_item(NAME(m_gun_y)); - save_item(NAME(m_keypad_select)); } void midzeus_state::machine_reset() { - memcpy(m_ram_base, memregion("user1")->base(), 0x40000*4); + memcpy(m_ram_base, memregion("maindata")->base(), 0x40000*4); *m_ram_base <<= 1; m_maincpu->reset(); @@ -205,7 +281,7 @@ void midzeus_state::cmos_w(offs_t offset, uint32_t data, uint32_t mem_mask) if (m_disk_asic_jr[2] && !m_cmos_protected) COMBINE_DATA(&m_nvram[offset]); else - logerror("%06X:timekeeper_w with disk_asic_jr[2] = %d, cmos_protected = %d\n", m_maincpu->pc(), m_disk_asic_jr[2], m_cmos_protected); + LOGMASKED(LOG_CMOS, "%06X:cmos_w with disk_asic_jr[2] = %d, cmos_protected = %d\n", m_maincpu->pc(), m_disk_asic_jr[2], m_cmos_protected); m_cmos_protected = true; } @@ -230,33 +306,33 @@ void midzeus_state::cmos_protect_w(uint32_t data) * *************************************/ -uint32_t midzeus2_state::zeus2_timekeeper_r(offs_t offset) +uint32_t midzeus2_state::timekeeper_r(offs_t offset) { return m_m48t35->read(offset) | 0xffffff00; } -void midzeus2_state::zeus2_timekeeper_w(offs_t offset, uint32_t data) +void midzeus2_state::timekeeper_w(offs_t offset, uint32_t data) { if (m_disk_asic_jr[2] && !m_cmos_protected) m_m48t35->write(offset, data); else - logerror("%s:zeus2_timekeeper_w with disk_asic_jr[2] = %d, cmos_protected = %d\n", machine().describe_context(), m_disk_asic_jr[2], m_cmos_protected); + LOGMASKED(LOG_CMOS, "%s:timekeeper_w with disk_asic_jr[2] = %d, cmos_protected = %d\n", machine().describe_context(), m_disk_asic_jr[2], m_cmos_protected); m_cmos_protected = true; } -uint32_t midzeus_state::zpram_r(offs_t offset) +uint32_t midzeus2_state::zpram_r(offs_t offset) { return m_nvram[offset] | 0xffffff00; } -void midzeus_state::zpram_w(offs_t offset, uint32_t data, uint32_t mem_mask) +void midzeus2_state::zpram_w(offs_t offset, uint32_t data, uint32_t mem_mask) { if (m_disk_asic_jr[2]) COMBINE_DATA(&m_nvram[offset]); else - logerror("%06X:zpram_w with disk_asic_jr[2] = %d\n", m_maincpu->pc(), m_disk_asic_jr[2]); + LOGMASKED(LOG_CMOS, "%06X:zpram_w with disk_asic_jr[2] = %d\n", m_maincpu->pc(), m_disk_asic_jr[2]); } @@ -370,34 +446,35 @@ uint32_t midzeus_state::disk_asic_jr_r(offs_t offset) case 1: break; - /* CMOS/ZPRAM write enable; only low bit is used */ + // CMOS/ZPRAM write enable; only low bit is used case 2: //return m_disk_asic_jr[offset] | ~1; break; - /* reset status; bit 0 is watchdog reset; mk4/invasn/thegrid read at startup; invasn freaks if it is 1 at startup */ + // reset status; bit 0 is watchdog reset; mk4/invasn/thegrid read at startup; invasn freaks if it is 1 at startup case 3: //return m_disk_asic_jr[offset] | ~1; break; - /* ROM bank selection on Zeus 2; two bits are used */ + // ROM bank selection on Zeus 2; two bits are used case 5: //return m_disk_asic_jr[offset] | ~3; break; - /* disk asic jr id; crusnexo reads at startup: if (val & 0xf0) == 0xa0 it affects */ - /* how the Zeus is used (reg 0x5d is set to 0x54580006) */ - /* thegrid does the same, writing either 0xD4580006 or 0xC4180006 depending */ - /* this is the value reported as DISK JR ASIC version in thegrid startup test */ + // disk asic jr id; crusnexo reads at startup: if (val & 0xf0) == 0xa0 it affects + // how the Zeus is used (reg 0x5d is set to 0x54580006) + // thegrid does the same, writing either 0xD4580006 or 0xC4180006 depending + // this is the value reported as DISK JR ASIC version in thegrid startup test // Set in reset // a0 = Rev3 Athens // 90 = Rev2 Athens case 6: break; - /* unknown purpose */ + // unknown purpose default: - logerror("%06X:disk_asic_jr_r(%X)\n", m_maincpu->pc(), offset); + if (!machine().side_effects_disabled()) + LOGMASKED(LOG_DISK_JR, "%06X:disk_asic_jr_r(%X)\n", m_maincpu->pc(), offset); break; } return retVal; @@ -411,56 +488,57 @@ void midzeus_state::disk_asic_jr_w(offs_t offset, uint32_t data) switch (offset) { - /* disk asic jr led; crusnexo toggles this between 0 and 1 every 20 frames; thegrid writes 1 */ + // disk asic jr led; crusnexo toggles this between 0 and 1 every 20 frames; thegrid writes 1 case 0: if (data != 0 && data != 1) - logerror("%06X:disk_asic_jr_w(%X) = %X (unexpected)\n", m_maincpu->pc(), offset, data); + LOGMASKED(LOG_DISK_JR, "%06X:disk_asic_jr_w(%X) = %X (unexpected)\n", m_maincpu->pc(), offset, data); break; - /* miscellaneous hardware wait states; mk4/invasn write 1 here at initialization; crusnexo/thegrid write 3 */ + // miscellaneous hardware wait states; mk4/invasn write 1 here at initialization; crusnexo/thegrid write 3 case 1: if (data != 1 && data != 3) - logerror("%06X:disk_asic_jr_w(%X) = %X (unexpected)\n", m_maincpu->pc(), offset, data); + LOGMASKED(LOG_DISK_JR, "%06X:disk_asic_jr_w(%X) = %X (unexpected)\n", m_maincpu->pc(), offset, data); break; - /* CMOS/ZPRAM write enable; only low bit is used */ + // CMOS/ZPRAM write enable; only low bit is used case 2: break; - /* reset status; bit 0 is watchdog reset; mk4/invasn/thegrid read at startup; invasn freaks if it is 1 at startup */ + // reset status; bit 0 is watchdog reset; mk4/invasn/thegrid read at startup; invasn freaks if it is 1 at startup case 3: break; - /* unknown purpose; invasn writes 2 here at startup */ + // unknown purpose; invasn writes 2 here at startup case 4: if (data != 2) - logerror("%06X:disk_asic_jr_w(%X) = %X (unexpected)\n", m_maincpu->pc(), offset, data); + LOGMASKED(LOG_DISK_JR, "%06X:disk_asic_jr_w(%X) = %X (unexpected)\n", m_maincpu->pc(), offset, data); break; - /* ROM bank selection on Zeus 2 */ + // ROM bank selection on Zeus 2 case 5: - membank("bank1")->set_entry(m_disk_asic_jr[offset] & 3); + if (m_mainbank) + m_mainbank->set_entry(m_disk_asic_jr[offset] & 3); break; - /* zeus2 ws; 0=zeus access 1 wait state, 2=unlock ROMs; crusnexo/thegrid write 1 at startup */ + // zeus2 ws; 0=zeus access 1 wait state, 2=unlock ROMs; crusnexo/thegrid write 1 at startup case 7: break; - /* romsize; crusnexo writes 4 at startup; thegrid writes 6 */ + // romsize; crusnexo writes 4 at startup; thegrid writes 6 case 8: if (data != 4 && data != 6) - logerror("%06X:disk_asic_jr_w(%X) = %X (unexpected)\n", m_maincpu->pc(), offset, data); + LOGMASKED(LOG_DISK_JR, "%06X:disk_asic_jr_w(%X) = %X (unexpected)\n", m_maincpu->pc(), offset, data); break; - /* trackball reset; thegrid writes 1 at startup */ + // trackball reset; thegrid writes 1 at startup case 9: if (data != 1) - logerror("%06X:disk_asic_jr_w(%X) = %X (unexpected)\n", m_maincpu->pc(), offset, data); + LOGMASKED(LOG_DISK_JR, "%06X:disk_asic_jr_w(%X) = %X (unexpected)\n", m_maincpu->pc(), offset, data); break; - /* unknown purpose */ + // unknown purpose default: //if (oldval ^ data) - logerror("%06X:disk_asic_jr_w(%X) = %X\n", m_maincpu->pc(), offset, data); + LOGMASKED(LOG_DISK_JR, "%06X:disk_asic_jr_w(%X) = %X\n", m_maincpu->pc(), offset, data); break; } @@ -474,40 +552,40 @@ void midzeus_state::disk_asic_jr_w(offs_t offset, uint32_t data) * *************************************/ -uint32_t midzeus2_state::crusnexo_leds_r(offs_t offset) +uint32_t crusnexo_state::crusnexo_leds_r(offs_t offset) { - /* reads appear to just be for synchronization */ + // reads appear to just be for synchronization return ~0; } -void midzeus2_state::crusnexo_leds_w(offs_t offset, uint32_t data) +void crusnexo_state::crusnexo_leds_w(offs_t offset, uint32_t data) { switch (offset) { - case 0: /* unknown purpose */ + case 0: // unknown purpose break; - case 1: /* controls lamps */ + case 1: // controls lamps for (int bit = 0; bit < 8; bit++) m_lamps[bit] = BIT(data, bit); break; - case 2: /* sets state of selected LEDs */ + case 2: // sets state of selected LEDs - /* selection bits 4-6 select the 3 7-segment LEDs */ + // selection bits 4-6 select the 3 7-segment LEDs for (int bit = 4; bit < 7; bit++) if ((m_crusnexo_leds_select & (1 << bit)) == 0) m_digits[bit] = ~data & 0xff; - /* selection bits 0-2 select the tachometer LEDs */ + // selection bits 0-2 select the tachometer LEDs for (int bit = 0; bit < 3; bit++) if ((m_crusnexo_leds_select & (1 << bit)) == 0) for (int led = 0; led < 8; led++) m_leds[bit * 8 + led] = BIT(~data, led); break; - case 3: /* selects which set of LEDs we are addressing */ + case 3: // selects which set of LEDs we are addressing m_crusnexo_leds_select = data; break; } @@ -541,42 +619,45 @@ void midzeus2_state::update_firewire_irq() * *************************************/ -uint32_t midzeus_state::tms32031_control_r(offs_t offset) +uint32_t midzeus_state::tms32032_control_r(offs_t offset) { - /* watch for accesses to the timers */ + // watch for accesses to the timers if (offset == 0x24 || offset == 0x34) { - /* timer is clocked at 100ns */ - int which = (offset >> 4) & 1; - int32_t result = (m_timer[which]->elapsed() * 10000000).as_double(); + // timer is clocked at 100ns + int const which = (offset >> 4) & 1; + int32_t const result = (m_timer[which]->elapsed() * 10000000).as_double(); return result; } - /* log anything else except the memory control register */ - if (offset != 0x64) - logerror("%06X:tms32031_control_r(%02X)\n", m_maincpu->pc(), offset); + // log anything else except the memory control register + if (!machine().side_effects_disabled()) + { + if (offset != 0x64) + LOGMASKED(LOG_TMS32032, "%06X:tms32032_control_r(%02X)\n", m_maincpu->pc(), offset); + } - return m_tms32031_control[offset]; + return m_tms32032_control[offset]; } -void midzeus_state::tms32031_control_w(offs_t offset, uint32_t data, uint32_t mem_mask) +void midzeus_state::tms32032_control_w(offs_t offset, uint32_t data, uint32_t mem_mask) { - COMBINE_DATA(&m_tms32031_control[offset]); + COMBINE_DATA(&m_tms32032_control[offset]); - /* ignore changes to the memory control register */ + // ignore changes to the memory control register if (offset == 0x64) ; - /* watch for accesses to the timers */ + // watch for accesses to the timers else if (offset == 0x20 || offset == 0x30) { - int which = (offset >> 4) & 1; + int const which = (offset >> 4) & 1; if (data & 0x40) m_timer[which]->adjust(attotime::never); } else - logerror("%06X:tms32031_control_w(%02X) = %08X\n", m_maincpu->pc(), offset, data); + LOGMASKED(LOG_TMS32032, "%06X:tms32032_control_w(%02X) = %08X\n", m_maincpu->pc(), offset, data); } @@ -587,21 +668,21 @@ void midzeus_state::tms32031_control_w(offs_t offset, uint32_t data, uint32_t me * *************************************/ -CUSTOM_INPUT_MEMBER(midzeus_state::custom_49way_r) +CUSTOM_INPUT_MEMBER(thegrid_state::custom_49way_r) { static const uint8_t translate49[7] = { 0x8, 0xc, 0xe, 0xf, 0x3, 0x1, 0x0 }; return (translate49[m_io_49way_y->read() >> 4] << 4) | translate49[m_io_49way_x->read() >> 4]; } -void midzeus_state::keypad_select_w(offs_t offset, uint32_t data) +void crusnexo_state::keypad_select_w(offs_t offset, uint32_t data) { if (offset == 1) m_keypad_select = data; } -CUSTOM_INPUT_MEMBER(midzeus_state::keypad_r) +CUSTOM_INPUT_MEMBER(crusnexo_state::keypad_r) { uint32_t bits = m_io_keypad->read(); uint8_t select = m_keypad_select; @@ -613,15 +694,15 @@ CUSTOM_INPUT_MEMBER(midzeus_state::keypad_r) return bits; } -uint32_t midzeus_state::grid_keypad_r(offs_t offset) +uint32_t thegrid_state::grid_keypad_r(offs_t offset) { - uint32_t bits = (m_io_keypad->read() >> ((offset >> 1) << 2)) & 0xf; + uint32_t const bits = (m_io_keypad->read() >> ((offset >> 1) << 2)) & 0xf; return bits; } -uint32_t midzeus_state::trackball_r(offs_t offset) +uint32_t thegrid_state::trackball_r(offs_t offset) { - if (offset==0) + if (offset == 0) return m_io_tracky->read(); else return m_io_trackx->read(); @@ -635,17 +716,20 @@ uint32_t midzeus_state::trackball_r(offs_t offset) * *************************************/ -uint32_t midzeus_state::analog_r(offs_t offset) +uint32_t crusnexo_state::analog_r(offs_t offset) { - if (offset < 8 || offset > 11) - logerror("%06X:analog_r(%X)\n", m_maincpu->pc(), offset); + if (!machine().side_effects_disabled()) + { + if (offset < 8 || offset > 11) + LOGMASKED(LOG_INPUT, "%06X:analog_r(%X)\n", m_maincpu->pc(), offset); + } return m_io_analog[offset & 3]->read(); } -void midzeus_state::analog_w(uint32_t data) +void crusnexo_state::analog_w(uint32_t data) { - /* 16 writes to the location before a read */ + // 16 writes to the location before a read } @@ -656,9 +740,9 @@ void midzeus_state::analog_w(uint32_t data) * *************************************/ -void midzeus_state::update_gun_irq() +void invasnab_state::update_gun_irq() { - /* low 2 bits of gun_control seem to enable IRQs */ + // low 2 bits of gun_control seem to enable IRQs if (m_gun_irq_state & m_gun_control & 0x03) m_maincpu->set_input_line(TMS3203X_IRQ3, ASSERT_LINE); else @@ -666,37 +750,36 @@ void midzeus_state::update_gun_irq() } -TIMER_CALLBACK_MEMBER(midzeus_state::invasn_gun_callback) +TIMER_CALLBACK_MEMBER(invasnab_state::invasn_gun_callback) { - int player = param; + int const player = param; int beamy = m_screen->vpos(); - /* set the appropriate IRQ in the internal gun control and update */ + // set the appropriate IRQ in the internal gun control and update m_gun_irq_state |= 0x01 << player; update_gun_irq(); - /* generate another interrupt on the next scanline while we are within the BEAM_DY */ + // generate another interrupt on the next scanline while we are within the BEAM_DY beamy++; if (beamy <= m_screen->visible_area().max_y && beamy <= m_gun_y[player] + BEAM_DY) m_gun_timer[player]->adjust(m_screen->time_until_pos(beamy, std::max(0, m_gun_x[player] - BEAM_DX)), player); } -void midzeus_state::invasn_gun_w(offs_t offset, uint32_t data, uint32_t mem_mask) +void invasnab_state::invasn_gun_w(offs_t offset, uint32_t data, uint32_t mem_mask) { - uint32_t old_control = m_gun_control; - int player; + uint32_t const old_control = m_gun_control; COMBINE_DATA(&m_gun_control); - /* bits 0-1 enable IRQs (?) */ - /* bits 2-3 reset IRQ states */ + // bits 0-1 enable IRQs (?) + // bits 2-3 reset IRQ states m_gun_irq_state &= ~((m_gun_control >> 2) & 3); update_gun_irq(); - for (player = 0; player < 2; player++) + for (int player = 0; player < 2; player++) { - uint8_t pmask = 0x04 << player; + uint8_t const pmask = 0x04 << player; if (((old_control ^ m_gun_control) & pmask) != 0 && (m_gun_control & pmask) == 0) { const rectangle &visarea = m_screen->visible_area(); @@ -708,17 +791,16 @@ void midzeus_state::invasn_gun_w(offs_t offset, uint32_t data, uint32_t mem_mask } -uint32_t midzeus_state::invasn_gun_r() +uint32_t invasnab_state::invasn_gun_r() { - int beamx = m_screen->hpos(); - int beamy = m_screen->vpos(); + int const beamx = m_screen->hpos(); + int const beamy = m_screen->vpos(); uint32_t result = 0xffff; - int player; - for (player = 0; player < 2; player++) + for (int player = 0; player < 2; player++) { - int diffx = beamx - m_gun_x[player]; - int diffy = beamy - m_gun_y[player]; + int const diffx = beamx - m_gun_x[player]; + int const diffy = beamy - m_gun_y[player]; if (diffx >= -BEAM_DX && diffx <= BEAM_DX && diffy >= -BEAM_DY && diffy <= BEAM_DY) result ^= 0x1000 << player; } @@ -736,38 +818,58 @@ uint32_t midzeus_state::invasn_gun_r() void midzeus_state::zeus_map(address_map &map) { map.unmap_value_high(); - map(0x000000, 0x03ffff).ram().share("ram_base"); + map(0x000000, 0x03ffff).ram().share(m_ram_base); map(0x400000, 0x41ffff).ram(); - map(0x808000, 0x80807f).rw(FUNC(midzeus_state::tms32031_control_r), FUNC(midzeus_state::tms32031_control_w)).share("tms32031_ctl"); - map(0x880000, 0x8803ff).rw(FUNC(midzeus_state::zeus_r), FUNC(midzeus_state::zeus_w)).share("zeusbase"); + map(0x808000, 0x80807f).rw(FUNC(midzeus_state::tms32032_control_r), FUNC(midzeus_state::tms32032_control_w)).share(m_tms32032_control); + map(0x880000, 0x8803ff).rw(FUNC(midzeus_state::zeus_r), FUNC(midzeus_state::zeus_w)).share(m_zeusbase); map(0x8d0000, 0x8d0009).rw(FUNC(midzeus_state::disk_asic_jr_r), FUNC(midzeus_state::disk_asic_jr_w)); - map(0x990000, 0x99000f).rw("ioasic", FUNC(midway_ioasic_device::read), FUNC(midway_ioasic_device::write)); + map(0x990000, 0x99000f).rw(m_ioasic, FUNC(midway_ioasic_device::read), FUNC(midway_ioasic_device::write)); map(0x9e0000, 0x9e0000).nopw(); // watchdog? - map(0x9f0000, 0x9f7fff).rw(FUNC(midzeus_state::cmos_r), FUNC(midzeus_state::cmos_w)).share("nvram"); + map(0x9f0000, 0x9f7fff).rw(FUNC(midzeus_state::cmos_r), FUNC(midzeus_state::cmos_w)).share(m_nvram); map(0x9f8000, 0x9f8000).w(FUNC(midzeus_state::cmos_protect_w)); - map(0xa00000, 0xffffff).rom().region("user1", 0); + map(0xa00000, 0xffffff).rom().region("maindata", 0); +} + +void invasnab_state::invasnab_map(address_map &map) +{ + zeus_map(map); + map(0x9c0000, 0x9c0000).rw(FUNC(invasnab_state::invasn_gun_r), FUNC(invasnab_state::invasn_gun_w)); } void midzeus2_state::zeus2_map(address_map &map) { map.unmap_value_high(); - map(0x000000, 0x03ffff).ram().share("ram_base"); + map(0x000000, 0x03ffff).ram().share(m_ram_base); map(0x400000, 0x43ffff).ram(); - map(0x808000, 0x80807f).rw(FUNC(midzeus2_state::tms32031_control_r), FUNC(midzeus2_state::tms32031_control_w)).share("tms32031_ctl"); + map(0x808000, 0x80807f).rw(FUNC(midzeus2_state::tms32032_control_r), FUNC(midzeus2_state::tms32032_control_w)).share(m_tms32032_control); map(0x880000, 0x88007f).rw(m_zeus, FUNC(zeus2_device::zeus2_r), FUNC(zeus2_device::zeus2_w)); map(0x8a0000, 0x8a00cf).rw(m_fw_link, FUNC(tsb12lv01a_device::read), FUNC(tsb12lv01a_device::write)); //map(0x8a0000, 0x8a00cf).rw(FUNC(midzeus2_state::firewire_r), FUNC(midzeus2_state::firewire_w)).share("firewire"); map(0x8d0000, 0x8d0009).rw(FUNC(midzeus2_state::disk_asic_jr_r), FUNC(midzeus2_state::disk_asic_jr_w)); - map(0x900000, 0x91ffff).rw(FUNC(midzeus2_state::zpram_r), FUNC(midzeus2_state::zpram_w)).share("nvram").mirror(0x020000); - map(0x990000, 0x99000f).rw("ioasic", FUNC(midway_ioasic_device::read), FUNC(midway_ioasic_device::write)); - map(0x9c0000, 0x9c000f).rw(FUNC(midzeus2_state::analog_r), FUNC(midzeus2_state::analog_w)); + map(0x900000, 0x91ffff).rw(FUNC(midzeus2_state::zpram_r), FUNC(midzeus2_state::zpram_w)).share(m_nvram).mirror(0x020000); + map(0x990000, 0x99000f).rw(m_ioasic, FUNC(midway_ioasic_device::read), FUNC(midway_ioasic_device::write)); map(0x9d0000, 0x9d000f).rw(FUNC(midzeus2_state::disk_asic_r), FUNC(midzeus2_state::disk_asic_w)); map(0x9e0000, 0x9e0000).nopw(); // watchdog? - map(0x9f0000, 0x9f7fff).rw(FUNC(midzeus2_state::zeus2_timekeeper_r), FUNC(midzeus2_state::zeus2_timekeeper_w)); + map(0x9f0000, 0x9f7fff).rw(FUNC(midzeus2_state::timekeeper_r), FUNC(midzeus2_state::timekeeper_w)); map(0x9f8000, 0x9f8000).w(FUNC(midzeus2_state::cmos_protect_w)); - map(0xa00000, 0xbfffff).rom().region("user1", 0); - map(0xc00000, 0xffffff).bankr("bank1"); + map(0xa00000, 0xbfffff).rom().region("maindata", 0); + map(0xc00000, 0xffffff).bankr(m_mainbank); +} + +void crusnexo_state::crusnexo_map(address_map &map) +{ + zeus2_map(map); + map(0x8d0009, 0x8d000a).w(FUNC(crusnexo_state::keypad_select_w)); + map(0x9b0004, 0x9b0007).rw(FUNC(crusnexo_state::crusnexo_leds_r), FUNC(crusnexo_state::crusnexo_leds_w)); + map(0x9c0000, 0x9c000f).rw(FUNC(crusnexo_state::analog_r), FUNC(crusnexo_state::analog_w)); +} + +void thegrid_state::thegrid_map(address_map &map) +{ + zeus2_map(map); + map(0x8c0000, 0x8c0001).r(FUNC(thegrid_state::trackball_r)); + map(0x9b0000, 0x9b0004).r(FUNC(thegrid_state::grid_keypad_r)); } /* @@ -816,7 +918,7 @@ void midzeus2_state::zeus2_map(address_map &map) *************************************/ static INPUT_PORTS_START( mk4 ) - PORT_START("DIPS") /* DS1 */ + PORT_START("DIPS") // DS1 PORT_DIPNAME( 0x0001, 0x0001, "Coinage Source" ) PORT_DIPSETTING( 0x0001, "Dipswitch" ) PORT_DIPSETTING( 0x0000, "CMOS" ) @@ -839,7 +941,7 @@ static INPUT_PORTS_START( mk4 ) PORT_DIPSETTING( 0x0018, "French-4" ) PORT_DIPSETTING( 0x0016, "French-ECA" ) PORT_DIPSETTING( 0x0030, DEF_STR( Free_Play ) ) - PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) /* Manual lists this dip as Unused */ + PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) // Manual lists this dip as Unused PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) PORT_DIPNAME( 0x0080, 0x0080, "Test Switch" ) @@ -851,7 +953,7 @@ static INPUT_PORTS_START( mk4 ) PORT_DIPNAME( 0x0200, 0x0200, "Blood" ) PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0200, DEF_STR( On ) ) - PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) /* Manual states that switches 3-7 are Unused */ + PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) // Manual states that switches 3-7 are Unused PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) ) @@ -874,7 +976,7 @@ static INPUT_PORTS_START( mk4 ) PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT ) /* Slam Switch */ + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT ) // Slam Switch PORT_SERVICE_NO_TOGGLE( 0x0010, IP_ACTIVE_LOW ) PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START2 ) PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE1 ) @@ -885,7 +987,7 @@ static INPUT_PORTS_START( mk4 ) PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_VOLUME_DOWN ) PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_VOLUME_UP ) PORT_BIT( 0x6000, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BILL1 ) /* Bill */ + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BILL1 ) // Bill PORT_START("IN1") PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY @@ -918,7 +1020,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( invasn ) - PORT_START("DIPS") /* DS1 */ + PORT_START("DIPS") // DS1 PORT_DIPNAME( 0x0001, 0x0001, "Coinage Source" ) PORT_DIPSETTING( 0x0001, "Dipswitch" ) PORT_DIPSETTING( 0x0000, "CMOS" ) @@ -979,7 +1081,7 @@ static INPUT_PORTS_START( invasn ) PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT ) /* Slam Switch */ + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT ) // Slam Switch PORT_SERVICE_NO_TOGGLE( 0x0010, IP_ACTIVE_LOW ) PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START2 ) PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE1 ) @@ -990,7 +1092,7 @@ static INPUT_PORTS_START( invasn ) PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_VOLUME_DOWN ) PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_VOLUME_UP ) PORT_BIT( 0x6000, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BILL1 ) /* Bill */ + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BILL1 ) // Bill PORT_START("IN1") PORT_BIT( 0x000f, IP_ACTIVE_LOW, IPT_UNUSED ) @@ -1003,22 +1105,22 @@ static INPUT_PORTS_START( invasn ) PORT_START("IN2") PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_START("GUNX1") /* fake analog X */ + PORT_START("GUNX1") // fake analog X PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) - PORT_START("GUNY1") /* fake analog Y */ + PORT_START("GUNY1") // fake analog Y PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10) - PORT_START("GUNX2") /* fake analog X */ + PORT_START("GUNX2") // fake analog X PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(2) - PORT_START("GUNY2") /* fake analog Y */ + PORT_START("GUNY2") // fake analog Y PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10) PORT_PLAYER(2) INPUT_PORTS_END static INPUT_PORTS_START( crusnexo ) - PORT_START("DIPS") /* DS1 */ + PORT_START("DIPS") // DS1 PORT_DIPNAME( 0x001f, 0x001f, "Country Code" ) PORT_DIPSETTING( 0x001f, DEF_STR( USA ) ) PORT_DIPSETTING( 0x001e, "Germany" ) @@ -1041,17 +1143,17 @@ static INPUT_PORTS_START( crusnexo ) PORT_DIPSETTING( 0x000a, "Hungary" ) PORT_DIPSETTING( 0x0008, "General" ) PORT_DIPNAME( 0x0060, 0x0060, "Coin Mode" ) - PORT_DIPSETTING( 0x0060, "Mode 1" ) /* USA1/GER1/FRA1/SPN1/AUSTRIA1/GEN1/CAN1/SWI1/ITL1/JPN1/TWN1/BLGN1/NTHRLND1/FNLD1/NRWY1/DNMK1/HUN1 */ - PORT_DIPSETTING( 0x0040, "Mode 2" ) /* USA3/GER1/FRA1/SPN1/AUSTRIA1/GEN3/CAN2/SWI2/ITL2/JPN2/TWN2/BLGN2/NTHRLND2 */ - PORT_DIPSETTING( 0x0020, "Mode 3" ) /* USA7/GER1/FRA1/SPN1/AUSTRIA1/GEN5/CAN3/SWI3/ITL3/JPN3/TWN3/BLGN3 */ - PORT_DIPSETTING( 0x0000, "Mode 4" ) /* USA8/GER1/FRA1/SPN1/AUSTRIA1/GEN7 */ + PORT_DIPSETTING( 0x0060, "Mode 1" ) // USA1/GER1/FRA1/SPN1/AUSTRIA1/GEN1/CAN1/SWI1/ITL1/JPN1/TWN1/BLGN1/NTHRLND1/FNLD1/NRWY1/DNMK1/HUN1 + PORT_DIPSETTING( 0x0040, "Mode 2" ) // USA3/GER1/FRA1/SPN1/AUSTRIA1/GEN3/CAN2/SWI2/ITL2/JPN2/TWN2/BLGN2/NTHRLND2 + PORT_DIPSETTING( 0x0020, "Mode 3" ) // USA7/GER1/FRA1/SPN1/AUSTRIA1/GEN5/CAN3/SWI3/ITL3/JPN3/TWN3/BLGN3 + PORT_DIPSETTING( 0x0000, "Mode 4" ) // USA8/GER1/FRA1/SPN1/AUSTRIA1/GEN7 PORT_DIPNAME( 0x0080, 0x0080, "Test Switch" ) PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0100, 0x0100, "Game Type" ) /* Manual states "*DIP 1, Switch 1 MUST be set */ - PORT_DIPSETTING( 0x0100, "Dedicated" ) /* to OFF position for proper operation" */ + PORT_DIPNAME( 0x0100, 0x0100, "Game Type" ) // Manual states "*DIP 1, Switch 1 MUST be set + PORT_DIPSETTING( 0x0100, "Dedicated" ) // to OFF position for proper operation" PORT_DIPSETTING( 0x0000, "Kit" ) - PORT_DIPNAME( 0x0200, 0x0200, "Seat Motion" ) /* For dedicated Sit Down models with Motion Seat */ + PORT_DIPNAME( 0x0200, 0x0200, "Seat Motion" ) // For dedicated Sit Down models with Motion Seat PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Cabinet ) ) @@ -1060,7 +1162,7 @@ static INPUT_PORTS_START( crusnexo ) PORT_DIPNAME( 0x0800, 0x0800, "Wheel Invert" ) PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x1000, 0x1000, "ROM Configuration" ) /* Manual lists this dip as Unused */ + PORT_DIPNAME( 0x1000, 0x1000, "ROM Configuration" ) // Manual lists this dip as Unused PORT_DIPSETTING( 0x1000, "32M ROM Normal" ) PORT_DIPSETTING( 0x0000, "16M ROM Split Active" ) PORT_DIPNAME( 0x2000, 0x2000, "Link" ) @@ -1076,7 +1178,7 @@ static INPUT_PORTS_START( crusnexo ) PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT ) /* Slam Switch */ + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT ) // Slam Switch PORT_SERVICE_NO_TOGGLE( 0x0010, IP_ACTIVE_LOW ) PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START2 ) PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE1 ) @@ -1089,41 +1191,41 @@ static INPUT_PORTS_START( crusnexo ) PORT_BIT( 0x6000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BILL1 ) - PORT_START("IN1") /* Listed "names" are via the manual's "JAMMA" pinout sheet" */ - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* Not Used */ - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Radio") /* Radio Switch */ - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* Not Used */ - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* Not Used */ - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("View 1") /* View 1 */ - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("View 2") /* View 2 */ - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_NAME("View 3") /* View 3 */ - PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_NAME("View 4") /* View 4 */ - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("1st Gear") /* Gear 1 */ - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("2nd Gear") /* Gear 2 */ - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("3rd Gear") /* Gear 3 */ - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("4th Gear") /* Gear 4 */ - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* Not Used */ - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* Not Used */ - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* Not Used */ + PORT_START("IN1") // Listed "names" are via the manual's "JAMMA" pinout sheet" + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Not Used + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Radio") // Radio Switch + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Not Used + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Not Used + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("View 1") // View 1 + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("View 2") // View 2 + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_NAME("View 3") // View 3 + PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_NAME("View 4") // View 4 + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("1st Gear") // Gear 1 + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("2nd Gear") // Gear 2 + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("3rd Gear") // Gear 3 + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("4th Gear") // Gear 4 + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Not Used + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Not Used + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Not Used PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("IN2") - PORT_BIT( 0x0007, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_CUSTOM_MEMBER(midzeus_state, keypad_r ) + PORT_BIT( 0x0007, IP_ACTIVE_HIGH, IPT_CUSTOM) PORT_CUSTOM_MEMBER(crusnexo_state, keypad_r ) PORT_BIT( 0xfff8, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("KEYPAD") - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) /* keypad 3 */ - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) /* keypad 1 */ - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) /* keypad 2 */ - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) /* keypad 6 */ - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) /* keypad 4 */ - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) /* keypad 5 */ - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) /* keypad 9 */ - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) /* keypad 7 */ - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) /* keypad 8 */ - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Keypad #") PORT_CODE(KEYCODE_PLUS_PAD) /* keypad # */ - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Keypad *") PORT_CODE(KEYCODE_MINUS_PAD) /* keypad * */ - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) /* keypad 0 */ + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) // keypad 3 + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) // keypad 1 + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) // keypad 2 + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) // keypad 6 + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) // keypad 4 + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) // keypad 5 + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) // keypad 9 + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) // keypad 7 + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) // keypad 8 + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Keypad #") PORT_CODE(KEYCODE_PLUS_PAD) // keypad # + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Keypad *") PORT_CODE(KEYCODE_MINUS_PAD) // keypad * + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) // keypad 0 PORT_START("ANALOG3") PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(25) PORT_KEYDELTA(20) @@ -1140,7 +1242,7 @@ INPUT_PORTS_END static INPUT_PORTS_START( thegrid ) - PORT_START("DIPS") /* DS1 */ + PORT_START("DIPS") // DS1 PORT_DIPNAME( 0x0100, 0x0100, "Show Blood" ) PORT_DIPSETTING( 0x0100, "Show Blood" ) PORT_DIPSETTING( 0x0000, "Do not show blood" ) @@ -1181,7 +1283,7 @@ static INPUT_PORTS_START( thegrid ) PORT_DIPSETTING( 0x0004, "UK-6 ECA" ) PORT_DIPSETTING( 0x0002, "UK-7 ECA" ) PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) ) - PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) /* Manual states switches 7 & 8 are Unused */ + PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) // Manual states switches 7 & 8 are Unused PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) PORT_DIPNAME( 0x0080, 0x0080, "Game Mode" ) @@ -1192,7 +1294,7 @@ static INPUT_PORTS_START( thegrid ) PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT ) /* Slam Switch */ + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT ) // Slam Switch PORT_SERVICE_NO_TOGGLE( 0x0010, IP_ACTIVE_LOW ) PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START2 ) PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_SERVICE1 ) @@ -1203,28 +1305,28 @@ static INPUT_PORTS_START( thegrid ) PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_VOLUME_DOWN ) PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_VOLUME_UP ) PORT_BIT( 0x6000, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BILL1 ) /* Bill */ - - PORT_START("IN1") /* Listed "names" are via the manual's "JAMMA" pinout sheet" */ - PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY /* Not Used */ - PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY /* Not Used */ - PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY /* Not Used */ - PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY /* Not Used */ - PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) /* Trigger */ - PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) /* Fire */ - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) /* Action */ + PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BILL1 ) // Bill + + PORT_START("IN1") // Listed "names" are via the manual's "JAMMA" pinout sheet" + PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY // Not Used + PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY // Not Used + PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY // Not Used + PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY // Not Used + PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) // Trigger + PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) // Fire + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) // Action PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY /* No Connection */ - PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY /* No Connection */ - PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY /* No Connection */ - PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY /* No Connection */ - PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) /* No Connection */ - PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) /* No Connection */ - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) /* No Connection */ + PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY // No Connection + PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY // No Connection + PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY // No Connection + PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY // No Connection + PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) // No Connection + PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) // No Connection + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) // No Connection PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("IN2") - PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(midzeus_state, custom_49way_r) + PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(thegrid_state, custom_49way_r) PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_START("49WAYX") @@ -1234,23 +1336,23 @@ static INPUT_PORTS_START( thegrid ) PORT_BIT( 0xff, 0x38, IPT_AD_STICK_Y ) PORT_MINMAX(0x00,0x6f) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE PORT_START("KEYPAD") - PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) /* keypad 1 */ - PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) /* keypad 4 */ - PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) /* keypad 7 */ - PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Keypad *") PORT_CODE(KEYCODE_ASTERISK) /* keypad * */ - PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) /* keypad 2 */ - PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) /* keypad 5 */ - PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) /* keypad 8 */ - PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) /* keypad 0 */ - PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) /* keypad 3 */ - PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) /* keypad 6 */ - PORT_BIT(0x400, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) /* keypad 9 */ - PORT_BIT(0x800, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Keypad #") PORT_CODE(KEYCODE_PLUS_PAD) /* keypad # */ - - PORT_START("TRACKX1") + PORT_BIT(0x001, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Keypad 1") PORT_CODE(KEYCODE_1_PAD) // keypad 1 + PORT_BIT(0x002, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Keypad 4") PORT_CODE(KEYCODE_4_PAD) // keypad 4 + PORT_BIT(0x004, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Keypad 7") PORT_CODE(KEYCODE_7_PAD) // keypad 7 + PORT_BIT(0x008, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Keypad *") PORT_CODE(KEYCODE_ASTERISK) // keypad * + PORT_BIT(0x010, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Keypad 2") PORT_CODE(KEYCODE_2_PAD) // keypad 2 + PORT_BIT(0x020, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Keypad 5") PORT_CODE(KEYCODE_5_PAD) // keypad 5 + PORT_BIT(0x040, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Keypad 8") PORT_CODE(KEYCODE_8_PAD) // keypad 8 + PORT_BIT(0x080, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Keypad 0") PORT_CODE(KEYCODE_0_PAD) // keypad 0 + PORT_BIT(0x100, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Keypad 3") PORT_CODE(KEYCODE_3_PAD) // keypad 3 + PORT_BIT(0x200, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Keypad 6") PORT_CODE(KEYCODE_6_PAD) // keypad 6 + PORT_BIT(0x400, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Keypad 9") PORT_CODE(KEYCODE_9_PAD) // keypad 9 + PORT_BIT(0x800, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Keypad #") PORT_CODE(KEYCODE_PLUS_PAD) // keypad # + + PORT_START("TRACKX") PORT_BIT(0xff, 0x00, IPT_TRACKBALL_X) PORT_SENSITIVITY(1) PORT_KEYDELTA(1) PORT_PLAYER(1) - PORT_START("TRACKY1") + PORT_START("TRACKY") PORT_BIT(0xff, 0x00, IPT_TRACKBALL_Y) PORT_SENSITIVITY(1) PORT_KEYDELTA(1) PORT_REVERSE PORT_PLAYER(1) INPUT_PORTS_END @@ -1263,24 +1365,26 @@ INPUT_PORTS_END * *************************************/ +static constexpr XTAL CPU_CLOCK = XTAL(60'000'000); + void midzeus_state::midzeus(machine_config &config) { - /* basic machine hardware */ + // basic machine hardware TMS32032(config, m_maincpu, CPU_CLOCK); m_maincpu->set_addrmap(AS_PROGRAM, &midzeus_state::zeus_map); m_maincpu->set_vblank_int("screen", FUNC(midzeus_state::display_irq)); NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1); - /* video hardware */ - PALETTE(config, "palette").set_entries(32768); + // video hardware + PALETTE(config, m_palette, palette_device::RGB_555); SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_raw(MIDZEUS_VIDEO_CLOCK / 8, 529, 0, 400, 278, 0, 256); m_screen->set_screen_update(FUNC(midzeus_state::screen_update)); - m_screen->set_palette("palette"); + m_screen->set_palette(m_palette); - /* sound hardware */ + // sound hardware SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); @@ -1306,31 +1410,33 @@ void midzeus_state::mk4(machine_config &config) m_ioasic->set_shuffle_default(1); } -void midzeus_state::invasn(machine_config &config) +void invasnab_state::invasn(machine_config &config) { midzeus(config); - PIC16C57(config, "pic", 8000000); /* ? */ + m_maincpu->set_addrmap(AS_PROGRAM, &invasnab_state::invasnab_map); + + PIC16C57(config, "pic", 8000000); // ? m_ioasic->set_upper(468/* or 488 */); } void midzeus2_state::midzeus2(machine_config &config) { - /* basic machine hardware */ + // basic machine hardware TMS32032(config, m_maincpu, CPU_CLOCK); m_maincpu->set_addrmap(AS_PROGRAM, &midzeus2_state::zeus2_map); m_maincpu->set_vblank_int("screen", FUNC(midzeus2_state::display_irq)); NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1); - /* video hardware */ + // video hardware SCREEN(config, m_screen, SCREEN_TYPE_RASTER); - m_screen->set_raw(MIDZEUS_VIDEO_CLOCK / 4, 666, 0, 512, 438, 0, 400); - m_screen->set_screen_update("zeus2", FUNC(zeus2_device::screen_update)); + m_screen->set_raw(ZEUS2_VIDEO_CLOCK / 4, 666, 0, 512, 438, 0, 400); + m_screen->set_screen_update(m_zeus, FUNC(zeus2_device::screen_update)); ZEUS2(config, m_zeus, ZEUS2_VIDEO_CLOCK); m_zeus->irq_callback().set(FUNC(midzeus2_state::zeus_irq)); - /* sound hardware */ + // sound hardware SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); @@ -1341,7 +1447,7 @@ void midzeus2_state::midzeus2(machine_config &config) M48T35(config, m_m48t35, 0); - /* I/O hardware */ + // I/O hardware MIDWAY_IOASIC(config, m_ioasic, 0); m_ioasic->in_port_cb<0>().set_ioport("DIPS"); m_ioasic->in_port_cb<1>().set_ioport("SYSTEM"); @@ -1361,15 +1467,19 @@ void midzeus2_state::midzeus2(machine_config &config) m_fw_link->phy_write().set(m_fw_phy, FUNC(ibm21s851_device::write)); } -void midzeus2_state::crusnexo(machine_config &config) +void crusnexo_state::crusnexo(machine_config &config) { midzeus2(config); + m_maincpu->set_addrmap(AS_PROGRAM, &crusnexo_state::crusnexo_map); + m_ioasic->set_upper(472/* or 476,477,478,110 */); } -void midzeus2_state::thegrid(machine_config &config) +void thegrid_state::thegrid(machine_config &config) { midzeus2(config); + m_maincpu->set_addrmap(AS_PROGRAM, &thegrid_state::thegrid_map); + PIC16C57(config, "pic", 8000000).set_disable(); // unverified clock, not hooked up m_ioasic->set_upper(474/* or 491 */); } @@ -1392,7 +1502,7 @@ ROM_START( mk4 ) ROM_REGION( 0x2000, "pic", 0 ) // PIC16C57 ROM_LOAD( "461_mortal_k_4_25_u76.u76", 0x0000, 0x2000, CRC(d4432af9) SHA1(44a4b114f9b2075fdc611c011123a37b99458752) ) // decapped but not hooked up - ROM_REGION32_LE( 0x1800000, "user1", 0 ) + ROM_REGION32_LE( 0x1800000, "maindata", 0 ) ROM_LOAD32_WORD( "mk4_l3.u10", 0x0000000, 0x200000, CRC(84efe5a9) SHA1(e2a9bf6fab971691017371a87ab87b1bf66f96d0) ) // ROMs U10 & U11 were labeled as v3.0 ROM_LOAD32_WORD( "mk4_l3.u11", 0x0000002, 0x200000, CRC(0c026ccb) SHA1(7531fe81ff8d8dd9ec3cd915acaf14cbe6bdc90a) ) ROM_LOAD32_WORD( "mk4_l2.u12", 0x0400000, 0x200000, CRC(7816c07f) SHA1(da94b4391e671f915c61b5eb9bece4acb3382e31) ) // ROMs U12 through U17 were all labeled as v2.0 @@ -1414,7 +1524,7 @@ ROM_START( mk4a ) ROM_REGION( 0x2000, "pic", 0 ) // PIC16C57 ROM_LOAD( "461_mortal_k_4_25_u76.u76", 0x0000, 0x2000, CRC(d4432af9) SHA1(44a4b114f9b2075fdc611c011123a37b99458752) ) // decapped but not hooked up - ROM_REGION32_LE( 0x1800000, "user1", 0 ) + ROM_REGION32_LE( 0x1800000, "maindata", 0 ) ROM_LOAD32_WORD( "mk4_l2.1.u10", 0x0000000, 0x200000, CRC(42d0f1c9) SHA1(5ac0ded8bf6e756319be2691e3b555eac079ebdc) ) // ROMs U10 & U11 were labeled as v2.1 ROM_LOAD32_WORD( "mk4_l2.1.u11", 0x0000002, 0x200000, CRC(6e21b243) SHA1(6d4768a5972db05c1409e0d16e79df9eff8918a0) ) ROM_LOAD32_WORD( "mk4_l2.u12", 0x0400000, 0x200000, CRC(7816c07f) SHA1(da94b4391e671f915c61b5eb9bece4acb3382e31) ) // ROMs U12 through U17 were all labeled as v2.0 @@ -1436,7 +1546,7 @@ ROM_START( mk4b ) ROM_REGION( 0x2000, "pic", 0 ) // PIC16C57 ROM_LOAD( "461_mortal_k_4_25_u76.u76", 0x0000, 0x2000, CRC(d4432af9) SHA1(44a4b114f9b2075fdc611c011123a37b99458752) ) // decapped but not hooked up - ROM_REGION32_LE( 0x1800000, "user1", 0 ) + ROM_REGION32_LE( 0x1800000, "maindata", 0 ) ROM_LOAD32_WORD( "mk4_l1.u10", 0x0000000, 0x200000, CRC(6fcc86dd) SHA1(b3b2b463daf51450fbcd5d2922ac1b091bd91c4a) ) // All ROMs were labeled as v1.0 ROM_LOAD32_WORD( "mk4_l1.u11", 0x0000002, 0x200000, CRC(04895940) SHA1(55d368905f5986587c4e3da236401fdd5e2c269c) ) ROM_LOAD32_WORD( "mk4_l1.u12", 0x0400000, 0x200000, CRC(323ddc5c) SHA1(4303c109c68a7cc15ff6fe91b6d34383b6066351) ) @@ -1456,7 +1566,7 @@ ROM_START( invasnab ) // Version 5.0 Program ROMs, v4.0 Graphics ROMs, v2.0 Soun ROM_REGION( 0x2000, "pic", 0 ) // PIC16c57 Code ROM_LOAD( "pic16c57.u76", 0x00000, 0x2000, BAD_DUMP CRC(f62729c9) SHA1(9642c53dd7eceeb7eb178497d367691c44abc5c5) ) // is this even a valid dump? - ROM_REGION32_LE( 0x1800000, "user1", 0 ) + ROM_REGION32_LE( 0x1800000, "maindata", 0 ) ROM_LOAD32_WORD( "invasion5.u10", 0x0000000, 0x200000, CRC(8c7785d9) SHA1(701602314cd4eba4215c47ea0ae75fd4eddad43b) ) // ROMs U10 & U11 were labeled as v5.0 ROM_LOAD32_WORD( "invasion5.u11", 0x0000002, 0x200000, CRC(8ceb1f32) SHA1(82d01f25cba25d77b11c347632e8b72776e12984) ) ROM_LOAD32_WORD( "invasion4.u12", 0x0400000, 0x200000, CRC(ce1eb06a) SHA1(ff17690a0cbca6dcccccde70e2c5812ae03db5bb) ) // ROMs U12 through U19 were all labeled as v4.0 @@ -1479,7 +1589,7 @@ ROM_START( invasnab4 ) // Version 4.0 Program ROMs & Graphics ROMs, v2.0 Sound R ROM_REGION( 0x2000, "pic", 0 ) // PIC16c57 Code ROM_LOAD( "pic16c57.u76", 0x00000, 0x2000, BAD_DUMP CRC(f62729c9) SHA1(9642c53dd7eceeb7eb178497d367691c44abc5c5) ) // is this even a valid dump? - ROM_REGION32_LE( 0x1800000, "user1", 0 ) + ROM_REGION32_LE( 0x1800000, "maindata", 0 ) ROM_LOAD32_WORD( "invasion4.u10", 0x0000000, 0x200000, CRC(b3ce958b) SHA1(ed51c167d85bc5f6155b8046ec056a4f4ad5cf9d) ) // These ROM were all labeled as v4.0 ROM_LOAD32_WORD( "invasion4.u11", 0x0000002, 0x200000, CRC(0bd09359) SHA1(f40886bd2e5f5fbf506580e5baa2f733be200852) ) ROM_LOAD32_WORD( "invasion4.u12", 0x0400000, 0x200000, CRC(ce1eb06a) SHA1(ff17690a0cbca6dcccccde70e2c5812ae03db5bb) ) @@ -1502,7 +1612,7 @@ ROM_START( invasnab3 ) // Version 3.0 Program ROMs & v2.0 Graphics ROMs, v2.0 So ROM_REGION( 0x2000, "pic", 0 ) // PIC16c57 Code ROM_LOAD( "pic16c57.u76", 0x00000, 0x2000, BAD_DUMP CRC(f62729c9) SHA1(9642c53dd7eceeb7eb178497d367691c44abc5c5) ) // is this even a valid dump? - ROM_REGION32_LE( 0x1800000, "user1", 0 ) + ROM_REGION32_LE( 0x1800000, "maindata", 0 ) ROM_LOAD32_WORD( "invasion3.u10", 0x0000000, 0x200000, CRC(8404830e) SHA1(808fea45fb09fb7bf60f9f1e195a51d39e9966f5) ) // ROMs U10 through U13 were labeled as v3.0 Dated 8/30 ROM_LOAD32_WORD( "invasion3.u11", 0x0000002, 0x200000, CRC(cb893a37) SHA1(c0b8283d9b6b2b1a5fed7f542a8964ed875182b1) ) ROM_LOAD32_WORD( "invasion3.u12", 0x0400000, 0x200000, CRC(79bfa881) SHA1(7c68a2f236223506f24a38d21836d132f2e10ac3) ) @@ -1569,13 +1679,13 @@ ROM_START( crusnexo ) ROM_REGION( 0x1000, "pic", 0 ) // PIC16c57 Code ROM_LOAD( "472_cruisn_exot_27.u53", 0x0000, 0x1000, CRC(7ff41d76) SHA1(13d23e634dc8d20fbee11a9c39923b7e54984672) ) // decapped but not hooked up - ROM_REGION32_LE( 0x0800000, "user1", 0 ) + ROM_REGION32_LE( 0x0800000, "maindata", 0 ) ROM_LOAD32_WORD( "cruisn_exotica_u10_rev_2.4.u10", 0x0000000, 0x200000, CRC(5e702f7c) SHA1(98c76fb46b304d4d21656d0505d5e5e99c8335bf) ) // Version 2.4 Wed Aug 23, 2000 17:26:53 ROM_LOAD32_WORD( "cruisn_exotica_u11_rev_2.4.u11", 0x0000002, 0x200000, CRC(5ecb2cbc) SHA1(57283167e48ca96579d0712d9fec23a36fa2b496) ) ROM_LOAD32_WORD( "cruisn_exotica_u12_rev.1.0.u12", 0x0400000, 0x200000, CRC(21f122b2) SHA1(5473401ec954bf9ab66a8283bd08d17c7960cd29) ) // These 2 ROMs might be labeled as a different version, ROM_LOAD32_WORD( "cruisn_exotica_u13_rev.1.0.u13", 0x0400002, 0x200000, CRC(cf9d3609) SHA1(6376891f478185d26370466bef92f0c5304d58d3) ) // but the data doesn't change. Verified for v1.3 & v1.6 - ROM_REGION32_LE( 0x3000000, "user2", 0 ) + ROM_REGION32_LE( 0x3000000, "bankeddata", 0 ) ROM_LOAD32_WORD( "cruisn_exotica_u14_rev.1.0.u14", 0x0000000, 0x400000, CRC(84452fc2) SHA1(06d87263f83ef079e6c5fb9de620e0135040c858) ) ROM_LOAD32_WORD( "cruisn_exotica_u15_rev.1.0.u15", 0x0000002, 0x400000, CRC(b6aaebdb) SHA1(6ede6ea123be6a88d1ff38e90f059c9d1f822d6d) ) ROM_LOAD32_WORD( "cruisn_exotica_u16_rev.1.0.u16", 0x0800000, 0x400000, CRC(aac6d2a5) SHA1(6c336520269d593b46b82414d9352a3f16955cc3) ) @@ -1600,13 +1710,13 @@ ROM_START( crusnexoa ) ROM_REGION( 0x1000, "pic", 0 ) // PIC16c57 Code ROM_LOAD( "472_cruisn_exot_27.u53", 0x0000, 0x1000, CRC(7ff41d76) SHA1(13d23e634dc8d20fbee11a9c39923b7e54984672) ) // decapped but not hooked up - ROM_REGION32_LE( 0x0800000, "user1", 0 ) + ROM_REGION32_LE( 0x0800000, "maindata", 0 ) ROM_LOAD32_WORD( "cruisn_exotica_u10_rev_2.0.u10", 0x0000000, 0x200000, CRC(43d80f54) SHA1(25683d835f3ed3dee99da33280ae6e21865801e4) ) // Version 2.0 Fri Apr 07, 2000 17:55:07 ROM_LOAD32_WORD( "cruisn_exotica_u11_rev_2.0.u11", 0x0000002, 0x200000, CRC(dba26b69) SHA1(4900ac3fe67664a543dcd66e41793874f6cdc07f) ) ROM_LOAD32_WORD( "cruisn_exotica_u12_rev.1.0.u12", 0x0400000, 0x200000, CRC(21f122b2) SHA1(5473401ec954bf9ab66a8283bd08d17c7960cd29) ) // These 2 ROMs might be labeled as a different version, ROM_LOAD32_WORD( "cruisn_exotica_u13_rev.1.0.u13", 0x0400002, 0x200000, CRC(cf9d3609) SHA1(6376891f478185d26370466bef92f0c5304d58d3) ) // but the data doesn't change. Verified for v1.3 & v1.6 - ROM_REGION32_LE( 0x3000000, "user2", 0 ) + ROM_REGION32_LE( 0x3000000, "bankeddata", 0 ) ROM_LOAD32_WORD( "cruisn_exotica_u14_rev.1.0.u14", 0x0000000, 0x400000, CRC(84452fc2) SHA1(06d87263f83ef079e6c5fb9de620e0135040c858) ) ROM_LOAD32_WORD( "cruisn_exotica_u15_rev.1.0.u15", 0x0000002, 0x400000, CRC(b6aaebdb) SHA1(6ede6ea123be6a88d1ff38e90f059c9d1f822d6d) ) ROM_LOAD32_WORD( "cruisn_exotica_u16_rev.1.0.u16", 0x0800000, 0x400000, CRC(aac6d2a5) SHA1(6c336520269d593b46b82414d9352a3f16955cc3) ) @@ -1631,13 +1741,13 @@ ROM_START( crusnexoaa ) // known alternate ROM configuration - The half size U18 ROM_REGION( 0x1000, "pic", 0 ) // PIC16c57 Code ROM_LOAD( "472_cruisn_exot_27.u53", 0x0000, 0x1000, CRC(7ff41d76) SHA1(13d23e634dc8d20fbee11a9c39923b7e54984672) ) // decapped but not hooked up - ROM_REGION32_LE( 0x0800000, "user1", 0 ) + ROM_REGION32_LE( 0x0800000, "maindata", 0 ) ROM_LOAD32_WORD( "cruisn_exotica_u10_rev_2.0.u10", 0x0000000, 0x200000, CRC(43d80f54) SHA1(25683d835f3ed3dee99da33280ae6e21865801e4) ) // Version 2.0 Fri Apr 07, 2000 17:55:07 ROM_LOAD32_WORD( "cruisn_exotica_u11_rev_2.0.u11", 0x0000002, 0x200000, CRC(dba26b69) SHA1(4900ac3fe67664a543dcd66e41793874f6cdc07f) ) ROM_LOAD32_WORD( "cruisn_exotica_u12_rev.1.0.u12", 0x0400000, 0x200000, CRC(21f122b2) SHA1(5473401ec954bf9ab66a8283bd08d17c7960cd29) ) // These 2 ROMs might be labeled as a different version, ROM_LOAD32_WORD( "cruisn_exotica_u13_rev.1.0.u13", 0x0400002, 0x200000, CRC(cf9d3609) SHA1(6376891f478185d26370466bef92f0c5304d58d3) ) // but the data doesn't change. Verified for v1.3 & v1.6 - ROM_REGION32_LE( 0x3000000, "user2", 0 ) + ROM_REGION32_LE( 0x3000000, "bankeddata", 0 ) ROM_LOAD32_WORD( "cruisn_exotica_u14_rev.1.0.u14", 0x0000000, 0x400000, CRC(84452fc2) SHA1(06d87263f83ef079e6c5fb9de620e0135040c858) ) ROM_LOAD32_WORD( "cruisn_exotica_u15_rev.1.0.u15", 0x0000002, 0x400000, CRC(b6aaebdb) SHA1(6ede6ea123be6a88d1ff38e90f059c9d1f822d6d) ) ROM_LOAD32_WORD( "cruisn_exotica_u16_rev.1.0.u16", 0x0800000, 0x400000, CRC(aac6d2a5) SHA1(6c336520269d593b46b82414d9352a3f16955cc3) ) @@ -1663,13 +1773,13 @@ ROM_START( crusnexob ) ROM_REGION( 0x1000, "pic", 0 ) // PIC16c57 Code ROM_LOAD( "472_cruisn_exot_27.u53", 0x0000, 0x1000, CRC(7ff41d76) SHA1(13d23e634dc8d20fbee11a9c39923b7e54984672) ) // decapped but not hooked up - ROM_REGION32_LE( 0x0800000, "user1", 0 ) + ROM_REGION32_LE( 0x0800000, "maindata", 0 ) ROM_LOAD32_WORD( "cruisn_exotica_u10_rev_1.6.u10", 0x0000000, 0x200000, CRC(65450140) SHA1(cad41a2cad48426de01feb78d3f71f768e3fc872) ) // Version 1.6 Tue Feb 22, 2000 10:25:01 ROM_LOAD32_WORD( "cruisn_exotica_u11_rev_1.6.u11", 0x0000002, 0x200000, CRC(e994891f) SHA1(bb088729b665864c7f3b79b97c3c86f9c8f68770) ) ROM_LOAD32_WORD( "cruisn_exotica_u12_rev.1.0.u12", 0x0400000, 0x200000, CRC(21f122b2) SHA1(5473401ec954bf9ab66a8283bd08d17c7960cd29) ) // These 2 ROMs might be labeled as a different version, ROM_LOAD32_WORD( "cruisn_exotica_u13_rev.1.0.u13", 0x0400002, 0x200000, CRC(cf9d3609) SHA1(6376891f478185d26370466bef92f0c5304d58d3) ) // but the data doesn't change. Verified for v1.3 & v1.6 - ROM_REGION32_LE( 0x3000000, "user2", 0 ) + ROM_REGION32_LE( 0x3000000, "bankeddata", 0 ) ROM_LOAD32_WORD( "cruisn_exotica_u14_rev.1.0.u14", 0x0000000, 0x400000, CRC(84452fc2) SHA1(06d87263f83ef079e6c5fb9de620e0135040c858) ) ROM_LOAD32_WORD( "cruisn_exotica_u15_rev.1.0.u15", 0x0000002, 0x400000, CRC(b6aaebdb) SHA1(6ede6ea123be6a88d1ff38e90f059c9d1f822d6d) ) ROM_LOAD32_WORD( "cruisn_exotica_u16_rev.1.0.u16", 0x0800000, 0x400000, CRC(aac6d2a5) SHA1(6c336520269d593b46b82414d9352a3f16955cc3) ) @@ -1694,13 +1804,13 @@ ROM_START( crusnexoc ) ROM_REGION( 0x1000, "pic", 0 ) // PIC16c57 Code ROM_LOAD( "472_cruisn_exot_27.u53", 0x0000, 0x1000, CRC(7ff41d76) SHA1(13d23e634dc8d20fbee11a9c39923b7e54984672) ) // decapped but not hooked up - ROM_REGION32_LE( 0x0800000, "user1", 0 ) + ROM_REGION32_LE( 0x0800000, "maindata", 0 ) ROM_LOAD32_WORD( "cruisn_exotica_u10_rev_1.3.u10", 0x0000000, 0x200000, CRC(ab7f1b5e) SHA1(c0c561e8cb15fd97465278b4b3b15acb27380c5d) ) // Version 1.3 Fri Feb 11, 2000 16:19:13 ROM_LOAD32_WORD( "cruisn_exotica_u11_rev_1.3.u11", 0x0000002, 0x200000, CRC(62d3c966) SHA1(9a485892295984a292501424d2c78caafac99a75) ) ROM_LOAD32_WORD( "cruisn_exotica_u12_rev.1.0.u12", 0x0400000, 0x200000, CRC(21f122b2) SHA1(5473401ec954bf9ab66a8283bd08d17c7960cd29) ) // These 2 ROMs might be labeled as a different version, ROM_LOAD32_WORD( "cruisn_exotica_u13_rev.1.0.u13", 0x0400002, 0x200000, CRC(cf9d3609) SHA1(6376891f478185d26370466bef92f0c5304d58d3) ) // but the data doesn't change. Verified for v1.3 & v1.6 - ROM_REGION32_LE( 0x3000000, "user2", 0 ) + ROM_REGION32_LE( 0x3000000, "bankeddata", 0 ) ROM_LOAD32_WORD( "cruisn_exotica_u14_rev.1.0.u14", 0x0000000, 0x400000, CRC(84452fc2) SHA1(06d87263f83ef079e6c5fb9de620e0135040c858) ) ROM_LOAD32_WORD( "cruisn_exotica_u15_rev.1.0.u15", 0x0000002, 0x400000, CRC(b6aaebdb) SHA1(6ede6ea123be6a88d1ff38e90f059c9d1f822d6d) ) ROM_LOAD32_WORD( "cruisn_exotica_u16_rev.1.0.u16", 0x0800000, 0x400000, CRC(aac6d2a5) SHA1(6c336520269d593b46b82414d9352a3f16955cc3) ) @@ -1725,13 +1835,13 @@ ROM_START( crusnexod ) ROM_REGION( 0x1000, "pic", 0 ) // PIC16c57 Code ROM_LOAD( "472_cruisn_exot_27.u53", 0x0000, 0x1000, CRC(7ff41d76) SHA1(13d23e634dc8d20fbee11a9c39923b7e54984672) ) // decapped but not hooked up - ROM_REGION32_LE( 0x0800000, "user1", 0 ) + ROM_REGION32_LE( 0x0800000, "maindata", 0 ) ROM_LOAD32_WORD( "cruisn_exotica_u10_rev.1.0.u10", 0x0000000, 0x200000, CRC(305fe2c1) SHA1(5d12163da0ae6db7d8d1f64f79c767a3c7df29a0) ) // Version 1.0 Tue Feb 08, 2000 13:22:04 ROM_LOAD32_WORD( "cruisn_exotica_u11_rev.1.0.u11", 0x0000002, 0x200000, CRC(50b241ff) SHA1(b8a353d9420009c4e521bb088575d704a7f386b3) ) ROM_LOAD32_WORD( "cruisn_exotica_u12_rev.1.0.u12", 0x0400000, 0x200000, CRC(21f122b2) SHA1(5473401ec954bf9ab66a8283bd08d17c7960cd29) ) ROM_LOAD32_WORD( "cruisn_exotica_u13_rev.1.0.u13", 0x0400002, 0x200000, CRC(cf9d3609) SHA1(6376891f478185d26370466bef92f0c5304d58d3) ) - ROM_REGION32_LE( 0x3000000, "user2", 0 ) + ROM_REGION32_LE( 0x3000000, "bankeddata", 0 ) ROM_LOAD32_WORD( "cruisn_exotica_u14_rev.1.0.u14", 0x0000000, 0x400000, CRC(84452fc2) SHA1(06d87263f83ef079e6c5fb9de620e0135040c858) ) ROM_LOAD32_WORD( "cruisn_exotica_u15_rev.1.0.u15", 0x0000002, 0x400000, CRC(b6aaebdb) SHA1(6ede6ea123be6a88d1ff38e90f059c9d1f822d6d) ) ROM_LOAD32_WORD( "cruisn_exotica_u16_rev.1.0.u16", 0x0800000, 0x400000, CRC(aac6d2a5) SHA1(6c336520269d593b46b82414d9352a3f16955cc3) ) @@ -1755,13 +1865,13 @@ ROM_START( thegrid ) // Version 1.2 Program ROMs ROM_REGION( 0x2000, "pic", 0 ) // PIC16C57 ROM_LOAD( "pic16c57.u76", 0x0000, 0x1fff, CRC(8234d466) SHA1(5737e355d3262cd0b13191cdf9b49dd74f69dd15) ) // decapped but not hooked up - ROM_REGION32_LE( 0x0800000, "user1", 0 ) + ROM_REGION32_LE( 0x0800000, "maindata", 0 ) ROM_LOAD32_WORD( "thegrid-12.u10", 0x0000000, 0x100000, CRC(eb6c2d54) SHA1(ddd32757a9be011988b7add3c091e93292a0867c) ) ROM_LOAD32_WORD( "thegrid-12.u11", 0x0000002, 0x100000, CRC(b9b5f92b) SHA1(36e16f109af9a5172869344f09b337b67e0b3e11) ) ROM_LOAD32_WORD( "thegrid-12.u12", 0x0200000, 0x100000, CRC(2810c207) SHA1(d244eaf85473ed49442a906d437af1a9f91a2f9d) ) ROM_LOAD32_WORD( "thegrid-12.u13", 0x0200002, 0x100000, CRC(8b721848) SHA1(d82f39045437ada2061587176e24f558a5e203fe) ) - ROM_REGION32_LE( 0x3000000, "user2", 0 ) + ROM_REGION32_LE( 0x3000000, "bankeddata", 0 ) ROM_LOAD32_WORD( "the_grid.u18", 0x0000000, 0x400000, CRC(3a3460be) SHA1(e719dae8a2e54584cb6a074ed42e35e3debef2f6) ) ROM_LOAD32_WORD( "the_grid.u19", 0x0000002, 0x400000, CRC(af262d5b) SHA1(3eb3980fa81a360a70aa74e793b2bc3028f68cf2) ) ROM_LOAD32_WORD( "the_grid.u20", 0x0800000, 0x400000, CRC(e6ad1917) SHA1(acab25e1251fd07b374badebe79f6ec1772b3589) ) @@ -1780,13 +1890,13 @@ ROM_START( thegrida ) // Version 1.1 Program ROMs ROM_REGION( 0x2000, "pic", 0 ) // PIC16C57 ROM_LOAD( "pic16c57.u76", 0x0000, 0x1fff, CRC(8234d466) SHA1(5737e355d3262cd0b13191cdf9b49dd74f69dd15) ) // decapped but not hooked up - ROM_REGION32_LE( 0x0800000, "user1", 0 ) + ROM_REGION32_LE( 0x0800000, "maindata", 0 ) ROM_LOAD32_WORD( "thegrid-11.u10", 0x0000000, 0x100000, CRC(87ea0e9e) SHA1(618de2ca87b7a3e0225d1f7e65f8fc1356de1421) ) ROM_LOAD32_WORD( "thegrid-11.u11", 0x0000002, 0x100000, CRC(73d84b1a) SHA1(8dcfcab5ff64f46f8486e6439a10d91ad26fd48a) ) ROM_LOAD32_WORD( "thegrid-11.u12", 0x0200000, 0x100000, CRC(78d16ca1) SHA1(7b893ec8af2f44d8bc293861fd8622d68d41ccbe) ) ROM_LOAD32_WORD( "thegrid-11.u13", 0x0200002, 0x100000, CRC(8e00b400) SHA1(96581c5da62afc19e6d69b2352b3166665cb9918) ) - ROM_REGION32_LE( 0x3000000, "user2", 0 ) + ROM_REGION32_LE( 0x3000000, "bankeddata", 0 ) ROM_LOAD32_WORD( "the_grid.u18", 0x0000000, 0x400000, CRC(3a3460be) SHA1(e719dae8a2e54584cb6a074ed42e35e3debef2f6) ) ROM_LOAD32_WORD( "the_grid.u19", 0x0000002, 0x400000, CRC(af262d5b) SHA1(3eb3980fa81a360a70aa74e793b2bc3028f68cf2) ) ROM_LOAD32_WORD( "the_grid.u20", 0x0800000, 0x400000, CRC(e6ad1917) SHA1(acab25e1251fd07b374badebe79f6ec1772b3589) ) @@ -1804,13 +1914,13 @@ ROM_START( thegridb ) // Version 1.01 Program ROMs ROM_REGION( 0x2000, "pic", 0 ) // PIC16C57 ROM_LOAD( "pic16c57.u76", 0x0000, 0x1fff, CRC(8234d466) SHA1(5737e355d3262cd0b13191cdf9b49dd74f69dd15) ) // decapped but not hooked up - ROM_REGION32_LE( 0x0800000, "user1", 0 ) + ROM_REGION32_LE( 0x0800000, "maindata", 0 ) ROM_LOAD32_WORD( "mpg_the_grid_1-17-00_ver1.01_54e6.u10", 0x0000000, 0x100000, CRC(cd0bf7c3) SHA1(8b490955381c078443e048dadd78fa931754bd0f) ) ROM_LOAD32_WORD( "mpg_the_grid_1-17-00_ver1.01_568d.u11", 0x0000002, 0x100000, CRC(ffea0d0a) SHA1(f0fe36b9f2fe890957a0dcc05bb091a78357cced) ) ROM_LOAD32_WORD( "mpg_the_grid_1-17-00_ver1.01_a117.u12", 0x0200000, 0x100000, CRC(ad54ad55) SHA1(2c7175bed85c75070357c83009527229e4943fe0) ) ROM_LOAD32_WORD( "mpg_the_grid_1-17-00_ver1.01_5694.u13", 0x0200002, 0x100000, CRC(976a3ab8) SHA1(6e521525208358f270a4961cad408ed598a25c88) ) - ROM_REGION32_LE( 0x3000000, "user2", 0 ) + ROM_REGION32_LE( 0x3000000, "bankeddata", 0 ) ROM_LOAD32_WORD( "the_grid.u18", 0x0000000, 0x400000, CRC(3a3460be) SHA1(e719dae8a2e54584cb6a074ed42e35e3debef2f6) ) ROM_LOAD32_WORD( "the_grid.u19", 0x0000002, 0x400000, CRC(af262d5b) SHA1(3eb3980fa81a360a70aa74e793b2bc3028f68cf2) ) ROM_LOAD32_WORD( "the_grid.u20", 0x0800000, 0x400000, CRC(e6ad1917) SHA1(acab25e1251fd07b374badebe79f6ec1772b3589) ) @@ -1821,59 +1931,24 @@ ROM_END -/************************************* - * - * Driver init - * - *************************************/ - -void midzeus_state::init_mk4() -{ -} - - -void midzeus_state::init_invasn() -{ - m_maincpu->space(AS_PROGRAM).install_read_handler(0x9c0000, 0x9c0000, read32smo_delegate(*this, FUNC(midzeus_state::invasn_gun_r))); - m_maincpu->space(AS_PROGRAM).install_write_handler(0x9c0000, 0x9c0000, write32s_delegate(*this, FUNC(midzeus_state::invasn_gun_w))); -} - - -void midzeus2_state::init_crusnexo() -{ - membank("bank1")->configure_entries(0, 3, memregion("user2")->base(), 0x400000*4); - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x9b0004, 0x9b0007, read32sm_delegate(*this, FUNC(midzeus2_state::crusnexo_leds_r)), write32sm_delegate(*this, FUNC(midzeus2_state::crusnexo_leds_w))); - m_maincpu->space(AS_PROGRAM).install_write_handler (0x8d0009, 0x8d000a, write32sm_delegate(*this, FUNC(midzeus_state::keypad_select_w))); -} - - -void midzeus2_state::init_thegrid() -{ - membank("bank1")->configure_entries(0, 3, memregion("user2")->base(), 0x400000*4); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x8c0000, 0x8c0001, read32sm_delegate(*this, FUNC(midzeus_state::trackball_r))); - m_maincpu->space(AS_PROGRAM).install_read_handler(0x9b0000, 0x9b0004, read32sm_delegate(*this, FUNC(midzeus_state::grid_keypad_r))); -} - - - /************************************* * * Game drivers * *************************************/ -GAME( 1997, mk4, 0, mk4, mk4, midzeus_state, init_mk4, ROT0, "Midway", "Mortal Kombat 4 (version 3.0)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1997, mk4a, mk4, mk4, mk4, midzeus_state, init_mk4, ROT0, "Midway", "Mortal Kombat 4 (version 2.1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1997, mk4b, mk4, mk4, mk4, midzeus_state, init_mk4, ROT0, "Midway", "Mortal Kombat 4 (version 1.0)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1999, invasnab, 0, invasn, invasn, midzeus_state, init_invasn, ROT0, "Midway", "Invasion - The Abductors (version 5.0)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1999, invasnab4, invasnab, invasn, invasn, midzeus_state, init_invasn, ROT0, "Midway", "Invasion - The Abductors (version 4.0)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAME( 1999, invasnab3, invasnab, invasn, invasn, midzeus_state, init_invasn, ROT0, "Midway", "Invasion - The Abductors (version 3.0)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) -GAMEL( 1999, crusnexo, 0, crusnexo, crusnexo, midzeus2_state, init_crusnexo, ROT0, "Midway", "Cruis'n Exotica (version 2.4)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE, layout_crusnexo ) -GAMEL( 1999, crusnexoa, crusnexo, crusnexo, crusnexo, midzeus2_state, init_crusnexo, ROT0, "Midway", "Cruis'n Exotica (version 2.0)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE, layout_crusnexo ) -GAMEL( 1999, crusnexoaa, crusnexo, crusnexo, crusnexo, midzeus2_state, init_crusnexo, ROT0, "Midway", "Cruis'n Exotica (version 2.0, alternate ROM format)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE, layout_crusnexo ) -GAMEL( 1999, crusnexob, crusnexo, crusnexo, crusnexo, midzeus2_state, init_crusnexo, ROT0, "Midway", "Cruis'n Exotica (version 1.6)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE, layout_crusnexo ) -GAMEL( 1999, crusnexoc, crusnexo, crusnexo, crusnexo, midzeus2_state, init_crusnexo, ROT0, "Midway", "Cruis'n Exotica (version 1.3)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE, layout_crusnexo ) -GAMEL( 1999, crusnexod, crusnexo, crusnexo, crusnexo, midzeus2_state, init_crusnexo, ROT0, "Midway", "Cruis'n Exotica (version 1.0)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE, layout_crusnexo ) -GAME( 2000, thegrid, 0, thegrid, thegrid, midzeus2_state, init_thegrid, ROT0, "Midway", "The Grid (version 1.2)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // 10/16/00 -GAME( 2000, thegrida, thegrid, thegrid, thegrid, midzeus2_state, init_thegrid, ROT0, "Midway", "The Grid (version 1.1)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // 07/26/00 -GAME( 2000, thegridb, thegrid, thegrid, thegrid, midzeus2_state, init_thegrid, ROT0, "Midway", "The Grid (version 1.01)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // 07/17/00 +GAME( 1997, mk4, 0, mk4, mk4, midzeus_state, empty_init, ROT0, "Midway", "Mortal Kombat 4 (version 3.0)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1997, mk4a, mk4, mk4, mk4, midzeus_state, empty_init, ROT0, "Midway", "Mortal Kombat 4 (version 2.1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1997, mk4b, mk4, mk4, mk4, midzeus_state, empty_init, ROT0, "Midway", "Mortal Kombat 4 (version 1.0)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1999, invasnab, 0, invasn, invasn, invasnab_state, empty_init, ROT0, "Midway", "Invasion - The Abductors (version 5.0)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1999, invasnab4, invasnab, invasn, invasn, invasnab_state, empty_init, ROT0, "Midway", "Invasion - The Abductors (version 4.0)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAME( 1999, invasnab3, invasnab, invasn, invasn, invasnab_state, empty_init, ROT0, "Midway", "Invasion - The Abductors (version 3.0)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) +GAMEL( 1999, crusnexo, 0, crusnexo, crusnexo, crusnexo_state, empty_init, ROT0, "Midway", "Cruis'n Exotica (version 2.4)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE, layout_crusnexo ) +GAMEL( 1999, crusnexoa, crusnexo, crusnexo, crusnexo, crusnexo_state, empty_init, ROT0, "Midway", "Cruis'n Exotica (version 2.0)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE, layout_crusnexo ) +GAMEL( 1999, crusnexoaa, crusnexo, crusnexo, crusnexo, crusnexo_state, empty_init, ROT0, "Midway", "Cruis'n Exotica (version 2.0, alternate ROM format)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE, layout_crusnexo ) +GAMEL( 1999, crusnexob, crusnexo, crusnexo, crusnexo, crusnexo_state, empty_init, ROT0, "Midway", "Cruis'n Exotica (version 1.6)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE, layout_crusnexo ) +GAMEL( 1999, crusnexoc, crusnexo, crusnexo, crusnexo, crusnexo_state, empty_init, ROT0, "Midway", "Cruis'n Exotica (version 1.3)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE, layout_crusnexo ) +GAMEL( 1999, crusnexod, crusnexo, crusnexo, crusnexo, crusnexo_state, empty_init, ROT0, "Midway", "Cruis'n Exotica (version 1.0)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE, layout_crusnexo ) +GAME( 2000, thegrid, 0, thegrid, thegrid, thegrid_state, empty_init, ROT0, "Midway", "The Grid (version 1.2)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // 10/16/00 +GAME( 2000, thegrida, thegrid, thegrid, thegrid, thegrid_state, empty_init, ROT0, "Midway", "The Grid (version 1.1)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // 07/26/00 +GAME( 2000, thegridb, thegrid, thegrid, thegrid, thegrid_state, empty_init, ROT0, "Midway", "The Grid (version 1.01)", MACHINE_NOT_WORKING | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) // 07/17/00 diff --git a/src/mame/midway/midzeus.h b/src/mame/midway/midzeus.h index f8a8e8185a7..6c2ec5a2597 100644 --- a/src/mame/midway/midzeus.h +++ b/src/mame/midway/midzeus.h @@ -6,8 +6,6 @@ **************************************************************************/ -#define MIDZEUS_VIDEO_CLOCK XTAL(66'666'700) - #include "machine/timekpr.h" #include "emupal.h" #include "screen.h" @@ -67,105 +65,61 @@ class midzeus_state : public driver_device public: midzeus_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_nvram(*this, "nvram"), - m_ram_base(*this, "ram_base"), - m_tms32031_control(*this, "tms32031_ctl"), m_zeusbase(*this, "zeusbase"), - m_m48t35(*this, "m48t35"), m_maincpu(*this, "maincpu"), m_screen(*this, "screen"), m_palette(*this, "palette"), m_ioasic(*this, "ioasic"), - m_io_analog(*this, "ANALOG%u", 0U), - m_io_gun_x(*this, "GUNX%u", 1U), - m_io_gun_y(*this, "GUNY%u", 1U), - m_io_trackx(*this, "TRACKX1"), - m_io_tracky(*this, "TRACKY1"), - m_io_49way_x(*this, "49WAYX"), - m_io_49way_y(*this, "49WAYY"), - m_io_keypad(*this, "KEYPAD"), - m_digits(*this, "digit%u", 0U) + m_ram_base(*this, "ram_base"), + m_nvram(*this, "nvram"), + m_tms32032_control(*this, "tms32032_ctl"), + m_mainbank(*this, "mainbank") { } - // turn on for hardcoded video debugging inputs - static constexpr bool DEBUG_KEYS = false; - - //static constexpr XTAL CPU_CLOCK = XTAL(60'000'000); - static constexpr int BEAM_DY = 3; - static constexpr int BEAM_DX = 3; - static constexpr int BEAM_XOFFS = 40; // table in the code indicates an offset of 20 with a beam height of 7 + void mk4(machine_config &config); - required_shared_ptr m_nvram; - required_shared_ptr m_ram_base; - required_shared_ptr m_tms32031_control; optional_shared_ptr m_zeusbase; +protected: + virtual void machine_start() override; + virtual void machine_reset() override; + virtual void video_start() override; + void cmos_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); uint32_t cmos_r(offs_t offset); void cmos_protect_w(uint32_t data); - uint32_t zpram_r(offs_t offset); - void zpram_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); uint32_t disk_asic_jr_r(offs_t offset); void disk_asic_jr_w(offs_t offset, uint32_t data); - uint32_t tms32031_control_r(offs_t offset); - void tms32031_control_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); - void keypad_select_w(offs_t offset, uint32_t data); - uint32_t analog_r(offs_t offset); - void analog_w(uint32_t data); - void invasn_gun_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); - uint32_t invasn_gun_r(); + uint32_t tms32032_control_r(offs_t offset); + void tms32032_control_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); uint32_t zeus_r(offs_t offset); void zeus_w(offs_t offset, uint32_t data); - DECLARE_CUSTOM_INPUT_MEMBER(custom_49way_r); - DECLARE_CUSTOM_INPUT_MEMBER(keypad_r); - uint32_t grid_keypad_r(offs_t offset); - uint32_t trackball_r(offs_t offset); - void init_invasn(); - void init_mk4(); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(display_irq); TIMER_CALLBACK_MEMBER(display_irq_off); - TIMER_CALLBACK_MEMBER(invasn_gun_callback); - void midzeus(machine_config &config); - void invasn(machine_config &config); - void mk4(machine_config &config); - void zeus_map(address_map &map); - -protected: - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - optional_device m_m48t35; - required_device m_maincpu; - required_device m_screen; - optional_device m_palette; - required_device m_ioasic; - optional_ioport_array<4> m_io_analog; - optional_ioport_array<2> m_io_gun_x; - optional_ioport_array<2> m_io_gun_y; - optional_ioport m_io_trackx; - optional_ioport m_io_tracky; - optional_ioport m_io_49way_x; - optional_ioport m_io_49way_y; - optional_ioport m_io_keypad; - output_finder<7> m_digits; + void zeus_map(address_map &map); + void midzeus(machine_config &config); emu_timer * m_display_irq_off_timer = nullptr; - uint8_t m_crusnexo_leds_select = 0; uint32_t m_disk_asic_jr[0x10]{}; uint8_t m_cmos_protected = 0; emu_timer * m_timer[2]{}; + required_device m_maincpu; + required_device m_screen; + optional_device m_palette; + required_device m_ioasic; + required_shared_ptr m_ram_base; + required_shared_ptr m_nvram; + required_shared_ptr m_tms32032_control; + optional_memory_bank m_mainbank; + private: - uint32_t m_gun_control = 0; - uint8_t m_gun_irq_state = 0; - emu_timer * m_gun_timer[2]{}; - int32_t m_gun_x[2]{}, m_gun_y[2]{}; - uint8_t m_keypad_select = 0; + static constexpr XTAL MIDZEUS_VIDEO_CLOCK = XTAL(66'666'700); void exit_handler(); void zeus_pointer_w(uint32_t which, uint32_t data, bool logit); @@ -177,7 +131,6 @@ class midzeus_state : public driver_device void log_fifo_command(const uint32_t *data, int numwords, const char *suffix); void log_waveram(uint32_t length_and_base); - void update_gun_irq(); void *waveram0_ptr_from_block_addr(uint32_t addr); void *waveram0_ptr_from_expanded_addr(uint32_t addr); @@ -208,3 +161,35 @@ class midzeus_state : public driver_device int m_texel_width = 0; int m_is_mk4b = 0; }; + +class invasnab_state : public midzeus_state +{ +public: + invasnab_state(const machine_config &mconfig, device_type type, const char *tag) : + midzeus_state(mconfig, type, tag), + m_io_gun_x(*this, "GUNX%u", 1U), + m_io_gun_y(*this, "GUNY%u", 1U) + { } + + void invasn(machine_config &config); + +protected: + virtual void machine_start() override; + +private: + void invasn_gun_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); + uint32_t invasn_gun_r(); + + void update_gun_irq(); + TIMER_CALLBACK_MEMBER(invasn_gun_callback); + + void invasnab_map(address_map &map); + + uint32_t m_gun_control = 0; + uint8_t m_gun_irq_state = 0; + emu_timer * m_gun_timer[2]{}; + int32_t m_gun_x[2]{}, m_gun_y[2]{}; + + required_ioport_array<2> m_io_gun_x; + required_ioport_array<2> m_io_gun_y; +}; diff --git a/src/mame/midway/midzeus_v.cpp b/src/mame/midway/midzeus_v.cpp index a066734e776..9485bed740f 100644 --- a/src/mame/midway/midzeus_v.cpp +++ b/src/mame/midway/midzeus_v.cpp @@ -11,6 +11,29 @@ #include "video/rgbutil.h" +#define LOG_ZEUS (1U << 1) +#define LOG_PTR (1U << 2) +#define LOG_REGS (1U << 3) +#define LOG_CMD (1U << 4) +#define LOG_MODEL (1U << 5) +#define LOG_QUAD (1U << 6) +#define LOG_FIFO (1U << 7) +#define LOG_WAVE (1U << 8) + +#define LOG_ALL (LOG_ZEUS | LOG_PTR | LOG_REGS | LOG_CMD | LOG_MODEL | LOG_QUAD | LOG_FIFO | LOG_WAVE) + +#define VERBOSE (0) +#include "logmacro.h" + +#define LOGZEUS(...) LOGMASKED(LOG_ZEUS, __VA_ARGS__) +#define LOGPTR(...) LOGMASKED(LOG_PTR, __VA_ARGS__) +#define LOGREGS(...) LOGMASKED(LOG_REGS, __VA_ARGS__) +#define LOGCMD(...) LOGMASKED(LOG_CMD, __VA_ARGS__) +#define LOGMODEL(...) LOGMASKED(LOG_MODEL, __VA_ARGS__) +#define LOGQUAD(...) LOGMASKED(LOG_QUAD, __VA_ARGS__) +#define LOGFIFO(...) LOGMASKED(LOG_FIFO, __VA_ARGS__) +#define LOGWAVE(...) LOGMASKED(LOG_WAVE, __VA_ARGS__) + /************************************* * @@ -20,20 +43,23 @@ #define DUMP_WAVE_RAM 0 -#define WAVERAM0_WIDTH 512 -#define WAVERAM0_HEIGHT 2048 +// turn on for hardcoded video debugging inputs +static constexpr bool DEBUG_KEYS = false; + +static constexpr uint32_t WAVERAM0_WIDTH = 512; +static constexpr uint32_t WAVERAM0_HEIGHT = 2048; -#define WAVERAM1_WIDTH 512 -#define WAVERAM1_HEIGHT 512 +static constexpr uint32_t WAVERAM1_WIDTH = 512; +static constexpr uint32_t WAVERAM1_HEIGHT = 512; -#define BLEND_OPAQUE1 0x00000000 -#define BLEND_OPAQUE2 0x4b23cb00 -#define BLEND_OPAQUE3 0x4b23dd00 -#define BLEND_OPAQUE4 0x00004800 -#define BLEND_OPAQUE5 0xdd23dd00 -#define BLEND_ADD1 0x40b68800 -#define BLEND_ADD2 0xc9b78800 -#define BLEND_MUL1 0x4093c800 +static constexpr uint32_t BLEND_OPAQUE1 = 0x00000000; +static constexpr uint32_t BLEND_OPAQUE2 = 0x4b23cb00; +static constexpr uint32_t BLEND_OPAQUE3 = 0x4b23dd00; +static constexpr uint32_t BLEND_OPAQUE4 = 0x00004800; +static constexpr uint32_t BLEND_OPAQUE5 = 0xdd23dd00; +static constexpr uint32_t BLEND_ADD1 = 0x40b68800; +static constexpr uint32_t BLEND_ADD2 = 0xc9b78800; +static constexpr uint32_t BLEND_MUL1 = 0x4093c800; /************************************* @@ -90,25 +116,25 @@ static inline uint8_t get_texel_alt_8bit(const void *base, int y, int x, int wid inline void *midzeus_state::waveram0_ptr_from_block_addr(uint32_t addr) { - uint32_t blocknum = (addr % WAVERAM0_WIDTH) + ((addr >> 12) % WAVERAM0_HEIGHT) * WAVERAM0_WIDTH; + uint32_t const blocknum = (addr % WAVERAM0_WIDTH) + ((addr >> 12) % WAVERAM0_HEIGHT) * WAVERAM0_WIDTH; return WAVERAM_BLOCK0(blocknum); } inline void *midzeus_state::waveram0_ptr_from_expanded_addr(uint32_t addr) { - uint32_t blocknum = (addr % WAVERAM0_WIDTH) + ((addr >> 16) % WAVERAM0_HEIGHT) * WAVERAM0_WIDTH; + uint32_t const blocknum = (addr % WAVERAM0_WIDTH) + ((addr >> 16) % WAVERAM0_HEIGHT) * WAVERAM0_WIDTH; return WAVERAM_BLOCK0(blocknum); } inline void *midzeus_state::waveram1_ptr_from_expanded_addr(uint32_t addr) { - uint32_t blocknum = (addr % WAVERAM1_WIDTH) + ((addr >> 16) % WAVERAM1_HEIGHT) * WAVERAM1_WIDTH; + uint32_t const blocknum = (addr % WAVERAM1_WIDTH) + ((addr >> 16) % WAVERAM1_HEIGHT) * WAVERAM1_WIDTH; return WAVERAM_BLOCK1(blocknum); } inline void *midzeus_state::waveram0_ptr_from_texture_addr(uint32_t addr, int width) { - uint32_t blocknum = (((addr & ~1) * width) / 8) % (WAVERAM0_WIDTH * WAVERAM0_HEIGHT); + uint32_t const blocknum = (((addr & ~1) * width) / 8) % (WAVERAM0_WIDTH * WAVERAM0_HEIGHT); return WAVERAM_BLOCK0(blocknum); } @@ -170,26 +196,26 @@ inline void midzeus_state::waveram_plot_check_depth_nowrite(int y, int x, uint16 // 4x2 block size static inline uint8_t get_texel_4bit(const void *base, int y, int x, int width) { - uint32_t byteoffs = (y / 2) * (width * 2) + ((x / 8) << 3) + ((y & 1) << 2) + ((x / 2) & 3); + uint32_t const byteoffs = (y / 2) * (width * 2) + ((x / 8) << 3) + ((y & 1) << 2) + ((x / 2) & 3); return (WAVERAM_READ8(base, byteoffs) >> (4 * (x & 1))) & 0x0f; } static inline uint8_t get_texel_8bit(const void *base, int y, int x, int width) { - uint32_t byteoffs = (y / 2) * (width * 2) + ((x / 4) << 3) + ((y & 1) << 2) + (x & 3); + uint32_t const byteoffs = (y / 2) * (width * 2) + ((x / 4) << 3) + ((y & 1) << 2) + (x & 3); return WAVERAM_READ8(base, byteoffs); } // 2x2 block size static inline uint8_t get_texel_alt_4bit(const void *base, int y, int x, int width) { - uint32_t byteoffs = (y / 4) * (width * 4) + ((x / 4) << 3) + ((y & 3) << 1) + ((x / 2) & 1); + uint32_t const byteoffs = (y / 4) * (width * 4) + ((x / 4) << 3) + ((y & 3) << 1) + ((x / 2) & 1); return (WAVERAM_READ8(base, byteoffs) >> (4 * (x & 1))) & 0x0f; } static inline uint8_t get_texel_alt_8bit(const void *base, int y, int x, int width) { - uint32_t byteoffs = (y / 4) * (width * 4) + ((x / 2) << 3) + ((y & 3) << 1) + (x & 1); + uint32_t const byteoffs = (y / 4) * (width * 4) + ((x / 2) << 3) + ((y & 3) << 1) + (x & 1); return WAVERAM_READ8(base, byteoffs); } @@ -206,25 +232,21 @@ midzeus_renderer::midzeus_renderer(midzeus_state &state) void midzeus_state::video_start() { - /* allocate memory for "wave" RAM */ + // allocate memory for "wave" RAM m_waveram[0] = std::make_unique(WAVERAM0_WIDTH * WAVERAM0_HEIGHT * 8/4); m_waveram[1] = std::make_unique(WAVERAM1_WIDTH * WAVERAM1_HEIGHT * 8/4); - /* initialize a 5-5-5 palette */ - for (int i = 0; i < 32768; i++) - m_palette->set_pen_color(i, pal5bit(i >> 10), pal5bit(i >> 5), pal5bit(i >> 0)); - - /* initialize polygon engine */ + // initialize polygon engine m_poly = std::make_unique(*this); - /* we need to cleanup on exit */ + // we need to cleanup on exit machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(&midzeus_state::exit_handler, this)); m_yoffs = 0; m_texel_width = 256; m_zeus_renderbase = m_waveram[1].get(); - /* state saving */ + // state saving save_item(NAME(m_zeus_fifo)); save_item(NAME(m_zeus_fifo_words)); save_item(NAME(m_zeus_matrix)); @@ -239,7 +261,7 @@ void midzeus_state::video_start() save_pointer(NAME(m_waveram[0]), WAVERAM0_WIDTH * WAVERAM0_HEIGHT * 8 / sizeof(m_waveram[0][0])); save_pointer(NAME(m_waveram[1]), WAVERAM1_WIDTH * WAVERAM1_HEIGHT * 8 / sizeof(m_waveram[1][0])); - /* hack */ + // hack m_is_mk4b = strcmp(machine().system().name, "mk4b") == 0; } @@ -274,7 +296,7 @@ uint32_t midzeus_state::screen_update(screen_device &screen, bitmap_ind16 &bitma { m_poly->wait("VIDEO_UPDATE"); - if (DEBUG_KEYS && machine().input().code_pressed(KEYCODE_V)) /* waveram drawing case */ + if (DEBUG_KEYS && machine().input().code_pressed(KEYCODE_V)) // waveram drawing case { const void *base; @@ -298,10 +320,10 @@ uint32_t midzeus_state::screen_update(screen_device &screen, bitmap_ind16 &bitma popmessage("offs = %06X", m_yoffs << 12); } - else /* normal update case */ + else // normal update case { const void *base = waveram1_ptr_from_expanded_addr(m_zeusbase[0xcc]); - int xoffs = screen.visible_area().min_x; + int const xoffs = screen.visible_area().min_x; for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { uint16_t *const dest = &bitmap.pix(y); @@ -324,7 +346,7 @@ uint32_t midzeus_state::screen_update(screen_device &screen, bitmap_ind16 &bitma uint32_t midzeus_state::zeus_r(offs_t offset) { - bool logit = (offset < 0xb0 || offset > 0xb7); + bool logit = ((!machine().side_effects_disabled()) && (offset < 0xb0 || offset > 0xb7)); uint32_t result = m_zeusbase[offset & ~1]; switch (offset & ~1) @@ -355,7 +377,7 @@ uint32_t midzeus_state::zeus_r(offs_t offset) break; } - /* 32-bit mode */ + // 32-bit mode if (m_zeusbase[0x80] & 0x00020000) { if (offset & 1) @@ -363,15 +385,15 @@ uint32_t midzeus_state::zeus_r(offs_t offset) if (logit) { if (offset & 1) - logerror("%06X:zeus32_r(%02X) = %08X -- unexpected in 32-bit mode\n", m_maincpu->pc(), offset, result); + LOGZEUS("%06X:zeus32_r(%02X) = %08X -- unexpected in 32-bit mode\n", m_maincpu->pc(), offset, result); else if (offset != 0xe0) - logerror("%06X:zeus32_r(%02X) = %08X\n", m_maincpu->pc(), offset, result); + LOGZEUS("%06X:zeus32_r(%02X) = %08X\n", m_maincpu->pc(), offset, result); else - logerror("%06X:zeus32_r(%02X) = %08X\n", m_maincpu->pc(), offset, result); + LOGZEUS("%06X:zeus32_r(%02X) = %08X\n", m_maincpu->pc(), offset, result); } } - /* 16-bit mode */ + // 16-bit mode else { if (offset & 1) @@ -379,7 +401,7 @@ uint32_t midzeus_state::zeus_r(offs_t offset) else result &= 0xffff; if (logit) - logerror("%06X:zeus16_r(%02X) = %04X\n", m_maincpu->pc(), offset, result); + LOGZEUS("%06X:zeus16_r(%02X) = %04X\n", m_maincpu->pc(), offset, result); } return result; } @@ -397,13 +419,13 @@ void midzeus_state::zeus_w(offs_t offset, uint32_t data) bool logit = m_zeus_enable_logging || ((offset < 0xb0 || offset > 0xb7) && (offset < 0xe0 || offset > 0xe1)); if (logit) - logerror("%06X:zeus_w", m_maincpu->pc()); + LOGZEUS("%06X:zeus_w", m_maincpu->pc()); - /* 32-bit mode */ + // 32-bit mode if (m_zeusbase[0x80] & 0x00020000) zeus_register32_w(offset, data, logit); - /* 16-bit mode */ + // 16-bit mode else zeus_register16_w(offset, data, logit); } @@ -424,20 +446,20 @@ void midzeus_state::zeus_pointer_w(uint32_t which, uint32_t data, bool logit) case 0x008000: case 0x018000: if (logit) - logerror(" -- setptr(objdata)\n"); + LOGPTR(" -- setptr(objdata)\n"); m_zeus_objdata = data; break; // case 0x00c040: -- set in model data in invasn case 0x00c040: if (logit) - logerror(" -- setptr(palbase)\n"); + LOGPTR(" -- setptr(palbase)\n"); m_zeus_palbase = data; break; case 0x02c0f0: if (logit) - logerror(" -- setptr(unkbase)\n"); + LOGPTR(" -- setptr(unkbase)\n"); m_zeus_unkbase = data; break; @@ -469,7 +491,7 @@ void midzeus_state::zeus_pointer_w(uint32_t which, uint32_t data, bool logit) default: if (logit) - logerror(" -- setptr(%06X)\n", which & 0xffffff); + LOGPTR(" -- setptr(%06X)\n", which & 0xffffff); break; } @@ -487,23 +509,23 @@ void midzeus_state::zeus_pointer_w(uint32_t which, uint32_t data, bool logit) void midzeus_state::zeus_register16_w(offs_t offset, uint16_t data, bool logit) { - /* writes to register $CC need to force a partial update */ + // writes to register $CC need to force a partial update if ((offset & ~1) == 0xcc) m_screen->update_partial(m_screen->vpos()); - /* write to high part on odd addresses */ + // write to high part on odd addresses if (offset & 1) m_zeusbase[offset & ~1] = (m_zeusbase[offset & ~1] & 0x0000ffff) | (data << 16); - /* write to low part on event addresses */ + // write to low part on event addresses else m_zeusbase[offset & ~1] = (m_zeusbase[offset & ~1] & 0xffff0000) | (data & 0xffff); - /* log appropriately */ + // log appropriately if (logit) - logerror("(%02X) = %04X [%08X]\n", offset, data & 0xffff, m_zeusbase[offset & ~1]); + LOGREGS("(%02X) = %04X [%08X]\n", offset, data & 0xffff, m_zeusbase[offset & ~1]); - /* handle the update */ + // handle the update if ((offset & 1) == 0) zeus_register_update(offset); } @@ -511,25 +533,25 @@ void midzeus_state::zeus_register16_w(offs_t offset, uint16_t data, bool logit) void midzeus_state::zeus_register32_w(offs_t offset, uint32_t data, bool logit) { - /* writes to register $CC need to force a partial update */ + // writes to register $CC need to force a partial update if ((offset & ~1) == 0xcc) m_screen->update_partial(m_screen->vpos()); - /* always write to low word? */ + // always write to low word? m_zeusbase[offset & ~1] = data; - /* log appropriately */ + // log appropriately if (logit) { if (offset & 1) - logerror("(%02X) = %08X -- unexpected in 32-bit mode\n", offset, data); + LOGREGS("(%02X) = %08X -- unexpected in 32-bit mode\n", offset, data); else if (offset != 0xe0) - logerror("(%02X) = %08X\n", offset, data); + LOGREGS("(%02X) = %08X\n", offset, data); else - logerror("(%02X) = %08X\n", offset, data); + LOGREGS("(%02X) = %08X\n", offset, data); } - /* handle the update */ + // handle the update if ((offset & 1) == 0) zeus_register_update(offset); } @@ -544,7 +566,7 @@ void midzeus_state::zeus_register32_w(offs_t offset, uint32_t data, bool logit) void midzeus_state::zeus_register_update(offs_t offset) { - /* handle the writes; only trigger on low accesses */ + // handle the writes; only trigger on low accesses switch (offset) { case 0x52: @@ -552,7 +574,7 @@ void midzeus_state::zeus_register_update(offs_t offset) break; case 0x60: - /* invasn writes here to execute a command (?) */ + // invasn writes here to execute a command (?) if (m_zeusbase[0x60] & 1) { if ((m_zeusbase[0x80] & 0xffffff) == 0x22FCFF) @@ -598,7 +620,7 @@ void midzeus_state::zeus_register_update(offs_t offset) m_poly->wait("Normal"); } else - logerror("Execute unknown command\n"); + LOGCMD("Execute unknown command\n"); } break; @@ -625,8 +647,8 @@ void midzeus_state::zeus_register_update(offs_t offset) break; case 0x84: - /* MK4: Written in tandem with 0xcc */ - /* MK4: Writes either 0x80 (and 0x000000 to 0xcc) or 0x00 (and 0x800000 to 0xcc) */ + // MK4: Written in tandem with 0xcc + // MK4: Writes either 0x80 (and 0x000000 to 0xcc) or 0x00 (and 0x800000 to 0xcc) m_zeus_renderbase = waveram1_ptr_from_expanded_addr(m_zeusbase[0x84] << 16); break; @@ -682,8 +704,8 @@ void midzeus_state::zeus_register_update(offs_t offset) case 0xca: m_screen->update_partial(m_screen->vpos()); { - int vtotal = m_zeusbase[0xca] >> 16; - int htotal = m_zeusbase[0xc6] >> 16; + int const vtotal = m_zeusbase[0xca] >> 16; + int const htotal = m_zeusbase[0xc6] >> 16; rectangle visarea(m_zeusbase[0xc6] & 0xffff, htotal - 3, 0, m_zeusbase[0xc8] & 0xffff); if (htotal > 0 && vtotal > 0 && visarea.min_x < visarea.max_x && visarea.max_y < vtotal) @@ -724,11 +746,11 @@ void midzeus_state::zeus_register_update(offs_t offset) int midzeus_state::zeus_fifo_process(const uint32_t *data, int numwords) { - /* handle logging */ + // handle logging switch (data[0] >> 24) { - /* 0x00/0x01: set pointer */ - /* in model data, this is 0x0C */ + // 0x00/0x01: set pointer + // in model data, this is 0x0C case 0x00: case 0x01: if (numwords < 2 && data[0] != 0) @@ -738,22 +760,22 @@ int midzeus_state::zeus_fifo_process(const uint32_t *data, int numwords) zeus_pointer_w(data[0] & 0xffffff, data[1], m_log_fifo); break; - /* 0x13: render model based on previously set information */ - case 0x13: /* invasn */ + // 0x13: render model based on previously set information + case 0x13: // invasn if (m_log_fifo) log_fifo_command(data, numwords, ""); zeus_draw_model((m_zeusbase[0x06] << 16), m_log_fifo); break; - /* 0x17: write 16-bit value to low registers */ + // 0x17: write 16-bit value to low registers case 0x17: if (m_log_fifo) log_fifo_command(data, numwords, " -- reg16"); zeus_register16_w((data[0] >> 16) & 0x7f, data[0], m_log_fifo); break; - /* 0x18: write 32-bit value to low registers */ - /* in model data, this is 0x19 */ + // 0x18: write 32-bit value to low registers + // in model data, this is 0x19 case 0x18: if (numwords < 2) return false; @@ -762,27 +784,27 @@ int midzeus_state::zeus_fifo_process(const uint32_t *data, int numwords) zeus_register32_w((data[0] >> 16) & 0x7f, data[1], m_log_fifo); break; - /* 0x1A/0x1B: sync pipeline(?) */ + // 0x1A/0x1B: sync pipeline(?) case 0x1a: case 0x1b: if (m_log_fifo) log_fifo_command(data, numwords, " -- sync\n"); break; - /* 0x1C/0x1E: write matrix and translation vector */ + // 0x1C/0x1E: write matrix and translation vector case 0x1c: case 0x1e: - /* single matrix form */ + // single matrix form if ((data[0] & 0xffff) != 0x7fff) { - /* requires 8 words total */ + // requires 8 words total if (numwords < 8) return false; if (m_log_fifo) { log_fifo_command(data, numwords, ""); - logerror("\n\t\tmatrix ( %04X %04X %04X ) ( %04X %04X %04X ) ( %04X %04X %04X )\n\t\tvector %8.2f %8.2f %8.5f\n", + LOGCMD("\n\t\tmatrix ( %04X %04X %04X ) ( %04X %04X %04X ) ( %04X %04X %04X )\n\t\tvector %8.2f %8.2f %8.5f\n", data[2] & 0xffff, data[2] >> 16, data[0] & 0xffff, data[3] & 0xffff, data[3] >> 16, data[1] >> 16, data[4] & 0xffff, data[4] >> 16, data[1] & 0xffff, @@ -791,30 +813,30 @@ int midzeus_state::zeus_fifo_process(const uint32_t *data, int numwords) (double)(int32_t)data[7] * (1.0 / (65536.0 * 512.0))); } - /* extract the matrix from the raw data */ + // extract the matrix from the raw data m_zeus_matrix[0][0] = data[2]; m_zeus_matrix[0][1] = data[2] >> 16; m_zeus_matrix[0][2] = data[0]; m_zeus_matrix[1][0] = data[3]; m_zeus_matrix[1][1] = data[3] >> 16; m_zeus_matrix[1][2] = data[1] >> 16; m_zeus_matrix[2][0] = data[4]; m_zeus_matrix[2][1] = data[4] >> 16; m_zeus_matrix[2][2] = data[1]; - /* extract the translation point from the raw data */ + // extract the translation point from the raw data m_zeus_point[0] = data[5]; m_zeus_point[1] = data[6]; m_zeus_point[2] = data[7]; } - /* double matrix form */ + // double matrix form else { int16_t matrix1[3][3]; int16_t matrix2[3][3]; - /* requires 13 words total */ + // requires 13 words total if (numwords < 13) return false; if (m_log_fifo) { log_fifo_command(data, numwords, ""); - logerror("\n\t\tmatrix ( %04X %04X %04X ) ( %04X %04X %04X ) ( %04X %04X %04X )\n\t\tmatrix ( %04X %04X %04X ) ( %04X %04X %04X ) ( %04X %04X %04X )\n\t\tvector %8.2f %8.2f %8.5f\n", + LOGCMD("\n\t\tmatrix ( %04X %04X %04X ) ( %04X %04X %04X ) ( %04X %04X %04X )\n\t\tmatrix ( %04X %04X %04X ) ( %04X %04X %04X ) ( %04X %04X %04X )\n\t\tvector %8.2f %8.2f %8.5f\n", data[4] & 0xffff, data[4] >> 16, data[5] >> 16, data[8] & 0xffff, data[8] >> 16, data[6] >> 16, data[9] & 0xffff, data[9] >> 16, data[7] >> 16, @@ -826,17 +848,17 @@ int midzeus_state::zeus_fifo_process(const uint32_t *data, int numwords) (double)(int32_t)data[12] * (1.0 / (65536.0 * 512.0))); } - /* extract the first matrix from the raw data */ + // extract the first matrix from the raw data matrix1[0][0] = data[4]; matrix1[0][1] = data[4] >> 16; matrix1[0][2] = data[5] >> 16; matrix1[1][0] = data[8]; matrix1[1][1] = data[8] >> 16; matrix1[1][2] = data[6] >> 16; matrix1[2][0] = data[9]; matrix1[2][1] = data[9] >> 16; matrix1[2][2] = data[7] >> 16; - /* extract the second matrix from the raw data */ + // extract the second matrix from the raw data matrix2[0][0] = data[1]; matrix2[0][1] = data[2]; matrix2[0][2] = data[3]; matrix2[1][0] = data[1] >> 16; matrix2[1][1] = data[2] >> 16; matrix2[1][2] = data[3] >> 16; matrix2[2][0] = data[5]; matrix2[2][1] = data[6]; matrix2[2][2] = data[7]; - /* multiply them together to get the final matrix */ + // multiply them together to get the final matrix m_zeus_matrix[0][0] = ((int64_t)(matrix1[0][0] * matrix2[0][0]) + (int64_t)(matrix1[0][1] * matrix2[1][0]) + (int64_t)(matrix1[0][2] * matrix2[2][0])) >> 16; m_zeus_matrix[0][1] = ((int64_t)(matrix1[0][0] * matrix2[0][1]) + (int64_t)(matrix1[0][1] * matrix2[1][1]) + (int64_t)(matrix1[0][2] * matrix2[2][1])) >> 16; m_zeus_matrix[0][2] = ((int64_t)(matrix1[0][0] * matrix2[0][2]) + (int64_t)(matrix1[0][1] * matrix2[1][2]) + (int64_t)(matrix1[0][2] * matrix2[2][2])) >> 16; @@ -847,15 +869,15 @@ int midzeus_state::zeus_fifo_process(const uint32_t *data, int numwords) m_zeus_matrix[2][1] = ((int64_t)(matrix1[2][0] * matrix2[0][1]) + (int64_t)(matrix1[2][1] * matrix2[1][1]) + (int64_t)(matrix1[2][2] * matrix2[2][1])) >> 16; m_zeus_matrix[2][2] = ((int64_t)(matrix1[2][0] * matrix2[0][2]) + (int64_t)(matrix1[2][1] * matrix2[1][2]) + (int64_t)(matrix1[2][2] * matrix2[2][2])) >> 16; - /* extract the translation point from the raw data */ + // extract the translation point from the raw data m_zeus_point[0] = data[10]; m_zeus_point[1] = data[11]; m_zeus_point[2] = data[12]; } break; - /* 0x23: some additional X,Y,Z coordinates */ - /* 0x2e: same for invasn */ + // 0x23: some additional X,Y,Z coordinates + // 0x2e: same for invasn case 0x23: case 0x2e: if (numwords < 2) @@ -863,18 +885,18 @@ int midzeus_state::zeus_fifo_process(const uint32_t *data, int numwords) if (m_log_fifo) { log_fifo_command(data, numwords, ""); - logerror(" -- light xyz = %d,%d,%d\n", (int16_t)data[1], (int16_t)(data[1] >> 16), (int16_t)data[0]); + LOGCMD(" -- light xyz = %d,%d,%d\n", (int16_t)data[1], (int16_t)(data[1] >> 16), (int16_t)data[0]); } m_zeus_light[0] = (int16_t)(data[1] & 0xffff); m_zeus_light[1] = (int16_t)(data[1] >> 16); m_zeus_light[2] = (int16_t)(data[0] & 0xffff); break; - /* 0x25: display control? */ - /* 0x28: same for mk4b */ - /* 0x30: same for invasn */ + // 0x25: display control? + // 0x28: same for mk4b + // 0x30: same for invasn case 0x25: - /* 0x25 is used differently in mk4b. What determines this? */ + // 0x25 is used differently in mk4b. What determines this? if (m_is_mk4b) { if (numwords < 2) @@ -893,28 +915,27 @@ int midzeus_state::zeus_fifo_process(const uint32_t *data, int numwords) if ((numwords < 10) && (data[0] & 0xffff7f) == 0) { - /* not right -- just a hack */ - int x, y; - for (y = m_zeus_cliprect.min_y; y <= m_zeus_cliprect.max_y; y++) - for (x = m_zeus_cliprect.min_x; x <= m_zeus_cliprect.max_x; x++) + // not right -- just a hack + for (int y = m_zeus_cliprect.min_y; y <= m_zeus_cliprect.max_y; y++) + for (int x = m_zeus_cliprect.min_x; x <= m_zeus_cliprect.max_x; x++) waveram_plot_depth(y, x, 0, 0x7fff); } else { - uint32_t texdata = (m_zeusbase[0x06] << 16) | (m_zeusbase[0x00] >> 16); + uint32_t const texdata = (m_zeusbase[0x06] << 16) | (m_zeusbase[0x00] >> 16); m_poly->zeus_draw_quad(false, data, texdata, m_log_fifo); } break; - /* 0x2d: unknown - invasn */ - /* 0x70: same for mk4 */ + // 0x2d: unknown - invasn + // 0x70: same for mk4 case 0x2d: case 0x70: if (m_log_fifo) log_fifo_command(data, numwords, "\n"); break; - /* 0x67: render model with inline texture info */ + // 0x67: render model with inline texture info case 0x67: if (numwords < 3) return false; @@ -925,7 +946,7 @@ int midzeus_state::zeus_fifo_process(const uint32_t *data, int numwords) break; default: - printf("Unknown command %08X\n", data[0]); + LOGCMD("Unknown command %08X\n", data[0]); if (m_log_fifo) log_fifo_command(data, numwords, "\n"); break; @@ -945,87 +966,83 @@ void midzeus_state::zeus_draw_model(uint32_t texdata, bool logit) { uint32_t databuffer[32]; int databufcount = 0; - int model_done = false; + bool model_done = false; if (logit) - logerror(" -- model @ %08X\n", m_zeus_objdata); + LOGMODEL(" -- model @ %08X\n", m_zeus_objdata); while (m_zeus_objdata != 0 && !model_done) { const void *base = waveram0_ptr_from_block_addr(m_zeus_objdata); - int count = m_zeus_objdata >> 24; - int curoffs; + int const count = m_zeus_objdata >> 24; - /* reset the objdata address */ + // reset the objdata address m_zeus_objdata = 0; - /* loop until we run out of data */ - for (curoffs = 0; curoffs <= count; curoffs++) + // loop until we run out of data + for (int curoffs = 0; curoffs <= count; curoffs++) { - int countneeded; - uint8_t cmd; - - /* accumulate 2 words of data */ + // accumulate 2 words of data databuffer[databufcount++] = WAVERAM_READ32(base, curoffs * 2 + 0); databuffer[databufcount++] = WAVERAM_READ32(base, curoffs * 2 + 1); - /* if this is enough, process the command */ - cmd = databuffer[0] >> 24; - countneeded = (cmd == 0x25 || cmd == 0x30 || cmd == 0x28) ? 14 : 2; + // if this is enough, process the command + uint8_t const cmd = databuffer[0] >> 24; + int const countneeded = (cmd == 0x25 || cmd == 0x30 || cmd == 0x28) ? 14 : 2; if (databufcount == countneeded) { - /* handle logging of the command */ + // handle logging of the command if (logit) { int offs; - logerror("\t"); + LOGMODEL("\t"); for (offs = 0; offs < databufcount; offs++) - logerror("%08X ", databuffer[offs]); - logerror("-- "); + LOGMODEL("%08X ", databuffer[offs]); + LOGMODEL("-- "); } - /* handle the command */ + // handle the command switch (cmd) { case 0x08: if (logit) - logerror("end of model\n"); + LOGMODEL("end of model\n"); model_done = true; break; - case 0x0c: /* mk4/invasn */ + case 0x0c: // mk4/invasn zeus_pointer_w(databuffer[0] & 0xffffff, databuffer[1], logit); break; - case 0x17: /* mk4 */ + case 0x17: // mk4 if (logit) - logerror("reg16"); + LOGMODEL("reg16"); zeus_register16_w((databuffer[0] >> 16) & 0x7f, databuffer[0], logit); if (((databuffer[0] >> 16) & 0x7f) == 0x06) texdata = (texdata & 0xffff) | (m_zeusbase[0x06] << 16); break; - case 0x19: /* invasn */ + case 0x19: // invasn if (logit) - logerror("reg32"); + LOGMODEL("reg32"); zeus_register32_w((databuffer[0] >> 16) & 0x7f, databuffer[1], logit); if (((databuffer[0] >> 16) & 0x7f) == 0x06) texdata = (texdata & 0xffff) | (m_zeusbase[0x06] << 16); break; - case 0x25: /* mk4 */ - case 0x28: /* mk4r1 */ - case 0x30: /* invasn */ + case 0x25: // mk4 + case 0x28: // mk4r1 + case 0x30: // invasn m_poly->zeus_draw_quad(true, databuffer, texdata, logit); break; default: if (logit) - logerror("unknown\n"); + LOGMODEL("unknown\n"); break; } - /* reset the count */ + // reset the count databufcount = 0; } } @@ -1044,38 +1061,33 @@ void midzeus_renderer::zeus_draw_quad(int long_fmt, const uint32_t *databuffer, { poly_vertex clipvert[8]; poly_vertex vert[4]; - uint32_t ushift, vshift; - float maxy, maxx; - uint32_t texbase, texwshift; - uint32_t numverts; - uint32_t ctrl_word = databuffer[long_fmt ? 1 : 9]; + uint32_t const ctrl_word = databuffer[long_fmt ? 1 : 9]; - texbase = ((texdata >> 10) & 0x3f0000) | (texdata & 0xffff); - texwshift = (texdata >> 22) & 7; + uint32_t const texbase = ((texdata >> 10) & 0x3f0000) | (texdata & 0xffff); + uint32_t const texwshift = (texdata >> 22) & 7; - ushift = 8 - ((m_state.m_zeusbase[0x04] >> 4) & 3); - vshift = 8 - ((m_state.m_zeusbase[0x04] >> 6) & 3); + uint32_t const ushift = 8 - ((m_state.m_zeusbase[0x04] >> 4) & 3); + uint32_t const vshift = 8 - ((m_state.m_zeusbase[0x04] >> 6) & 3); - int xy_offset = long_fmt ? 2 : 1; + int const xy_offset = long_fmt ? 2 : 1; int16_t (*zeus_matrix)[3] = m_state.m_zeus_matrix; int32_t *zeus_point = m_state.m_zeus_point; for (uint32_t i = 0; i < 4; i++) { - uint32_t ixy = databuffer[xy_offset + i*2]; - uint32_t iuvz = databuffer[xy_offset + 1 + i*2]; - int32_t xo = (int16_t)ixy; - int32_t yo = (int16_t)(ixy >> 16); - int32_t zo = (int16_t)iuvz; - uint8_t u = iuvz >> 16; - uint8_t v = iuvz >> 24; - int64_t x, y, z; - - x = (int64_t)(xo * zeus_matrix[0][0]) + (int64_t)(yo * zeus_matrix[0][1]) + (int64_t)(zo * zeus_matrix[0][2]) + zeus_point[0]; - y = (int64_t)(xo * zeus_matrix[1][0]) + (int64_t)(yo * zeus_matrix[1][1]) + (int64_t)(zo * zeus_matrix[1][2]) + zeus_point[1]; - z = (int64_t)(xo * zeus_matrix[2][0]) + (int64_t)(yo * zeus_matrix[2][1]) + (int64_t)(zo * zeus_matrix[2][2]) + zeus_point[2]; + uint32_t const ixy = databuffer[xy_offset + i*2]; + uint32_t const iuvz = databuffer[xy_offset + 1 + i*2]; + int32_t const xo = (int16_t)ixy; + int32_t const yo = (int16_t)(ixy >> 16); + int32_t const zo = (int16_t)iuvz; + uint8_t const u = iuvz >> 16; + uint8_t const v = iuvz >> 24; + + int64_t x = (int64_t)(xo * zeus_matrix[0][0]) + (int64_t)(yo * zeus_matrix[0][1]) + (int64_t)(zo * zeus_matrix[0][2]) + zeus_point[0]; + int64_t y = (int64_t)(xo * zeus_matrix[1][0]) + (int64_t)(yo * zeus_matrix[1][1]) + (int64_t)(zo * zeus_matrix[1][2]) + zeus_point[1]; + int64_t z = (int64_t)(xo * zeus_matrix[2][0]) + (int64_t)(yo * zeus_matrix[2][1]) + (int64_t)(zo * zeus_matrix[2][2]) + zeus_point[2]; // Rounding hack x = (x + 0x00004000) & ~0x00007fffULL; @@ -1096,7 +1108,7 @@ void midzeus_renderer::zeus_draw_quad(int long_fmt, const uint32_t *databuffer, rotnormal[1] = normal[0] * zeus_matrix[1][0] + normal[1] * zeus_matrix[1][1] + normal[2] * zeus_matrix[1][2]; rotnormal[2] = normal[0] * zeus_matrix[2][0] + normal[1] * zeus_matrix[2][1] + normal[2] * zeus_matrix[2][2]; - int64_t dot = rotnormal[0] * x + rotnormal[1] * y + rotnormal[2] * z; + int64_t const dot = rotnormal[0] * x + rotnormal[1] * y + rotnormal[2] * z; if (dot >= 0) return; @@ -1120,6 +1132,7 @@ void midzeus_renderer::zeus_draw_quad(int long_fmt, const uint32_t *databuffer, vert[i].p[2] = v << vshift; vert[i].p[3] = 0xffff; +#if (VERBOSE & LOG_QUAD) if (logit) { m_state.logerror("\t\t(%f,%f,%f) UV:(%02X,%02X) UV_SCALE:(%02X,%02X) (%03X,%03X,%03X) dot=%08X\n", @@ -1129,16 +1142,17 @@ void midzeus_renderer::zeus_draw_quad(int long_fmt, const uint32_t *databuffer, (databuffer[10 + i] >> 20) & 0x3ff, (databuffer[10 + i] >> 10) & 0x3ff, (databuffer[10 + i] >> 0) & 0x3ff, 0); } +#endif } - numverts = m_state.m_poly->zclip_if_less<4>(4, &vert[0], &clipvert[0], 512.0f); + uint32_t const numverts = m_state.m_poly->zclip_if_less<4>(4, &vert[0], &clipvert[0], 512.0f); if (numverts < 3) return; - maxx = maxy = -1000.0f; + float maxx = -1000.0f, maxy = -1000.0f; for (uint32_t i = 0; i < numverts; i++) { - float ooz = 512.0f / clipvert[i].p[0]; + float const ooz = 512.0f / clipvert[i].p[0]; clipvert[i].x *= ooz; clipvert[i].y *= ooz; @@ -1148,8 +1162,10 @@ void midzeus_renderer::zeus_draw_quad(int long_fmt, const uint32_t *databuffer, maxx = std::max(maxx, clipvert[i].x); maxy = std::max(maxy, clipvert[i].y); +#if (VERBOSE & LOG_QUAD) if (logit) m_state.logerror("\t\t\tTranslated=(%f,%f,%f)\n", (double) clipvert[i].x, (double) clipvert[i].y, (double) clipvert[i].p[0]); +#endif } for (uint32_t i = 0; i < numverts; i++) { @@ -1163,7 +1179,7 @@ void midzeus_renderer::zeus_draw_quad(int long_fmt, const uint32_t *databuffer, if (ctrl_word & 0x01000000) { - uint32_t tex_type = (texdata >> 16) & 3; + uint32_t const tex_type = (texdata >> 16) & 3; extra.texwidth = 512 >> texwshift; extra.voffset = ctrl_word & 0xffff; @@ -1179,7 +1195,9 @@ void midzeus_renderer::zeus_draw_quad(int long_fmt, const uint32_t *databuffer, } else { - printf("Unknown texture type: %d\n", tex_type); +#if (VERBOSE & LOG_QUAD) + m_state.logerror("Unknown texture type: %d\n", tex_type); +#endif return; } } @@ -1220,10 +1238,10 @@ void midzeus_renderer::render_poly(int32_t scanline, const extent_t& extent, con int32_t curu = extent.param[1].start; int32_t curv = extent.param[2].start; int32_t curi = extent.param[3].start; - int32_t dzdx = extent.param[0].dpdx; - int32_t dudx = extent.param[1].dpdx; - int32_t dvdx = extent.param[2].dpdx; - int32_t didx = extent.param[3].dpdx; + int32_t const dzdx = extent.param[0].dpdx; + int32_t const dudx = extent.param[1].dpdx; + int32_t const dvdx = extent.param[2].dpdx; + int32_t const didx = extent.param[3].dpdx; const void *texbase = object.texbase; const void *palbase = object.palbase; uint16_t transcolor = object.transcolor; @@ -1248,7 +1266,7 @@ void midzeus_renderer::render_poly(int32_t scanline, const extent_t& extent, con if (depth_pass) { - rgb_t src=0; + rgb_t src = 0; bool src_valid = true; @@ -1260,10 +1278,10 @@ void midzeus_renderer::render_poly(int32_t scanline, const extent_t& extent, con } else { - uint32_t u0 = curu >> 8; - uint32_t v0 = object.voffset + (curv >> 8); - uint32_t u1 = u0 + 1; - uint32_t v1 = v0 + 1; + uint32_t const u0 = curu >> 8; + uint32_t const v0 = object.voffset + (curv >> 8); + uint32_t const u1 = u0 + 1; + uint32_t const v1 = v0 + 1; uint8_t texels[4]; @@ -1278,7 +1296,7 @@ void midzeus_renderer::render_poly(int32_t scanline, const extent_t& extent, con for (uint32_t i = 0; i < 4; ++i) { - uint16_t pix = WAVERAM_READ16(palbase, texels[i]); + uint16_t const pix = WAVERAM_READ16(palbase, texels[i]); color[i].set_r(pal5bit(pix >> 10)); color[i].set_g(pal5bit(pix >> 5)); @@ -1295,9 +1313,9 @@ void midzeus_renderer::render_poly(int32_t scanline, const extent_t& extent, con if (src_valid) { - uint32_t srcr = src.r(); - uint32_t srcg = src.g(); - uint32_t srcb = src.b(); + uint32_t const srcr = src.r(); + uint32_t const srcg = src.g(); + uint32_t const srcb = src.b(); uint32_t dstr = 0; uint32_t dstg = 0; @@ -1307,13 +1325,13 @@ void midzeus_renderer::render_poly(int32_t scanline, const extent_t& extent, con uint32_t outg = 0; uint32_t outb = 0; - uint32_t srca = object.alpha & 0xff; - uint32_t dsta = (object.alpha >> 8) & 0xff; + uint32_t const srca = object.alpha & 0xff; + uint32_t const dsta = (object.alpha >> 8) & 0xff; // Destination enable? if (object.blend & 0x00800000) { - uint16_t dst = WAVERAM_READPIX(m_state.m_zeus_renderbase, scanline, x); + uint16_t const dst = WAVERAM_READPIX(m_state.m_zeus_renderbase, scanline, x); dstr = (dst >> 10) & 0x1f; dstg = (dst >> 5) & 0x1f; @@ -1425,11 +1443,10 @@ void midzeus_renderer::render_poly(int32_t scanline, const extent_t& extent, con void midzeus_renderer::render_poly_solid_fixedz(int32_t scanline, const extent_t& extent, const mz_poly_extra_data& object, int threadid) { - uint16_t color = object.solidcolor; - uint16_t depth = object.zoffset; - int x; + uint16_t const color = object.solidcolor; + uint16_t const depth = object.zoffset; - for (x = extent.startx; x < extent.stopx; x++) + for (int x = extent.startx; x < extent.stopx; x++) m_state.waveram_plot_depth(scanline, x, color, depth); } @@ -1443,12 +1460,10 @@ void midzeus_renderer::render_poly_solid_fixedz(int32_t scanline, const extent_t void midzeus_state::log_fifo_command(const uint32_t *data, int numwords, const char *suffix) { - int wordnum; - - logerror("Zeus cmd %02X :", data[0] >> 24); - for (wordnum = 0; wordnum < numwords; wordnum++) - logerror(" %08X", data[wordnum]); - logerror("%s", suffix); + LOGFIFO("Zeus cmd %02X :", data[0] >> 24); + for (int wordnum = 0; wordnum < numwords; wordnum++) + LOGFIFO(" %08X", data[wordnum]); + LOGFIFO("%s", suffix); } @@ -1460,10 +1475,10 @@ void midzeus_state::log_waveram(uint32_t length_and_base) uint32_t checksum; } recent_entries[100]; - uint32_t numoctets = (length_and_base >> 24) + 1; + uint32_t const numoctets = (length_and_base >> 24) + 1; const uint32_t *ptr = (const uint32_t *)waveram0_ptr_from_block_addr(length_and_base); uint32_t checksum = length_and_base; - int foundit = false; + bool foundit = false; int i; for (i = 0; i < numoctets; i++) @@ -1488,5 +1503,5 @@ void midzeus_state::log_waveram(uint32_t length_and_base) return; for (i = 0; i < numoctets; i++) - logerror("\t%02X: %08X %08X\n", i, ptr[i*2], ptr[i*2+1]); + LOGWAVE("\t%02X: %08X %08X\n", i, ptr[i*2], ptr[i*2+1]); } From df62ba1451bc96711877937f22461e07d24b0163 Mon Sep 17 00:00:00 2001 From: 987123879113 <63495610+987123879113@users.noreply.github.com> Date: Mon, 13 May 2024 02:26:38 +0900 Subject: [PATCH 08/16] util/cdrom, machine/t10mmc: Add preliminary support for multisession CD-ROMs, indexes, and track flags (#12201) * util/cdrom: Refactoring * util/cdrom: Read all indexes from cue files * util/cdrom: Read in track flags from cues * util/cdrom: Multisession support for cues * machine/t10mmc: Playback from current head, other misc cleanup * machine/t10mmc: Implement T10MMC_CMD_MECHANISM_STATUS * machine/t10mmc: Implement TOC_FORMAT_FULL_TOC, TOC_FORMAT_SESSIONS, and return proper indexes for T10MMC_CMD_READ_SUB_CHANNEL --- src/devices/bus/ata/atapicdr.cpp | 20 +- src/devices/imagedev/cdromimg.cpp | 14 + src/devices/imagedev/cdromimg.h | 2 + src/devices/machine/t10mmc.cpp | 265 ++++++++++++++---- src/devices/machine/t10mmc.h | 9 +- src/lib/util/cdrom.cpp | 428 +++++++++++++++++++++--------- src/lib/util/cdrom.h | 65 +++-- 7 files changed, 601 insertions(+), 202 deletions(-) diff --git a/src/devices/bus/ata/atapicdr.cpp b/src/devices/bus/ata/atapicdr.cpp index aa32806913f..3b035b1b503 100644 --- a/src/devices/bus/ata/atapicdr.cpp +++ b/src/devices/bus/ata/atapicdr.cpp @@ -199,9 +199,19 @@ void atapi_cdrom_device::ExecCommand() } t10mmc::ExecCommand(); - // truckk requires seek complete flag to be set after calling the SEEK command - // so set the seek complete status flag after a successful request to emulate - // having asked the device itself to seek - if (command[0] == T10SBC_CMD_SEEK_10 && m_status_code == SCSI_STATUS_CODE_GOOD) - m_status |= IDE_STATUS_DSC; + if (m_status_code == SCSI_STATUS_CODE_GOOD) + { + switch (command[0]) + { + // Set the DSC (Drive Seek Complete) bit on commands that involve a drive seek. + // truckk is known to rely on this flag being set after T10SBC_CMD_SEEK_10. + case T10SBC_CMD_SEEK_10: + case T10MMC_CMD_PLAY_AUDIO_10: + case T10MMC_CMD_PLAY_AUDIO_12: + case T10MMC_CMD_PLAY_AUDIO_MSF: + case T10MMC_CMD_PLAY_AUDIO_TRACK_INDEX: + m_status |= IDE_STATUS_DSC; + break; + } + } } diff --git a/src/devices/imagedev/cdromimg.cpp b/src/devices/imagedev/cdromimg.cpp index a5ceca8b16d..5848eb349dc 100644 --- a/src/devices/imagedev/cdromimg.cpp +++ b/src/devices/imagedev/cdromimg.cpp @@ -184,6 +184,13 @@ int cdrom_image_device::get_last_track() const return 0; } +int cdrom_image_device::get_last_session() const +{ + if (m_cdrom_handle) + return m_cdrom_handle->get_last_session(); + return 0; +} + uint32_t cdrom_image_device::get_track(uint32_t frame) const { if (m_cdrom_handle) @@ -191,6 +198,13 @@ uint32_t cdrom_image_device::get_track(uint32_t frame) const return 0; } +uint32_t cdrom_image_device::get_track_index(uint32_t frame) const +{ + if (m_cdrom_handle) + return m_cdrom_handle->get_track_index(frame); + return 0; +} + uint32_t cdrom_image_device::get_track_start(uint32_t track) const { if (m_cdrom_handle) diff --git a/src/devices/imagedev/cdromimg.h b/src/devices/imagedev/cdromimg.h index 6e222703672..d37e0d5d64d 100644 --- a/src/devices/imagedev/cdromimg.h +++ b/src/devices/imagedev/cdromimg.h @@ -59,7 +59,9 @@ class cdrom_image_device : public device_t, virtual const char *image_brief_type_name() const noexcept override { return "cdrm"; } int get_last_track() const; + int get_last_session() const; uint32_t get_track(uint32_t frame) const; + uint32_t get_track_index(uint32_t frame) const; uint32_t get_track_start(uint32_t track) const; bool read_data(uint32_t lbasector, void *buffer, uint32_t datatype, bool phys=false); bool read_subcode(uint32_t lbasector, void *buffer, bool phys=false); diff --git a/src/devices/machine/t10mmc.cpp b/src/devices/machine/t10mmc.cpp index bc3d6d0a95c..eac2c97f6d0 100644 --- a/src/devices/machine/t10mmc.cpp +++ b/src/devices/machine/t10mmc.cpp @@ -5,26 +5,25 @@ #include "multibyte.h" -static int to_msf_raw(int frame) +static int32_t to_msf_raw(int32_t frame) { - int m = frame / (75 * 60); - int s = (frame / 75) % 60; - int f = frame % 75; - + const int m = (frame / (75 * 60)) % 100; + const int s = (frame / 75) % 60; + const int f = frame % 75; return (m << 16) | (s << 8) | f; } -static int to_msf(int frame) +static int32_t to_msf(int32_t frame) { - int adjusted_frame = frame + 150; - if (frame <= -151) + int32_t adjusted_frame = frame + 150; + if (adjusted_frame < 0) adjusted_frame += 450000; return to_msf_raw(adjusted_frame); } -static int to_lba(int msf) +static int32_t to_lba(int32_t msf) { - int lba = cdrom_file::msf_to_lba(msf) - 150; + int32_t lba = cdrom_file::msf_to_lba(msf) - 150; if (BIT(msf, 16, 8) >= 90) // 90:00:00 and later lba -= 450000; return lba; @@ -256,6 +255,16 @@ void t10mmc::ExecCommand() length = 4 + (8 * 1); break; + case TOC_FORMAT_FULL_TOC: + { + const int total_tracks = m_image->get_last_track(); + const int total_sessions = m_image->get_last_session(); + const int total_a0s = total_sessions * 3; // every session has a set of a0/a1/a2 + const int total_b0s = (total_sessions - 1) * 2; // every additional session starts with a b0/c0 set + length = 4 + (11 * (total_tracks + total_a0s + total_b0s)); + break; + } + default: m_device->logerror("T10MMC: Unhandled READ TOC format %d\n", toc_format()); length = 0; @@ -288,6 +297,12 @@ void t10mmc::ExecCommand() m_lba = get_u32be(&command[2]); m_blocks = SCSILengthFromUINT16( &command[7] ); + if (m_lba == 0xffffffff) + { + m_device->logerror("T10MMC: play audio from current not fully implemented!\n"); + m_lba = m_cdda->get_audio_lba(); + } + if (m_lba == 0) { // A request for LBA 0 will return something different depending on the type of media being played. @@ -298,10 +313,6 @@ void t10mmc::ExecCommand() else m_lba = 150; } - else if (m_lba == 0xffffffff) - { - m_device->logerror("T10MMC: play audio from current not implemented!\n"); - } //m_device->logerror("T10MMC: PLAY AUDIO(10) at LBA %x for %x blocks\n", m_lba, m_blocks); @@ -334,23 +345,19 @@ void t10mmc::ExecCommand() break; } - const uint32_t msf_start = get_u24be(&command[3]); + uint32_t msf_start = get_u24be(&command[3]); const uint32_t msf_end = get_u24be(&command[6]); - int32_t lba_start = to_lba(msf_start); - int32_t lba_end = to_lba(msf_end); - - // LBA valid range is technically -45150 to 404849 but negatives are not handled anywhere - if (lba_start < 0 || lba_end < 0) + if (msf_start == 0xffffff) { - m_device->logerror("T10MMC: tried playing audio from lba %d to %d\n", lba_start, lba_end); - m_status_code = SCSI_STATUS_CODE_CHECK_CONDITION; - set_sense(SCSI_SENSE_KEY_ILLEGAL_REQUEST, SCSI_SENSE_ASC_ASCQ_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE); - break; + // when start MSF is set to all FFs, the starting address becomes the current optical head location + m_lba = m_cdda->get_audio_lba(); + msf_start = to_msf(m_lba); } - m_lba = lba_start; - m_blocks = lba_end - lba_start; + // note: BeOS's CD player sends the start MSF + a large end MSF (99:59:71) when a scan is ended and it wants to resume playback + m_lba = to_lba(msf_start); + m_blocks = cdrom_file::msf_to_lba(msf_end - msf_start); if (m_lba == 0) { @@ -372,13 +379,6 @@ void t10mmc::ExecCommand() m_status_code = SCSI_STATUS_CODE_GOOD; m_audio_sense = SCSI_SENSE_ASC_ASCQ_NO_SENSE; } - else if (msf_start == 0xffffff) - { - // when start MSF is set to all FFs, the starting address becomes the current optical head location - m_device->logerror("T10MMC: play audio from current not implemented!\n"); - m_status_code = SCSI_STATUS_CODE_CHECK_CONDITION; - set_sense(SCSI_SENSE_KEY_ILLEGAL_REQUEST, SCSI_SENSE_ASC_ASCQ_AUDIO_PLAY_OPERATION_STOPPED_DUE_TO_ERROR); - } else if (msf_start > msf_end) { m_device->logerror("T10MMC: track starts after requested end time!\n"); @@ -479,6 +479,8 @@ void t10mmc::ExecCommand() break; case T10MMC_CMD_STOP_PLAY_SCAN: + m_last_lba = m_cdda->get_audio_lba(); + abort_audio(); //m_device->logerror("T10MMC: STOP_PLAY_SCAN\n"); @@ -512,6 +514,12 @@ void t10mmc::ExecCommand() m_lba = get_u32be(&command[2]); m_blocks = get_u32be(&command[6]); + if (m_lba == 0xffffffff) + { + m_device->logerror("T10MMC: play audio from current not fully implemented!\n"); + m_lba = m_cdda->get_audio_lba(); + } + if (m_lba == 0) { if (m_image->get_track_type(0) == cdrom_file::CD_TRACK_AUDIO) @@ -519,10 +527,6 @@ void t10mmc::ExecCommand() else m_lba = 150; } - else if (m_lba == 0xffffffff) - { - m_device->logerror("T10MMC: play audio from current not implemented!\n"); - } //m_device->logerror("T10MMC: PLAY AUDIO(12) at LBA %x for %x blocks\n", m_lba, m_blocks); @@ -582,6 +586,13 @@ void t10mmc::ExecCommand() m_transfer_length = 0; break; + case T10MMC_CMD_MECHANISM_STATUS: + m_phase = SCSI_PHASE_DATAIN; + m_status_code = SCSI_STATUS_CODE_GOOD; + m_transfer_length = get_u16be(&command[8]); + m_device->logerror("T10MMC: MECHANISM STATUS requested %d bytes\n", m_transfer_length); + break; + case T10MMC_CMD_READ_CD: { if (!m_image->exists()) @@ -892,6 +903,32 @@ void t10mmc::ReadData( uint8_t *data, int dataLength ) } break; + case T10MMC_CMD_MECHANISM_STATUS: + { + uint8_t status_header[8]; + size_t transfer_len = get_u16be(&command[8]); + + if (transfer_len == 0) + break; + + std::fill_n(&data[0], transfer_len, 0); + std::fill(std::begin(status_header), std::end(status_header), 0); + + put_u24be(&status_header[2], m_last_lba); + + if (m_cdda->audio_active()) + { + // cdrdao checks this flag after starting an audio track to play for 1 block to + // determine when it can read the sub q channel data when finding tracks and indexes + m_last_lba = m_cdda->get_audio_lba(); + status_header[1] |= 1 << 5; // playing (audio or data) flag + } + + std::copy_n(std::begin(status_header), std::min(std::size(status_header), transfer_len), &data[0]); + + break; + } + case T10MMC_CMD_READ_CD: //m_device->logerror("T10MMC: read CD %x dataLength lba=%x\n", dataLength, m_lba); if ((m_image) && (m_blocks)) @@ -1134,13 +1171,11 @@ void t10mmc::ReadData( uint8_t *data, int dataLength ) return; } - m_device->logerror("T10MMC: READ SUB-CHANNEL Time = %x, SUBQ = %x\n", command[1], command[2]); - bool msf = (command[1] & 0x2) != 0; data[0]= 0x00; - int audio_active = m_cdda->audio_active(); + const int audio_active = m_cdda->audio_active(); if (audio_active) { // if audio is playing, get the latest LBA from the CDROM layer @@ -1168,14 +1203,18 @@ void t10mmc::ReadData( uint8_t *data, int dataLength ) } } + m_device->logerror("T10MMC: READ SUB-CHANNEL Time = %x, SUBQ = %x, LBA = %d)\n", msf, command[2], m_last_lba); + if (command[2] & 0x40) { + int track = m_image->get_track(m_last_lba); + data[2] = 0; - data[3] = 12; // data length + data[3] = 12; // data length data[4] = 0x01; // sub-channel format code - data[5] = 0x10 | (audio_active ? 0 : 4); - data[6] = m_image->get_track(m_last_lba) + 1; // track - data[7] = 0; // index + data[5] = m_image->get_adr_control(track); + data[6] = track + 1; // track + data[7] = m_image->get_track_index(m_last_lba); // index uint32_t frame = m_last_lba; @@ -1203,8 +1242,11 @@ void t10mmc::ReadData( uint8_t *data, int dataLength ) } break; } + default: m_device->logerror("T10MMC: Unknown subchannel type %d requested\n", command[3]); + std::fill_n(data, dataLength, 0); + break; } break; @@ -1275,33 +1317,158 @@ void t10mmc::ReadData( uint8_t *data, int dataLength ) case TOC_FORMAT_SESSIONS: { + auto toc = m_image->get_toc(); + const int tracks = toc_tracks(); + const int last_session = m_image->get_last_session(); + uint32_t first_track_last_session = 0; + + for (int i = 0; i < tracks - 1; i++) + { + if (toc.tracks[i].session == last_session - 1) + first_track_last_session = i; + } + int len = 2 + (8 * 1); int dptr = 0; put_u16be(&data[dptr], len); dptr += 2; data[dptr++] = 1; - data[dptr++] = 1; + data[dptr++] = last_session; data[dptr++] = 0; - data[dptr++] = m_image->get_adr_control(0); - data[dptr++] = 1; + data[dptr++] = m_image->get_adr_control(first_track_last_session); + data[dptr++] = first_track_last_session + 1; // First Track Number In Last Complete Session data[dptr++] = 0; - uint32_t tstart = m_image->get_track_start(0); + uint32_t tstart = m_image->get_track_start(first_track_last_session); if (msf) { tstart = to_msf(tstart); } - put_u32be(&data[dptr], tstart); + put_u32be(&data[dptr], tstart); // Start Address of First Track in Last Session dptr += 4; } break; + case TOC_FORMAT_FULL_TOC: + { + auto toc = m_image->get_toc(); + + const uint32_t tracks = m_image->get_last_track(); + const uint32_t total_sessions = m_image->get_last_session(); + const int total_a0s = total_sessions * 3; // every session has a set of a0/a1/a2 + const int total_b0s = (total_sessions - 1) * 2; // every additional session starts with a b0/c0 set + const int len = 2 + (11 * (tracks + total_a0s + total_b0s)); + + int dptr = 0; + put_u16be(&data[dptr], len); + dptr += 2; + data[dptr++] = 1; + data[dptr++] = total_sessions; + + int cur_track = 0; + for (uint32_t cur_session = 0; cur_session < total_sessions; cur_session++) + { + if (toc.tracks[cur_track].session != cur_session) + continue; + + int last_track_in_session = cur_track; + for (int i = cur_track; i < tracks && toc.tracks[i].session == cur_session; i++) + last_track_in_session = i; + + // point 0xa0, first track number in session + data[dptr++] = toc.tracks[cur_track].session + 1; + data[dptr++] = m_image->get_adr_control(cur_track); + data[dptr++] = 0; + data[dptr++] = 0xa0; + put_u24be(&data[dptr], 0); + dptr += 3; + data[dptr++] = 0; + data[dptr++] = cur_track + 1; // first track number in session + data[dptr++] = 0; + data[dptr++] = 0; + + // point 0xa1, last track number in session + data[dptr++] = toc.tracks[cur_track].session + 1; + data[dptr++] = m_image->get_adr_control(last_track_in_session); + data[dptr++] = 0; + data[dptr++] = 0xa1; + put_u24be(&data[dptr], 0); + dptr += 3; + data[dptr++] = 0; + data[dptr++] = last_track_in_session + 1; // last track number in session + data[dptr++] = 0; + data[dptr++] = 0; + + // point 0xa2, start of lead-out + uint32_t leadout_addr = m_image->get_track_start(last_track_in_session) + toc.tracks[last_track_in_session].frames; + if (toc.tracks[last_track_in_session].pgdatasize != 0) + leadout_addr -= toc.tracks[last_track_in_session].pregap; // pregap is already included in frame count if pgdatasize is set + + data[dptr++] = toc.tracks[cur_track].session + 1; + data[dptr++] = m_image->get_adr_control(last_track_in_session); + data[dptr++] = 0; + data[dptr++] = 0xa2; + put_u24be(&data[dptr], 0); + dptr += 3; + data[dptr++] = 0; + put_u24be(&data[dptr], to_msf(leadout_addr)); // Track start time + dptr += 3; + + while (cur_track < tracks && toc.tracks[cur_track].session == cur_session) + { + data[dptr++] = toc.tracks[cur_track].session + 1; + data[dptr++] = m_image->get_adr_control(cur_track); + data[dptr++] = 0; + data[dptr++] = cur_track + 1; + put_u24be(&data[dptr], 0); + dptr += 3; + data[dptr++] = 0; + put_u24be(&data[dptr], to_msf(m_image->get_track_start(cur_track))); // Track start time + dptr += 3; + + cur_track++; + } + + if (cur_session + 1 < total_sessions) + { + const uint32_t leadout_addr = m_image->get_track_start(cur_track) + toc.tracks[cur_track].frames; + const uint32_t next_session_program_area = m_image->get_track_start(cur_track) - 150; // fixed 2s pregap + + // point 0xb0, info about next session + data[dptr++] = cur_session + 1; + data[dptr++] = (m_image->get_adr_control(cur_track - 1) & 0x0f) | 0x50; + data[dptr++] = 0; + data[dptr++] = 0xb0; + put_u24be(&data[dptr], to_msf(next_session_program_area)); // start time for the next possible session's program area + dptr += 3; + data[dptr++] = (total_sessions - (cur_session + 1)) * 2; // the number of different Mode-5 pointers present from this point, inclusive + put_u24be(&data[dptr], to_msf(leadout_addr)); // the maximum possible start time of the outermost Lead-out + dptr += 3; + + // point 0xc0, start time of first lead-in of the disc + data[dptr++] = cur_session + 1; + data[dptr++] = (m_image->get_adr_control(0) & 0x0f) | 0x50; + data[dptr++] = 0; + data[dptr++] = 0xc0; + put_u24be(&data[dptr], 0); + dptr += 3; + data[dptr++] = 0; + // Hardcode a value of 95:00:00 because that's the most common value I've seen on various multisession CD dumps + put_u24be(&data[dptr], 0x5f0000); // Start time of the first Lead-in area of the disc + dptr += 3; + } + } + + break; + } + default: m_device->logerror("T10MMC: Unhandled READ TOC format %d\n", toc_format()); + std::fill_n(data, dataLength, 0); break; } } diff --git a/src/devices/machine/t10mmc.h b/src/devices/machine/t10mmc.h index 9b84e929c29..852e21db046 100644 --- a/src/devices/machine/t10mmc.h +++ b/src/devices/machine/t10mmc.h @@ -45,6 +45,7 @@ class t10mmc : public virtual t10spc T10MMC_CMD_PLAY_AUDIO_12 = 0xa5, T10MMC_CMD_READ_DISC_STRUCTURE = 0xad, T10MMC_CMD_SET_CD_SPEED = 0xbb, + T10MMC_CMD_MECHANISM_STATUS = 0xbd, T10MMC_CMD_READ_CD = 0xbe }; @@ -70,8 +71,12 @@ class t10mmc : public virtual t10spc enum toc_format_t { - TOC_FORMAT_TRACKS = 0, - TOC_FORMAT_SESSIONS = 1 + TOC_FORMAT_TRACKS = 0, // legacy toc + TOC_FORMAT_SESSIONS = 1, // multi-session information + TOC_FORMAT_FULL_TOC = 2, // full TOC - includes sessions, lead-ins, lead-outs + TOC_FORMAT_PMA = 3, // PMA + TOC_FORMAT_ATIP = 4, // ATIP + TOC_FORMAT_CDTEXT = 5, // valid only for CD audio discs }; void abort_audio(); diff --git a/src/lib/util/cdrom.cpp b/src/lib/util/cdrom.cpp index 159a9c964a1..d9074bfd838 100644 --- a/src/lib/util/cdrom.cpp +++ b/src/lib/util/cdrom.cpp @@ -21,6 +21,7 @@ #include "corestr.h" #include "multibyte.h" #include "osdfile.h" +#include "path.h" #include "strformat.h" #include @@ -180,6 +181,9 @@ cdrom_file::cdrom_file(std::string_view inputfile) track.logframeofs = track.pregap; } + if ((cdtoc.flags & CD_FLAG_MULTISESSION) && cdtrack_info.track[i].leadin != -1) + logofs += cdtrack_info.track[i].leadin; + track.physframeofs = physofs; track.chdframeofs = 0; track.logframeofs += logofs; @@ -191,8 +195,13 @@ cdrom_file::cdrom_file(std::string_view inputfile) physofs += track.frames; logofs += track.frames; + if ((cdtoc.flags & CD_FLAG_MULTISESSION) && cdtrack_info.track[i].leadout != -1) + logofs += cdtrack_info.track[i].leadout; + if (EXTRA_VERBOSE) - printf("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", i+1, + 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, @@ -290,7 +299,9 @@ cdrom_file::cdrom_file(chd_file *_chd) logofs += track.frames; if (EXTRA_VERBOSE) - printf("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", i+1, + 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, @@ -583,6 +594,27 @@ uint32_t cdrom_file::get_track(uint32_t frame) const return track; } +uint32_t cdrom_file::get_track_index(uint32_t frame) const +{ + const uint32_t track = get_track(frame); + const uint32_t track_start = get_track_start(track); + const uint32_t index_offset = frame - track_start; + int index = 0; + + for (int i = 0; i < std::size(cdtrack_info.track[track].idx); i++) + { + if (index_offset >= cdtrack_info.track[track].idx[i]) + index = i; + else + break; + } + + if (cdtrack_info.track[track].idx[index] == -1) + index = 1; // valid index not found, default to index 1 + + return index; +} + /*************************************************************************** EXTRA UTILITIES @@ -868,70 +900,57 @@ std::error_condition cdrom_file::parse_metadata(chd_file *chd, toc &toc) /* clear structures */ memset(&toc, 0, sizeof(toc)); + toc.numsessions = 1; + /* start with no tracks */ for (toc.numtrks = 0; toc.numtrks < MAX_TRACKS; toc.numtrks++) { - int tracknum = -1, frames = 0, pregap, postgap, padframes; + int tracknum, frames, pregap, postgap, padframes; char type[16], subtype[16], pgtype[16], pgsub[16]; track_info *track; - pregap = postgap = padframes = 0; + tracknum = -1; + frames = pregap = postgap = padframes = 0; + std::fill(std::begin(type), std::end(type), 0); + std::fill(std::begin(subtype), std::end(subtype), 0); + std::fill(std::begin(pgtype), std::end(pgtype), 0); + std::fill(std::begin(pgsub), std::end(pgsub), 0); /* fetch the metadata for this track */ - err = chd->read_metadata(CDROM_TRACK_METADATA_TAG, toc.numtrks, metadata); - if (!err) + if (!chd->read_metadata(CDROM_TRACK_METADATA_TAG, toc.numtrks, metadata)) { - /* parse the metadata */ - type[0] = subtype[0] = 0; - pgtype[0] = pgsub[0] = 0; if (sscanf(metadata.c_str(), CDROM_TRACK_METADATA_FORMAT, &tracknum, type, subtype, &frames) != 4) return chd_file::error::INVALID_DATA; - if (tracknum == 0 || tracknum > MAX_TRACKS) + } + else if (!chd->read_metadata(CDROM_TRACK_METADATA2_TAG, toc.numtrks, metadata)) + { + if (sscanf(metadata.c_str(), CDROM_TRACK_METADATA2_FORMAT, &tracknum, type, subtype, &frames, &pregap, pgtype, pgsub, &postgap) != 8) return chd_file::error::INVALID_DATA; - track = &toc.tracks[tracknum - 1]; } else { - err = chd->read_metadata(CDROM_TRACK_METADATA2_TAG, toc.numtrks, metadata); + /* fall through to GD-ROM detection */ + err = chd->read_metadata(GDROM_OLD_METADATA_TAG, toc.numtrks, metadata); if (!err) - { - /* parse the metadata */ - type[0] = subtype[0] = 0; - pregap = postgap = 0; - if (sscanf(metadata.c_str(), CDROM_TRACK_METADATA2_FORMAT, &tracknum, type, subtype, &frames, &pregap, pgtype, pgsub, &postgap) != 8) - return chd_file::error::INVALID_DATA; - if (tracknum == 0 || tracknum > MAX_TRACKS) - return chd_file::error::INVALID_DATA; - track = &toc.tracks[tracknum - 1]; - } + /* legacy GDROM track was detected */ + toc.flags |= CD_FLAG_GDROMLE; else - { - err = chd->read_metadata(GDROM_OLD_METADATA_TAG, toc.numtrks, metadata); - if (!err) - /* legacy GDROM track was detected */ - toc.flags |= CD_FLAG_GDROMLE; - else - err = chd->read_metadata(GDROM_TRACK_METADATA_TAG, toc.numtrks, metadata); + err = chd->read_metadata(GDROM_TRACK_METADATA_TAG, toc.numtrks, metadata); - if (!err) - { - /* parse the metadata */ - type[0] = subtype[0] = 0; - pregap = postgap = 0; - if (sscanf(metadata.c_str(), GDROM_TRACK_METADATA_FORMAT, &tracknum, type, subtype, &frames, &padframes, &pregap, pgtype, pgsub, &postgap) != 9) - return chd_file::error::INVALID_DATA; - if (tracknum == 0 || tracknum > MAX_TRACKS) - return chd_file::error::INVALID_DATA; - track = &toc.tracks[tracknum - 1]; - toc.flags |= CD_FLAG_GDROM; - } - else - { - break; - } - } + if (err) + break; + + if (sscanf(metadata.c_str(), GDROM_TRACK_METADATA_FORMAT, &tracknum, type, subtype, &frames, &padframes, &pregap, pgtype, pgsub, &postgap) != 9) + return chd_file::error::INVALID_DATA; + + toc.flags |= CD_FLAG_GDROM; } + if (tracknum == 0 || tracknum > MAX_TRACKS) + return chd_file::error::INVALID_DATA; + + track = &toc.tracks[tracknum - 1]; + /* extract the track type and determine the data size */ track->trktype = CD_TRACK_MODE1; track->datasize = 0; @@ -986,8 +1005,11 @@ std::error_condition cdrom_file::parse_metadata(chd_file *chd, toc &toc) auto *mrp = reinterpret_cast(&oldmetadata[0]); toc.numtrks = *mrp++; + toc.numsessions = 1; + for (int i = 0; i < MAX_TRACKS; i++) { + toc.tracks[i].session = 0; toc.tracks[i].trktype = *mrp++; toc.tracks[i].subtype = *mrp++; toc.tracks[i].datasize = *mrp++; @@ -1045,7 +1067,16 @@ std::error_condition cdrom_file::write_metadata(chd_file *chd, const toc &toc) for (int i = 0; i < toc.numtrks; i++) { std::string metadata; - if (!(toc.flags & CD_FLAG_GDROM)) + if (toc.flags & CD_FLAG_GDROM) + { + metadata = util::string_format(GDROM_TRACK_METADATA_FORMAT, i + 1, get_type_string(toc.tracks[i].trktype), + get_subtype_string(toc.tracks[i].subtype), toc.tracks[i].frames, toc.tracks[i].padframes, + toc.tracks[i].pregap, get_type_string(toc.tracks[i].pgtype), + get_subtype_string(toc.tracks[i].pgsub), toc.tracks[i].postgap); + + err = chd->write_metadata(GDROM_TRACK_METADATA_TAG, i, metadata); + } + else { char submode[32]; @@ -1065,15 +1096,6 @@ std::error_condition cdrom_file::write_metadata(chd_file *chd, const toc &toc) toc.tracks[i].postgap); err = chd->write_metadata(CDROM_TRACK_METADATA2_TAG, i, metadata); } - else - { - metadata = util::string_format(GDROM_TRACK_METADATA_FORMAT, i + 1, get_type_string(toc.tracks[i].trktype), - get_subtype_string(toc.tracks[i].subtype), toc.tracks[i].frames, toc.tracks[i].padframes, - toc.tracks[i].pregap, get_type_string(toc.tracks[i].pgtype), - get_subtype_string(toc.tracks[i].pgsub), toc.tracks[i].postgap); - - err = chd->write_metadata(GDROM_TRACK_METADATA_TAG, i, metadata); - } if (err) return err; } @@ -1833,6 +1855,8 @@ std::error_condition cdrom_file::parse_nero(std::string_view tocfname, toc &outt memset(&outtoc, 0, sizeof(outtoc)); outinfo.reset(); + outtoc.numsessions = 1; + // seek to 12 bytes before the end fseek(infile, -12, SEEK_END); fread(buffer, 12, 1, infile); @@ -1895,8 +1919,7 @@ std::error_condition cdrom_file::parse_nero(std::string_view tocfname, toc &outt // printf("Track %d: sector size %d mode %x index0 %llx index1 %llx track_end %llx (pregap %d sectors, length %d sectors)\n", track, size, mode, index0, index1, track_end, (uint32_t)(index1-index0)/size, (uint32_t)(track_end-index1)/size); outinfo.track[track-1].fname.assign(tocfname); outinfo.track[track-1].offset = offset + (uint32_t)(index1-index0); - outinfo.track[track-1].idx0offs = 0; - outinfo.track[track-1].idx1offs = 0; + outinfo.track[track-1].idx[0] = outinfo.track[track-1].idx[1] = 0; switch (mode) { @@ -2016,11 +2039,11 @@ std::error_condition cdrom_file::parse_iso(std::string_view tocfname, toc &outto outtoc.numtrks = 1; + outtoc.numsessions = 1; outinfo.track[0].fname = tocfname; outinfo.track[0].offset = 0; - outinfo.track[0].idx0offs = 0; - outinfo.track[0].idx1offs = 0; + outinfo.track[0].idx[0] = outinfo.track[0].idx[1] = 0; if ((size % 2048)==0 ) { outtoc.tracks[0].trktype = CD_TRACK_MODE1; @@ -2189,6 +2212,7 @@ std::error_condition cdrom_file::parse_gdi(std::string_view tocfname, toc &outto /* store the number of tracks found */ outtoc.numtrks = numtracks; + outtoc.numsessions = 1; return std::error_condition(); } @@ -2215,13 +2239,15 @@ std::error_condition cdrom_file::parse_gdi(std::string_view tocfname, toc &outto std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outtoc, track_input_info &outinfo) { - int i, trknum; + int i, trknum, sessionnum, session_pregap; char token[512]; std::string lastfname; uint32_t wavlen, wavoffs; std::string path = std::string(tocfname); const bool is_gdrom = is_gdicue(tocfname); enum gdi_area current_area = SINGLE_DENSITY; + bool is_multibin = false; + int leadin = -1; FILE *infile = fopen(path.c_str(), "rt"); if (!infile) @@ -2237,6 +2263,8 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto trknum = -1; wavoffs = wavlen = 0; + sessionnum = 0; + session_pregap = 0; if (is_gdrom) { @@ -2261,13 +2289,65 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto if (!strcmp(token, "REM")) { - /* TODO: sessions are notated using REM commands: "REM SESSION 01" */ - /* skip to actual data of REM command */ while (i < std::size(linebuffer) && isspace((uint8_t)linebuffer[i])) i++; - if (is_gdrom && !strncmp(linebuffer+i, "SINGLE-DENSITY AREA", 19)) + if (!strncmp(linebuffer+i, "SESSION", 7)) + { + /* IsoBuster extension */ + TOKENIZE + + /* get the session number */ + TOKENIZE + + sessionnum = strtoul(token, nullptr, 10) - 1; + + if (sessionnum >= 1) /* don't consider it a multisession CD unless there's actually more than 1 session */ + outtoc.flags |= CD_FLAG_MULTISESSION; + } + else if ((outtoc.flags & CD_FLAG_MULTISESSION) && !strncmp(linebuffer+i, "PREGAP", 6)) + { + /* + Redump extension? PREGAP associated with the session instead of the track + + DiscImageCreator - Older versions would write a bogus value here (and maybe session lead-in and lead-out). + These should be considered bad dumps and will not be supported. + */ + TOKENIZE + + /* get pregap time */ + TOKENIZE + session_pregap = msf_to_frames( token ); + } + else if (!strncmp(linebuffer+i, "LEAD-OUT", 8)) + { + /* + IsoBuster and ImgBurn (single bin file) - Lead-out time is the start of the lead-out + lead-out time - MSF of last track of session = size of last track + + Redump and DiscImageCreator (multiple bins) - Lead-out time is the duration of just the lead-out + */ + TOKENIZE + + /* get lead-out time */ + TOKENIZE + int leadout_offset = msf_to_frames( token ); + outinfo.track[trknum].leadout = leadout_offset; + } + else if (!strncmp(linebuffer+i, "LEAD-IN", 7)) + { + /* + IsoBuster and ImgBurn (single bin file) - Not used? + Redump and DiscImageCreator (multiple bins) - Lead-in time is the duration of just the lead-in + */ + TOKENIZE + + /* get lead-in time */ + TOKENIZE + leadin = msf_to_frames( token ); + } + else if (is_gdrom && !strncmp(linebuffer+i, "SINGLE-DENSITY AREA", 19)) { /* single-density area starts LBA = 0 */ current_area = SINGLE_DENSITY; @@ -2284,7 +2364,10 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto TOKENIZE /* keep the filename */ + std::string prevfname = lastfname; lastfname.assign(path).append(token); + if (prevfname.length() > 0 && lastfname.compare(prevfname) != 0) + is_multibin = true; /* get the file type */ TOKENIZE @@ -2323,6 +2406,7 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto /* next token on the line is the track type */ TOKENIZE + outtoc.tracks[trknum].session = sessionnum; outtoc.tracks[trknum].subtype = CD_SUB_NONE; outtoc.tracks[trknum].subsize = 0; outtoc.tracks[trknum].pgsub = CD_SUB_NONE; @@ -2330,9 +2414,26 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto outtoc.tracks[trknum].padframes = 0; outtoc.tracks[trknum].datasize = 0; outtoc.tracks[trknum].multicuearea = is_gdrom ? current_area : 0; - outinfo.track[trknum].idx0offs = -1; - outinfo.track[trknum].idx1offs = 0; outinfo.track[trknum].offset = 0; + std::fill(std::begin(outinfo.track[trknum].idx), std::end(outinfo.track[trknum].idx), -1); + + outinfo.track[trknum].leadout = -1; + outinfo.track[trknum].leadin = leadin; /* use previously saved lead-in value */ + leadin = -1; + + if (session_pregap != 0) + { + /* + associated the pregap from the session transition with the lead-in to simplify things for now. + setting it as the proper pregap for the track causes logframeofs of the last dummy entry in the TOC + to become 2s later than it should. this might be an issue with how pgdatasize = 0 pregaps are handled. + */ + if (outinfo.track[trknum].leadin == -1) + outinfo.track[trknum].leadin = session_pregap; + else + outinfo.track[trknum].leadin += session_pregap; + session_pregap = 0; + } if (wavlen != 0) { @@ -2341,7 +2442,7 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto wavoffs = wavlen = 0; } - outinfo.track[trknum].fname.assign(lastfname); // default filename to the last one + outinfo.track[trknum].fname.assign(lastfname); /* default filename to the last one */ if (EXTRA_VERBOSE) { @@ -2368,7 +2469,7 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto convert_subtype_string_to_track_info(token, &outtoc.tracks[trknum]); } - else if (!strcmp(token, "INDEX")) /* only in bin/cue files */ + else if (!strcmp(token, "INDEX")) { int idx, frames; @@ -2380,22 +2481,25 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto TOKENIZE frames = msf_to_frames( token ); - if (idx == 0) + if (idx < 0 || idx > MAX_INDEX) { - outinfo.track[trknum].idx0offs = frames; + printf("ERROR: encountered invalid index %d\n", idx); + return chd_file::error::INVALID_DATA; } - else if (idx == 1) + + outinfo.track[trknum].idx[idx] = frames; + + if (idx == 1) { - outinfo.track[trknum].idx1offs = frames; - if ((outtoc.tracks[trknum].pregap == 0) && (outinfo.track[trknum].idx0offs != -1)) + if (outtoc.tracks[trknum].pregap == 0 && outinfo.track[trknum].idx[0] != -1) { - outtoc.tracks[trknum].pregap = frames - outinfo.track[trknum].idx0offs; + outtoc.tracks[trknum].pregap = frames - outinfo.track[trknum].idx[0]; outtoc.tracks[trknum].pgtype = outtoc.tracks[trknum].trktype; outtoc.tracks[trknum].pgdatasize = outtoc.tracks[trknum].datasize; } - else // pregap sectors not in file, but we're always using idx0ofs for track length calc now + else if (outinfo.track[trknum].idx[0] == -1) /* pregap sectors not in file, but we're always using idx 0 for track length calc now */ { - outinfo.track[trknum].idx0offs = frames; + outinfo.track[trknum].idx[0] = frames; } } } @@ -2419,6 +2523,28 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto outtoc.tracks[trknum].postgap = frames; } + else if (!strcmp(token, "FLAGS")) + { + outtoc.tracks[trknum].control_flags = 0; + + /* keep looping over remaining tokens in FLAGS line until there's no more to read */ + while (i < std::size(linebuffer)) + { + int last_idx = i; + + TOKENIZE + + if (i == last_idx) + break; + + if (!strcmp(token, "DCP")) + outtoc.tracks[trknum].control_flags |= CD_FLAG_CONTROL_DIGITAL_COPY_PERMITTED; + else if (!strcmp(token, "4CH")) + outtoc.tracks[trknum].control_flags |= CD_FLAG_CONTROL_4CH; + else if (!strcmp(token, "PRE")) + outtoc.tracks[trknum].control_flags |= CD_FLAG_CONTROL_PREEMPHASIS; + } + } } } @@ -2427,82 +2553,126 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto /* store the number of tracks found */ outtoc.numtrks = trknum + 1; + outtoc.numsessions = sessionnum + 1; /* now go over the files again and set the lengths */ for (trknum = 0; trknum < outtoc.numtrks; trknum++) { uint64_t tlen = 0; - // this is true for cue/bin and cue/iso, and we need it for cue/wav since .WAV is little-endian + if (outinfo.track[trknum].idx[1] == -1) + { + /* index 1 should always be set */ + printf("ERROR: track %d is missing INDEX 01 marker\n", trknum+1); + return chd_file::error::INVALID_DATA; + } + + /* this is true for cue/bin and cue/iso, and we need it for cue/wav since .WAV is little-endian */ if (outtoc.tracks[trknum].trktype == CD_TRACK_AUDIO) { outinfo.track[trknum].swap = true; } - // don't do this for .WAV tracks, we already have their length and offset filled out - if (outinfo.track[trknum].offset == 0) + /* don't do this for .WAV tracks, we already have their length and offset filled out */ + if (outinfo.track[trknum].offset != 0) + continue; + + if (trknum+1 >= outtoc.numtrks && trknum > 0 && (outinfo.track[trknum].fname.compare(outinfo.track[trknum-1].fname)==0)) { - // is this the last track? - if (trknum == (outtoc.numtrks-1)) + /* if the last track's filename is the same as the previous track */ + tlen = get_file_size(outinfo.track[trknum].fname); + if (tlen == 0) { - /* if we have the same filename as the last track, do it that way */ - if (trknum != 0 && (outinfo.track[trknum].fname.compare(outinfo.track[trknum-1].fname)==0)) + printf("ERROR: couldn't find bin file [%s]\n", outinfo.track[trknum-1].fname.c_str()); + return std::errc::no_such_file_or_directory; + } + + outinfo.track[trknum].offset = outinfo.track[trknum-1].offset + outtoc.tracks[trknum-1].frames * (outtoc.tracks[trknum-1].datasize + outtoc.tracks[trknum-1].subsize); + outtoc.tracks[trknum].frames = (tlen - outinfo.track[trknum].offset) / (outtoc.tracks[trknum].datasize + outtoc.tracks[trknum].subsize); + } + else if (trknum+1 < outtoc.numtrks && outinfo.track[trknum].fname.compare(outinfo.track[trknum+1].fname)==0) + { + /* if the current filename is the same as the next track */ + outtoc.tracks[trknum].frames = outinfo.track[trknum+1].idx[0] - outinfo.track[trknum].idx[0]; + + if (outtoc.tracks[trknum].frames == 0) + { + printf("ERROR: unable to determine size of track %d, missing INDEX 01 markers?\n", trknum+1); + return chd_file::error::INVALID_DATA; + } + + if (trknum > 0) + { + const uint32_t previous_track_raw_size = outtoc.tracks[trknum-1].frames * (outtoc.tracks[trknum-1].datasize + outtoc.tracks[trknum-1].subsize); + outinfo.track[trknum].offset = outinfo.track[trknum-1].offset + previous_track_raw_size; + } + } + else if (outtoc.tracks[trknum].frames == 0) + { + /* if the filenames between tracks are different */ + tlen = get_file_size(outinfo.track[trknum].fname); + if (tlen == 0) + { + printf("ERROR: couldn't find bin file [%s]\n", outinfo.track[trknum-1].fname.c_str()); + return std::errc::no_such_file_or_directory; + } + + outtoc.tracks[trknum].frames = tlen / (outtoc.tracks[trknum].datasize + outtoc.tracks[trknum].subsize); + outinfo.track[trknum].offset = 0; + } + + if (outtoc.flags & CD_FLAG_MULTISESSION) + { + if (is_multibin) + { + if (outinfo.track[trknum].leadout == -1 && trknum + 1 < outtoc.numtrks && outtoc.tracks[trknum].session != outtoc.tracks[trknum+1].session) { - tlen = get_file_size(outinfo.track[trknum].fname); - if (tlen == 0) - { - printf("ERROR: couldn't find bin file [%s]\n", outinfo.track[trknum-1].fname.c_str()); - return std::errc::no_such_file_or_directory; - } - outinfo.track[trknum].offset = outinfo.track[trknum-1].offset + outtoc.tracks[trknum-1].frames * (outtoc.tracks[trknum-1].datasize + outtoc.tracks[trknum-1].subsize); - outtoc.tracks[trknum].frames = (tlen - outinfo.track[trknum].offset) / (outtoc.tracks[trknum].datasize + outtoc.tracks[trknum].subsize); + /* add a standard lead-out to the last track before changing sessions */ + outinfo.track[trknum].leadout = outtoc.tracks[trknum].session == 0 ? 6750 : 2250; /* first session lead-out (1m30s0f) is longer than the rest (0m30s0f) */ } - else /* data files are different */ + + if (outinfo.track[trknum].leadin == -1 && trknum > 0 && outtoc.tracks[trknum].session != outtoc.tracks[trknum-1].session) { - tlen = get_file_size(outinfo.track[trknum].fname); - if (tlen == 0) - { - printf("ERROR: couldn't find bin file [%s]\n", outinfo.track[trknum-1].fname.c_str()); - return std::errc::no_such_file_or_directory; - } - tlen /= (outtoc.tracks[trknum].datasize + outtoc.tracks[trknum].subsize); - outtoc.tracks[trknum].frames = tlen; - outinfo.track[trknum].offset = 0; + /* add a standard lead-in to the first track of a new session */ + outinfo.track[trknum].leadin = 4500; /* lead-in (1m0s0f) */ } } else { - /* if we have the same filename as the next track, do it that way */ - if (outinfo.track[trknum].fname.compare(outinfo.track[trknum+1].fname)==0) + if (outinfo.track[trknum].leadout != -1) { - outtoc.tracks[trknum].frames = outinfo.track[trknum+1].idx0offs - outinfo.track[trknum].idx0offs; - - if (trknum == 0) // track 0 offset is 0 + /* + if a lead-out time is specified in a multisession CD then the size of the previous track needs to be trimmed + to use the lead-out time instead of the idx 0 of the next track + */ + const int endframes = outinfo.track[trknum].leadout - outinfo.track[trknum].idx[0]; + if (outtoc.tracks[trknum].frames >= endframes) { - outinfo.track[trknum].offset = 0; - } - else - { - outinfo.track[trknum].offset = outinfo.track[trknum-1].offset + outtoc.tracks[trknum-1].frames * (outtoc.tracks[trknum-1].datasize + outtoc.tracks[trknum-1].subsize); - } + outtoc.tracks[trknum].frames = endframes; /* trim track length */ - if (!outtoc.tracks[trknum].frames) - { - printf("ERROR: unable to determine size of track %d, missing INDEX 01 markers?\n", trknum+1); - return chd_file::error::INVALID_DATA; + if (trknum + 1 < outtoc.numtrks) + { + /* lead-out value becomes just the duration between the lead-out to the pre-gap of the next track */ + outinfo.track[trknum].leadout = outinfo.track[trknum+1].idx[0] - outinfo.track[trknum].leadout; + } } } - else /* data files are different */ + + if (trknum > 0 && outinfo.track[trknum-1].leadout != -1) { - tlen = get_file_size(outinfo.track[trknum].fname); - if (tlen == 0) + /* + ImgBurn bin/cue have dummy data to pad between the lead-out and the start of the next track. + DiscImageCreator img/cue does not have any data between the lead-out and the start of the next track. + + Detecting by extension is an awful way to handle this but there's no other way to determine what format + the data will be in since we don't know the exact length of the last track just from the cue. + */ + if (!core_filename_ends_with(outinfo.track[trknum-1].fname, ".img")) { - printf("ERROR: couldn't find bin file [%s]\n", outinfo.track[trknum].fname.c_str()); - return std::errc::no_such_file_or_directory; + outtoc.tracks[trknum-1].padframes += outinfo.track[trknum-1].leadout; + outtoc.tracks[trknum].frames -= outinfo.track[trknum-1].leadout; + outinfo.track[trknum].offset += outinfo.track[trknum-1].leadout * (outtoc.tracks[trknum].datasize + outtoc.tracks[trknum].subsize); } - tlen /= (outtoc.tracks[trknum].datasize + outtoc.tracks[trknum].subsize); - outtoc.tracks[trknum].frames = tlen; - outinfo.track[trknum].offset = 0; } } } @@ -2523,7 +2693,7 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto outinfo.track[trknum].offset += this_offset; outtoc.tracks[trknum].frames -= this_pregap; - outinfo.track[trknum].idx1offs -= this_pregap; + outinfo.track[trknum].idx[1] -= this_pregap; outtoc.tracks[trknum].pregap = 0; outtoc.tracks[trknum].pgtype = 0; @@ -2551,7 +2721,8 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto if (EXTRA_VERBOSE) for (trknum = 0; trknum < outtoc.numtrks; trknum++) { - printf("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", + 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, @@ -2562,8 +2733,8 @@ std::error_condition cdrom_file::parse_cue(std::string_view tocfname, toc &outto outtoc.tracks[trknum].pregap, outtoc.tracks[trknum].pgtype, outtoc.tracks[trknum].pgdatasize, - outinfo.track[trknum].idx0offs, - outinfo.track[trknum].idx1offs, + outinfo.track[trknum].idx[0], + outinfo.track[trknum].idx[1], outtoc.tracks[trknum].frames - outtoc.tracks[trknum].padframes); } @@ -2832,6 +3003,7 @@ std::error_condition cdrom_file::parse_toc(std::string_view tocfname, toc &outto /* store the number of tracks found */ outtoc.numtrks = trknum + 1; + outtoc.numsessions = 1; return std::error_condition(); } diff --git a/src/lib/util/cdrom.h b/src/lib/util/cdrom.h index 9bf80190a7c..dd62badeff1 100644 --- a/src/lib/util/cdrom.h +++ b/src/lib/util/cdrom.h @@ -24,6 +24,7 @@ class cdrom_file { static constexpr uint32_t MAX_TRACKS = 99; /* AFAIK the theoretical limit */ static constexpr uint32_t MAX_SECTOR_DATA = 2352; static constexpr uint32_t MAX_SUBCODE_DATA = 96; + static constexpr uint32_t MAX_INDEX = 99; static constexpr uint32_t FRAME_SIZE = MAX_SECTOR_DATA + MAX_SUBCODE_DATA; static constexpr uint32_t FRAMES_PER_HUNK = 8; @@ -53,25 +54,43 @@ class cdrom_file { enum { - CD_FLAG_GDROM = 0x00000001, // disc is a GD-ROM, all tracks should be stored with GD-ROM metadata - CD_FLAG_GDROMLE = 0x00000002 // legacy GD-ROM, with little-endian CDDA data + CD_FLAG_GDROM = 0x00000001, // disc is a GD-ROM, all tracks should be stored with GD-ROM metadata + CD_FLAG_GDROMLE = 0x00000002, // legacy GD-ROM, with little-endian CDDA data + CD_FLAG_MULTISESSION = 0x00000004, // multisession CD-ROM + }; + + enum + { + CD_FLAG_CONTROL_PREEMPHASIS = 1, + CD_FLAG_CONTROL_DIGITAL_COPY_PERMITTED = 2, + CD_FLAG_CONTROL_DATA_TRACK = 4, + CD_FLAG_CONTROL_4CH = 8, + }; + + enum + { + CD_FLAG_ADR_START_TIME = 1, + CD_FLAG_ADR_CATALOG_CODE, + CD_FLAG_ADR_ISRC_CODE, }; struct track_info { /* fields used by CHDMAN and in MAME */ - uint32_t trktype; /* track type */ - uint32_t subtype; /* subcode data type */ - uint32_t datasize; /* size of data in each sector of this track */ - uint32_t subsize; /* size of subchannel data in each sector of this track */ - uint32_t frames; /* number of frames in this track */ - uint32_t extraframes; /* number of "spillage" frames in this track */ - uint32_t pregap; /* number of pregap frames */ - uint32_t postgap; /* number of postgap frames */ - uint32_t pgtype; /* type of sectors in pregap */ - uint32_t pgsub; /* type of subchannel data in pregap */ - uint32_t pgdatasize; /* size of data in each sector of the pregap */ - uint32_t pgsubsize; /* size of subchannel data in each sector of the pregap */ + uint32_t trktype; /* track type */ + uint32_t subtype; /* subcode data type */ + uint32_t datasize; /* size of data in each sector of this track */ + uint32_t subsize; /* size of subchannel data in each sector of this track */ + uint32_t frames; /* number of frames in this track */ + uint32_t extraframes; /* number of "spillage" frames in this track */ + uint32_t pregap; /* number of pregap frames */ + uint32_t postgap; /* number of postgap frames */ + uint32_t pgtype; /* type of sectors in pregap */ + uint32_t pgsub; /* type of subchannel data in pregap */ + uint32_t pgdatasize; /* size of data in each sector of the pregap */ + uint32_t pgsubsize; /* size of subchannel data in each sector of the pregap */ + uint32_t control_flags; /* metadata flags associated with each track */ + uint32_t session; /* session number */ /* fields used in CHDMAN only */ uint32_t padframes; /* number of frames of padding to add to the end of the track; needed for GDI */ @@ -91,6 +110,7 @@ class cdrom_file { struct toc { uint32_t numtrks; /* number of tracks */ + uint32_t numsessions; /* number of sessions */ uint32_t flags; /* see FLAG_ above */ track_info tracks[MAX_TRACKS + 1]; }; @@ -98,13 +118,13 @@ class cdrom_file { struct track_input_entry { track_input_entry() { reset(); } - void reset() { fname.clear(); offset = idx0offs = idx1offs = 0; swap = false; } + void reset() { fname.clear(); offset = 0; leadin = leadout = -1; swap = false; std::fill(std::begin(idx), std::end(idx), -1); } std::string fname; // filename for each track uint32_t offset; // offset in the data file for each track bool swap; // data needs to be byte swapped - uint32_t idx0offs; - uint32_t idx1offs; + int32_t idx[MAX_INDEX + 1]; + int32_t leadin, leadout; // TODO: these should probably be their own tracks entirely }; struct track_input_info @@ -128,6 +148,7 @@ class cdrom_file { uint32_t get_track(uint32_t frame) const; uint32_t get_track_start(uint32_t track) const {return cdtoc.tracks[track == 0xaa ? cdtoc.numtrks : track].logframeofs; } uint32_t get_track_start_phys(uint32_t track) const { return cdtoc.tracks[track == 0xaa ? cdtoc.numtrks : track].physframeofs; } + uint32_t get_track_index(uint32_t frame) const; /* TOC utilities */ static std::error_condition parse_nero(std::string_view tocfname, toc &outtoc, track_input_info &outinfo); @@ -136,8 +157,16 @@ class cdrom_file { static std::error_condition parse_cue(std::string_view tocfname, toc &outtoc, track_input_info &outinfo); static bool is_gdicue(std::string_view tocfname); 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 { return track == 0xaa || cdtoc.tracks[track].trktype == CD_TRACK_AUDIO ? 0x10 : 0x14; } + 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); + if (cdtoc.tracks[track].trktype != CD_TRACK_AUDIO) + adrctl |= CD_FLAG_CONTROL_DATA_TRACK; + return adrctl; + } int get_track_type(int track) const { return cdtoc.tracks[track].trktype; } const toc &get_toc() const { return cdtoc; } From f9ef8589ef2bd692df1b75f9f56efea5c065693b Mon Sep 17 00:00:00 2001 From: arbee Date: Sun, 12 May 2024 14:15:45 -0400 Subject: [PATCH 09/16] sega/segaybd.cpp: Switch Sega Y-Board games back to Musashi (MT08783). [R. Belmont] cpu/m68000: added option to use Musashi for M68000 emulation. [R. Belmont] --- scripts/src/cpu.lua | 2 ++ src/devices/cpu/m68000/m68000musashi.cpp | 25 ++++++++++++++++++++++ src/devices/cpu/m68000/m68000musashi.h | 27 ++++++++++++++++++++++++ src/mame/sega/segaybd.cpp | 6 +++--- src/mame/sega/segaybd.h | 8 +++---- 5 files changed, 61 insertions(+), 7 deletions(-) create mode 100755 src/devices/cpu/m68000/m68000musashi.cpp create mode 100755 src/devices/cpu/m68000/m68000musashi.h diff --git a/scripts/src/cpu.lua b/scripts/src/cpu.lua index ed31d24dbdc..f40e4815cce 100644 --- a/scripts/src/cpu.lua +++ b/scripts/src/cpu.lua @@ -2042,6 +2042,8 @@ if CPUS["M680X0"] then MAME_DIR .. "src/devices/cpu/m68000/m68008-sip8.cpp", MAME_DIR .. "src/devices/cpu/m68000/m68008.h", MAME_DIR .. "src/devices/cpu/m68000/m68008.cpp", + MAME_DIR .. "src/devices/cpu/m68000/m68000musashi.h", + MAME_DIR .. "src/devices/cpu/m68000/m68000musashi.cpp", MAME_DIR .. "src/devices/cpu/m68000/m68010.h", MAME_DIR .. "src/devices/cpu/m68000/m68010.cpp", MAME_DIR .. "src/devices/cpu/m68000/m68020.h", diff --git a/src/devices/cpu/m68000/m68000musashi.cpp b/src/devices/cpu/m68000/m68000musashi.cpp new file mode 100755 index 00000000000..41b4c746458 --- /dev/null +++ b/src/devices/cpu/m68000/m68000musashi.cpp @@ -0,0 +1,25 @@ +// license:BSD-3-Clause +// copyright-holders:Karl Stenerud + +#include "emu.h" +#include "m68000musashi.h" +#include "m68kdasm.h" + +DEFINE_DEVICE_TYPE(M68000MUSASHI, m68000msh_device, "m68000msh", "Motorola MC68000 (Musashi)") + +std::unique_ptr m68000msh_device::create_disassembler() +{ + return std::make_unique(m68k_disassembler::TYPE_68010); +} + + +m68000msh_device::m68000msh_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) + : m68000_musashi_device(mconfig, tag, owner, clock, M68000MUSASHI, 16, 24) +{ +} + +void m68000msh_device::device_start() +{ + m68000_musashi_device::device_start(); + init_cpu_m68000(); +} diff --git a/src/devices/cpu/m68000/m68000musashi.h b/src/devices/cpu/m68000/m68000musashi.h new file mode 100755 index 00000000000..0d025d05e44 --- /dev/null +++ b/src/devices/cpu/m68000/m68000musashi.h @@ -0,0 +1,27 @@ +// license:BSD-3-Clause +// copyright-holders:Karl Stenerud +#ifndef MAME_CPU_M68000_M68000MUSASHI_H +#define MAME_CPU_M68000_M68000MUSASHI_H + +#pragma once + +#include "m68kmusashi.h" + +class m68000msh_device : public m68000_musashi_device +{ +public: + // construction/destruction + m68000msh_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + + virtual std::unique_ptr create_disassembler() override; + + virtual u32 execute_min_cycles() const noexcept override { return 4; } + virtual u32 execute_max_cycles() const noexcept override { return 158; } + + // device-level overrides + virtual void device_start() override; +}; + +DECLARE_DEVICE_TYPE(M68000MUSASHI, m68000msh_device) + +#endif diff --git a/src/mame/sega/segaybd.cpp b/src/mame/sega/segaybd.cpp index 0c132c8ae2f..776f211a8a9 100644 --- a/src/mame/sega/segaybd.cpp +++ b/src/mame/sega/segaybd.cpp @@ -1428,13 +1428,13 @@ INPUT_PORTS_END void segaybd_state::yboard(machine_config &config) { // basic machine hardware - M68000(config, m_maincpu, MASTER_CLOCK/4); + M68000MUSASHI(config, m_maincpu, MASTER_CLOCK/4); m_maincpu->set_addrmap(AS_PROGRAM, &segaybd_state::main_map); - M68000(config, m_subx, MASTER_CLOCK/4); + M68000MUSASHI(config, m_subx, MASTER_CLOCK/4); m_subx->set_addrmap(AS_PROGRAM, &segaybd_state::subx_map); - M68000(config, m_suby, MASTER_CLOCK/4); + M68000MUSASHI(config, m_suby, MASTER_CLOCK/4); m_suby->set_addrmap(AS_PROGRAM, &segaybd_state::suby_map); Z80(config, m_soundcpu, SOUND_CLOCK/8); diff --git a/src/mame/sega/segaybd.h b/src/mame/sega/segaybd.h index 864f9b877fa..c38b74558c2 100644 --- a/src/mame/sega/segaybd.h +++ b/src/mame/sega/segaybd.h @@ -10,7 +10,7 @@ #pragma once -#include "cpu/m68000/m68000.h" +#include "cpu/m68000/m68000musashi.h" #include "cpu/z80/z80.h" #include "machine/mb3773.h" #include "segaic16.h" @@ -123,9 +123,9 @@ class segaybd_state : public sega_16bit_common_base void update_irqs(); // devices - required_device m_maincpu; - required_device m_subx; - required_device m_suby; + required_device m_maincpu; + required_device m_subx; + required_device m_suby; required_device m_soundcpu; optional_device m_linkcpu; required_device m_watchdog; From 7f8793967ffadf36e0c439db406ae1635d5c3a69 Mon Sep 17 00:00:00 2001 From: wilbertpol Date: Sun, 12 May 2024 21:47:07 +0100 Subject: [PATCH 10/16] lib/formats/fs_fat.cpp: Add write support. (#12363) --- src/lib/formats/fs_fat.cpp | 557 ++++++++++++++++++++++++++++++++++--- 1 file changed, 520 insertions(+), 37 deletions(-) diff --git a/src/lib/formats/fs_fat.cpp b/src/lib/formats/fs_fat.cpp index 4aad4f6b573..fe9a7b949c4 100644 --- a/src/lib/formats/fs_fat.cpp +++ b/src/lib/formats/fs_fat.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Nathan Woods +// copyright-holders:Nathan Woods,Wilbert Pol /*************************************************************************** fs_fat.cpp @@ -7,11 +7,13 @@ PC FAT disk images Current Limitations: - - Read only - Only supports floppy disks - No FAT32 support - No Long Filenames Support + Removal of files is untested; floptool does not have a command to delete + a file. + ***************************************************************************** Master boot record format: @@ -147,6 +149,7 @@ #include "strformat.h" #include +#include using namespace fs; @@ -163,7 +166,22 @@ namespace { class directory_entry { public: - static const int SIZE = 32; + static constexpr int SIZE = 32; + static constexpr int OFFSET_FNAME = 0; + static constexpr int FNAME_LENGTH = 11; + static constexpr int OFFSET_ATTRIBUTES = 11; + static constexpr int OFFSET_CREATE_DATETIME = 14; + static constexpr int OFFSET_START_CLUSTER_HI = 20; + static constexpr int OFFSET_MODIFIED_DATETIME = 22; + static constexpr int OFFSET_START_CLUSTER = 26; + static constexpr int OFFSET_FILE_SIZE = 28; + static constexpr u8 DELETED_FILE_MARKER = 0xe5; + static constexpr u8 ATTR_READ_ONLY = 0x01; + static constexpr u8 ATTR_HIDDEN = 0x02; + static constexpr u8 ATTR_SYSTEM = 0x04; + static constexpr u8 ATTR_VOLUME_LABEL = 0x08; + static constexpr u8 ATTR_DIRECTORY = 0x10; + static constexpr u8 ATTR_ARCHIVE = 0x20; directory_entry(const fsblk_t::block_t &block, u32 offset) : m_block(block) @@ -171,13 +189,13 @@ class directory_entry { } - std::string_view raw_stem() const { return std::string_view((const char *) &m_block.rodata()[m_offset + 0], 8); } - std::string_view raw_ext() const { return std::string_view((const char *) &m_block.rodata()[m_offset + 8], 3); } - u8 attributes() const { return m_block.r8(m_offset + 11); } - u32 raw_create_datetime() const { return m_block.r32l(m_offset + 14); } - u32 raw_modified_datetime() const { return m_block.r32l(m_offset + 22); } - u32 start_cluster() const { return ((u32)m_block.r16l(m_offset + 20)) << 16 | m_block.r16l(m_offset + 26); } - u32 file_size() const { return m_block.r32l(m_offset + 28); } + std::string_view raw_stem() const { return std::string_view((const char *) &m_block.rodata()[m_offset + OFFSET_FNAME], 8); } + std::string_view raw_ext() const { return std::string_view((const char *) &m_block.rodata()[m_offset + OFFSET_FNAME + 8], 3); } + u8 attributes() const { return m_block.r8(m_offset + OFFSET_ATTRIBUTES); } + u32 raw_create_datetime() const { return m_block.r32l(m_offset + OFFSET_CREATE_DATETIME); } + u32 raw_modified_datetime() const { return m_block.r32l(m_offset + OFFSET_MODIFIED_DATETIME); } + u32 start_cluster() const { return ((u32)m_block.r16l(m_offset + OFFSET_START_CLUSTER_HI)) << 16 | m_block.r16l(m_offset + OFFSET_START_CLUSTER); } + u32 file_size() const { return m_block.r32l(m_offset + OFFSET_FILE_SIZE); } bool is_read_only() const { return (attributes() & 0x01) != 0x00; } bool is_hidden() const { return (attributes() & 0x02) != 0x00; } @@ -191,14 +209,15 @@ class directory_entry std::string name() const; meta_data metadata() const; -private: - static constexpr u8 DELETED_FILE_MARKER = 0xe5; + void set_file_size(u32 file_size) { m_block.w32l(m_offset + OFFSET_FILE_SIZE, file_size); } + void set_raw_modified_datetime(u32 datetime) { m_block.w32l(m_offset + OFFSET_MODIFIED_DATETIME, datetime); } + void mark_deleted() { m_block.w8(m_offset + OFFSET_FNAME, DELETED_FILE_MARKER); } +private: fsblk_t::block_t m_block; u32 m_offset; }; - // ======================> directory_span class directory_span @@ -232,24 +251,57 @@ class impl : public filesystem_t virtual std::pair metadata(const std::vector &path) override; virtual std::pair> directory_contents(const std::vector &path) override; virtual std::pair> file_read(const std::vector &path) override; + virtual err_t file_create(const std::vector &path, const meta_data &meta) override; + virtual err_t file_write(const std::vector &path, const std::vector &data) override; + virtual err_t remove(const std::vector &path) override; // methods std::vector get_sectors_from_fat(const directory_entry &dirent) const; + // Boot sector settings + static constexpr u32 OFFSET_BYTES_PER_SECTOR = 0x0b; + static constexpr u32 OFFSET_CLUSTER_SECTOR_COUNT = 0x0d; + static constexpr u32 OFFSET_RESERVED_SECTOR_COUNT = 0x0e; + static constexpr u32 OFFSET_FAT_COUNT = 0x10; + static constexpr u32 OFFSET_DIRECTORY_ENTRY_COUNT = 0x11; + static constexpr u32 OFFSET_FAT_SECTOR_COUNT = 0x16; + private: + static constexpr u32 FIRST_VALID_CLUSTER = 2; + fsblk_t::block_t m_boot_sector_block; std::vector m_file_allocation_table; u32 m_starting_sector; u32 m_sector_count; u16 m_reserved_sector_count; u16 m_bytes_per_sector; + u16 m_root_directory_size; + u16 m_sectors_per_cluster; + u8 m_fat_count; + u16 m_fat_sector_count; u8 m_bits_per_fat_entry; + u32 m_last_cluster_indicator; + u32 m_last_valid_cluster; // methods 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); + 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); + err_t initialize_directory(u32 directory_cluster, u32 parent_cluster); + err_t initialize_directory_entry(fsblk_t::block_t &dirblk, u32 offset, const std::string_view &fname, u8 attributes, u32 start_cluster); + err_t free_clusters(u32 start_cluster); + void clear_cluster_sectors(u32 cluster, u8 fill_byte); + u32 first_cluster_sector(u32 cluster); + u32 get_next_cluster(u32 cluster); + void set_next_cluster(u32 cluster, u32 next_cluster); + u32 find_free_cluster(); + }; @@ -317,15 +369,27 @@ util::arbitrary_datetime decode_fat_datetime(u32 dt) util::arbitrary_datetime result; memset(&result, 0, sizeof(result)); - result.year = ((dt >> 25) & 0x7F) + 1980; - result.month = (dt >> 21) & 0x0F; - result.day_of_month = (dt >> 16) & 0x1F; - result.hour = (dt >> 11) & 0x1F; - result.minute = (dt >> 5) & 0x3F; - result.second = ((dt >> 0) & 0x1F) * 2; + result.year = ((dt >> 25) & 0x7f) + 1980; + result.month = (dt >> 21) & 0x0f; + result.day_of_month = (dt >> 16) & 0x1f; + result.hour = (dt >> 11) & 0x1f; + result.minute = (dt >> 5) & 0x3f; + result.second = ((dt >> 0) & 0x1f) * 2; return result; } +u32 encode_now_fat_datetime() +{ + auto now = util::arbitrary_datetime::now(); + + return u32((((now.year - 1980) & 0x7f) << 25) | + ((now.month & 0x0f) << 21) | + ((now.day_of_month & 0x1f) << 16) | + ((now.hour & 0x1f) << 11) | + ((now.minute & 0x3f) << 5) | + ((now.second >> 1) & 0x1f)); +} + } @@ -355,7 +419,7 @@ bool fs::fat_image::can_read() const bool fs::fat_image::can_write() const { - return false; + return true; } @@ -429,12 +493,12 @@ std::unique_ptr fs::fat_image::mount_partition(fsblk_t &blockdev, { // load the boot sector block and get some basic info fsblk_t::block_t boot_sector_block = blockdev.get(starting_sector); - u16 reserved_sector_count = boot_sector_block.r16l(14); + u16 reserved_sector_count = boot_sector_block.r16l(impl::OFFSET_RESERVED_SECTOR_COUNT); // load all file allocation table sectors - u32 fat_count = boot_sector_block.r8(16); - u32 sectors_per_fat = boot_sector_block.r16l(22); - u16 bytes_per_sector = boot_sector_block.r16l(11); + u32 fat_count = boot_sector_block.r8(impl::OFFSET_FAT_COUNT); + u32 sectors_per_fat = boot_sector_block.r16l(impl::OFFSET_FAT_SECTOR_COUNT); + u16 bytes_per_sector = boot_sector_block.r16l(impl::OFFSET_BYTES_PER_SECTOR); std::vector file_allocation_table; file_allocation_table.reserve(fat_count * sectors_per_fat * bytes_per_sector); for (auto i = 0; i < fat_count * sectors_per_fat; i++) @@ -489,8 +553,14 @@ impl::impl(fsblk_t &blockdev, fsblk_t::block_t &&boot_sector_block, std::vector< , m_starting_sector(starting_sector) , m_sector_count(sector_count) , m_reserved_sector_count(reserved_sector_count) - , m_bytes_per_sector(m_boot_sector_block.r16l(11)) + , m_bytes_per_sector(m_boot_sector_block.r16l(OFFSET_BYTES_PER_SECTOR)) + , m_root_directory_size(m_boot_sector_block.r16l(OFFSET_DIRECTORY_ENTRY_COUNT)) + , m_sectors_per_cluster(m_boot_sector_block.r8(OFFSET_CLUSTER_SECTOR_COUNT)) + , m_fat_count(m_boot_sector_block.r8(OFFSET_FAT_COUNT)) + , m_fat_sector_count(m_boot_sector_block.r16l(OFFSET_FAT_SECTOR_COUNT)) , m_bits_per_fat_entry(bits_per_fat_entry) + , m_last_cluster_indicator(((u64)1 << bits_per_fat_entry) - 1) + , m_last_valid_cluster(m_last_cluster_indicator - 0x10) { } @@ -594,6 +664,339 @@ std::pair> impl::file_read(const std::vector } +bool impl::is_valid_short_filename(std::string &filename) +{ + /* + Valid characters in DOS file names: + - Upper case letters A-Z + - Numbers 0-9 + - Space (though there is no way to identify a trailing space) + - ! # $ % & ( ) - @ ^ _ ` { } ~ + - Characters 128-255, except e5 (though the code page is indeterminate) + We currently do not check for characters 128-255. + */ + std::regex filename_regex("([A-Z0-9!#\\$%&\\(\\)\\-@^_`\\{\\}~]{0,8})(\\.([A-Z0-9!#\\$%&\\(\\)\\-@^_`\\{\\}~]{0,3}))?"); + return std::regex_match(filename, filename_regex); +} + + +err_t impl::build_direntry_filename(std::string &filename, std::string &fname) +{ + std::regex filename_regex("([A-Z0-9!#\\$%&\\(\\)\\-@^_`\\{\\}~]{0,8})(\\.([A-Z0-9!#\\$%&\\(\\)\\-@^_`\\{\\}~]{0,3}))?"); + std::smatch smatch; + if (!std::regex_match(filename, smatch, filename_regex)) + return ERR_INVALID; + if (smatch.size() != 4) + return ERR_INVALID; + + fname.resize(directory_entry::FNAME_LENGTH, ' '); + + for (int i = 0; i < 8 && i < smatch.str(1).size(); i++) + fname[i] = smatch.str(1)[i]; + + for (int j = 0; j < 3 && j < smatch.str(3).size(); j++) + fname[8 + j] = smatch.str(3)[j]; + + return ERR_OK; +} + + +err_t impl::file_create(const std::vector &path, const meta_data &meta) +{ + std::string filename = meta.get_string(meta_name::name, ""); + std::string fname; + err_t err = build_direntry_filename(filename, fname); + if (err != ERR_OK) + return err; + + if (path.empty()) + { + return file_create_root(fname); + } 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) + { + partial_path.emplace_back(path_part); + std::optional dir_entry = find_entity(partial_path); + if (!dir_entry) + { + if (!is_valid_short_filename(path_part)) + return ERR_INVALID; + + std::string part_fname; + err_t err = build_direntry_filename(path_part, part_fname); + 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); + if (err != ERR_OK) + return err; + + dir_entry = find_entity(partial_path); + if (!dir_entry) + return ERR_INVALID; + + err = initialize_directory(dir_entry->start_cluster(), parent_entry ? parent_entry->start_cluster() : 0); + if (err != ERR_OK) + return err; + } + else + { + if (!dir_entry->is_subdirectory()) + return ERR_INVALID; + } + parent_entry = dir_entry; + } + + dirent = find_entity(path); + if (!dirent) + return ERR_INVALID; + } + + return file_create_directory(dirent.value(), fname); + } +} + + +err_t impl::initialize_directory(u32 directory_cluster, u32 parent_cluster) +{ + clear_cluster_sectors(directory_cluster, 0x00); + + auto dirblk = m_blockdev.get(first_cluster_sector(directory_cluster)); + + // Add special directory entries for . and .. + std::string dir_fname; + dir_fname.resize(directory_entry::FNAME_LENGTH, ' '); + dir_fname[0] = '.'; + err_t err = initialize_directory_entry(dirblk, 0, dir_fname, directory_entry::ATTR_DIRECTORY, directory_cluster); + if (err != ERR_OK) + return err; + + dir_fname[1] = '.'; + err = initialize_directory_entry(dirblk, directory_entry::SIZE, dir_fname, directory_entry::ATTR_DIRECTORY, parent_cluster); + if (err != ERR_OK) + return err; + + return ERR_OK; +} + + +err_t impl::initialize_directory_entry(fsblk_t::block_t &dirblk, u32 offset, const std::string_view &fname, u8 attributes, u32 start_cluster) +{ + if (fname.size() != directory_entry::FNAME_LENGTH) + return ERR_INVALID; + + for (int i = 0; i < directory_entry::SIZE; i += 4) + dirblk.w32l(offset + i, 0); + + dirblk.wstr(offset + directory_entry::OFFSET_FNAME, fname); + dirblk.w8(offset + directory_entry::OFFSET_ATTRIBUTES, attributes); + dirblk.w32l(offset + directory_entry::OFFSET_CREATE_DATETIME, encode_now_fat_datetime()); + dirblk.w32l(offset + directory_entry::OFFSET_MODIFIED_DATETIME, encode_now_fat_datetime()); + dirblk.w16l(offset + directory_entry::OFFSET_START_CLUSTER_HI, u16(start_cluster >> 16)); + dirblk.w16l(offset + directory_entry::OFFSET_START_CLUSTER, u16(start_cluster & 0xffff)); + + return ERR_OK; +} + + +err_t impl::file_create_root(std::string &fname, u8 attributes) +{ + const u32 first_directory_sector = m_starting_sector + m_reserved_sector_count + ((u32)m_file_allocation_table.size() / m_bytes_per_sector); + const u32 directory_sector_count = (m_root_directory_size * directory_entry::SIZE) / m_bytes_per_sector; + for (u32 sector = first_directory_sector; sector < first_directory_sector + directory_sector_count; sector++) + { + err_t err = file_create_sector(sector, fname, attributes); + if (err != ERR_NOT_FOUND) + return err; + } + return ERR_NO_SPACE; +} + + +err_t impl::file_create_directory(directory_entry &dirent, std::string &fname, u8 attributes) +{ + 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++) { + err_t err = file_create_sector(first_sector + i, fname, attributes); + if (err != ERR_NOT_FOUND) + return err; + } + + // 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) { + next_cluster = find_free_cluster(); + if (next_cluster == 0) + return ERR_NO_SPACE; + + set_next_cluster(current_cluster, next_cluster); + set_next_cluster(next_cluster, m_last_cluster_indicator); + + clear_cluster_sectors(next_cluster, 0x00); + } + current_cluster = next_cluster; + } while (current_cluster > FIRST_VALID_CLUSTER && current_cluster < m_last_valid_cluster); + return ERR_NO_SPACE; +} + + +u32 impl::first_cluster_sector(u32 cluster) +{ + return m_starting_sector + m_reserved_sector_count + + ((u32)m_file_allocation_table.size() / m_bytes_per_sector) + + ((m_root_directory_size + 1) / dirents_per_sector()) + + ((cluster - FIRST_VALID_CLUSTER) * m_sectors_per_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++) { + auto dirblk = m_blockdev.get(sector + i); + for (int offset = 0; offset < m_bytes_per_sector; offset++) + dirblk.w8(offset, fill_byte); + } +} + + +// Returns ERR_NOT_FOUND when no room could be found to create the file in the sector. +err_t impl::file_create_sector(u32 sector, std::string &fname, u8 attributes) +{ + auto dirblk = m_blockdev.get(sector); + for (u32 blkoffset = 0; blkoffset < m_bytes_per_sector; blkoffset += directory_entry::SIZE) + { + u8 first_byte = dirblk.r8(blkoffset); + if (first_byte == 0x00 || first_byte == directory_entry::DELETED_FILE_MARKER) + { + u32 start_cluster = find_free_cluster(); + if (start_cluster == 0) + return ERR_NO_SPACE; + set_next_cluster(start_cluster, m_last_cluster_indicator); + + err_t err = initialize_directory_entry(dirblk, blkoffset, fname, attributes, start_cluster); + if (err != ERR_OK) + return err; + + return ERR_OK; + } + } + return ERR_NOT_FOUND; +} + + +err_t impl::file_write(const std::vector &path, const std::vector &data) +{ + std::optional dirent = find_entity(path); + if (!dirent) + return ERR_NOT_FOUND; + + if (dirent->is_subdirectory()) + return ERR_INVALID; + + u32 current_length = dirent->file_size(); + const size_t data_length = data.size(); + const u32 bytes_per_cluster = m_sectors_per_cluster * bytes_per_sector(); + const u32 current_clusters = (current_length + bytes_per_cluster - 1) / bytes_per_cluster; + const u32 required_clusters = (data_length + bytes_per_cluster - 1) / bytes_per_cluster; + + if (required_clusters > current_clusters) + { + u32 current_cluster = dirent->start_cluster(); + u32 next_cluster = 0; + do { + next_cluster = get_next_cluster(current_cluster); + if (next_cluster < FIRST_VALID_CLUSTER) + return ERR_INVALID; + } while (next_cluster < m_last_valid_cluster); + for (int i = current_clusters; i < required_clusters; i++) + { + u32 free_cluster = find_free_cluster(); + if (free_cluster < FIRST_VALID_CLUSTER) + return ERR_NO_SPACE; + + set_next_cluster(current_cluster, free_cluster); + set_next_cluster(free_cluster, m_last_cluster_indicator); + current_cluster = free_cluster; + } + } + if (required_clusters < current_clusters) + { + u32 current_cluster = dirent->start_cluster(); + for (int i = 0; i < required_clusters; i++) + { + current_cluster = get_next_cluster(current_cluster); + } + u32 next_cluster = get_next_cluster(current_cluster); + set_next_cluster(current_cluster, m_last_cluster_indicator); + + err_t err = free_clusters(next_cluster); + if (err != ERR_OK) + return err; + } + + auto sectors = get_sectors_from_fat(*dirent); + size_t offset = 0; + for (auto sector : sectors) + { + if (offset < data_length) + { + auto datablk = m_blockdev.get(sector); + u32 bytes = (data_length - offset > m_bytes_per_sector) ? m_bytes_per_sector : data_length - offset; + memcpy(datablk.data(), data.data() + offset, bytes); + offset += m_bytes_per_sector; + } + } + + dirent->set_raw_modified_datetime(encode_now_fat_datetime()); + dirent->set_file_size(data_length); + + return ERR_OK; +} + + +err_t impl::remove(const std::vector &path) +{ + if (path.size() != 0) + return ERR_UNSUPPORTED; + + std::optional dirent = find_entity(path); + if (!dirent) + return ERR_OK; + + // Removing directories is not supported yet + if (dirent->is_subdirectory()) + return ERR_UNSUPPORTED; + + dirent->mark_deleted(); + + return ERR_OK; +} + + +err_t impl::free_clusters(u32 start_cluster) +{ + while (start_cluster < m_last_valid_cluster) + { + if (start_cluster < FIRST_VALID_CLUSTER) + return ERR_INVALID; + + u32 next_cluster = get_next_cluster(start_cluster); + set_next_cluster(start_cluster, 0); + start_cluster = next_cluster; + } + return ERR_OK; +} + //------------------------------------------------- // impl::get_sectors_from_fat //------------------------------------------------- @@ -605,22 +1008,20 @@ std::vector impl::get_sectors_from_fat(const directory_entry &dirent) const results.reserve(dirent.file_size() / bytes_per_sector()); // get critical information - u8 sectors_per_cluster = m_boot_sector_block.r8(13); - u16 root_directory_entry_count = m_boot_sector_block.r16l(17); - u16 root_directory_sector_count = (root_directory_entry_count + 1) / dirents_per_sector(); - u32 fat_sector_count = (u32)(m_file_allocation_table.size() / m_bytes_per_sector); + u16 root_directory_sector_count = (m_root_directory_size + 1) / dirents_per_sector(); + u32 fat_sector_count = m_fat_count * m_fat_sector_count; 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) / sectors_per_cluster; + u32 data_cluster_count = (m_sector_count - data_starting_sector) / m_sectors_per_cluster; // find all clusters u32 start_cluster_mask = ((u64)1 << m_bits_per_fat_entry) - 1; u32 cluster = dirent.start_cluster() & start_cluster_mask; - while (cluster >= 2 && cluster < (data_cluster_count + 2)) + while (cluster >= FIRST_VALID_CLUSTER && cluster < (data_cluster_count + 2)) { // add the sectors for this cluster - for (auto i = 0; i < sectors_per_cluster; i++) - results.push_back(data_starting_sector + (cluster - 2) * sectors_per_cluster + i); + for (auto i = 0; i < m_sectors_per_cluster; i++) + results.push_back(data_starting_sector + (cluster - FIRST_VALID_CLUSTER) * m_sectors_per_cluster + i); // determine the bit position of this entry u32 entry_bit_position = cluster * m_bits_per_fat_entry; @@ -644,8 +1045,8 @@ std::vector impl::get_sectors_from_fat(const directory_entry &dirent) const } // normalize special cluster IDs - if (new_cluster > ((u32)1 << m_bits_per_fat_entry) - 0x10) - new_cluster |= ~(((u32)1 << m_bits_per_fat_entry) - 1); + if (new_cluster > m_last_valid_cluster) + new_cluster |= ~m_last_cluster_indicator; } cluster = new_cluster; } @@ -654,6 +1055,89 @@ std::vector impl::get_sectors_from_fat(const directory_entry &dirent) const } +u32 impl::get_next_cluster(u32 cluster) +{ + u32 entry_bit_position = cluster * m_bits_per_fat_entry; + u32 new_cluster = 0; + if (entry_bit_position + m_bits_per_fat_entry <= m_file_allocation_table.size() * 8) + { + u32 current_bit = 0; + while (current_bit < m_bits_per_fat_entry) + { + u32 pos = entry_bit_position + current_bit; + u32 shift = pos % 8; + u32 bit_count = std::min(8 - shift, m_bits_per_fat_entry - current_bit); + u32 bits = (m_file_allocation_table[pos / 8] >> shift) & ((1 << bit_count) - 1); + + new_cluster |= (bits << current_bit); + current_bit += bit_count; + } + } + return new_cluster; +} + + +void impl::set_next_cluster(u32 cluster, u32 next_cluster) +{ + const u32 m_fat_start_sector = m_starting_sector + m_reserved_sector_count; + const 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) + { + u32 current_bit = 0; + while (current_bit < m_bits_per_fat_entry) + { + u32 pos = entry_bit_position + current_bit; + u32 shift = pos % 8; + u32 bit_count = std::min(8 - shift, m_bits_per_fat_entry - current_bit); + u32 byte_pos = pos / 8; + u32 mask = ((1 << bit_count) - 1); + m_file_allocation_table[byte_pos] = (m_file_allocation_table[byte_pos] & ~(mask << shift)) | ((next_cluster & mask) << shift); + next_cluster = next_cluster >> bit_count; + current_bit += bit_count; + // Write back to backing blocks + 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]); + } + } + } +} + + +// Returns 0 if no free cluster could be found +u32 impl::find_free_cluster() +{ + u16 root_directory_sector_count = (m_root_directory_size + 1) / dirents_per_sector(); + u32 fat_sector_count = m_fat_count * m_fat_sector_count; + 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++) { + 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) + { + u32 new_cluster = 0; + u32 current_bit = 0; + while (current_bit < m_bits_per_fat_entry) + { + u32 pos = entry_bit_position + current_bit; + u32 shift = pos % 8; + u32 bit_count = std::min(8 - shift, m_bits_per_fat_entry - current_bit); + u32 bits = (m_file_allocation_table[pos / 8] >> shift) & ((1 << bit_count) - 1); + + new_cluster |= (bits << current_bit); + current_bit += bit_count; + } + + if (new_cluster == 0) + return cluster; + } + } + return 0; +} + //------------------------------------------------- // impl::find_entity //------------------------------------------------- @@ -682,8 +1166,7 @@ directory_span::ptr impl::find_directory(std::vector::const_iterato { // the root directory is treated differently u32 first_sector = m_starting_sector + m_reserved_sector_count + (u32)m_file_allocation_table.size() / m_bytes_per_sector; - u16 directory_entry_count = m_boot_sector_block.r16l(17); - directory_span::ptr current_dir = std::make_unique(*this, first_sector, directory_entry_count); + directory_span::ptr current_dir = std::make_unique(*this, first_sector, m_root_directory_size); // traverse the directory for (auto iter = path_begin; iter != path_end; iter++) From 7fa05ad90bf0f18629fe61033fac90999d3c1d66 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Mon, 13 May 2024 00:46:20 +0200 Subject: [PATCH 11/16] New systems marked not working ------------------------------ Yamaha QS300 [O. Galibert, Matt] Yamaha EOS B900 [O. Galibert, Matt] --- src/devices/cpu/h8/h8_intc.cpp | 2 +- src/mame/mame.lst | 4 + src/mame/yamaha/ymqs300.cpp | 374 +++++++++++++++++++++++++++++++++ 3 files changed, 379 insertions(+), 1 deletion(-) create mode 100644 src/mame/yamaha/ymqs300.cpp diff --git a/src/devices/cpu/h8/h8_intc.cpp b/src/devices/cpu/h8/h8_intc.cpp index 0e471d7330f..9ef110b16c3 100644 --- a/src/devices/cpu/h8/h8_intc.cpp +++ b/src/devices/cpu/h8/h8_intc.cpp @@ -297,7 +297,7 @@ u8 h8h_intc_device::isr_r() void h8h_intc_device::isr_w(u8 data) { m_isr &= data; // edge/level - logerror("isr = %02x / %02x\n", data, m_isr); + // logerror("isr = %02x / %02x\n", data, m_isr); check_level_irqs(false); update_irq_state(); } diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 9ec1525f685..2a94a657a82 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -46304,6 +46304,10 @@ mu500 mu1000 mu2000 +@source:yamaha/ymqs300.cpp +qs300 +eosb900 + @source:yamaha/ympcs30.cpp pcs30 // 1984 diff --git a/src/mame/yamaha/ymqs300.cpp b/src/mame/yamaha/ymqs300.cpp new file mode 100644 index 00000000000..07f11f3ef10 --- /dev/null +++ b/src/mame/yamaha/ymqs300.cpp @@ -0,0 +1,374 @@ +// license:BSD-3-Clause +// copyright-holders:Olivier Galibert + +#include "emu.h" + +#include "bus/midi/midiinport.h" +#include "bus/midi/midioutport.h" +#include "cpu/h8/h83002.h" +#include "machine/nvram.h" +#include "sound/swp00.h" +#include "video/t6963c.h" + +#include "screen.h" +#include "speaker.h" +#include "utf8.h" + +class qs300_state : public driver_device { +public: + qs300_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_subcpu(*this, "subcpu"), + m_swp00(*this, "swp00"), + m_lcdc(*this, "vs254300"), + m_nvram(*this, "ram"), + m_inputs(*this, "DR%u", 0U), + m_is_eos(false) + + { } + + void qs300(machine_config &config); + +protected: + required_device m_maincpu; + required_device m_subcpu; + required_device m_swp00; + required_device m_lcdc; + required_device m_nvram; + required_ioport_array<7> m_inputs; + // required_ioport m_sustain; + // required_ioport m_pitch_bend; + + bool m_is_eos; + u8 m_mlatch, m_slatch; + bool m_mlatch_full, m_slatch_full; + + u8 m_mpb; + + void mainmap(address_map &map); + void submap(address_map &map); + void lcdmap(address_map &map); + + u8 mlatch_r(); + void mlatch_w(u8 data); + u8 slatch_r(); + void slatch_w(u8 data); + + u8 mp6_r(); + void mp6_w(u8 data); + u8 mp7_r(); + u8 mpa_r(); + u8 mpb_r(); + void mpb_w(u8 data); + + u8 sp9_r(); + u8 spa_r(); + + void lcd_palette(palette_device &palette) const; + + void machine_start() override; +}; + +class eos_b900_state : public qs300_state +{ +public: + eos_b900_state(const machine_config &mconfig, device_type type, const char *tag) + : qs300_state(mconfig, type, tag) + { + m_is_eos = true; + } +}; + +void qs300_state::machine_start() +{ + save_item(NAME(m_mlatch)); + save_item(NAME(m_mlatch_full)); + save_item(NAME(m_slatch)); + save_item(NAME(m_slatch_full)); + save_item(NAME(m_mpb)); + + m_mlatch = 0; + m_mlatch_full = false; + m_slatch = 0; + m_slatch_full = false; + m_mpb = 0; +} + +u8 qs300_state::mlatch_r() +{ + if(!machine().side_effects_disabled()) { + m_mlatch_full = false; + m_maincpu->set_input_line(4, CLEAR_LINE); + } + return m_mlatch; +} + +void qs300_state::mlatch_w(u8 data) +{ + m_mlatch = data; + m_mlatch_full = true; + m_maincpu->set_input_line(4, ASSERT_LINE); +} + +u8 qs300_state::mpa_r() +{ + return (m_slatch_full ? 0x40 : 0x00) | (m_is_eos ? 0x00 : 0x20); +} + +u8 qs300_state::slatch_r() +{ + if(!machine().side_effects_disabled()) { + m_slatch_full = false; + m_subcpu->set_input_line(4, CLEAR_LINE); + } + return m_slatch; +} + +void qs300_state::slatch_w(u8 data) +{ + m_slatch = data; + m_slatch_full = true; + m_subcpu->set_input_line(4, ASSERT_LINE); +} + +u8 qs300_state::spa_r() +{ + return m_mlatch_full ? 0x40 : 0x00; +} + +u8 qs300_state::mpb_r() +{ + return m_mpb; +} + +void qs300_state::mpb_w(u8 data) +{ + m_mpb = data; +} + +u8 qs300_state::mp6_r() +{ + return 0xff; +} + +void qs300_state::mp6_w(u8 data) +{ + // Bits 1-2 are related to leds +} + +u8 qs300_state::mp7_r() +{ + // Some bits are inverted with transistors for led driving reasons. + u8 mask = m_mpb ^ 0x1b; + u8 res = 0xff; + for(u32 i=0; i != 7; i++) + if(BIT(mask, i)) + res &= m_inputs[i]->read(); + + return res; +} + +u8 qs300_state::sp9_r() +{ + // 0x20 = suspend pedal + return 0x00; +} + +void qs300_state::lcd_palette(palette_device &palette) const +{ + palette.set_pen_color(0, rgb_t(2, 176, 219)); + palette.set_pen_color(1, rgb_t(0, 0, 0)); +} + +void qs300_state::qs300(machine_config &config) +{ + H83002(config, m_maincpu, 16_MHz_XTAL); + m_maincpu->set_addrmap(AS_PROGRAM, &qs300_state::mainmap); + m_maincpu->read_port6().set(FUNC(qs300_state::mp6_r)); + m_maincpu->write_port6().set(FUNC(qs300_state::mp6_w)); + m_maincpu->read_port7().set(FUNC(qs300_state::mp7_r)); + m_maincpu->read_porta().set(FUNC(qs300_state::mpa_r)); + m_maincpu->read_portb().set(FUNC(qs300_state::mpb_r)); + m_maincpu->write_portb().set(FUNC(qs300_state::mpb_w)); + + H83002(config, m_subcpu, 16_MHz_XTAL); + m_subcpu->read_adc<0>().set_constant(0); // Aftertouch + m_subcpu->read_adc<1>().set_constant(0); // Pitch bend + m_subcpu->read_adc<2>().set_constant(0); // Modulation wheel + m_subcpu->read_adc<3>().set_constant(0x3ff); // CC ? Wired to +5V + m_subcpu->read_adc<4>().set_constant(0); // Foot control + m_subcpu->read_adc<5>().set_constant(0); // Foot volume + m_subcpu->read_adc<6>().set_constant(0x3ff); // Unconnected + m_subcpu->read_adc<7>().set_constant(0x3ff); // Battery + m_subcpu->set_addrmap(AS_PROGRAM, &qs300_state::submap); + m_subcpu->read_port9().set(FUNC(qs300_state::sp9_r)); + m_subcpu->read_porta().set(FUNC(qs300_state::spa_r)); + + SWP00(config, m_swp00); + m_swp00->add_route(0, "lspeaker", 1.0); + m_swp00->add_route(1, "rspeaker", 1.0); + + T6963C(config, m_lcdc, 270000); + m_lcdc->set_addrmap(0, &qs300_state::lcdmap); + m_lcdc->set_fs(2); + m_lcdc->set_md(0x13); + + PALETTE(config, "palette", FUNC(qs300_state::lcd_palette), 2); + + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD)); + screen.set_refresh_hz(60); + screen.set_size(240, 80); + screen.set_visarea(0, 239, 0, 63); + screen.set_screen_update("vs254300", FUNC(t6963c_device::screen_update)); + screen.set_palette("palette"); + + NVRAM(config, m_nvram, nvram_device::DEFAULT_NONE); + + SPEAKER(config, "lspeaker").front_left(); + SPEAKER(config, "rspeaker").front_right(); + + auto &mdin(MIDI_PORT(config, "mdin")); + midiin_slot(mdin); + mdin.rxd_handler().set(m_maincpu, FUNC(h83002_device::sci_rx_w<0>)); + + auto &mdout(MIDI_PORT(config, "mdout")); + midiout_slot(mdout); + m_maincpu->write_sci_tx<0>().set(mdout, FUNC(midi_port_device::write_txd)); + + // Annoying but required for faster inter-cpu communication + config.set_maximum_quantum(attotime::from_usec(10)); +} + +void qs300_state::mainmap(address_map &map) +{ + map(0x000000, 0x1fffff).rom().region("maincpu", 0); + map(0x200000, 0x207fff).ram().share("ram"); + map(0x420000, 0x420000).rw(FUNC(qs300_state::mlatch_r), FUNC(qs300_state::slatch_w)); + map(0x440000, 0x440001).rw(m_lcdc, FUNC(t6963c_device::read), FUNC(t6963c_device::write)); + + // 480000: fdc + + map(0x600000, 0x67ffff).ram(); +} + +void qs300_state::submap(address_map &map) +{ + map(0x000000, 0x07ffff).rom().region("subcpu", 0); + map(0x200000, 0x2007ff).m(m_swp00, FUNC(swp00_device::map)); + map(0x400000, 0x400000).rw(FUNC(qs300_state::slatch_r), FUNC(qs300_state::mlatch_w)); + map(0x600000, 0x61ffff).ram(); +} + +void qs300_state::lcdmap(address_map &map) +{ + map(0x0000, 0x7fff).ram(); +} + +static INPUT_PORTS_START( qs300 ) + PORT_START("DR0") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Song") PORT_CODE(KEYCODE_A) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Voice") PORT_CODE(KEYCODE_S) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("DR1") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Pattern") PORT_CODE(KEYCODE_D) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Phrase") PORT_CODE(KEYCODE_F) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F1") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F2") PORT_CODE(KEYCODE_W) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("DR2") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Utility") PORT_CODE(KEYCODE_G) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Disk") PORT_CODE(KEYCODE_H) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F3") PORT_CODE(KEYCODE_E) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F4") PORT_CODE(KEYCODE_R) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("DR3") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Record") PORT_CODE(KEYCODE_J) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Top") PORT_CODE(KEYCODE_K) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F5") PORT_CODE(KEYCODE_T) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F6") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("DR4") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Stop") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Run") PORT_CODE(KEYCODE_X) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F7") PORT_CODE(KEYCODE_U) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F8") PORT_CODE(KEYCODE_I) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("DR5") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("<<") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME(">>") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Exit") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Dec/No") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Inc/Yes") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + + PORT_START("DR6") + PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Edit") PORT_CODE(KEYCODE_C) + PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Job") PORT_CODE(KEYCODE_V) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Store") PORT_CODE(KEYCODE_B) + PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) +INPUT_PORTS_END + +ROM_START( qs300 ) + ROM_REGION( 0x200000, "maincpu", 0 ) + ROM_LOAD16_WORD_SWAP( "xq055e0.ic04", 0x000000, 0x100000, CRC(abdbcc1f) SHA1(998c3cd5b14d407cb0e1fcdea9a9f585cf73fe5a)) + ROM_LOAD16_WORD_SWAP( "xq320e0.ic24", 0x100000, 0x100000, CRC(5fe1a151) SHA1(7e06716795fdd24e33a922a1f3fe77e6082b2abb)) + + ROM_REGION( 0x80000, "subcpu", 0 ) + ROM_LOAD16_WORD_SWAP( "xq056e0.ic09", 0, 0x80000, CRC(ff0ed0f9) SHA1(be80b5e7c701db708e435c2c825d562cf20a284e)) + + ROM_REGION16_LE( 0x400000, "swp00", 0) + // Identical to the mu50 roms + ROM_LOAD( "xq057c0.ic10", 0x000000, 0x200000, CRC(d4adbc7e) SHA1(32f653c7644d060f5a6d63a435ae3a7412386d92) ) + ROM_LOAD( "xq058c0.ic11", 0x200000, 0x200000, CRC(7b68f475) SHA1(adf68689b4842ec5bc9b0ea1bb99cf66d2dec4de) ) + + ROM_REGION(0x400, "vs254300:cgrom", 0) + ROM_LOAD("t6963c_0101.bin", 0x000, 0x400, CRC(547d118b) SHA1(0dd3e3acd3d47e6ece644c98c390fc86587373e9)) + // This t6963c_0101 internal CG ROM is similar to lm24014w_0101.bin which may be used as a replacement +ROM_END + +ROM_START( eosb900 ) + // Identical afaict. The firmware can almost but not quite handle the sdx 4000 too. + ROM_REGION( 0x200000, "maincpu", 0 ) + ROM_LOAD16_WORD_SWAP( "xq055e0.ic04", 0x000000, 0x100000, CRC(abdbcc1f) SHA1(998c3cd5b14d407cb0e1fcdea9a9f585cf73fe5a)) + ROM_LOAD16_WORD_SWAP( "xq320e0.ic24", 0x100000, 0x100000, CRC(5fe1a151) SHA1(7e06716795fdd24e33a922a1f3fe77e6082b2abb)) + + ROM_REGION( 0x80000, "subcpu", 0 ) + ROM_LOAD16_WORD_SWAP( "xq056e0.ic09", 0, 0x80000, CRC(ff0ed0f9) SHA1(be80b5e7c701db708e435c2c825d562cf20a284e)) + + ROM_REGION16_LE( 0x400000, "swp00", 0) + // Identical to the mu50 roms + ROM_LOAD( "xq057c0.ic10", 0x000000, 0x200000, CRC(d4adbc7e) SHA1(32f653c7644d060f5a6d63a435ae3a7412386d92) ) + ROM_LOAD( "xq058c0.ic11", 0x200000, 0x200000, CRC(7b68f475) SHA1(adf68689b4842ec5bc9b0ea1bb99cf66d2dec4de) ) + + ROM_REGION(0x400, "vs254300:cgrom", 0) + ROM_LOAD("t6963c_0101.bin", 0x000, 0x400, CRC(547d118b) SHA1(0dd3e3acd3d47e6ece644c98c390fc86587373e9)) + // This t6963c_0101 internal CG ROM is similar to lm24014w_0101.bin which may be used as a replacement +ROM_END + +SYST( 1999, qs300, 0, 0, qs300, qs300, qs300_state, empty_init, "Yamaha", "QS300", MACHINE_NOT_WORKING ) +SYST( 1999, eosb900, qs300, 0, qs300, qs300, eos_b900_state, empty_init, "Yamaha", "EOS B900", MACHINE_NOT_WORKING ) From 25587a632132fab97a00a3dc4b379046aa073463 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Mon, 13 May 2024 12:02:52 +0200 Subject: [PATCH 12/16] qs300: Correct inputs polarity and voltage of battery --- src/mame/yamaha/ymqs300.cpp | 112 ++++++++++++++++++------------------ 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/src/mame/yamaha/ymqs300.cpp b/src/mame/yamaha/ymqs300.cpp index 07f11f3ef10..80e19529a39 100644 --- a/src/mame/yamaha/ymqs300.cpp +++ b/src/mame/yamaha/ymqs300.cpp @@ -161,10 +161,10 @@ u8 qs300_state::mp7_r() { // Some bits are inverted with transistors for led driving reasons. u8 mask = m_mpb ^ 0x1b; - u8 res = 0xff; + u8 res = 0; for(u32 i=0; i != 7; i++) if(BIT(mask, i)) - res &= m_inputs[i]->read(); + res |= m_inputs[i]->read(); return res; } @@ -200,7 +200,7 @@ void qs300_state::qs300(machine_config &config) m_subcpu->read_adc<4>().set_constant(0); // Foot control m_subcpu->read_adc<5>().set_constant(0); // Foot volume m_subcpu->read_adc<6>().set_constant(0x3ff); // Unconnected - m_subcpu->read_adc<7>().set_constant(0x3ff); // Battery + m_subcpu->read_adc<7>().set_constant(0x276); // Battery (3V) m_subcpu->set_addrmap(AS_PROGRAM, &qs300_state::submap); m_subcpu->read_port9().set(FUNC(qs300_state::sp9_r)); m_subcpu->read_porta().set(FUNC(qs300_state::spa_r)); @@ -249,7 +249,7 @@ void qs300_state::mainmap(address_map &map) // 480000: fdc - map(0x600000, 0x67ffff).ram(); + map(0x600000, 0x67ffff).ram().mirror(0x180000); } void qs300_state::submap(address_map &map) @@ -267,70 +267,70 @@ void qs300_state::lcdmap(address_map &map) static INPUT_PORTS_START( qs300 ) PORT_START("DR0") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Song") PORT_CODE(KEYCODE_A) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Voice") PORT_CODE(KEYCODE_S) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) - PORT_BIT(0xf8, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Song") PORT_CODE(KEYCODE_A) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Voice") PORT_CODE(KEYCODE_S) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) + PORT_BIT(0xf8, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_START("DR1") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Pattern") PORT_CODE(KEYCODE_D) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Phrase") PORT_CODE(KEYCODE_F) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F1") PORT_CODE(KEYCODE_Q) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F2") PORT_CODE(KEYCODE_W) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("7") PORT_CODE(KEYCODE_7) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("8") PORT_CODE(KEYCODE_8) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("9") PORT_CODE(KEYCODE_9) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Pattern") PORT_CODE(KEYCODE_D) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Phrase") PORT_CODE(KEYCODE_F) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("F1") PORT_CODE(KEYCODE_Q) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("F2") PORT_CODE(KEYCODE_W) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("7") PORT_CODE(KEYCODE_7) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("8") PORT_CODE(KEYCODE_8) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("9") PORT_CODE(KEYCODE_9) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_START("DR2") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Utility") PORT_CODE(KEYCODE_G) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Disk") PORT_CODE(KEYCODE_H) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F3") PORT_CODE(KEYCODE_E) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F4") PORT_CODE(KEYCODE_R) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("4") PORT_CODE(KEYCODE_4) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("5") PORT_CODE(KEYCODE_5) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("6") PORT_CODE(KEYCODE_6) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Utility") PORT_CODE(KEYCODE_G) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Disk") PORT_CODE(KEYCODE_H) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("F3") PORT_CODE(KEYCODE_E) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("F4") PORT_CODE(KEYCODE_R) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("4") PORT_CODE(KEYCODE_4) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("5") PORT_CODE(KEYCODE_5) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("6") PORT_CODE(KEYCODE_6) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_START("DR3") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Record") PORT_CODE(KEYCODE_J) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Top") PORT_CODE(KEYCODE_K) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F5") PORT_CODE(KEYCODE_T) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F6") PORT_CODE(KEYCODE_Y) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("1") PORT_CODE(KEYCODE_1) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("2") PORT_CODE(KEYCODE_2) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Record") PORT_CODE(KEYCODE_J) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Top") PORT_CODE(KEYCODE_K) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("F5") PORT_CODE(KEYCODE_T) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("F6") PORT_CODE(KEYCODE_Y) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("1") PORT_CODE(KEYCODE_1) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("2") PORT_CODE(KEYCODE_2) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("3") PORT_CODE(KEYCODE_3) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_START("DR4") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Stop") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Run") PORT_CODE(KEYCODE_X) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F7") PORT_CODE(KEYCODE_U) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("F8") PORT_CODE(KEYCODE_I) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("0") PORT_CODE(KEYCODE_0) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Stop") PORT_CODE(KEYCODE_Z) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Run") PORT_CODE(KEYCODE_X) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("F7") PORT_CODE(KEYCODE_U) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("F8") PORT_CODE(KEYCODE_I) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("0") PORT_CODE(KEYCODE_0) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("-") PORT_CODE(KEYCODE_MINUS) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Enter") PORT_CODE(KEYCODE_ENTER) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_START("DR5") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("<<") PORT_CODE(KEYCODE_COMMA) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME(">>") PORT_CODE(KEYCODE_STOP) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Exit") PORT_CODE(KEYCODE_BACKSPACE) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Dec/No") PORT_CODE(KEYCODE_OPENBRACE) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Inc/Yes") PORT_CODE(KEYCODE_CLOSEBRACE) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("<<") PORT_CODE(KEYCODE_COMMA) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME(">>") PORT_CODE(KEYCODE_STOP) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Exit") PORT_CODE(KEYCODE_BACKSPACE) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Dec/No") PORT_CODE(KEYCODE_OPENBRACE) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME(UTF8_UP) PORT_CODE(KEYCODE_UP) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Inc/Yes") PORT_CODE(KEYCODE_CLOSEBRACE) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) PORT_START("DR6") - PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Edit") PORT_CODE(KEYCODE_C) - PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Job") PORT_CODE(KEYCODE_V) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Store") PORT_CODE(KEYCODE_B) - PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) - PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) - PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) - PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) - PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Edit") PORT_CODE(KEYCODE_C) + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Job") PORT_CODE(KEYCODE_V) + PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME("Store") PORT_CODE(KEYCODE_B) + PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME(UTF8_LEFT) PORT_CODE(KEYCODE_LEFT) + PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME(UTF8_DOWN) PORT_CODE(KEYCODE_DOWN) + PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_OTHER) PORT_NAME(UTF8_RIGHT) PORT_CODE(KEYCODE_RIGHT) + PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED) INPUT_PORTS_END ROM_START( qs300 ) From 07b62ad614ee76bc6d61d7054aa7cbbfdf2a1d13 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Mon, 13 May 2024 18:33:32 +0200 Subject: [PATCH 13/16] New systems marked not working ------------------------------ Clie PEG-T650C [Guru] --- src/mame/capcom/lwings.cpp | 4 +- src/mame/mame.lst | 3 ++ src/mame/sony/clie_db.cpp | 86 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 src/mame/sony/clie_db.cpp diff --git a/src/mame/capcom/lwings.cpp b/src/mame/capcom/lwings.cpp index b40c2006810..f2486ccea27 100644 --- a/src/mame/capcom/lwings.cpp +++ b/src/mame/capcom/lwings.cpp @@ -1685,7 +1685,7 @@ For the Trojan sets, Capcom labeled all program ROMs as TB 04, TB 05 & TB 06. S */ -ROM_START( trojan ) // One of these sets is rev A - need to verify +ROM_START( trojan ) // This set is likely rev A - need to verify ROM_REGION( 0x20000, "maincpu", 0 ) /* 64k for code + 3*16k for the banked ROMs images */ ROM_LOAD( "tb_04.10n", 0x00000, 0x8000, CRC(c1bbeb4e) SHA1(248ae4184d25b642b282ef44ac729c0f7952834d) ) ROM_LOAD( "tb_06.13n", 0x10000, 0x8000, CRC(d49592ef) SHA1(b538bac3c73f35474cc6745a4e4dc3ab6217eaac) ) @@ -1732,7 +1732,7 @@ ROM_START( trojan ) // One of these sets is rev A - need to verify ROM_LOAD( "tbb-1.1e", 0x0100, 0x0100, CRC(5052fa9d) SHA1(8cd240f4795a7ae76499573c09069dba37182be2) ) /* priority (not used) */ ROM_END -ROM_START( trojana ) // One of these sets is rev A - need to verify +ROM_START( trojana ) ROM_REGION( 0x20000, "maincpu", 0 ) /* 64k for code + 3*16k for the banked ROMs images */ ROM_LOAD( "tb_04.10n", 0x00000, 0x8000, CRC(0113a551) SHA1(933ebaf73fb70772fc2cf2b9143bf00757505772) ) // SLDH ROM_LOAD( "tb_06.13n", 0x10000, 0x8000, CRC(aa127a5b) SHA1(0b7115c2ffe8456ef463e22d68e03a2e396abf92) ) // SLDH diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 2a94a657a82..6dff4dbff0b 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -42507,6 +42507,9 @@ uvw1800 // 199? Sony Betacam-SP UVW-1800 @source:sony/bvm.cpp bvm20f1e // +@source:sony/clie_db.cpp +t650c // + @source:sony/dfs500.cpp dfs500 // 1994 Sony DFS-500 Video Mixer diff --git a/src/mame/sony/clie_db.cpp b/src/mame/sony/clie_db.cpp new file mode 100644 index 00000000000..40e9a7cea02 --- /dev/null +++ b/src/mame/sony/clie_db.cpp @@ -0,0 +1,86 @@ +// license:BSD-3-Clause +// copyright-holders: + +/* +Skeleton driver for Sony Clie PDAs running on Motorola Dragonball CPU. +Later series ran on ARM based SoCs and should go in a separate driver. + +Sony Clie PEG T650C main components (PCB YSX-1230 MP-43): +- Motorola Super VZ DragonBall MC68SZ328AVH66 +- MediaQ MQ1100-CBC +- Sony CXD3523AGG +- Mosel-Vitelic V54C3128164VAT7 +- Sony CXD1859GA +*/ + +#include "emu.h" + +#include "machine/mc68328.h" + +#include "screen.h" +#include "speaker.h" + + +namespace { + +class clie_db_state : public driver_device +{ +public: + clie_db_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu") + { } + + void t650c(machine_config &config); + +private: + required_device m_maincpu; + + void program_map(address_map &map); + + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); +}; + + +uint32_t clie_db_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +{ + return 0; +} + + +void clie_db_state::program_map(address_map &map) +{ + map(0x00000000, 0x007fffff).rom(); +} + + +static INPUT_PORTS_START( t650c ) +INPUT_PORTS_END + +void clie_db_state::t650c(machine_config &config) +{ + MC68EZ328(config, m_maincpu, 66'000'000); // unknown clock, 66 MHz according to flyer + m_maincpu->set_addrmap(AS_PROGRAM, &clie_db_state::program_map); + + screen_device&screen(SCREEN(config, "screen", SCREEN_TYPE_LCD)); + screen.set_refresh_hz(60); + screen.set_size(320, 320); // 320 x 320 according to flyer + screen.set_visarea(0, 320 - 1, 0, 320 - 1); + screen.set_screen_update(FUNC(clie_db_state::screen_update)); + + // TODO: MediaQ MQ1100-CB LCD controller + + SPEAKER(config, "speaker").front_center(); + // TODO: CXD1859GA audio chip +} + + +ROM_START( t650c ) + ROM_REGION16_BE( 0x800000, "maincpu", 0 ) + ROM_LOAD16_WORD_SWAP( "sony_clie_peg_t650c_flashrom.bin", 0x000000, 0x800000, CRC(60855a64) SHA1(e08350e64438c62401041aaa335def08aa0decb7) ) // TODO: factory-reset +ROM_END + +} // anonymous namespace + + +SYST( 2002, t650c, 0, 0, t650c, t650c, clie_db_state, empty_init, "Sony", "Clie PEG-T650C", MACHINE_IS_SKELETON ) From 34a31ac42d383f24b4ea4a8acdc923a77eca9b05 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Tue, 14 May 2024 05:11:16 +1000 Subject: [PATCH 14/16] Fixed various issues in internal layouts: * plugins/layout: Log script errors at warning level rather than verbose level. * microtouch.lay, pntnpuzl.lay: Improved pointer mapping code. * Reordered all layouts to place views after element and group definitions and scripts last. This matches how layout files are interpreted by MAME. * Fixed various errors identified by validating layout files against an XSD schema. --- plugins/layout/init.lua | 2 +- src/mame/layout/babydad.lay | 2 +- src/mame/layout/babypkr.lay | 2 +- src/mame/layout/bfm_sc4.lay | 2 +- src/mame/layout/bfm_sc5.lay | 2 +- src/mame/layout/bfm_sc5_gu96x8.lay | 6 +- src/mame/layout/bigtrak.lay | 2 +- src/mame/layout/dx100.lay | 4 +- src/mame/layout/eacc.lay | 2 +- src/mame/layout/ecoinf2.lay | 2 +- src/mame/layout/ecoinf3.lay | 2 +- src/mame/layout/ecoinfr.lay | 2 +- src/mame/layout/enmirage.lay | 2 +- src/mame/layout/fb01.lay | 2 +- src/mame/layout/guab.lay | 2 +- src/mame/layout/hp3478a.lay | 2 +- src/mame/layout/interpro.lay | 12 +-- src/mame/layout/m4andybt.lay | 26 +++--- src/mame/layout/mdndclab.lay | 134 ++++++++++++++--------------- src/mame/layout/microtouch.lay | 34 ++++++-- src/mame/layout/mu128.lay | 2 +- src/mame/layout/pce220.lay | 4 +- src/mame/layout/pntnpuzl.lay | 36 ++++++-- src/mame/layout/sc4_dmd.lay | 2 +- src/mame/layout/segajw.lay | 2 +- src/mame/layout/sigmab52.lay | 2 +- src/mame/layout/teqsun.lay | 4 +- src/mame/layout/v4dbltak.lay | 78 ++++++++--------- 28 files changed, 205 insertions(+), 169 deletions(-) diff --git a/plugins/layout/init.lua b/plugins/layout/init.lua index d4c9a535f34..f3b1094ef55 100644 --- a/plugins/layout/init.lua +++ b/plugins/layout/init.lua @@ -51,7 +51,7 @@ function layout.startplugin() table = table } local script, err = load(script, script, "t", env) if not script then - emu.print_verbose("error loading layout script " .. err) + emu.print_warning("error loading layout script " .. err) return end local hooks = script() diff --git a/src/mame/layout/babydad.lay b/src/mame/layout/babydad.lay index 1580034785d..a23320224e9 100644 --- a/src/mame/layout/babydad.lay +++ b/src/mame/layout/babydad.lay @@ -106,7 +106,7 @@ license:CC0-1.0 - + diff --git a/src/mame/layout/babypkr.lay b/src/mame/layout/babypkr.lay index 48fbcbca93a..77a70987b65 100644 --- a/src/mame/layout/babypkr.lay +++ b/src/mame/layout/babypkr.lay @@ -133,7 +133,7 @@ license:CC0-1.0 - + diff --git a/src/mame/layout/bfm_sc4.lay b/src/mame/layout/bfm_sc4.lay index c795126d447..7b2ac79c481 100644 --- a/src/mame/layout/bfm_sc4.lay +++ b/src/mame/layout/bfm_sc4.lay @@ -52,7 +52,7 @@ license:CC0-1.0 - " + diff --git a/src/mame/layout/bfm_sc5.lay b/src/mame/layout/bfm_sc5.lay index c795126d447..7b2ac79c481 100644 --- a/src/mame/layout/bfm_sc5.lay +++ b/src/mame/layout/bfm_sc5.lay @@ -52,7 +52,7 @@ license:CC0-1.0 - " + diff --git a/src/mame/layout/bfm_sc5_gu96x8.lay b/src/mame/layout/bfm_sc5_gu96x8.lay index c5226a5a682..b8ea3a681c5 100644 --- a/src/mame/layout/bfm_sc5_gu96x8.lay +++ b/src/mame/layout/bfm_sc5_gu96x8.lay @@ -52,7 +52,7 @@ license:CC0 - " + @@ -254,7 +254,7 @@ license:CC0 - + @@ -270,7 +270,7 @@ license:CC0 - + diff --git a/src/mame/layout/bigtrak.lay b/src/mame/layout/bigtrak.lay index fcc7e90d3dd..e471bd0b718 100644 --- a/src/mame/layout/bigtrak.lay +++ b/src/mame/layout/bigtrak.lay @@ -50,7 +50,7 @@ authors:hap - > + diff --git a/src/mame/layout/dx100.lay b/src/mame/layout/dx100.lay index 17d40389658..a016ba269f0 100644 --- a/src/mame/layout/dx100.lay +++ b/src/mame/layout/dx100.lay @@ -47,7 +47,7 @@ license:CC0-1.0 - + @@ -953,7 +953,7 @@ license:CC0-1.0 - + diff --git a/src/mame/layout/eacc.lay b/src/mame/layout/eacc.lay index eecd0b9dcc0..67fbb9fe778 100644 --- a/src/mame/layout/eacc.lay +++ b/src/mame/layout/eacc.lay @@ -13,7 +13,7 @@ Electronics Australia Car Computer - + diff --git a/src/mame/layout/ecoinf2.lay b/src/mame/layout/ecoinf2.lay index 897824460c5..53b235ec21e 100644 --- a/src/mame/layout/ecoinf2.lay +++ b/src/mame/layout/ecoinf2.lay @@ -44,7 +44,7 @@ license:CC0-1.0 - " + diff --git a/src/mame/layout/ecoinf3.lay b/src/mame/layout/ecoinf3.lay index 897824460c5..53b235ec21e 100644 --- a/src/mame/layout/ecoinf3.lay +++ b/src/mame/layout/ecoinf3.lay @@ -44,7 +44,7 @@ license:CC0-1.0 - " + diff --git a/src/mame/layout/ecoinfr.lay b/src/mame/layout/ecoinfr.lay index 4d7811620f4..061072d41bb 100644 --- a/src/mame/layout/ecoinfr.lay +++ b/src/mame/layout/ecoinfr.lay @@ -28,7 +28,7 @@ license:CC0-1.0 - " + diff --git a/src/mame/layout/enmirage.lay b/src/mame/layout/enmirage.lay index 816dc72e14d..a1466c21fdf 100644 --- a/src/mame/layout/enmirage.lay +++ b/src/mame/layout/enmirage.lay @@ -103,7 +103,7 @@ copyright-holders:tim lindner - 11 + diff --git a/src/mame/layout/fb01.lay b/src/mame/layout/fb01.lay index d9f94cc3454..c6cecf5ae06 100644 --- a/src/mame/layout/fb01.lay +++ b/src/mame/layout/fb01.lay @@ -130,7 +130,7 @@ license:CC0-1.0 - + diff --git a/src/mame/layout/guab.lay b/src/mame/layout/guab.lay index 0c180f80a5c..d6ece6cdb68 100644 --- a/src/mame/layout/guab.lay +++ b/src/mame/layout/guab.lay @@ -89,7 +89,7 @@ license:CC0-1.0 - a + diff --git a/src/mame/layout/hp3478a.lay b/src/mame/layout/hp3478a.lay index 9d7c2263ed1..55057e3341e 100644 --- a/src/mame/layout/hp3478a.lay +++ b/src/mame/layout/hp3478a.lay @@ -28,7 +28,7 @@ loosely based on tranz330.lay - + diff --git a/src/mame/layout/interpro.lay b/src/mame/layout/interpro.lay index fc504c4df5e..0c8ce80e27c 100644 --- a/src/mame/layout/interpro.lay +++ b/src/mame/layout/interpro.lay @@ -10,6 +10,12 @@ TODO - monitor bezels --> + + + + + + @@ -22,12 +28,6 @@ TODO - - - - - - diff --git a/src/mame/layout/m4andybt.lay b/src/mame/layout/m4andybt.lay index f1debc6544c..3bef616c343 100644 --- a/src/mame/layout/m4andybt.lay +++ b/src/mame/layout/m4andybt.lay @@ -355,7 +355,7 @@ - + @@ -535,7 +535,7 @@ - + @@ -1575,7 +1575,7 @@ - + @@ -3151,7 +3151,7 @@ - + @@ -3179,7 +3179,7 @@ - + @@ -3203,7 +3203,7 @@ - + @@ -3223,7 +3223,7 @@ - + @@ -3247,7 +3247,7 @@ - + @@ -3271,7 +3271,7 @@ - + @@ -3315,7 +3315,7 @@ - + @@ -3732,7 +3732,7 @@ - + @@ -3786,7 +3786,7 @@ - + @@ -4074,7 +4074,7 @@ - + diff --git a/src/mame/layout/mdndclab.lay b/src/mame/layout/mdndclab.lay index 8627e852475..6424ee876ae 100644 --- a/src/mame/layout/mdndclab.lay +++ b/src/mame/layout/mdndclab.lay @@ -5,73 +5,6 @@ authors:hap, Carl --> - - - @@ -387,4 +320,71 @@ authors:hap, Carl + + + diff --git a/src/mame/layout/microtouch.lay b/src/mame/layout/microtouch.lay index 6f9f36c8894..893a14c96a1 100644 --- a/src/mame/layout/microtouch.lay +++ b/src/mame/layout/microtouch.lay @@ -17,6 +17,12 @@ license:CC0-1.0 local btn_field = tsdev:ioport('TOUCH'):field(0x01) local x_field = tsdev:ioport('TOUCH_X'):field(0x3fff) local y_field = tsdev:ioport('TOUCH_Y'):field(0x3fff) + local set_field_value = btn_field.set_value + local clear_field_value = btn_field.clear_value + local x_min = x_field.minvalue + local x_max = x_field.maxvalue + local y_min = y_field.minvalue + local y_max = y_field.maxvalue -- for mapping coordinates local view = file.views['Touch-Enabled'] @@ -30,9 +36,9 @@ license:CC0-1.0 local inside = false local function release_touch() - btn_field:clear_value() - x_field:clear_value() - y_field:clear_value() + clear_field_value(btn_field) + clear_field_value(x_field) + clear_field_value(y_field) end local function recomputed() @@ -41,16 +47,28 @@ license:CC0-1.0 r = bounds.x1 t = bounds.y0 b = bounds.y1 - x_scale = 0x3fff / bounds.width - y_scale = 0x3fff / bounds.height + x_scale = (x_max - x_min + 1) / bounds.width + y_scale = (y_max - y_min + 1) / bounds.height end local function check_pointer(x, y) if (x >= l) and (x < r) and (y >= t) and (y < b) then inside = true - btn_field:set_value(1) - x_field:set_value(floor(0.5 + ((x - l) * x_scale))) - y_field:set_value(floor(0.5 + ((y - t) * y_scale))) + local ix = x_min + floor(0.0001 + ((x - l) * x_scale)) + if ix < x_min then + ix = x_min + elseif ix > x_max then + ix = x_max + end + local iy = y_min + floor(0.0001 + ((y - t) * y_scale)) + if iy < y_min then + iy = y_min + elseif iy > y_max then + iy = y_max + end + set_field_value(btn_field, 1) + set_field_value(x_field, ix) + set_field_value(y_field, iy) elseif inside then inside = false release_touch() diff --git a/src/mame/layout/mu128.lay b/src/mame/layout/mu128.lay index 762b6ae6e0c..ee6c4b00f68 100644 --- a/src/mame/layout/mu128.lay +++ b/src/mame/layout/mu128.lay @@ -43,7 +43,7 @@ authors:hap -// mu-plg1-plg2-plg3 + diff --git a/src/mame/layout/pce220.lay b/src/mame/layout/pce220.lay index c044961786b..b9e30eec0b7 100644 --- a/src/mame/layout/pce220.lay +++ b/src/mame/layout/pce220.lay @@ -142,11 +142,11 @@ - + - + diff --git a/src/mame/layout/pntnpuzl.lay b/src/mame/layout/pntnpuzl.lay index b3b0e2c7880..edae6ae356c 100644 --- a/src/mame/layout/pntnpuzl.lay +++ b/src/mame/layout/pntnpuzl.lay @@ -60,10 +60,16 @@ license:CC0-1.0 - @@ -225,4 +186,43 @@ license:CC0-1.0 + + + + From ad925b856420e05f2674318965a2bc4b052ecbf9 Mon Sep 17 00:00:00 2001 From: wilbertpol Date: Mon, 13 May 2024 22:38:27 +0100 Subject: [PATCH 15/16] lib/formats/fs_cbmdos.cpp: Fix display of all directory entries. (#12370) * lib/formats/fs_cbmdos.cpp: Fix display of all directory entries. * Give the magic number a name. --- src/lib/formats/fs_cbmdos.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/formats/fs_cbmdos.cpp b/src/lib/formats/fs_cbmdos.cpp index 51d1369b04f..cbf8ebed553 100644 --- a/src/lib/formats/fs_cbmdos.cpp +++ b/src/lib/formats/fs_cbmdos.cpp @@ -33,6 +33,8 @@ namespace { class impl : public filesystem_t { public: + static constexpr u8 SECTOR_DIRECTORY_COUNT = 8; + struct cbmdos_dirent { u8 m_next_directory_track; @@ -55,7 +57,7 @@ class impl : public filesystem_t { block_iterator(const impl &fs, u8 first_track, u8 first_sector); bool next(); const void *data() const; - const std::array &dirent_data() const; + const std::array &dirent_data() const; u8 size() const; private: @@ -458,9 +460,9 @@ const void *impl::block_iterator::data() const // impl::block_iterator::dirent_data //------------------------------------------------- -const std::array &impl::block_iterator::dirent_data() const +const std::array &impl::block_iterator::dirent_data() const { - return *reinterpret_cast *>(m_block.rodata()); + return *reinterpret_cast *>(m_block.rodata()); } From 7501d0cb09a0604ec160adda2d0533a81a7d68eb Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Mon, 13 May 2024 23:43:59 +0200 Subject: [PATCH 16/16] psr540: Start adding the floppy --- src/devices/cpu/sh/sh_mtu.cpp | 17 +++++++++-------- src/devices/machine/upd765.cpp | 1 - src/mame/yamaha/ympsr540.cpp | 27 +++++++++++++++++++++++++-- src/mame/yamaha/ymqs300.cpp | 2 +- 4 files changed, 35 insertions(+), 12 deletions(-) diff --git a/src/devices/cpu/sh/sh_mtu.cpp b/src/devices/cpu/sh/sh_mtu.cpp index afb453f3e94..2b612bd12b4 100644 --- a/src/devices/cpu/sh/sh_mtu.cpp +++ b/src/devices/cpu/sh/sh_mtu.cpp @@ -317,13 +317,14 @@ u8 sh_mtu_channel_device::tier_r() void sh_mtu_channel_device::tier_w(u8 data) { m_tier = data; - logerror("irq %c%c%c%c%c%c\n", - m_tier & IRQ_A ? 'a' : '.', - m_tier & IRQ_B ? 'b' : '.', - m_tier & IRQ_C ? 'c' : '.', - m_tier & IRQ_D ? 'd' : '.', - m_tier & IRQ_V ? 'v' : '.', - m_tier & IRQ_U ? 'u' : '.'); + if(0) + logerror("irq %c%c%c%c%c%c\n", + m_tier & IRQ_A ? 'a' : '.', + m_tier & IRQ_B ? 'b' : '.', + m_tier & IRQ_C ? 'c' : '.', + m_tier & IRQ_D ? 'd' : '.', + m_tier & IRQ_V ? 'v' : '.', + m_tier & IRQ_U ? 'u' : '.'); recalc_event(); } @@ -343,7 +344,7 @@ u16 sh_mtu_channel_device::tcnt_r() { if(!machine().side_effects_disabled()) update_counter(); - // Nedd to implement phase counting for the rotary controller on the psr540 + // Need to implement phase counting for the rotary controller on the psr540 if(m_tmdr & 0xf) return 0; return m_tcnt; diff --git a/src/devices/machine/upd765.cpp b/src/devices/machine/upd765.cpp index 694a32b0999..210cc9f0f0a 100644 --- a/src/devices/machine/upd765.cpp +++ b/src/devices/machine/upd765.cpp @@ -3431,7 +3431,6 @@ void hd63266f_device::motor_control(int fid, bool start_motor) if(selected_drive != fid) return; - logerror("motor_on_counter %d\n", motor_on_counter); // decrement motor on counter if(motor_on_counter) motor_on_counter--; diff --git a/src/mame/yamaha/ympsr540.cpp b/src/mame/yamaha/ympsr540.cpp index 9bb9b64b413..dcbce07d3ba 100644 --- a/src/mame/yamaha/ympsr540.cpp +++ b/src/mame/yamaha/ympsr540.cpp @@ -6,7 +6,9 @@ #include "bus/midi/midiinport.h" #include "bus/midi/midioutport.h" #include "cpu/sh/sh7042.h" +#include "imagedev/floppy.h" #include "machine/nvram.h" +#include "machine/upd765.h" #include "sound/swx00.h" #include "video/hd44780.h" @@ -21,6 +23,8 @@ class psr540_state : public driver_device { m_maincpu(*this, "maincpu"), m_swx00(*this, "swx00"), m_lcdc(*this, "ks0066"), + m_floppy(*this, "fdc:0"), + m_fdc(*this, "fdc"), m_nvram(*this, "ram"), m_inputs(*this, "B%u", 1U), m_outputs(*this, "%02d.%x.%x", 0U, 0U, 0U), @@ -34,6 +38,8 @@ class psr540_state : public driver_device { required_device m_maincpu; required_device m_swx00; required_device m_lcdc; + required_device m_floppy; + required_device m_fdc; required_device m_nvram; required_ioport_array<8> m_inputs; output_finder<80, 8, 5> m_outputs; @@ -83,6 +89,8 @@ void psr540_state::machine_start() m_pe = 0; m_led = 0; m_scan = 0; + + m_fdc->set_floppy(m_floppy->get_device()); } u16 psr540_state::adc_sustain_r() @@ -100,6 +108,11 @@ u16 psr540_state::adc_battery_r() return 0x3ff; } +static void psr540_floppies(device_slot_interface &device) +{ + device.option_add("35hd", FLOPPY_35_HD); +} + void psr540_state::psr540(machine_config &config) { SH7042A(config, m_maincpu, 7_MHz_XTAL*4); // // md=a, on-chip rom, 32-bit space, pll 4x -- XW25610 6437042F14F 9M1 A @@ -122,6 +135,15 @@ void psr540_state::psr540(machine_config &config) m_lcdc->set_default_bios_tag("f00"); m_lcdc->set_lcd_size(2, 40); + HD63266F(config, m_fdc, 16_MHz_XTAL); + // m_fdc->drq_wr_callback().set([this](int state){ fdc_drq = state; maincpu->set_input_line(Z180_INPUT_LINE_DREQ0, state); }); + m_fdc->set_ready_line_connected(false); + m_fdc->set_select_lines_connected(false); + m_fdc->inp_rd_callback().set([this](){ return m_floppy->get_device()->dskchg_r(); }); + m_fdc->intrq_wr_callback().set_inputline(m_maincpu, 0); + + FLOPPY_CONNECTOR(config, m_floppy, psr540_floppies, "35hd", floppy_image_device::default_pc_floppy_formats, true); + NVRAM(config, m_nvram, nvram_device::DEFAULT_NONE); /* video hardware */ @@ -172,9 +194,10 @@ u8 psr540_state::pf_r() void psr540_state::pe_w(u16 data) { m_pe = data; - logerror("pe lcd_rs=%x lcd_en=%x ldcic=%d fdcic=%d (%s)\n", BIT(m_pe, 11), BIT(m_pe, 9), BIT(m_pe, 4), BIT(m_pe, 3), machine().describe_context()); + // logerror("pe lcd_rs=%x lcd_en=%x rdens=%d ldcic=%d fdcic=%d (%s)\n", BIT(m_pe, 11), BIT(m_pe, 9), BIT(m_pe, 8), BIT(m_pe, 4), BIT(m_pe, 3), machine().describe_context()); m_lcdc->rs_w(BIT(m_pe, 11)); m_lcdc->e_w(BIT(m_pe, 9)); + m_fdc->rate_w(!BIT(m_pe, 8)); if(BIT(m_pe, 4)) m_scan = m_led & 7; @@ -198,7 +221,7 @@ void psr540_state::map(address_map &map) // 200000-3fffff: cs0 space, 8bits, 1 cycle between accesses, cs assert extension, 6 wait states // 200000 fdc - map(0x00200000, 0x00200000).lr8(NAME([]() -> u8 { return 0x80; })); + map(0x00200000, 0x00200003).m(m_fdc, FUNC(hd63266f_device::map)); // 280000 sram (battery-backed) map(0x00280000, 0x0029ffff).ram().share("ram"); // 2c0000 leds/scanning diff --git a/src/mame/yamaha/ymqs300.cpp b/src/mame/yamaha/ymqs300.cpp index 80e19529a39..b0fdc4168b4 100644 --- a/src/mame/yamaha/ymqs300.cpp +++ b/src/mame/yamaha/ymqs300.cpp @@ -196,7 +196,7 @@ void qs300_state::qs300(machine_config &config) m_subcpu->read_adc<0>().set_constant(0); // Aftertouch m_subcpu->read_adc<1>().set_constant(0); // Pitch bend m_subcpu->read_adc<2>().set_constant(0); // Modulation wheel - m_subcpu->read_adc<3>().set_constant(0x3ff); // CC ? Wired to +5V + m_subcpu->read_adc<3>().set_constant(0x3ff); // Generic continuous controller, wired to +5V m_subcpu->read_adc<4>().set_constant(0); // Foot control m_subcpu->read_adc<5>().set_constant(0); // Foot volume m_subcpu->read_adc<6>().set_constant(0x3ff); // Unconnected