From 11481828949f9c779bc865c7171bb5f03ea23bc9 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Wed, 25 Jul 2018 08:03:45 +0200 Subject: funworld.cpp, mame.lst: corrected pool10j year in the comments, too (nw) --- src/mame/drivers/funworld.cpp | 2 +- src/mame/mame.lst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mame/drivers/funworld.cpp b/src/mame/drivers/funworld.cpp index efb12ddad11..1d7a3540415 100644 --- a/src/mame/drivers/funworld.cpp +++ b/src/mame/drivers/funworld.cpp @@ -48,7 +48,7 @@ * Pool 10 (Italian, set 6), C.M.C., 1996. * Pool 10 (Italian, set 7), C.M.C., 1997. * Pool 10 (Italian, set 8), C.M.C., 1997. - * Pool 10 (Italian, set 9), C.M.C., 1997. + * Pool 10 (Italian, set 9), bootleg (R.B.), 1996. * Pool 10 (Italian, Dino 4 hardware, encrypted), C.M.C., 1997. * Royal (Pool 10 hack), unknown, 2001. * Tortuga Family (Italian), C.M.C., 1997. diff --git a/src/mame/mame.lst b/src/mame/mame.lst index a8919f9ec85..ba652a2d2bb 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -13054,7 +13054,7 @@ pool10f // (c) 1997 C.M.C. pool10g // (c) 1996 C.M.C. pool10h // (c) 1996 C.M.C. pool10i // (c) 1997 C.M.C. -pool10j // (c) 1997 C.M.C. +pool10j // (c) 1996 bootleg potgame // (c) 1996 C.M.C. powercrd // (c) 1993 Fun World rcdino4 // 1998 unknown -- cgit v1.2.3 From d7ed066ad5a9f48dca45ed82bbfd895f6258c405 Mon Sep 17 00:00:00 2001 From: Robbbert Date: Thu, 26 Jul 2018 01:23:49 +1000 Subject: (nw) micro20 : set default baud so screen is readable --- src/mame/drivers/micro20.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mame/drivers/micro20.cpp b/src/mame/drivers/micro20.cpp index 1f0a56f679a..05b11e2b6a0 100644 --- a/src/mame/drivers/micro20.cpp +++ b/src/mame/drivers/micro20.cpp @@ -156,6 +156,15 @@ void micro20_state::micro20_map(address_map &map) map(0xffff80c0, 0xffff80df).rw(m_pit, FUNC(pit68230_device::read), FUNC(pit68230_device::write)); } +static DEVICE_INPUT_DEFAULTS_START( terminal ) + DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_19200 ) + DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_19200 ) + DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) + DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_7 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) +DEVICE_INPUT_DEFAULTS_END + MACHINE_CONFIG_START(micro20_state::micro20) /* basic machine hardware */ MCFG_DEVICE_ADD(MAINCPU_TAG, M68020, 16.67_MHz_XTAL) @@ -166,6 +175,7 @@ MACHINE_CONFIG_START(micro20_state::micro20) MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, "terminal") MCFG_RS232_RXD_HANDLER(WRITELINE(DUART_A_TAG, mc68681_device, rx_a_w)) + MCFG_SLOT_OPTION_DEVICE_INPUT_DEFAULTS("terminal", terminal) MCFG_DEVICE_ADD(DUART_B_TAG, MC68681, 3.6864_MHz_XTAL) -- cgit v1.2.3 From d32e26b33583748f04bf06126ed845a981523837 Mon Sep 17 00:00:00 2001 From: smf- Date: Wed, 25 Jul 2018 14:04:32 +0100 Subject: Machines promoted to working ---------------------------- Psychic Force EX [Ekorz] --- src/mame/drivers/zn.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mame/drivers/zn.cpp b/src/mame/drivers/zn.cpp index bb7e3f395c1..49a9b94bcd0 100644 --- a/src/mame/drivers/zn.cpp +++ b/src/mame/drivers/zn.cpp @@ -4686,7 +4686,7 @@ ROM_START( psyforcex ) TAITOFX1_BIOS ROM_REGION32_LE( 0x01000000, "bankedroms", 0 ) - ROM_LOAD16_BYTE( "e22-11.2", 0x0000001, 0x080000, CRC(a263b41f) SHA1(a797f1eb74a7ba7aeefabd9f5d55e6eec2df46e2) ) + ROM_LOAD16_BYTE( "e22-11.2", 0x0000001, 0x080000, CRC(29ebebc9) SHA1(48a3371460d69ae5ba58d3e24615f389bf43b2cc) ) ROM_LOAD16_BYTE( "e22-12.7", 0x0000000, 0x080000, CRC(7426ffc5) SHA1(24b0132241e2e49109e585b082bf4ab67f86b294) ) ROM_LOAD( "e22-02.16", 0x0800000, 0x200000, CRC(03b50064) SHA1(0259537e86b266b3f34308c4fc0bcc04c037da71) ) ROM_LOAD( "e22-03.19", 0x0a00000, 0x200000, CRC(8372f839) SHA1(646b3919b6be63412c11850ec1524685abececc0) ) @@ -5437,7 +5437,7 @@ GAME( 1995, sfchampu, sfchamp, coh1000ta, znt, zn_state, empty_init, RO GAME( 1995, sfchampj, sfchamp, coh1000ta, znt, zn_state, empty_init, ROT0, "Taito", "Super Football Champ (Ver 2.4J)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) GAME( 1995, psyforce, coh1000t, coh1000ta, znt, zn_state, empty_init, ROT0, "Taito", "Psychic Force (Ver 2.4O)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) GAME( 1995, psyforcej, psyforce, coh1000ta, znt, zn_state, empty_init, ROT0, "Taito", "Psychic Force (Ver 2.4J)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -GAME( 1995, psyforcex, psyforce, coh1000ta, znt, zn_state, empty_init, ROT0, "Taito", "Psychic Force EX (Ver 2.0J)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND | MACHINE_NOT_WORKING ) // exception in attract after reading 0xbbbbbbbb from 0x8025ed18 leads to watchdog reset +GAME( 1995, psyforcex, psyforce, coh1000ta, znt, zn_state, empty_init, ROT0, "Taito", "Psychic Force EX (Ver 2.0J)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) GAME( 1996, mgcldate, mgcldtex, coh1000ta, znt, zn_state, empty_init, ROT0, "Taito", "Magical Date / Magical Date - dokidoki kokuhaku daisakusen (Ver 2.02J)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) GAME( 1997, mgcldtex, coh1000t, coh1000ta, znt, zn_state, empty_init, ROT0, "Taito", "Magical Date EX / Magical Date - sotsugyou kokuhaku daisakusen (Ver 2.01J)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) -- cgit v1.2.3 From c59210497359a288bbbe5a522121ef2ee5c7497c Mon Sep 17 00:00:00 2001 From: smf- Date: Wed, 25 Jul 2018 16:20:54 +0100 Subject: make it quik (nw) --- src/mame/drivers/vgmplay.cpp | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/mame/drivers/vgmplay.cpp b/src/mame/drivers/vgmplay.cpp index 0c346573764..e6926b13856 100644 --- a/src/mame/drivers/vgmplay.cpp +++ b/src/mame/drivers/vgmplay.cpp @@ -2,13 +2,13 @@ // copyright-holders: Olivier Galibert // A "virtual" driver to play vgm files -// Use with mame vgmplay -bitb file.vgm +// Use with mame vgmplay -quik file.vgm #include "emu.h" #define QSOUND_LLE -#include "imagedev/bitbngr.h" +#include "imagedev/snapquik.h" #include "cpu/h6280/h6280.h" #include "cpu/m6502/n2a03.h" @@ -274,7 +274,7 @@ class vgmplay_state : public driver_device public: vgmplay_state(const machine_config &mconfig, device_type type, const char *tag); - virtual void machine_start() override; + DECLARE_QUICKLOAD_LOAD_MEMBER(load_file); DECLARE_READ8_MEMBER(file_r); DECLARE_READ8_MEMBER(file_size_r); @@ -310,7 +310,6 @@ public: private: std::vector m_file_data; - required_device m_file; required_device m_vgmplay; required_device m_lspeaker; required_device m_rspeaker; @@ -1370,7 +1369,6 @@ READ8_MEMBER(vgmplay_device::ga20_rom_r) vgmplay_state::vgmplay_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) - , m_file(*this, "file") , m_vgmplay(*this, "vgmplay") , m_lspeaker(*this, "lspeaker") , m_rspeaker(*this, "rspeaker") @@ -1422,19 +1420,22 @@ uint8_t vgmplay_state::r8(int off) const return 0; } -void vgmplay_state::machine_start() +QUICKLOAD_LOAD_MEMBER(vgmplay_state, load_file) { // Disable executing devices if not required m_pokey[0]->set_unscaled_clock(0); m_pokey[1]->set_unscaled_clock(0); m_qsound->set_unscaled_clock(0); - uint32_t size = 0; - if(m_file->exists() && m_file->length() > 0) { - size = m_file->length(); - m_file_data.resize(size); - m_file->input(&m_file_data[0], size); + m_file_data.resize(quickload_size); + if (image.fread(&m_file_data[0], quickload_size) != quickload_size) + { + m_file_data.clear(); + return image_init_result::FAIL; + } + else + { // Decompress gzip-compressed files (aka vgz) if(m_file_data[0] == 0x1f && m_file_data[1] == 0x8b) { std::vector decomp; @@ -1453,7 +1454,7 @@ void vgmplay_state::machine_start() if(err != Z_OK) { logerror("gzip header but not a gzip file\n"); m_file_data.clear(); - return; + return image_init_result::FAIL; } do { if(str.total_out >= decomp.size()) @@ -1465,7 +1466,7 @@ void vgmplay_state::machine_start() if(err != Z_STREAM_END) { logerror("broken gzip file\n"); m_file_data.clear(); - return; + return image_init_result::FAIL; } m_file_data.resize(str.total_out); memcpy(&m_file_data[0], &decomp[0], str.total_out); @@ -1474,7 +1475,7 @@ void vgmplay_state::machine_start() if(m_file_data.size() < 0x40 || r32(0) != 0x206d6756) { logerror("Not a vgm/vgz file\n"); m_file_data.clear(); - return; + return image_init_result::FAIL; } uint32_t version = r32(8); @@ -1675,6 +1676,8 @@ void vgmplay_state::machine_start() m_ga20->set_unscaled_clock(r32(0xe0)); } } + + return image_init_result::PASS; } } @@ -1994,8 +1997,8 @@ MACHINE_CONFIG_START(vgmplay_state::vgmplay) MCFG_DEVICE_IO_MAP( soundchips_map ) MCFG_CPU_IO16_MAP( soundchips16_map ) - MCFG_DEVICE_ADD("file", BITBANGER, 0) - MCFG_BITBANGER_READONLY(true) + MCFG_QUICKLOAD_ADD("quickload", vgmplay_state, load_file, "vgm,vgz", 0) + config.set_default_layout(layout_vgmplay); SPEAKER(config, "lspeaker").front_left(); -- cgit v1.2.3 From 9604dc159aaba9f8944bb6f33aacc8ea35a4ed08 Mon Sep 17 00:00:00 2001 From: smf- Date: Wed, 25 Jul 2018 17:15:34 +0100 Subject: reset after load, so you can choose another song (nw) --- src/mame/drivers/vgmplay.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mame/drivers/vgmplay.cpp b/src/mame/drivers/vgmplay.cpp index e6926b13856..a8a22367f48 100644 --- a/src/mame/drivers/vgmplay.cpp +++ b/src/mame/drivers/vgmplay.cpp @@ -1677,6 +1677,8 @@ QUICKLOAD_LOAD_MEMBER(vgmplay_state, load_file) } } + m_vgmplay->reset(); + return image_init_result::PASS; } } -- cgit v1.2.3 From dc40dde09822372d029ede5c0d4a71c075e83e9a Mon Sep 17 00:00:00 2001 From: smf- Date: Wed, 25 Jul 2018 18:45:58 +0100 Subject: vgmplay: Added software list support [smf] --- hash/vgmplay.xml | 57 ++++++++++++++++++++++++++++++++++++++++++++ src/mame/drivers/vgmplay.cpp | 3 +++ 2 files changed, 60 insertions(+) create mode 100644 hash/vgmplay.xml diff --git a/hash/vgmplay.xml b/hash/vgmplay.xml new file mode 100644 index 00000000000..bb80f3859e3 --- /dev/null +++ b/hash/vgmplay.xml @@ -0,0 +1,57 @@ + + + + + + + Power Drift (Sega Y) + 1988 + Sega + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mame/drivers/vgmplay.cpp b/src/mame/drivers/vgmplay.cpp index a8a22367f48..b14aa544963 100644 --- a/src/mame/drivers/vgmplay.cpp +++ b/src/mame/drivers/vgmplay.cpp @@ -2000,6 +2000,9 @@ MACHINE_CONFIG_START(vgmplay_state::vgmplay) MCFG_CPU_IO16_MAP( soundchips16_map ) MCFG_QUICKLOAD_ADD("quickload", vgmplay_state, load_file, "vgm,vgz", 0) + MCFG_QUICKLOAD_INTERFACE("vgm_quik") + + MCFG_SOFTWARE_LIST_ADD("vgm_list", "vgmplay") config.set_default_layout(layout_vgmplay); -- cgit v1.2.3 From 0e73479668ec2d28a970422f1f97fa1644a00af2 Mon Sep 17 00:00:00 2001 From: smf- Date: Wed, 25 Jul 2018 19:32:55 +0100 Subject: vgm improvements (nw) --- hash/vgmplay.xml | 27 ++++++++++++++++++--------- src/mame/drivers/vgmplay.cpp | 1 - 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/hash/vgmplay.xml b/hash/vgmplay.xml index bb80f3859e3..96ad04bc657 100644 --- a/hash/vgmplay.xml +++ b/hash/vgmplay.xml @@ -8,47 +8,56 @@ 1988 Sega - + + - + + - + + - + + - + + - + + - + + - + + - + + diff --git a/src/mame/drivers/vgmplay.cpp b/src/mame/drivers/vgmplay.cpp index b14aa544963..0ddedb3ffe7 100644 --- a/src/mame/drivers/vgmplay.cpp +++ b/src/mame/drivers/vgmplay.cpp @@ -387,7 +387,6 @@ void vgmplay_device::device_reset() m_pc = 0; m_state = RESET; m_paused = false; - m_loop = true; m_ym2612_stream_offset = 0; blocks_clear(); -- cgit v1.2.3 From 61f5bc288570e274de3145b4d06458382ef2b871 Mon Sep 17 00:00:00 2001 From: smf- Date: Wed, 25 Jul 2018 19:37:37 +0100 Subject: fix feature part_id (nw) --- hash/pc88va.xml | 46 +++++++++++++++++++++++----------------------- hash/x68k_flop.xml | 12 ++++++------ 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/hash/pc88va.xml b/hash/pc88va.xml index bbcc275fbee..9cff43990b9 100644 --- a/hash/pc88va.xml +++ b/hash/pc88va.xml @@ -112,14 +112,14 @@ PC88VA doujin games (mostly undumped) <unknown> - + - + @@ -132,14 +132,14 @@ PC88VA doujin games (mostly undumped) 19?? <unknown> - + - + @@ -190,21 +190,21 @@ PC88VA doujin games (mostly undumped) ゲームアーツ (Game Arts) - + - + - + @@ -220,14 +220,14 @@ PC88VA doujin games (mostly undumped) - + - + @@ -239,21 +239,21 @@ PC88VA doujin games (mostly undumped) 19?? ゲームアーツ (Game Arts) - + - + - + @@ -475,35 +475,35 @@ PC88VA doujin games (mostly undumped) - + - + - + - + - + @@ -1015,42 +1015,42 @@ PC88VA doujin games (mostly undumped) - + - + - + - + - + - + diff --git a/hash/x68k_flop.xml b/hash/x68k_flop.xml index a1987101a12..f3d9b1ff41d 100644 --- a/hash/x68k_flop.xml +++ b/hash/x68k_flop.xml @@ -15636,42 +15636,42 @@ maybe the remaining disks are the supposedly undumped addons: Daikairei Powerup - + - + - + - + - + - + -- cgit v1.2.3 From 97f9d7eb26fef1a4dfb9fc88dead51110518f45b Mon Sep 17 00:00:00 2001 From: smf- Date: Wed, 25 Jul 2018 19:40:15 +0100 Subject: remove BOM (nw) --- hash/vgmplay.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hash/vgmplay.xml b/hash/vgmplay.xml index 96ad04bc657..220e87cd351 100644 --- a/hash/vgmplay.xml +++ b/hash/vgmplay.xml @@ -1,4 +1,4 @@ - + -- cgit v1.2.3 From cdee90b1a37e98bf8ca11d9971994df4b4fe1441 Mon Sep 17 00:00:00 2001 From: AJR Date: Wed, 25 Jul 2018 16:08:22 -0400 Subject: osbexec: Remove spurious line inversion that broke the selftest --- src/mame/drivers/osbexec.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/mame/drivers/osbexec.cpp b/src/mame/drivers/osbexec.cpp index 6cd100a9f19..9b19456acf1 100644 --- a/src/mame/drivers/osbexec.cpp +++ b/src/mame/drivers/osbexec.cpp @@ -602,12 +602,12 @@ MACHINE_CONFIG_START(osbexec_state::osbexec) INPUT_MERGER_ANY_HIGH(config, "mainirq").output_handler().set_inputline(m_maincpu, 0); Z80SIO(config, m_sio, MAIN_CLOCK/6); - m_sio->out_txda_callback().set(MODEM_PORT_TAG, FUNC(rs232_port_device::write_txd)).invert(); - m_sio->out_dtra_callback().set(MODEM_PORT_TAG, FUNC(rs232_port_device::write_dtr)).invert(); - m_sio->out_rtsa_callback().set(MODEM_PORT_TAG, FUNC(rs232_port_device::write_rts)).invert(); - m_sio->out_txdb_callback().set(PRINTER_PORT_TAG, FUNC(rs232_port_device::write_txd)).invert(); - m_sio->out_dtrb_callback().set(PRINTER_PORT_TAG, FUNC(rs232_port_device::write_dtr)).invert(); - m_sio->out_rtsb_callback().set(PRINTER_PORT_TAG, FUNC(rs232_port_device::write_rts)).invert(); + m_sio->out_txda_callback().set(MODEM_PORT_TAG, FUNC(rs232_port_device::write_txd)); + m_sio->out_dtra_callback().set(MODEM_PORT_TAG, FUNC(rs232_port_device::write_dtr)); + m_sio->out_rtsa_callback().set(MODEM_PORT_TAG, FUNC(rs232_port_device::write_rts)); + m_sio->out_txdb_callback().set(PRINTER_PORT_TAG, FUNC(rs232_port_device::write_txd)); + m_sio->out_dtrb_callback().set(PRINTER_PORT_TAG, FUNC(rs232_port_device::write_dtr)); + m_sio->out_rtsb_callback().set(PRINTER_PORT_TAG, FUNC(rs232_port_device::write_rts)); m_sio->out_int_callback().set("mainirq", FUNC(input_merger_device::in_w<4>)); MCFG_DEVICE_ADD("ctc", PIT8253, 0) @@ -619,16 +619,16 @@ MACHINE_CONFIG_START(osbexec_state::osbexec) //MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, osbexec_state, spindle_clk_w)) rs232_port_device &modem_port(RS232_PORT(config, MODEM_PORT_TAG, default_rs232_devices, nullptr)); - modem_port.rxd_handler().set(m_sio, FUNC(z80sio_device::rxa_w)).invert(); - modem_port.dcd_handler().set(m_sio, FUNC(z80sio_device::dcda_w)).invert(); + modem_port.rxd_handler().set(m_sio, FUNC(z80sio_device::rxa_w)); + modem_port.dcd_handler().set(m_sio, FUNC(z80sio_device::dcda_w)); modem_port.dsr_handler().set(FUNC(osbexec_state::modem_dsr_w)); modem_port.ri_handler().set(FUNC(osbexec_state::modem_ri_w)); - modem_port.cts_handler().set(m_sio, FUNC(z80sio_device::ctsa_w)).invert(); + modem_port.cts_handler().set(m_sio, FUNC(z80sio_device::ctsa_w)); rs232_port_device &printer_port(RS232_PORT(config, PRINTER_PORT_TAG, default_rs232_devices, nullptr)); - printer_port.rxd_handler().set(m_sio, FUNC(z80sio_device::rxb_w)).invert(); - printer_port.dcd_handler().set(m_sio, FUNC(z80sio_device::dcdb_w)).invert(); - printer_port.cts_handler().set(m_sio, FUNC(z80sio_device::ctsb_w)).invert(); + printer_port.rxd_handler().set(m_sio, FUNC(z80sio_device::rxb_w)); + printer_port.dcd_handler().set(m_sio, FUNC(z80sio_device::dcdb_w)); + printer_port.cts_handler().set(m_sio, FUNC(z80sio_device::ctsb_w)); MCFG_DEVICE_ADD("mb8877", MB8877, MAIN_CLOCK/24) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(m_pia_1, pia6821_device, cb1_w)) -- cgit v1.2.3 From f3537b3b307cc6aae3ea62133420f636cce3fcf4 Mon Sep 17 00:00:00 2001 From: David Haywood Date: Thu, 26 Jul 2018 01:58:31 +0100 Subject: tlcs870 updates (#3787) * tlcs870 updates * basic devcb3 stuff to make a start on the ports (nw) --- src/devices/cpu/tlcs870/tlcs870.cpp | 177 ++++++++- src/devices/cpu/tlcs870/tlcs870.h | 71 +++- src/devices/cpu/tlcs870/tlcs870_ops.cpp | 480 ++++++++++++++++++----- src/devices/cpu/tlcs870/tlcs870_ops_dst.cpp | 124 +++--- src/devices/cpu/tlcs870/tlcs870_ops_reg.cpp | 365 +++++++++++++----- src/devices/cpu/tlcs870/tlcs870_ops_src.cpp | 575 +++++++++++++++++++++++++--- src/mame/drivers/hng64.cpp | 37 +- src/mame/includes/hng64.h | 20 + 8 files changed, 1535 insertions(+), 314 deletions(-) diff --git a/src/devices/cpu/tlcs870/tlcs870.cpp b/src/devices/cpu/tlcs870/tlcs870.cpp index e893cf69e0b..db201179719 100644 --- a/src/devices/cpu/tlcs870/tlcs870.cpp +++ b/src/devices/cpu/tlcs870/tlcs870.cpp @@ -22,7 +22,6 @@ DEFINE_DEVICE_TYPE(TMP87PH40AN, tmp87ph40an_device, "tmp87ph40an", "Toshiba TMP8 void tlcs870_device::tmp87ph40an_mem(address_map &map) { -#if 0 map(0x0000, 0x0000).rw(FUNC(tlcs870_device::port0_r), FUNC(tlcs870_device::port0_w)); map(0x0001, 0x0001).rw(FUNC(tlcs870_device::port1_r), FUNC(tlcs870_device::port1_w)); map(0x0002, 0x0002).rw(FUNC(tlcs870_device::port2_r), FUNC(tlcs870_device::port2_w)); @@ -37,6 +36,7 @@ void tlcs870_device::tmp87ph40an_mem(address_map &map) map(0x000b, 0x000b).w(FUNC(tlcs870_device::p1cr_w)); // Port 1 I/O control map(0x000c, 0x000c).w(FUNC(tlcs870_device::p6cr_w)); // Port 6 I/O control map(0x000d, 0x000d).w(FUNC(tlcs870_device::p7cr_w)); // Port 7 I/O control +#if 0 map(0x000e, 0x000e).rw(FUNC(tlcs870_device::adccr_r), FUNC(tlcs870_device::adccr_w)); // A/D converter control map(0x000f, 0x000f).r(FUNC(tlcs870_device::adcdr_r)); // A/D converter result @@ -107,6 +107,8 @@ tlcs870_device::tlcs870_device(const machine_config &mconfig, device_type optype , m_program_config("program", ENDIANNESS_LITTLE, 8, 16, 0, program_map) , m_io_config("io", ENDIANNESS_LITTLE, 8, 16, 0) , m_intram(*this, "intram") + , m_port_in_cb{{*this}, {*this}, {*this}, {*this}, {*this}, {*this}, {*this}, {*this}} + , m_port_out_cb{{*this}, {*this}, {*this}, {*this}, {*this}, {*this}, {*this}, {*this}} { } @@ -129,6 +131,147 @@ bool tlcs870_device::stream_arg(std::ostream &stream, uint32_t pc, const char *p return false; } +// NOT using templates here because there are subtle differences in the port behavior (the ports are multi-purpose) that still need implementing +READ8_MEMBER(tlcs870_device::port0_r) +{ + // need to use P0CR (0x000a) to control direction + + if (m_read_input_port) + return m_port_in_cb[0](); + else + return m_port_out_latch[0]; +} + +READ8_MEMBER(tlcs870_device::port1_r) +{ + // need to use P1CR (0x000b) to control direction + + if (m_read_input_port) + return m_port_in_cb[1](); + else + return m_port_out_latch[1]; +} + +READ8_MEMBER(tlcs870_device::port2_r) // 3-bit port +{ + if (m_read_input_port) + return m_port_in_cb[2]() | 0xf8; + else + return m_port_out_latch[2]; +} + +READ8_MEMBER(tlcs870_device::port3_r) +{ + if (m_read_input_port) + return m_port_in_cb[3](); + else + return m_port_out_latch[3]; +} + +READ8_MEMBER(tlcs870_device::port4_r) +{ + if (m_read_input_port) + return m_port_in_cb[4](); + else + return m_port_out_latch[4]; +} + +READ8_MEMBER(tlcs870_device::port5_r) // 5-bit port +{ + if (m_read_input_port) + return m_port_in_cb[5]() | 0xe0; + else + return m_port_out_latch[5]; +} + +READ8_MEMBER(tlcs870_device::port6_r) // doubles up as analog? +{ + // need to use P6CR (0x000c) to control direction + + if (m_read_input_port) + return m_port_in_cb[6](); + else + return m_port_out_latch[6]; +} + +READ8_MEMBER(tlcs870_device::port7_r) +{ + // need to use P7CR (0x000d) to control direction + + if (m_read_input_port) + return m_port_in_cb[7](); + else + return m_port_out_latch[7]; +} + +WRITE8_MEMBER(tlcs870_device::port0_w) +{ + m_port_out_latch[0] = data; + m_port_out_cb[0](data); +} + +WRITE8_MEMBER(tlcs870_device::port1_w) +{ + m_port_out_latch[1] = data; + m_port_out_cb[1](data); +} + +WRITE8_MEMBER(tlcs870_device::port2_w) +{ + m_port_out_latch[2] = data; + m_port_out_cb[2](data); +} + +WRITE8_MEMBER(tlcs870_device::port3_w) +{ + m_port_out_latch[3] = data; + m_port_out_cb[3](data); +} + +WRITE8_MEMBER(tlcs870_device::port4_w) +{ + m_port_out_latch[4] = data; + m_port_out_cb[4](data); +} + +WRITE8_MEMBER(tlcs870_device::port5_w) +{ + m_port_out_latch[5] = data; + m_port_out_cb[5](data); +} + +WRITE8_MEMBER(tlcs870_device::port6_w) +{ + m_port_out_latch[6] = data; + m_port_out_cb[6](data); +} + +WRITE8_MEMBER(tlcs870_device::port7_w) +{ + m_port_out_latch[7] = data; + m_port_out_cb[7](data); +} + +WRITE8_MEMBER(tlcs870_device::p0cr_w) +{ + m_port0_cr = data; +} + +WRITE8_MEMBER(tlcs870_device::p1cr_w) +{ + m_port1_cr = data; +} + +WRITE8_MEMBER(tlcs870_device::p6cr_w) +{ + m_port6_cr = data; +} + +WRITE8_MEMBER(tlcs870_device::p7cr_w) +{ + m_port7_cr = data; +} + void tlcs870_device::execute_set_input(int inputnum, int state) { #if 0 @@ -151,7 +294,7 @@ void tlcs870_device::execute_set_input(int inputnum, int state) void tlcs870_device::execute_run() { - m_cycles = 1; + while (m_icount > 0) { @@ -161,10 +304,19 @@ void tlcs870_device::execute_run() //check_interrupts(); m_addr = m_pc.d; m_tmppc = m_addr; // used for jumps etc. + m_cycles = 0; + m_read_input_port = 1; // some operations force the output latches to read from the memory mapped ports, not input ports decode(); m_pc.d = m_addr; - m_icount -= m_cycles * 4; // 1 machine cycle = 4 clock cycles? + if (m_cycles) + { + m_icount -= m_cycles * 4; // 1 machine cycle = 4 clock cycles? + } + else + { + fatalerror("m_cycles == 0 after PC %04x\n", m_tmppc); + } }; } @@ -172,6 +324,20 @@ void tlcs870_device::device_reset() { m_pc.d = RM16(0xfffe); m_RBS = 0; + + m_port_out_latch[0] = 0x00; + m_port_out_latch[1] = 0x00; + m_port_out_latch[2] = 0xff; + m_port_out_latch[3] = 0xff; + m_port_out_latch[4] = 0xff; + m_port_out_latch[5] = 0xff; + m_port_out_latch[6] = 0x00; + m_port_out_latch[7] = 0x00; + + m_port0_cr = 0xff; + m_port1_cr = 0xff; + m_port6_cr = 0xff; + m_port7_cr = 0xff; } void tlcs870_device::state_import(const device_state_entry &entry) @@ -315,6 +481,11 @@ void tlcs870_device::device_start() state_add(STATE_GENFLAGS, "GENFLAGS", m_F).formatstr("%8s").noshow(); set_icountptr(m_icount); + + for (auto &cb : m_port_in_cb) + cb.resolve_safe(0xff); + for (auto &cb : m_port_out_cb) + cb.resolve_safe(); } diff --git a/src/devices/cpu/tlcs870/tlcs870.h b/src/devices/cpu/tlcs870/tlcs870.h index 8b3c9d83bd3..7b8c8c256be 100644 --- a/src/devices/cpu/tlcs870/tlcs870.h +++ b/src/devices/cpu/tlcs870/tlcs870.h @@ -7,6 +7,25 @@ class tlcs870_device : public cpu_device { +public: + auto p0_in_cb() { return m_port_in_cb[0].bind(); } + auto p1_in_cb() { return m_port_in_cb[1].bind(); } + auto p2_in_cb() { return m_port_in_cb[2].bind(); } + auto p3_in_cb() { return m_port_in_cb[3].bind(); } + auto p4_in_cb() { return m_port_in_cb[4].bind(); } + auto p5_in_cb() { return m_port_in_cb[5].bind(); } + auto p6_in_cb() { return m_port_in_cb[6].bind(); } + auto p7_in_cb() { return m_port_in_cb[7].bind(); } + + auto p0_out_cb() { return m_port_out_cb[0].bind(); } + auto p1_out_cb() { return m_port_out_cb[1].bind(); } + auto p2_out_cb() { return m_port_out_cb[2].bind(); } + auto p3_out_cb() { return m_port_out_cb[3].bind(); } + auto p4_out_cb() { return m_port_out_cb[4].bind(); } + auto p5_out_cb() { return m_port_out_cb[5].bind(); } + auto p6_out_cb() { return m_port_out_cb[6].bind(); } + auto p7_out_cb() { return m_port_out_cb[7].bind(); } + protected: // construction/destruction tlcs870_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, address_map_constructor program_map); @@ -110,6 +129,35 @@ private: address_space *m_io; int m_icount; + devcb_read8 m_port_in_cb[8]; + devcb_write8 m_port_out_cb[8]; + uint8_t m_port_out_latch[8]; + int m_read_input_port; + uint8_t m_port0_cr, m_port1_cr, m_port6_cr, m_port7_cr; + + DECLARE_READ8_MEMBER(port0_r); + DECLARE_READ8_MEMBER(port1_r); + DECLARE_READ8_MEMBER(port2_r); + DECLARE_READ8_MEMBER(port3_r); + DECLARE_READ8_MEMBER(port4_r); + DECLARE_READ8_MEMBER(port5_r); + DECLARE_READ8_MEMBER(port6_r); + DECLARE_READ8_MEMBER(port7_r); + + DECLARE_WRITE8_MEMBER(port0_w); + DECLARE_WRITE8_MEMBER(port1_w); + DECLARE_WRITE8_MEMBER(port2_w); + DECLARE_WRITE8_MEMBER(port3_w); + DECLARE_WRITE8_MEMBER(port4_w); + DECLARE_WRITE8_MEMBER(port5_w); + DECLARE_WRITE8_MEMBER(port6_w); + DECLARE_WRITE8_MEMBER(port7_w); + + DECLARE_WRITE8_MEMBER(p0cr_w); + DECLARE_WRITE8_MEMBER(p1cr_w); + DECLARE_WRITE8_MEMBER(p6cr_w); + DECLARE_WRITE8_MEMBER(p7cr_w); + // Work registers uint8_t m_cycles; uint16_t m_tmppc; @@ -162,6 +210,8 @@ private: int is_CF() const { return ((m_F & FLAG_C) ? 1 : 0); } int is_HF() const { return ((m_F & FLAG_H) ? 1 : 0); } + int get_base_srcdst_cycles(int i) const { const int SRC_DST_CYCLES[8] = { 1, 2, 0, 0, 2, 2, 1, 1 }; return SRC_DST_CYCLES[i]; } + bool stream_arg(std::ostream &stream, uint32_t pc, const char *pre, const uint16_t mode, const uint16_t r, const uint16_t rb); // tlcs870_ops.cpp @@ -232,12 +282,7 @@ private: // tlcs870_ops_src.cpp - void do_e0_opcode(const uint8_t opbyte0); - void do_e1_to_e3_opcode(const uint8_t opbyte0); - void do_e4_opcode(const uint8_t opbyte0); - void do_e5_to_e7_opcode(const uint8_t opbyte0); - - void do_e0_to_e7_opcode(uint8_t opbyte0, uint16_t srcaddr); + void do_srcprefixtype_opcode(const uint8_t opbyte0); void do_e0_to_e7_oprand_illegal(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr); @@ -266,13 +311,7 @@ private: uint16_t do_alu(int op, uint16_t param1, uint16_t param2); // tlcs870_ops_dst.cpp - - void do_f0_opcode(const uint8_t opbyte0); - void do_f2_to_f3_opcode(const uint8_t opbyte0); - void do_f4_opcode(const uint8_t opbyte0); - void do_f6_to_f7_opcode(const uint8_t opbyte0); - - void do_f0_to_f7_opcode(const uint8_t opbyte0, const uint16_t dstaddr); + void do_dstprefixtype_opcode(const uint8_t opbyte0); void do_f0_to_f7_oprand_illegal_opcode(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t dstaddr); @@ -310,9 +349,9 @@ private: void do_ALUOP_g_n(const uint8_t opbyte0, const uint8_t opbyte1); void do_SET_inppbit(const uint8_t opbyte0, const uint8_t opbyte1); void do_CLR_inppbit(const uint8_t opbyte0, const uint8_t opbyte1); - void do_CPL_inppbit(const uint8_t opbyte0, const uint8_t opbyte1); - void do_LD_inppbit_CF(const uint8_t opbyte0, const uint8_t opbyte1); - void do_LD_CF_inppbit(const uint8_t opbyte0, const uint8_t opbyte1); + void do_CPL_inpp_indirectbit(const uint8_t opbyte0, const uint8_t opbyte1); + void do_LD_inpp_indirectbit_CF(const uint8_t opbyte0, const uint8_t opbyte1); + void do_LD_CF_inpp_indirectbit(const uint8_t opbyte0, const uint8_t opbyte1); void do_XCH_r_g(const uint8_t opbyte0, const uint8_t opbyte1); void do_CPL_gbit(const uint8_t opbyte0, const uint8_t opbyte1); void do_LD_gbit_CF(const uint8_t opbyte0, const uint8_t opbyte1); diff --git a/src/devices/cpu/tlcs870/tlcs870_ops.cpp b/src/devices/cpu/tlcs870/tlcs870_ops.cpp index a2ab06ca962..034d967bca6 100644 --- a/src/devices/cpu/tlcs870/tlcs870_ops.cpp +++ b/src/devices/cpu/tlcs870/tlcs870_ops.cpp @@ -4,20 +4,7 @@ Toshiba TLCS-870 Series MCUs - (src) prefix ops (e0 to e7 subtable) - - (src) address depends on the first byte of the opcode - - E0 (x) - E1 (PC+A) - E2 (DE) - E3 (HL) - E4 (HL+d) - E5 (HL+) - E6 (-HL) - - note, in cases where the address is an immediate value, not a register (x) and (HL+d) the - immediate value is directly after the first byte of the opcode + direct opcodes, no prefix *************************************************************************************************************/ @@ -136,24 +123,12 @@ void tlcs870_device::decode() do_JR_cc_a(opbyte0); break; case 0xd8: case 0xd9: case 0xda: case 0xdb: case 0xdc: case 0xdd: case 0xde: case 0xdf: do_LD_CF_inxbit(opbyte0); break; - case 0xe0: - do_e0_opcode(opbyte0); break; - case 0xe1: case 0xe2: case 0xe3: - do_e1_to_e3_opcode(opbyte0); break; - case 0xe4: - do_e4_opcode(opbyte0); break; - case 0xe5: case 0xe6: case 0xe7: - do_e5_to_e7_opcode(opbyte0); break; + case 0xe0: case 0xe1: case 0xe2: case 0xe3: case 0xe4: case 0xe5: case 0xe6: case 0xe7: + do_srcprefixtype_opcode(opbyte0); break; case 0xe8: case 0xe9: case 0xea: case 0xeb: case 0xec: case 0xed: case 0xee: case 0xef: do_regprefixtype_opcode(opbyte0); break; - case 0xf0: - do_f0_opcode(opbyte0); break; - case 0xf2: case 0xf3: - do_f2_to_f3_opcode(opbyte0); break; - case 0xf4: - do_f4_opcode(opbyte0); break; - case 0xf6: case 0xf7: - do_f6_to_f7_opcode(opbyte0); break; + case 0xf0: case 0xf1: case 0xf2: case 0xf3: case 0xf4: case 0xf5: case 0xf6: case 0xf7: + do_dstprefixtype_opcode(opbyte0); break; case 0xfa: do_LD_SP_mn(opbyte0); break; case 0xfb: @@ -175,36 +150,62 @@ void tlcs870_device::decode() void tlcs870_device::do_illegal(const uint8_t opbyte0) { + m_cycles = 1; logerror("illegal opcode %02x\n", opbyte0); } void tlcs870_device::do_NOP(const uint8_t opbyte0) { - // NOP + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + NOP 0000 0000 - - - - 1 + */ + m_cycles = 1; } void tlcs870_device::do_SWAP_A(const uint8_t opbyte0) { - // SWAP A + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + SWAP A 0000 0001 1 - - - 3 + */ + m_cycles = 3; + handle_swap(REG_A); } void tlcs870_device::do_MUL_W_A(const uint8_t opbyte0) { - // MUL W,A + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + MUL W, A 0000 0010 Z Z - - 7 + */ + m_cycles = 7; + handle_mul(REG_WA); } void tlcs870_device::do_DIV_WA_C(const uint8_t opbyte0) { - // DIV WA,C + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + DIV WA, C 0000 0011 Z Z C - 7 + */ + m_cycles = 7; + handle_div(REG_WA); } void tlcs870_device::do_RETI(const uint8_t opbyte0) { - // RETI - // Return from maskable interrupt service (how does this differ from RETN?) + /* + Return from maskable interrupt service (how does this differ from RETN?) + + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + RETI 0000 0100 * * * * 6 + */ + m_cycles = 6; + m_sp.d += 3; m_addr = RM16(m_sp.d - 2); set_PSW(RM8(m_sp.d - 1)); @@ -212,14 +213,24 @@ void tlcs870_device::do_RETI(const uint8_t opbyte0) void tlcs870_device::do_RET(const uint8_t opbyte0) { - // RET + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + RET 0000 0101 - - - - 6 + */ + m_cycles = 6; + m_sp.d += 2; m_addr = RM16(m_sp.d - 1); }; void tlcs870_device::do_POP_PSW(const uint8_t opbyte0) { - // POP PSW + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + POP PSW 0000 0110 * * * * 3 + */ + m_cycles = 3; + m_sp.d += 2; const uint16_t val = RM16(m_sp.d - 1); set_PSW(val); @@ -227,7 +238,12 @@ void tlcs870_device::do_POP_PSW(const uint8_t opbyte0) void tlcs870_device::do_PUSH_PSW(const uint8_t opbyte0) { - // PUSH PSW: + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + POP PSW 0000 0111 - - - - 2 + */ + m_cycles = 2; + const uint16_t val = get_PSW(); WM16(m_sp.d - 1, val); m_sp.d -= 2; @@ -235,7 +251,12 @@ void tlcs870_device::do_PUSH_PSW(const uint8_t opbyte0) void tlcs870_device::do_DAA_A(const uint8_t opbyte0) { - // DAA A + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + DAA A 0000 1010 C Z C H 2 + */ + m_cycles = 2; + uint8_t val = get_reg8(REG_A); val = handle_DAA(val); @@ -245,7 +266,12 @@ void tlcs870_device::do_DAA_A(const uint8_t opbyte0) void tlcs870_device::do_DAS_A(const uint8_t opbyte0) { - // DAS A + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + DAS A 0000 1011 C Z C H 2 + */ + m_cycles = 2; + uint8_t val = get_reg8(REG_A); val = handle_DAS(val); @@ -255,21 +281,36 @@ void tlcs870_device::do_DAS_A(const uint8_t opbyte0) void tlcs870_device::do_CLR_CF(const uint8_t opbyte0) { - // CLR CF + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + CLR CF 0000 1100 1 - 0 - 1 + */ + m_cycles = 1; + clear_CF(); set_JF(); } void tlcs870_device::do_SET_CF(const uint8_t opbyte0) { - // SET CF + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + SET CF 0000 1101 0 - 1 - 1 + */ + m_cycles = 1; + set_CF(); clear_JF(); } void tlcs870_device::do_CPL_CF(const uint8_t opbyte0) { - // CPL CF + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + CPL CF 0000 1110 * - * - 1 + */ + m_cycles = 1; + if (is_CF()) { set_JF(); @@ -284,7 +325,12 @@ void tlcs870_device::do_CPL_CF(const uint8_t opbyte0) void tlcs870_device::do_LD_RBS_n(const uint8_t opbyte0) // register bank switching { - // LD RBS,n + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD RBS, n 0000 1111 0000 nnnn 1 - - - 4 + */ + m_cycles = 4; + const uint8_t param = READ8(); m_RBS = param & 0x0f; set_JF(); @@ -293,7 +339,12 @@ void tlcs870_device::do_LD_RBS_n(const uint8_t opbyte0) // register bank switchi void tlcs870_device::do_INC_rr(const uint8_t opbyte0) { - // INC rr + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + INC rr 0001 00rr C Z - - 2 + */ + m_cycles = 2; + const int reg = opbyte0 & 3; uint16_t temp = get_reg16(reg); temp++; @@ -315,7 +366,12 @@ void tlcs870_device::do_INC_rr(const uint8_t opbyte0) void tlcs870_device::do_LD_rr_mn(const uint8_t opbyte0) { - // LD rr,mn + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD rr,mn 0001 01rr nnnn nnnn mmmm mmmm 1 - - - 3 + */ + m_cycles = 3; + const uint16_t val = READ16(); // 16-bit set_reg16(opbyte0 & 3, val); set_JF(); @@ -324,7 +380,12 @@ void tlcs870_device::do_LD_rr_mn(const uint8_t opbyte0) void tlcs870_device::do_DEC_rr(const uint8_t opbyte0) { - // DEC rr + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + DEC rr 0001 10rr C Z - - 2 + */ + m_cycles = 2; + const int reg = opbyte0 & 3; uint16_t temp = get_reg16(reg); temp--; @@ -353,7 +414,12 @@ void tlcs870_device::do_DEC_rr(const uint8_t opbyte0) void tlcs870_device::do_SHLC_A(const uint8_t opbyte0) { - // SHLC A + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + SHLC A 0001 1100 C Z * - 1 + */ + m_cycles = 1; + uint8_t val = get_reg8(REG_A); val = handle_SHLC(val); @@ -363,7 +429,12 @@ void tlcs870_device::do_SHLC_A(const uint8_t opbyte0) void tlcs870_device::do_SHRC_A(const uint8_t opbyte0) { - // SHRC A + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + SHRC A 0001 1101 C Z * - 1 + */ + m_cycles = 1; + uint8_t val = get_reg8(REG_A); val = handle_SHRC(val); @@ -373,7 +444,12 @@ void tlcs870_device::do_SHRC_A(const uint8_t opbyte0) void tlcs870_device::do_ROLC_A(const uint8_t opbyte0) { - // ROLC A + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + ROLC A 0001 1110 C Z * - 1 + */ + m_cycles = 1; + uint8_t val = get_reg8(REG_A); val = handle_ROLC(val); @@ -383,7 +459,12 @@ void tlcs870_device::do_ROLC_A(const uint8_t opbyte0) void tlcs870_device::do_RORC_A(const uint8_t opbyte0) { - // RORC A + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + RORC A 0001 1111 C Z * - 1 + */ + m_cycles = 1; + uint8_t val = get_reg8(REG_A); val = handle_RORC(val); @@ -393,7 +474,12 @@ void tlcs870_device::do_RORC_A(const uint8_t opbyte0) void tlcs870_device::do_INC_inx(const uint8_t opbyte0) { - // INC (x) + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + INC (x) 0010 0000 xxxx xxxx C Z - - 5 + */ + m_cycles = 5; + const uint16_t srcaddr = READ8(); uint8_t val = RM8(srcaddr); @@ -416,7 +502,12 @@ void tlcs870_device::do_INC_inx(const uint8_t opbyte0) void tlcs870_device::do_INC_inHL(const uint8_t opbyte0) { - // INC (HL) + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + INC (HL) 0010 0001 C Z - - 4 + */ + m_cycles = 4; + const uint16_t addr = get_reg16(REG_HL); uint8_t val = RM8(addr); @@ -438,7 +529,12 @@ void tlcs870_device::do_INC_inHL(const uint8_t opbyte0) void tlcs870_device::do_LD_A_inx(const uint8_t opbyte0) { - // LD A,(x) + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD A, (x) 0010 0010 xxxx xxxx 1 Z - - 3 + */ + m_cycles = 3; + const uint16_t srcaddr = READ8(); const uint8_t val = RM8(srcaddr); @@ -452,7 +548,12 @@ void tlcs870_device::do_LD_A_inx(const uint8_t opbyte0) void tlcs870_device::do_LD_A_inHL(const uint8_t opbyte0) { - // LD A,(HL) + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD A, (HL) 0010 0011 1 Z - - 2 + */ + m_cycles = 2; + const uint16_t srcaddr = get_reg16(REG_HL); const uint8_t val = RM8(srcaddr); @@ -466,7 +567,12 @@ void tlcs870_device::do_LD_A_inHL(const uint8_t opbyte0) void tlcs870_device::do_LD_inx_iny(const uint8_t opbyte0) { - // LD (x),(y) + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD (x), (y) 0010 0110 yyyy yyyy xxxx xxxx 1 Z - - 5 + */ + m_cycles = 5; + const uint16_t srcaddr = READ8(); const uint16_t dstaddr = READ8(); @@ -482,7 +588,12 @@ void tlcs870_device::do_LD_inx_iny(const uint8_t opbyte0) void tlcs870_device::do_DEC_inx(const uint8_t opbyte0) { - // DEC (x) + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + DEC (x) 0010 1000 xxxx xxxx C Z - - 5 + */ + m_cycles = 5; + const uint16_t addr = READ8(); uint8_t temp = RM8(addr); @@ -511,7 +622,12 @@ void tlcs870_device::do_DEC_inx(const uint8_t opbyte0) void tlcs870_device::do_DEC_inHL(const uint8_t opbyte0) { - // DEC (HL) + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + DEC (HL) 0010 1001 C Z - - 4 + */ + m_cycles = 4; + const uint16_t addr = get_reg16(REG_HL); uint8_t temp = RM8(addr); @@ -540,7 +656,12 @@ void tlcs870_device::do_DEC_inHL(const uint8_t opbyte0) void tlcs870_device::do_LD_inx_A(const uint8_t opbyte0) { - // LD (x),A + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD (x), A 0010 1010 xxxx xxxx 1 - - - 3 + */ + m_cycles = 3; + const uint16_t dstaddr = READ8(); const uint8_t val = get_reg8(REG_A); @@ -554,7 +675,12 @@ void tlcs870_device::do_LD_inx_A(const uint8_t opbyte0) void tlcs870_device::do_LD_inHL_A(const uint8_t opbyte0) { - // LD (HL),A + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD (HL), A 0010 1011 1 - - - 2 + */ + m_cycles = 2; + const uint8_t val = get_reg8(REG_A); set_JF(); @@ -565,7 +691,12 @@ void tlcs870_device::do_LD_inHL_A(const uint8_t opbyte0) void tlcs870_device::do_LD_inx_n(const uint8_t opbyte0) { - // LD (x),n + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD (x), n 0010 1100 xxxx xxxx nnnn nnnn 1 - - - 4 + */ + m_cycles = 4; + const uint16_t dstaddr = READ8(); const uint8_t val = READ8(); @@ -576,7 +707,12 @@ void tlcs870_device::do_LD_inx_n(const uint8_t opbyte0) void tlcs870_device::do_LD_inHL_n(const uint8_t opbyte0) { - // LD (HL),n + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD (HL), n 0010 1101 nnnn nnnn 1 - - - 3 + */ + m_cycles = 3; + const uint8_t val = READ8(); const uint16_t addr = get_reg16(REG_HL); @@ -587,7 +723,12 @@ void tlcs870_device::do_LD_inHL_n(const uint8_t opbyte0) void tlcs870_device::do_CLR_inx(const uint8_t opbyte0) { - // CLR (x) + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + CLR (x) 0010 1110 xxxx xxxx 1 - - - 4 + */ + m_cycles = 4; + const uint16_t addr = READ8(); WM8(addr, 0); @@ -597,7 +738,12 @@ void tlcs870_device::do_CLR_inx(const uint8_t opbyte0) void tlcs870_device::do_CLR_inHL(const uint8_t opbyte0) { - // CLR (HL) + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + CLR (HL) 0010 1111 1 - - - 2 + */ + m_cycles = 2; + const uint16_t addr = get_reg16(REG_HL); WM8(addr, 0); @@ -606,7 +752,12 @@ void tlcs870_device::do_CLR_inHL(const uint8_t opbyte0) void tlcs870_device::do_LD_r_n(const uint8_t opbyte0) { - // LD r,n + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD r,n 0011 0rrr nnnn nnnn 1 - - - 2 + */ + m_cycles = 2; + const uint8_t param1 = opbyte0 & 7; const uint8_t param2 = READ8(); @@ -617,10 +768,14 @@ void tlcs870_device::do_LD_r_n(const uint8_t opbyte0) void tlcs870_device::do_SET_inxbit(const uint8_t opbyte0) { - // SET (x).b - // 0100 0bbb xxxx xxxx + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + SET (x).b 0100 0bbb xxxx xxxx Z * - - 5 + + (opbyte0 == 0x40) && (opval == 0x3a) is EI + */ + m_cycles = 5; - // (opbyte0 == 0x40) && (opval == 0x3a) is EI const uint8_t srcaddr = READ8(); uint8_t val = RM8(srcaddr); @@ -646,10 +801,14 @@ void tlcs870_device::do_SET_inxbit(const uint8_t opbyte0) void tlcs870_device::do_CLR_inxbit(const uint8_t opbyte0) { - // CLR (x).b - // 0100 1bbb xxxx xxxx + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + CLR (x).b 0100 1bbb xxxx xxxx Z * - - 5 + + (opbyte0 == 0x48) && (opval == 0x3a) is DI + */ + m_cycles = 5; - // (opbyte0 == 0x48) && (opval == 0x3a) is DI const uint8_t srcaddr = READ8(); uint8_t val = RM8(srcaddr); @@ -675,8 +834,12 @@ void tlcs870_device::do_CLR_inxbit(const uint8_t opbyte0) void tlcs870_device::do_LD_A_r(const uint8_t opbyte0) { - // LD A,r - // 0101 0rrr + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD A, r 0101 0rrr 1 Z - - 1 + */ + m_cycles = 1; + const uint8_t val = get_reg8(opbyte0 & 0x7); set_reg8(REG_A, val); @@ -688,8 +851,12 @@ void tlcs870_device::do_LD_A_r(const uint8_t opbyte0) void tlcs870_device::do_LD_r_A(const uint8_t opbyte0) { - // LD r,A - // 0101 1rrr + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD r, A 0101 1rrr 1 Z - - 1 + */ + m_cycles = 1; + const uint8_t val = get_reg8(REG_A); set_reg8(opbyte0 & 0x7, val); @@ -701,7 +868,12 @@ void tlcs870_device::do_LD_r_A(const uint8_t opbyte0) void tlcs870_device::do_INC_r(const uint8_t opbyte0) { - // INC r + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + INC r 0110 0rrr C Z - - 1 + */ + m_cycles = 1; + const int reg = opbyte0 & 7; uint8_t temp = get_reg8(reg); temp++; @@ -722,7 +894,12 @@ void tlcs870_device::do_INC_r(const uint8_t opbyte0) void tlcs870_device::do_DEC_r(const uint8_t opbyte0) { - // DEC r + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + DEC r 0110 1rrr C Z - - 1 + */ + m_cycles = 1; + const int reg = opbyte0 & 7; uint8_t temp = get_reg8(reg); temp--; @@ -750,16 +927,22 @@ void tlcs870_device::do_DEC_r(const uint8_t opbyte0) void tlcs870_device::do_JRS_T_a(const uint8_t opbyte0) { - // JRS T,a - const int param1 = 6; + /* + Jump Relative Short, if True + + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + JRS T, a 100d dddd 1 - - - 4 (2 if not taken) + */ + m_cycles = 2; int val = opbyte0 & 0x1f; if (val & 0x10) val -= 0x20; - const bool takejump = check_jump_condition(param1); + const bool takejump = check_jump_condition(COND_T); if (takejump) { + m_cycles += 2; m_addr = m_tmppc + 2 + val; set_JF(); } @@ -767,16 +950,22 @@ void tlcs870_device::do_JRS_T_a(const uint8_t opbyte0) void tlcs870_device::do_JRS_F_a(const uint8_t opbyte0) { - // JRS F,a - const int param1 = 7; + /* + Jump Relative Short, if False + + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + JRS F, a 101d dddd 1 - - - 4 (2 if not taken) + */ + m_cycles = 2; int val = opbyte0 & 0x1f; if (val & 0x10) val -= 0x20; - const bool takejump = check_jump_condition(param1); + const bool takejump = check_jump_condition(COND_F); if (takejump) { + m_cycles += 2; m_addr = m_tmppc + 2 + val; set_JF(); } @@ -784,7 +973,14 @@ void tlcs870_device::do_JRS_F_a(const uint8_t opbyte0) void tlcs870_device::do_CALLV_n(const uint8_t opbyte0) { - // CALLV n + /* + Call Vector + + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + CALLV n 1100 nnnn - - - - 7 + */ + m_cycles = 7; + const uint16_t addr = 0xffc0 + ((opbyte0 & 0xf) * 2); WM16(m_sp.d - 1, m_addr); @@ -795,7 +991,19 @@ void tlcs870_device::do_CALLV_n(const uint8_t opbyte0) void tlcs870_device::do_JR_cc_a(const uint8_t opbyte0) { - // JR cc,a + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + JR T, a 1101 0110 dddd dddd 1 - - - 4 (2 if not taken) + JR F, a 1101 0111 dddd dddd 1 - - - 4 (2 if not taken) + JR EQ, a (Z, a) 1101 0000 dddd dddd 1 - - - 4 (2 if not taken) + JR NE, a (NZ, a) 1101 0001 dddd dddd 1 - - - 4 (2 if not taken) + JR CS, a (LT, a) 1101 0010 dddd dddd 1 - - - 4 (2 if not taken) + JR CC, a (GE, a) 1101 0011 dddd dddd 1 - - - 4 (2 if not taken) + JR LE, a 1101 0100 dddd dddd 1 - - - 4 (2 if not taken) + JR GT, a 1101 0101 dddd dddd 1 - - - 4 (2 if not taken) + */ + m_cycles = 2; + const int param1 = opbyte0 & 0x7; int val = READ8(); @@ -805,6 +1013,7 @@ void tlcs870_device::do_JR_cc_a(const uint8_t opbyte0) if (takejump) { + m_cycles += 2; m_addr = m_tmppc + 2 + val; set_JF(); } @@ -812,14 +1021,21 @@ void tlcs870_device::do_JR_cc_a(const uint8_t opbyte0) void tlcs870_device::do_LD_CF_inxbit(const uint8_t opbyte0) { - // LD CF, (x).b aka TEST (x).b + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD CF, (x).b 1101 1bbb xxxx xxxx ~C - * - 4 + + aka TEST (x).b + */ + m_cycles = 4; + const uint16_t srcaddr = READ8(); const uint8_t val = RM8(srcaddr); const uint8_t bitpos = opbyte0 & 0x7; const int bitused = (1 << bitpos); - uint8_t bit = val & bitused; + const uint8_t bit = val & bitused; bit ? set_CF() : clear_CF(); // for this optype of operation ( LD CF, *.b ) the Jump Flag always ends up the inverse of the Carry Flag @@ -828,8 +1044,12 @@ void tlcs870_device::do_LD_CF_inxbit(const uint8_t opbyte0) void tlcs870_device::do_LD_SP_mn(const uint8_t opbyte0) { - // LD SP,mn - // Flags / Cycles 1--- / 3 + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD SP ,mn 1111 1010 nnnn nnnn mmmm mmmm 1 - - - 3 + */ + m_cycles = 3; + const uint16_t param = READ16(); m_sp.d = param; set_JF(); @@ -837,7 +1057,12 @@ void tlcs870_device::do_LD_SP_mn(const uint8_t opbyte0) void tlcs870_device::do_JR_a(const uint8_t opbyte0) { - // JR a + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + JR a 1111 1011 dddd dddd 1 - - - 4 + */ + m_cycles = 4; + int val = READ8(); if (val & 0x80) val -= 0x100; @@ -848,7 +1073,12 @@ void tlcs870_device::do_JR_a(const uint8_t opbyte0) void tlcs870_device::do_CALL_mn(const uint8_t opbyte0) { - // CALL mn + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + CALL mn 1111 1100 nnnn nnnn mmmm mmmm - - - - 6 + */ + m_cycles = 6; + const uint16_t addr = READ16(); WM16(m_sp.d - 1, m_addr); @@ -859,7 +1089,12 @@ void tlcs870_device::do_CALL_mn(const uint8_t opbyte0) void tlcs870_device::do_CALLP_n(const uint8_t opbyte0) { - // CALLP n + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + CALLP n 1111 1101 nnnn nnnn - - - - 6 + */ + m_cycles = 6; + const uint16_t addr = READ8() + 0xff00; WM16(m_sp.d - 1, m_addr); @@ -870,7 +1105,12 @@ void tlcs870_device::do_CALLP_n(const uint8_t opbyte0) void tlcs870_device::do_JP_mn(const uint8_t opbyte0) { - // JP mn + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + JP mn 1111 1110 nnnn nnnn mmmm mmmm 1 - - - 4 + */ + m_cycles = 4; + const int param2 = READ16(); m_addr = param2; set_JF(); @@ -878,7 +1118,12 @@ void tlcs870_device::do_JP_mn(const uint8_t opbyte0) void tlcs870_device::do_ff_opcode(const uint8_t opbyte0) { - // SWI + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + SWI 1111 1111 - - - - 9 (1 if already in NMI) + */ + m_cycles = 9; // TODO: 1 if in NMI (acts as NOP?) + handle_take_interrupt(0x0e); } @@ -888,9 +1133,18 @@ void tlcs870_device::do_ff_opcode(const uint8_t opbyte0) void tlcs870_device::do_ALUOP_A_n(const uint8_t opbyte0) { - // (ALU OP) A,n - // 0111 0000 nnnn nnnn ADDC A,n - // 0111 0001 nnnn nnnn ADD A,n + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + ADDC A, n 0111 0000 nnnn nnnn C Z C H 2 + ADD A, n 0111 0001 nnnn nnnn C Z C H 2 + SUBB A, n 0111 0010 nnnn nnnn C Z C H 2 + SUB A, n 0111 0011 nnnn nnnn C Z C H 2 + AND A, n 0111 0100 nnnn nnnn Z Z - - 2 + XOR A, n 0111 0101 nnnn nnnn Z Z - - 2 + OR A, n 0111 0110 nnnn nnnn Z Z - - 2 + CMP A, n 0111 0111 nnnn nnnn Z Z C H 2 + */ + m_cycles = 2; const int aluop = (opbyte0 & 0x7); const uint8_t val = READ8(); @@ -905,9 +1159,18 @@ void tlcs870_device::do_ALUOP_A_n(const uint8_t opbyte0) void tlcs870_device::do_ALUOP_A_inx(const uint8_t opbyte0) { - // (ALU OP) A,(x) - // 0111 1000 nnnn nnnn ADDC A,(x) - // 0111 1001 nnnn nnnn ADD A,(x) + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + ADDC A, (x) 0111 1000 xxxx xxxx C Z C H 4 + ADD A, (x) 0111 1001 xxxx xxxx C Z C H 4 + SUBB A, (x) 0111 1010 xxxx xxxx C Z C H 4 + SUB A, (x) 0111 1011 xxxx xxxx C Z C H 4 + AND A, (x) 0111 1100 xxxx xxxx Z Z - - 4 + XOR A, (x) 0111 1101 xxxx xxxx Z Z - - 4 + OR A, (x) 0111 1110 xxxx xxxx Z Z - - 4 + CMP A, (x) 0111 1111 xxxx xxxx Z Z C H 4 + */ + m_cycles = 4; const int aluop = (opbyte0 & 0x7); const uint16_t addr = READ8(); @@ -927,7 +1190,12 @@ void tlcs870_device::do_ALUOP_A_inx(const uint8_t opbyte0) void tlcs870_device::do_LDW_inx_mn(const uint8_t opbyte0) { - // LDW (x),mn + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LDW (x), mn 0010 0100 xxxx xxxx nnnn nnnn mmmm mmmm 1 - - - 6 + */ + m_cycles = 6; + const uint16_t dstaddr = READ8(); const uint16_t val = READ16(); @@ -939,8 +1207,12 @@ void tlcs870_device::do_LDW_inx_mn(const uint8_t opbyte0) void tlcs870_device::do_LDW_inHL_mn(const uint8_t opbyte0) { - // LDW (HL),mn - // m_op = LDW; + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LDW (HL), mn 0010 0101 nnnn nnnn mmmm mmmm 1 - - - 5 + */ + m_cycles = 5; + const uint16_t dstaddr = get_reg16(REG_HL); const uint16_t val = READ16(); diff --git a/src/devices/cpu/tlcs870/tlcs870_ops_dst.cpp b/src/devices/cpu/tlcs870/tlcs870_ops_dst.cpp index 6eee0ff72bc..3f5a77d0217 100644 --- a/src/devices/cpu/tlcs870/tlcs870_ops_dst.cpp +++ b/src/devices/cpu/tlcs870/tlcs870_ops_dst.cpp @@ -13,8 +13,9 @@ F2 (DE) F3 (HL) F4 (HL+d) - F5 invalid (would be (HL+) based on the src table, check for undefined behavior?) - F6 (-HL) + F5 invalid (would be (HL+C) based on the src table, check for undefined behavior?) + F6 (HL+) + F7 (-HL) note, in cases where the address is an immediate value, not a register (x) and (HL+d) the immediate value is directly after the first byte of the opcode @@ -28,47 +29,31 @@ // Main dispatch handlers for these -void tlcs870_device::do_f0_opcode(const uint8_t opbyte0) -{ - // 1111 0000 xxxx xxxx 0101 0rrr - // destination memory prefix (dst) - const uint16_t dstaddr = get_addr((opbyte0 & 0x7), READ8()); - do_f0_to_f7_opcode(opbyte0, dstaddr); -} - -void tlcs870_device::do_f2_to_f3_opcode(const uint8_t opbyte0) -{ - // 0xf2: 1111 001p 0101 0rrr - // 0xf3: 1111 001p 0101 0rrr - // destination memory prefix (dst) - const uint16_t dstaddr = get_addr((opbyte0 & 0x7), 0); - do_f0_to_f7_opcode(opbyte0, dstaddr); -} - - -void tlcs870_device::do_f4_opcode(const uint8_t opbyte0) +// f0 - f7 use this table +// note, the manual shows both src/dst opcodes in the same table as there's no overlap, but they're not compatible +void tlcs870_device::do_dstprefixtype_opcode(const uint8_t opbyte0) { - // 0xf4: 1111 0100 dddd dddd 0101 0rrr - // destination memory prefix (dst) - const uint16_t dstaddr = get_addr((opbyte0 & 0x7), READ8()); - do_f0_to_f7_opcode(opbyte0, dstaddr); -} + m_cycles = get_base_srcdst_cycles(opbyte0 & 0x7); // set base number of cycles based on dst prefix mode -void tlcs870_device::do_f6_to_f7_opcode(const uint8_t opbyte0) -{ - // 0xf6: 1110 0110 0101 0rrr - // 0xf7: 1111 0111 0101 0rrr - // destination memory prefix (dst) - const uint16_t dstaddr = get_addr((opbyte0 & 0x7), 0); - do_f0_to_f7_opcode(opbyte0, dstaddr); -} + uint16_t dstaddr; + // (x) and (HL+d) require an immediate value + if ((opbyte0 == 0xf0) || (opbyte0 == 0xf4)) + { + dstaddr = get_addr((opbyte0 & 0x7), READ8()); + } + else + { + dstaddr = get_addr((opbyte0 & 0x7), 0); + } -// f0 - f7 use this table -// note, same table is shown as above in manual, there's no overlap between src/dest, but they're not compatible -void tlcs870_device::do_f0_to_f7_opcode(const uint8_t opbyte0, const uint16_t dstaddr) -{ const uint8_t opbyte1 = READ8(); + // these are illegal prefixes for dst, undefined behavior at least + if ((opbyte0 == 0xf1) || (opbyte0 == 0xf5)) + { + do_f0_to_f7_oprand_illegal_opcode(opbyte0, opbyte1, dstaddr); + } + switch (opbyte1) { case 0x10: case 0x11: case 0x12: case 0x13: @@ -82,6 +67,12 @@ void tlcs870_device::do_f0_to_f7_opcode(const uint8_t opbyte0, const uint16_t ds } } +void tlcs870_device::do_f0_to_f7_oprand_illegal_opcode(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t dstaddr) +{ + m_cycles += 1; + logerror("illegal dst prefix opcode %02x %02x (dst addr %04x)\n", opbyte0, opbyte1, dstaddr); +} + // Actual handlers /**********************************************************************************************************************/ @@ -90,8 +81,22 @@ void tlcs870_device::do_f0_to_f7_opcode(const uint8_t opbyte0, const uint16_t ds void tlcs870_device::do_LD_indst_rr(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t dstaddr) { - // LD (dst),rr - // (dst) can only be (x) (pp) or (HL+d) ? not (HL+) or (-HL) ? + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD (x), rr 1111 0000 xxxx xxxx 0001 00rr 1 - - - 5 + LD (PC+A), rr invalid encoding (all PC+A are invalid for dst) ? ? ? ? ? + LD (DE), rr 1111 0010 0001 00rr 1 - - - 4 + LD (HL), rr 1111 0011 0001 00rr 1 - - - 4 + LD (HL+d), rr 1111 0100 dddd dddd 0001 00rr 1 - - - 6 + LD (HL+C), rr invalid encoding (all HL+C are invalid for dst) ? ? ? ? ? + LD (HL+), rr not listed, invalid due to 16-bit op? ? ? ? ? ? + LD (-HL), rr not listed, invalid due to 16-bit op? ? ? ? ? ? + + aka LD (dst),rr + (dst) can only be (x) (pp) or (HL+d) ? not (HL+) or (-HL) ? + */ + m_cycles += 4; + const uint16_t val = get_reg16(opbyte1 & 0x3); WM16(dstaddr, val); @@ -104,8 +109,22 @@ void tlcs870_device::do_LD_indst_rr(const uint8_t opbyte0, const uint8_t opbyte1 void tlcs870_device::do_LD_indst_n(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t dstaddr) { - // LD (dst),n - // (dst) can only be (DE), (HL+), (-HL), or (HL+d) because (x) and (HL) are redundant encodings? + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD (x), n not listed, redundant encoding? ? ? ? ? ? + LD (PC+A), n invalid encoding (all PC+A are invalid for dst) ? ? ? ? ? + LD (DE), n 1111 0010 0010 1100 nnnn nnnn 1 - - - 4 + LD (HL), n not listed, redundant encoding? ? ? ? ? ? + LD (HL+d), n 1111 0100 dddd dddd 0010 1100 nnnn nnnn 1 - - - 6 + LD (HL+C), n invalid encoding (all HL+C are invalid for dst) ? ? ? ? ? + LD (HL+), n 1111 0110 0010 1100 nnnn nnnn 1 - - - 5 + LD (-HL), n 1111 0111 0010 1100 nnnn nnnn 1 - - - 5 + + aka (dst),n + (dst) can only be (DE), (HL+), (-HL), or (HL+d) because (x) and (HL) are redundant encodings? + */ + m_cycles += 4; + const uint16_t n = READ8(); WM8(dstaddr, n); @@ -114,14 +133,23 @@ void tlcs870_device::do_LD_indst_n(const uint8_t opbyte0, const uint8_t opbyte1, void tlcs870_device::do_LD_indst_r(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t dstaddr) { - // LD (dst),r + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD (x), r 1111 0000 xxxx xxxx 0101 1rrr 1 - - - 4 + LD (PC+A), r invalid encoding (all PC+A are invalid for dst) ? ? ? ? ? + LD (DE), r 1111 0010 0101 1rrr 1 - - - 3 + LD (HL), r 1111 0011 0101 1rrr 1 - - - 3 + LD (HL+d), r 1111 0100 dddd dddd 0101 1rrr 1 - - - 5 + LD (HL+C), r invalid encoding (all HL+C are invalid for dst) ? ? ? ? ? + LD (HL+), r 1111 0110 0101 0rrr 1 - - - 4 (invalid if r is H or L) + LD (-HL), r 1111 0111 0101 0rrr 1 - - - 4 + + aka LD (dst),r + */ + m_cycles += 3; + const uint8_t reg = get_reg8(opbyte1 & 0x7); WM8(dstaddr, reg); set_JF(); } - -void tlcs870_device::do_f0_to_f7_oprand_illegal_opcode(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t dstaddr) -{ - logerror("illegal dst prefix opcode %02x %02x (dst addr %04x)\n", opbyte0, opbyte1, dstaddr); -} diff --git a/src/devices/cpu/tlcs870/tlcs870_ops_reg.cpp b/src/devices/cpu/tlcs870/tlcs870_ops_reg.cpp index e9073bc4c49..4bcc361c51d 100644 --- a/src/devices/cpu/tlcs870/tlcs870_ops_reg.cpp +++ b/src/devices/cpu/tlcs870/tlcs870_ops_reg.cpp @@ -97,11 +97,11 @@ void tlcs870_device::do_regprefixtype_opcode(const uint8_t opbyte0) case 0x8a: case 0x8b: do_CLR_inppbit(opbyte0, opbyte1); break; case 0x92: case 0x93: - do_CPL_inppbit(opbyte0, opbyte1); break; + do_CPL_inpp_indirectbit(opbyte0, opbyte1); break; case 0x9a: case 0x9b: - do_LD_inppbit_CF(opbyte0, opbyte1); break; + do_LD_inpp_indirectbit_CF(opbyte0, opbyte1); break; case 0x9e: case 0x9f: - do_LD_CF_inppbit(opbyte0, opbyte1); break; + do_LD_CF_inpp_indirectbit(opbyte0, opbyte1); break; case 0xa8: case 0xa9: case 0xaa: case 0xab: case 0xac: case 0xad: case 0xae: case 0xaf: do_XCH_r_g(opbyte0, opbyte1); break; case 0xc0: case 0xc1: case 0xc2: case 0xc3: case 0xc4: case 0xc5: case 0xc6: case 0xc7: @@ -134,6 +134,7 @@ void tlcs870_device::do_regprefixtype_opcode(const uint8_t opbyte0) void tlcs870_device::do_regprefixtype_oprand_illegal(const uint8_t opbyte0, const uint8_t opbyte1) { + m_cycles = 1; logerror("illegal reg prefix opcode %02x %02x\n", opbyte0, opbyte1); } @@ -143,8 +144,13 @@ void tlcs870_device::do_RETN(const uint8_t opbyte0, const uint8_t opbyte1) // with E8 only if (opbyte0 == 0xe8) { - // RETN - // Return from non-maskable interrupt service (how does this differ from RETI?) + /* + Return from non-maskable interrupt service (how does this differ from RETI?) + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + RETN 1110 1000 0000 0100 * * * * 7 + */ + m_cycles = 7; + m_sp.d += 3; m_addr = RM16(m_sp.d - 2); set_PSW(RM8(m_sp.d - 1)); @@ -161,15 +167,24 @@ void tlcs870_device::do_RETN(const uint8_t opbyte0, const uint8_t opbyte1) void tlcs870_device::do_SWAP_g(const uint8_t opbyte0, const uint8_t opbyte1) { - // SWAP g + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + SWAP g 1110 1ggg 0000 0001 1 - - - 4 + */ + m_cycles = 4; + const uint8_t reg = opbyte0 & 0x7; handle_swap(reg); } void tlcs870_device::do_DAA_g(const uint8_t opbyte0, const uint8_t opbyte1) { - // DAA g - // 1110 1ggg 0000 1010 + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + DAS g 1110 1ggg 0000 1010 C Z C H 3 + */ + m_cycles = 3; + uint8_t val = get_reg8(opbyte0 & 0x7); val = handle_DAA(val); @@ -180,8 +195,12 @@ void tlcs870_device::do_DAA_g(const uint8_t opbyte0, const uint8_t opbyte1) void tlcs870_device::do_DAS_g(const uint8_t opbyte0, const uint8_t opbyte1) { - // DAS g - // 1110 1ggg 0000 1011 + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + DAS g 1110 1ggg 0000 1011 C Z C H 3 + */ + m_cycles = 3; + uint8_t val = get_reg8(opbyte0 & 0x7); val = handle_DAS(val); @@ -192,8 +211,13 @@ void tlcs870_device::do_DAS_g(const uint8_t opbyte0, const uint8_t opbyte1) void tlcs870_device::do_SHLC_g(const uint8_t opbyte0, const uint8_t opbyte1) { - // SHLC g - // Logical Shift Left with Carry Flag + /* + Logical Shift Left with Carry Flag + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + SHLC g 1110 1ggg 0001 1100 C Z * - 2 + */ + m_cycles = 2; + uint8_t val = get_reg8(opbyte0 & 0x7); val = handle_SHLC(val); @@ -203,8 +227,12 @@ void tlcs870_device::do_SHLC_g(const uint8_t opbyte0, const uint8_t opbyte1) void tlcs870_device::do_SHRC_g(const uint8_t opbyte0, const uint8_t opbyte1) { - // SHRC g - // Logical Shift Right with Carry Flag + /* + Logical Shift Right with Carry Flag + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + SHRC g 1110 1ggg 0001 1101 C Z * - 2 + */ + m_cycles = 2; uint8_t val = get_reg8(opbyte0 & 0x7); @@ -215,8 +243,13 @@ void tlcs870_device::do_SHRC_g(const uint8_t opbyte0, const uint8_t opbyte1) void tlcs870_device::do_ROLC_g(const uint8_t opbyte0, const uint8_t opbyte1) { - // ROLC g - // Rotate Left through Carry flag + /* + Rotate Left through Carry flag + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + ROLC g 1110 1ggg 0001 1110 C Z * - 2 + */ + m_cycles = 2; + uint8_t val = get_reg8(opbyte0 & 0x7); val = handle_ROLC(val); @@ -227,8 +260,13 @@ void tlcs870_device::do_ROLC_g(const uint8_t opbyte0, const uint8_t opbyte1) void tlcs870_device::do_RORC_g(const uint8_t opbyte0, const uint8_t opbyte1) { - // RORC g - // Rotate Right through Carry flag + /* + Rotate Right through Carry flag + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + RORC g 1110 1ggg 0001 1111 C Z * - 2 + */ + m_cycles = 2; + uint8_t val = get_reg8(opbyte0 & 0x7); val = handle_RORC(val); @@ -239,8 +277,12 @@ void tlcs870_device::do_RORC_g(const uint8_t opbyte0, const uint8_t opbyte1) void tlcs870_device::do_LD_r_g(const uint8_t opbyte0, const uint8_t opbyte1) { - // LD r,g - // 1110 1ggg 0101 1rrr + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD r, g 1110 1ggg 0101 1rrr 1 Z - - 2 + */ + m_cycles = 2; + const uint8_t val = get_reg8(opbyte0 & 0x7); set_reg8(opbyte1 & 0x7, val); @@ -252,8 +294,12 @@ void tlcs870_device::do_LD_r_g(const uint8_t opbyte0, const uint8_t opbyte1) void tlcs870_device::do_XCH_r_g(const uint8_t opbyte0, const uint8_t opbyte1) { - // XCH r,g - // 1110 1ggg 1010 1rrr + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + XCG r, g 1110 1ggg 1010 1rrr 1 Z - - 3 + */ + m_cycles = 3; + const uint8_t val = get_reg8(opbyte0 & 0x7); const uint8_t r = get_reg8(opbyte1 & 0x7); @@ -272,17 +318,18 @@ void tlcs870_device::do_XCH_r_g(const uint8_t opbyte0, const uint8_t opbyte1) void tlcs870_device::do_ALUOP_A_g(const uint8_t opbyte0, const uint8_t opbyte1) { - // (ALU OP) A,g /* - 1110 1ggg 0110 0000 ADDC A,g - 1110 1ggg 0110 0001 ADD A,g - 1110 1ggg 0110 0010 SUBB A,g - 1110 1ggg 0110 0011 SUB A,g - 1110 1ggg 0110 0100 AND A,g - 1110 1ggg 0110 0101 XOR A,g - 1110 1ggg 0110 0110 OR A,g - 1110 1ggg 0110 0111 CMP A,g + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + ADDC A, g 1110 1ggg 0110 0000 C Z C H 2 + ADD A, g 1110 1ggg 0110 0001 C Z C H 2 + SUBB A, g 1110 1ggg 0110 0010 C Z C H 2 + SUB A, g 1110 1ggg 0110 0011 C Z C H 2 + AND A, g 1110 1ggg 0110 0100 Z Z - - 2 + XOR A, g 1110 1ggg 0110 0101 Z Z - - 2 + OR A, g 1110 1ggg 0110 0110 Z Z - - 2 + CMP A, g 1110 1ggg 0110 0111 Z Z C H 2 */ + m_cycles = 2; const int aluop = (opbyte1 & 0x7); @@ -296,17 +343,18 @@ void tlcs870_device::do_ALUOP_A_g(const uint8_t opbyte0, const uint8_t opbyte1) void tlcs870_device::do_ALUOP_g_A(const uint8_t opbyte0, const uint8_t opbyte1) { - // (ALU OP) g,A /* - 1110 1ggg 0110 1000 ADDC A,g - 1110 1ggg 0110 1001 ADD A,g - 1110 1ggg 0110 1010 SUBB A,g - 1110 1ggg 0110 1011 SUB A,g - 1110 1ggg 0110 1100 AND A,g - 1110 1ggg 0110 1101 XOR A,g - 1110 1ggg 0110 1110 OR A,g - 1110 1ggg 0110 1111 CMP A,g + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + ADDC g, A 1110 1ggg 0110 1000 C Z C H 3 + ADD g, A 1110 1ggg 0110 1001 C Z C H 3 + SUBB g, A 1110 1ggg 0110 1010 C Z C H 3 + SUB g, A 1110 1ggg 0110 1011 C Z C H 3 + AND g, A 1110 1ggg 0110 1100 Z Z - - 3 + XOR g, A 1110 1ggg 0110 1101 Z Z - - 3 + OR g, A 1110 1ggg 0110 1110 Z Z - - 3 + CMP g, A 1110 1ggg 0110 1111 Z Z C H 3 */ + m_cycles = 3; const int aluop = (opbyte1 & 0x7); const uint8_t result = do_alu(aluop, get_reg8(opbyte0 & 0x7), get_reg8(REG_A)); @@ -319,7 +367,19 @@ void tlcs870_device::do_ALUOP_g_A(const uint8_t opbyte0, const uint8_t opbyte1) void tlcs870_device::do_ALUOP_g_n(const uint8_t opbyte0, const uint8_t opbyte1) { - // (ALU OP) g,n + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + ADDC g, n 1110 1ggg 0111 0000 nnnn nnnn C Z C H 3 + ADD g, n 1110 1ggg 0111 0001 nnnn nnnn C Z C H 3 + SUBB g, n 1110 1ggg 0111 0010 nnnn nnnn C Z C H 3 + SUB g, n 1110 1ggg 0111 0011 nnnn nnnn C Z C H 3 + AND g, n 1110 1ggg 0111 0100 nnnn nnnn Z Z - - 3 + XOR g, n 1110 1ggg 0111 0101 nnnn nnnn Z Z - - 3 + OR g, n 1110 1ggg 0111 0110 nnnn nnnn Z Z - - 3 + CMP g, n 1110 1ggg 0111 0111 nnnn nnnn Z Z C H 3 + */ + m_cycles = 3; + const int aluop = (opbyte1 & 0x7); const uint8_t n = READ8(); @@ -338,17 +398,18 @@ void tlcs870_device::do_ALUOP_g_n(const uint8_t opbyte0, const uint8_t opbyte1) void tlcs870_device::do_ALUOP_WA_gg(const uint8_t opbyte0, const uint8_t opbyte1) { - // (ALU OP) WA,gg /* - 1110 10gg 0011 0000 ADDC WA,gg - 1110 10gg 0011 0001 ADD WA,gg - 1110 10gg 0011 0010 SUBB WA,gg - 1110 10gg 0011 0011 SUB WA,gg - 1110 10gg 0011 0100 AND WA,gg - 1110 10gg 0011 0101 XOR WA,gg - 1110 10gg 0011 0110 OR WA,gg - 1110 10gg 0011 0111 CMP WA,gg + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + ADDC WA, gg 1110 10gg 0011 0000 C Z C U 4 + ADD WA, gg 1110 10gg 0011 0001 C Z C U 4 + SUBB WA, gg 1110 10gg 0011 0010 C Z C U 4 + SUB WA, gg 1110 10gg 0011 0011 C Z C U 4 + AND WA, gg 1110 10gg 0011 0100 Z Z - - 4 + XOR WA, gg 1110 10gg 0011 0101 Z Z - - 4 + OR WA, gg 1110 10gg 0011 0110 Z Z - - 4 + CMP WA, gg 1110 10gg 0011 0111 Z Z C U 4 */ + m_cycles = 4; const int aluop = (opbyte1 & 0x7); @@ -363,7 +424,19 @@ void tlcs870_device::do_ALUOP_WA_gg(const uint8_t opbyte0, const uint8_t opbyte1 void tlcs870_device::do_ALUOP_gg_mn(const uint8_t opbyte0, const uint8_t opbyte1) { - // (ALU OP) gg,mn + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + ADDC gg, mn 1110 10gg 0011 1000 nnnn nnnn mmmm mmmm C Z C U 4 + ADD gg, mn 1110 10gg 0011 1001 nnnn nnnn mmmm mmmm C Z C U 4 + SUBB gg, mn 1110 10gg 0011 1010 nnnn nnnn mmmm mmmm C Z C U 4 + SUB gg, mn 1110 10gg 0011 1011 nnnn nnnn mmmm mmmm C Z C U 4 + AND gg, mn 1110 10gg 0011 1100 nnnn nnnn mmmm mmmm Z Z - - 4 + XOR gg, mn 1110 10gg 0011 1101 nnnn nnnn mmmm mmmm Z Z - - 4 + OR gg, mn 1110 10gg 0011 1110 nnnn nnnn mmmm mmmm Z Z - - 4 + CMP gg, mn 1110 10gg 0011 1111 nnnn nnnn mmmm mmmm Z Z C U 4 + */ + m_cycles = 4; + const int aluop = (opbyte1 & 0x7); const uint16_t mn = READ16(); @@ -384,8 +457,14 @@ void tlcs870_device::do_ALUOP_gg_mn(const uint8_t opbyte0, const uint8_t opbyte1 void tlcs870_device::do_SET_inppbit(const uint8_t opbyte0, const uint8_t opbyte1) { - // SET (pp).g - const uint8_t bitpos = opbyte0 & 7; + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + SET (DE).g 1110 1ggg 1000 0010 Z * - - 5 + SET (HL).g 1110 1ggg 1000 0011 Z * - - 5 + */ + m_cycles = 5; + + const uint8_t bitpos = get_reg8(opbyte0 & 7) & 0x7; const uint8_t bitused = 1 << bitpos; const uint16_t addr = get_reg16((opbyte1 & 1) + 2); // DE or HL uint8_t val = RM8(addr); @@ -408,8 +487,14 @@ void tlcs870_device::do_SET_inppbit(const uint8_t opbyte0, const uint8_t opbyte1 void tlcs870_device::do_CLR_inppbit(const uint8_t opbyte0, const uint8_t opbyte1) { - // CLR (pp).g - const uint8_t bitpos = opbyte0 & 7; + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + CLR (DE).g 1110 1ggg 1000 1010 Z * - - 5 + CLR (HL).g 1110 1ggg 1000 1011 Z * - - 5 + */ + m_cycles = 5; + + const uint8_t bitpos = get_reg8(opbyte0 & 7) & 0x7; const uint8_t bitused = 1 << bitpos; const uint16_t addr = get_reg16((opbyte1 & 1) + 2); // DE or HL uint8_t val = RM8(addr); @@ -430,10 +515,16 @@ void tlcs870_device::do_CLR_inppbit(const uint8_t opbyte0, const uint8_t opbyte1 WM8(addr, val); } -void tlcs870_device::do_CPL_inppbit(const uint8_t opbyte0, const uint8_t opbyte1) +void tlcs870_device::do_CPL_inpp_indirectbit(const uint8_t opbyte0, const uint8_t opbyte1) { - // CPL (pp).g - const uint8_t bitpos = opbyte0 & 7; + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + CPL (DE).g 1110 1ggg 1001 0010 Z * - - 5 + CPL (HL).g 1110 1ggg 1001 0011 Z * - - 5 + */ + m_cycles = 5; + + const uint8_t bitpos = get_reg8(opbyte0 & 7) & 0x7; const uint8_t bitused = 1 << bitpos; const uint16_t addr = get_reg16((opbyte1 & 1) + 2); // DE or HL uint8_t val = RM8(addr); @@ -458,10 +549,16 @@ void tlcs870_device::do_CPL_inppbit(const uint8_t opbyte0, const uint8_t opbyte1 WM8(addr, val); } -void tlcs870_device::do_LD_inppbit_CF(const uint8_t opbyte0, const uint8_t opbyte1) +void tlcs870_device::do_LD_inpp_indirectbit_CF(const uint8_t opbyte0, const uint8_t opbyte1) { - // LD (pp).g,CF - const uint8_t bitpos = opbyte0 & 7; + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD (DE).g, CF 1110 1ggg 1001 1010 1 - - - 5 + LD (HL).g, CF 1110 1ggg 1001 1011 1 - - - 5 + */ + m_cycles = 5; + + const uint8_t bitpos = get_reg8(opbyte0 & 7) & 0x7; const uint8_t bitused = 1 << bitpos; const uint16_t addr = get_reg16((opbyte1 & 1) + 2); // DE or HL uint8_t val = RM8(addr); @@ -482,11 +579,18 @@ void tlcs870_device::do_LD_inppbit_CF(const uint8_t opbyte0, const uint8_t opbyt } -void tlcs870_device::do_LD_CF_inppbit(const uint8_t opbyte0, const uint8_t opbyte1) +void tlcs870_device::do_LD_CF_inpp_indirectbit(const uint8_t opbyte0, const uint8_t opbyte1) { - // LD CF,(pp).g aka TEST (pp).g - // 1110 1ggg 1001 111p - const uint8_t bitpos = opbyte0 & 7; + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD CF, (DE).g 1110 1ggg 1001 1110 ~C - * - 4 + LD CF, (HL).g 1110 1ggg 1001 1111 ~C - * - 4 + + aka aka TEST (pp).g + */ + m_cycles = 4; + + const uint8_t bitpos = get_reg8(opbyte0 & 7) & 0x7; const uint8_t bitused = 1 << bitpos; const uint16_t addr = get_reg16((opbyte1 & 1) + 2); // DE or HL const uint8_t val = RM8(addr); @@ -502,8 +606,12 @@ void tlcs870_device::do_LD_CF_inppbit(const uint8_t opbyte0, const uint8_t opbyt void tlcs870_device::do_SET_gbit(const uint8_t opbyte0, const uint8_t opbyte1) { - // SET g.b - // 1110 1ggg 0100 0bbb + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + SET g.b 1110 1ggg 0100 0bbb Z * - - 3 + */ + m_cycles = 3; + uint8_t val = get_reg8(opbyte0 & 0x7); const uint8_t bitpos = opbyte1 & 0x7; @@ -527,8 +635,12 @@ void tlcs870_device::do_SET_gbit(const uint8_t opbyte0, const uint8_t opbyte1) void tlcs870_device::do_CLR_gbit(const uint8_t opbyte0, const uint8_t opbyte1) { - // CLR g.b - // 1110 1ggg 0100 1bbb + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + CLR g.b 1110 1ggg 0100 1bbb Z * - - 3 + */ + m_cycles = 3; + uint8_t val = get_reg8(opbyte0 & 0x7); const uint8_t bitpos = opbyte1 & 0x7; @@ -552,8 +664,12 @@ void tlcs870_device::do_CLR_gbit(const uint8_t opbyte0, const uint8_t opbyte1) void tlcs870_device::do_CPL_gbit(const uint8_t opbyte0, const uint8_t opbyte1) { - // CPL g.b - // 1110 1ggg 1100 0bbb + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + CPL g.b 1110 1ggg 1100 0bbb Z * - - 3 + */ + m_cycles = 3; + uint8_t val = get_reg8(opbyte0 & 0x7); const uint8_t bitpos = opbyte1 & 0x7; @@ -581,9 +697,12 @@ void tlcs870_device::do_CPL_gbit(const uint8_t opbyte0, const uint8_t opbyte1) void tlcs870_device::do_LD_gbit_CF(const uint8_t opbyte0, const uint8_t opbyte1) { - // LD g.b,CF - // m_op = LD; // Flags / Cycles 1--- / 2 - //m_flagsaffected |= FLAG_J; + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD g.b, CF 1110 1ggg 1100 1bbb 1 - - - 2 + */ + m_cycles = 2; + uint8_t val = get_reg8(opbyte0 & 0x7); const uint8_t bitpos = opbyte1 & 0x7; @@ -607,7 +726,12 @@ void tlcs870_device::do_LD_gbit_CF(const uint8_t opbyte0, const uint8_t opbyte1) void tlcs870_device::do_XOR_CF_gbit(const uint8_t opbyte0, const uint8_t opbyte1) { - // XOR CF,g.b + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + XOR CF, g.b 1110 1ggg 1101 0bbb ~C - * - 2 + */ + m_cycles = 2; + const uint8_t bitpos = opbyte1 & 0x7; const uint8_t bitused = 1 << bitpos; @@ -648,7 +772,14 @@ void tlcs870_device::do_XOR_CF_gbit(const uint8_t opbyte0, const uint8_t opbyte1 void tlcs870_device::do_LD_CF_gbit(const uint8_t opbyte0, const uint8_t opbyte1) { - // LD CF,g.b aka TEST g.b + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD CF, g.b 1110 1ggg 1101 1bbb ~C - * - 2 + + aka TEST g.b + */ + m_cycles = 2; + const uint8_t bitpos = opbyte1 & 0x7; const uint8_t bitused = 1 << bitpos; @@ -667,23 +798,44 @@ void tlcs870_device::do_LD_CF_gbit(const uint8_t opbyte0, const uint8_t opbyte1) void tlcs870_device::do_MUL_gg(const uint8_t opbyte0, const uint8_t opbyte1) { - // MUL ggH, ggL (odd syntax, basically MUL gg) + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + MUL W, A not listed (redundant encoding?) ? ? ? ? ? + MUL B, C 1110 1010 0000 0010 Z Z - - 8 + MUL D, E 1110 1010 0000 0010 Z Z - - 8 + MUL H, L 1110 1011 0000 0010 Z Z - - 8 + + aka MUL ggH, ggL (odd syntax, basically MUL gg) + */ + m_cycles = 8; + const uint8_t reg = opbyte0 & 0x3; // opbyte0 & 4 = invalid? handle_mul(reg); // flag changes in handler } void tlcs870_device::do_DIV_gg_C(const uint8_t opbyte0, const uint8_t opbyte1) { - // DIV gg,C - // (DIV BC,C is presumably an illegal / undefined result) - // (DIV WA,C is a redundant encoding) + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + DIV WA, C not listed (redundant encoding?) ? ? ? ? ? + DIV BC, C not listed (illegal?) ? ? ? ? ? + DIV DE, C 1110 1010 0000 0011 Z Z C - 8 + DIV HL, C 1110 1011 0000 0011 Z Z C - 8 + */ + m_cycles = 8; + const uint8_t reg = opbyte0 & 0x3; // opbyte0 & 4 = invalid? handle_div(reg); // flag changes in handler } void tlcs870_device::do_POP_gg(const uint8_t opbyte0, const uint8_t opbyte1) { - // POP gg + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + POP gg 1110 10gg 0000 0110 - - - - 5 + */ + m_cycles = 5; + m_sp.d += 2; const uint16_t val = RM16(m_sp.d - 1); set_reg16(opbyte0 & 3, val); @@ -692,7 +844,12 @@ void tlcs870_device::do_POP_gg(const uint8_t opbyte0, const uint8_t opbyte1) void tlcs870_device::do_PUSH_gg(const uint8_t opbyte0, const uint8_t opbyte1) { - // PUSH gg + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + PUSH gg 1110 10gg 0000 0111 - - - - 4 + */ + m_cycles = 4; + const uint16_t val = get_reg16(opbyte0 & 3); WM16(m_sp.d - 1, val); m_sp.d -= 2; @@ -702,21 +859,36 @@ void tlcs870_device::do_PUSH_gg(const uint8_t opbyte0, const uint8_t opbyte1) void tlcs870_device::do_LD_SP_gg(const uint8_t opbyte0, const uint8_t opbyte1) { - // LD SP,gg + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD SP, gg 1110 10gg 1111 1010 1 - - - 3 + */ + m_cycles = 3; + m_sp.d = get_reg16(opbyte0 & 0x3); set_JF(); // no other flag changes for this type of LD } void tlcs870_device::do_LD_gg_SP(const uint8_t opbyte0, const uint8_t opbyte1) { - // LD gg,SP + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD gg, SP 1110 10gg 1111 1011 1 - - - 3 + */ + m_cycles = 3; + set_reg16(opbyte0 & 0x3, m_sp.d); set_JF(); // no other flag changes for this type of LD } void tlcs870_device::do_LD_rr_gg(const uint8_t opbyte0, const uint8_t opbyte1) { - // LD rr,gg + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD rr, gg 1110 10gg 0001 00rr 1 - - - 2 + */ + m_cycles = 2; + const uint16_t gg = get_reg16(opbyte0 & 0x3); set_reg16(opbyte1 & 0x3, gg); @@ -726,20 +898,30 @@ void tlcs870_device::do_LD_rr_gg(const uint8_t opbyte0, const uint8_t opbyte1) void tlcs870_device::do_XCH_rr_gg(const uint8_t opbyte0, const uint8_t opbyte1) { - // XCH rr,gg + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + XCH rr, gg 1110 10gg 0001 01rr 1 - - - 3 + */ + m_cycles = 3; + const uint16_t gg = get_reg16(opbyte0 & 0x3); const uint16_t rr = get_reg16(opbyte1 & 0x3); set_reg16(opbyte1 & 0x3, gg); set_reg16(opbyte0 & 0x3, rr); - // flags not done + set_JF(); } void tlcs870_device::do_CALL_gg(const uint8_t opbyte0, const uint8_t opbyte1) { - // CALL gg + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + CALL gg 1110 10gg 1111 1100 - - - - 6 + */ + m_cycles = 6; + const uint16_t val = get_reg16(opbyte0 & 3); WM16(m_sp.d - 1, m_addr); @@ -752,7 +934,12 @@ void tlcs870_device::do_CALL_gg(const uint8_t opbyte0, const uint8_t opbyte1) void tlcs870_device::do_JP_gg(const uint8_t opbyte0, const uint8_t opbyte1) { - // JP gg + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + JP gg 1110 10gg 1111 1110 1 - - - 3 + */ + m_cycles = 3; + const uint16_t val = get_reg16(opbyte0 & 3); m_addr = val; diff --git a/src/devices/cpu/tlcs870/tlcs870_ops_src.cpp b/src/devices/cpu/tlcs870/tlcs870_ops_src.cpp index afb1c0c9ac0..22c718a2078 100644 --- a/src/devices/cpu/tlcs870/tlcs870_ops_src.cpp +++ b/src/devices/cpu/tlcs870/tlcs870_ops_src.cpp @@ -29,33 +29,18 @@ // Main dispatch handlers for these -void tlcs870_device::do_e0_opcode(const uint8_t opbyte0) -{ - const uint16_t srcaddr = get_addr((opbyte0 & 0x7), READ8()); - do_e0_to_e7_opcode(opbyte0, srcaddr); -} - -void tlcs870_device::do_e1_to_e3_opcode(const uint8_t opbyte0) -{ - const uint16_t srcaddr = get_addr((opbyte0 & 0x7), 0); - do_e0_to_e7_opcode(opbyte0, srcaddr); -} - -void tlcs870_device::do_e4_opcode(const uint8_t opbyte0) +// e0 - e7 use this table +void tlcs870_device::do_srcprefixtype_opcode(const uint8_t opbyte0) { - const uint16_t srcaddr = get_addr((opbyte0 & 0x7), READ8()); - do_e0_to_e7_opcode(opbyte0, srcaddr); -} + m_cycles = get_base_srcdst_cycles(opbyte0 & 0x7); // set base number of cycles based on src prefix mode -void tlcs870_device::do_e5_to_e7_opcode(const uint8_t opbyte0) -{ - const uint16_t srcaddr = get_addr((opbyte0 & 0x7), 0); - do_e0_to_e7_opcode(opbyte0, srcaddr); -} + uint16_t srcaddr; + // (x) and (HL+d) require an immediate value + if ((opbyte0 == 0xe0) || (opbyte0 == 0xe4)) + srcaddr = get_addr((opbyte0 & 0x7), READ8()); + else + srcaddr = get_addr((opbyte0 & 0x7), 0); -// e0 - e7 use this table -void tlcs870_device::do_e0_to_e7_opcode(uint8_t opbyte0, uint16_t srcaddr) -{ const uint8_t opbyte1 = READ8(); switch (opbyte1) @@ -112,6 +97,7 @@ void tlcs870_device::do_e0_to_e7_opcode(uint8_t opbyte0, uint16_t srcaddr) void tlcs870_device::do_e0_to_e7_oprand_illegal(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr) { + m_cycles += 1; logerror("illegal src prefix opcode %02x %02x (src addr %04x)\n", opbyte0, opbyte1, srcaddr); } @@ -121,7 +107,21 @@ void tlcs870_device::do_e0_to_e7_oprand_illegal(const uint8_t opbyte0, const uin void tlcs870_device::do_LD_rr_insrc(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr) { - // LD rr, (src) + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD rr, (x) 1110 0000 xxxx xxxx 0001 01rr 1 - - - 5 + LD rr, (PC+A) 1110 0001 0001 01rr 1 - - - 6 + LD rr, (DE) 1110 0010 0001 01rr 1 - - - 4 + LD rr, (HL) 1110 0011 0001 01rr 1 - - - 4 + LD rr, (HL+d) 1110 0100 dddd dddd 0001 01rr 1 - - - 6 + LD rr, (HL+C) 1110 0101 0001 01rr 1 - - - 6 + LD rr, (HL+) not listed, invalid due to 16-bit op? ? ? ? ? ? + LD rr, (-HL) not listed, invalid due to 16-bit op? ? ? ? ? ? + + aka LD rr, (src) + */ + m_cycles += 4; + const uint16_t val = RM16(srcaddr); set_reg16(opbyte1 & 0x3, val); set_JF(); @@ -133,7 +133,21 @@ void tlcs870_device::do_LD_rr_insrc(const uint8_t opbyte0, const uint8_t opbyte1 void tlcs870_device::do_INC_insrc(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr) { - // INC (src) + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + INC (x) not listed, redundant encoding? ? ? ? ? ? + INC (PC+A) 1110 0001 0010 0000 C Z - - 6 + INC (DE) 1110 0010 0010 0000 C Z - - 4 + INC (HL) not listed, redundant encoding? ? ? ? ? ? + INC (HL+d) 1110 0100 dddd dddd 0010 0000 C Z - - 6 + INC (HL+C) 1110 0101 0010 0000 C Z - - 6 + INC (HL+) 1110 0110 0010 0000 C Z - - 5 + INC (-HL) 1110 0111 0010 0000 C Z - - 5 + + aka INC (src) + */ + m_cycles += 4; + uint8_t val = RM8(srcaddr); val++; @@ -153,7 +167,21 @@ void tlcs870_device::do_INC_insrc(const uint8_t opbyte0, const uint8_t opbyte1, void tlcs870_device::do_DEC_insrc(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr) { - // DEC (src) + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + DEC (x) not listed, redundant encoding? ? ? ? ? ? + DEC (PC+A) 1110 0001 0010 1000 C Z - - 6 + DEC (DE) 1110 0010 0010 1000 C Z - - 4 + DEC (HL) not listed, redundant encoding? ? ? ? ? ? + DEC (HL+d) 1110 0100 dddd dddd 0010 1000 C Z - - 6 + DEC (HL+C) 1110 0101 0010 1000 C Z - - 6 + DEC (HL+) 1110 0110 0010 1000 C Z - - 5 + DEC (-HL) 1110 0111 0010 1000 C Z - - 5 + + aka DEC (src) + */ + m_cycles += 4; + uint8_t val = RM8(srcaddr); val--; @@ -173,7 +201,7 @@ void tlcs870_device::do_DEC_insrc(const uint8_t opbyte0, const uint8_t opbyte1, } else { - set_ZF(); + clear_ZF(); } WM8(srcaddr, val); @@ -181,8 +209,22 @@ void tlcs870_device::do_DEC_insrc(const uint8_t opbyte0, const uint8_t opbyte1, void tlcs870_device::do_ROLD_A_insrc(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr) { - // ROLD A,(src) - // 12-bit left rotation using lower 4 bits of REG_A and content of (src) + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + ROLD A, (x) 1110 0000 xxxx xxxx 0000 1000 1 0 0 0 8 + ROLD A, (PC+A) not listed, invalid? ? ? ? ? ? + ROLD A, (DE) 1110 0010 0000 1000 1 0 0 0 7 + ROLD A, (HL) 1110 0011 0000 1000 1 0 0 0 7 + ROLD A, (HL+d) 1110 0100 dddd dddd 0000 1000 1 0 0 0 9 + ROLD A, (HL+C) 1110 0101 0000 1000 1 0 0 0 9 + ROLD A, (HL+) 1110 0110 0000 1000 1 0 0 0 8 + ROLD A, (-HL) 1110 0111 0000 1000 1 0 0 0 8 + + aka ROLD A,(src) + 12-bit left rotation using lower 4 bits of REG_A and content of (src) + */ + m_cycles += 7; + const uint8_t val = RM8(srcaddr); const uint8_t reg = get_reg8(REG_A); @@ -193,13 +235,27 @@ void tlcs870_device::do_ROLD_A_insrc(const uint8_t opbyte0, const uint8_t opbyte set_reg8(REG_A, tempa); WM8(srcaddr, tempval); - // TODO: flags + set_JF(); } void tlcs870_device::do_RORD_A_insrc(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr) { - // RORD A,(src) - // 12-bit right rotation using lower 4 bits of REG_A and content of (src) + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + RORD A, (x) 1110 0000 xxxx xxxx 0000 1001 1 0 0 0 8 + RORD A, (PC+A) not listed, invalid? ? ? ? ? ? + RORD A, (DE) 1110 0010 0000 1001 1 0 0 0 7 + RORD A, (HL) 1110 0011 0000 1001 1 0 0 0 7 + RORD A, (HL+d) 1110 0100 dddd dddd 0000 1001 1 0 0 0 9 + RORD A, (HL+C) 1110 0101 0000 1001 1 0 0 0 9 + RORD A, (HL+) 1110 0110 0000 1001 1 0 0 0 8 + RORD A, (-HL) 1110 0111 0000 1001 1 0 0 0 8 + + aka RORD A,(src) + 12-bit right rotation using lower 4 bits of REG_A and content of (src) + */ + m_cycles += 7; + const uint8_t val = RM8(srcaddr); const uint8_t reg = get_reg8(REG_A); @@ -210,15 +266,28 @@ void tlcs870_device::do_RORD_A_insrc(const uint8_t opbyte0, const uint8_t opbyte set_reg8(REG_A, tempa); WM8(srcaddr, tempval); - // TODO: flags + set_JF(); } void tlcs870_device::do_LD_inx_insrc(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr) { - // LD (x),(src) - // invalid if (src) is also (x) ? (not specified) + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD (x), (x) not listed, invalid? or redundant? ? ? ? ? ? + LD (x), (PC+A) 1110 0001 0010 0110 xxxx xxxx 1 U - - 7 + LD (x), (DE) 1110 0010 0010 0110 xxxx xxxx 1 U - - 5 + LD (x), (HL) 1110 0011 0010 0110 xxxx xxxx 1 U - - 5 + LD (x), (HL+d) 1110 0100 dddd dddd 0010 0110 xxxx xxxx 1 U - - 7 + LD (x), (HL+C) 1110 0101 0010 0110 xxxx xxxx 1 U - - 7 + LD (x), (HL+) not listed, invalid? ? ? ? ? ? + LD (x), (-HL) not listed, invalid? ? ? ? ? ? + + aka LD (x),(src) + */ + m_cycles += 5; + const uint16_t x = READ8(); // get address x const uint8_t val = RM8(srcaddr); WM8(x, val); @@ -229,11 +298,23 @@ void tlcs870_device::do_LD_inx_insrc(const uint8_t opbyte0, const uint8_t opbyte void tlcs870_device::do_LD_inHL_insrc(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr) { - // LD (HL),(src) - const uint8_t val = RM8(srcaddr); + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD (HL), (x) 1110 0000 xxxx xxxx 0010 0111 1 Z - - 5 + LD (HL), (PC+A) 1110 0001 0010 0111 1 Z - - 6 + LD (HL), (DE) 1110 0010 0010 0111 1 Z - - 4 + LD (HL), (HL) 1110 0011 0010 0111 1 Z - - 4 + LD (HL), (HL+d) 1110 0100 dddd dddd 0010 0111 1 Z - - 6 + LD (HL), (HL+C) 1110 0101 0010 0111 1 Z - - 6 + LD (HL), (HL+) not listed, invalid? ? ? ? ? ? + LD (HL), (-HL) not listed, invalid? ? ? ? ? ? + + aka LD (HL),(src) + */ + m_cycles += 4; + const uint8_t val = RM8(srcaddr); const uint16_t dstaddr = get_reg16(REG_HL); - WM8(dstaddr, val); set_JF(); @@ -244,7 +325,21 @@ void tlcs870_device::do_LD_inHL_insrc(const uint8_t opbyte0, const uint8_t opbyt void tlcs870_device::do_LD_r_insrc(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr) { - // LD r, (src) + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD r, (x) 1110 0000 xxxx xxxx 0101 1rrr 1 Z - - 4 + LD r, (PC+A) 1110 0001 0101 1rrr 1 Z - - 5 + LD r, (DE) 1110 0010 0101 1rrr 1 Z - - 3 + LD r, (HL) 1110 0011 0101 1rrr 1 Z - - 3 + LD r, (HL+d) 1110 0100 dddd dddd 0101 1rrr 1 Z - - 5 + LD r, (HL+C) 1110 0101 0101 1rrr 1 Z - - 5 + LD r, (HL+) 1110 0110 0101 1rrr 1 Z - - 4 (invalid if r is H or L) + LD r, (-HL) 1110 0111 0101 1rrr 1 Z - - 4 + + aka LD r, (src) + */ + m_cycles += 3; + const uint8_t val = RM8(srcaddr); set_reg8(opbyte1 & 0x7, val); @@ -257,7 +352,21 @@ void tlcs870_device::do_LD_r_insrc(const uint8_t opbyte0, const uint8_t opbyte1, void tlcs870_device::do_MCMP_insrc_n(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr) { - // MCMP (src), n + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + MCMP (x), n 1110 0000 xxxx xxxx 0010 1111 nnnn nnnn Z Z C H 6 + MCMP (PC+A), n 1110 0001 0010 1111 nnnn nnnn Z Z C H 7 + MCMP (DE), n 1110 0010 0010 1111 nnnn nnnn Z Z C H 5 + MCMP (HL), n 1110 0011 0010 1111 nnnn nnnn Z Z C H 5 + MCMP (HL+d), n 1110 0100 dddd dddd 0010 1111 nnnn nnnn Z Z C H 7 + MCMP (HL+C), n 1110 0101 0010 1111 nnnn nnnn Z Z C H 7 + MCMP (HL+), n 1110 0110 0010 1111 nnnn nnnn Z Z C H 6 + MCMP (-HL), n 1110 0111 0010 1111 nnnn nnnn Z Z C H 6 + + aka MCMP (src), n + */ + m_cycles += 5; + const uint8_t n = READ8(); const uint8_t val = RM8(srcaddr); @@ -292,7 +401,21 @@ void tlcs870_device::do_MCMP_insrc_n(const uint8_t opbyte0, const uint8_t opbyte void tlcs870_device::do_XCH_r_insrc(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr) { - // XCH r,(src) + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + XCH r, (x) 1110 0000 xxxx xxxx 1010 1rrr 1 Z - - 5 + XCH r, (PC+A) 1110 0001 1010 1rrr 1 Z - - 6 + XCH r, (DE) 1110 0010 1010 1rrr 1 Z - - 4 + XCH r, (HL) 1110 0011 1010 1rrr 1 Z - - 4 + XCH r, (HL+d) 1110 0100 dddd dddd 1010 1rrr 1 Z - - 6 + XCH r, (HL+C) 1110 0101 1010 1rrr 1 Z - - 6 + XCH r, (HL+) 1110 0110 1010 1rrr 1 Z - - 5 (invalid if r is H or L) + XCH r, (-HL) 1110 0111 1010 1rrr 1 Z - - 5 + + aka XCH r,(src) + */ + m_cycles += 4; + const uint8_t val = RM8(srcaddr); const uint8_t temp = get_reg8(opbyte1 & 0x7); @@ -318,7 +441,84 @@ void tlcs870_device::do_XCH_r_insrc(const uint8_t opbyte0, const uint8_t opbyte1 void tlcs870_device::do_ALUOP_insrc_inHL(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr) { - // (ALU OP) (src), (HL) + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + ADDC (x), (HL) 1110 0000 xxxx xxxx 0110 0000 C Z C H 7 + ADDC (PC+A), (HL) 1110 0001 0110 0000 C Z C H 8 + ADDC (DE), (HL) 1110 0010 0110 0000 C Z C H 6 + ADDC (HL), (HL) 1110 0011 0110 0000 C Z C H 6 + ADDC (HL+d), (HL) 1110 0100 dddd dddd 0110 0000 C Z C H 8 + ADDC (HL+C), (HL) 1110 0101 0110 0000 C Z C H 8 + ADDC (HL+), (HL) not listed, invalid? ? ? ? ? ? + ADDC (-HL), (HL) not listed, invalid? ? ? ? ? ? + + ADD (x), (HL) 1110 0000 xxxx xxxx 0110 0001 C Z C H 7 + ADD (PC+A), (HL) 1110 0001 0110 0001 C Z C H 8 + ADD (DE), (HL) 1110 0010 0110 0001 C Z C H 6 + ADD (HL), (HL) 1110 0011 0110 0001 C Z C H 6 + ADD (HL+d), (HL) 1110 0100 dddd dddd 0110 0001 C Z C H 8 + ADD (HL+C), (HL) 1110 0101 0110 0001 C Z C H 8 + ADD (HL+), (HL) not listed, invalid? ? ? ? ? ? + ADD (-HL), (HL) not listed, invalid? ? ? ? ? ? + + SUBB (x), (HL) 1110 0000 xxxx xxxx 0110 0010 C Z C H 7 + SUBB (PC+A), (HL) 1110 0001 0110 0010 C Z C H 8 + SUBB (DE), (HL) 1110 0010 0110 0010 C Z C H 6 + SUBB (HL), (HL) 1110 0011 0110 0010 C Z C H 6 + SUBB (HL+d), (HL) 1110 0100 dddd dddd 0110 0010 C Z C H 8 + SUBB (HL+C), (HL) 1110 0101 0110 0010 C Z C H 8 + SUBB (HL+), (HL) not listed, invalid? ? ? ? ? ? + SUBB (-HL), (HL) not listed, invalid? ? ? ? ? ? + + SUB (x), (HL) 1110 0000 xxxx xxxx 0110 0011 C Z C H 7 + SUB (PC+A), (HL) 1110 0001 0110 0011 C Z C H 8 + SUB (DE), (HL) 1110 0010 0110 0011 C Z C H 6 + SUB (HL), (HL) 1110 0011 0110 0011 C Z C H 6 + SUB (HL+d), (HL) 1110 0100 dddd dddd 0110 0011 C Z C H 8 + SUB (HL+C), (HL) 1110 0101 0110 0011 C Z C H 8 + SUB (HL+), (HL) not listed, invalid? ? ? ? ? ? + SUB (-HL), (HL) not listed, invalid? ? ? ? ? ? + + AND (x), (HL) 1110 0000 xxxx xxxx 0110 0100 Z Z - - 7 + AND (PC+A), (HL) 1110 0001 0110 0100 Z Z - - 8 + AND (DE), (HL) 1110 0010 0110 0100 Z Z - - 6 + AND (HL), (HL) 1110 0011 0110 0100 Z Z - - 6 + AND (HL+d), (HL) 1110 0100 dddd dddd 0110 0100 Z Z - - 8 + AND (HL+C), (HL) 1110 0101 0110 0100 Z Z - - 8 + AND (HL+), (HL) not listed, invalid? ? ? ? ? ? + AND (-HL), (HL) not listed, invalid? ? ? ? ? ? + + XOR (x), (HL) 1110 0000 xxxx xxxx 0110 0101 Z Z - - 7 + XOR (PC+A), (HL) 1110 0001 0110 0101 Z Z - - 8 + XOR (DE), (HL) 1110 0010 0110 0101 Z Z - - 6 + XOR (HL), (HL) 1110 0011 0110 0101 Z Z - - 6 + XOR (HL+d), (HL) 1110 0100 dddd dddd 0110 0101 Z Z - - 8 + XOR (HL+C), (HL) 1110 0101 0110 0101 Z Z - - 8 + XOR (HL+), (HL) not listed, invalid? ? ? ? ? ? + XOR (-HL), (HL) not listed, invalid? ? ? ? ? ? + + OR (x), (HL) 1110 0000 xxxx xxxx 0110 0110 Z Z - - 7 + OR (PC+A), (HL) 1110 0001 0110 0110 Z Z - - 8 + OR (DE), (HL) 1110 0010 0110 0110 Z Z - - 6 + OR (HL), (HL) 1110 0011 0110 0110 Z Z - - 6 + OR (HL+d), (HL) 1110 0100 dddd dddd 0110 0110 Z Z - - 8 + OR (HL+C), (HL) 1110 0101 0110 0110 Z Z - - 8 + OR (HL+), (HL) not listed, invalid? ? ? ? ? ? + OR (-HL), (HL) not listed, invalid? ? ? ? ? ? + + CMP (x), (HL) 1110 0000 xxxx xxxx 0110 0111 Z Z C H 6 + CMP (PC+A), (HL) 1110 0001 0110 0111 Z Z C H 7 + CMP (DE), (HL) 1110 0010 0110 0111 Z Z C H 5 + CMP (HL), (HL) 1110 0011 0110 0111 Z Z C H 5 + CMP (HL+d), (HL) 1110 0100 dddd dddd 0110 0111 Z Z C H 7 + CMP (HL+C), (HL) 1110 0101 0110 0111 Z Z C H 7 + CMP (HL+), (HL) not listed, invalid? ? ? ? ? ? + CMP (-HL), (HL) not listed, invalid? ? ? ? ? ? + + aka (ALU OP) (src), (HL) + */ + m_cycles += 6; + const int aluop = (opbyte1 & 0x7); const uint8_t val = RM8(srcaddr); @@ -328,13 +528,91 @@ void tlcs870_device::do_ALUOP_insrc_inHL(const uint8_t opbyte0, const uint8_t op if (aluop != 0x07) // CMP doesn't write back { + m_cycles -= 1; // one less for CMP here? WM8(srcaddr, result); } } void tlcs870_device::do_ALUOP_insrc_n(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr) { - // (ALU OP) (src), n + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + ADDC (x), n 1110 0000 xxxx xxxx 0111 0000 nnnn nnnn C Z C H 6 + ADDC (PC+A), n 1110 0001 0111 0000 nnnn nnnn C Z C H 7 + ADDC (DE), n 1110 0010 0111 0000 nnnn nnnn C Z C H 5 + ADDC (HL), n 1110 0011 0111 0000 nnnn nnnn C Z C H 5 + ADDC (HL+d), n 1110 0100 dddd dddd 0111 0000 nnnn nnnn C Z C H 7 + ADDC (HL+C), n 1110 0101 0111 0000 nnnn nnnn C Z C H 7 + ADDC (HL+), n 1110 0110 0111 0000 nnnn nnnn C Z C H 6 + ADDC (-HL), n 1110 0111 0111 0000 nnnn nnnn C Z C H 6 + + ADD (x), n 1110 0000 xxxx xxxx 0111 0001 nnnn nnnn C Z C H 6 + ADD (PC+A), n 1110 0001 0111 0001 nnnn nnnn C Z C H 7 + ADD (DE), n 1110 0010 0111 0001 nnnn nnnn C Z C H 5 + ADD (HL), n 1110 0011 0111 0001 nnnn nnnn C Z C H 5 + ADD (HL+d), n 1110 0100 dddd dddd 0111 0001 nnnn nnnn C Z C H 7 + ADD (HL+C), n 1110 0101 0111 0001 nnnn nnnn C Z C H 7 + ADD (HL+), n 1110 0110 0111 0001 nnnn nnnn C Z C H 6 + ADD (-HL), n 1110 0111 0111 0001 nnnn nnnn C Z C H 6 + + SUBB (x), n 1110 0000 xxxx xxxx 0111 0010 nnnn nnnn C Z C H 6 + SUBB (PC+A), n 1110 0001 0111 0010 nnnn nnnn C Z C H 7 + SUBB (DE), n 1110 0010 0111 0010 nnnn nnnn C Z C H 5 + SUBB (HL), n 1110 0011 0111 0010 nnnn nnnn C Z C H 5 + SUBB (HL+d), n 1110 0100 dddd dddd 0111 0010 nnnn nnnn C Z C H 7 + SUBB (HL+C), n 1110 0101 0111 0010 nnnn nnnn C Z C H 7 + SUBB (HL+), n 1110 0110 0111 0010 nnnn nnnn C Z C H 6 + SUBB (-HL), n 1110 0111 0111 0010 nnnn nnnn C Z C H 6 + + SUB (x), n 1110 0000 xxxx xxxx 0111 0011 nnnn nnnn C Z C H 6 + SUB (PC+A), n 1110 0001 0111 0011 nnnn nnnn C Z C H 7 + SUB (DE), n 1110 0010 0111 0011 nnnn nnnn C Z C H 5 + SUB (HL), n 1110 0011 0111 0011 nnnn nnnn C Z C H 5 + SUB (HL+d), n 1110 0100 dddd dddd 0111 0011 nnnn nnnn C Z C H 7 + SUB (HL+C), n 1110 0101 0111 0011 nnnn nnnn C Z C H 7 + SUB (HL+), n 1110 0110 0111 0011 nnnn nnnn C Z C H 6 + SUB (-HL), n 1110 0111 0111 0011 nnnn nnnn C Z C H 6 + + AND (x), n 1110 0000 xxxx xxxx 0111 0100 nnnn nnnn Z Z - - 6 + AND (PC+A), n 1110 0001 0111 0100 nnnn nnnn Z Z - - 7 + AND (DE), n 1110 0010 0111 0100 nnnn nnnn Z Z - - 5 + AND (HL), n 1110 0011 0111 0100 nnnn nnnn Z Z - - 5 + AND (HL+d), n 1110 0100 dddd dddd 0111 0100 nnnn nnnn Z Z - - 7 + AND (HL+C), n 1110 0101 0111 0100 nnnn nnnn Z Z - - 7 + AND (HL+), n 1110 0110 0111 0100 nnnn nnnn Z Z - - 6 + AND (-HL), n 1110 0111 0111 0100 nnnn nnnn Z Z - - 6 + + XOR (x), n 1110 0000 xxxx xxxx 0111 0101 nnnn nnnn Z Z - - 6 + XOR (PC+A), n 1110 0001 0111 0101 nnnn nnnn Z Z - - 7 + XOR (DE), n 1110 0010 0111 0101 nnnn nnnn Z Z - - 5 + XOR (HL), n 1110 0011 0111 0101 nnnn nnnn Z Z - - 5 + XOR (HL+d), n 1110 0100 dddd dddd 0111 0101 nnnn nnnn Z Z - - 7 + XOR (HL+C), n 1110 0101 0111 0101 nnnn nnnn Z Z - - 7 + XOR (HL+), n 1110 0110 0111 0101 nnnn nnnn Z Z - - 6 + XOR (-HL), n 1110 0111 0111 0101 nnnn nnnn Z Z - - 6 + + OR (x), n 1110 0000 xxxx xxxx 0111 0110 nnnn nnnn Z Z - - 6 + OR (PC+A), n 1110 0001 0111 0110 nnnn nnnn Z Z - - 7 + OR (DE), n 1110 0010 0111 0110 nnnn nnnn Z Z - - 5 + OR (HL), n 1110 0011 0111 0110 nnnn nnnn Z Z - - 5 + OR (HL+d), n 1110 0100 dddd dddd 0111 0110 nnnn nnnn Z Z - - 7 + OR (HL+C), n 1110 0101 0111 0110 nnnn nnnn Z Z - - 7 + OR (HL+), n 1110 0110 0111 0110 nnnn nnnn Z Z - - 6 + OR (-HL), n 1110 0111 0111 0110 nnnn nnnn Z Z - - 6 + + CMP (x), n 1110 0000 xxxx xxxx 0111 0111 nnnn nnnn Z Z C H 5 + CMP (PC+A), n 1110 0001 0111 0111 nnnn nnnn Z Z C H 6 + CMP (DE), n 1110 0010 0111 0111 nnnn nnnn Z Z C H 4 + CMP (HL), n 1110 0011 0111 0111 nnnn nnnn Z Z C H 4 + CMP (HL+d), n 1110 0100 dddd dddd 0111 0111 nnnn nnnn Z Z C H 6 + CMP (HL+C), n 1110 0101 0111 0111 nnnn nnnn Z Z C H 6 + CMP (HL+), n 1110 0110 0111 0111 nnnn nnnn Z Z C H 5 + CMP (-HL), n 1110 0111 0111 0111 nnnn nnnn Z Z C H 5 + + aka (ALU OP) (src), n + */ + m_cycles += 5; + const uint8_t n = READ8(); const int aluop = (opbyte1 & 0x7); @@ -344,13 +622,91 @@ void tlcs870_device::do_ALUOP_insrc_n(const uint8_t opbyte0, const uint8_t opbyt if (aluop != 0x07) // CMP doesn't write back { + m_cycles -= 1; // one less for CMP here? WM8(srcaddr, result); } } void tlcs870_device::do_ALUOP_A_insrc(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr) { - // (ALU OP) A, (src) + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + ADDC A, (x) 1110 0000 xxxx xxxx 0111 1000 C Z C H 4 + ADDC A, (PC+A) 1110 0001 0111 1000 C Z C H 5 + ADDC A, (DE) 1110 0010 0111 1000 C Z C H 3 + ADDC A, (HL) 1110 0011 0111 1000 C Z C H 3 + ADDC A, (HL+d) 1110 0100 dddd dddd 0111 1000 C Z C H 5 + ADDC A, (HL+C) 1110 0101 0111 1000 C Z C H 5 + ADDC A, (HL+) 1110 0110 0111 1000 C Z C H 4 + ADDC A, (-HL) 1110 0111 0111 1000 C Z C H 4 + + ADD A, (x) 1110 0000 xxxx xxxx 0111 1001 C Z C H 4 + ADD A, (PC+A) 1110 0001 0111 1001 C Z C H 5 + ADD A, (DE) 1110 0010 0111 1001 C Z C H 3 + ADD A, (HL) 1110 0011 0111 1001 C Z C H 3 + ADD A, (HL+d) 1110 0100 dddd dddd 0111 1001 C Z C H 5 + ADD A, (HL+C) 1110 0101 0111 1001 C Z C H 5 + ADD A, (HL+) 1110 0110 0111 1001 C Z C H 4 + ADD A, (-HL) 1110 0111 0111 1001 C Z C H 4 + + SUBB A, (x) 1110 0000 xxxx xxxx 0111 1010 C Z C H 4 + SUBB A, (PC+A) 1110 0001 0111 1010 C Z C H 5 + SUBB A, (DE) 1110 0010 0111 1010 C Z C H 3 + SUBB A, (HL) 1110 0011 0111 1010 C Z C H 3 + SUBB A, (HL+d) 1110 0100 dddd dddd 0111 1010 C Z C H 5 + SUBB A, (HL+C) 1110 0101 0111 1010 C Z C H 5 + SUBB A, (HL+) 1110 0110 0111 1010 C Z C H 4 + SUBB A, (-HL) 1110 0111 0111 1010 C Z C H 4 + + SUB A, (x) 1110 0000 xxxx xxxx 0111 1011 C Z C H 4 + SUB A, (PC+A) 1110 0001 0111 1011 C Z C H 5 + SUB A, (DE) 1110 0010 0111 1011 C Z C H 3 + SUB A, (HL) 1110 0011 0111 1011 C Z C H 3 + SUB A, (HL+d) 1110 0100 dddd dddd 0111 1011 C Z C H 5 + SUB A, (HL+C) 1110 0101 0111 1011 C Z C H 5 + SUB A, (HL+) 1110 0110 0111 1011 C Z C H 4 + SUB A, (-HL) 1110 0111 0111 1011 C Z C H 4 + + AND A, (x) 1110 0000 xxxx xxxx 0111 1100 Z Z - - 4 + AND A, (PC+A) 1110 0001 0111 1100 Z Z - - 5 + AND A, (DE) 1110 0010 0111 1100 Z Z - - 3 + AND A, (HL) 1110 0011 0111 1100 Z Z - - 3 + AND A, (HL+d) 1110 0100 dddd dddd 0111 1100 Z Z - - 5 + AND A, (HL+C) 1110 0101 0111 1100 Z Z - - 5 + AND A, (HL+) 1110 0110 0111 1100 Z Z - - 4 + AND A, (-HL) 1110 0111 0111 1100 Z Z - - 4 + + XOR A, (x) 1110 0000 xxxx xxxx 0111 1101 Z Z - - 4 + XOR A, (PC+A) 1110 0001 0111 1101 Z Z - - 5 + XOR A, (DE) 1110 0010 0111 1101 Z Z - - 3 + XOR A, (HL) 1110 0011 0111 1101 Z Z - - 3 + XOR A, (HL+d) 1110 0100 dddd dddd 0111 1101 Z Z - - 5 + XOR A, (HL+C) 1110 0101 0111 1101 Z Z - - 5 + XOR A, (HL+) 1110 0110 0111 1101 Z Z - - 4 + XOR A, (-HL) 1110 0111 0111 1101 Z Z - - 4 + + OR A, (x) 1110 0000 xxxx xxxx 0111 1110 Z Z - - 4 + OR A, (PC+A) 1110 0001 0111 1110 Z Z - - 5 + OR A, (DE) 1110 0010 0111 1110 Z Z - - 3 + OR A, (HL) 1110 0011 0111 1110 Z Z - - 3 + OR A, (HL+d) 1110 0100 dddd dddd 0111 1110 Z Z - - 5 + OR A, (HL+C) 1110 0101 0111 1110 Z Z - - 5 + OR A, (HL+) 1110 0110 0111 1110 Z Z - - 4 + OR A, (-HL) 1110 0111 0111 1110 Z Z - - 4 + + CMP A, (x) 1110 0000 xxxx xxxx 0111 1111 Z Z C H 4 + CMP A, (PC+A) 1110 0001 0111 1111 Z Z C H 5 + CMP A, (DE) 1110 0010 0111 1111 Z Z C H 3 + CMP A, (HL) 1110 0011 0111 1111 Z Z C H 3 + CMP A, (HL+d) 1110 0100 dddd dddd 0111 1111 Z Z C H 5 + CMP A, (HL+C) 1110 0101 0111 1111 Z Z C H 5 + CMP A, (HL+) 1110 0110 0111 1111 Z Z C H 4 + CMP A, (-HL) 1110 0111 0111 1111 Z Z C H 4 + + aka (ALU OP) A, (src) + */ + m_cycles += 3; + const int aluop = (opbyte1 & 0x7); const uint8_t val = RM8(srcaddr); @@ -358,6 +714,7 @@ void tlcs870_device::do_ALUOP_A_insrc(const uint8_t opbyte0, const uint8_t opbyt if (aluop != 0x07) // CMP doesn't write back { + // NOT one less for CMP here? set_reg8(REG_A, result); } } @@ -368,7 +725,21 @@ void tlcs870_device::do_ALUOP_A_insrc(const uint8_t opbyte0, const uint8_t opbyt void tlcs870_device::do_CALL_insrc(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr) { - // CALL (src) + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + CALL (x) 1110 0000 xxxx xxxx 1111 1100 - - - - 9 + CALL (PC+A) 1110 0001 1111 1100 - - - - 10 + CALL (DE) 1110 0010 1111 1100 - - - - 8 + CALL (HL) 1110 0011 1111 1100 - - - - 8 + CALL (HL+d) 1110 0100 dddd dddd 1111 1100 - - - - 10 + CALL (HL+C) 1110 0101 1111 1100 - - - - 10 + CALL (HL+) not listed, invalid due to 16-bit op? ? ? ? ? ? + CALL (-HL) not listed, invalid due to 16-bit op? ? ? ? ? ? + + aka CALL (src) + */ + m_cycles += 8; + const uint16_t val = RM16(srcaddr); WM16(m_sp.d - 1, m_addr); @@ -381,7 +752,21 @@ void tlcs870_device::do_CALL_insrc(const uint8_t opbyte0, const uint8_t opbyte1, void tlcs870_device::do_JP_insrc(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr) { - // JP (src) + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + JP (x) 1110 0000 xxxx xxxx 1111 1110 1 - - - 6 + JP (PC+A) 1110 0001 1111 1110 1 - - - 7 + JP (DE) 1110 0010 1111 1110 1 - - - 5 + JP (HL) 1110 0011 1111 1110 1 - - - 5 + JP (HL+d) 1110 0100 dddd dddd 1111 1110 1 - - - 7 + JP (HL+C) 1110 0101 1111 1110 1 - - - 7 + JP (HL+) not listed, invalid due to 16-bit op? ? ? ? ? ? + JP (-HL) not listed, invalid due to 16-bit op? ? ? ? ? ? + + aka JP (src) + */ + m_cycles += 5; + const uint16_t val = RM16(srcaddr); m_addr = val; set_JF(); @@ -393,7 +778,21 @@ void tlcs870_device::do_JP_insrc(const uint8_t opbyte0, const uint8_t opbyte1, c void tlcs870_device::do_XOR_CF_insrcbit(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr) { - // XOR CF,(src).b + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + XOR CF, (x).b 1110 0000 xxxx xxxx 1101 0bbb ~C - * - 4 + XOR CF, (PC+A).b 1110 0001 1101 0bbb ~C - * - 5 + XOR CF, (DE).b 1110 0010 1101 0bbb ~C - * - 3 + XOR CF, (HL).b 1110 0011 1101 0bbb ~C - * - 3 + XOR CF, (HL+d).b 1110 0100 dddd dddd 1101 0bbb ~C - * - 5 + XOR CF, (HL+C).b 1110 0101 1101 0bbb ~C - * - 5 + XOR CF, (HL+).b 1110 0110 1101 0bbb ~C - * - 4 + XOR CF, (-HL).b 1110 0111 1101 0bbb ~C - * - 4 + + aka XOR CF,(src).b + */ + m_cycles += 3; + const uint8_t val = RM8(srcaddr); const uint8_t bitpos = opbyte1 & 0x7; @@ -434,7 +833,21 @@ void tlcs870_device::do_XOR_CF_insrcbit(const uint8_t opbyte0, const uint8_t opb void tlcs870_device::do_LD_insrcbit_CF(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr) { - // LD (src).b,CF + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD (x).b, CF 1110 0000 xxxx xxxx 1100 1bbb 1 - - - 5 + LD (PC+A).b, CF 1110 0001 1100 1bbb 1 - - - 6 + LD (DE).b, CF 1110 0010 1100 1bbb 1 - - - 4 + LD (HL).b, CF 1110 0011 1100 1bbb 1 - - - 4 + LD (HL+d).b, CF 1110 0100 dddd dddd 1100 1bbb 1 - - - 6 + LD (HL+C).b, CF 1110 0101 1100 1bbb 1 - - - 6 + LD (HL+).b, CF 1110 0110 1100 1bbb 1 - - - 5 + LD (-HL).b, CF 1110 0111 1100 1bbb 1 - - - 5 + + aka LD (src).b,CF + */ + m_cycles += 4; + uint8_t val = RM8(srcaddr); const uint8_t bitpos = opbyte1 & 0x7; @@ -457,7 +870,21 @@ void tlcs870_device::do_LD_insrcbit_CF(const uint8_t opbyte0, const uint8_t opby void tlcs870_device::do_CPL_insrcbit(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr) { - // CPL (src).b + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + CPL (x).b 1110 0000 xxxx xxxx 1100 0bbb Z * - - 5 + CPL (PC+A).b 1110 0001 1100 0bbb Z * - - 6 + CPL (DE).b 1110 0010 1100 0bbb Z * - - 4 + CPL (HL).b 1110 0011 1100 0bbb Z * - - 4 + CPL (HL+d).b 1110 0100 dddd dddd 1100 0bbb Z * - - 6 + CPL (HL+C).b 1110 0101 1100 0bbb Z * - - 6 + CPL (HL+).b 1110 0110 1100 0bbb Z * - - 5 + CPL (-HL).b 1110 0111 1100 0bbb Z * - - 5 + + aka CPL (src).b + */ + m_cycles += 4; + uint8_t val = RM8(srcaddr); const uint8_t bitpos = opbyte1 & 0x7; @@ -485,7 +912,21 @@ void tlcs870_device::do_CPL_insrcbit(const uint8_t opbyte0, const uint8_t opbyte void tlcs870_device::do_LD_CF_insrcbit(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr) { - // LD CF,(src).b aka TEST (src).b + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + LD CF, (x).b 1110 0000 xxxx xxxx 1101 1bbb ~C - * - 4 + LD CF, (PC+A).b 1110 0001 1101 1bbb ~C - * - 5 + LD CF, (DE).b 1110 0010 1101 1bbb ~C - * - 3 + LD CF, (HL).b 1110 0011 1101 1bbb ~C - * - 3 + LD CF, (HL+d).b 1110 0100 dddd dddd 1101 1bbb ~C - * - 5 + LD CF, (HL+C).b 1110 0101 1101 1bbb ~C - * - 5 + LD CF, (HL+).b 1110 0110 1101 1bbb ~C - * - 4 + LD CF, (-HL).b 1110 0111 1101 1bbb ~C - * - 4 + + aka LD CF,(src).b or TEST (src).b + */ + m_cycles += 3; + const uint8_t val = RM8(srcaddr); const uint8_t bitpos = opbyte1 & 0x7; @@ -500,7 +941,21 @@ void tlcs870_device::do_LD_CF_insrcbit(const uint8_t opbyte0, const uint8_t opby void tlcs870_device::do_SET_insrcbit(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr) { - // SET (src).b + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + SET (x).b 1110 0000 xxxx xxxx 0100 0bbb Z * - - 5 + SET (PC+A).b 1110 0001 0100 0bbb Z * - - 6 + SET (DE).b 1110 0010 0100 0bbb Z * - - 4 + SET (HL).b 1110 0011 0100 0bbb Z * - - 4 + SET (HL+d).b 1110 0100 dddd dddd 0100 0bbb Z * - - 6 + SET (HL+C).b 1110 0101 0100 0bbb Z * - - 6 + SET (HL+).b 1110 0110 0100 0bbb Z * - - 5 + SET (-HL).b 1110 0111 0100 0bbb Z * - - 5 + + aka SET (src).b + */ + m_cycles += 4; + uint8_t val = RM8(srcaddr); const uint8_t bitpos = opbyte1 & 0x7; @@ -524,7 +979,21 @@ void tlcs870_device::do_SET_insrcbit(const uint8_t opbyte0, const uint8_t opbyte void tlcs870_device::do_CLR_insrcbit(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr) { - // CLR (src).b + /* + OP (opbyte0) (immval0) (opbyte1) (immval1) (immval2) JF ZF CF HF cycles + CLR (x).b 1110 0000 xxxx xxxx 0100 1bbb Z * - - 5 + CLR (PC+A).b 1110 0001 0100 1bbb Z * - - 6 + CLR (DE).b 1110 0010 0100 1bbb Z * - - 4 + CLR (HL).b 1110 0011 0100 1bbb Z * - - 4 + CLR (HL+d).b 1110 0100 dddd dddd 0100 1bbb Z * - - 6 + CLR (HL+C).b 1110 0101 0100 1bbb Z * - - 6 + CLR (HL+).b 1110 0110 0100 1bbb Z * - - 5 + CLR (-HL).b 1110 0111 0100 1bbb Z * - - 5 + + aka CLR (src).b + */ + m_cycles += 4; + uint8_t val = RM8(srcaddr); const uint8_t bitpos = opbyte1 & 0x7; diff --git a/src/mame/drivers/hng64.cpp b/src/mame/drivers/hng64.cpp index 6c4df6876cc..0ca4a5ea2e2 100644 --- a/src/mame/drivers/hng64.cpp +++ b/src/mame/drivers/hng64.cpp @@ -1532,6 +1532,25 @@ void hng64_state::machine_reset() reset_sound(); } +READ8_MEMBER(hng64_state::ioport0_r) { logerror("ioport0_r\n"); return 0xff; } +READ8_MEMBER(hng64_state::ioport1_r) { logerror("ioport1_r\n"); return 0xff; } +READ8_MEMBER(hng64_state::ioport2_r) { logerror("ioport2_r\n"); return 0xff; } +READ8_MEMBER(hng64_state::ioport3_r) { logerror("ioport3_r\n"); return 0xff; } +READ8_MEMBER(hng64_state::ioport4_r) { logerror("ioport4_r\n"); return 0xff; } +READ8_MEMBER(hng64_state::ioport5_r) { logerror("ioport5_r\n"); return 0xff; } +READ8_MEMBER(hng64_state::ioport6_r) { logerror("ioport6_r\n"); return 0xff; } +READ8_MEMBER(hng64_state::ioport7_r) { logerror("ioport7_r\n"); return 0xff; } + +WRITE8_MEMBER(hng64_state::ioport0_w) { logerror("ioport0_w %02x\n", data); } +WRITE8_MEMBER(hng64_state::ioport1_w) { logerror("ioport1_w %02x\n", data); } +WRITE8_MEMBER(hng64_state::ioport2_w) { logerror("ioport2_w %02x\n", data); } +WRITE8_MEMBER(hng64_state::ioport3_w) { logerror("ioport3_w %02x\n", data); } +WRITE8_MEMBER(hng64_state::ioport4_w) { logerror("ioport4_w %02x\n", data); } +WRITE8_MEMBER(hng64_state::ioport5_w) { logerror("ioport5_w %02x\n", data); } +WRITE8_MEMBER(hng64_state::ioport6_w) { logerror("ioport6_w %02x\n", data); } +WRITE8_MEMBER(hng64_state::ioport7_w) { logerror("ioport7_w %02x\n", data); } + + MACHINE_CONFIG_START(hng64_state::hng64) /* basic machine hardware */ MCFG_DEVICE_ADD("maincpu", VR4300BE, HNG64_MASTER_CLOCK) // actually R4300 @@ -1557,7 +1576,23 @@ MACHINE_CONFIG_START(hng64_state::hng64) hng64_audio(config); hng64_network(config); - MCFG_DEVICE_ADD("iomcu", TMP87PH40AN, 8000000) + tmp87ph40an_device &iomcu(TMP87PH40AN(config, m_iomcu, 8_MHz_XTAL)); + iomcu.p0_in_cb().set(FUNC(hng64_state::ioport0_r)); + iomcu.p1_in_cb().set(FUNC(hng64_state::ioport1_r)); + iomcu.p2_in_cb().set(FUNC(hng64_state::ioport2_r)); + iomcu.p3_in_cb().set(FUNC(hng64_state::ioport3_r)); + iomcu.p4_in_cb().set(FUNC(hng64_state::ioport4_r)); + iomcu.p5_in_cb().set(FUNC(hng64_state::ioport5_r)); + iomcu.p6_in_cb().set(FUNC(hng64_state::ioport6_r)); + iomcu.p7_in_cb().set(FUNC(hng64_state::ioport7_r)); + iomcu.p0_out_cb().set(FUNC(hng64_state::ioport0_w)); + iomcu.p1_out_cb().set(FUNC(hng64_state::ioport1_w)); + iomcu.p2_out_cb().set(FUNC(hng64_state::ioport2_w)); + iomcu.p3_out_cb().set(FUNC(hng64_state::ioport3_w)); + iomcu.p4_out_cb().set(FUNC(hng64_state::ioport4_w)); + iomcu.p5_out_cb().set(FUNC(hng64_state::ioport5_w)); + iomcu.p6_out_cb().set(FUNC(hng64_state::ioport6_w)); + iomcu.p7_out_cb().set(FUNC(hng64_state::ioport7_w)); MACHINE_CONFIG_END diff --git a/src/mame/includes/hng64.h b/src/mame/includes/hng64.h index 058b04f8e80..0e8ccfb1df7 100644 --- a/src/mame/includes/hng64.h +++ b/src/mame/includes/hng64.h @@ -143,6 +143,7 @@ public: m_palette(*this, "palette"), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), + m_iomcu(*this, "iomcu"), m_dsp(*this, "l7a1045"), m_comm(*this, "network"), m_rtc(*this, "rtc"), @@ -185,6 +186,7 @@ public: private: required_device m_maincpu; required_device m_audiocpu; + required_device m_iomcu; required_device m_dsp; required_device m_comm; required_device m_rtc; @@ -303,6 +305,24 @@ private: DECLARE_READ8_MEMBER(hng64_comm_mmu_r); DECLARE_WRITE8_MEMBER(hng64_comm_mmu_w); + DECLARE_READ8_MEMBER(ioport0_r); + DECLARE_READ8_MEMBER(ioport1_r); + DECLARE_READ8_MEMBER(ioport2_r); + DECLARE_READ8_MEMBER(ioport3_r); + DECLARE_READ8_MEMBER(ioport4_r); + DECLARE_READ8_MEMBER(ioport5_r); + DECLARE_READ8_MEMBER(ioport6_r); + DECLARE_READ8_MEMBER(ioport7_r); + + DECLARE_WRITE8_MEMBER(ioport0_w); + DECLARE_WRITE8_MEMBER(ioport1_w); + DECLARE_WRITE8_MEMBER(ioport2_w); + DECLARE_WRITE8_MEMBER(ioport3_w); + DECLARE_WRITE8_MEMBER(ioport4_w); + DECLARE_WRITE8_MEMBER(ioport5_w); + DECLARE_WRITE8_MEMBER(ioport6_w); + DECLARE_WRITE8_MEMBER(ioport7_w); + void init_hng64_reorder_gfx(); void set_irq(uint32_t irq_vector); -- cgit v1.2.3 From 45f81762666ed5e13dde3d27a1ef1033aae3c18b Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Thu, 26 Jul 2018 07:49:00 +0200 Subject: megaphx.cpp: verified megaphx pals as BAD_DUMP [caius] --- src/mame/drivers/megaphx.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mame/drivers/megaphx.cpp b/src/mame/drivers/megaphx.cpp index 6c1bcf6a1bb..128a35fa72b 100644 --- a/src/mame/drivers/megaphx.cpp +++ b/src/mame/drivers/megaphx.cpp @@ -439,9 +439,9 @@ ROM_START( megaphx ) ROM_LOAD( "pic16c54-xt.bin", 0x000000, 0x430, CRC(21f396fb) SHA1(c8badb9b3681e684bced0ced1de4c3a15641de8b) ) ROM_FILL(0x2c, 1, 0x01) // patch timer length or its too slow (pic issue?) - ROM_REGION( 0x100000, "pals", 0 ) // jedutil won't convert these? are they bad? - ROM_LOAD( "p31_u31_palce16v8h-25.jed", 0x000, 0xbd4, CRC(05ef04b7) SHA1(330dd81a832b6675fb0473868c26fe9bec2da854) ) - ROM_LOAD( "p40_u29_palce16v8h-25.jed", 0x000, 0xbd4, CRC(44b7e51c) SHA1(b8b34f3b319d664ec3ad72ed87d9f65701f183a5) ) + ROM_REGION( 0x1000, "pals", 0 ) // protected + ROM_LOAD( "p31_u31_palce16v8h-25.jed", 0x000, 0xbd4, BAD_DUMP CRC(05ef04b7) SHA1(330dd81a832b6675fb0473868c26fe9bec2da854) ) + ROM_LOAD( "p40_u29_palce16v8h-25.jed", 0x000, 0xbd4, BAD_DUMP CRC(44b7e51c) SHA1(b8b34f3b319d664ec3ad72ed87d9f65701f183a5) ) ROM_END ROM_START( hamboy ) -- cgit v1.2.3 From 796bb295d192b9a5ca7137a2614b191b348a550d Mon Sep 17 00:00:00 2001 From: Robbbert Date: Thu, 26 Jul 2018 21:08:35 +1000 Subject: slicer : fixed regression from last November. --- src/mame/drivers/slicer.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/mame/drivers/slicer.cpp b/src/mame/drivers/slicer.cpp index 1aba773c3c2..1094b65dcc9 100644 --- a/src/mame/drivers/slicer.cpp +++ b/src/mame/drivers/slicer.cpp @@ -28,6 +28,7 @@ public: private: DECLARE_WRITE8_MEMBER(sio_out_w); + DECLARE_WRITE_LINE_MEMBER(drive_size_w); template DECLARE_WRITE_LINE_MEMBER(drive_sel_w); void slicer_io(address_map &map); @@ -66,6 +67,11 @@ WRITE_LINE_MEMBER(slicer_state::drive_sel_w) m_fdc->set_floppy(floppy); } +WRITE_LINE_MEMBER(slicer_state::drive_size_w) +{ + m_fdc->set_unscaled_clock (state ? 1'000'000 : 2'000'000); +} + void slicer_state::slicer_map(address_map &map) { map(0x00000, 0x3ffff).ram(); // fixed 256k for now @@ -77,7 +83,7 @@ void slicer_state::slicer_io(address_map &map) map.unmap_value_high(); map(0x0000, 0x007f).rw(m_fdc, FUNC(fd1797_device::read), FUNC(fd1797_device::write)).umask16(0x00ff); //PCS0 map(0x0080, 0x00ff).rw("duart", FUNC(scn2681_device::read), FUNC(scn2681_device::write)).umask16(0x00ff); //PCS1 - map(0x0100, 0x0107).mirror(0x0078).w("drivelatch", FUNC(ls259_device::write_d0)).umask16(0x00ff); //PCS2 + map(0x0100, 0x010f).mirror(0x0070).w("drivelatch", FUNC(ls259_device::write_d0)).umask16(0x00ff); //PCS2 // TODO: 0x180 sets ack map(0x0180, 0x0180).r("sasi_data_in", FUNC(input_buffer_device::bus_r)).w("sasi_data_out", FUNC(output_latch_device::bus_w)).umask16(0x00ff); //PCS3 map(0x0181, 0x0181).r("sasi_ctrl_in", FUNC(input_buffer_device::bus_r)); @@ -122,6 +128,7 @@ MACHINE_CONFIG_START(slicer_state::slicer) MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, slicer_state, drive_sel_w<2>)) MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(*this, slicer_state, drive_sel_w<1>)) MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(*this, slicer_state, drive_sel_w<0>)) + MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(*this, slicer_state, drive_size_w)) MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE("fdc", fd1797_device, dden_w)) MCFG_DEVICE_ADD("sasi", SCSI_PORT, 0) -- cgit v1.2.3 From 884f3a86bb57652c4306a852a6f8560cc746b1ce Mon Sep 17 00:00:00 2001 From: Chromaryu Date: Thu, 26 Jul 2018 21:29:05 +0900 Subject: Update taito_f3.cpp (#3791) Removed old comments; ES5510 is in taito_en.h --- src/mame/drivers/taito_f3.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mame/drivers/taito_f3.cpp b/src/mame/drivers/taito_f3.cpp index a40b2c26d5a..46fdb820873 100644 --- a/src/mame/drivers/taito_f3.cpp +++ b/src/mame/drivers/taito_f3.cpp @@ -13,7 +13,6 @@ sprite sync fixes, sprite zoom fixes and others! Other Issues: - - ES5510 DSP isn't hooked up. - Various hacks in video core that needs squashing; - When playing space invaders dx in original mode, t.t. with overlay, the alpha blending effect is wrong (see Taito B version of game) -- cgit v1.2.3 From 9db24aa2e965d8469d000a7429679fd06c048406 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Thu, 26 Jul 2018 23:11:02 +1000 Subject: Better support for screen orientation/geometry: * Eliminates the need for the horizontal/vertical/LCD/SVG layout files * Screens can now have orientation and physical aspect ratio specified * RASTER/VECTOR defaults to 4:3, LCD/SVG defaults to square pixels at config time * System orientation is applied on top of screen orientation Automatically generated single-screen views and orientation flags in XML output now work correctly for systems with multiple screens in different geometries/orientations, e.g. housemnq, rocnms, stepstag, or netmerc. The "core rotation options" only interact with system orientation. Allowing multi-screen systems to work well with one monitor per emulated screen is a complex topic. System orientation also affects the GFX viewer while screen orientation doesn't. The orientation displayed in the system selection menu is from the system orientation. Let me know if I've broken any systems or use cases. Also, add save state support for std::array/C array nested to any depth. --- scripts/src/emu.lua | 10 -- src/devices/video/bt45x.cpp | 2 +- src/devices/video/gba_lcd.cpp | 2 - src/emu/layout/horizont.lay | 24 --- src/emu/layout/lcd.lay | 8 - src/emu/layout/lcd_rot.lay | 8 - src/emu/layout/svg.lay | 8 - src/emu/layout/vertical.lay | 37 ----- src/emu/render.cpp | 320 ++++++++++++++++++++++++++-------------- src/emu/rendlay.cpp | 56 ++----- src/emu/rendlay.h | 11 -- src/emu/save.h | 61 +++++--- src/emu/screen.cpp | 131 ++++++++++------ src/emu/screen.h | 12 +- src/frontend/mame/info.cpp | 53 ++++--- src/frontend/mame/luaengine.cpp | 2 +- src/frontend/mame/ui/devopt.cpp | 5 +- src/frontend/mame/ui/info.cpp | 2 +- src/lib/util/avhuff.h | 9 +- src/lib/util/bitstream.h | 9 +- src/lib/util/cdrom.h | 11 +- src/lib/util/chd.h | 9 +- src/lib/util/chdcd.h | 8 +- src/lib/util/chdcodec.h | 9 +- src/lib/util/corestr.h | 8 +- src/lib/util/coretmpl.h | 20 +++ src/lib/util/coreutil.h | 8 +- src/lib/util/delegate.h | 9 +- src/lib/util/flac.h | 29 ++-- src/lib/util/harddisk.h | 8 +- src/lib/util/hash.h | 8 +- src/lib/util/hashing.h | 8 +- src/lib/util/huffman.h | 9 +- src/lib/util/jedparse.h | 8 +- src/lib/util/opresolv.h | 8 +- src/lib/util/palette.h | 9 +- src/lib/util/plaparse.h | 10 +- src/lib/util/pool.h | 8 +- src/lib/util/vbiparse.h | 8 +- src/lib/util/wavwrite.h | 8 +- src/mame/drivers/alesis.cpp | 1 - src/mame/drivers/alphasma.cpp | 2 - src/mame/drivers/alto2.cpp | 17 +-- src/mame/drivers/bw2.cpp | 1 - src/mame/drivers/cesclass.cpp | 2 - src/mame/drivers/cfx9850.cpp | 3 - src/mame/drivers/clcd.cpp | 2 - src/mame/drivers/cybiko.cpp | 4 +- src/mame/drivers/deshoros.cpp | 2 - src/mame/drivers/fb01.cpp | 2 - src/mame/drivers/gamepock.cpp | 3 - src/mame/drivers/gb.cpp | 79 +++++----- src/mame/drivers/gizmondo.cpp | 3 - src/mame/drivers/gmaster.cpp | 2 - src/mame/drivers/gp32.cpp | 4 - src/mame/drivers/gridcomp.cpp | 5 +- src/mame/drivers/hh_hmcs40.cpp | 33 +---- src/mame/drivers/hh_melps4.cpp | 7 +- src/mame/drivers/hh_sm510.cpp | 68 --------- src/mame/drivers/hh_tms1k.cpp | 3 - src/mame/drivers/hh_ucom4.cpp | 17 --- src/mame/drivers/hp49gp.cpp | 4 - src/mame/drivers/hp_ipc.cpp | 8 +- src/mame/drivers/hprot1.cpp | 2 - src/mame/drivers/hunter2.cpp | 2 - src/mame/drivers/hx20.cpp | 1 - src/mame/drivers/icatel.cpp | 2 - src/mame/drivers/juicebox.cpp | 2 - src/mame/drivers/lcmate2.cpp | 2 - src/mame/drivers/micronic.cpp | 3 - src/mame/drivers/microvsn.cpp | 3 - src/mame/drivers/mini2440.cpp | 6 +- src/mame/drivers/mstation.cpp | 2 - src/mame/drivers/nakajies.cpp | 9 +- src/mame/drivers/nbmj8688.cpp | 32 ++-- src/mame/drivers/nc.cpp | 3 - src/mame/drivers/ngp.cpp | 3 - src/mame/drivers/palm.cpp | 11 +- src/mame/drivers/palmz22.cpp | 10 +- src/mame/drivers/pasopia7.cpp | 3 - src/mame/drivers/pb1000.cpp | 2 - src/mame/drivers/pc2000.cpp | 2 - src/mame/drivers/pc4.cpp | 2 - src/mame/drivers/pce220.cpp | 4 - src/mame/drivers/pda600.cpp | 9 +- src/mame/drivers/pitagjr.cpp | 3 - src/mame/drivers/pofo.cpp | 3 - src/mame/drivers/pokemini.cpp | 3 - src/mame/drivers/prestige.cpp | 3 - src/mame/drivers/psion.cpp | 2 - src/mame/drivers/replicator.cpp | 2 - src/mame/drivers/rex6000.cpp | 3 - src/mame/drivers/tetrisp2.cpp | 79 +++++----- src/mame/drivers/ti630.cpp | 2 - src/mame/drivers/ti89.cpp | 2 - src/mame/drivers/tmmjprd.cpp | 37 +++-- src/mame/drivers/wpc_dot.cpp | 55 +++---- src/mame/drivers/wpc_flip1.cpp | 27 ++-- src/mame/drivers/wpc_flip2.cpp | 27 ++-- src/mame/drivers/x07.cpp | 1 - src/mame/drivers/ymmu100.cpp | 2 - src/mame/drivers/z88.cpp | 2 - src/mame/includes/alesis.h | 1 - src/mame/includes/gb.h | 9 +- src/mame/includes/hx20.h | 1 - src/mame/includes/nbmj8688.h | 7 + src/mame/includes/wpc_dot.h | 36 ++--- src/mame/includes/wpc_flip1.h | 6 +- src/mame/includes/wpc_flip2.h | 6 +- src/mame/includes/x07.h | 7 +- src/mame/includes/z88.h | 3 +- src/mame/layout/nbmj8688.lay | 40 +---- src/mame/layout/rocknms.lay | 26 ---- src/mame/layout/stepstag.lay | 41 ----- src/mame/video/decodmd1.cpp | 5 +- src/mame/video/decodmd2.cpp | 32 ++-- src/mame/video/decodmd3.cpp | 29 ++-- src/mame/video/gamate.cpp | 3 - src/mame/video/kyocera.cpp | 5 - src/mame/video/wpc_dmd.cpp | 2 - src/osd/eigccppc.h | 6 +- src/osd/osdnet.h | 8 +- src/osd/osdsync.h | 7 +- 123 files changed, 790 insertions(+), 1103 deletions(-) delete mode 100644 src/emu/layout/horizont.lay delete mode 100644 src/emu/layout/lcd.lay delete mode 100644 src/emu/layout/lcd_rot.lay delete mode 100644 src/emu/layout/svg.lay delete mode 100644 src/emu/layout/vertical.lay diff --git a/scripts/src/emu.lua b/scripts/src/emu.lua index c9a8ddeb625..4e763996a2c 100644 --- a/scripts/src/emu.lua +++ b/scripts/src/emu.lua @@ -271,13 +271,8 @@ dependency { { MAME_DIR .. "src/emu/rendlay.cpp", GEN_DIR .. "emu/layout/dualhovu.lh" }, { MAME_DIR .. "src/emu/rendlay.cpp", GEN_DIR .. "emu/layout/dualhsxs.lh" }, { MAME_DIR .. "src/emu/rendlay.cpp", GEN_DIR .. "emu/layout/dualhuov.lh" }, - { MAME_DIR .. "src/emu/rendlay.cpp", GEN_DIR .. "emu/layout/horizont.lh" }, { MAME_DIR .. "src/emu/rendlay.cpp", GEN_DIR .. "emu/layout/triphsxs.lh" }, { MAME_DIR .. "src/emu/rendlay.cpp", GEN_DIR .. "emu/layout/quadhsxs.lh" }, - { MAME_DIR .. "src/emu/rendlay.cpp", GEN_DIR .. "emu/layout/vertical.lh" }, - { MAME_DIR .. "src/emu/rendlay.cpp", GEN_DIR .. "emu/layout/lcd.lh" }, - { MAME_DIR .. "src/emu/rendlay.cpp", GEN_DIR .. "emu/layout/lcd_rot.lh" }, - { MAME_DIR .. "src/emu/rendlay.cpp", GEN_DIR .. "emu/layout/svg.lh" }, { MAME_DIR .. "src/emu/rendlay.cpp", GEN_DIR .. "emu/layout/noscreens.lh" }, } @@ -291,13 +286,8 @@ custombuildtask { layoutbuildtask("emu/layout", "dualhovu"), layoutbuildtask("emu/layout", "dualhsxs"), layoutbuildtask("emu/layout", "dualhuov"), - layoutbuildtask("emu/layout", "horizont"), layoutbuildtask("emu/layout", "triphsxs"), layoutbuildtask("emu/layout", "quadhsxs"), - layoutbuildtask("emu/layout", "vertical"), - layoutbuildtask("emu/layout", "lcd"), - layoutbuildtask("emu/layout", "lcd_rot"), - layoutbuildtask("emu/layout", "svg"), layoutbuildtask("emu/layout", "noscreens"), } diff --git a/src/devices/video/bt45x.cpp b/src/devices/video/bt45x.cpp index f1176ee5f77..2f676c831fe 100644 --- a/src/devices/video/bt45x.cpp +++ b/src/devices/video/bt45x.cpp @@ -146,7 +146,7 @@ void bt45x_rgb_device_base::device_start() m_color_ram = std::make_unique[]>(m_palette_colors + m_overlay_colors); - //save_pointer(NAME(m_color_ram), m_palette_colors + m_overlay_colors); + save_pointer(NAME(m_color_ram), m_palette_colors + m_overlay_colors); } void bt45x_mono_device_base::device_start() diff --git a/src/devices/video/gba_lcd.cpp b/src/devices/video/gba_lcd.cpp index 098499b1af5..98957a3353a 100644 --- a/src/devices/video/gba_lcd.cpp +++ b/src/devices/video/gba_lcd.cpp @@ -13,7 +13,6 @@ #include "emu.h" #include "gba_lcd.h" -#include "rendlay.h" #include "screen.h" @@ -1810,7 +1809,6 @@ MACHINE_CONFIG_START(gba_lcd_device::device_add_mconfig) MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, gba_lcd_device, screen_update) MCFG_SCREEN_PALETTE("palette") - config.set_default_layout(layout_lcd); MCFG_PALETTE_ADD("palette", 32768) MCFG_PALETTE_INIT_OWNER(gba_lcd_device, gba) MACHINE_CONFIG_END diff --git a/src/emu/layout/horizont.lay b/src/emu/layout/horizont.lay deleted file mode 100644 index 908804832af..00000000000 --- a/src/emu/layout/horizont.lay +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emu/layout/lcd.lay b/src/emu/layout/lcd.lay deleted file mode 100644 index 8de4141324a..00000000000 --- a/src/emu/layout/lcd.lay +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/emu/layout/lcd_rot.lay b/src/emu/layout/lcd_rot.lay deleted file mode 100644 index 95176d24a06..00000000000 --- a/src/emu/layout/lcd_rot.lay +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/emu/layout/svg.lay b/src/emu/layout/svg.lay deleted file mode 100644 index 96a25360a19..00000000000 --- a/src/emu/layout/svg.lay +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/emu/layout/vertical.lay b/src/emu/layout/vertical.lay deleted file mode 100644 index 2d66df317f8..00000000000 --- a/src/emu/layout/vertical.lay +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/emu/render.cpp b/src/emu/render.cpp index 9ec8445fa49..a65a47e2cf6 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -46,8 +46,12 @@ #include "drivenum.h" #include "xmlfile.h" #include "ui/uimain.h" + #include +#include +#include + //************************************************************************** @@ -562,20 +566,20 @@ const rgb_t *render_texture::get_adjusted_palette(render_container &container) //------------------------------------------------- render_container::render_container(render_manager &manager, screen_device *screen) - : m_next(nullptr), - m_manager(manager), - m_screen(screen), - m_overlaybitmap(nullptr), - m_overlaytexture(nullptr) + : m_next(nullptr) + , m_manager(manager) + , m_screen(screen) + , m_overlaybitmap(nullptr) + , m_overlaytexture(nullptr) { // make sure it is empty empty(); // if we have a screen, read and apply the options - if (m_screen != nullptr) + if (m_screen) { // set the initial orientation and brightness/contrast/gamma - m_user.m_orientation = manager.machine().system().flags & machine_flags::MASK_ORIENTATION; + m_user.m_orientation = m_screen->orientation(); m_user.m_brightness = manager.machine().options().brightness(); m_user.m_contrast = manager.machine().options().contrast(); m_user.m_gamma = manager.machine().options().gamma(); @@ -884,14 +888,14 @@ void render_container::update_palette() //------------------------------------------------- render_container::user_settings::user_settings() - : m_orientation(0), - m_brightness(1.0f), - m_contrast(1.0f), - m_gamma(1.0f), - m_xscale(1.0f), - m_yscale(1.0f), - m_xoffset(0.0f), - m_yoffset(0.0f) + : m_orientation(0) + , m_brightness(1.0f) + , m_contrast(1.0f) + , m_gamma(1.0f) + , m_xscale(1.0f) + , m_yscale(1.0f) + , m_xoffset(0.0f) + , m_yoffset(0.0f) { } @@ -1676,23 +1680,53 @@ void render_target::load_additional_layout_files(const char *basename, bool have } - screen_device_iterator iter(m_manager.machine().root_device()); - unsigned const screens = iter.count(); - - // now do the built-in layouts for single-screen games - if (screens == 1) + // local screen info to avoid repeated code + class screen_info { - if (system.flags & ORIENTATION_SWAP_XY) - load_layout_file(nullptr, layout_vertical); - else - load_layout_file(nullptr, layout_horizont); - if (m_filelist.empty()) - throw emu_fatalerror("Couldn't parse default layout??"); - } + public: + screen_info(screen_device const &screen) + : m_device(screen) + , m_rotated(screen.orientation() & ORIENTATION_SWAP_XY) + , m_physical(screen.physical_aspect()) + , m_native(screen.visible_area().width(), screen.visible_area().height()) + { + util::reduce_fraction(m_native.first, m_native.second); + if (m_rotated) + { + std::swap(m_physical.first, m_physical.second); + std::swap(m_native.first, m_native.second); + } + } + + screen_device const &device() const { return m_device.get(); } + bool rotated() const { return m_rotated; } + bool square() const { return m_physical == m_native; } + unsigned physical_x() const { return m_physical.first; } + unsigned physical_y() const { return m_physical.second; } + unsigned native_x() const { return m_native.first; } + unsigned native_y() const { return m_native.second; } + + std::pair tiled_size() const + { + if (physical_x() == physical_y()) + return std::make_pair(1.0F, 1.0F); + else if (physical_x() > physical_y()) + return std::make_pair(1.0F, float(physical_y()) / physical_x()); + else + return std::make_pair(float(physical_x()) / physical_y(), 1.0F); + } + + private: + std::reference_wrapper m_device; + bool m_rotated; + std::pair m_physical, m_native; + }; + screen_device_iterator iter(m_manager.machine().root_device()); + std::vector const screens(std::begin(iter), std::end(iter)); if (!have_default && !have_artwork) { - if (screens == 2) + if (screens.size() == 2U) { load_layout_file(nullptr, layout_dualhsxs); if (m_filelist.empty()) @@ -1700,7 +1734,7 @@ void render_target::load_additional_layout_files(const char *basename, bool have } } - if (screens == 0) // ensure the fallback view for systems with no screens is loaded if necessary + if (screens.empty()) // ensure the fallback view for systems with no screens is loaded if necessary { if (!view_by_index(0)) { @@ -1709,7 +1743,7 @@ void render_target::load_additional_layout_files(const char *basename, bool have throw emu_fatalerror("Couldn't parse default layout??"); } } - else if (screens >= 2) // generate default layouts for larger numbers of screens + else // generate default layouts for larger numbers of screens { util::xml::file::ptr const root(util::xml::file::create()); if (!root) @@ -1719,17 +1753,18 @@ void render_target::load_additional_layout_files(const char *basename, bool have throw emu_fatalerror("Couldn't create XML node??"); layoutnode->set_attribute_int("version", 2); - // get standard width/height assuming 4:3 screens - unsigned const stdwidth((system.flags & ORIENTATION_SWAP_XY) ? 3 : 4); - unsigned const stdheight((system.flags & ORIENTATION_SWAP_XY) ? 4 : 3); - - // generate individual 4:3 views - for (unsigned i = 0; screens > i; ++i) + // generate individual physical aspect views + for (unsigned i = 0; screens.size() > i; ++i) { util::xml::data_node *const viewnode(layoutnode->add_child("view", nullptr)); if (!viewnode) throw emu_fatalerror("Couldn't create XML node??"); - viewnode->set_attribute("name", util::xml::normalize_string(util::string_format("Screen %1$u Standard (%2$u:%3$u)", i, stdwidth, stdheight).c_str())); + viewnode->set_attribute( + "name", + util::xml::normalize_string( + util::string_format( + "Screen %1$u Standard (%2$u:%3$u)", + i, screens[i].physical_x(), screens[i].physical_y()).c_str())); util::xml::data_node *const screennode(viewnode->add_child("screen", nullptr)); if (!screennode) throw emu_fatalerror("Couldn't create XML node??"); @@ -1739,40 +1774,85 @@ void render_target::load_additional_layout_files(const char *basename, bool have throw emu_fatalerror("Couldn't create XML node??"); boundsnode->set_attribute_int("x", 0); boundsnode->set_attribute_int("y", 0); - boundsnode->set_attribute_int("width", stdwidth); - boundsnode->set_attribute_int("height", stdheight); + boundsnode->set_attribute_int("width", screens[i].physical_x()); + boundsnode->set_attribute_int("height", screens[i].physical_y()); } // generate individual pixel aspect views - for (unsigned i = 0; screens > i; ++i) + for (unsigned i = 0; screens.size() > i; ++i) + { + if (!screens[i].square()) + { + util::xml::data_node *const viewnode(layoutnode->add_child("view", nullptr)); + if (!viewnode) + throw emu_fatalerror("Couldn't create XML node??"); + viewnode->set_attribute( + "name", + util::xml::normalize_string( + util::string_format( + "Screen %1$u Pixel Aspect (%2$u:%3$u)", + i, screens[i].native_x(), screens[i].native_y()).c_str())); + util::xml::data_node *const screennode(viewnode->add_child("screen", nullptr)); + if (!screennode) + throw emu_fatalerror("Couldn't create XML node??"); + screennode->set_attribute_int("index", i); + util::xml::data_node *const boundsnode(screennode->add_child("bounds", nullptr)); + if (!boundsnode) + throw emu_fatalerror("Couldn't create XML node??"); + boundsnode->set_attribute_int("x", 0); + boundsnode->set_attribute_int("y", 0); + boundsnode->set_attribute_int("width", screens[i].native_x()); + boundsnode->set_attribute_int("height", screens[i].native_y()); + } + } + + // generate the fake cocktail view for single-screen systems + if (screens.size() == 1U) { util::xml::data_node *const viewnode(layoutnode->add_child("view", nullptr)); if (!viewnode) throw emu_fatalerror("Couldn't create XML node??"); - viewnode->set_attribute("name", util::xml::normalize_string(util::string_format("Screen %1$u Pixel Aspect (~scr%1$unativexaspect~:~scr%1$unativeyaspect~)", i).c_str())); + viewnode->set_attribute("name", "Cocktail"); + + util::xml::data_node *const mirrornode(viewnode->add_child("screen", nullptr)); + if (!mirrornode) + throw emu_fatalerror("Couldn't create XML node??"); + mirrornode->set_attribute_int("index", 0); + util::xml::data_node *const mirrorbounds(mirrornode->add_child("bounds", nullptr)); + if (!mirrorbounds) + throw emu_fatalerror("Couldn't create XML node??"); + mirrorbounds->set_attribute_int("x", 0); + mirrorbounds->set_attribute_float("y", (-0.01 * (std::min)(screens[0].physical_x(), screens[0].physical_y())) - screens[0].physical_y()); + mirrorbounds->set_attribute_int("width", screens[0].physical_x()); + mirrorbounds->set_attribute_int("height", screens[0].physical_y()); + util::xml::data_node *const flipper(mirrornode->add_child("orientation", nullptr)); + if (!flipper) + throw emu_fatalerror("Couldn't create XML node??"); + flipper->set_attribute_int("rotate", 180); + util::xml::data_node *const screennode(viewnode->add_child("screen", nullptr)); if (!screennode) throw emu_fatalerror("Couldn't create XML node??"); - screennode->set_attribute_int("index", i); - util::xml::data_node *const boundsnode(screennode->add_child("bounds", nullptr)); - if (!boundsnode) + screennode->set_attribute_int("index", 0); + util::xml::data_node *const screenbounds(screennode->add_child("bounds", nullptr)); + if (!screenbounds) throw emu_fatalerror("Couldn't create XML node??"); - boundsnode->set_attribute_int("x", 0); - boundsnode->set_attribute_int("y", 0); - boundsnode->set_attribute("width", util::xml::normalize_string(util::string_format("~scr%1$uwidth~", i).c_str())); - boundsnode->set_attribute("height", util::xml::normalize_string(util::string_format("~scr%1$uheight~", i).c_str())); + screenbounds->set_attribute_int("x", 0); + screenbounds->set_attribute_int("y", 0); + screenbounds->set_attribute_int("width", screens[0].physical_x()); + screenbounds->set_attribute_int("height", screens[0].physical_y()); } // generate tiled views if the supplied artwork doesn't provide a view of all screens - bool need_tiles(screens >= 3); - if (!need_tiles) + bool need_tiles(screens.size() >= 3); + if (!need_tiles && (screens.size() >= 2)) { need_tiles = true; int viewindex(0); for (layout_view *view = view_by_index(viewindex); need_tiles && view; view = view_by_index(++viewindex)) { render_screen_list const &viewscreens(view->screens()); - if (viewscreens.count() >= screens) + if (viewscreens.count() >= screens.size()) { bool screen_missing(false); for (screen_device &screen : iter) @@ -1790,93 +1870,119 @@ void render_target::load_additional_layout_files(const char *basename, bool have } if (need_tiles) { - // helper for generating a view since we do this a lot + // helpers for generating a view since we do this a lot + std::vector widths(screens.size()), heights(screens.size()); + std::vector > sizes(screens.size()); + std::transform(screens.begin(), screens.end(), sizes.begin(), [] (screen_info const &s) { return s.tiled_size(); }); auto const generate_view = - [&layoutnode, screens, stdwidth, stdheight] (char const *title, auto &&bounds_callback) + [&layoutnode, &screens, &widths, &heights, &sizes] (char const *title, unsigned columns, bool gapless, auto &&mapper) { + // calculate necessary widths/heights of rows/columns restricting screens to unit square + assert(0U < columns); + assert(screens.size() >= columns); + unsigned const rows((screens.size() + columns - 1) / columns); + std::fill_n(widths.begin(), columns, 0.0F); + std::fill_n(heights.begin(), rows, 0.0F); + for (unsigned y = 0U; rows > y; ++y) + { + for (unsigned x = 0U; columns > x; ++x) + { + int const i(mapper(x, y)); + if (0 <= i) + { + widths[x] = (std::max)(widths[x], sizes[i].first); + heights[y] = (std::max)(heights[y], sizes[i].second); + } + } + } + + // spacing is 1% of minor dimension + float spacing(0.0F); + if (!gapless) + { + spacing = 0.01F * (std::min)( + *std::max_element(widths.begin(), widths.begin() + columns), + *std::max_element(heights.begin(), heights.begin() + rows)); + } + + // actually generate elements util::xml::data_node *viewnode = layoutnode->add_child("view", nullptr); if (!viewnode) throw emu_fatalerror("Couldn't create XML node??"); viewnode->set_attribute("name", util::xml::normalize_string(title)); - for (unsigned i = 0; screens > i; ++i) + float ypos(0.0F); + for (unsigned y = 0U; rows > y; ypos += heights[y] + spacing, ++y) { - util::xml::data_node *const screennode(viewnode->add_child("screen", nullptr)); - if (!screennode) - throw emu_fatalerror("Couldn't create XML node??"); - screennode->set_attribute_int("index", i); - util::xml::data_node *const boundsnode(screennode->add_child("bounds", nullptr)); - if (!boundsnode) - throw emu_fatalerror("Couldn't create XML node??"); - bounds_callback(*boundsnode, i); - boundsnode->set_attribute_int("width", stdwidth); - boundsnode->set_attribute_int("height", stdheight); + float xpos(0.0F); + for (unsigned x = 0U; columns > x; xpos += widths[x] + spacing, ++x) + { + int const i(mapper(x, y)); + if (0 <= i) + { + util::xml::data_node *const screennode(viewnode->add_child("screen", nullptr)); + if (!screennode) + throw emu_fatalerror("Couldn't create XML node??"); + screennode->set_attribute_int("index", i); + util::xml::data_node *const boundsnode(screennode->add_child("bounds", nullptr)); + if (!boundsnode) + throw emu_fatalerror("Couldn't create XML node??"); + boundsnode->set_attribute_float("x", xpos + ((widths[x] - sizes[i].first) / 2)); + boundsnode->set_attribute_float("y", ypos + ((heights[y] - sizes[i].second) / 2)); + boundsnode->set_attribute_float("width", sizes[i].first); + boundsnode->set_attribute_float("height", sizes[i].second); + } + } } }; // generate linear views - generate_view( - "Left-to-Right", - [stdwidth] (util::xml::data_node &boundsnode, unsigned i) - { - boundsnode.set_attribute_float("x", i * (stdwidth + 0.03f)); - boundsnode.set_attribute_int("y", 0); - }); - generate_view( - "Left-to-Right (Gapless)", - [stdwidth] (util::xml::data_node &boundsnode, unsigned i) - { - boundsnode.set_attribute_int("x", i * stdwidth); - boundsnode.set_attribute_int("y", 0); - }); - generate_view( - "Top-to-Bottom", - [stdheight] (util::xml::data_node &boundsnode, unsigned i) - { - boundsnode.set_attribute_int("x", 0); - boundsnode.set_attribute_float("y", i * (stdheight + 0.03f)); - }); - generate_view( - "Top-to-Bottom (Gapless)", - [stdheight] (util::xml::data_node &boundsnode, unsigned i) - { - boundsnode.set_attribute_int("x", 0); - boundsnode.set_attribute_int("y", i * stdheight); - }); + generate_view("Left-to-Right", screens.size(), false, [] (unsigned x, unsigned y) { return x; }); + generate_view("Left-to-Right (Gapless)", screens.size(), true, [] (unsigned x, unsigned y) { return x; }); + generate_view("Top-to-Bottom", 1U, false, [] (unsigned x, unsigned y) { return y; }); + generate_view("Top-to-Bottom (Gapless)", 1U, true, [] (unsigned x, unsigned y) { return y; }); // generate tiled views - for (unsigned mindim = 2; ((screens + mindim - 1) / mindim) >= mindim; ++mindim) + for (unsigned mindim = 2; ((screens.size() + mindim - 1) / mindim) >= mindim; ++mindim) { - unsigned const majdim((screens + mindim - 1) / mindim); - unsigned const remainder(screens % majdim); + unsigned const majdim((screens.size() + mindim - 1) / mindim); + unsigned const remainder(screens.size() % majdim); if (!remainder || (((majdim + 1) / 2) <= remainder)) { generate_view( util::string_format("%1$u\xC3\x97%2$u Left-to-Right, Top-to-Bottom", majdim, mindim).c_str(), - [majdim, stdwidth, stdheight] (util::xml::data_node &boundsnode, unsigned i) + majdim, + false, + [&screens, majdim] (unsigned x, unsigned y) { - boundsnode.set_attribute_float("x", (i % majdim) * (stdwidth + 0.03f)); - boundsnode.set_attribute_float("y", (i / majdim) * (stdheight + 0.03f)); + unsigned const i(x + (y * majdim)); + return (screens.size() > i) ? int(i) : -1; }); generate_view( util::string_format("%1$u\xC3\x97%2$u Left-to-Right, Top-to-Bottom (Gapless)", majdim, mindim).c_str(), - [majdim, stdwidth, stdheight] (util::xml::data_node &boundsnode, unsigned i) + majdim, + true, + [&screens, majdim] (unsigned x, unsigned y) { - boundsnode.set_attribute_int("x", (i % majdim) * stdwidth); - boundsnode.set_attribute_int("y", (i / majdim) * stdheight); + unsigned const i(x + (y * majdim)); + return (screens.size() > i) ? int(i) : -1; }); generate_view( util::string_format("%1$u\xC3\x97%2$u Top-to-Bottom, Left-to-Right", mindim, majdim).c_str(), - [majdim, stdwidth, stdheight] (util::xml::data_node &boundsnode, unsigned i) + mindim, + false, + [&screens, majdim] (unsigned x, unsigned y) { - boundsnode.set_attribute_float("x", (i / majdim) * (stdwidth + 0.03f)); - boundsnode.set_attribute_float("y", (i % majdim) * (stdheight + 0.03f)); + unsigned const i((x * majdim) + y); + return (screens.size() > i) ? int(i) : -1; }); generate_view( util::string_format("%1$u\xC3\x97%2$u Top-to-Bottom, Left-to-Right (Gapless)", mindim, majdim).c_str(), - [majdim, stdwidth, stdheight] (util::xml::data_node &boundsnode, unsigned i) + mindim, + true, + [&screens, majdim] (unsigned x, unsigned y) { - boundsnode.set_attribute_int("x", (i / majdim) * stdwidth); - boundsnode.set_attribute_int("y", (i % majdim) * stdheight); + unsigned const i((x * majdim) + y); + return (screens.size() > i) ? int(i) : -1; }); } } diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp index 896391b264e..2c4057501d6 100644 --- a/src/emu/rendlay.cpp +++ b/src/emu/rendlay.cpp @@ -40,10 +40,6 @@ // screenless layouts #include "noscreens.lh" -// single screen layouts -#include "horizont.lh" -#include "vertical.lh" - // dual screen layouts #include "dualhsxs.lh" #include "dualhovu.lh" @@ -55,13 +51,6 @@ // quad screen layouts #include "quadhsxs.lh" -// LCD screen layouts -#include "lcd.lh" -#include "lcd_rot.lh" - -// SVG screen layouts -#include "svg.lh" - namespace { @@ -86,38 +75,6 @@ std::locale const f_portable_locale("C"); // INLINE HELPERS //************************************************************************** -//------------------------------------------------- -// gcd - compute the greatest common divisor (GCD) -// of two integers using the Euclidean algorithm -//------------------------------------------------- - -template -constexpr std::common_type_t gcd(M a, N b) -{ - return b ? gcd(b, a % b) : a; -} - - -//------------------------------------------------- -// reduce_fraction - reduce a fraction by -// dividing out common factors -//------------------------------------------------- - -template -inline void reduce_fraction(M &num, N &den) -{ - // search the greatest common divisor - auto const div = gcd(num, den); - - // reduce the fraction if a common divisor has been found - if (div) - { - num /= div; - den /= div; - } -} - - //------------------------------------------------- // render_bounds_transform - apply translation/ // scaling @@ -430,9 +387,20 @@ private: unsigned i(0U); for (screen_device const &screen : screen_device_iterator(machine().root_device())) { + std::pair const physaspect(screen.physical_aspect()); s64 const w(screen.visible_area().width()), h(screen.visible_area().height()); s64 xaspect(w), yaspect(h); - reduce_fraction(xaspect, yaspect); + util::reduce_fraction(xaspect, yaspect); + + tmp.seekp(0); + util::stream_format(tmp, "scr%uphysicalxaspect", i); + tmp.put('\0'); + try_insert(&tmp.vec()[0], s64(physaspect.first)); + + tmp.seekp(0); + util::stream_format(tmp, "scr%uphysicalyaspect", i); + tmp.put('\0'); + try_insert(&tmp.vec()[0], s64(physaspect.second)); tmp.seekp(0); util::stream_format(tmp, "scr%unativexaspect", i); diff --git a/src/emu/rendlay.h b/src/emu/rendlay.h index e51a783e968..d1de55f73ef 100644 --- a/src/emu/rendlay.h +++ b/src/emu/rendlay.h @@ -21,10 +21,6 @@ // no screens layouts extern const internal_layout layout_noscreens; // for screenless systems -// single screen layouts -extern const internal_layout layout_horizont; // horizontal 4:3 screens -extern const internal_layout layout_vertical; // vertical 4:3 screens - // dual screen layouts extern const internal_layout layout_dualhsxs; // dual 4:3 screens side-by-side extern const internal_layout layout_dualhovu; // dual 4:3 screens above and below @@ -36,11 +32,4 @@ extern const internal_layout layout_triphsxs; // triple 4:3 screens side-by-s // quad screen layouts extern const internal_layout layout_quadhsxs; // quad 4:3 screens side-by-side -// LCD screen layouts -extern const internal_layout layout_lcd; // generic 1:1 lcd screen layout -extern const internal_layout layout_lcd_rot; // same, for use with ROT90 or ROT270 - -// SVG screen layouts -extern const internal_layout layout_svg; // generic 1:1 lcd screen layout - #endif // MAME_EMU_RENDLAY_H diff --git a/src/emu/save.h b/src/emu/save.h index 4559d230b96..9097c195dec 100644 --- a/src/emu/save.h +++ b/src/emu/save.h @@ -17,6 +17,8 @@ #ifndef MAME_EMU_SAVE_H #define MAME_EMU_SAVE_H +#include + //************************************************************************** @@ -86,6 +88,29 @@ class rewinder; class save_manager { + // stuff for working with arrays + template struct array_unwrap + { + using underlying_type = T; + static constexpr std::size_t COUNT = 1U; + static constexpr std::size_t SIZE = sizeof(underlying_type); + static underlying_type *ptr(T &value) { return &value; } + }; + template struct array_unwrap + { + using underlying_type = typename array_unwrap::underlying_type; + static constexpr std::size_t COUNT = N * array_unwrap::COUNT; + static constexpr std::size_t SIZE = sizeof(underlying_type); + static underlying_type *ptr(T (&value)[N]) { return array_unwrap::ptr(value[0]); } + }; + template struct array_unwrap > + { + using underlying_type = typename array_unwrap::underlying_type; + static constexpr std::size_t COUNT = N * array_unwrap::COUNT; + static constexpr std::size_t SIZE = sizeof(underlying_type); + static underlying_type *ptr(std::array &value) { return array_unwrap::ptr(value[0]); } + }; + // type_checker is a set of templates to identify valid save types template struct type_checker { static const bool is_atom = false; static const bool is_pointer = false; }; template struct type_checker { static const bool is_atom = false; static const bool is_pointer = true; }; @@ -118,45 +143,33 @@ public: // generic memory registration void save_memory(device_t *device, const char *module, const char *tag, u32 index, const char *name, void *val, u32 valsize, u32 valcount = 1); - // templatized wrapper for general objects + // templatized wrapper for general objects and arrays template void save_item(device_t *device, const char *module, const char *tag, int index, ItemType &value, const char *valname) { - if (type_checker::is_pointer) throw emu_fatalerror("Called save_item on a pointer with no count!"); - if (!type_checker::is_atom) throw emu_fatalerror("Called save_item on a non-fundamental type!"); - save_memory(device, module, tag, index, valname, &value, sizeof(ItemType)); - } - - // templatized wrapper for 1-dimensional arrays - template - void save_item(device_t *device, const char *module, const char *tag, int index, ItemType (&value)[N], const char *valname) - { - if (!type_checker::is_atom) throw emu_fatalerror("Called save_item on a non-fundamental type!"); - save_memory(device, module, tag, index, valname, &value[0], sizeof(ItemType), N); - } - - // templatized wrapper for 2-dimensional arrays - template - void save_item(device_t *device, const char *module, const char *tag, int index, ItemType (&value)[M][N], const char *valname) - { - if (!type_checker::is_atom) throw emu_fatalerror("Called save_item on a non-fundamental type!"); - save_memory(device, module, tag, index, valname, &value[0][0], sizeof(ItemType), M * N); + if (type_checker::is_pointer) + throw emu_fatalerror("Called save_item on a pointer with no count!"); + if (!type_checker::underlying_type>::is_atom) + throw emu_fatalerror("Called save_item on a non-fundamental type!"); + save_memory(device, module, tag, index, valname, array_unwrap::ptr(value), array_unwrap::SIZE, array_unwrap::COUNT); } // templatized wrapper for pointers template void save_pointer(device_t *device, const char *module, const char *tag, int index, ItemType *value, const char *valname, u32 count) { - if (!type_checker::is_atom) throw emu_fatalerror("Called save_item on a non-fundamental type!"); - save_memory(device, module, tag, index, valname, value, sizeof(ItemType), count); + if (!type_checker::underlying_type>::is_atom) + throw emu_fatalerror("Called save_item on a non-fundamental type!"); + save_memory(device, module, tag, index, valname, array_unwrap::ptr(value[0]), array_unwrap::SIZE, array_unwrap::COUNT * count); } // templatized wrapper for std::unique_ptr template void save_pointer(device_t *device, const char *module, const char *tag, int index, std::unique_ptr &value, const char *valname, u32 count) { - if (!type_checker::is_atom) throw emu_fatalerror("Called save_item on a non-fundamental type!"); - save_memory(device, module, tag, index, valname, value.get(), sizeof(ItemType), count); + if (!type_checker::underlying_type>::is_atom) + throw emu_fatalerror("Called save_item on a non-fundamental type!"); + save_memory(device, module, tag, index, valname, array_unwrap::ptr(value[0]), array_unwrap::SIZE, array_unwrap::COUNT * count); } // global memory registration diff --git a/src/emu/screen.cpp b/src/emu/screen.cpp index 00a1a6435e7..26ef04c43ce 100644 --- a/src/emu/screen.cpp +++ b/src/emu/screen.cpp @@ -546,43 +546,45 @@ void screen_device::svg_renderer::rebuild_cache() //------------------------------------------------- screen_device::screen_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : device_t(mconfig, SCREEN, tag, owner, clock), - m_type(SCREEN_TYPE_RASTER), - m_oldstyle_vblank_supplied(false), - m_refresh(0), - m_vblank(0), - m_xoffset(0.0f), - m_yoffset(0.0f), - m_xscale(1.0f), - m_yscale(1.0f), - m_screen_vblank(*this), - m_palette(*this, finder_base::DUMMY_TAG), - m_video_attributes(0), - m_svg_region(nullptr), - m_container(nullptr), - m_width(100), - m_height(100), - m_visarea(0, 99, 0, 99), - m_texformat(), - m_curbitmap(0), - m_curtexture(0), - m_changed(true), - m_last_partial_scan(0), - m_partial_scan_hpos(0), - m_color(rgb_t(0xff, 0xff, 0xff, 0xff)), - m_brightness(0xff), - m_frame_period(DEFAULT_FRAME_PERIOD.as_attoseconds()), - m_scantime(1), - m_pixeltime(1), - m_vblank_period(0), - m_vblank_start_time(attotime::zero), - m_vblank_end_time(attotime::zero), - m_vblank_begin_timer(nullptr), - m_vblank_end_timer(nullptr), - m_scanline0_timer(nullptr), - m_scanline_timer(nullptr), - m_frame_number(0), - m_partial_updates_this_frame(0) + : device_t(mconfig, SCREEN, tag, owner, clock) + , m_type(SCREEN_TYPE_RASTER) + , m_orientation(ROT0) + , m_phys_aspect(0U, 0U) + , m_oldstyle_vblank_supplied(false) + , m_refresh(0) + , m_vblank(0) + , m_xoffset(0.0f) + , m_yoffset(0.0f) + , m_xscale(1.0f) + , m_yscale(1.0f) + , m_screen_vblank(*this) + , m_palette(*this, finder_base::DUMMY_TAG) + , m_video_attributes(0) + , m_svg_region(nullptr) + , m_container(nullptr) + , m_width(100) + , m_height(100) + , m_visarea(0, 99, 0, 99) + , m_texformat() + , m_curbitmap(0) + , m_curtexture(0) + , m_changed(true) + , m_last_partial_scan(0) + , m_partial_scan_hpos(0) + , m_color(rgb_t(0xff, 0xff, 0xff, 0xff)) + , m_brightness(0xff) + , m_frame_period(DEFAULT_FRAME_PERIOD.as_attoseconds()) + , m_scantime(1) + , m_pixeltime(1) + , m_vblank_period(0) + , m_vblank_start_time(attotime::zero) + , m_vblank_end_time(attotime::zero) + , m_vblank_begin_timer(nullptr) + , m_vblank_end_timer(nullptr) + , m_scanline0_timer(nullptr) + , m_scanline_timer(nullptr) + , m_frame_number(0) + , m_partial_updates_this_frame(0) { m_unique_id = m_id_counter; m_id_counter++; @@ -645,6 +647,48 @@ void screen_device::device_validity_check(validity_checker &valid) const } +//------------------------------------------------- +// device_config_complete - finalise static +// configuration +//------------------------------------------------- + +void screen_device::device_config_complete() +{ + // combine orientation with machine orientation + m_orientation = orientation_add(m_orientation, mconfig().gamedrv().flags & machine_flags::MASK_ORIENTATION); + + // physical aspect ratio unconfigured + if (!m_phys_aspect.first || !m_phys_aspect.second) + { + switch (m_type) + { + case SCREEN_TYPE_RASTER: + case SCREEN_TYPE_VECTOR: + m_phys_aspect = std::make_pair(4, 3); // assume standard CRT + break; + case SCREEN_TYPE_LCD: + case SCREEN_TYPE_SVG: + m_phys_aspect = std::make_pair(~0U, ~0U); // assume square pixels + break; + case SCREEN_TYPE_INVALID: + default: + throw emu_fatalerror("%s: invalid screen type configured\n", tag()); + } + } + + // square pixels? + if ((~0U == m_phys_aspect.first) && (~0U == m_phys_aspect.second)) + { + m_phys_aspect.first = visible_area().width(); + m_phys_aspect.second = visible_area().height(); + } + + // always keep this in reduced form + util::reduce_fraction(m_phys_aspect.first, m_phys_aspect.second); +} + + + //------------------------------------------------- // device_resolve_objects - resolve objects that // may be needed for other devices to set @@ -674,17 +718,14 @@ void screen_device::device_start() { memory_region *reg = owner()->memregion(m_svg_region); if (!reg) - fatalerror("SVG region \"%s\" does not exist\n", m_svg_region); + fatalerror("%s: SVG region \"%s\" does not exist\n", tag(), m_svg_region); m_svg = std::make_unique(reg); machine().output().set_notifier(nullptr, svg_renderer::output_notifier, m_svg.get()); - if (0) - { - // The osd picks up the size before start is called, so that's useless - m_width = m_svg->width(); - m_height = m_svg->height(); - m_visarea.set(0, m_width-1, 0, m_height-1); - } + // The OSD picks up the size before start is called, so this only affect the info display if it's called up in-game + m_width = m_svg->width(); + m_height = m_svg->height(); + m_visarea.set(0, m_width-1, 0, m_height-1); } // if we have a palette and it's not started, wait for it diff --git a/src/emu/screen.h b/src/emu/screen.h index 27ac6d421be..4d0fddf17ef 100644 --- a/src/emu/screen.h +++ b/src/emu/screen.h @@ -173,7 +173,7 @@ public: screen_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); screen_device(const machine_config &mconfig, const char *tag, device_t *owner, screen_type_enum type) - : screen_device(mconfig, tag, owner, (u32)0) + : screen_device(mconfig, tag, owner, u32(0)) { set_type(type); } @@ -181,6 +181,8 @@ public: // configuration readers screen_type_enum screen_type() const { return m_type; } + int orientation() const { assert(configured()); return m_orientation; } + std::pair physical_aspect() const { assert(configured()); return m_phys_aspect; } int width() const { return m_width; } int height() const { return m_height; } const rectangle &visible_area() const { return m_visarea; } @@ -196,7 +198,10 @@ public: bool have_screen_update() const { return !m_screen_update_ind16.isnull() && !m_screen_update_rgb32.isnull(); } // inline configuration helpers - void set_type(screen_type_enum type) { m_type = type; } + void set_type(screen_type_enum type) { assert(!configured()); m_type = type; } + void set_orientation(int orientation) { assert(!configured()); m_orientation = orientation; } + void set_physical_aspect(unsigned x, unsigned y) { assert(!configured()); m_phys_aspect = std::make_pair(x, y); } + void set_native_aspect() { assert(!configured()); m_phys_aspect = std::make_pair(~0U, ~0U); } void set_raw(u32 pixclock, u16 htotal, u16 hbend, u16 hbstart, u16 vtotal, u16 vbend, u16 vbstart) { m_clock = pixclock; @@ -317,6 +322,7 @@ private: // device-level overrides virtual void device_validity_check(validity_checker &valid) const override; + virtual void device_config_complete() override; virtual void device_resolve_objects() override; virtual void device_start() override; virtual void device_reset() override; @@ -334,6 +340,8 @@ private: // inline configuration data screen_type_enum m_type; // type of screen + int m_orientation; // orientation flags combined with system flags + std::pair m_phys_aspect; // physical aspect ratio bool m_oldstyle_vblank_supplied; // MCFG_SCREEN_VBLANK_TIME macro used attoseconds_t m_refresh; // default refresh period attoseconds_t m_vblank; // duration of a VBLANK diff --git a/src/frontend/mame/info.cpp b/src/frontend/mame/info.cpp index f4e1a01ca68..3e7af8a43c5 100644 --- a/src/frontend/mame/info.cpp +++ b/src/frontend/mame/info.cpp @@ -896,35 +896,32 @@ void info_xml_creator::output_display(device_t &device, machine_flags::type cons } // output the orientation as a string - if (flags) + switch (screendev.orientation()) { - switch (*flags & machine_flags::MASK_ORIENTATION) - { - case ORIENTATION_FLIP_X: - fprintf(m_output, " rotate=\"0\" flipx=\"yes\""); - break; - case ORIENTATION_FLIP_Y: - fprintf(m_output, " rotate=\"180\" flipx=\"yes\""); - break; - case ORIENTATION_FLIP_X|ORIENTATION_FLIP_Y: - fprintf(m_output, " rotate=\"180\""); - break; - case ORIENTATION_SWAP_XY: - fprintf(m_output, " rotate=\"90\" flipx=\"yes\""); - break; - case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_X: - fprintf(m_output, " rotate=\"90\""); - break; - case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_Y: - fprintf(m_output, " rotate=\"270\""); - break; - case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_X|ORIENTATION_FLIP_Y: - fprintf(m_output, " rotate=\"270\" flipx=\"yes\""); - break; - default: - fprintf(m_output, " rotate=\"0\""); - break; - } + case ORIENTATION_FLIP_X: + fprintf(m_output, " rotate=\"0\" flipx=\"yes\""); + break; + case ORIENTATION_FLIP_Y: + fprintf(m_output, " rotate=\"180\" flipx=\"yes\""); + break; + case ORIENTATION_FLIP_X|ORIENTATION_FLIP_Y: + fprintf(m_output, " rotate=\"180\""); + break; + case ORIENTATION_SWAP_XY: + fprintf(m_output, " rotate=\"90\" flipx=\"yes\""); + break; + case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_X: + fprintf(m_output, " rotate=\"90\""); + break; + case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_Y: + fprintf(m_output, " rotate=\"270\""); + break; + case ORIENTATION_SWAP_XY|ORIENTATION_FLIP_X|ORIENTATION_FLIP_Y: + fprintf(m_output, " rotate=\"270\" flipx=\"yes\""); + break; + default: + fprintf(m_output, " rotate=\"0\""); + break; } // output width and height only for games that are not vector diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp index edc56ee13b9..894767e0838 100644 --- a/src/frontend/mame/luaengine.cpp +++ b/src/frontend/mame/luaengine.cpp @@ -1782,7 +1782,7 @@ void lua_engine::initialize() "height", [](screen_device &sdev) { return sdev.visible_area().height(); }, "width", [](screen_device &sdev) { return sdev.visible_area().width(); }, "orientation", [](screen_device &sdev) { - uint32_t flags = sdev.machine().system().flags & machine_flags::MASK_ORIENTATION; + uint32_t flags = sdev.orientation(); int rotation_angle = 0; switch (flags) { diff --git a/src/frontend/mame/ui/devopt.cpp b/src/frontend/mame/ui/devopt.cpp index 562bcc26e2c..2c1ddd9aebd 100644 --- a/src/frontend/mame/ui/devopt.cpp +++ b/src/frontend/mame/ui/devopt.cpp @@ -32,6 +32,9 @@ void menu_device_config::populate(float &customtop, float &custombottom) machine_config &mconfig(const_cast(machine().config())); machine_config::token const tok(mconfig.begin_configuration(mconfig.root_device())); device_t *const dev = mconfig.device_add(m_option->name(), m_option->devtype(), 0); + for (device_t &d : device_iterator(*dev)) + if (!d.configured()) + d.config_complete(); std::ostringstream str; util::stream_format( @@ -96,7 +99,7 @@ void menu_device_config::populate(float &customtop, float &custombottom) util::stream_format( str, - (machine().system().flags & ORIENTATION_SWAP_XY) + (screen.orientation() & ORIENTATION_SWAP_XY) ? _(" Screen '%1$s': %2$d \xC3\x97 %3$d (V) %4$f\xC2\xA0Hz\n") : _(" Screen '%1$s': %2$d \xC3\x97 %3$d (H) %4$f\xC2\xA0Hz\n"), screen.tag(), diff --git a/src/frontend/mame/ui/info.cpp b/src/frontend/mame/ui/info.cpp index fde44227ea3..4a39bc050f5 100644 --- a/src/frontend/mame/ui/info.cpp +++ b/src/frontend/mame/ui/info.cpp @@ -385,7 +385,7 @@ std::string machine_info::game_info_string() const const rectangle &visarea = screen.visible_area(); detail = string_format("%d " UTF8_MULTIPLY " %d (%s) %f" UTF8_NBSP "Hz", visarea.width(), visarea.height(), - (m_machine.system().flags & ORIENTATION_SWAP_XY) ? "V" : "H", + (screen.orientation() & ORIENTATION_SWAP_XY) ? "V" : "H", ATTOSECONDS_TO_HZ(screen.frame_period().attoseconds())); } diff --git a/src/lib/util/avhuff.h b/src/lib/util/avhuff.h index 9d00ed423e6..90ef43e977f 100644 --- a/src/lib/util/avhuff.h +++ b/src/lib/util/avhuff.h @@ -8,10 +8,10 @@ ***************************************************************************/ -#pragma once +#ifndef MAME_UTIL_AVHUFF_H +#define MAME_UTIL_AVHUFF_H -#ifndef __AVHUFF_H__ -#define __AVHUFF_H__ +#pragma once #include "osdcore.h" #include "coretmpl.h" @@ -198,5 +198,4 @@ private: #endif }; - -#endif +#endif // MAME_UTIL_AVHUFF_H diff --git a/src/lib/util/bitstream.h b/src/lib/util/bitstream.h index 0056c4ce38e..3da6ec2c1cf 100644 --- a/src/lib/util/bitstream.h +++ b/src/lib/util/bitstream.h @@ -8,10 +8,10 @@ ***************************************************************************/ -#pragma once +#ifndef MAME_UTIL_BITSTREAM_H +#define MAME_UTIL_BITSTREAM_H -#ifndef __BITSTREAM_H__ -#define __BITSTREAM_H__ +#pragma once #include "osdcore.h" @@ -238,5 +238,4 @@ inline uint32_t bitstream_out::flush() return m_doffset; } - -#endif +#endif // MAME_UTIL_BITSTREAM_H diff --git a/src/lib/util/cdrom.h b/src/lib/util/cdrom.h index 8dd841b3459..50b762d5009 100644 --- a/src/lib/util/cdrom.h +++ b/src/lib/util/cdrom.h @@ -8,10 +8,10 @@ ***************************************************************************/ -#pragma once +#ifndef MAME_UTIL_CDROM_H +#define MAME_UTIL_CDROM_H -#ifndef __CDROM_H__ -#define __CDROM_H__ +#pragma once #include "osdcore.h" #include "chd.h" @@ -179,7 +179,4 @@ static inline uint32_t lba_to_msf_alt(int lba) return ret; } - - - -#endif // __CDROM_H__ +#endif // MAME_UTIL_CDROM_H diff --git a/src/lib/util/chd.h b/src/lib/util/chd.h index a85ae1b9c10..254a99daae1 100644 --- a/src/lib/util/chd.h +++ b/src/lib/util/chd.h @@ -8,10 +8,10 @@ ***************************************************************************/ -#pragma once +#ifndef MAME_UTIL_CHD_H +#define MAME_UTIL_CHD_H -#ifndef __CHD_H__ -#define __CHD_H__ +#pragma once #include "osdcore.h" #include "coretmpl.h" @@ -580,5 +580,4 @@ private: uint32_t m_write_hunk; // next hunk to write }; - -#endif // __CHD_H__ +#endif // MAME_UTIL_CHD_H diff --git a/src/lib/util/chdcd.h b/src/lib/util/chdcd.h index 3f31bad7e00..65e4b943964 100644 --- a/src/lib/util/chdcd.h +++ b/src/lib/util/chdcd.h @@ -6,10 +6,10 @@ ***************************************************************************/ -#pragma once +#ifndef MAME_UTIL_CHDCD_H +#define MAME_UTIL_CHDCD_H -#ifndef __CHDCD_H__ -#define __CHDCD_H__ +#pragma once #include "cdrom.h" @@ -35,4 +35,4 @@ struct chdcd_track_input_info chd_error chdcd_parse_toc(const char *tocfname, cdrom_toc &outtoc, chdcd_track_input_info &outinfo); -#endif /* __CHDCD_H__ */ +#endif // MAME_UTIL_CHDCD_H diff --git a/src/lib/util/chdcodec.h b/src/lib/util/chdcodec.h index 899b5363592..e688b41a108 100644 --- a/src/lib/util/chdcodec.h +++ b/src/lib/util/chdcodec.h @@ -8,10 +8,10 @@ ***************************************************************************/ -#pragma once +#ifndef MAME_UTIL_CHDCODEC_H +#define MAME_UTIL_CHDCODEC_H -#ifndef __CHDCODEC_H__ -#define __CHDCODEC_H__ +#pragma once #include "osdcore.h" #include "coretmpl.h" @@ -190,5 +190,4 @@ enum AVHUFF_CODEC_DECOMPRESS_CONFIG = 1 }; - -#endif // __CHDCODEC_H__ +#endif // MAME_UTIL_CHDCODEC_H diff --git a/src/lib/util/corestr.h b/src/lib/util/corestr.h index 4df0a5ae812..d7734d50b29 100644 --- a/src/lib/util/corestr.h +++ b/src/lib/util/corestr.h @@ -8,10 +8,10 @@ ***************************************************************************/ -#pragma once +#ifndef MAME_UTIL_CORESTR_H +#define MAME_UTIL_CORESTR_H -#ifndef __CORESTR_H__ -#define __CORESTR_H__ +#pragma once #include "osdcore.h" #include "strformat.h" @@ -64,4 +64,4 @@ std::string &strmakeupper(std::string& str); std::string &strmakelower(std::string& str); int strreplace(std::string &str, const std::string& search, const std::string& replace); -#endif /* __CORESTR_H__ */ +#endif // MAME_UTIL_CORESTR_H diff --git a/src/lib/util/coretmpl.h b/src/lib/util/coretmpl.h index 08c3a6b8678..4b3b05bf274 100644 --- a/src/lib/util/coretmpl.h +++ b/src/lib/util/coretmpl.h @@ -990,6 +990,26 @@ constexpr std::enable_if_t::value, T> iabs(T v) noexcept return (v < T(0)) ? -v : v; } + +// returns greatest common divisor of a and b using the Euclidean algorithm +template +constexpr std::common_type_t euclid_gcd(M a, N b) +{ + return b ? euclid_gcd(b, a % b) : a; +} + +// reduce a fraction +template +inline void reduce_fraction(M &num, N &den) +{ + auto const div(euclid_gcd(num, den)); + if (div) + { + num /= div; + den /= div; + } +} + }; // namespace util #endif // MAME_UTIL_CORETMPL_H diff --git a/src/lib/util/coreutil.h b/src/lib/util/coreutil.h index 0a584c4a39e..cf5106f953d 100644 --- a/src/lib/util/coreutil.h +++ b/src/lib/util/coreutil.h @@ -8,10 +8,10 @@ ***************************************************************************/ -#pragma once +#ifndef MAME_UTIL_COREUTIL_H +#define MAME_UTIL_COREUTIL_H -#ifndef __COREUTIL_H__ -#define __COREUTIL_H__ +#pragma once #include "osdcomm.h" @@ -81,4 +81,4 @@ void rand_memory(void *memory, size_t length); uint32_t core_crc32(uint32_t crc, const uint8_t *buf, uint32_t len); -#endif /* __COREUTIL_H__ */ +#endif // MAME_UTIL_COREUTIL_H diff --git a/src/lib/util/delegate.h b/src/lib/util/delegate.h index f8e23faf57d..e4b870ed06d 100644 --- a/src/lib/util/delegate.h +++ b/src/lib/util/delegate.h @@ -73,10 +73,10 @@ ***************************************************************************/ -#pragma once +#ifndef MAME_UTIL_DELEGATE_H +#define MAME_UTIL_DELEGATE_H -#ifndef __DELEGATE_H__ -#define __DELEGATE_H__ +#pragma once // standard C++ includes #include @@ -619,5 +619,4 @@ public: delegate &operator=(const basetype &src) { *static_cast(this) = src; return *this; } }; - -#endif /* __DELEGATE_H__ */ +#endif // MAME_UTIL_DELEGATE_H diff --git a/src/lib/util/flac.h b/src/lib/util/flac.h index f5951945b07..20e3f1b9378 100644 --- a/src/lib/util/flac.h +++ b/src/lib/util/flac.h @@ -8,10 +8,10 @@ ***************************************************************************/ -#pragma once +#ifndef MAME_UTIL_FLAC_H +#define MAME_UTIL_FLAC_H -#ifndef __FLAC_H__ -#define __FLAC_H__ +#pragma once #include "osdcore.h" #include "corefile.h" @@ -126,20 +126,19 @@ private: // output state FLAC__StreamDecoder * m_decoder; // actual encoder util::core_file * m_file; // output file - uint32_t m_sample_rate; // decoded sample rate - uint8_t m_channels; // decoded number of channels - uint8_t m_bits_per_sample; // decoded bits per sample - uint32_t m_compressed_offset; // current offset in compressed data + uint32_t m_sample_rate; // decoded sample rate + uint8_t m_channels; // decoded number of channels + uint8_t m_bits_per_sample; // decoded bits per sample + uint32_t m_compressed_offset; // current offset in compressed data const FLAC__byte * m_compressed_start; // start of compressed data - uint32_t m_compressed_length; // length of compressed data + uint32_t m_compressed_length; // length of compressed data const FLAC__byte * m_compressed2_start; // start of compressed data - uint32_t m_compressed2_length; // length of compressed data - int16_t * m_uncompressed_start[8];// pointer to start of uncompressed data (up to 8 streams) - uint32_t m_uncompressed_offset; // current position in uncompressed data - uint32_t m_uncompressed_length; // length of uncompressed data + uint32_t m_compressed2_length; // length of compressed data + int16_t * m_uncompressed_start[8];// pointer to start of uncompressed data (up to 8 streams) + uint32_t m_uncompressed_offset; // current position in uncompressed data + uint32_t m_uncompressed_length; // length of uncompressed data bool m_uncompressed_swap; // swap uncompressed sample data - uint8_t m_custom_header[0x2a]; // custom header + uint8_t m_custom_header[0x2a]; // custom header }; - -#endif // __FLAC_H__ +#endif // MAME_UTIL_FLAC_H diff --git a/src/lib/util/harddisk.h b/src/lib/util/harddisk.h index 727f9a3fd07..c0551703ca7 100644 --- a/src/lib/util/harddisk.h +++ b/src/lib/util/harddisk.h @@ -8,10 +8,10 @@ ***************************************************************************/ -#pragma once +#ifndef MAME_UTIL_HARDDISK_H +#define MAME_UTIL_HARDDISK_H -#ifndef __HARDDISK_H__ -#define __HARDDISK_H__ +#pragma once #include "osdcore.h" #include "chd.h" @@ -46,4 +46,4 @@ hard_disk_info *hard_disk_get_info(hard_disk_file *file); uint32_t hard_disk_read(hard_disk_file *file, uint32_t lbasector, void *buffer); uint32_t hard_disk_write(hard_disk_file *file, uint32_t lbasector, const void *buffer); -#endif /* __HARDDISK_H__ */ +#endif // MAME_UTIL_HARDDISK_H diff --git a/src/lib/util/hash.h b/src/lib/util/hash.h index 23c8702958e..cb87f3f8b3c 100644 --- a/src/lib/util/hash.h +++ b/src/lib/util/hash.h @@ -10,10 +10,10 @@ ***************************************************************************/ -#pragma once +#ifndef MAME_UTIL_HASH_H +#define MAME_UTIL_HASH_H -#ifndef __HASH_H__ -#define __HASH_H__ +#pragma once #include "hashing.h" @@ -119,4 +119,4 @@ private: } // namespace util -#endif /* __HASH_H__ */ +#endif // MAME_UTIL_HASH_H diff --git a/src/lib/util/hashing.h b/src/lib/util/hashing.h index 5e9c9134c97..b1505c654a4 100644 --- a/src/lib/util/hashing.h +++ b/src/lib/util/hashing.h @@ -8,10 +8,10 @@ ***************************************************************************/ -#pragma once +#ifndef MAME_UTIL_HASHING_H +#define MAME_UTIL_HASHING_H -#ifndef __HASHING_H__ -#define __HASHING_H__ +#pragma once #include "osdcore.h" #include "corestr.h" @@ -260,4 +260,4 @@ template <> struct hash<::util::crc16_t> } // namespace std -#endif // __HASHING_H__ +#endif // MAME_UTIL_HASHING_H diff --git a/src/lib/util/huffman.h b/src/lib/util/huffman.h index 2814eb127dd..0eac393f380 100644 --- a/src/lib/util/huffman.h +++ b/src/lib/util/huffman.h @@ -8,10 +8,10 @@ ***************************************************************************/ -#pragma once +#ifndef MAME_UTIL_HUFFMAN_H +#define MAME_UTIL_HUFFMAN_H -#ifndef __HUFFMAN_H__ -#define __HUFFMAN_H__ +#pragma once #include "osdcore.h" #include "bitstream.h" @@ -219,5 +219,4 @@ inline uint32_t huffman_decoder<_NumCodes, _MaxBits>::decode_one(bitstream_in &b return lookup >> 5; } - -#endif +#endif // MAME_UTIL_HUFFMAN_H diff --git a/src/lib/util/jedparse.h b/src/lib/util/jedparse.h index e2eca46b236..f12101ca154 100644 --- a/src/lib/util/jedparse.h +++ b/src/lib/util/jedparse.h @@ -8,8 +8,10 @@ ***************************************************************************/ -#ifndef __JEDPARSE_H__ -#define __JEDPARSE_H__ +#ifndef MAME_UTIL_JEDPARSE_H +#define MAME_UTIL_JEDPARSE_H + +#pragma once #include "osdcore.h" @@ -84,4 +86,4 @@ static inline void jed_set_fuse(jed_data *data, uint32_t fusenum, uint8_t value) } } -#endif /* __JEDPARSE_H__ */ +#endif // MAME_UTIL_JEDPARSE_H diff --git a/src/lib/util/opresolv.h b/src/lib/util/opresolv.h index 1b1bc692118..52030dc4336 100644 --- a/src/lib/util/opresolv.h +++ b/src/lib/util/opresolv.h @@ -38,8 +38,10 @@ ****************************************************************************/ -#ifndef __OPRESOLV_H__ -#define __OPRESOLV_H__ +#ifndef MAME_UTIL_OPRESOLV_H +#define MAME_UTIL_OPRESOLV_H + +#pragma once #include #include @@ -271,4 +273,4 @@ private: } // namespace util -#endif /* __OPRESOLV_H__ */ +#endif // MAME_UTIL_OPRESOLV_H diff --git a/src/lib/util/palette.h b/src/lib/util/palette.h index 8febfe39764..ff2c7bb80c9 100644 --- a/src/lib/util/palette.h +++ b/src/lib/util/palette.h @@ -8,10 +8,10 @@ ***************************************************************************/ -#pragma once +#ifndef MAME_UTIL_PALETTE_H +#define MAME_UTIL_PALETTE_H -#ifndef __PALETTE_H__ -#define __PALETTE_H__ +#pragma once #include "osdcore.h" #include "coretmpl.h" @@ -278,5 +278,4 @@ inline rgb_t pal555(uint32_t data, uint8_t rshift, uint8_t gshift, uint8_t bshif inline rgb_t pal565(uint32_t data, uint8_t rshift, uint8_t gshift, uint8_t bshift) { return rgbexpand<5,6,5>(data, rshift, gshift, bshift); } inline rgb_t pal888(uint32_t data, uint8_t rshift, uint8_t gshift, uint8_t bshift) { return rgbexpand<8,8,8>(data, rshift, gshift, bshift); } - -#endif // __PALETTE_H__ +#endif // MAME_UTIL_PALETTE_H diff --git a/src/lib/util/plaparse.h b/src/lib/util/plaparse.h index e3bfcaf0e2a..b0d3cbbe4e3 100644 --- a/src/lib/util/plaparse.h +++ b/src/lib/util/plaparse.h @@ -8,8 +8,10 @@ ***************************************************************************/ -#ifndef __PLAPARSE_H__ -#define __PLAPARSE_H__ +#ifndef MAME_UTIL_PLAPARSE_H +#define MAME_UTIL_PLAPARSE_H + +#pragma once #include "osdcore.h" #include "jedparse.h" @@ -22,6 +24,4 @@ /* parse a file (read into memory) into a jed_data structure */ int pla_parse(const void *data, size_t length, jed_data *result); - - -#endif /* __PLAPARSE_H__ */ +#endif // MAME_UTIL_PLAPARSE_H diff --git a/src/lib/util/pool.h b/src/lib/util/pool.h index 305fc9c5f51..2d1c5af31a7 100644 --- a/src/lib/util/pool.h +++ b/src/lib/util/pool.h @@ -8,8 +8,10 @@ ***************************************************************************/ -#ifndef __POOL_H__ -#define __POOL_H__ +#ifndef MAME_UTIL_POOL_H +#define MAME_UTIL_POOL_H + +#pragma once #include "osdcore.h" @@ -113,4 +115,4 @@ char *pool_strdup_file_line(object_pool *pool, const char *str, const char *file bool test_memory_pools(void); -#endif /* __POOL_H__ */ +#endif // MAME_UTIL_POOL_H diff --git a/src/lib/util/vbiparse.h b/src/lib/util/vbiparse.h index 4ccb6a935c4..8113cb5cb32 100644 --- a/src/lib/util/vbiparse.h +++ b/src/lib/util/vbiparse.h @@ -8,10 +8,10 @@ ***************************************************************************/ -#pragma once +#ifndef MAME_UTIL_VBIPARSE_H +#define MAME_UTIL_VBIPARSE_H -#ifndef __VBIPARSE_H__ -#define __VBIPARSE_H__ +#pragma once #include "osdcomm.h" @@ -90,4 +90,4 @@ void vbi_metadata_pack(uint8_t *dest, uint32_t framenum, const vbi_metadata *vbi void vbi_metadata_unpack(vbi_metadata *vbi, uint32_t *framenum, const uint8_t *source); -#endif /* __VBIPARSE_H__ */ +#endif // MAME_UTIL_VBIPARSE_H diff --git a/src/lib/util/wavwrite.h b/src/lib/util/wavwrite.h index da94a9d3782..8ceb6ad2a0d 100644 --- a/src/lib/util/wavwrite.h +++ b/src/lib/util/wavwrite.h @@ -1,9 +1,9 @@ // license:BSD-3-Clause // copyright-holders:Aaron Giles -#pragma once +#ifndef MAME_UTIL_WAVWRITE_H +#define MAME_UTIL_WAVWRITE_H -#ifndef __WAVWRITE_H__ -#define __WAVWRITE_H__ +#pragma once struct wav_file; @@ -15,4 +15,4 @@ void wav_add_data_32(wav_file *wavptr, int32_t *data, int samples, int shift); void wav_add_data_16lr(wav_file *wavptr, int16_t *left, int16_t *right, int samples); void wav_add_data_32lr(wav_file *wavptr, int32_t *left, int32_t *right, int samples, int shift); -#endif /* __WAVWRITE_H__ */ +#endif // MAME_UTIL_WAVWRITE_H diff --git a/src/mame/drivers/alesis.cpp b/src/mame/drivers/alesis.cpp index fb331764ec4..322c9da3f23 100644 --- a/src/mame/drivers/alesis.cpp +++ b/src/mame/drivers/alesis.cpp @@ -431,7 +431,6 @@ MACHINE_CONFIG_START(alesis_state::hr16) MCFG_SCREEN_VISIBLE_AREA(0, 6*16-1, 0, 9*2-1) MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) MCFG_SCREEN_PALETTE("palette") - config.set_default_layout(layout_lcd); MCFG_PALETTE_ADD_MONOCHROME("palette") MCFG_PALETTE_INIT_OWNER(alesis_state, alesis) diff --git a/src/mame/drivers/alphasma.cpp b/src/mame/drivers/alphasma.cpp index 50736a86f61..0b5137f6452 100644 --- a/src/mame/drivers/alphasma.cpp +++ b/src/mame/drivers/alphasma.cpp @@ -18,7 +18,6 @@ #include "machine/ram.h" #include "video/hd44780.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" class alphasmart_state : public driver_device @@ -458,7 +457,6 @@ MACHINE_CONFIG_START(alphasmart_state::alphasmart) MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(alphasmart_state, alphasmart) - config.set_default_layout(layout_lcd); MCFG_NVRAM_ADD_0FILL("nvram") MACHINE_CONFIG_END diff --git a/src/mame/drivers/alto2.cpp b/src/mame/drivers/alto2.cpp index 890548e059e..2fcfa30f009 100644 --- a/src/mame/drivers/alto2.cpp +++ b/src/mame/drivers/alto2.cpp @@ -290,16 +290,13 @@ MACHINE_CONFIG_START(alto2_state::alto2) MCFG_DEVICE_IO_MAP(alto2_iomem_map) // Video hardware - MCFG_SCREEN_ADD_MONOCHROME("screen", RASTER, rgb_t::white()) - MCFG_SCREEN_RAW_PARAMS(XTAL(20'160'000), - A2_DISP_TOTAL_WIDTH, 0, A2_DISP_WIDTH, - A2_DISP_TOTAL_HEIGHT, 0, A2_DISP_HEIGHT) - // Two interlaced fields at 60Hz => 30Hz frame rate - MCFG_SCREEN_REFRESH_RATE(30) - MCFG_SCREEN_UPDATE_DEVICE("maincpu", alto2_cpu_device, screen_update) - MCFG_SCREEN_PALETTE("palette") - - config.set_default_layout(layout_vertical); + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_color(rgb_t::white()); + screen.set_physical_aspect(3, 4); // Portrait CRT + screen.set_raw(XTAL(20'160'000), A2_DISP_TOTAL_WIDTH, 0, A2_DISP_WIDTH, A2_DISP_TOTAL_HEIGHT, 0, A2_DISP_HEIGHT); + screen.set_refresh_hz(30); // Two interlaced fields at 60Hz => 30Hz frame rate + screen.set_screen_update("maincpu", FUNC(alto2_cpu_device::screen_update)); + screen.set_palette("palette"); MCFG_PALETTE_ADD_MONOCHROME("palette") diff --git a/src/mame/drivers/bw2.cpp b/src/mame/drivers/bw2.cpp index 976a5a9131e..1b1a5d2bcc3 100644 --- a/src/mame/drivers/bw2.cpp +++ b/src/mame/drivers/bw2.cpp @@ -550,7 +550,6 @@ MACHINE_CONFIG_START(bw2_state::bw2) MCFG_DEVICE_IO_MAP(bw2_io) // video hardware - config.set_default_layout(layout_lcd); MCFG_SCREEN_ADD(SCREEN_TAG, LCD) MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_UPDATE_DEVICE( MSM6255_TAG, msm6255_device, screen_update ) diff --git a/src/mame/drivers/cesclass.cpp b/src/mame/drivers/cesclass.cpp index 8536ed29e21..98c638a197b 100644 --- a/src/mame/drivers/cesclass.cpp +++ b/src/mame/drivers/cesclass.cpp @@ -27,7 +27,6 @@ #include "sound/okim6295.h" #include "machine/nvram.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" #include "speaker.h" @@ -267,7 +266,6 @@ MACHINE_CONFIG_START(cesclassic_state::cesclassic) MCFG_SCREEN_UPDATE_DRIVER(cesclassic_state, screen_update) MCFG_SCREEN_SIZE(8*16*2, 8*8+3*8) MCFG_SCREEN_VISIBLE_AREA(0*8, 8*16*2-1, 0*8, 8*8-1) - config.set_default_layout(layout_lcd); MCFG_PALETTE_ADD("palette", 4) MCFG_PALETTE_INIT_OWNER(cesclassic_state, cesclassic) diff --git a/src/mame/drivers/cfx9850.cpp b/src/mame/drivers/cfx9850.cpp index 8f9007a3740..6aeff5cb610 100644 --- a/src/mame/drivers/cfx9850.cpp +++ b/src/mame/drivers/cfx9850.cpp @@ -28,7 +28,6 @@ Debugging information: #include "emu.h" #include "cpu/hcd62121/hcd62121.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" class cfx9850_state : public driver_device @@ -300,8 +299,6 @@ MACHINE_CONFIG_START(cfx9850_state::cfx9850) MCFG_SCREEN_UPDATE_DRIVER(cfx9850_state, screen_update_cfx9850) MCFG_SCREEN_PALETTE("palette") - config.set_default_layout(layout_lcd); - // TODO: Verify amount of colors and palette. Colors can be changed by changing the contrast. MCFG_PALETTE_ADD("palette", 4) MCFG_PALETTE_INIT_OWNER(cfx9850_state, cfx9850) diff --git a/src/mame/drivers/clcd.cpp b/src/mame/drivers/clcd.cpp index e2e9a1bd457..31cf84c7300 100644 --- a/src/mame/drivers/clcd.cpp +++ b/src/mame/drivers/clcd.cpp @@ -24,7 +24,6 @@ #include "machine/nvram.h" #include "sound/spkrdev.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" #include "speaker.h" @@ -815,7 +814,6 @@ MACHINE_CONFIG_START(clcd_state::clcd) MCFG_SCREEN_VISIBLE_AREA(0, 480-1, 0, 128-1) MCFG_SCREEN_PALETTE("palette") - config.set_default_layout(layout_lcd); MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(clcd_state, clcd) diff --git a/src/mame/drivers/cybiko.cpp b/src/mame/drivers/cybiko.cpp index c08ec4a387f..e95b97985b0 100644 --- a/src/mame/drivers/cybiko.cpp +++ b/src/mame/drivers/cybiko.cpp @@ -22,7 +22,6 @@ ToDo: #include "includes/cybiko.h" #include "bus/rs232/rs232.h" -#include "rendlay.h" #include "screen.h" #include "speaker.h" @@ -401,7 +400,7 @@ MACHINE_CONFIG_START(cybiko_state::cybikov1) MCFG_H8_SCI_CLK_CALLBACK(WRITELINE("flash1", at45db041_device, sck_w)) // screen - MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_ADD("screen", LCD) MCFG_SCREEN_REFRESH_RATE( 60 ) MCFG_SCREEN_SIZE( hd66421_device::WIDTH, hd66421_device::HEIGHT ) MCFG_SCREEN_VISIBLE_AREA( 0, hd66421_device::WIDTH - 1, 0, hd66421_device::HEIGHT - 1 ) @@ -409,7 +408,6 @@ MACHINE_CONFIG_START(cybiko_state::cybikov1) MCFG_SCREEN_PALETTE("hd66421:palette") // video MCFG_HD66421_ADD("hd66421") - config.set_default_layout(layout_lcd); // sound SPEAKER(config, "mono").front_center(); MCFG_DEVICE_ADD("speaker", SPEAKER_SOUND) diff --git a/src/mame/drivers/deshoros.cpp b/src/mame/drivers/deshoros.cpp index cbec35e6ab8..99e797a710a 100644 --- a/src/mame/drivers/deshoros.cpp +++ b/src/mame/drivers/deshoros.cpp @@ -33,7 +33,6 @@ TODO: #include "cpu/m6809/m6809.h" #include "sound/beep.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" #include "speaker.h" @@ -280,7 +279,6 @@ MACHINE_CONFIG_START(destiny_state::destiny) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ MCFG_SCREEN_SIZE(6*16, 9*2) MCFG_SCREEN_VISIBLE_AREA(0, 6*16-1, 0, 9*2-1) - config.set_default_layout(layout_lcd); MCFG_SCREEN_UPDATE_DRIVER(destiny_state, screen_update_destiny) MCFG_SCREEN_PALETTE("palette") diff --git a/src/mame/drivers/fb01.cpp b/src/mame/drivers/fb01.cpp index 05e77a07e9e..0aa2b148e9a 100644 --- a/src/mame/drivers/fb01.cpp +++ b/src/mame/drivers/fb01.cpp @@ -17,7 +17,6 @@ #include "video/hd44780.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" #include "speaker.h" @@ -195,7 +194,6 @@ MACHINE_CONFIG_START(fb01_state::fb01) MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update) MCFG_SCREEN_PALETTE("palette") - config.set_default_layout(layout_lcd); // why set layout only to replace? config.set_default_layout(layout_fb01); MCFG_PALETTE_ADD("palette", 2) diff --git a/src/mame/drivers/gamepock.cpp b/src/mame/drivers/gamepock.cpp index 5c8e8c5fbe5..33c4a697374 100644 --- a/src/mame/drivers/gamepock.cpp +++ b/src/mame/drivers/gamepock.cpp @@ -9,7 +9,6 @@ #include "cpu/upd7810/upd7810.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" #include "softlist.h" #include "speaker.h" @@ -59,8 +58,6 @@ MACHINE_CONFIG_START(gamepock_state::gamepock) screen.set_screen_update(FUNC(gamepock_state::screen_update_gamepock)); screen.set_palette("palette"); - config.set_default_layout(layout_lcd); - MCFG_PALETTE_ADD_MONOCHROME("palette") /* sound hardware */ diff --git a/src/mame/drivers/gb.cpp b/src/mame/drivers/gb.cpp index eaa2562c7af..49f1a2b4e2a 100644 --- a/src/mame/drivers/gb.cpp +++ b/src/mame/drivers/gb.cpp @@ -274,7 +274,6 @@ space. This mapper uses 32KB sized banks. ***************************************************************************/ #include "emu.h" -#include "rendlay.h" #include "includes/gb.h" #include "bus/gameboy/rom.h" #include "bus/gameboy/mbc.h" @@ -617,16 +616,14 @@ MACHINE_CONFIG_START(gb_state::gameboy) MCFG_LR35902_HALT_BUG /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(DMG_FRAMES_PER_SECOND) - MCFG_SCREEN_VBLANK_TIME(0) - MCFG_SCREEN_UPDATE_DEVICE("ppu", dmg_ppu_device, screen_update) - MCFG_SCREEN_PALETTE("palette") - - config.set_default_layout(layout_lcd); -// MCFG_SCREEN_SIZE(20*8, 18*8) - MCFG_SCREEN_SIZE( 458, 154 ) - MCFG_SCREEN_VISIBLE_AREA(0*8, 20*8-1, 0*8, 18*8-1) + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD)); + screen.set_refresh_hz(DMG_FRAMES_PER_SECOND); + screen.set_vblank_time(0); + screen.set_screen_update("ppu", FUNC(dmg_ppu_device::screen_update)); + screen.set_palette("palette"); +// screen.set_size(20*8, 18*8); + screen.set_size(458, 154); + screen.set_visarea(0*8, 20*8-1, 0*8, 18*8-1); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfxdecode_device::empty) MCFG_PALETTE_ADD("palette", 4) @@ -660,15 +657,14 @@ MACHINE_CONFIG_START(gb_state::supergb) MCFG_MACHINE_RESET_OVERRIDE(gb_state, sgb) /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(SGB_FRAMES_PER_SECOND) - MCFG_SCREEN_VBLANK_TIME(0) - MCFG_SCREEN_UPDATE_DEVICE("ppu", dmg_ppu_device, screen_update) - MCFG_SCREEN_PALETTE("palette") - - config.set_default_layout(layout_horizont); /* runs on a TV, not an LCD */ - MCFG_SCREEN_SIZE(32*8, 28*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1) + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD)); + screen.set_physical_aspect(4, 3); // runs on a TV, not an LCD + screen.set_refresh_hz(SGB_FRAMES_PER_SECOND); + screen.set_vblank_time(0); + screen.set_screen_update("ppu", FUNC(dmg_ppu_device::screen_update)); + screen.set_palette("palette"); + screen.set_size(32*8, 28*8); + screen.set_visarea(0*8, 32*8-1, 0*8, 28*8-1); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfxdecode_device::empty) MCFG_PALETTE_ADD("palette", 32768) @@ -701,11 +697,10 @@ MACHINE_CONFIG_START(gb_state::supergb2) MCFG_MACHINE_RESET_OVERRIDE(gb_state, sgb) /* video hardware */ - config.set_default_layout(layout_horizont); /* runs on a TV, not an LCD */ - - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_SIZE(32*8, 28*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1) + screen_device &screen(*subdevice("screen")); + screen.set_physical_aspect(4, 3); // runs on a TV, not an LCD + screen.set_size(32*8, 28*8); + screen.set_visarea(0*8, 32*8-1, 0*8, 28*8-1); MCFG_PALETTE_MODIFY("palette") MCFG_PALETTE_ENTRIES(32768) @@ -738,16 +733,14 @@ MACHINE_CONFIG_START(gb_state::gbcolor) MCFG_MACHINE_RESET_OVERRIDE(gb_state,gbc) /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(DMG_FRAMES_PER_SECOND) - MCFG_SCREEN_VBLANK_TIME(0) - MCFG_SCREEN_UPDATE_DEVICE("ppu", dmg_ppu_device, screen_update) - MCFG_SCREEN_PALETTE("palette") - - config.set_default_layout(layout_lcd); -// MCFG_SCREEN_SIZE(20*8, 18*8) - MCFG_SCREEN_SIZE( 458, 154 ) - MCFG_SCREEN_VISIBLE_AREA(0*8, 20*8-1, 0*8, 18*8-1) + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD)); + screen.set_refresh_hz(DMG_FRAMES_PER_SECOND); + screen.set_vblank_time(0); + screen.set_screen_update("ppu", FUNC(dmg_ppu_device::screen_update)); + screen.set_palette("palette"); +// screen.set_size(20*8, 18*8); + screen.set_size(458, 154); + screen.set_visarea(0*8, 20*8-1, 0*8, 18*8-1); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfxdecode_device::empty) @@ -783,19 +776,17 @@ MACHINE_CONFIG_START(megaduck_state::megaduck) MCFG_LR35902_HALT_BUG /* video hardware */ - MCFG_SCREEN_ADD("screen", LCD) - MCFG_SCREEN_REFRESH_RATE(DMG_FRAMES_PER_SECOND) - MCFG_SCREEN_VBLANK_TIME(0) - MCFG_SCREEN_PALETTE("palette") + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD)); + screen.set_refresh_hz(DMG_FRAMES_PER_SECOND); + screen.set_vblank_time(0); + screen.set_screen_update("ppu", FUNC(dmg_ppu_device::screen_update)); + screen.set_palette("palette"); + screen.set_size(20*8, 18*8); + screen.set_visarea(0*8, 20*8-1, 0*8, 18*8-1); MCFG_MACHINE_START_OVERRIDE(megaduck_state, megaduck) MCFG_MACHINE_RESET_OVERRIDE(megaduck_state, megaduck) - MCFG_SCREEN_UPDATE_DEVICE("ppu", dmg_ppu_device, screen_update) - MCFG_SCREEN_SIZE(20*8, 18*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 20*8-1, 0*8, 18*8-1) - - config.set_default_layout(layout_lcd); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfxdecode_device::empty) MCFG_PALETTE_ADD("palette", 4) diff --git a/src/mame/drivers/gizmondo.cpp b/src/mame/drivers/gizmondo.cpp index c1fa29da123..b2a215604f7 100644 --- a/src/mame/drivers/gizmondo.cpp +++ b/src/mame/drivers/gizmondo.cpp @@ -34,7 +34,6 @@ SYSINTR_GPS = INT_EINT3, INT_EINT8_23 (EINT18) #include "machine/docg3.h" #include "machine/s3c2440.h" #include "video/gf4500.h" -#include "rendlay.h" #include "screen.h" @@ -203,8 +202,6 @@ MACHINE_CONFIG_START(gizmondo_state::gizmondo) MCFG_SCREEN_VISIBLE_AREA(0, 320 - 1, 0, 240 - 1) MCFG_SCREEN_UPDATE_DEVICE("gf4500", gf4500_device, screen_update) - config.set_default_layout(layout_lcd); - MCFG_GF4500_ADD("gf4500") MCFG_DEVICE_ADD("s3c2440", S3C2440, 12000000) diff --git a/src/mame/drivers/gmaster.cpp b/src/mame/drivers/gmaster.cpp index 1863f322822..483beef069f 100644 --- a/src/mame/drivers/gmaster.cpp +++ b/src/mame/drivers/gmaster.cpp @@ -13,7 +13,6 @@ #include "bus/generic/carts.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" #include "softlist.h" #include "speaker.h" @@ -357,7 +356,6 @@ MACHINE_CONFIG_START(gmaster_state::gmaster) MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(gmaster_palette)) MCFG_PALETTE_INIT_OWNER(gmaster_state, gmaster) - config.set_default_layout(layout_lcd); SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker).add_route(0, "mono", 0.50); diff --git a/src/mame/drivers/gp32.cpp b/src/mame/drivers/gp32.cpp index 6235ce7eefd..00fcd718098 100644 --- a/src/mame/drivers/gp32.cpp +++ b/src/mame/drivers/gp32.cpp @@ -23,7 +23,6 @@ #include "cpu/arm7/arm7core.h" #include "sound/volt_reg.h" -#include "rendlay.h" #include "softlist.h" #include "speaker.h" @@ -1687,9 +1686,6 @@ MACHINE_CONFIG_START(gp32_state::gp32) MCFG_SCREEN_VISIBLE_AREA(0, 239, 0, 319) MCFG_SCREEN_UPDATE_DRIVER(gp32_state, screen_update_gp32) - /* 320x240 is 4:3 but ROT270 causes an aspect ratio of 3:4 by default */ - config.set_default_layout(layout_lcd_rot); - SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); MCFG_DEVICE_ADD("ldac", DAC_16BIT_R2R_TWOS_COMPLEMENT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) // unknown DAC diff --git a/src/mame/drivers/gridcomp.cpp b/src/mame/drivers/gridcomp.cpp index eb6ce77c674..afe2ae7e3b5 100644 --- a/src/mame/drivers/gridcomp.cpp +++ b/src/mame/drivers/gridcomp.cpp @@ -77,7 +77,6 @@ #include "sound/spkrdev.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" #include "softlist.h" #include "speaker.h" @@ -384,11 +383,10 @@ MACHINE_CONFIG_START(gridcomp_state::grid1101) MCFG_DEVICE_ADD("speaker", SPEAKER_SOUND) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - MCFG_SCREEN_ADD_MONOCHROME("screen", RASTER, rgb_t::amber()) + MCFG_SCREEN_ADD_MONOCHROME("screen", LCD, rgb_t::amber()) // actually a kind of EL display MCFG_SCREEN_UPDATE_DRIVER(gridcomp_state, screen_update_110x) MCFG_SCREEN_RAW_PARAMS(XTAL(15'000'000)/2, 424, 0, 320, 262, 0, 240) // XXX 66 Hz refresh MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(I80130_TAG, i80130_device, ir3_w)) - config.set_default_layout(layout_lcd); MCFG_SCREEN_PALETTE("palette") MCFG_PALETTE_ADD_MONOCHROME("palette") @@ -628,4 +626,3 @@ COMP( 1984, grid1121, 0, 0, grid1121, gridcomp, gridcomp_state, empt COMP( 1984, grid1129, grid1121, 0, grid1129, gridcomp, gridcomp_state, empty_init, "GRiD Computers", "Compass II 1129", MACHINE_IS_SKELETON ) COMP( 1984, grid1131, grid1121, 0, grid1131, gridcomp, gridcomp_state, empty_init, "GRiD Computers", "Compass II 1131", MACHINE_IS_SKELETON ) COMP( 1984, grid1139, grid1121, 0, grid1139, gridcomp, gridcomp_state, empty_init, "GRiD Computers", "Compass II 1139", MACHINE_IS_SKELETON ) - diff --git a/src/mame/drivers/hh_hmcs40.cpp b/src/mame/drivers/hh_hmcs40.cpp index b2caa7e5aca..3baefb4f54f 100644 --- a/src/mame/drivers/hh_hmcs40.cpp +++ b/src/mame/drivers/hh_hmcs40.cpp @@ -95,7 +95,6 @@ #include "machine/gen_latch.h" #include "machine/timer.h" #include "sound/spkrdev.h" -#include "rendlay.h" #include "screen.h" #include "speaker.h" @@ -109,8 +108,8 @@ class hh_hmcs40_state : public driver_device { public: - hh_hmcs40_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + hh_hmcs40_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_soundlatch(*this, "soundlatch"), @@ -445,7 +444,6 @@ MACHINE_CONFIG_START(bambball_state::bambball) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(1920, 478) MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 478-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -582,7 +580,6 @@ MACHINE_CONFIG_START(bmboxing_state::bmboxing) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(1920, 529) MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 529-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -706,7 +703,6 @@ MACHINE_CONFIG_START(bfriskyt_state::bfriskyt) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(1920, 675) MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 675-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -817,7 +813,6 @@ MACHINE_CONFIG_START(packmon_state::packmon) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(1920, 766) MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 766-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -951,7 +946,6 @@ MACHINE_CONFIG_START(msthawk_state::msthawk) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(1920, 696) MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 696-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -1073,7 +1067,6 @@ MACHINE_CONFIG_START(bzaxxon_state::bzaxxon) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(613, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 613-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -1191,7 +1184,6 @@ MACHINE_CONFIG_START(zackman_state::zackman) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(487, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 487-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -1319,7 +1311,6 @@ MACHINE_CONFIG_START(bpengo_state::bpengo) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(1920, 759) MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 759-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -1443,7 +1434,6 @@ MACHINE_CONFIG_START(bbtime_state::bbtime) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(379, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 379-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -1542,7 +1532,6 @@ MACHINE_CONFIG_START(bdoramon_state::bdoramon) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(1920, 668) MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 668-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -1634,7 +1623,6 @@ MACHINE_CONFIG_START(bultrman_state::bultrman) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(1920, 673) MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 673-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -1724,7 +1712,6 @@ MACHINE_CONFIG_START(machiman_state::machiman) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(1534, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 1534-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -1993,7 +1980,6 @@ MACHINE_CONFIG_START(alnattck_state::alnattck) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(1920, 700) MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 700-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -2123,7 +2109,6 @@ MACHINE_CONFIG_START(cdkong_state::cdkong) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(605, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 605-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -2252,7 +2237,6 @@ MACHINE_CONFIG_START(cgalaxn_state::cgalaxn) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(526, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 526-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -2374,7 +2358,6 @@ MACHINE_CONFIG_START(cpacman_state::cpacman) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(484, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 484-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -2491,7 +2474,6 @@ MACHINE_CONFIG_START(cmspacmn_state::cmspacmn) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(481, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 481-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -2753,7 +2735,6 @@ MACHINE_CONFIG_START(egalaxn2_state::egalaxn2) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(505, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 505-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -3014,7 +2995,6 @@ MACHINE_CONFIG_START(eturtles_state::eturtles) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(484, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 484-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -3123,7 +3103,6 @@ MACHINE_CONFIG_START(estargte_state::estargte) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(1920, 854) MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 854-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -3239,7 +3218,6 @@ MACHINE_CONFIG_START(ghalien_state::ghalien) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(1920, 699) MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 699-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -3366,7 +3344,6 @@ MACHINE_CONFIG_START(gckong_state::gckong) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(506, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 506-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -3487,7 +3464,6 @@ MACHINE_CONFIG_START(gdigdug_state::gdigdug) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(476, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 476-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -3648,7 +3624,6 @@ MACHINE_CONFIG_START(mwcbaseb_state::mwcbaseb) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(1920, 478) MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 478-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -3738,7 +3713,6 @@ MACHINE_CONFIG_START(pbqbert_state::pbqbert) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(603, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 603-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -3859,7 +3833,6 @@ MACHINE_CONFIG_START(kingman_state::kingman) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(374, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 374-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -3980,7 +3953,6 @@ MACHINE_CONFIG_START(tmtron_state::tmtron) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(1920, 662) MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 662-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -4075,7 +4047,6 @@ MACHINE_CONFIG_START(vinvader_state::vinvader) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(233, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 233-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ diff --git a/src/mame/drivers/hh_melps4.cpp b/src/mame/drivers/hh_melps4.cpp index f600c87b2a8..888d403f791 100644 --- a/src/mame/drivers/hh_melps4.cpp +++ b/src/mame/drivers/hh_melps4.cpp @@ -13,7 +13,6 @@ #include "machine/timer.h" #include "sound/spkrdev.h" -#include "rendlay.h" #include "screen.h" #include "speaker.h" @@ -23,8 +22,8 @@ class hh_melps4_state : public driver_device { public: - hh_melps4_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + hh_melps4_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_inp_matrix(*this, "IN.%u", 0), m_out_x(*this, "%u.%u", 0U, 0U), @@ -311,7 +310,6 @@ MACHINE_CONFIG_START(cfrogger_state::cfrogger) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(500, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 500-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_melps4_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -428,7 +426,6 @@ MACHINE_CONFIG_START(gjungler_state::gjungler) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(481, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 481-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_melps4_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ diff --git a/src/mame/drivers/hh_sm510.cpp b/src/mame/drivers/hh_sm510.cpp index 04d5e0fc213..b224001112a 100644 --- a/src/mame/drivers/hh_sm510.cpp +++ b/src/mame/drivers/hh_sm510.cpp @@ -297,7 +297,6 @@ MACHINE_CONFIG_START(kdribble_state::kdribble) MCFG_SCREEN_VISIBLE_AREA(0, 1524-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -370,7 +369,6 @@ MACHINE_CONFIG_START(ktopgun_state::ktopgun) MCFG_SCREEN_VISIBLE_AREA(0, 1515-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -444,7 +442,6 @@ MACHINE_CONFIG_START(kcontra_state::kcontra) MCFG_SCREEN_VISIBLE_AREA(0, 1505-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -517,7 +514,6 @@ MACHINE_CONFIG_START(ktmnt_state::ktmnt) MCFG_SCREEN_VISIBLE_AREA(0, 1505-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -587,7 +583,6 @@ MACHINE_CONFIG_START(kgradius_state::kgradius) MCFG_SCREEN_VISIBLE_AREA(0, 1420-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -655,7 +650,6 @@ MACHINE_CONFIG_START(kloneran_state::kloneran) MCFG_SCREEN_VISIBLE_AREA(0, 1497-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -726,7 +720,6 @@ MACHINE_CONFIG_START(kblades_state::kblades) MCFG_SCREEN_SIZE(1516, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 1516-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -799,7 +792,6 @@ MACHINE_CONFIG_START(knfl_state::knfl) MCFG_SCREEN_SIZE(1449, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 1449-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -871,7 +863,6 @@ MACHINE_CONFIG_START(kbilly_state::kbilly) MCFG_SCREEN_SIZE(1490, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 1490-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -937,7 +928,6 @@ MACHINE_CONFIG_START(kbucky_state::kbucky) MCFG_SCREEN_SIZE(1490, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 1490-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -1007,7 +997,6 @@ MACHINE_CONFIG_START(kgarfld_state::kgarfld) MCFG_SCREEN_SIZE(1500, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 1500-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -1102,7 +1091,6 @@ MACHINE_CONFIG_START(gnw_mmouse_state::gnw_mmouse) MCFG_SCREEN_VISIBLE_AREA(0, 1711-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -1217,7 +1205,6 @@ MACHINE_CONFIG_START(gnw_mickdon_state::gnw_mickdon) MCFG_SCREEN_VISIBLE_AREA(0, 1920/2-1, 0, 1236/2-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_gnw_dualv); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -1301,7 +1288,6 @@ MACHINE_CONFIG_START(gnw_dkong2_state::gnw_dkong2) MCFG_SCREEN_VISIBLE_AREA(0, 1920/2-1, 0, 1237/2-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_gnw_dualv); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -1387,7 +1373,6 @@ MACHINE_CONFIG_START(gnw_mario_state::gnw_mario) MCFG_SCREEN_VISIBLE_AREA(0, 2261/2-1, 0, 1440/2-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_gnw_dualh); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -1474,7 +1459,6 @@ MACHINE_CONFIG_START(gnw_dkjr_state::gnw_dkjr) MCFG_SCREEN_VISIBLE_AREA(0, 1647-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -1556,7 +1540,6 @@ MACHINE_CONFIG_START(gnw_mariocm_state::gnw_mariocm) MCFG_SCREEN_VISIBLE_AREA(0, 1647-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -1639,7 +1622,6 @@ MACHINE_CONFIG_START(gnw_smb_state::gnw_smb) MCFG_SCREEN_VISIBLE_AREA(0, 1677-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -1742,7 +1724,6 @@ MACHINE_CONFIG_START(gnw_boxing_state::gnw_boxing) MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 524-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -1853,7 +1834,6 @@ MACHINE_CONFIG_START(tgaunt_state::tgaunt) MCFG_SCREEN_VISIBLE_AREA(0, 1425-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -1956,7 +1936,6 @@ MACHINE_CONFIG_START(tddragon_state::tddragon) MCFG_SCREEN_VISIBLE_AREA(0, 1467-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -2051,7 +2030,6 @@ MACHINE_CONFIG_START(tkarnov_state::tkarnov) MCFG_SCREEN_VISIBLE_AREA(0, 1477-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -2145,7 +2123,6 @@ MACHINE_CONFIG_START(tvindictr_state::tvindictr) MCFG_SCREEN_VISIBLE_AREA(0, 1459-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -2262,7 +2239,6 @@ MACHINE_CONFIG_START(tgaiden_state::tgaiden) MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -2352,7 +2328,6 @@ MACHINE_CONFIG_START(tbatman_state::tbatman) MCFG_SCREEN_VISIBLE_AREA(0, 1442-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -2446,7 +2421,6 @@ MACHINE_CONFIG_START(tsharr2_state::tsharr2) MCFG_SCREEN_VISIBLE_AREA(0, 1493-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -2537,7 +2511,6 @@ MACHINE_CONFIG_START(tstrider_state::tstrider) MCFG_SCREEN_VISIBLE_AREA(0, 1479-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -2632,7 +2605,6 @@ MACHINE_CONFIG_START(tgoldnaxe_state::tgoldnaxe) MCFG_SCREEN_VISIBLE_AREA(0, 1456-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -2744,7 +2716,6 @@ MACHINE_CONFIG_START(trobocop2_state::trobocop2) MCFG_SCREEN_VISIBLE_AREA(0, 1487-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -2852,7 +2823,6 @@ MACHINE_CONFIG_START(taltbeast_state::taltbeast) MCFG_SCREEN_VISIBLE_AREA(0, 1455-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -2947,7 +2917,6 @@ MACHINE_CONFIG_START(tsf2010_state::tsf2010) MCFG_SCREEN_VISIBLE_AREA(0, 1465-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -3038,7 +3007,6 @@ MACHINE_CONFIG_START(tswampt_state::tswampt) MCFG_SCREEN_VISIBLE_AREA(0, 1450-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -3133,7 +3101,6 @@ MACHINE_CONFIG_START(tspidman_state::tspidman) MCFG_SCREEN_VISIBLE_AREA(0, 1440-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -3228,7 +3195,6 @@ MACHINE_CONFIG_START(txmen_state::txmen) MCFG_SCREEN_VISIBLE_AREA(0, 1467-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -3323,7 +3289,6 @@ MACHINE_CONFIG_START(tddragon3_state::tddragon3) MCFG_SCREEN_VISIBLE_AREA(0, 1514-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -3418,7 +3383,6 @@ MACHINE_CONFIG_START(tflash_state::tflash) MCFG_SCREEN_VISIBLE_AREA(0, 1444-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -3513,7 +3477,6 @@ MACHINE_CONFIG_START(tmchammer_state::tmchammer) MCFG_SCREEN_VISIBLE_AREA(0, 1471-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -3608,7 +3571,6 @@ MACHINE_CONFIG_START(tbtoads_state::tbtoads) MCFG_SCREEN_VISIBLE_AREA(0, 1454-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -3703,7 +3665,6 @@ MACHINE_CONFIG_START(thook_state::thook) MCFG_SCREEN_VISIBLE_AREA(0, 1489-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -3797,7 +3758,6 @@ MACHINE_CONFIG_START(tbttf_state::tbttf) MCFG_SCREEN_VISIBLE_AREA(0, 1466-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -3894,7 +3854,6 @@ MACHINE_CONFIG_START(taddams_state::taddams) MCFG_SCREEN_VISIBLE_AREA(0, 1464-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -3989,7 +3948,6 @@ MACHINE_CONFIG_START(thalone_state::thalone) MCFG_SCREEN_VISIBLE_AREA(0, 1448-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -4080,7 +4038,6 @@ MACHINE_CONFIG_START(txmenpx_state::txmenpx) MCFG_SCREEN_VISIBLE_AREA(0, 1464-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -4175,7 +4132,6 @@ MACHINE_CONFIG_START(thalone2_state::thalone2) MCFG_SCREEN_VISIBLE_AREA(0, 1454-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -4263,7 +4219,6 @@ MACHINE_CONFIG_START(tsonic_state::tsonic) MCFG_SCREEN_SIZE(1517, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 1517-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -4359,7 +4314,6 @@ MACHINE_CONFIG_START(trobocop3_state::trobocop3) MCFG_SCREEN_VISIBLE_AREA(0, 1464-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -4450,7 +4404,6 @@ MACHINE_CONFIG_START(tdummies_state::tdummies) MCFG_SCREEN_VISIBLE_AREA(0, 1441-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -4545,7 +4498,6 @@ MACHINE_CONFIG_START(tsfight2_state::tsfight2) MCFG_SCREEN_VISIBLE_AREA(0, 1444-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -4640,7 +4592,6 @@ MACHINE_CONFIG_START(twworld_state::twworld) MCFG_SCREEN_VISIBLE_AREA(0, 1429-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -4731,7 +4682,6 @@ MACHINE_CONFIG_START(tjpark_state::tjpark) MCFG_SCREEN_VISIBLE_AREA(0, 1454-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -4819,7 +4769,6 @@ MACHINE_CONFIG_START(tsonic2_state::tsonic2) MCFG_SCREEN_SIZE(1475, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 1475-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -4920,7 +4869,6 @@ MACHINE_CONFIG_START(tsddragon_state::tsddragon) MCFG_SCREEN_VISIBLE_AREA(0, 1503-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -5016,7 +4964,6 @@ MACHINE_CONFIG_START(tdennis_state::tdennis) MCFG_SCREEN_VISIBLE_AREA(0, 1467-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -5115,7 +5062,6 @@ MACHINE_CONFIG_START(tnmarebc_state::tnmarebc) MCFG_SCREEN_VISIBLE_AREA(0, 1456-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -5210,7 +5156,6 @@ MACHINE_CONFIG_START(ttransf2_state::ttransf2) MCFG_SCREEN_VISIBLE_AREA(0, 1476-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -5301,7 +5246,6 @@ MACHINE_CONFIG_START(topaliens_state::topaliens) MCFG_SCREEN_VISIBLE_AREA(0, 1450-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -5397,7 +5341,6 @@ MACHINE_CONFIG_START(tmkombat_state::tmkombat) MCFG_SCREEN_VISIBLE_AREA(0, 1468-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -5492,7 +5435,6 @@ MACHINE_CONFIG_START(tshadow_state::tshadow) MCFG_SCREEN_VISIBLE_AREA(0, 1484-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -5587,7 +5529,6 @@ MACHINE_CONFIG_START(tskelwarr_state::tskelwarr) MCFG_SCREEN_VISIBLE_AREA(0, 1444-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -5683,7 +5624,6 @@ MACHINE_CONFIG_START(tbatfor_state::tbatfor) MCFG_SCREEN_VISIBLE_AREA(0, 1493-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -5779,7 +5719,6 @@ MACHINE_CONFIG_START(tjdredd_state::tjdredd) MCFG_SCREEN_VISIBLE_AREA(0, 1444-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -5875,7 +5814,6 @@ MACHINE_CONFIG_START(tapollo13_state::tapollo13) MCFG_SCREEN_VISIBLE_AREA(0, 1467-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -5971,7 +5909,6 @@ MACHINE_CONFIG_START(tgoldeye_state::tgoldeye) MCFG_SCREEN_VISIBLE_AREA(0, 1461-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -6062,7 +5999,6 @@ MACHINE_CONFIG_START(tinday_state::tinday) MCFG_SCREEN_VISIBLE_AREA(0, 1463-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -6153,7 +6089,6 @@ MACHINE_CONFIG_START(tsjam_state::tsjam) MCFG_SCREEN_VISIBLE_AREA(0, 1421-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -6242,7 +6177,6 @@ MACHINE_CONFIG_START(tbatmana_state::tbatmana) MCFG_SCREEN_SIZE(1478, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 1478-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -6346,7 +6280,6 @@ MACHINE_CONFIG_START(tigarden_state::tigarden) MCFG_SCREEN_VISIBLE_AREA(0, 1515-1, 0, 1080-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -6446,7 +6379,6 @@ MACHINE_CONFIG_START(nummunch_state::nummunch) MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 875-1) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_sm510_state, display_decay_tick, attotime::from_msec(1)) - config.set_default_layout(layout_svg); /* sound hardware */ SPEAKER(config, "mono").front_center(); diff --git a/src/mame/drivers/hh_tms1k.cpp b/src/mame/drivers/hh_tms1k.cpp index 6dc3282b622..410752a3e59 100644 --- a/src/mame/drivers/hh_tms1k.cpp +++ b/src/mame/drivers/hh_tms1k.cpp @@ -160,7 +160,6 @@ #include "softlist.h" #include "screen.h" #include "speaker.h" -#include "rendlay.h" // internal artwork #include "7in1ss.lh" @@ -4603,7 +4602,6 @@ MACHINE_CONFIG_START(ginv1000_state::ginv1000) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(226, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 226-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -4739,7 +4737,6 @@ MACHINE_CONFIG_START(ginv2000_state::ginv2000) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(364, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 364-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ diff --git a/src/mame/drivers/hh_ucom4.cpp b/src/mame/drivers/hh_ucom4.cpp index a4d9eeba981..979736b186e 100644 --- a/src/mame/drivers/hh_ucom4.cpp +++ b/src/mame/drivers/hh_ucom4.cpp @@ -73,7 +73,6 @@ TODO: #include "includes/hh_ucom4.h" #include "video/hlcd0515.h" -#include "rendlay.h" #include "screen.h" #include "speaker.h" @@ -348,7 +347,6 @@ MACHINE_CONFIG_START(ufombs_state::ufombs) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(243, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 243-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -495,7 +493,6 @@ MACHINE_CONFIG_START(ssfball_state::ssfball) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(1920, 482) MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 482-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -623,7 +620,6 @@ MACHINE_CONFIG_START(bmsoccer_state::bmsoccer) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(271, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 271-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -730,7 +726,6 @@ MACHINE_CONFIG_START(bmsafari_state::bmsafari) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(248, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 248-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -881,7 +876,6 @@ MACHINE_CONFIG_START(splasfgt_state::splasfgt) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(1920, 476) MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 476-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -985,7 +979,6 @@ MACHINE_CONFIG_START(bcclimbr_state::bcclimbr) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(310, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 310-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -1202,7 +1195,6 @@ MACHINE_CONFIG_START(invspace_state::invspace) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(289, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 289-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -1418,7 +1410,6 @@ MACHINE_CONFIG_START(galaxy2_state::galaxy2) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(304, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 304-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -1537,7 +1528,6 @@ MACHINE_CONFIG_START(astrocmd_state::astrocmd) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(1920, 525) MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 525-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -1633,7 +1623,6 @@ MACHINE_CONFIG_START(edracula_state::edracula) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(1920, 526) MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 526-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -2026,7 +2015,6 @@ MACHINE_CONFIG_START(tccombat_state::tccombat) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(300, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 300-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -2184,7 +2172,6 @@ MACHINE_CONFIG_START(tmtennis_state::tmtennis) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(1920, 417) MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 417-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -2293,7 +2280,6 @@ MACHINE_CONFIG_START(tmpacman_state::tmpacman) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(1920, 508) MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 508-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -2396,7 +2382,6 @@ MACHINE_CONFIG_START(tmscramb_state::tmscramb) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(1920, 556) MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 556-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -2495,7 +2480,6 @@ MACHINE_CONFIG_START(tcaveman_state::tcaveman) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(1920, 559) MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 559-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ @@ -2628,7 +2612,6 @@ MACHINE_CONFIG_START(alnchase_state::alnchase) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_SIZE(365, 1080) MCFG_SCREEN_VISIBLE_AREA(0, 365-1, 0, 1080-1) - config.set_default_layout(layout_svg); MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_ucom4_state, display_decay_tick, attotime::from_msec(1)) /* sound hardware */ diff --git a/src/mame/drivers/hp49gp.cpp b/src/mame/drivers/hp49gp.cpp index d08ad80e98f..53f5f732747 100644 --- a/src/mame/drivers/hp49gp.cpp +++ b/src/mame/drivers/hp49gp.cpp @@ -9,7 +9,6 @@ #include "emu.h" #include "cpu/arm7/arm7.h" #include "machine/s3c2410.h" -#include "rendlay.h" #include "screen.h" #define VERBOSE_LEVEL ( 0 ) @@ -297,9 +296,6 @@ MACHINE_CONFIG_START(hp49gp_state::hp49gp) MCFG_SCREEN_VISIBLE_AREA(0, 131 - 1, 0, 80 - 1) MCFG_SCREEN_UPDATE_DEVICE("s3c2410", s3c2410_device, screen_update) - config.set_default_layout(layout_lcd); - - MCFG_DEVICE_ADD("s3c2410", S3C2410, 12000000) MCFG_S3C2410_PALETTE("palette") MCFG_S3C2410_SCREEN("screen") diff --git a/src/mame/drivers/hp_ipc.cpp b/src/mame/drivers/hp_ipc.cpp index 899cc0768f5..fcbe52ff23f 100644 --- a/src/mame/drivers/hp_ipc.cpp +++ b/src/mame/drivers/hp_ipc.cpp @@ -374,8 +374,6 @@ Software to look for #include "machine/tms9914.h" #include "bus/ieee488/ieee488.h" -#include "rendlay.h" - #include "emupal.h" #include "screen.h" @@ -801,11 +799,10 @@ MACHINE_CONFIG_START(hp_ipc_state::hp_ipc) // horizontal time = 60 us (min) // ver.refresh period = ~300 us // ver.period = 16.7ms (~60 hz) - MCFG_SCREEN_ADD_MONOCHROME("screen", RASTER, rgb_t::amber()) + MCFG_SCREEN_ADD_MONOCHROME("screen", LCD, rgb_t::amber()) // actually a kind of EL display MCFG_SCREEN_UPDATE_DEVICE("gpu", hp1ll3_device, screen_update) MCFG_SCREEN_RAW_PARAMS(6_MHz_XTAL * 2, 720, 0, 512, 278, 0, 256) MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("mlc", hp_hil_mlc_device, ap_w)) // XXX actually it's driven by 555 (U59) - config.set_default_layout(layout_lcd); MCFG_SCREEN_PALETTE("palette") MCFG_PALETTE_ADD_MONOCHROME("palette") @@ -821,11 +818,10 @@ MACHINE_CONFIG_START(hp_ipc_state::hp9808a) MCFG_ADDRESS_MAP_BANK_DATA_WIDTH(16) MCFG_ADDRESS_MAP_BANK_STRIDE(0x1000000) - MCFG_SCREEN_ADD_MONOCHROME("screen", RASTER, rgb_t::amber()) + MCFG_SCREEN_ADD_MONOCHROME("screen", LCD, rgb_t::amber()) // actually a kind of EL display MCFG_SCREEN_UPDATE_DEVICE("gpu", hp1ll3_device, screen_update) MCFG_SCREEN_RAW_PARAMS(6_MHz_XTAL * 2, 720, 0, 640, 480, 0, 400) MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("mlc", hp_hil_mlc_device, ap_w)) - config.set_default_layout(layout_lcd); MCFG_SCREEN_PALETTE("palette") MCFG_PALETTE_ADD_MONOCHROME("palette") diff --git a/src/mame/drivers/hprot1.cpp b/src/mame/drivers/hprot1.cpp index c353fb912a5..d81f856498d 100644 --- a/src/mame/drivers/hprot1.cpp +++ b/src/mame/drivers/hprot1.cpp @@ -60,7 +60,6 @@ Infinite loop is reached at address 0x7699 #include "sound/spkrdev.h" #include "video/hd44780.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" #include "speaker.h" @@ -262,7 +261,6 @@ MACHINE_CONFIG_START(hprot1_state::hprot1) MCFG_SCREEN_VISIBLE_AREA(0, 6*16-1, 0, 9*2-1) MCFG_SCREEN_PALETTE("palette") - config.set_default_layout(layout_lcd); MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(hprot1_state, hprot1) MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_hprot1) diff --git a/src/mame/drivers/hunter2.cpp b/src/mame/drivers/hunter2.cpp index 054bffa3533..3960ba36a48 100644 --- a/src/mame/drivers/hunter2.cpp +++ b/src/mame/drivers/hunter2.cpp @@ -30,7 +30,6 @@ #include "sound/spkrdev.h" #include "video/hd61830.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" #include "speaker.h" @@ -391,7 +390,6 @@ MACHINE_CONFIG_START(hunter2_state::hunter2) MCFG_SCREEN_VISIBLE_AREA(0, 239, 0, 63) MCFG_SCREEN_PALETTE("palette") - config.set_default_layout(layout_lcd); MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(hunter2_state, hunter2) MCFG_DEVICE_ADD("lcdc", HD61830, XTAL(4'915'200)/2/2) // unknown clock diff --git a/src/mame/drivers/hx20.cpp b/src/mame/drivers/hx20.cpp index b203f1193d1..f6e643a6495 100644 --- a/src/mame/drivers/hx20.cpp +++ b/src/mame/drivers/hx20.cpp @@ -905,7 +905,6 @@ MACHINE_CONFIG_START(hx20_state::hx20) MCFG_DEVICE_IO_MAP(hx20_sub_io) // video hardware - config.set_default_layout(layout_lcd); MCFG_SCREEN_ADD(SCREEN_TAG, LCD) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) diff --git a/src/mame/drivers/icatel.cpp b/src/mame/drivers/icatel.cpp index 65591006ec5..0b4828950e8 100644 --- a/src/mame/drivers/icatel.cpp +++ b/src/mame/drivers/icatel.cpp @@ -25,7 +25,6 @@ #include "debugger.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" @@ -273,7 +272,6 @@ MACHINE_CONFIG_START(icatel_state::icatel) MCFG_SCREEN_VISIBLE_AREA(0, 6*16-1, 0, 9*2-1) MCFG_SCREEN_PALETTE("palette") - config.set_default_layout(layout_lcd); MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(icatel_state, icatel) MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_icatel) diff --git a/src/mame/drivers/juicebox.cpp b/src/mame/drivers/juicebox.cpp index 387537611ce..04fc84667df 100644 --- a/src/mame/drivers/juicebox.cpp +++ b/src/mame/drivers/juicebox.cpp @@ -15,7 +15,6 @@ #include "sound/dac.h" #include "sound/volt_reg.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" #include "softlist.h" #include "speaker.h" @@ -320,7 +319,6 @@ MACHINE_CONFIG_START(juicebox_state::juicebox) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ MCFG_SCREEN_SIZE(240, 160) MCFG_SCREEN_VISIBLE_AREA(0, 240 - 1, 0, 160 - 1) - config.set_default_layout(layout_lcd); MCFG_SCREEN_UPDATE_DEVICE("s3c44b0", s3c44b0_device, video_update) diff --git a/src/mame/drivers/lcmate2.cpp b/src/mame/drivers/lcmate2.cpp index 96c9247d130..d15a9a4a57e 100644 --- a/src/mame/drivers/lcmate2.cpp +++ b/src/mame/drivers/lcmate2.cpp @@ -36,7 +36,6 @@ #include "sound/spkrdev.h" #include "video/hd44780.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" #include "speaker.h" @@ -248,7 +247,6 @@ MACHINE_CONFIG_START(lcmate2_state::lcmate2) MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(lcmate2_state, lcmate2) - config.set_default_layout(layout_lcd); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_lcmate2) MCFG_HD44780_ADD("hd44780") diff --git a/src/mame/drivers/micronic.cpp b/src/mame/drivers/micronic.cpp index 08414f85a7a..beec4e9a037 100644 --- a/src/mame/drivers/micronic.cpp +++ b/src/mame/drivers/micronic.cpp @@ -114,7 +114,6 @@ #include "emu.h" #include "includes/micronic.h" -#include "rendlay.h" #include "screen.h" #include "speaker.h" @@ -364,8 +363,6 @@ MACHINE_CONFIG_START(micronic_state::micronic) MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 64-1) MCFG_SCREEN_PALETTE("palette") - config.set_default_layout(layout_lcd); - MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(micronic_state, micronic) diff --git a/src/mame/drivers/microvsn.cpp b/src/mame/drivers/microvsn.cpp index b0c30de9616..38e8d8f4ec6 100644 --- a/src/mame/drivers/microvsn.cpp +++ b/src/mame/drivers/microvsn.cpp @@ -23,7 +23,6 @@ of the games were clocked at around 500KHz, 550KHz, or 300KHz. #include "sound/dac.h" #include "sound/volt_reg.h" #include "emupal.h" -#include "rendlay.h" #include "softlist.h" #include "screen.h" #include "speaker.h" @@ -667,8 +666,6 @@ MACHINE_CONFIG_START(microvision_state::microvision) MCFG_PALETTE_ADD("palette", 16) MCFG_PALETTE_INIT_OWNER(microvision_state,microvision) - config.set_default_layout(layout_lcd); - /* sound hardware */ SPEAKER(config, "speaker").front_center(); MCFG_DEVICE_ADD("dac", DAC_2BIT_BINARY_WEIGHTED_ONES_COMPLEMENT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.25) // unknown DAC diff --git a/src/mame/drivers/mini2440.cpp b/src/mame/drivers/mini2440.cpp index 2fd5b759f81..f8699c28d60 100644 --- a/src/mame/drivers/mini2440.cpp +++ b/src/mame/drivers/mini2440.cpp @@ -12,7 +12,6 @@ #include "machine/smartmed.h" #include "sound/dac.h" #include "sound/volt_reg.h" -#include "rendlay.h" #include "screen.h" #include "speaker.h" @@ -22,8 +21,8 @@ class mini2440_state : public driver_device { public: - mini2440_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + mini2440_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_s3c2440(*this, "s3c2440"), m_nand(*this, "nand"), @@ -237,7 +236,6 @@ MACHINE_CONFIG_START(mini2440_state::mini2440) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ MCFG_SCREEN_SIZE(1024, 768) MCFG_SCREEN_VISIBLE_AREA(0, 239, 0, 319) - config.set_default_layout(layout_lcd); MCFG_SCREEN_UPDATE_DEVICE("s3c2440", s3c2440_device, screen_update) diff --git a/src/mame/drivers/mstation.cpp b/src/mame/drivers/mstation.cpp index 1bd1734bfbb..14fd5ad2c22 100644 --- a/src/mame/drivers/mstation.cpp +++ b/src/mame/drivers/mstation.cpp @@ -34,7 +34,6 @@ #include "machine/rp5c01.h" #include "machine/timer.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" @@ -463,7 +462,6 @@ MACHINE_CONFIG_START(mstation_state::mstation) MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(mstation_state, mstation) - config.set_default_layout(layout_lcd); MCFG_AMD_29F080_ADD("flash0") MCFG_SST_28SF040_ADD("flash1") diff --git a/src/mame/drivers/nakajies.cpp b/src/mame/drivers/nakajies.cpp index 44ea42721c6..16015369b1f 100644 --- a/src/mame/drivers/nakajies.cpp +++ b/src/mame/drivers/nakajies.cpp @@ -277,7 +277,6 @@ disabled). Perhaps power on/off related?? #include "machine/timer.h" #include "sound/spkrdev.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" #include "speaker.h" @@ -289,9 +288,10 @@ class nakajies_state : public driver_device { public: nakajies_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "v20hl") - {} + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "v20hl") + { + } void nakajies210(machine_config &config); void nakajies220(machine_config &config); @@ -763,7 +763,6 @@ MACHINE_CONFIG_START(nakajies_state::nakajies210) MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_wales210) MCFG_PALETTE_ADD( "palette", 2 ) MCFG_PALETTE_INIT_OWNER(nakajies_state, nakajies) - config.set_default_layout(layout_lcd); /* sound */ SPEAKER(config, "mono").front_center(); diff --git a/src/mame/drivers/nbmj8688.cpp b/src/mame/drivers/nbmj8688.cpp index 95e7fd95c28..e76db1c9774 100644 --- a/src/mame/drivers/nbmj8688.cpp +++ b/src/mame/drivers/nbmj8688.cpp @@ -2647,23 +2647,27 @@ MACHINE_CONFIG_START(nbmj8688_state::mbmj_p16bit_LCD) MCFG_PALETTE_ADD("palette_lcd", 2) MCFG_PALETTE_INIT_OWNER(nbmj8688_state,mbmj8688_lcd) - MCFG_SCREEN_ADD("lcd0", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(480, 64) - MCFG_SCREEN_VISIBLE_AREA(0, 480-1, 0, 64-1) - MCFG_SCREEN_UPDATE_DEVICE("lcdc0", hd61830_device, screen_update) - MCFG_SCREEN_PALETTE("palette_lcd") + screen_device &lcd0(SCREEN(config, "lcd0", SCREEN_TYPE_LCD)); + lcd0.set_physical_aspect(15, 3); + lcd0.set_orientation(ROT180); + lcd0.set_refresh_hz(60); + lcd0.set_vblank_time(ATTOSECONDS_IN_USEC(0)); + lcd0.set_size(480, 64); + lcd0.set_visarea(0, 480-1, 0, 64-1); + lcd0.set_screen_update("lcdc0", FUNC(hd61830_device::screen_update)); + lcd0.set_palette("palette_lcd"); MCFG_DEVICE_ADD("lcdc0", HD61830B, 5000000/2) // ??? MCFG_VIDEO_SET_SCREEN("lcd0") - MCFG_SCREEN_ADD("lcd1", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(480, 64) - MCFG_SCREEN_VISIBLE_AREA(0, 480-1, 0, 64-1) - MCFG_SCREEN_UPDATE_DEVICE("lcdc1", hd61830_device, screen_update) - MCFG_SCREEN_PALETTE("palette_lcd") + screen_device &lcd1(SCREEN(config, "lcd1", SCREEN_TYPE_LCD)); + lcd1.set_physical_aspect(15, 3); + lcd1.set_orientation(ROT180); + lcd1.set_refresh_hz(60); + lcd1.set_vblank_time(ATTOSECONDS_IN_USEC(0)); + lcd1.set_size(480, 64); + lcd1.set_visarea(0, 480-1, 0, 64-1); + lcd1.set_screen_update("lcdc1", FUNC(hd61830_device::screen_update)); + lcd1.set_palette("palette_lcd"); MCFG_DEVICE_ADD("lcdc1", HD61830B, 5000000/2) // ??? MCFG_VIDEO_SET_SCREEN("lcd1") diff --git a/src/mame/drivers/nc.cpp b/src/mame/drivers/nc.cpp index e4bdc34ca76..2e9c9ee223c 100644 --- a/src/mame/drivers/nc.cpp +++ b/src/mame/drivers/nc.cpp @@ -102,7 +102,6 @@ #include "machine/mc146818.h" // for NC200 real time clock #include "machine/rp5c01.h" // for NC100 real time clock #include "formats/pc_dsk.h" // for NC200 disk image -#include "rendlay.h" #include "screen.h" #include "speaker.h" @@ -1393,8 +1392,6 @@ MACHINE_CONFIG_START(nc_state::nc_base) MCFG_PALETTE_ADD("palette", NC_NUM_COLOURS) MCFG_PALETTE_INIT_OWNER(nc_state, nc) - config.set_default_layout(layout_lcd); - /* sound hardware */ SPEAKER(config, "mono").front_center(); MCFG_DEVICE_ADD("beep.1", BEEP, 0) diff --git a/src/mame/drivers/ngp.cpp b/src/mame/drivers/ngp.cpp index b926a156ff0..e2be1d57e41 100644 --- a/src/mame/drivers/ngp.cpp +++ b/src/mame/drivers/ngp.cpp @@ -106,7 +106,6 @@ the Neogeo Pocket. #include "sound/dac.h" #include "sound/volt_reg.h" #include "video/k1ge.h" -#include "rendlay.h" #include "screen.h" #include "softlist.h" #include "speaker.h" @@ -842,8 +841,6 @@ MACHINE_CONFIG_START(ngp_state::ngp_common) MCFG_SCREEN_RAW_PARAMS( 6.144_MHz_XTAL, 515, 0, 160 /*480*/, 199, 0, 152 ) MCFG_SCREEN_UPDATE_DRIVER(ngp_state, screen_update_ngp) - config.set_default_layout(layout_lcd); - /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); diff --git a/src/mame/drivers/palm.cpp b/src/mame/drivers/palm.cpp index fcb6fe5c4ce..27bb29208b3 100644 --- a/src/mame/drivers/palm.cpp +++ b/src/mame/drivers/palm.cpp @@ -18,7 +18,6 @@ #include "sound/dac.h" #include "sound/volt_reg.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" #include "speaker.h" @@ -27,15 +26,16 @@ class palm_state : public driver_device { public: - palm_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + palm_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_lsi(*this, MC68328_TAG), m_ram(*this, RAM_TAG), m_io_penx(*this, "PENX"), m_io_peny(*this, "PENY"), m_io_penb(*this, "PENB"), - m_io_portd(*this, "PORTD") { } + m_io_portd(*this, "PORTD") + { } void palmiii(machine_config &config); void pilot1k(machine_config &config); @@ -188,7 +188,7 @@ MACHINE_CONFIG_START(palm_state::palm) MCFG_QUANTUM_TIME( attotime::from_hz(60) ) - MCFG_SCREEN_ADD( "screen", RASTER ) + MCFG_SCREEN_ADD( "screen", LCD ) MCFG_SCREEN_REFRESH_RATE( 60 ) MCFG_SCREEN_VBLANK_TIME( ATTOSECONDS_IN_USEC(1260) ) /* video hardware */ @@ -200,7 +200,6 @@ MACHINE_CONFIG_START(palm_state::palm) MCFG_PALETTE_ADD( "palette", 2 ) MCFG_PALETTE_INIT_OWNER(palm_state, palm) - config.set_default_layout(layout_lcd); /* audio hardware */ SPEAKER(config, "speaker").front_center(); diff --git a/src/mame/drivers/palmz22.cpp b/src/mame/drivers/palmz22.cpp index f6ed4ef927c..7701c59352a 100644 --- a/src/mame/drivers/palmz22.cpp +++ b/src/mame/drivers/palmz22.cpp @@ -67,7 +67,6 @@ end #include "cpu/arm7/arm7.h" #include "machine/s3c2410.h" #include "machine/smartmed.h" -#include "rendlay.h" #include "screen.h" #define PALM_Z22_BATTERY_LEVEL 75 @@ -78,10 +77,10 @@ class palmz22_state : public driver_device { public: palmz22_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_s3c2410(*this, "s3c2410"), - m_nand(*this, "nand") + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_s3c2410(*this, "s3c2410") + , m_nand(*this, "nand") { } DECLARE_INPUT_CHANGED_MEMBER(input_changed); @@ -300,7 +299,6 @@ MACHINE_CONFIG_START(palmz22_state::palmz22) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ MCFG_SCREEN_SIZE(160, 160) MCFG_SCREEN_VISIBLE_AREA(0, 160 - 1, 0, 160 - 1) - config.set_default_layout(layout_lcd); MCFG_SCREEN_UPDATE_DEVICE("s3c2410", s3c2410_device, screen_update) diff --git a/src/mame/drivers/pasopia7.cpp b/src/mame/drivers/pasopia7.cpp index 57fce524b9a..f356aa8ee58 100644 --- a/src/mame/drivers/pasopia7.cpp +++ b/src/mame/drivers/pasopia7.cpp @@ -33,7 +33,6 @@ #include "video/mc6845.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" #include "speaker.h" @@ -1011,8 +1010,6 @@ MACHINE_CONFIG_START(pasopia7_state::p7_lcd) MCFG_MC6845_ADD("crtc", H46505, "screen", LCD_CLOCK) /* unknown clock, hand tuned to get ~60 fps */ MCFG_MC6845_SHOW_BORDER_AREA(false) MCFG_MC6845_CHAR_WIDTH(8) - - config.set_default_layout(layout_lcd); MACHINE_CONFIG_END /* ROM definition */ diff --git a/src/mame/drivers/pb1000.cpp b/src/mame/drivers/pb1000.cpp index 09f50dee1bd..f55fbf99772 100644 --- a/src/mame/drivers/pb1000.cpp +++ b/src/mame/drivers/pb1000.cpp @@ -26,7 +26,6 @@ #include "video/hd44352.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" #include "softlist.h" #include "speaker.h" @@ -504,7 +503,6 @@ MACHINE_CONFIG_START(pb1000_state::pb1000) MCFG_SCREEN_VISIBLE_AREA(0, 192-1, 0, 32-1) MCFG_SCREEN_PALETTE("palette") - config.set_default_layout(layout_lcd); MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(pb1000_state, pb1000) MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pb1000) diff --git a/src/mame/drivers/pc2000.cpp b/src/mame/drivers/pc2000.cpp index 159cd07f4fb..b55ea95f587 100644 --- a/src/mame/drivers/pc2000.cpp +++ b/src/mame/drivers/pc2000.cpp @@ -25,7 +25,6 @@ #include "bus/generic/carts.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" #include "softlist.h" #include "speaker.h" @@ -898,7 +897,6 @@ MACHINE_CONFIG_START(pc2000_state::pc2000) MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(pc2000_state, pc2000) MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pc2000) - config.set_default_layout(layout_lcd); MCFG_HD44780_ADD("hd44780") MCFG_HD44780_LCD_SIZE(2, 20) diff --git a/src/mame/drivers/pc4.cpp b/src/mame/drivers/pc4.cpp index e0a29cbd5ba..97bdfd88b83 100644 --- a/src/mame/drivers/pc4.cpp +++ b/src/mame/drivers/pc4.cpp @@ -30,7 +30,6 @@ #include "cpu/z80/z80.h" #include "machine/rp5c01.h" -#include "rendlay.h" #include "screen.h" #include "speaker.h" @@ -232,7 +231,6 @@ MACHINE_CONFIG_START(pc4_state::pc4) MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 36-1) MCFG_SCREEN_PALETTE("palette") - config.set_default_layout(layout_lcd); MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(pc4_state, pc4) MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pc4) diff --git a/src/mame/drivers/pce220.cpp b/src/mame/drivers/pce220.cpp index 2880970573a..bc907429e15 100644 --- a/src/mame/drivers/pce220.cpp +++ b/src/mame/drivers/pce220.cpp @@ -34,7 +34,6 @@ #include "machine/timer.h" #include "sound/beep.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" #include "speaker.h" @@ -962,7 +961,6 @@ MACHINE_CONFIG_START(pce220_state::pce220) MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(pce220_state,pce220) - config.set_default_layout(layout_lcd); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -998,7 +996,6 @@ MACHINE_CONFIG_START(pcg850v_state::pcg815) MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(pce220_state,pce220) - config.set_default_layout(layout_lcd); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -1034,7 +1031,6 @@ MACHINE_CONFIG_START(pcg850v_state::pcg850v) MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(pce220_state,pce220) - config.set_default_layout(layout_lcd); /* sound hardware */ SPEAKER(config, "mono").front_center(); diff --git a/src/mame/drivers/pda600.cpp b/src/mame/drivers/pda600.cpp index 374eb596379..687cae1a2a7 100644 --- a/src/mame/drivers/pda600.cpp +++ b/src/mame/drivers/pda600.cpp @@ -60,7 +60,6 @@ #include "machine/nvram.h" #include "machine/hd64610.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" @@ -68,9 +67,10 @@ class pda600_state : public driver_device { public: pda600_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") - {} + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + { + } void pda600(machine_config &config); @@ -220,7 +220,6 @@ MACHINE_CONFIG_START(pda600_state::pda600) MCFG_SCREEN_PALETTE("palette") MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pda600) - config.set_default_layout(layout_lcd); MCFG_PALETTE_ADD_MONOCHROME("palette") // NVRAM needs to be filled with random data to fail the checksum and be initialized correctly diff --git a/src/mame/drivers/pitagjr.cpp b/src/mame/drivers/pitagjr.cpp index 29177c5665b..4f8b4cd7a3b 100644 --- a/src/mame/drivers/pitagjr.cpp +++ b/src/mame/drivers/pitagjr.cpp @@ -154,7 +154,6 @@ #include "cpu/m6805/m6805.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" @@ -222,8 +221,6 @@ MACHINE_CONFIG_START(pitagjr_state::pitajr) MCFG_SCREEN_VISIBLE_AREA( 0, 200-1, 0, 100-1 ) MCFG_SCREEN_PALETTE("palette") - config.set_default_layout(layout_lcd); - MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(pitagjr_state, pitagjr) MACHINE_CONFIG_END diff --git a/src/mame/drivers/pofo.cpp b/src/mame/drivers/pofo.cpp index 166207bce87..8e91648b6e8 100644 --- a/src/mame/drivers/pofo.cpp +++ b/src/mame/drivers/pofo.cpp @@ -44,7 +44,6 @@ #include "video/hd61830.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" #include "softlist.h" #include "speaker.h" @@ -1031,8 +1030,6 @@ MACHINE_CONFIG_START(portfolio_state::portfolio) MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 64-1) MCFG_SCREEN_PALETTE("palette") - config.set_default_layout(layout_lcd); - MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(portfolio_state, portfolio) diff --git a/src/mame/drivers/pokemini.cpp b/src/mame/drivers/pokemini.cpp index 2699933d568..f5f6d2ba509 100644 --- a/src/mame/drivers/pokemini.cpp +++ b/src/mame/drivers/pokemini.cpp @@ -16,7 +16,6 @@ The LCD is likely to be a SSD1828 LCD. #include "bus/generic/slot.h" #include "bus/generic/carts.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" #include "softlist.h" #include "speaker.h" @@ -1779,8 +1778,6 @@ MACHINE_CONFIG_START(pokemini_state::pokemini) MCFG_SCREEN_REFRESH_RATE( 72 ) MCFG_SCREEN_PALETTE("palette") - config.set_default_layout(layout_lcd); - MCFG_PALETTE_ADD("palette", 4) MCFG_PALETTE_INIT_OWNER(pokemini_state, pokemini) diff --git a/src/mame/drivers/prestige.cpp b/src/mame/drivers/prestige.cpp index 39838a468d9..9430deca54a 100644 --- a/src/mame/drivers/prestige.cpp +++ b/src/mame/drivers/prestige.cpp @@ -87,7 +87,6 @@ Notes: #include "bus/generic/carts.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" #include "softlist.h" @@ -760,8 +759,6 @@ MACHINE_CONFIG_START(prestige_state::prestige_base) MCFG_SCREEN_VISIBLE_AREA( 0, 240-1, 0, 100-1 ) MCFG_SCREEN_PALETTE("palette") - config.set_default_layout(layout_lcd); - MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(prestige_state, prestige) diff --git a/src/mame/drivers/psion.cpp b/src/mame/drivers/psion.cpp index 41ebbdc07e7..638d993a902 100644 --- a/src/mame/drivers/psion.cpp +++ b/src/mame/drivers/psion.cpp @@ -23,7 +23,6 @@ #include "emu.h" #include "includes/psion.h" -#include "rendlay.h" #include "screen.h" #include "softlist.h" #include "speaker.h" @@ -583,7 +582,6 @@ MACHINE_CONFIG_START(psion_state::psion_2lines) MCFG_SCREEN_VISIBLE_AREA(0, 6*16-1, 0, 9*2-1) MCFG_SCREEN_PALETTE("palette") - config.set_default_layout(layout_lcd); MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(psion_state, psion) MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_psion) diff --git a/src/mame/drivers/replicator.cpp b/src/mame/drivers/replicator.cpp index 7d18085be66..c54cef2f7ea 100644 --- a/src/mame/drivers/replicator.cpp +++ b/src/mame/drivers/replicator.cpp @@ -30,7 +30,6 @@ #include "sound/volt_reg.h" #include "video/hd44780.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" #include "speaker.h" @@ -637,7 +636,6 @@ MACHINE_CONFIG_START(replicator_state::replicator) MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(replicator_state, replicator) MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_replicator) - config.set_default_layout(layout_lcd); MCFG_HD44780_ADD("hd44780") MCFG_HD44780_LCD_SIZE(4, 20) diff --git a/src/mame/drivers/rex6000.cpp b/src/mame/drivers/rex6000.cpp index c8999baed30..d084eb4f95b 100644 --- a/src/mame/drivers/rex6000.cpp +++ b/src/mame/drivers/rex6000.cpp @@ -38,7 +38,6 @@ #include "imagedev/snapquik.h" #include "sound/beep.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" #include "speaker.h" @@ -915,7 +914,6 @@ MACHINE_CONFIG_START(rex6000_state::rex6000) MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 120-1) MCFG_SCREEN_PALETTE("palette") - config.set_default_layout(layout_lcd); MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(rex6000_state, rex6000) MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_rex6000) @@ -1005,7 +1003,6 @@ MACHINE_CONFIG_START(oz750_state::oz750) MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 80-1) MCFG_SCREEN_PALETTE("palette") - config.set_default_layout(layout_lcd); MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(rex6000_state, rex6000) diff --git a/src/mame/drivers/tetrisp2.cpp b/src/mame/drivers/tetrisp2.cpp index 9363b3af5aa..d6cb166b29f 100644 --- a/src/mame/drivers/tetrisp2.cpp +++ b/src/mame/drivers/tetrisp2.cpp @@ -1856,19 +1856,21 @@ MACHINE_CONFIG_START(tetrisp2_state::rocknms) config.set_default_layout(layout_rocknms); - MCFG_SCREEN_ADD("lscreen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(0x140, 0xe0) - MCFG_SCREEN_VISIBLE_AREA(0, 0x140-1, 0, 0xe0-1) - MCFG_SCREEN_UPDATE_DRIVER(tetrisp2_state, screen_update_rocknms_left) - - MCFG_SCREEN_ADD("rscreen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(0x140, 0xe0) - MCFG_SCREEN_VISIBLE_AREA(0, 0x140-1, 0, 0xe0-1) - MCFG_SCREEN_UPDATE_DRIVER(tetrisp2_state, screen_update_rocknms_right) + screen_device &lscreen(SCREEN(config, "lscreen", SCREEN_TYPE_RASTER)); + lscreen.set_orientation(ROT0); + lscreen.set_refresh_hz(60); + lscreen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); + lscreen.set_size(0x140, 0xe0); + lscreen.set_visarea(0, 0x140-1, 0, 0xe0-1); + lscreen.set_screen_update(FUNC(tetrisp2_state::screen_update_rocknms_left)); + + screen_device &rscreen(SCREEN(config, "rscreen", SCREEN_TYPE_RASTER)); + rscreen.set_orientation(ROT270); + rscreen.set_refresh_hz(60); + rscreen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); + rscreen.set_size(0x140, 0xe0); + rscreen.set_visarea(0, 0x140-1, 0, 0xe0-1); + rscreen.set_screen_update(FUNC(tetrisp2_state::screen_update_rocknms_right)); MCFG_VIDEO_START_OVERRIDE(tetrisp2_state,rocknms) @@ -1896,30 +1898,33 @@ MACHINE_CONFIG_START(stepstag_state::stepstag) MCFG_WATCHDOG_ADD("watchdog") // video hardware - MCFG_SCREEN_ADD("lscreen", RASTER) -// MCFG_SCREEN_RAW_PARAMS(12288000*2, 768, 0, 496, 264*2,0,480) - MCFG_SCREEN_REFRESH_RATE(30) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(0x160, 0xf0) - MCFG_SCREEN_VISIBLE_AREA(0, 0x160-1, 0, 0xf0-1) - MCFG_SCREEN_UPDATE_DRIVER(stepstag_state, screen_update_stepstag_left) -// MCFG_SCREEN_PALETTE("lpalette") - - MCFG_SCREEN_ADD("mscreen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(0x160, 0xf0) - MCFG_SCREEN_VISIBLE_AREA(0, 0x160-1, 0, 0xf0-1) - MCFG_SCREEN_UPDATE_DRIVER(stepstag_state, screen_update_stepstag_mid) -// MCFG_SCREEN_PALETTE("mpalette") - - MCFG_SCREEN_ADD("rscreen", RASTER) - MCFG_SCREEN_REFRESH_RATE(30) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(0x160, 0xf0) - MCFG_SCREEN_VISIBLE_AREA(0, 0x160-1, 0, 0xf0-1) - MCFG_SCREEN_UPDATE_DRIVER(stepstag_state, screen_update_stepstag_right) - MCFG_SCREEN_PALETTE("rpalette") + screen_device &lscreen(SCREEN(config, "lscreen", SCREEN_TYPE_RASTER)); + lscreen.set_orientation(ROT270); +// lscreen.set_raw(12288000*2, 768, 0, 496, 264*2,0,480); + lscreen.set_refresh_hz(30); + lscreen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); + lscreen.set_size(0x160, 0xf0); + lscreen.set_visarea(0, 0x160-1, 0, 0xf0-1); + lscreen.set_screen_update(FUNC(stepstag_state::screen_update_stepstag_left)); +// lscreen.set_palette("lpalette")); + + screen_device &mscreen(SCREEN(config, "mscreen", SCREEN_TYPE_RASTER)); + mscreen.set_orientation(ROT0); + mscreen.set_refresh_hz(60); + mscreen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); + mscreen.set_size(0x160, 0xf0); + mscreen.set_visarea(0, 0x160-1, 0, 0xf0-1); + mscreen.set_screen_update(FUNC(stepstag_state::screen_update_stepstag_mid)); +// mscreen.set_palette("mpalette")); + + screen_device &rscreen(SCREEN(config, "rscreen", SCREEN_TYPE_RASTER)); + rscreen.set_orientation(ROT270);; + rscreen.set_refresh_hz(30); + rscreen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); + rscreen.set_size(0x160, 0xf0); + rscreen.set_visarea(0, 0x160-1, 0, 0xf0-1); + rscreen.set_screen_update(FUNC(stepstag_state::screen_update_stepstag_right)); + rscreen.set_palette("rpalette"); MCFG_VIDEO_START_OVERRIDE(stepstag_state, stepstag ) MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tetrisp2) diff --git a/src/mame/drivers/ti630.cpp b/src/mame/drivers/ti630.cpp index 768aa9f228b..185ce0c11a2 100644 --- a/src/mame/drivers/ti630.cpp +++ b/src/mame/drivers/ti630.cpp @@ -38,7 +38,6 @@ It means we probably would have to emulate a modem device for it to treat commun #include "cpu/mcs51/mcs51.h" #include "video/hd44780.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" @@ -156,7 +155,6 @@ MACHINE_CONFIG_START(ti630_state::ti630) MCFG_SCREEN_VISIBLE_AREA(0, 6*16-1, 0, 9*2-1) MCFG_SCREEN_PALETTE("palette") - config.set_default_layout(layout_lcd); MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(ti630_state, ti630) MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ti630) diff --git a/src/mame/drivers/ti89.cpp b/src/mame/drivers/ti89.cpp index 57261b448b0..e410df8fd64 100644 --- a/src/mame/drivers/ti89.cpp +++ b/src/mame/drivers/ti89.cpp @@ -23,7 +23,6 @@ #include "cpu/m68000/m68000.h" #include "machine/intelfsh.h" #include "machine/nvram.h" -#include "rendlay.h" #include "screen.h" @@ -538,7 +537,6 @@ MACHINE_CONFIG_START(ti68k_state::ti89) MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(ti68k_state, ti68k) - config.set_default_layout(layout_lcd); MCFG_SHARP_UNK128MBIT_ADD("flash") //should be LH28F320 for ti89t and v200 and LH28F160S3T for other models diff --git a/src/mame/drivers/tmmjprd.cpp b/src/mame/drivers/tmmjprd.cpp index 904787851b9..3c7124b731a 100644 --- a/src/mame/drivers/tmmjprd.cpp +++ b/src/mame/drivers/tmmjprd.cpp @@ -42,8 +42,8 @@ class tmmjprd_state : public driver_device { public: - tmmjprd_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + tmmjprd_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_eeprom(*this, "eeprom"), m_gfxdecode(*this, "gfxdecode"), @@ -57,7 +57,8 @@ public: m_gfxroms(*this, "gfx2"), m_pl1(*this, "PL1.%u", 1), m_pl2(*this, "PL2.%u", 1), - m_system(*this, "SYSTEM") { } + m_system(*this, "SYSTEM") + { } void tmmjprd(machine_config &config); void tmpdoki(machine_config &config); @@ -738,7 +739,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(tmmjprd_state::scanline) } -MACHINE_CONFIG_START(tmmjprd_state::tmmjprd) +MACHINE_CONFIG_START(tmmjprd_state::tmpdoki) MCFG_DEVICE_ADD(m_maincpu,M68EC020,24000000) /* 24 MHz */ MCFG_DEVICE_PROGRAM_MAP(main_map) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", tmmjprd_state, scanline, "lscreen", 0, 1) @@ -756,9 +757,6 @@ MACHINE_CONFIG_START(tmmjprd_state::tmmjprd) MCFG_PALETTE_ADD(m_palette, 0x1000) MCFG_PALETTE_FORMAT(XGRB) - - config.set_default_layout(layout_dualhsxs); - MCFG_SCREEN_ADD("lscreen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) @@ -768,15 +766,6 @@ MACHINE_CONFIG_START(tmmjprd_state::tmmjprd) MCFG_SCREEN_UPDATE_DRIVER(tmmjprd_state, screen_update_left) MCFG_SCREEN_PALETTE(m_palette) - MCFG_SCREEN_ADD("rscreen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(64*16, 64*16) - MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 28*8-1) - //MCFG_SCREEN_VISIBLE_AREA(0*8, 64*16-1, 0*8, 64*16-1) - MCFG_SCREEN_UPDATE_DRIVER(tmmjprd_state, screen_update_right) - MCFG_SCREEN_PALETTE(m_palette) - /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); @@ -787,11 +776,19 @@ MACHINE_CONFIG_START(tmmjprd_state::tmmjprd) MCFG_SOUND_ROUTE(1, "lspeaker", 1.00) MACHINE_CONFIG_END -MACHINE_CONFIG_START(tmmjprd_state::tmpdoki) - tmmjprd(config); - config.set_default_layout(layout_horizont); +MACHINE_CONFIG_START(tmmjprd_state::tmmjprd) + tmpdoki(config); - MCFG_DEVICE_REMOVE("rscreen") + config.set_default_layout(layout_dualhsxs); + + MCFG_SCREEN_ADD("rscreen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + MCFG_SCREEN_SIZE(64*16, 64*16) + MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 28*8-1) + //MCFG_SCREEN_VISIBLE_AREA(0*8, 64*16-1, 0*8, 64*16-1) + MCFG_SCREEN_UPDATE_DRIVER(tmmjprd_state, screen_update_right) + MCFG_SCREEN_PALETTE(m_palette) MACHINE_CONFIG_END diff --git a/src/mame/drivers/wpc_dot.cpp b/src/mame/drivers/wpc_dot.cpp index 60835081bcf..b1fe1de42a0 100644 --- a/src/mame/drivers/wpc_dot.cpp +++ b/src/mame/drivers/wpc_dot.cpp @@ -170,18 +170,18 @@ void wpc_dot_state::init_wpc_dot() m_cpubank->set_entry(0); m_fixedbank->configure_entries(0, 1, &fixed[codeoff],0x8000); m_fixedbank->set_entry(0); - m_dmdbank1->configure_entries(0, 16, &m_dmdram[0x0000],0x200); - m_dmdbank1->set_entry(0); - m_dmdbank2->configure_entries(0, 16, &m_dmdram[0x0000],0x200); - m_dmdbank2->set_entry(1); - m_dmdbank3->configure_entries(0, 16, &m_dmdram[0x0000],0x200); - m_dmdbank3->set_entry(2); - m_dmdbank4->configure_entries(0, 16, &m_dmdram[0x0000],0x200); - m_dmdbank4->set_entry(3); - m_dmdbank5->configure_entries(0, 16, &m_dmdram[0x0000],0x200); - m_dmdbank5->set_entry(4); - m_dmdbank6->configure_entries(0, 16, &m_dmdram[0x0000],0x200); - m_dmdbank6->set_entry(5); + m_dmdbanks[0]->configure_entries(0, 16, &m_dmdram[0x0000],0x200); + m_dmdbanks[0]->set_entry(0); + m_dmdbanks[1]->configure_entries(0, 16, &m_dmdram[0x0000],0x200); + m_dmdbanks[1]->set_entry(1); + m_dmdbanks[2]->configure_entries(0, 16, &m_dmdram[0x0000],0x200); + m_dmdbanks[2]->set_entry(2); + m_dmdbanks[3]->configure_entries(0, 16, &m_dmdram[0x0000],0x200); + m_dmdbanks[3]->set_entry(3); + m_dmdbanks[4]->configure_entries(0, 16, &m_dmdram[0x0000],0x200); + m_dmdbanks[4]->set_entry(4); + m_dmdbanks[5]->configure_entries(0, 16, &m_dmdram[0x0000],0x200); + m_dmdbanks[5]->set_entry(5); m_vblank_timer = timer_alloc(TIMER_VBLANK); m_vblank_timer->adjust(attotime::from_hz(60),0,attotime::from_hz(60*4)); m_irq_timer = timer_alloc(TIMER_IRQ); @@ -213,28 +213,18 @@ WRITE8_MEMBER(wpc_dot_state::wpc_rombank_w) WRITE8_MEMBER(wpc_dot_state::wpc_dmdbank_w) { - uint8_t page = offset >> 4; + uint8_t const bank(offset & 0x07); + uint8_t const page(offset >> 4); - switch(offset & 0x07) + switch (bank) { case 0: - m_dmdbank1->set_entry(data + (page*16)); - break; case 1: - m_dmdbank2->set_entry(data + (page*16)); - break; case 2: - m_dmdbank3->set_entry(data + (page*16)); - break; case 3: - m_dmdbank4->set_entry(data + (page*16)); - break; case 4: - m_dmdbank5->set_entry(data + (page*16)); - break; case 5: - m_dmdbank6->set_entry(data + (page*16)); - break; + m_dmdbanks[bank]->set_entry(data + (page << 4)); } } @@ -321,13 +311,12 @@ MACHINE_CONFIG_START(wpc_dot_state::wpc_dot) MCFG_WPC_SOUND_REPLY_CALLBACK(WRITELINE(*this, wpc_dot_state,wpcsnd_reply_w)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 1.0) - config.set_default_layout(layout_lcd); - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_SIZE(128, 32) - MCFG_SCREEN_VISIBLE_AREA(0, 128-1, 0, 32-1) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_UPDATE_DRIVER(wpc_dot_state, screen_update) + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_native_aspect(); + screen.set_size(128, 32); + screen.set_visarea(0, 128-1, 0, 32-1); + screen.set_refresh_hz(60); + screen.set_screen_update(FUNC(wpc_dot_state::screen_update)); MACHINE_CONFIG_END /*----------------- diff --git a/src/mame/drivers/wpc_flip1.cpp b/src/mame/drivers/wpc_flip1.cpp index f8c801e824b..3a524f5e925 100644 --- a/src/mame/drivers/wpc_flip1.cpp +++ b/src/mame/drivers/wpc_flip1.cpp @@ -164,26 +164,25 @@ MACHINE_CONFIG_START(wpc_flip1_state::wpc_flip1) MCFG_DEVICE_PROGRAM_MAP(wpc_flip1_map) MCFG_WMS_WPC_ADD("wpc") - MCFG_WPC_IRQ_ACKNOWLEDGE(WRITELINE(*this, wpc_dot_state,wpc_irq_w)) - MCFG_WPC_FIRQ_ACKNOWLEDGE(WRITELINE(*this, wpc_dot_state,wpc_firq_w)) - MCFG_WPC_ROMBANK(WRITE8(*this, wpc_dot_state,wpc_rombank_w)) - MCFG_WPC_SOUND_CTRL(READ8(*this, wpc_dot_state,wpc_sound_ctrl_r),WRITE8(*this, wpc_dot_state,wpc_sound_ctrl_w)) - MCFG_WPC_SOUND_DATA(READ8(*this, wpc_dot_state,wpc_sound_data_r),WRITE8(*this, wpc_dot_state,wpc_sound_data_w)) - MCFG_WPC_DMDBANK(WRITE8(*this, wpc_dot_state,wpc_dmdbank_w)) + MCFG_WPC_IRQ_ACKNOWLEDGE(WRITELINE(*this, wpc_flip1_state,wpc_irq_w)) + MCFG_WPC_FIRQ_ACKNOWLEDGE(WRITELINE(*this, wpc_flip1_state,wpc_firq_w)) + MCFG_WPC_ROMBANK(WRITE8(*this, wpc_flip1_state,wpc_rombank_w)) + MCFG_WPC_SOUND_CTRL(READ8(*this, wpc_flip1_state,wpc_sound_ctrl_r),WRITE8(*this, wpc_flip1_state,wpc_sound_ctrl_w)) + MCFG_WPC_SOUND_DATA(READ8(*this, wpc_flip1_state,wpc_sound_data_r),WRITE8(*this, wpc_flip1_state,wpc_sound_data_w)) + MCFG_WPC_DMDBANK(WRITE8(*this, wpc_flip1_state,wpc_dmdbank_w)) SPEAKER(config, "speaker").front_center(); MCFG_DEVICE_ADD("wpcsnd", WPCSND) MCFG_WPC_ROM_REGION("sound1") - MCFG_WPC_SOUND_REPLY_CALLBACK(WRITELINE(*this, wpc_dot_state,wpcsnd_reply_w)) + MCFG_WPC_SOUND_REPLY_CALLBACK(WRITELINE(*this, wpc_flip1_state,wpcsnd_reply_w)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 1.0) - config.set_default_layout(layout_lcd); - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_SIZE(128, 32) - MCFG_SCREEN_VISIBLE_AREA(0, 128-1, 0, 32-1) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_UPDATE_DRIVER(wpc_dot_state, screen_update) + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_native_aspect(); + screen.set_size(128, 32); + screen.set_visarea(0, 128-1, 0, 32-1); + screen.set_refresh_hz(60); + screen.set_screen_update(FUNC(wpc_flip1_state::screen_update)); MACHINE_CONFIG_END /*----------------- diff --git a/src/mame/drivers/wpc_flip2.cpp b/src/mame/drivers/wpc_flip2.cpp index e9e421b6e40..bd4a7e2eb62 100644 --- a/src/mame/drivers/wpc_flip2.cpp +++ b/src/mame/drivers/wpc_flip2.cpp @@ -193,26 +193,25 @@ MACHINE_CONFIG_START(wpc_flip2_state::wpc_flip2) MCFG_DEVICE_PROGRAM_MAP(wpc_flip2_map) MCFG_WMS_WPC_ADD("wpc") - MCFG_WPC_IRQ_ACKNOWLEDGE(WRITELINE(*this, wpc_dot_state,wpc_irq_w)) - MCFG_WPC_FIRQ_ACKNOWLEDGE(WRITELINE(*this, wpc_dot_state,wpc_firq_w)) - MCFG_WPC_ROMBANK(WRITE8(*this, wpc_dot_state,wpc_rombank_w)) - MCFG_WPC_SOUND_CTRL(READ8(*this, wpc_dot_state,wpc_sound_ctrl_r),WRITE8(*this, wpc_dot_state,wpc_sound_ctrl_w)) - MCFG_WPC_SOUND_DATA(READ8(*this, wpc_dot_state,wpc_sound_data_r),WRITE8(*this, wpc_dot_state,wpc_sound_data_w)) - MCFG_WPC_DMDBANK(WRITE8(*this, wpc_dot_state,wpc_dmdbank_w)) + MCFG_WPC_IRQ_ACKNOWLEDGE(WRITELINE(*this, wpc_flip2_state,wpc_irq_w)) + MCFG_WPC_FIRQ_ACKNOWLEDGE(WRITELINE(*this, wpc_flip2_state,wpc_firq_w)) + MCFG_WPC_ROMBANK(WRITE8(*this, wpc_flip2_state,wpc_rombank_w)) + MCFG_WPC_SOUND_CTRL(READ8(*this, wpc_flip2_state,wpc_sound_ctrl_r),WRITE8(*this, wpc_flip2_state,wpc_sound_ctrl_w)) + MCFG_WPC_SOUND_DATA(READ8(*this, wpc_flip2_state,wpc_sound_data_r),WRITE8(*this, wpc_flip2_state,wpc_sound_data_w)) + MCFG_WPC_DMDBANK(WRITE8(*this, wpc_flip2_state,wpc_dmdbank_w)) SPEAKER(config, "speaker").front_center(); MCFG_DEVICE_ADD("wpcsnd", WPCSND) MCFG_WPC_ROM_REGION("sound1") - MCFG_WPC_SOUND_REPLY_CALLBACK(WRITELINE(*this, wpc_dot_state,wpcsnd_reply_w)) + MCFG_WPC_SOUND_REPLY_CALLBACK(WRITELINE(*this, wpc_flip2_state,wpcsnd_reply_w)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 1.0) - config.set_default_layout(layout_lcd); - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_SIZE(128, 32) - MCFG_SCREEN_VISIBLE_AREA(0, 128-1, 0, 32-1) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_UPDATE_DRIVER(wpc_dot_state, screen_update) + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_native_aspect(); + screen.set_size(128, 32); + screen.set_visarea(0, 128-1, 0, 32-1); + screen.set_refresh_hz(60); + screen.set_screen_update(FUNC(wpc_flip2_state::screen_update)); MACHINE_CONFIG_END /*----------------- diff --git a/src/mame/drivers/x07.cpp b/src/mame/drivers/x07.cpp index 2e0074aab21..ad8bf59eeaa 100644 --- a/src/mame/drivers/x07.cpp +++ b/src/mame/drivers/x07.cpp @@ -1497,7 +1497,6 @@ MACHINE_CONFIG_START(x07_state::x07) MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(x07_state, x07) - config.set_default_layout(layout_lcd); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_x07) /* sound hardware */ diff --git a/src/mame/drivers/ymmu100.cpp b/src/mame/drivers/ymmu100.cpp index 4eccfd7bf81..e810f5f9e0c 100644 --- a/src/mame/drivers/ymmu100.cpp +++ b/src/mame/drivers/ymmu100.cpp @@ -122,7 +122,6 @@ #include "video/hd44780.h" #include "debugger.h" -#include "rendlay.h" #include "screen.h" #include "speaker.h" @@ -455,7 +454,6 @@ MACHINE_CONFIG_START(mu100_state::mu100) MCFG_SCREEN_UPDATE_DRIVER(mu100_state, screen_update) MCFG_SCREEN_SIZE(900, 241) MCFG_SCREEN_VISIBLE_AREA(0, 899, 0, 240) - config.set_default_layout(layout_lcd); SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); diff --git a/src/mame/drivers/z88.cpp b/src/mame/drivers/z88.cpp index 35e9dccb673..f6293830018 100644 --- a/src/mame/drivers/z88.cpp +++ b/src/mame/drivers/z88.cpp @@ -614,8 +614,6 @@ MACHINE_CONFIG_START(z88_state::z88) device = &PALETTE(config, m_palette, Z88_NUM_COLOURS); MCFG_PALETTE_INIT_OWNER(z88_state, z88) - config.set_default_layout(layout_lcd); - device = &UPD65031(config, m_blink, XTAL(9'830'400)); m_blink->kb_rd_callback().set(FUNC(z88_state::kb_r)); m_blink->int_wr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); diff --git a/src/mame/includes/alesis.h b/src/mame/includes/alesis.h index a9fa9a1f33b..93ceda86a4b 100644 --- a/src/mame/includes/alesis.h +++ b/src/mame/includes/alesis.h @@ -17,7 +17,6 @@ #include "video/hd44780.h" #include "imagedev/cassette.h" #include "emupal.h" -#include "rendlay.h" #define MCFG_ALESIS_DM3AG_ADD(_tag,_clock) \ MCFG_DEVICE_ADD( _tag, ALESIS_DM3AG, _clock ) diff --git a/src/mame/includes/gb.h b/src/mame/includes/gb.h index ac037d4ad47..09a585e9aff 100644 --- a/src/mame/includes/gb.h +++ b/src/mame/includes/gb.h @@ -9,6 +9,8 @@ #ifndef MAME_INCLUDES_GB_H #define MAME_INCLUDES_GB_H +#pragma once + #include "sound/gb.h" #include "cpu/lr35902/lr35902.h" #include "bus/gameboy/gb_slot.h" @@ -20,8 +22,8 @@ class gb_state : public driver_device { public: - gb_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + gb_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_cartslot(*this, "gbslot"), m_maincpu(*this, "maincpu"), m_apu(*this, "apu"), @@ -30,7 +32,8 @@ public: m_inputs(*this, "INPUTS"), m_bios_hack(*this, "SKIP_CHECK"), m_ram(*this, RAM_TAG), - m_ppu(*this, "ppu") { } + m_ppu(*this, "ppu") + { } uint8_t m_gb_io[0x10]; diff --git a/src/mame/includes/hx20.h b/src/mame/includes/hx20.h index c21acf72619..cf049c155a5 100644 --- a/src/mame/includes/hx20.h +++ b/src/mame/includes/hx20.h @@ -18,7 +18,6 @@ #include "bus/rs232/rs232.h" #include "emupal.h" -#include "rendlay.h" #define HD6301V1_MAIN_TAG "8g" #define HD6301V1_SLAVE_TAG "6d" diff --git a/src/mame/includes/nbmj8688.h b/src/mame/includes/nbmj8688.h index f6e7a01c8ce..396c5920950 100644 --- a/src/mame/includes/nbmj8688.h +++ b/src/mame/includes/nbmj8688.h @@ -1,5 +1,10 @@ // license:BSD-3-Clause // copyright-holders:Takahiro Nogi +#ifndef MAME_INCLUDES_NBMJ8688_H +#define MAME_INCLUDES_NBMJ8688_H + +#pragma once + #include "video/hd61830.h" #include "machine/nb1413m3.h" #include "emupal.h" @@ -156,3 +161,5 @@ private: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; }; + +#endif // MAME_INCLUDES_NBMJ8688_H diff --git a/src/mame/includes/wpc_dot.h b/src/mame/includes/wpc_dot.h index 073cadd2cd9..29a8ffa44a1 100644 --- a/src/mame/includes/wpc_dot.h +++ b/src/mame/includes/wpc_dot.h @@ -10,33 +10,31 @@ #ifndef MAME_INCLUDES_WPC_DOT_H #define MAME_INCLUDES_WPC_DOT_H +#pragma once + #include "cpu/m6809/m6809.h" #include "audio/wpcsnd.h" #include "audio/dcs.h" #include "machine/wpc.h" -#include "rendlay.h" class wpc_dot_state : public driver_device { public: wpc_dot_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_wpcsnd(*this,"wpcsnd"), - m_wpc(*this,"wpc"), - m_cpubank(*this, "cpubank"), - m_fixedbank(*this, "fixedbank"), - m_dmdbank1(*this, "dmdbank1"), - m_dmdbank2(*this, "dmdbank2"), - m_dmdbank3(*this, "dmdbank3"), - m_dmdbank4(*this, "dmdbank4"), - m_dmdbank5(*this, "dmdbank5"), - m_dmdbank6(*this, "dmdbank6") + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_wpcsnd(*this,"wpcsnd") + , m_wpc(*this,"wpc") + , m_cpubank(*this, "cpubank") + , m_fixedbank(*this, "fixedbank") + , m_dmdbanks(*this, "dmdbank%u", 1U) { } + void init_wpc_dot(); void wpc_dot(machine_config &config); - void wpc_dot_map(address_map &map); + protected: + void wpc_dot_map(address_map &map); // devices required_device m_maincpu; @@ -44,20 +42,14 @@ protected: required_device m_wpc; required_memory_bank m_cpubank; required_memory_bank m_fixedbank; - required_memory_bank m_dmdbank1; - required_memory_bank m_dmdbank2; - required_memory_bank m_dmdbank3; - required_memory_bank m_dmdbank4; - required_memory_bank m_dmdbank5; - required_memory_bank m_dmdbank6; + required_memory_bank_array<6> m_dmdbanks; // driver_device overrides virtual void machine_reset() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; static const device_timer_id TIMER_VBLANK = 0; static const device_timer_id TIMER_IRQ = 1; -public: - void init_wpc_dot(); + DECLARE_READ8_MEMBER(ram_r); DECLARE_WRITE8_MEMBER(ram_w); DECLARE_WRITE_LINE_MEMBER(wpcsnd_reply_w); diff --git a/src/mame/includes/wpc_flip1.h b/src/mame/includes/wpc_flip1.h index dd53bb41d08..8f26f9ebd75 100644 --- a/src/mame/includes/wpc_flip1.h +++ b/src/mame/includes/wpc_flip1.h @@ -8,6 +8,8 @@ #ifndef MAME_INCLUDES_WPC_FLIP1_H #define MAME_INCLUDES_WPC_FLIP1_H +#pragma once + #include "includes/wpc_dot.h" class wpc_flip1_state : public wpc_dot_state @@ -16,9 +18,11 @@ public: wpc_flip1_state(const machine_config &mconfig, device_type type, const char *tag) : wpc_dot_state(mconfig, type, tag) { } -public: + void init_wpc_flip1(); void wpc_flip1(machine_config &config); + +protected: void wpc_flip1_map(address_map &map); }; diff --git a/src/mame/includes/wpc_flip2.h b/src/mame/includes/wpc_flip2.h index 9709abedcb6..7c07907af1f 100644 --- a/src/mame/includes/wpc_flip2.h +++ b/src/mame/includes/wpc_flip2.h @@ -8,6 +8,8 @@ #ifndef MAME_INCLUDES_WPC_FLIP2_H #define MAME_INCLUDES_WPC_FLIP2_H +#pragma once + #include "includes/wpc_flip1.h" class wpc_flip2_state : public wpc_flip1_state @@ -16,9 +18,11 @@ public: wpc_flip2_state(const machine_config &mconfig, device_type type, const char *tag) : wpc_flip1_state(mconfig, type, tag) { } -public: + void init_wpc_flip2(); void wpc_flip2(machine_config &config); + +protected: void wpc_flip2_map(address_map &map); }; diff --git a/src/mame/includes/x07.h b/src/mame/includes/x07.h index 1d1c770b042..b3da10b3134 100644 --- a/src/mame/includes/x07.h +++ b/src/mame/includes/x07.h @@ -5,6 +5,10 @@ includes/x07.h *********************************************************************/ +#ifndef MAME_INCLUDES_X07_H +#define MAME_INCLUDES_X07_H + +#pragma once #include "cpu/z80/z80.h" #include "sound/beep.h" @@ -18,7 +22,6 @@ #include "bus/generic/slot.h" #include "bus/generic/carts.h" #include "emupal.h" -#include "rendlay.h" //default value for user defined keys, taken for official documentation static const char *const udk_ini[12] = { @@ -291,3 +294,5 @@ private: void x07_io(address_map &map); void x07_mem(address_map &map); }; + +#endif // MAME_INCLUDES_X07_H diff --git a/src/mame/includes/z88.h b/src/mame/includes/z88.h index cfe59c28a84..6d55aaae74a 100644 --- a/src/mame/includes/z88.h +++ b/src/mame/includes/z88.h @@ -9,6 +9,8 @@ #ifndef MAME_INCLUDES_Z88_H #define MAME_INCLUDES_Z88_H +#pragma once + #include "cpu/z80/z80.h" #include "machine/ram.h" #include "machine/upd65031.h" @@ -20,7 +22,6 @@ #include "bus/z88/z88.h" #include "emupal.h" -#include "rendlay.h" #include "screen.h" #include "speaker.h" diff --git a/src/mame/layout/nbmj8688.lay b/src/mame/layout/nbmj8688.lay index 9dc702d198a..d6e2037d4d4 100644 --- a/src/mame/layout/nbmj8688.lay +++ b/src/mame/layout/nbmj8688.lay @@ -1,51 +1,15 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -55,7 +19,6 @@ - @@ -66,7 +29,6 @@ - diff --git a/src/mame/layout/rocknms.lay b/src/mame/layout/rocknms.lay index d01706707f3..a8d892f3cb4 100644 --- a/src/mame/layout/rocknms.lay +++ b/src/mame/layout/rocknms.lay @@ -1,30 +1,5 @@ - - - - - - - - - - - - - - - - - - - - - - - - - @@ -32,7 +7,6 @@ - diff --git a/src/mame/layout/stepstag.lay b/src/mame/layout/stepstag.lay index 1c7dce7c093..f51becc014f 100644 --- a/src/mame/layout/stepstag.lay +++ b/src/mame/layout/stepstag.lay @@ -1,56 +1,15 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mame/video/decodmd1.cpp b/src/mame/video/decodmd1.cpp index d3af92b81e2..17a6bdefcf7 100644 --- a/src/mame/video/decodmd1.cpp +++ b/src/mame/video/decodmd1.cpp @@ -9,7 +9,6 @@ #include "emu.h" #include "decodmd1.h" -#include "rendlay.h" #include "screen.h" DEFINE_DEVICE_TYPE(DECODMD1, decodmd_type1_device, "decodmd1", "Data East Pinball Dot Matrix Display Type 1") @@ -206,9 +205,7 @@ MACHINE_CONFIG_START(decodmd_type1_device::device_add_mconfig) MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer", decodmd_type1_device, dmd_nmi, attotime::from_hz(2000)) // seems a lot - config.set_default_layout(layout_lcd); - - MCFG_SCREEN_ADD("dmd",LCD) + MCFG_SCREEN_ADD("dmd", LCD) MCFG_SCREEN_SIZE(128, 16) MCFG_SCREEN_VISIBLE_AREA(0, 128-1, 0, 16-1) MCFG_SCREEN_UPDATE_DRIVER(decodmd_type1_device, screen_update) diff --git a/src/mame/video/decodmd2.cpp b/src/mame/video/decodmd2.cpp index 752ef6c522f..00622e504e6 100644 --- a/src/mame/video/decodmd2.cpp +++ b/src/mame/video/decodmd2.cpp @@ -10,7 +10,6 @@ #include "emu.h" #include "decodmd2.h" -#include "rendlay.h" #include "screen.h" DEFINE_DEVICE_TYPE(DECODMD2, decodmd_type2_device, "decodmd2", "Data East Pinball Dot Matrix Display Type 2") @@ -143,29 +142,28 @@ MACHINE_CONFIG_START(decodmd_type2_device::device_add_mconfig) MCFG_MC6845_CHAR_WIDTH(8) MCFG_MC6845_UPDATE_ROW_CB(decodmd_type2_device, crtc_update_row) - config.set_default_layout(layout_lcd); - - MCFG_SCREEN_ADD("dmd",RASTER) - MCFG_SCREEN_SIZE(128, 32) - MCFG_SCREEN_VISIBLE_AREA(0, 128-1, 0, 32-1) - MCFG_SCREEN_UPDATE_DEVICE("dmd6845", mc6845_device, screen_update) - MCFG_SCREEN_REFRESH_RATE(60) + screen_device &screen(SCREEN(config, "dmd", SCREEN_TYPE_RASTER)); + screen.set_native_aspect(); + screen.set_size(128, 32); + screen.set_visarea(0, 128-1, 0, 32-1); + screen.set_screen_update("dmd6845", FUNC(mc6845_device::screen_update)); + screen.set_refresh_hz(60); MCFG_RAM_ADD(RAM_TAG) MCFG_RAM_DEFAULT_SIZE("12K") - MACHINE_CONFIG_END decodmd_type2_device::decodmd_type2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, DECODMD2, tag, owner, clock), - m_cpu(*this,"dmdcpu"), - m_mc6845(*this,"dmd6845"), - m_rombank1(*this,"dmdbank1"), - m_rombank2(*this,"dmdbank2"), - m_rambank(*this,"dmdram"), - m_ram(*this,RAM_TAG) -{} + : device_t(mconfig, DECODMD2, tag, owner, clock) + , m_cpu(*this, "dmdcpu") + , m_mc6845(*this, "dmd6845") + , m_rombank1(*this, "dmdbank1") + , m_rombank2(*this, "dmdbank2") + , m_rambank(*this, "dmdram") + , m_ram(*this, RAM_TAG) +{ +} void decodmd_type2_device::device_start() { diff --git a/src/mame/video/decodmd3.cpp b/src/mame/video/decodmd3.cpp index 414ab2c1a5e..2148973db2b 100644 --- a/src/mame/video/decodmd3.cpp +++ b/src/mame/video/decodmd3.cpp @@ -10,7 +10,6 @@ #include "emu.h" #include "decodmd3.h" -#include "rendlay.h" #include "screen.h" DEFINE_DEVICE_TYPE(DECODMD3, decodmd_type3_device, "decodmd3", "Data East Pinball Dot Matrix Display Type 3") @@ -145,13 +144,12 @@ MACHINE_CONFIG_START(decodmd_type3_device::device_add_mconfig) MCFG_MC6845_CHAR_WIDTH(16) MCFG_MC6845_UPDATE_ROW_CB(decodmd_type3_device, crtc_update_row) - config.set_default_layout(layout_lcd); - - MCFG_SCREEN_ADD("dmd",RASTER) - MCFG_SCREEN_SIZE(192, 64) - MCFG_SCREEN_VISIBLE_AREA(0, 192-1, 0, 64-1) - MCFG_SCREEN_UPDATE_DEVICE("dmd6845", mc6845_device, screen_update) - MCFG_SCREEN_REFRESH_RATE(60) + screen_device &screen(SCREEN(config, "dmd", SCREEN_TYPE_RASTER)); + screen.set_native_aspect(); + screen.set_size(192, 64); + screen.set_visarea(0, 192-1, 0, 64-1); + screen.set_screen_update("dmd6845", FUNC(mc6845_device::screen_update)); + screen.set_refresh_hz(60); MCFG_RAM_ADD(RAM_TAG) MCFG_RAM_DEFAULT_SIZE("64K") @@ -159,13 +157,14 @@ MACHINE_CONFIG_END decodmd_type3_device::decodmd_type3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, DECODMD3, tag, owner, clock), - m_cpu(*this,"dmdcpu"), - m_mc6845(*this,"dmd6845"), - m_ram(*this,RAM_TAG), - m_rambank(*this,"dmdram"), - m_rombank(*this,"dmdrom") -{} + : device_t(mconfig, DECODMD3, tag, owner, clock) + , m_cpu(*this,"dmdcpu") + , m_mc6845(*this,"dmd6845") + , m_ram(*this,RAM_TAG) + , m_rambank(*this,"dmdram") + , m_rombank(*this,"dmdrom") +{ +} void decodmd_type3_device::device_start() { diff --git a/src/mame/video/gamate.cpp b/src/mame/video/gamate.cpp index 39f62d0884f..6d678a625e0 100644 --- a/src/mame/video/gamate.cpp +++ b/src/mame/video/gamate.cpp @@ -26,7 +26,6 @@ #include "emu.h" #include "video/gamate.h" -#include "rendlay.h" #include "screen.h" DEFINE_DEVICE_TYPE(GAMATE_VIDEO, gamate_video_device, "gamate_vid", "Gamate Video Hardware") @@ -316,8 +315,6 @@ MACHINE_CONFIG_START(gamate_video_device::device_add_mconfig) MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_SCANLINE) // close approximate until we use timers to emulate exact video update MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - config.set_default_layout(layout_lcd); - MCFG_PALETTE_ADD("palette", 4) MCFG_PALETTE_INIT_OWNER(gamate_video_device,gamate) MACHINE_CONFIG_END diff --git a/src/mame/video/kyocera.cpp b/src/mame/video/kyocera.cpp index 78e96a6833c..ba34a0a5e84 100644 --- a/src/mame/video/kyocera.cpp +++ b/src/mame/video/kyocera.cpp @@ -3,7 +3,6 @@ #include "emu.h" #include "includes/kyocera.h" -#include "rendlay.h" #include "screen.h" @@ -56,8 +55,6 @@ MACHINE_CONFIG_START(kc85_state::kc85_video) MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 64-1) MCFG_SCREEN_PALETTE("palette") - config.set_default_layout(layout_lcd); - MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(kc85_state,kc85) @@ -84,8 +81,6 @@ MACHINE_CONFIG_START(tandy200_state::tandy200_video) MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 128-1) MCFG_SCREEN_PALETTE("palette") - config.set_default_layout(layout_lcd); - MCFG_PALETTE_ADD("palette", 2) MCFG_PALETTE_INIT_OWNER(tandy200_state,tandy200) diff --git a/src/mame/video/wpc_dmd.cpp b/src/mame/video/wpc_dmd.cpp index 98675d0561d..683ee65e407 100644 --- a/src/mame/video/wpc_dmd.cpp +++ b/src/mame/video/wpc_dmd.cpp @@ -2,7 +2,6 @@ // copyright-holders:Olivier Galibert #include "emu.h" #include "wpc_dmd.h" -#include "rendlay.h" #include "screen.h" DEFINE_DEVICE_TYPE(WPC_DMD, wpc_dmd_device, "wpc_dmd", "Williams Pinball Controller Dot Matrix Display") @@ -43,7 +42,6 @@ MACHINE_CONFIG_START(wpc_dmd_device::device_add_mconfig) MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, wpc_dmd_device, screen_update) MCFG_SCREEN_SIZE(128*4, 32*4) MCFG_SCREEN_VISIBLE_AREA(0, 128*4-1, 0, 32*4-1) - config.set_default_layout(layout_lcd); MCFG_TIMER_DRIVER_ADD_PERIODIC("scanline", wpc_dmd_device, scanline_timer, attotime::from_hz(60*4*32)) MACHINE_CONFIG_END diff --git a/src/osd/eigccppc.h b/src/osd/eigccppc.h index 7f932eb1e88..56a4c65d5b1 100644 --- a/src/osd/eigccppc.h +++ b/src/osd/eigccppc.h @@ -9,8 +9,8 @@ ***************************************************************************/ -#ifndef __EIGCCPPC__ -#define __EIGCCPPC__ +#ifndef MAME_OSD_EIGCCPPC_H +#define MAME_OSD_EIGCCPPC_H /*************************************************************************** @@ -283,4 +283,4 @@ _count_leading_ones(uint32_t value) return result; } -#endif /* __EIGCCPPC__ */ +#endif // MAME_OSD_EIGCCPPC_H diff --git a/src/osd/osdnet.h b/src/osd/osdnet.h index 908a8f33242..87a1b56b9f0 100644 --- a/src/osd/osdnet.h +++ b/src/osd/osdnet.h @@ -1,8 +1,9 @@ // license:BSD-3-Clause // copyright-holders:Carl -#ifndef __OSDNET_H__ -#define __OSDNET_H__ +#ifndef MAME_OSD_OSDNET_H +#define MAME_OSD_OSDNET_H +#pragma once class osd_netdev; @@ -46,4 +47,5 @@ void add_netdev(const char *name, const char *description, create_netdev func); void clear_netdev(); const std::vector>& get_netdev_list(); int netdev_count(); -#endif + +#endif // MAME_OSD_OSDNET_H diff --git a/src/osd/osdsync.h b/src/osd/osdsync.h index 71726a830cf..3a286b60afa 100644 --- a/src/osd/osdsync.h +++ b/src/osd/osdsync.h @@ -5,9 +5,10 @@ // osdsync.h - Core synchronization functions // //============================================================ +#ifndef MAME_OSD_OSDSYNC_H +#define MAME_OSD_OSDSYNC_H -#ifndef __OSDSYNC__ -#define __OSDSYNC__ +#pragma once // C++ headers #include @@ -163,4 +164,4 @@ private: }; -#endif /* __OSDSYNC__ */ +#endif // MAME_OSD_OSDSYNC_H -- cgit v1.2.3 From 85eaf871946af5ee509154a48ac497157c0c341d Mon Sep 17 00:00:00 2001 From: Robbbert Date: Fri, 27 Jul 2018 00:18:55 +1000 Subject: (nw) pulsarlb : notes --- src/mame/drivers/pulsar.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/mame/drivers/pulsar.cpp b/src/mame/drivers/pulsar.cpp index 0f0f425da38..a6929df412e 100644 --- a/src/mame/drivers/pulsar.cpp +++ b/src/mame/drivers/pulsar.cpp @@ -16,7 +16,10 @@ The terminal must be set for 9600 baud, 7 bits, even parity, 1 stop bit. ToDo: -- Need software +- Fix floppy. It needs to WAIT the cpu whenever port 0xD3 is read, wait + for either DRQ ir INTRQ to assert, then release the cpu and then do the + actual port read. Our Z80 cannot do that. +- Fix FDC so MAME doesn't crash when a certain disk is inserted. Monitor Commands: @@ -71,8 +74,8 @@ private: DECLARE_WRITE8_MEMBER(ppi_pc_w); DECLARE_READ8_MEMBER(ppi_pc_r); - void pulsar_io(address_map &map); - void pulsar_mem(address_map &map); + void io_map(address_map &map); + void mem_map(address_map &map); floppy_image_device *m_floppy; required_device m_maincpu; @@ -82,7 +85,7 @@ private: required_device m_rtc; }; -void pulsar_state::pulsar_mem(address_map &map) +void pulsar_state::mem_map(address_map &map) { map.unmap_value_high(); map(0x0000, 0x07ff).bankr("bankr0").bankw("bankw0"); @@ -90,7 +93,7 @@ void pulsar_state::pulsar_mem(address_map &map) map(0xf800, 0xffff).bankr("bankr1").bankw("bankw1"); } -void pulsar_state::pulsar_io(address_map &map) +void pulsar_state::io_map(address_map &map) { map.unmap_value_high(); map.global_mask(0xff); @@ -176,7 +179,7 @@ DEVICE_INPUT_DEFAULTS_END static void pulsar_floppies(device_slot_interface &device) { - device.option_add("525hd", FLOPPY_525_HD); + device.option_add("flop", FLOPPY_8_DSDD); } /* Input ports */ @@ -209,8 +212,8 @@ void pulsar_state::init_pulsar() MACHINE_CONFIG_START(pulsar_state::pulsar) /* basic machine hardware */ MCFG_DEVICE_ADD("maincpu", Z80, 4_MHz_XTAL) - MCFG_DEVICE_PROGRAM_MAP(pulsar_mem) - MCFG_DEVICE_IO_MAP(pulsar_io) + MCFG_DEVICE_PROGRAM_MAP(mem_map) + MCFG_DEVICE_IO_MAP(io_map) MCFG_Z80_DAISY_CHAIN(daisy_chain_intf) MCFG_MACHINE_RESET_OVERRIDE(pulsar_state, pulsar) @@ -242,9 +245,9 @@ MACHINE_CONFIG_START(pulsar_state::pulsar) brg.ft_handler().append("dart", FUNC(z80dart_device::rxcb_w)); MCFG_DEVICE_ADD("fdc", FD1797, 4_MHz_XTAL / 2) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", pulsar_floppies, "525hd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:0", pulsar_floppies, "flop", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", pulsar_floppies, "525hd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD("fdc:1", pulsar_floppies, "flop", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_SOUND(true) MACHINE_CONFIG_END @@ -252,9 +255,9 @@ MACHINE_CONFIG_END ROM_START( pulsarlb ) ROM_REGION( 0x10800, "maincpu", ROMREGION_ERASEFF ) ROM_SYSTEM_BIOS(0, "mon7", "MP7A") - ROMX_LOAD( "mp7a.bin", 0x10000, 0x800, CRC(726b8a19) SHA1(43b2af84d5622c1f67584c501b730acf002a6113), ROM_BIOS(0)) + ROMX_LOAD( "mp7a.u2", 0x10000, 0x800, CRC(726b8a19) SHA1(43b2af84d5622c1f67584c501b730acf002a6113), ROM_BIOS(0)) ROM_SYSTEM_BIOS(1, "mon6", "LBOOT6") // Blank screen until floppy boots - ROMX_LOAD( "lboot6.rom", 0x10000, 0x800, CRC(3bca9096) SHA1(ff99288e51a9e832785ce8e3ab5a9452b1064231), ROM_BIOS(1)) + ROMX_LOAD( "lboot6.u2", 0x10000, 0x800, CRC(3bca9096) SHA1(ff99288e51a9e832785ce8e3ab5a9452b1064231), ROM_BIOS(1)) ROM_END /* Driver */ -- cgit v1.2.3 From 6024c958b978b9d470ac7261257e5d2312f92178 Mon Sep 17 00:00:00 2001 From: AJR Date: Thu, 26 Jul 2018 14:40:44 -0400 Subject: debug/express.cpp: Use std::deque for token stack (nw) --- src/emu/debug/express.cpp | 48 ++++++++++++++++------------------------------- src/emu/debug/express.h | 6 ++---- 2 files changed, 18 insertions(+), 36 deletions(-) diff --git a/src/emu/debug/express.cpp b/src/emu/debug/express.cpp index 0e4175c6aaf..bcd9269db30 100644 --- a/src/emu/debug/express.cpp +++ b/src/emu/debug/express.cpp @@ -539,8 +539,7 @@ void symbol_table::set_memory_value(const char *name, expression_space space, u3 //------------------------------------------------- parsed_expression::parsed_expression(symbol_table *symtable, const char *expression, u64 *result) - : m_symtable(symtable), - m_token_stack_ptr(0) + : m_symtable(symtable) { // if we got an expression parse it if (expression != nullptr) @@ -1210,15 +1209,13 @@ void parsed_expression::normalize_operator(parse_token *prevtoken, parse_token & // Determine if , refers to a function parameter case TVL_COMMA: - for (int lookback = 0; lookback < MAX_STACK_DEPTH; lookback++) + for (auto lookback = m_token_stack.rbegin(); lookback != m_token_stack.rend(); ++lookback) { - parse_token *peek = peek_token(lookback); - if (peek == nullptr) - break; + parse_token &peek = *lookback; // if we hit an execute function operator, or else a left parenthesis that is // already tagged, then tag us as well - if (peek->is_operator(TVL_EXECUTEFUNC) || (peek->is_operator(TVL_LPAREN) && peek->is_function_separator())) + if (peek.is_operator(TVL_EXECUTEFUNC) || (peek.is_operator(TVL_LPAREN) && peek.is_function_separator())) { thistoken.set_function_separator(); break; @@ -1332,11 +1329,11 @@ void parsed_expression::infix_to_postfix() inline void parsed_expression::push_token(parse_token &token) { // check for overflow - if (m_token_stack_ptr >= MAX_STACK_DEPTH) + if (m_token_stack.size() >= m_token_stack.max_size()) throw expression_error(expression_error::STACK_OVERFLOW, token.offset()); // push - m_token_stack[m_token_stack_ptr++] = token; + m_token_stack.push_back(token); } @@ -1347,24 +1344,12 @@ inline void parsed_expression::push_token(parse_token &token) inline void parsed_expression::pop_token(parse_token &token) { // check for underflow - if (m_token_stack_ptr == 0) + if (m_token_stack.empty()) throw expression_error(expression_error::STACK_UNDERFLOW, token.offset()); // pop - token = m_token_stack[--m_token_stack_ptr]; -} - - -//------------------------------------------------- -// peek_token - look at a token some number of -// entries up the stack -//------------------------------------------------- - -inline parsed_expression::parse_token *parsed_expression::peek_token(int count) -{ - if (m_token_stack_ptr <= count) - return nullptr; - return &m_token_stack[m_token_stack_ptr - count - 1]; + token = std::move(m_token_stack.back()); + m_token_stack.pop_back(); } @@ -1412,7 +1397,7 @@ inline void parsed_expression::pop_token_rval(parse_token &token) u64 parsed_expression::execute_tokens() { // reset the token stack - m_token_stack_ptr = 0; + m_token_stack.clear(); // loop over the entire sequence parse_token t1, t2, result; @@ -1662,7 +1647,7 @@ u64 parsed_expression::execute_tokens() pop_token_rval(result); // error if our stack isn't empty - if (peek_token(0) != nullptr) + if (!m_token_stack.empty()) throw expression_error(expression_error::SYNTAX, 0); return result.value(); @@ -1741,18 +1726,17 @@ void parsed_expression::execute_function(parse_token &token) while (paramcount < MAX_FUNCTION_PARAMS) { // peek at the next token on the stack - parse_token *peek = peek_token(0); - if (peek == nullptr) + if (m_token_stack.empty()) throw expression_error(expression_error::INVALID_PARAM_COUNT, token.offset()); + parse_token &peek = m_token_stack.back(); // if it is a function symbol, break out of the loop - if (peek->is_symbol()) + if (peek.is_symbol()) { - symbol = peek->symbol(); + symbol = peek.symbol(); if (symbol->is_function()) { - parse_token t1; - pop_token(t1); + m_token_stack.pop_back(); break; } } diff --git a/src/emu/debug/express.h b/src/emu/debug/express.h index 270743e6261..ee5a500ad0e 100644 --- a/src/emu/debug/express.h +++ b/src/emu/debug/express.h @@ -15,6 +15,7 @@ #include "emucore.h" +#include #include #include @@ -366,7 +367,6 @@ private: // execution helpers void push_token(parse_token &token); void pop_token(parse_token &token); - parse_token *peek_token(int count); void pop_token_lval(parse_token &token); void pop_token_rval(parse_token &token); u64 execute_tokens(); @@ -374,15 +374,13 @@ private: // constants static const int MAX_FUNCTION_PARAMS = 16; - static const int MAX_STACK_DEPTH = 16; // internal state symbol_table * m_symtable; // symbol table std::string m_original_string; // original string (prior to parsing) simple_list m_tokenlist; // token list simple_list m_stringlist; // string list - int m_token_stack_ptr; // stack pointer (used during execution) - parse_token m_token_stack[MAX_STACK_DEPTH]; // token stack (used during execution) + std::deque m_token_stack; // token stack (used during execution) }; #endif // MAME_EMU_DEBUG_EXPRESS_H -- cgit v1.2.3 From 8de41654fafdf4311034331e48a7e2723a3ea3ca Mon Sep 17 00:00:00 2001 From: AJR Date: Thu, 26 Jul 2018 14:41:14 -0400 Subject: debugcpu.cpp: Move scripting functions down into console (nw) --- src/emu/debug/debugcmd.cpp | 4 +-- src/emu/debug/debugcon.cpp | 66 ++++++++++++++++++++++++++++++++++++++++++ src/emu/debug/debugcon.h | 4 +++ src/emu/debug/debugcpu.cpp | 72 ++-------------------------------------------- src/emu/debug/debugcpu.h | 9 ------ 5 files changed, 74 insertions(+), 81 deletions(-) diff --git a/src/emu/debug/debugcmd.cpp b/src/emu/debug/debugcmd.cpp index f253235f714..4dc4844ae6c 100644 --- a/src/emu/debug/debugcmd.cpp +++ b/src/emu/debug/debugcmd.cpp @@ -294,7 +294,7 @@ debugger_commands::debugger_commands(running_machine& machine, debugger_cpu& cpu /* set up the initial debugscript if specified */ const char* name = m_machine.options().debug_script(); if (name[0] != 0) - m_cpu.source_script(name); + m_console.source_script(name); m_cheat.cpu[0] = m_cheat.cpu[1] = 0; } @@ -3094,7 +3094,7 @@ void debugger_commands::execute_snap(int ref, const std::vector &pa void debugger_commands::execute_source(int ref, const std::vector ¶ms) { - m_cpu.source_script(params[0].c_str()); + m_console.source_script(params[0].c_str()); } diff --git a/src/emu/debug/debugcon.cpp b/src/emu/debug/debugcon.cpp index 3b0f2e98b6b..e19d23e6b55 100644 --- a/src/emu/debug/debugcon.cpp +++ b/src/emu/debug/debugcon.cpp @@ -15,6 +15,7 @@ #include "textbuf.h" #include "debugger.h" #include +#include /*************************************************************************** CONSTANTS @@ -392,6 +393,71 @@ void debugger_console::register_command(const char *command, u32 flags, int ref, } +//------------------------------------------------- +// source_script - specifies a debug command +// script to execute +//------------------------------------------------- + +void debugger_console::source_script(const char *file) +{ + // close any existing source file + m_source_file.reset(); + + // open a new one if requested + if (file != nullptr) + { + auto source_file = std::make_unique(file, std::ifstream::in); + if (source_file->fail()) + { + if (m_machine.phase() == machine_phase::RUNNING) + printf("Cannot open command file '%s'\n", file); + else + fatalerror("Cannot open command file '%s'\n", file); + } + else + { + m_source_file = std::move(source_file); + } + } +} + + +//------------------------------------------------- +// process_source_file - executes commands from +// a source file +//------------------------------------------------- + +void debugger_console::process_source_file() +{ + std::string buf; + + // loop until the file is exhausted or until we are executing again + while (m_machine.debugger().cpu().is_stopped() + && m_source_file + && std::getline(*m_source_file, buf)) + { + // strip out comments (text after '//') + size_t pos = buf.find("//"); + if (pos != std::string::npos) + buf.resize(pos); + + // strip whitespace + strtrimrightspace(buf); + + // execute the command + if (!buf.empty()) + execute_command(buf, true); + } + + if (m_source_file && !m_source_file->good()) + { + if (!m_source_file->eof()) + printf("I/O error, script processing terminated\n"); + m_source_file.reset(); + } +} + + /*************************************************************************** diff --git a/src/emu/debug/debugcon.h b/src/emu/debug/debugcon.h index 7cc1231d4c9..a64238ed8c6 100644 --- a/src/emu/debug/debugcon.h +++ b/src/emu/debug/debugcon.h @@ -80,6 +80,8 @@ public: CMDERR execute_command(const std::string &command, bool echo); CMDERR validate_command(const char *command); void register_command(const char *command, u32 flags, int ref, int minparams, int maxparams, std::function &)> handler); + void source_script(const char *file); + void process_source_file(); /* console management */ void vprintf(util::format_argument_pack const &args); @@ -132,6 +134,8 @@ private: text_buffer *m_errorlog_textbuf; debug_command *m_commandlist; + + std::unique_ptr m_source_file; // script source file }; #endif // MAME_EMU_DEBUG_DEBUGCON_H diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp index cd17a1e40f7..bdb0928f926 100644 --- a/src/emu/debug/debugcpu.cpp +++ b/src/emu/debug/debugcpu.cpp @@ -25,9 +25,6 @@ #include "osdepend.h" #include "xmlfile.h" -#include -#include - const size_t debugger_cpu::NUM_TEMP_VARIABLES = 10; @@ -152,42 +149,13 @@ symbol_table* debugger_cpu::get_visible_symtable() } -/*------------------------------------------------- - source_script - specifies a debug command - script to execute --------------------------------------------------*/ - -void debugger_cpu::source_script(const char *file) -{ - // close any existing source file - m_source_file.reset(); - - // open a new one if requested - if (file != nullptr) - { - auto source_file = std::make_unique(file, std::ifstream::in); - if (source_file->fail()) - { - if (m_machine.phase() == machine_phase::RUNNING) - m_machine.debugger().console().printf("Cannot open command file '%s'\n", file); - else - fatalerror("Cannot open command file '%s'\n", file); - } - else - { - m_source_file = std::move(source_file); - } - } -} - - //************************************************************************** // MEMORY AND DISASSEMBLY HELPERS //************************************************************************** //------------------------------------------------- -// omment_save - save all comments for the given +// comment_save - save all comments for the given // machine //------------------------------------------------- @@ -641,42 +609,6 @@ void debugger_cpu::reset_transient_flags() } -/*------------------------------------------------- - process_source_file - executes commands from - a source file --------------------------------------------------*/ - -void debugger_cpu::process_source_file() -{ - std::string buf; - - // loop until the file is exhausted or until we are executing again - while (m_execution_state == exec_state::STOPPED - && m_source_file - && std::getline(*m_source_file, buf)) - { - // strip out comments (text after '//') - size_t pos = buf.find("//"); - if (pos != std::string::npos) - buf.resize(pos); - - // strip whitespace - strtrimrightspace(buf); - - // execute the command - if (!buf.empty()) - m_machine.debugger().console().execute_command(buf, true); - } - - if (m_source_file && !m_source_file->good()) - { - if (!m_source_file->eof()) - m_machine.debugger().console().printf("I/O error, script processing terminated\n"); - m_source_file.reset(); - } -} - - /*************************************************************************** EXPRESSION HANDLERS @@ -1718,7 +1650,7 @@ void device_debug::instruction_hook(offs_t curpc) } // check for commands in the source file - machine.debugger().cpu().process_source_file(); + machine.debugger().console().process_source_file(); // if an event got scheduled, resume if (machine.scheduled_event_pending()) diff --git a/src/emu/debug/debugcpu.h b/src/emu/debug/debugcpu.h index f3e8f68a408..2244b6ccb42 100644 --- a/src/emu/debug/debugcpu.h +++ b/src/emu/debug/debugcpu.h @@ -504,12 +504,6 @@ public: symbol_table *get_visible_symtable(); - /* ----- misc debugger functions ----- */ - - /* specifies a debug command script to execute */ - void source_script(const char *file); - - /* ----- debugger comment helpers ----- */ // save all comments for a given machine @@ -581,7 +575,6 @@ public: void halt_on_next_instruction(device_t *device, util::format_argument_pack &&args); void ensure_comments_loaded(); void reset_transient_flags(); - void process_source_file(); private: static const size_t NUM_TEMP_VARIABLES; @@ -611,8 +604,6 @@ private: device_t * m_visiblecpu; device_t * m_breakcpu; - std::unique_ptr m_source_file; // script source file - std::unique_ptr m_symtable; // global symbol table bool m_within_instruction_hook; -- cgit v1.2.3 From f2874c54a331aaafae1cd774c63d06c02a989ba6 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Thu, 26 Jul 2018 22:38:14 +0200 Subject: new working clone ------------------------------ Halley's Comet (Japan, prototype) [Joe Magiera, The Dumping Union] --- src/mame/drivers/halleys.cpp | 62 +++++++++++++++++++++++++++++++++++++------- src/mame/mame.lst | 9 ++++--- 2 files changed, 58 insertions(+), 13 deletions(-) diff --git a/src/mame/drivers/halleys.cpp b/src/mame/drivers/halleys.cpp index 00bff4219f0..094e8d42c74 100644 --- a/src/mame/drivers/halleys.cpp +++ b/src/mame/drivers/halleys.cpp @@ -231,6 +231,7 @@ public: void init_halley87(); void init_benberob(); void init_halleys(); + void init_halleysp(); private: uint16_t *m_render_layer[MAX_LAYERS]; @@ -2012,7 +2013,7 @@ ROM_START( benberob ) ROM_END -ROM_START( halleys ) +ROM_START( halleysc ) ROM_REGION( 0x10000, "maincpu", 0 ) //MAIN PRG ROM_LOAD( "a62_01.30", 0x0000, 0x4000, CRC(a5e82b3e) SHA1(c16c6a6c23a579454b8a2be4b951c35b04f2a856) ) ROM_LOAD( "a62_02.31", 0x4000, 0x4000, CRC(25f5bcd3) SHA1(9d72afe866df363d2ac33dab3ed6c3913f4de12d) ) @@ -2040,7 +2041,7 @@ ROM_START( halleys ) ROM_END -ROM_START( halleycj ) +ROM_START( halleyscj ) ROM_REGION( 0x10000, "maincpu", 0 ) //MAIN PRG ROM_LOAD( "a62_01.30", 0x0000, 0x4000, CRC(a5e82b3e) SHA1(c16c6a6c23a579454b8a2be4b951c35b04f2a856) ) ROM_LOAD( "a62_02.31", 0x4000, 0x4000, CRC(25f5bcd3) SHA1(9d72afe866df363d2ac33dab3ed6c3913f4de12d) ) @@ -2068,7 +2069,7 @@ ROM_START( halleycj ) ROM_END -ROM_START( halleysc ) +ROM_START( halleyscja ) ROM_REGION( 0x10000, "maincpu", 0 ) //MAIN PRG ROM_LOAD( "a62_01.30", 0x0000, 0x4000, CRC(a5e82b3e) SHA1(c16c6a6c23a579454b8a2be4b951c35b04f2a856) ) ROM_LOAD( "a62_02.31", 0x4000, 0x4000, CRC(25f5bcd3) SHA1(9d72afe866df363d2ac33dab3ed6c3913f4de12d) ) @@ -2096,7 +2097,35 @@ ROM_START( halleysc ) ROM_END -ROM_START( halley87 ) +ROM_START( halleyscjp ) /* earliest version, preproduction or possible prototype with all hand written labels */ + ROM_REGION( 0x10000, "maincpu", 0 ) //MAIN PRG + ROM_LOAD( "p_0_19f8.30", 0x0000, 0x4000, CRC(10acefe8) SHA1(2f64e052999bc98219129206ec73b5d96d20ae60) ) /* hand written label P_0 19F8 */ + ROM_LOAD( "p_1_87b4.31", 0x4000, 0x4000, CRC(1fe05cff) SHA1(d11c308aac6788233a48abe23b0278dc54254d13) ) /* hand written label P_1 87B4 */ + ROM_LOAD( "p_2_aaaa.52", 0x8000, 0x4000, CRC(de4a14f0) SHA1(50b23289e00753b421a3373e0a9350124b75af9e) ) /* hand written label P_2 AAAA */ + ROM_LOAD( "p_3_0341.50", 0xc000, 0x4000, CRC(b4b2b4f1) SHA1(5f01c013984958c689d09f1c85068379ffb3eb45) ) /* hand written label P_3 0341 */ + + ROM_REGION( 0x10000, "audiocpu", 0 ) //SOUND + ROM_LOAD( "s1_3d02.5", 0x0000, 0x2000, CRC(7ce290db) SHA1(e3c72ba5d97cb07f0f72d2765a068af6fb5cca29) ) /* hand written label S1 3D02 == a62_13.5 */ + ROM_LOAD( "s2_213d.4", 0x2000, 0x2000, CRC(ea74b1a2) SHA1(7be3b9e9d51cfa753ce97e92f7eebd9723fe5821) ) /* hand written label S2 213D == a62_14.4 */ + + ROM_REGION( 0x20000, "gfx1", 0 ) //CHR + ROM_LOAD( "ic-78_3441.78", 0x00000, 0x4000, CRC(c5834a7a) SHA1(4a24b3fa707cde89ad5a52d4e994412fcf28e81f) ) /* hand written label IC-78 3441 == a62_12.78 */ + ROM_LOAD( "ic-77_a097.77", 0x04000, 0x4000, CRC(3ae7231e) SHA1(277f12570001d82104c79d3d0a58a0b57ed18778) ) /* hand written label IC-77 A097 == a62_10.77 */ + ROM_LOAD( "ic-80_7f98.80", 0x08000, 0x4000, CRC(b9210dbe) SHA1(f72f2307e9acd2dd622a3efce71bd334b68a9b60) ) /* hand written label IC-80 7F98 == a62_08.80 */ + ROM_LOAD( "ic-79_9383.79", 0x0c000, 0x4000, CRC(600be9ca) SHA1(a705b10be37ee93908b1bbaf806cfe7955aa3ffc) ) /* hand written label IC-79 9383 == a62_06.79 */ + ROM_LOAD( "ic-89_ef2b.89", 0x10000, 0x4000, CRC(d0e9974e) SHA1(6826cfb4fbf098ed7b9d8b00e2684d7c85a13c11) ) /* hand written label IC-89 EF2B == a62_11.89 */ + ROM_LOAD( "ic-88_a03d.88", 0x14000, 0x4000, CRC(e93ef281) SHA1(8bfe1ecce1c7107a5bd1b43b531594c8cfc0719d) ) /* hand written label IC-88 A03D == a62_09.88 */ + ROM_LOAD( "ic-91_8b4c.91", 0x18000, 0x4000, CRC(64c95e8b) SHA1(4c3320a764b13a5751c0019c9fafb899ea2f908f) ) /* hand written label IC-91 8B4C == a62_07.91 */ + ROM_LOAD( "ic-90_057c.90", 0x1c000, 0x4000, CRC(c3c877ef) SHA1(23180b106e50b7a2a230c5e9948832e5631972ae) ) /* hand written label IC-90 057C == a62_05.90 */ + + ROM_REGION( 0x0060, "proms", 0 ) //COLOR (all identical!) + ROM_LOAD( "a26-13.109", 0x0000, 0x0020, CRC(ec449aee) SHA1(aa33e82b592276d5ffd540d9a73d1b48d7d4accf) ) + ROM_LOAD( "a26-13.110", 0x0020, 0x0020, CRC(ec449aee) SHA1(aa33e82b592276d5ffd540d9a73d1b48d7d4accf) ) + ROM_LOAD( "a26-13.111", 0x0040, 0x0020, CRC(ec449aee) SHA1(aa33e82b592276d5ffd540d9a73d1b48d7d4accf) ) +ROM_END + + +ROM_START( halleysc87 ) ROM_REGION( 0x10000, "maincpu", 0 ) //MAIN PRG ROM_LOAD( "a62-17.30", 0x0000, 0x4000, CRC(fa2a58a6) SHA1(42cb587aad166ff74ece987f275aa7ad16d58300) ) ROM_LOAD( "a62-18.31", 0x4000, 0x4000, CRC(f3a078e6) SHA1(f8fa548b5814276d1ae2d575b9a5d3f0cc2f54fa) ) @@ -2215,12 +2244,26 @@ void halleys_state::init_benberob() void halleys_state::init_halleys() { +/* +LDA $66 96 66 +BNE +0E 26 0E <-- Intercept here +ANDCC #$EF 1C EF +*/ + m_game_id = GAME_HALLEYS; m_collision_detection = 0xb114; init_common(); } +void halleys_state::init_halleysp() +{ + m_game_id = GAME_HALLEYS; + m_collision_detection = 0xb038; + + init_common(); +} + void halleys_state::init_halley87() { m_game_id = GAME_HALLEYS; @@ -2233,8 +2276,9 @@ void halleys_state::init_halley87() //************************************************************************** // Game Definitions -GAME( 1984, benberob, 0, benberob, benberob, halleys_state, init_benberob, ROT0, "Taito", "Ben Bero Beh (Japan)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_COLORS | MACHINE_NO_COCKTAIL ) -GAME( 1986, halleys, 0, halleys, halleys, halleys_state, init_halleys, ROT90, "Taito America Corporation (Coin-It license)", "Halley's Comet (US)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_COCKTAIL ) -GAME( 1986, halleysc, halleys, halleys, halleys, halleys_state, init_halleys, ROT90, "Taito Corporation", "Halley's Comet (Japan, Newer)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_COCKTAIL ) -GAME( 1986, halleycj, halleys, halleys, halleys, halleys_state, init_halleys, ROT90, "Taito Corporation", "Halley's Comet (Japan, Older)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_COCKTAIL ) -GAME( 1986, halley87, halleys, halleys, halleys, halleys_state, init_halley87, ROT90, "Taito Corporation", "Halley's Comet '87", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_COCKTAIL ) +GAME( 1984, benberob, 0, benberob, benberob, halleys_state, init_benberob, ROT0, "Taito", "Ben Bero Beh (Japan)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_COLORS | MACHINE_NO_COCKTAIL ) +GAME( 1986, halleysc, 0, halleys, halleys, halleys_state, init_halleys, ROT90, "Taito America Corporation (Coin-It license)", "Halley's Comet (US)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_COCKTAIL ) +GAME( 1986, halleyscj, halleysc, halleys, halleys, halleys_state, init_halleys, ROT90, "Taito Corporation", "Halley's Comet (Japan, rev 1)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_COCKTAIL ) +GAME( 1986, halleyscja, halleysc, halleys, halleys, halleys_state, init_halleys, ROT90, "Taito Corporation", "Halley's Comet (Japan)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_COCKTAIL ) +GAME( 1985, halleyscjp, halleysc, halleys, halleys, halleys_state, init_halleysp, ROT90, "Taito Corporation", "Halley's Comet (Japan, prototype)", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_COCKTAIL ) +GAME( 1986, halleysc87, halleysc, halleys, halleys, halleys_state, init_halley87, ROT90, "Taito Corporation", "Halley's Comet '87", MACHINE_IMPERFECT_GRAPHICS | MACHINE_NO_COCKTAIL ) diff --git a/src/mame/mame.lst b/src/mame/mame.lst index ba652a2d2bb..23183dd9d2a 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -14697,10 +14697,11 @@ h89 // @source:halleys.cpp benberob // A26 -halley87 // A62 (c) 1986 Taito Corporation (Japan) -halleycj // A62 (c) 1986 Taito Corporation (Japan) -halleys // A62 (c) 1986 Taito America Corporation + Coin It (US) -halleysc // A62 (c) 1986 Taito Corporation (Japan) +halleysc // A62 (c) 1986 Taito America Corporation + Coin It (US) +halleysc87 // A62 (c) 1986 Taito Corporation (Japan) +halleyscj // A62 (c) 1986 Taito Corporation (Japan, rev 1) +halleyscja // A62 (c) 1986 Taito Corporation (Japan) +halleyscjp // A62 (c) 1985 Taito Corporation (Japan, prototype) @source:hanaawas.cpp hanaawas // (c) SetaKikaku -- cgit v1.2.3 From ce848a8df912674ec72f741051125ded48d628a0 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Thu, 26 Jul 2018 22:38:55 +0200 Subject: dynax.cpp: minor note about possible Inca manufacturer (nw) --- src/mame/drivers/dynax.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/drivers/dynax.cpp b/src/mame/drivers/dynax.cpp index 3f3f114be4e..7e28094ec1f 100644 --- a/src/mame/drivers/dynax.cpp +++ b/src/mame/drivers/dynax.cpp @@ -7371,7 +7371,7 @@ GAME( 1994, maya, 0, sprtmtch, drgpunch, dynax_state, init_maya, GAME( 1994, mayaa, maya, sprtmtch, drgpunch, dynax_state, init_maya, ROT0, "Promat", "Maya (set 2)", MACHINE_SUPPORTS_SAVE ) // this set has backgrounds blacked out in attract GAME( 1994, mayab, maya, sprtmtch, drgpunch, dynax_state, init_maya, ROT0, "Promat", "Maya (set 3)", MACHINE_SUPPORTS_SAVE ) GAME( 1994, mayac, maya, sprtmtch, drgpunch, dynax_state, init_mayac, ROT0, "Promat", "Maya (set 4, clean)", MACHINE_SUPPORTS_SAVE ) -GAME( 199?, inca, 0, sprtmtch, drgpunch, dynax_state, init_maya, ROT0, "", "Inca", MACHINE_SUPPORTS_SAVE ) +GAME( 199?, inca, 0, sprtmtch, drgpunch, dynax_state, init_maya, ROT0, "", "Inca", MACHINE_SUPPORTS_SAVE ) // PCB by "Barko", game too? GAME( 199?, blktouch, 0, sprtmtch, drgpunch, dynax_state, init_blktouch, ROT0, "Yang Gi Co Ltd.", "Black Touch (Korea)", MACHINE_SUPPORTS_SAVE ) GAME( 1989, mjfriday, 0, mjfriday, mjfriday, dynax_state, empty_init, ROT180, "Dynax", "Mahjong Friday (Japan)", MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3 From a1c3a96a83bc704311f7ee6af051911feb53d946 Mon Sep 17 00:00:00 2001 From: AJR Date: Thu, 26 Jul 2018 22:12:55 -0400 Subject: Mask address expressions in debug disasm view --- src/emu/debug/dvdisasm.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/emu/debug/dvdisasm.cpp b/src/emu/debug/dvdisasm.cpp index b10df8c618f..fecb02d4998 100644 --- a/src/emu/debug/dvdisasm.cpp +++ b/src/emu/debug/dvdisasm.cpp @@ -311,7 +311,8 @@ void debug_view_disasm::generate_dasm(debug_disasm_buffer &buffer, offs_t pc) m_topleft.x = 0; m_topleft.y = 0; } - generate_from_address(buffer, m_expression.value()); + const debug_view_disasm_source &source = downcast(*m_source); + generate_from_address(buffer, m_expression.value() & source.m_space.logaddrmask()); return; } -- cgit v1.2.3 From ecc30334a5aeec500f305c62cc4c01c8d99ec4ca Mon Sep 17 00:00:00 2001 From: Justin Kerk Date: Thu, 26 Jul 2018 22:32:54 -0700 Subject: New working software list additions ----------------------------------- ibm5150: Math Blaster, Writer Rabbit [darksabre76] ibm5170: The All In One Boot Floppy 1.0, The All In One Boot Floppy 0.9, The All In One Boot Floppy 0.9 (Lite Version), The All In One Boot Floppy 0.9 (FreeDOS only) [Justin Kerk] --- hash/ibm5150.xml | 31 +++++++++++++++++++++++++++++++ hash/ibm5170.xml | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) diff --git a/hash/ibm5150.xml b/hash/ibm5150.xml index 641dd785e15..d42e3c7567e 100644 --- a/hash/ibm5150.xml +++ b/hash/ibm5150.xml @@ -8903,6 +8903,25 @@ has been replaced with an all-zero block. --> + + Math Blaster + 1983 + Davidson & Associates + + + + + + + + + + + + + + + Mean Streets 1989 @@ -10601,6 +10620,18 @@ has been replaced with an all-zero block. --> + + Writer Rabbit + 1988 + The Learning Company + + + + + + + + Xenon 1988 diff --git a/hash/ibm5170.xml b/hash/ibm5170.xml index 5390872eee4..2d84e374483 100644 --- a/hash/ibm5170.xml +++ b/hash/ibm5170.xml @@ -57,6 +57,54 @@ + + The All In One Boot Floppy 1.0 + 2008 + Michael Schierl + + + + + + + + + + The All In One Boot Floppy 0.9 + 2006 + Michael Schierl + + + + + + + + + + The All In One Boot Floppy 0.9 (Lite Version) + 2006 + Michael Schierl + + + + + + + + + + The All In One Boot Floppy 0.9 (FreeDOS only) + 2006 + Michael Schierl + + + + + + + + Brutalware Linux 1.1 1999 -- cgit v1.2.3 From da224d90a01b2717826d0806f3892ab3b831b074 Mon Sep 17 00:00:00 2001 From: Robbbert Date: Fri, 27 Jul 2018 15:43:34 +1000 Subject: (nw) goupil : tidied up rom loading, added cursor --- src/mame/drivers/goupil.cpp | 45 ++++++++++++++++++--------------------------- 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/src/mame/drivers/goupil.cpp b/src/mame/drivers/goupil.cpp index 6e754618e6c..58f1fcf2f50 100644 --- a/src/mame/drivers/goupil.cpp +++ b/src/mame/drivers/goupil.cpp @@ -496,7 +496,7 @@ MC6845_UPDATE_ROW(goupil_g2_state::crtc_update_row) { uint16_t const offset = ( 0x400 + ( ma + x ) ) & 0x7FF; uint8_t const chr = m_visu24x80_ram->pointer()[offset]; - uint8_t const gfx = m_visu24x80_rom[ ( ( chr & 0x7F ) << 4 ) + ra ]; + uint8_t const gfx = m_visu24x80_rom[ ( ( chr & 0x7F ) << 4 ) + ra ] ^ ((x == cursor_x) ? 0xff : 0); for (unsigned bit = 0; 8 > bit; ++bit) { @@ -647,23 +647,18 @@ MACHINE_CONFIG_END /* ROM definition */ ROM_START( goupilg1 ) ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_DEFAULT_BIOS("v1_0") - - ROM_SYSTEM_BIOS(0, "v1_0", "Version 1.0") - ROMX_LOAD( "smt_goupil_g1_mon_1.bin", 0xF800, 0x0400, CRC(98b7be69) SHA1(69e83fe78a43fcf2b08fb0bcefb0d217a57b1ecb), ROM_BIOS(0) ) - ROM_LOAD ( "smt_goupil_g1_mon_2.bin", 0xFC00, 0x0400, CRC(19386b81) SHA1(e52f63fd29d374319781e9677de6d3fd61a3684c) ) - - ROM_LOAD ( "smt_goupil_g1_mod_3.bin", 0xF400, 0x0400, CRC(e662f152) SHA1(11b91c5737e7572a2c18472b66bbd16b485132d5) ) - - ROMX_LOAD( "smt_goupil_g1_basic_1.bin", 0xC000, 0x0400, CRC(ad105b12) SHA1(631cd4b997f76b57bf2509e4bff30b1595c8bd13), ROM_BIOS(0) ) - ROMX_LOAD( "smt_goupil_g1_basic_2.bin", 0xC400, 0x0400, CRC(0c5c309c) SHA1(f1cab4b0f9191e53113790a95f1ab7108f9406a1), ROM_BIOS(0) ) - ROMX_LOAD( "smt_goupil_g1_basic_3.bin", 0xC800, 0x0400, CRC(1f1eb127) SHA1(dbbb880c79d515acbfcb2be9a4c96962f3e4edea), ROM_BIOS(0) ) - ROMX_LOAD( "smt_goupil_g1_basic_4.bin", 0xCC00, 0x0400, CRC(09be48e4) SHA1(86cae0d159583c1d572a5754f3bb6b4a2e479359), ROM_BIOS(0) ) - ROMX_LOAD( "smt_goupil_g1_basic_5.bin", 0xD000, 0x0400, CRC(bdeb395c) SHA1(32a50468f1ca772ee45a1f5c61c66f3ecc774074), ROM_BIOS(0) ) - ROMX_LOAD( "smt_goupil_g1_basic_6.bin", 0xD400, 0x0400, CRC(850a4000) SHA1(720f0bb3e45877835219b7e1d943ef4f19b9977d), ROM_BIOS(0) ) - ROMX_LOAD( "smt_goupil_g1_basic_7.bin", 0xD800, 0x0400, CRC(586c7670) SHA1(13e2e96b9f1a53555ce0d55f657cf3c6b96f10a0), ROM_BIOS(0) ) - ROMX_LOAD( "smt_goupil_g1_basic_8.bin", 0xDC00, 0x0400, CRC(33281300) SHA1(ce631fa8157a3f8869c5fefe24b7f40e06696df9), ROM_BIOS(0) ) - ROMX_LOAD( "smt_goupil_g1_basic_9.bin", 0xE000, 0x0400, CRC(a3911201) SHA1(8623a0a2d83eb3a27a795030643c5c05a4350a9f), ROM_BIOS(0) ) + ROM_LOAD( "smt_goupil_g1_basic_1.bin", 0xC000, 0x0400, CRC(ad105b12) SHA1(631cd4b997f76b57bf2509e4bff30b1595c8bd13) ) + ROM_LOAD( "smt_goupil_g1_basic_2.bin", 0xC400, 0x0400, CRC(0c5c309c) SHA1(f1cab4b0f9191e53113790a95f1ab7108f9406a1) ) + ROM_LOAD( "smt_goupil_g1_basic_3.bin", 0xC800, 0x0400, CRC(1f1eb127) SHA1(dbbb880c79d515acbfcb2be9a4c96962f3e4edea) ) + ROM_LOAD( "smt_goupil_g1_basic_4.bin", 0xCC00, 0x0400, CRC(09be48e4) SHA1(86cae0d159583c1d572a5754f3bb6b4a2e479359) ) + ROM_LOAD( "smt_goupil_g1_basic_5.bin", 0xD000, 0x0400, CRC(bdeb395c) SHA1(32a50468f1ca772ee45a1f5c61c66f3ecc774074) ) + ROM_LOAD( "smt_goupil_g1_basic_6.bin", 0xD400, 0x0400, CRC(850a4000) SHA1(720f0bb3e45877835219b7e1d943ef4f19b9977d) ) + ROM_LOAD( "smt_goupil_g1_basic_7.bin", 0xD800, 0x0400, CRC(586c7670) SHA1(13e2e96b9f1a53555ce0d55f657cf3c6b96f10a0) ) + ROM_LOAD( "smt_goupil_g1_basic_8.bin", 0xDC00, 0x0400, CRC(33281300) SHA1(ce631fa8157a3f8869c5fefe24b7f40e06696df9) ) + ROM_LOAD( "smt_goupil_g1_basic_9.bin", 0xE000, 0x0400, CRC(a3911201) SHA1(8623a0a2d83eb3a27a795030643c5c05a4350a9f) ) + ROM_LOAD( "smt_goupil_g1_mod_3.bin", 0xF400, 0x0400, CRC(e662f152) SHA1(11b91c5737e7572a2c18472b66bbd16b485132d5) ) + ROM_LOAD( "smt_goupil_g1_mon_1.bin", 0xF800, 0x0400, CRC(98b7be69) SHA1(69e83fe78a43fcf2b08fb0bcefb0d217a57b1ecb) ) + ROM_LOAD( "smt_goupil_g1_mon_2.bin", 0xFC00, 0x0400, CRC(19386b81) SHA1(e52f63fd29d374319781e9677de6d3fd61a3684c) ) ROM_REGION( 0x400, "ef9364", 0 ) ROM_LOAD( "smt_goupil_g1_charset.bin", 0x0000, 0x0400, CRC(8b6da54b) SHA1(ac2204600f45c6dd0df1e759b62ed25928f02a12) ) @@ -672,17 +667,13 @@ ROM_END /* ROM definition */ ROM_START( goupilg2 ) ROM_REGION( 0x10000, "maincpu", 0 ) - ROM_DEFAULT_BIOS("v1_4") - - ROM_SYSTEM_BIOS(0, "v1_4", "Version 1.4") - ROMX_LOAD( "smt_goupil_g2_mon_1.bin", 0xF000, 0x0800, CRC(91a4f256) SHA1(ece3b47a17e47fc87e2262be806ce8015f5f5db6), ROM_BIOS(0) ) - ROM_LOAD ( "smt_goupil_g2_mon_2.bin", 0xF800, 0x0800, CRC(f7783a32) SHA1(7368fc0bd86b48e6727367bd7d1922f219741015) ) - - ROM_LOAD ( "smt_goupil_g2_mod_1.bin", 0xC000, 0x0400, CRC(4d585e40) SHA1(7558f89db52299c4c305755259d5c908b3f66ac7) ) - ROM_LOAD ( "smt_goupil_g2_mod_2.bin", 0xC400, 0x0400, CRC(c5531667) SHA1(24b0a1d3b812b95e68f4dc4323581b1fd14eb4fb) ) + ROM_LOAD( "smt_goupil_g2_mod_1.bin", 0xC000, 0x0400, CRC(4d585e40) SHA1(7558f89db52299c4c305755259d5c908b3f66ac7) ) + ROM_LOAD( "smt_goupil_g2_mod_2.bin", 0xC400, 0x0400, CRC(c5531667) SHA1(24b0a1d3b812b95e68f4dc4323581b1fd14eb4fb) ) + ROM_LOAD( "smt_goupil_g2_mon_1.bin", 0xF000, 0x0800, CRC(91a4f256) SHA1(ece3b47a17e47fc87e2262be806ce8015f5f5db6) ) + ROM_LOAD( "smt_goupil_g2_mon_2.bin", 0xF800, 0x0800, CRC(f7783a32) SHA1(7368fc0bd86b48e6727367bd7d1922f219741015) ) ROM_REGION( 0x400, "ef9364", 0 ) - ROM_LOAD ( "smt_goupil_g2_charset.bin", 0x0000, 0x0400, CRC(d3930877) SHA1(7b790fb18f8893cfc753bf622c8b795075741d22) ) + ROM_LOAD( "smt_goupil_g2_charset.bin", 0x0000, 0x0400, CRC(d3930877) SHA1(7b790fb18f8893cfc753bf622c8b795075741d22) ) ROM_REGION( 0x800, "visu_24x80", 0 ) ROM_LOAD( "smt_goupil_g2_charset_24x80.bin", 0x0000, 0x0800, CRC(f0f83b99) SHA1(75a7730aec30280ee4ccf3dcaf587eea4f861196) ) -- cgit v1.2.3 From dbb034ad61477d9072c42ed83c8547d925085beb Mon Sep 17 00:00:00 2001 From: smf- Date: Fri, 27 Jul 2018 09:47:55 +0100 Subject: PSX CPU: hookup debugger_exception_hook & debugger_interrupt_hook [smf] --- src/devices/cpu/psx/psx.cpp | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/src/devices/cpu/psx/psx.cpp b/src/devices/cpu/psx/psx.cpp index f74d998fed4..a8366bdea91 100644 --- a/src/devices/cpu/psx/psx.cpp +++ b/src/devices/cpu/psx/psx.cpp @@ -137,6 +137,10 @@ #define CAUSE_EXC ( 31L << 2 ) #define CAUSE_IP ( 255L << 8 ) +// software interrupts +#define CAUSE_IP0 ( 1L << 8 ) +#define CAUSE_IP1 ( 1L << 9 ) +// hardware interrupts #define CAUSE_IP2 ( 1L << 10 ) #define CAUSE_IP3 ( 1L << 11 ) #define CAUSE_IP4 ( 1L << 12 ) @@ -1436,21 +1440,32 @@ void psxcpu_device::update_rom_config() } } -void psxcpu_device::update_cop0( int reg ) +void psxcpu_device::update_cop0(int reg) { - if( reg == CP0_SR ) + if (reg == CP0_SR) { update_memory_handlers(); update_address_masks(); } - if( ( reg == CP0_SR || reg == CP0_CAUSE ) && - ( m_cp0r[ CP0_SR ] & SR_IEC ) != 0 && - ( m_cp0r[ CP0_SR ] & m_cp0r[ CP0_CAUSE ] & CAUSE_IP ) != 0 ) + if ((reg == CP0_SR || reg == CP0_CAUSE) && + (m_cp0r[CP0_SR] & SR_IEC) != 0) { - m_op = m_cache->read_dword( m_pc ); - execute_unstoppable_instructions( 1 ); - exception( EXC_INT ); + uint32_t ip = m_cp0r[CP0_SR] & m_cp0r[CP0_CAUSE] & CAUSE_IP; + if (ip != 0) + { + if (ip & CAUSE_IP0) debugger_exception_hook(EXC_INT); + if (ip & CAUSE_IP1) debugger_exception_hook(EXC_INT); + if (ip & CAUSE_IP2) debugger_interrupt_hook(PSXCPU_IRQ0); + if (ip & CAUSE_IP3) debugger_interrupt_hook(PSXCPU_IRQ1); + if (ip & CAUSE_IP4) debugger_interrupt_hook(PSXCPU_IRQ2); + if (ip & CAUSE_IP5) debugger_interrupt_hook(PSXCPU_IRQ3); + if (ip & CAUSE_IP6) debugger_interrupt_hook(PSXCPU_IRQ4); + if (ip & CAUSE_IP7) debugger_interrupt_hook(PSXCPU_IRQ5); + m_op = m_cache->read_dword(m_pc); + execute_unstoppable_instructions(1); + exception(EXC_INT); + } } } @@ -1588,9 +1603,12 @@ void psxcpu_device::common_exception( int exception, uint32_t romOffset, uint32_ m_cp0r[ CP0_EPC ] = m_pc; } - if( LOG_BIOSCALL && exception != EXC_INT ) + if (exception != EXC_INT) { - logerror( "%08x: Exception %d\n", m_pc, exception ); + if (LOG_BIOSCALL) + logerror("%08x: Exception %d\n", m_pc, exception); + + debugger_exception_hook(exception); } m_delayr = 0; -- cgit v1.2.3 From 29686200984dc74633183583e7391c6fa913b070 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sat, 28 Jul 2018 02:27:53 +1000 Subject: make rectangle work better with constexpr, change many things to use designated getters/setters (nw) --- makefile | 4 +- src/devices/video/poly.h | 58 +++--- src/devices/video/stvvdp2.cpp | 176 ++++++++-------- src/devices/video/upd7220.cpp | 13 +- src/devices/video/vic4567.cpp | 12 +- src/emu/drawgfx.cpp | 6 +- src/emu/drawgfxm.h | 100 ++++----- src/emu/render.cpp | 2 +- src/emu/rendfont.cpp | 7 +- src/emu/rendlay.cpp | 68 +++---- src/emu/screen.cpp | 89 ++++---- src/emu/screen.h | 4 +- src/emu/tilemap.cpp | 50 +++-- src/lib/util/bitmap.cpp | 60 +++--- src/lib/util/bitmap.h | 50 ++--- src/mame/drivers/accomm.cpp | 6 +- src/mame/drivers/alg.cpp | 4 +- src/mame/drivers/apple1.cpp | 4 +- src/mame/drivers/astrof.cpp | 2 +- src/mame/drivers/atarisy4.cpp | 6 +- src/mame/drivers/bfcobra.cpp | 4 +- src/mame/drivers/bmcpokr.cpp | 5 +- src/mame/drivers/c65.cpp | 4 +- src/mame/drivers/casloopy.cpp | 2 +- src/mame/drivers/cps3.cpp | 29 ++- src/mame/drivers/ddenlovr.cpp | 4 +- src/mame/drivers/dooyong.cpp | 6 +- src/mame/drivers/firefox.cpp | 4 +- src/mame/drivers/fp200.cpp | 8 +- src/mame/drivers/missile.cpp | 14 +- src/mame/drivers/popobear.cpp | 4 +- src/mame/drivers/riscpc.cpp | 9 +- src/mame/drivers/sbrkout.cpp | 4 +- src/mame/includes/realbrk.h | 10 +- src/mame/machine/amiga.cpp | 2 +- src/mame/machine/archimds.cpp | 14 +- src/mame/machine/deco_irq.cpp | 4 +- src/mame/machine/electron.cpp | 4 +- src/mame/video/agat7.cpp | 20 +- src/mame/video/amiga.cpp | 10 +- src/mame/video/amigaaga.cpp | 10 +- src/mame/video/apple2.cpp | 64 +++--- src/mame/video/apple3.cpp | 16 +- src/mame/video/aquarium.cpp | 4 +- src/mame/video/arcadecl.cpp | 8 +- src/mame/video/atarig42.cpp | 8 +- src/mame/video/atarigt.cpp | 6 +- src/mame/video/atarigx2.cpp | 8 +- src/mame/video/atarimo.cpp | 18 +- src/mame/video/atarirle.cpp | 95 +++++---- src/mame/video/atarisy1.cpp | 6 +- src/mame/video/atarisy2.cpp | 4 +- src/mame/video/atarivad.cpp | 40 ++-- src/mame/video/badlands.cpp | 4 +- src/mame/video/batman.cpp | 8 +- src/mame/video/beathead.cpp | 10 +- src/mame/video/blstroid.cpp | 4 +- src/mame/video/boogwing.cpp | 4 +- src/mame/video/ccastles.cpp | 6 +- src/mame/video/cinemat.cpp | 8 +- src/mame/video/cloak.cpp | 4 +- src/mame/video/cloud9.cpp | 6 +- src/mame/video/copsnrob.cpp | 2 +- src/mame/video/cvs.cpp | 6 +- src/mame/video/cyberbal.cpp | 4 +- src/mame/video/cybstorm.cpp | 8 +- src/mame/video/dassault.cpp | 4 +- src/mame/video/decbac06.cpp | 38 ++-- src/mame/video/deco16ic.cpp | 4 +- src/mame/video/deco32.cpp | 4 +- src/mame/video/deco_mlc.cpp | 19 +- src/mame/video/deco_zoomspr.cpp | 20 +- src/mame/video/decocass.cpp | 18 +- src/mame/video/decospr.cpp | 28 +-- src/mame/video/dragrace.cpp | 3 +- src/mame/video/dynax.cpp | 4 +- src/mame/video/electron.cpp | 6 +- src/mame/video/eprom.cpp | 16 +- src/mame/video/equites.cpp | 6 +- src/mame/video/exidy440.cpp | 12 +- src/mame/video/fantland.cpp | 2 +- src/mame/video/firetrk.cpp | 10 +- src/mame/video/galaxia.cpp | 10 +- src/mame/video/galspnbl.cpp | 4 +- src/mame/video/gamate.cpp | 4 +- src/mame/video/gauntlet.cpp | 4 +- src/mame/video/harddriv.cpp | 4 +- src/mame/video/irobot.cpp | 2 +- src/mame/video/jaguar.cpp | 8 +- src/mame/video/jedi.cpp | 10 +- src/mame/video/klax.cpp | 4 +- src/mame/video/leland.cpp | 4 +- src/mame/video/lemmings.cpp | 14 +- src/mame/video/mac.cpp | 31 +-- src/mame/video/madalien.cpp | 15 +- src/mame/video/mermaid.cpp | 28 +-- src/mame/video/namcos21.cpp | 12 +- src/mame/video/namcos22.cpp | 59 +++--- src/mame/video/offtwall.cpp | 4 +- src/mame/video/quasar.cpp | 4 +- src/mame/video/rampart.cpp | 8 +- src/mame/video/realbrk.cpp | 435 ++++++++++++++++------------------------ src/mame/video/relief.cpp | 4 +- src/mame/video/rohga.cpp | 8 +- src/mame/video/shuuz.cpp | 4 +- src/mame/video/skullxbo.cpp | 6 +- src/mame/video/sprint2.cpp | 16 +- src/mame/video/sprint4.cpp | 16 +- src/mame/video/tank8.cpp | 4 +- src/mame/video/thunderj.cpp | 8 +- 110 files changed, 1010 insertions(+), 1157 deletions(-) diff --git a/makefile b/makefile index 89788aed12c..6c9664138f0 100644 --- a/makefile +++ b/makefile @@ -912,12 +912,12 @@ endif ifeq ($(OS),windows) ifeq (posix,$(SHELLTYPE)) GCC_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) -dumpversion 2> /dev/null) -CLANG_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) --version 2> /dev/null| head -n 1 | grep clang | sed "s/^.*[^0-9]\([0-9]\+\.[0-9]\+\.[0-9]\+\).*$$/\1/" | head -n 1) +CLANG_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) --version 2> /dev/null| head -n 1 | grep clang | sed "s/^.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$$/\1/" | head -n 1) PYTHON_AVAILABLE := $(shell $(PYTHON) --version > /dev/null 2>&1 && echo python) GIT_AVAILABLE := $(shell git --version > /dev/null 2>&1 && echo git) else GCC_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) -dumpversion 2> NUL) -CLANG_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) --version 2> NUL| head -n 1 | grep clang | sed "s/^.*[^0-9]\([0-9]\+\.[0-9]\+\.[0-9]\+\).*$$/\1/" | head -n 1) +CLANG_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) --version 2> NUL| head -n 1 | grep clang | sed "s/^.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$$/\1/" | head -n 1) PYTHON_AVAILABLE := $(shell $(PYTHON) --version > NUL 2>&1 && echo python) GIT_AVAILABLE := $(shell git --version > NUL 2>&1 && echo git) endif diff --git a/src/devices/video/poly.h b/src/devices/video/poly.h index 3f1053e65c6..cda1c46dc3b 100644 --- a/src/devices/video/poly.h +++ b/src/devices/video/poly.h @@ -513,8 +513,8 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_til // clip coordinates int32_t v1yclip = v1y; int32_t v2yclip = v2y + ((m_flags & FLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0); - v1yclip = std::max(v1yclip, cliprect.min_y); - v2yclip = std::min(v2yclip, cliprect.max_y + 1); + v1yclip = std::max(v1yclip, cliprect.top()); + v2yclip = std::min(v2yclip, cliprect.bottom() + 1); if (v2yclip - v1yclip <= 0) return 0; @@ -558,10 +558,10 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_til istopx++; // apply left/right clipping - if (istartx < cliprect.min_x) - istartx = cliprect.min_x; - if (istopx > cliprect.max_x) - istopx = cliprect.max_x + 1; + if (istartx < cliprect.left()) + istartx = cliprect.left(); + if (istopx > cliprect.right()) + istopx = cliprect.right() + 1; if (istartx >= istopx) return 0; @@ -658,8 +658,8 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_tri // clip coordinates int32_t v1yclip = v1y; int32_t v3yclip = v3y + ((m_flags & FLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0); - v1yclip = std::max(v1yclip, cliprect.min_y); - v3yclip = std::min(v3yclip, cliprect.max_y + 1); + v1yclip = std::max(v1yclip, cliprect.top()); + v3yclip = std::min(v3yclip, cliprect.bottom() + 1); if (v3yclip - v1yclip <= 0) return 0; @@ -772,10 +772,10 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_tri istopx++; // apply left/right clipping - if (istartx < cliprect.min_x) - istartx = cliprect.min_x; - if (istopx > cliprect.max_x) - istopx = cliprect.max_x + 1; + if (istartx < cliprect.left()) + istartx = cliprect.left(); + if (istopx > cliprect.right()) + istopx = cliprect.right() + 1; // set the extent and update the total pixel count if (istartx >= istopx) @@ -848,8 +848,8 @@ template uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_triangle_custom(const rectangle &cliprect, render_delegate callback, int startscanline, int numscanlines, const extent_t *extents) { // clip coordinates - int32_t v1yclip = std::max(startscanline, cliprect.min_y); - int32_t v3yclip = std::min(startscanline + numscanlines, cliprect.max_y + 1); + int32_t v1yclip = std::max(startscanline, cliprect.top()); + int32_t v3yclip = std::min(startscanline + numscanlines, cliprect.bottom() + 1); if (v3yclip - v1yclip <= 0) return 0; @@ -883,14 +883,14 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_tri int32_t istartx = srcextent.startx, istopx = srcextent.stopx; // apply left/right clipping - if (istartx < cliprect.min_x) - istartx = cliprect.min_x; - if (istartx > cliprect.max_x) - istartx = cliprect.max_x + 1; - if (istopx < cliprect.min_x) - istopx = cliprect.min_x; - if (istopx > cliprect.max_x) - istopx = cliprect.max_x + 1; + if (istartx < cliprect.left()) + istartx = cliprect.left(); + if (istartx > cliprect.right()) + istartx = cliprect.right() + 1; + if (istopx < cliprect.left()) + istopx = cliprect.left(); + if (istopx > cliprect.right()) + istopx = cliprect.right() + 1; // set the extent and update the total pixel count extent_t &extent = unit.extent[extnum]; @@ -956,8 +956,8 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_pol // clip coordinates int32_t minyclip = miny; int32_t maxyclip = maxy + ((m_flags & FLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0); - minyclip = std::max(minyclip, cliprect.min_y); - maxyclip = std::min(maxyclip, cliprect.max_y + 1); + minyclip = std::max(minyclip, cliprect.top()); + maxyclip = std::min(maxyclip, cliprect.bottom() + 1); if (maxyclip - minyclip <= 0) return 0; @@ -1092,14 +1092,14 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_pol istopx++; // apply left/right clipping - if (istartx < cliprect.min_x) + if (istartx < cliprect.left()) { for (int paramnum = 0; paramnum < paramcount; paramnum++) - extent.param[paramnum].start += (cliprect.min_x - istartx) * extent.param[paramnum].dpdx; - istartx = cliprect.min_x; + extent.param[paramnum].start += (cliprect.left() - istartx) * extent.param[paramnum].dpdx; + istartx = cliprect.left(); } - if (istopx > cliprect.max_x) - istopx = cliprect.max_x + 1; + if (istopx > cliprect.right()) + istopx = cliprect.right() + 1; // set the extent and update the total pixel count if (istartx >= istopx) diff --git a/src/devices/video/stvvdp2.cpp b/src/devices/video/stvvdp2.cpp index cc1da5b39d3..3c64fce6690 100644 --- a/src/devices/video/stvvdp2.cpp +++ b/src/devices/video/stvvdp2.cpp @@ -2502,27 +2502,27 @@ void saturn_state::stv_vdp2_drawgfxzoom( y_index = 0; } - if( sx < myclip.min_x) + if( sx < myclip.left()) { /* clip left */ - int pixels = myclip.min_x-sx; + int pixels = myclip.left()-sx; sx += pixels; x_index_base += pixels*dx; } - if( sy < myclip.min_y ) + if( sy < myclip.top() ) { /* clip top */ - int pixels = myclip.min_y-sy; + int pixels = myclip.top()-sy; sy += pixels; y_index += pixels*dy; } /* NS 980211 - fixed incorrect clipping */ - if( ex > myclip.max_x+1 ) + if( ex > myclip.right()+1 ) { /* clip right */ - int pixels = ex-myclip.max_x-1; + int pixels = ex-myclip.right()-1; ex -= pixels; } - if( ey > myclip.max_y+1 ) + if( ey > myclip.bottom()+1 ) { /* clip bottom */ - int pixels = ey-myclip.max_y-1; + int pixels = ey-myclip.bottom()-1; ey -= pixels; } @@ -2703,27 +2703,27 @@ void saturn_state::stv_vdp2_drawgfxzoom_rgb555( y_index = 0; } - if( sx < myclip.min_x) + if( sx < myclip.left()) { /* clip left */ - int pixels = myclip.min_x-sx; + int pixels = myclip.left()-sx; sx += pixels; x_index_base += pixels*dx; } - if( sy < myclip.min_y ) + if( sy < myclip.top() ) { /* clip top */ - int pixels = myclip.min_y-sy; + int pixels = myclip.top()-sy; sy += pixels; y_index += pixels*dy; } /* NS 980211 - fixed incorrect clipping */ - if( ex > myclip.max_x+1 ) + if( ex > myclip.right()+1 ) { /* clip right */ - int pixels = ex-myclip.max_x-1; + int pixels = ex-myclip.right()-1; ex -= pixels; } - if( ey > myclip.max_y+1 ) + if( ey > myclip.bottom()+1 ) { /* clip bottom */ - int pixels = ey-myclip.max_y-1; + int pixels = ey-myclip.bottom()-1; ey -= pixels; } @@ -2893,27 +2893,27 @@ void saturn_state::stv_vdp2_drawgfx_rgb555( bitmap_rgb32 &dest_bmp, const rectan y_index = 0; } - if( sx < myclip.min_x) + if( sx < myclip.left()) { /* clip left */ - int pixels = myclip.min_x-sx; + int pixels = myclip.left()-sx; sx += pixels; x_index_base += pixels*dx; } - if( sy < myclip.min_y ) + if( sy < myclip.top() ) { /* clip top */ - int pixels = myclip.min_y-sy; + int pixels = myclip.top()-sy; sy += pixels; y_index += pixels*dy; } /* NS 980211 - fixed incorrect clipping */ - if( ex > myclip.max_x+1 ) + if( ex > myclip.right()+1 ) { /* clip right */ - int pixels = ex-myclip.max_x-1; + int pixels = ex-myclip.right()-1; ex -= pixels; } - if( ey > myclip.max_y+1 ) + if( ey > myclip.bottom()+1 ) { /* clip bottom */ - int pixels = ey-myclip.max_y-1; + int pixels = ey-myclip.bottom()-1; ey -= pixels; } @@ -3006,27 +3006,27 @@ void saturn_state::stv_vdp2_drawgfx_rgb888( bitmap_rgb32 &dest_bmp, const rectan y_index = 0; } - if( sx < myclip.min_x) + if( sx < myclip.left()) { /* clip left */ - int pixels = myclip.min_x-sx; + int pixels = myclip.left()-sx; sx += pixels; x_index_base += pixels*dx; } - if( sy < myclip.min_y ) + if( sy < myclip.top() ) { /* clip top */ - int pixels = myclip.min_y-sy; + int pixels = myclip.top()-sy; sy += pixels; y_index += pixels*dy; } /* NS 980211 - fixed incorrect clipping */ - if( ex > myclip.max_x+1 ) + if( ex > myclip.right()+1 ) { /* clip right */ - int pixels = ex-myclip.max_x-1; + int pixels = ex-myclip.right()-1; ex -= pixels; } - if( ey > myclip.max_y+1 ) + if( ey > myclip.bottom()+1 ) { /* clip bottom */ - int pixels = ey-myclip.max_y-1; + int pixels = ey-myclip.bottom()-1; ey -= pixels; } @@ -3096,29 +3096,29 @@ void saturn_state::stv_vdp2_drawgfx_alpha(bitmap_rgb32 &dest_bmp,const rectangle ey = sy + gfx->height(); /* clip left */ - if (sx < clip.min_x) + if (sx < clip.left()) { - int pixels = clip.min_x-sx; + int pixels = clip.left()-sx; sx += pixels; x_index_base += xinc*pixels; } /* clip top */ - if (sy < clip.min_y) - { int pixels = clip.min_y-sy; + if (sy < clip.top()) + { int pixels = clip.top()-sy; sy += pixels; y_index += yinc*pixels; } /* clip right */ - if (ex > clip.max_x+1) + if (ex > clip.right()+1) { - ex = clip.max_x+1; + ex = clip.right()+1; } /* clip bottom */ - if (ey > clip.max_y+1) + if (ey > clip.bottom()+1) { - ey = clip.max_y+1; + ey = clip.bottom()+1; } /* skip if inner loop doesn't draw anything */ @@ -3173,29 +3173,29 @@ void saturn_state::stv_vdp2_drawgfx_transpen(bitmap_rgb32 &dest_bmp,const rectan ey = sy + gfx->height(); /* clip left */ - if (sx < clip.min_x) + if (sx < clip.left()) { - int pixels = clip.min_x-sx; + int pixels = clip.left()-sx; sx += pixels; x_index_base += xinc*pixels; } /* clip top */ - if (sy < clip.min_y) - { int pixels = clip.min_y-sy; + if (sy < clip.top()) + { int pixels = clip.top()-sy; sy += pixels; y_index += yinc*pixels; } /* clip right */ - if (ex > clip.max_x+1) + if (ex > clip.right()+1) { - ex = clip.max_x+1; + ex = clip.right()+1; } /* clip bottom */ - if (ey > clip.max_y+1) + if (ey > clip.bottom()+1) { - ey = clip.max_y+1; + ey = clip.bottom()+1; } /* skip if inner loop doesn't draw anything */ @@ -3251,9 +3251,9 @@ void saturn_state::draw_4bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &clipr if(stv2_current_tilemap.fade_control & 1) pal_bank += ((stv2_current_tilemap.fade_control & 2) ? (2*2048) : (2048)); - for(ydst=cliprect.min_y;ydst<=cliprect.max_y;ydst++) + for(ydst=cliprect.top();ydst<=cliprect.bottom();ydst++) { - for(xdst=cliprect.min_x;xdst<=cliprect.max_x;xdst++) + for(xdst=cliprect.left();xdst<=cliprect.right();xdst++) { if(!stv_vdp2_window_process(xdst,ydst)) continue; @@ -3308,9 +3308,9 @@ void saturn_state::draw_8bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &clipr if(stv2_current_tilemap.fade_control & 1) pal_bank += ((stv2_current_tilemap.fade_control & 2) ? (2*2048) : (2048)); - for(ydst=cliprect.min_y;ydst<=cliprect.max_y;ydst++) + for(ydst=cliprect.top();ydst<=cliprect.bottom();ydst++) { - for(xdst=cliprect.min_x;xdst<=cliprect.max_x;xdst++) + for(xdst=cliprect.left();xdst<=cliprect.right();xdst++) { if(!stv_vdp2_window_process(xdst,ydst)) continue; @@ -3364,9 +3364,9 @@ void saturn_state::draw_11bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &clip if(stv2_current_tilemap.fade_control & 1) pal_bank = ((stv2_current_tilemap.fade_control & 2) ? (2*2048) : (2048)); - for(ydst=cliprect.min_y;ydst<=cliprect.max_y;ydst++) + for(ydst=cliprect.top();ydst<=cliprect.bottom();ydst++) { - for(xdst=cliprect.min_x;xdst<=cliprect.max_x;xdst++) + for(xdst=cliprect.left();xdst<=cliprect.right();xdst++) { if(!stv_vdp2_window_process(xdst,ydst)) continue; @@ -3418,9 +3418,9 @@ void saturn_state::draw_rgb15_bitmap(bitmap_rgb32 &bitmap, const rectangle &clip xsize_mask = (stv2_current_tilemap.linescroll_enable) ? 1024 : xsize; ysize_mask = (stv2_current_tilemap.vertical_linescroll_enable) ? 512 : ysize; - for(ydst=cliprect.min_y;ydst<=cliprect.max_y;ydst++) + for(ydst=cliprect.top();ydst<=cliprect.bottom();ydst++) { - for(xdst=cliprect.min_x;xdst<=cliprect.max_x;xdst++) + for(xdst=cliprect.left();xdst<=cliprect.right();xdst++) { if(!stv_vdp2_window_process(xdst,ydst)) continue; @@ -3476,9 +3476,9 @@ void saturn_state::draw_rgb32_bitmap(bitmap_rgb32 &bitmap, const rectangle &clip xsize_mask = (stv2_current_tilemap.linescroll_enable) ? 1024 : xsize; ysize_mask = (stv2_current_tilemap.vertical_linescroll_enable) ? 512 : ysize; - for(ydst=cliprect.min_y;ydst<=cliprect.max_y;ydst++) + for(ydst=cliprect.top();ydst<=cliprect.bottom();ydst++) { - for(xdst=cliprect.min_x;xdst<=cliprect.max_x;xdst++) + for(xdst=cliprect.left();xdst<=cliprect.right();xdst++) { if(!stv_vdp2_window_process(xdst,ydst)) continue; @@ -3958,7 +3958,7 @@ void saturn_state::stv_vdp2_draw_basic_tilemap(bitmap_rgb32 &bitmap, const recta { int drawyposinc = tilesizey*(stv2_current_tilemap.tile_size ? 2 : 1); drawypos = -(stv2_current_tilemap.scrolly*scaley); - while( ((drawypos + drawyposinc) >> 16) < cliprect.min_y ) + while( ((drawypos + drawyposinc) >> 16) < cliprect.top() ) { drawypos += drawyposinc; y++; @@ -3969,7 +3969,7 @@ void saturn_state::stv_vdp2_draw_basic_tilemap(bitmap_rgb32 &bitmap, const recta { drawypos += tilesizey*(stv2_current_tilemap.tile_size ? 2 : 1); } - if ((drawypos >> 16) > cliprect.max_y) break; + if ((drawypos >> 16) > cliprect.bottom()) break; ypageoffs = y & (pgtiles_y-1); @@ -3981,7 +3981,7 @@ void saturn_state::stv_vdp2_draw_basic_tilemap(bitmap_rgb32 &bitmap, const recta { int drawxposinc = tilesizex*(stv2_current_tilemap.tile_size ? 2 : 1); drawxpos = -(stv2_current_tilemap.scrollx*scalex); - while( ((drawxpos + drawxposinc) >> 16) < cliprect.min_x ) + while( ((drawxpos + drawxposinc) >> 16) < cliprect.left() ) { drawxpos += drawxposinc; x++; @@ -3992,7 +3992,7 @@ void saturn_state::stv_vdp2_draw_basic_tilemap(bitmap_rgb32 &bitmap, const recta { drawxpos+=tilesizex*(stv2_current_tilemap.tile_size ? 2 : 1); } - if ( (drawxpos >> 16) > cliprect.max_x ) break; + if ( (drawxpos >> 16) > cliprect.right() ) break; xpageoffs = x & (pgtiles_x-1); @@ -4190,7 +4190,7 @@ void saturn_state::stv_vdp2_draw_basic_tilemap(bitmap_rgb32 &bitmap, const recta if ( LOG_VDP2 ) { - logerror( "Layer RBG%d, size %d x %d\n", stv2_current_tilemap.layer_name & 0x7f, cliprect.max_x + 1, cliprect.max_y + 1 ); + logerror( "Layer RBG%d, size %d x %d\n", stv2_current_tilemap.layer_name & 0x7f, cliprect.right() + 1, cliprect.bottom() + 1 ); logerror( "Tiles: min %08X, max %08X\n", tilecodemin, tilecodemax ); logerror( "MAP size in dwords %08X\n", mpsize_dwords ); for (i = 0; i < stv2_current_tilemap.map_count; i++) @@ -4240,7 +4240,7 @@ void saturn_state::stv_vdp2_draw_basic_tilemap(bitmap_rgb32 &bitmap, const recta void saturn_state::stv_vdp2_check_tilemap_with_linescroll(bitmap_rgb32 &bitmap, const rectangle &cliprect) { rectangle mycliprect; - int cur_line = cliprect.min_y; + int cur_line = cliprect.top(); int address; int active_functions = 0; int32_t scroll_values[3], prev_scroll_values[3]; @@ -4278,7 +4278,7 @@ void saturn_state::stv_vdp2_check_tilemap_with_linescroll(bitmap_rgb32 &bitmap, if ( linezoom_enable ) active_functions++; // address of data table - address = stv2_current_tilemap.linescroll_table_address + active_functions*4*cliprect.min_y; + address = stv2_current_tilemap.linescroll_table_address + active_functions*4*cliprect.top(); // get the first scroll values for ( i = 0; i < active_functions; i++ ) @@ -4294,7 +4294,7 @@ void saturn_state::stv_vdp2_check_tilemap_with_linescroll(bitmap_rgb32 &bitmap, } } - while( cur_line <= cliprect.max_y ) + while( cur_line <= cliprect.bottom() ) { lines = 0; do @@ -4325,12 +4325,11 @@ void saturn_state::stv_vdp2_check_tilemap_with_linescroll(bitmap_rgb32 &bitmap, { scroll_values_equal &= (scroll_values[i] == prev_scroll_values[i]); } - } while( scroll_values_equal && ((cur_line + lines) <= cliprect.max_y) ); + } while( scroll_values_equal && ((cur_line + lines) <= cliprect.bottom()) ); // determined how many lines can be drawn // prepare clipping rectangle - mycliprect.min_y = cur_line; - mycliprect.max_y = cur_line + lines - 1; + mycliprect.sety(cur_line, cur_line + lines - 1); // prepare scroll values i = 0; @@ -4358,7 +4357,7 @@ void saturn_state::stv_vdp2_check_tilemap_with_linescroll(bitmap_rgb32 &bitmap, i++; } -// if ( LOG_VDP2 ) logerror( "Linescroll: y < %d, %d >, scrollx = %d, scrolly = %d, incx = %f\n", mycliprect.min_y, mycliprect.max_y, stv2_current_tilemap.scrollx, stv2_current_tilemap.scrolly, (float)stv2_current_tilemap.incx/65536.0 ); +// if ( LOG_VDP2 ) logerror( "Linescroll: y < %d, %d >, scrollx = %d, scrolly = %d, incx = %f\n", mycliprect.top(), mycliprect.bottom(), stv2_current_tilemap.scrollx, stv2_current_tilemap.scrolly, (float)stv2_current_tilemap.incx/65536.0 ); // render current tilemap portion if (stv2_current_tilemap.bitmap_enable) // this layer is a bitmap { @@ -4389,14 +4388,14 @@ void saturn_state::stv_vdp2_draw_line(bitmap_rgb32 &bitmap, const rectangle &cli { base_mask = STV_VDP2_VRAMSZ ? 0x7ffff : 0x3ffff; - for(y=cliprect.min_y;y<=cliprect.max_y;y++) + for(y=cliprect.top();y<=cliprect.bottom();y++) { base_offs = (STV_VDP2_LCTA & base_mask) << 1; if(STV_VDP2_LCCLMD) base_offs += (y / interlace) << 1; - for(x=cliprect.min_x;x<=cliprect.max_x;x++) + for(x=cliprect.left();x<=cliprect.right();x++) { uint16_t pen; @@ -4427,9 +4426,9 @@ void saturn_state::stv_vdp2_draw_mosaic(bitmap_rgb32 &bitmap, const rectangle &c if(STV_VDP2_LSMD == 3) v_size <<= 1; - for(y=cliprect.min_y;y<=cliprect.max_y;y+=v_size) + for(y=cliprect.top();y<=cliprect.bottom();y+=v_size) { - for(x=cliprect.min_x;x<=cliprect.max_x;x+=h_size) + for(x=cliprect.left();x<=cliprect.right();x+=h_size) { pix = bitmap.pix32(y, x); @@ -4484,10 +4483,9 @@ void saturn_state::stv_vdp2_check_tilemap(bitmap_rgb32 &bitmap, const rectangle //base_incx = stv2_current_tilemap.incx; //base_incy = stv2_current_tilemap.incy; - while(cur_char <= cliprect.max_x) + while(cur_char <= cliprect.right()) { - mycliprect.min_x = cur_char; - mycliprect.max_x = cur_char + 8 - 1; + mycliprect.setx(cur_char, cur_char + 8 - 1); uint32_t cur_address; int16_t char_scroll; @@ -4755,7 +4753,7 @@ void saturn_state::stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap, xp = mul_fixed32( RP.A, RP.px - RP.cx ) + mul_fixed32( RP.B, RP.py - RP.cy ) + mul_fixed32( RP.C, RP.pz - RP.cz ) + RP.cx + RP.mx; yp = mul_fixed32( RP.D, RP.px - RP.cx ) + mul_fixed32( RP.E, RP.py - RP.cy ) + mul_fixed32( RP.F, RP.pz - RP.cz ) + RP.cy + RP.my; - for (vcnt = cliprect.min_y; vcnt <= cliprect.max_y; vcnt++ ) + for (vcnt = cliprect.top(); vcnt <= cliprect.bottom(); vcnt++ ) { /*xsp = RP.A * ( ( RP.xst + RP.dxst * (vcnt << 16) ) - RP.px ) + RP.B * ( ( RP.yst + RP.dyst * (vcnt << 16) ) - RP.py ) + @@ -4847,7 +4845,7 @@ void saturn_state::stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap, dxs = mul_fixed32( kx, mul_fixed32( dx, 1 << (16-hcnt_shift))); dys = mul_fixed32( ky, mul_fixed32( dy, 1 << (16-hcnt_shift))); - for (hcnt = cliprect.min_x; hcnt <= cliprect.max_x; xs+=dxs, ys+=dys, hcnt++ ) + for (hcnt = cliprect.left(); hcnt <= cliprect.right(); xs+=dxs, ys+=dys, hcnt++ ) { x = xs >> 16; y = ys >> 16; @@ -4904,7 +4902,7 @@ void saturn_state::stv_vdp2_copy_roz_bitmap(bitmap_rgb32 &bitmap, } else { - for (hcnt = cliprect.min_x; hcnt <= cliprect.max_x; hcnt++ ) + for (hcnt = cliprect.left(); hcnt <= cliprect.right(); hcnt++ ) { switch( coeff_table_size ) { @@ -5830,13 +5828,13 @@ void saturn_state::stv_vdp2_draw_back(bitmap_rgb32 &bitmap, const rectangle &cli { base_mask = STV_VDP2_VRAMSZ ? 0x7ffff : 0x3ffff; - for(y=cliprect.min_y;y<=cliprect.max_y;y++) + for(y=cliprect.top();y<=cliprect.bottom();y++) { base_offs = ((STV_VDP2_BKTA ) & base_mask) << 1; if(STV_VDP2_BKCLMD) base_offs += ((y / interlace) << 1); - for(x=cliprect.min_x;x<=cliprect.max_x;x++) + for(x=cliprect.left();x<=cliprect.right();x++) { int r,g,b; uint16_t dot; @@ -6182,7 +6180,7 @@ uint8_t saturn_state::get_hblank( void ) const rectangle &visarea = m_screen->visible_area(); int cur_h = m_screen->hpos(); - if (cur_h > visarea.max_x) //TODO + if (cur_h > visarea.right()) //TODO return 1; return 0; @@ -6791,7 +6789,7 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, { if ( alpha_enabled == 0 ) { - for ( y = cliprect.min_y; y <= cliprect.max_y; y++ ) + for ( y = cliprect.top(); y <= cliprect.bottom(); y++ ) { if ( stv_sprite_priorities_usage_valid ) if (stv_sprite_priorities_in_fb_line[y][pri] == 0) @@ -6800,7 +6798,7 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, framebuffer_line = m_vdp1.framebuffer_display_lines[y]; bitmap_line = &bitmap.pix32(y); - for ( x = cliprect.min_x; x <= cliprect.max_x; x++ ) + for ( x = cliprect.left(); x <= cliprect.right(); x++ ) { if(!stv_vdp2_window_process(x,y)) continue; @@ -6884,7 +6882,7 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, } else //alpha_enabled == 1 { - for ( y = cliprect.min_y; y <= cliprect.max_y; y++ ) + for ( y = cliprect.top(); y <= cliprect.bottom(); y++ ) { if ( stv_sprite_priorities_usage_valid ) if (stv_sprite_priorities_in_fb_line[y][pri] == 0) @@ -6893,7 +6891,7 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, framebuffer_line = m_vdp1.framebuffer_display_lines[y]; bitmap_line = &bitmap.pix32(y); - for ( x = cliprect.min_x; x <= cliprect.max_x; x++ ) + for ( x = cliprect.left(); x <= cliprect.right(); x++ ) { if(!stv_vdp2_window_process(x,y)) continue; @@ -6993,7 +6991,7 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, } else { - for ( y = cliprect.min_y; y <= cliprect.max_y / (interlace_framebuffer+1); y++ ) + for ( y = cliprect.top(); y <= cliprect.bottom() / (interlace_framebuffer+1); y++ ) { if ( stv_sprite_priorities_usage_valid ) if (stv_sprite_priorities_in_fb_line[y][pri] == 0) @@ -7010,7 +7008,7 @@ void saturn_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, bitmap_line2 = &bitmap.pix32(2*y + 1); } - for ( x = cliprect.min_x; x <= cliprect.max_x /(double_x+1) ; x++ ) + for ( x = cliprect.left(); x <= cliprect.right() /(double_x+1) ; x++ ) { if(!stv_vdp2_window_process(x,y)) continue; diff --git a/src/devices/video/upd7220.cpp b/src/devices/video/upd7220.cpp index f7174ae4543..16bbc507a5a 100644 --- a/src/devices/video/upd7220.cpp +++ b/src/devices/video/upd7220.cpp @@ -408,15 +408,14 @@ inline void upd7220_device::recompute_parameters() attoseconds_t refresh = HZ_TO_ATTOSECONDS(clock() * 8) * horiz_pix_total * vert_pix_total; - rectangle visarea; - - visarea.min_x = 0; //(m_hs + m_hbp) * 8; - visarea.min_y = m_vbp; //m_vs + m_vbp; - visarea.max_x = m_aw * horiz_mult - 1;//horiz_pix_total - (m_hfp * 8) - 1; - visarea.max_y = m_al * vert_mult + m_vbp - 1;//vert_pix_total - m_vfp - 1; + rectangle visarea( + 0, //(m_hs + m_hbp) * 8; + m_aw * horiz_mult - 1,//horiz_pix_total - (m_hfp * 8) - 1; + m_vbp, //m_vs + m_vbp; + m_al * vert_mult + m_vbp - 1);//vert_pix_total - m_vfp - 1; LOG("uPD7220 Screen: %u x %u @ %f Hz\n", horiz_pix_total, vert_pix_total, 1 / ATTOSECONDS_TO_DOUBLE(refresh)); - LOG("Visible Area: (%u, %u) - (%u, %u)\n", visarea.min_x, visarea.min_y, visarea.max_x, visarea.max_y); + LOG("Visible Area: (%u, %u) - (%u, %u)\n", visarea.left(), visarea.top(), visarea.right(), visarea.bottom()); LOG("%d %d %d %d %d\n",m_hs,m_hbp,m_aw,m_hfp,m_pitch); LOG("%d %d %d %d\n",m_vs,m_vbp,m_al,m_vfp); diff --git a/src/devices/video/vic4567.cpp b/src/devices/video/vic4567.cpp index 8154f6a9458..14e22461c23 100644 --- a/src/devices/video/vic4567.cpp +++ b/src/devices/video/vic4567.cpp @@ -1906,25 +1906,25 @@ void vic3_device::draw_bitplanes() if (XPOS > 0) { - vis.set(0, XPOS - 1, 0, visarea.max_y); + vis.set(0, XPOS - 1, 0, visarea.bottom()); m_bitmap->fill(FRAMECOLOR, vis); } - if (XPOS + VIC3_BITPLANES_WIDTH < visarea.max_x) + if (XPOS + VIC3_BITPLANES_WIDTH < visarea.right()) { - vis.set(XPOS + VIC3_BITPLANES_WIDTH, visarea.max_x, 0, visarea.max_y); + vis.set(XPOS + VIC3_BITPLANES_WIDTH, visarea.right(), 0, visarea.bottom()); m_bitmap->fill(FRAMECOLOR, vis); } if (YPOS > 0) { - vis.set(0, visarea.max_x, 0, YPOS - 1); + vis.set(0, visarea.right(), 0, YPOS - 1); m_bitmap->fill(FRAMECOLOR, vis); } - if (YPOS + VIC3_LINES < visarea.max_y) + if (YPOS + VIC3_LINES < visarea.bottom()) { - vis.set(0, visarea.max_x, YPOS + VIC3_LINES, visarea.max_y); + vis.set(0, visarea.right(), YPOS + VIC3_LINES, visarea.bottom()); m_bitmap->fill(FRAMECOLOR, vis); } } diff --git a/src/emu/drawgfx.cpp b/src/emu/drawgfx.cpp index 8c86de6ad9a..3a00569e32c 100644 --- a/src/emu/drawgfx.cpp +++ b/src/emu/drawgfx.cpp @@ -2014,8 +2014,7 @@ static inline void copyscrollbitmap_trans_common(_BitmapClass &dest, const _Bitm for (s32 sx = xscroll - src.width(); sx < dest.width(); sx += src.width()) { // compute the cliprect for this group - subclip.min_x = col * colwidth + sx; - subclip.max_x = (col + groupcols) * colwidth - 1 + sx; + subclip.setx(col * colwidth + sx, (col + groupcols) * colwidth - 1 + sx); subclip &= cliprect; // iterate over all portions of the scroll that overlap the destination @@ -2051,8 +2050,7 @@ static inline void copyscrollbitmap_trans_common(_BitmapClass &dest, const _Bitm for (s32 sy = yscroll - src.height(); sy < dest.height(); sy += src.height()) { // compute the cliprect for this group - subclip.min_y = row * rowheight + sy; - subclip.max_y = (row + grouprows) * rowheight - 1 + sy; + subclip.sety(row * rowheight + sy, (row + grouprows) * rowheight - 1 + sy); subclip &= cliprect; // iterate over all portions of the scroll that overlap the destination diff --git a/src/emu/drawgfxm.h b/src/emu/drawgfxm.h index 1bef8e15237..f4566e9b59f 100644 --- a/src/emu/drawgfxm.h +++ b/src/emu/drawgfxm.h @@ -419,37 +419,37 @@ do { \ /* compute final pixel in X and exit if we are entirely clipped */ \ destendx = destx + width() - 1; \ - if (destx > cliprect.max_x || destendx < cliprect.min_x) \ + if (destx > cliprect.right() || destendx < cliprect.left()) \ break; \ \ /* apply left clip */ \ srcx = 0; \ - if (destx < cliprect.min_x) \ + if (destx < cliprect.left()) \ { \ - srcx = cliprect.min_x - destx; \ - destx = cliprect.min_x; \ + srcx = cliprect.left() - destx; \ + destx = cliprect.left(); \ } \ \ /* apply right clip */ \ - if (destendx > cliprect.max_x) \ - destendx = cliprect.max_x; \ + if (destendx > cliprect.right()) \ + destendx = cliprect.right(); \ \ /* compute final pixel in Y and exit if we are entirely clipped */ \ destendy = desty + height() - 1; \ - if (desty > cliprect.max_y || destendy < cliprect.min_y) \ + if (desty > cliprect.bottom() || destendy < cliprect.top()) \ break; \ \ /* apply top clip */ \ srcy = 0; \ - if (desty < cliprect.min_y) \ + if (desty < cliprect.top()) \ { \ - srcy = cliprect.min_y - desty; \ - desty = cliprect.min_y; \ + srcy = cliprect.top() - desty; \ + desty = cliprect.top(); \ } \ \ /* apply bottom clip */ \ - if (destendy > cliprect.max_y) \ - destendy = cliprect.max_y; \ + if (destendy > cliprect.bottom()) \ + destendy = cliprect.bottom(); \ \ /* apply X flipping */ \ if (flipx) \ @@ -601,24 +601,24 @@ do { \ /* compute final pixel in X and exit if we are entirely clipped */ \ destendx = destx + dstwidth - 1; \ - if (destx > cliprect.max_x || destendx < cliprect.min_x) \ + if (destx > cliprect.right() || destendx < cliprect.left()) \ break; \ \ /* apply left clip */ \ srcx = 0; \ - if (destx < cliprect.min_x) \ + if (destx < cliprect.left()) \ { \ - srcx = (cliprect.min_x - destx) * dx; \ - destx = cliprect.min_x; \ + srcx = (cliprect.left() - destx) * dx; \ + destx = cliprect.left(); \ } \ \ /* apply right clip */ \ - if (destendx > cliprect.max_x) \ - destendx = cliprect.max_x; \ + if (destendx > cliprect.right()) \ + destendx = cliprect.right(); \ \ /* compute final pixel in Y and exit if we are entirely clipped */ \ destendy = desty + dstheight - 1; \ - if (desty > cliprect.max_y || destendy < cliprect.min_y) \ + if (desty > cliprect.bottom() || destendy < cliprect.top()) \ { \ g_profiler.stop(); \ return; \ @@ -626,15 +626,15 @@ do { \ /* apply top clip */ \ srcy = 0; \ - if (desty < cliprect.min_y) \ + if (desty < cliprect.top()) \ { \ - srcy = (cliprect.min_y - desty) * dy; \ - desty = cliprect.min_y; \ + srcy = (cliprect.top() - desty) * dy; \ + desty = cliprect.top(); \ } \ \ /* apply bottom clip */ \ - if (destendy > cliprect.max_y) \ - destendy = cliprect.max_y; \ + if (destendy > cliprect.bottom()) \ + destendy = cliprect.bottom(); \ \ /* apply X flipping */ \ if (flipx) \ @@ -740,37 +740,37 @@ do { \ /* compute final pixel in X and exit if we are entirely clipped */ \ destendx = destx + src.width() - 1; \ - if (destx > cliprect.max_x || destendx < cliprect.min_x) \ + if (destx > cliprect.right() || destendx < cliprect.left()) \ break; \ \ /* apply left clip */ \ srcx = 0; \ - if (destx < cliprect.min_x) \ + if (destx < cliprect.left()) \ { \ - srcx = cliprect.min_x - destx; \ - destx = cliprect.min_x; \ + srcx = cliprect.left() - destx; \ + destx = cliprect.left(); \ } \ \ /* apply right clip */ \ - if (destendx > cliprect.max_x) \ - destendx = cliprect.max_x; \ + if (destendx > cliprect.right()) \ + destendx = cliprect.right(); \ \ /* compute final pixel in Y and exit if we are entirely clipped */ \ destendy = desty + src.height() - 1; \ - if (desty > cliprect.max_y || destendy < cliprect.min_y) \ + if (desty > cliprect.bottom() || destendy < cliprect.top()) \ break; \ \ /* apply top clip */ \ srcy = 0; \ - if (desty < cliprect.min_y) \ + if (desty < cliprect.top()) \ { \ - srcy = cliprect.min_y - desty; \ - desty = cliprect.min_y; \ + srcy = cliprect.top() - desty; \ + desty = cliprect.top(); \ } \ \ /* apply bottom clip */ \ - if (destendy > cliprect.max_y) \ - destendy = cliprect.max_y; \ + if (destendy > cliprect.bottom()) \ + destendy = cliprect.bottom(); \ \ /* apply X flipping */ \ if (flipx) \ @@ -912,8 +912,8 @@ do { srcfixheight = src.height() << 16; \ \ /* advance the starting coordinates to the top-left of the cliprect */ \ - startx += cliprect.min_x * incxx + cliprect.min_y * incyx; \ - starty += cliprect.min_x * incxy + cliprect.min_y * incyy; \ + startx += cliprect.left() * incxx + cliprect.top() * incyx; \ + starty += cliprect.left() * incxy + cliprect.top() * incyy; \ \ /* compute how many blocks of 4 pixels we have */ \ numblocks = cliprect.width() / 4; \ @@ -926,10 +926,10 @@ do { if (!wraparound) \ { \ /* iterate over pixels in Y */ \ - for (cury = cliprect.min_y; cury <= cliprect.max_y; cury++) \ + for (cury = cliprect.top(); cury <= cliprect.bottom(); cury++) \ { \ - PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.min_x); \ - PIXEL_TYPE *destptr = &dest.pixt(cury, cliprect.min_x); \ + PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.left()); \ + PIXEL_TYPE *destptr = &dest.pixt(cury, cliprect.left()); \ const PIXEL_TYPE *srcptr; \ s32 srcx = startx; \ s32 srcy = starty; \ @@ -987,10 +987,10 @@ do { starty &= srcfixheight; \ \ /* iterate over pixels in Y */ \ - for (cury = cliprect.min_y; cury <= cliprect.max_y; cury++) \ + for (cury = cliprect.top(); cury <= cliprect.bottom(); cury++) \ { \ - PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.min_x); \ - PIXEL_TYPE *destptr = &dest.pixt(cury, cliprect.min_x); \ + PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.left()); \ + PIXEL_TYPE *destptr = &dest.pixt(cury, cliprect.left()); \ const PIXEL_TYPE *srcptr = &src.pixt(starty >> 16); \ s32 srcx = startx; \ \ @@ -1034,10 +1034,10 @@ do { if (!wraparound) \ { \ /* iterate over pixels in Y */ \ - for (cury = cliprect.min_y; cury <= cliprect.max_y; cury++) \ + for (cury = cliprect.top(); cury <= cliprect.bottom(); cury++) \ { \ - PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.min_x); \ - PIXEL_TYPE *destptr = &dest.pixt(cury, cliprect.min_x); \ + PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.left()); \ + PIXEL_TYPE *destptr = &dest.pixt(cury, cliprect.left()); \ const PIXEL_TYPE *srcptr; \ s32 srcx = startx; \ s32 srcy = starty; \ @@ -1110,10 +1110,10 @@ do { starty &= srcfixheight; \ \ /* iterate over pixels in Y */ \ - for (cury = cliprect.min_y; cury <= cliprect.max_y; cury++) \ + for (cury = cliprect.top(); cury <= cliprect.bottom(); cury++) \ { \ - PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.min_x); \ - PIXEL_TYPE *destptr = &dest.pixt(cury, cliprect.min_x); \ + PRIORITY_TYPE *priptr = PRIORITY_ADDR(priority, PRIORITY_TYPE, cury, cliprect.left()); \ + PIXEL_TYPE *destptr = &dest.pixt(cury, cliprect.left()); \ const PIXEL_TYPE *srcptr; \ s32 srcx = startx; \ s32 srcy = starty; \ diff --git a/src/emu/render.cpp b/src/emu/render.cpp index a65a47e2cf6..243b118d81e 100644 --- a/src/emu/render.cpp +++ b/src/emu/render.cpp @@ -457,7 +457,7 @@ void render_texture::get_scaled(u32 dwidth, u32 dheight, render_texinfo &texinfo // add a reference and set up the source bitmap primlist.add_reference(m_bitmap); - texinfo.base = m_bitmap->raw_pixptr(m_sbounds.min_y, m_sbounds.min_x); + texinfo.base = m_bitmap->raw_pixptr(m_sbounds.top(), m_sbounds.left()); texinfo.rowpixels = m_bitmap->rowpixels(); texinfo.width = swidth; texinfo.height = sheight; diff --git a/src/emu/rendfont.cpp b/src/emu/rendfont.cpp index 5e7f0329fd2..a71a119f75f 100644 --- a/src/emu/rendfont.cpp +++ b/src/emu/rendfont.cpp @@ -524,10 +524,9 @@ inline render_font::glyph &render_font::get_char(char32_t chnum) gl.bmheight = int(glyph_ch.bmheight * scale + 0.5f); gl.bitmap.allocate(gl.bmwidth, gl.bmheight); - rectangle clip; - clip.min_x = clip.min_y = 0; - clip.max_x = glyph_ch.bitmap.width() - 1; - clip.max_y = glyph_ch.bitmap.height() - 1; + rectangle clip( + 0, glyph_ch.bitmap.width() - 1, + 0, glyph_ch.bitmap.height() - 1); render_texture::hq_scale(gl.bitmap, glyph_ch.bitmap, clip, nullptr); /* wrap a texture around the bitmap */ diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp index 2c4057501d6..1d5dd7eadd5 100644 --- a/src/emu/rendlay.cpp +++ b/src/emu/rendlay.cpp @@ -1139,11 +1139,11 @@ void layout_element::element_scale(bitmap_argb32 &dest, bitmap_argb32 &source, c if (curcomp->state() == -1 || curcomp->state() == elemtex->m_state) { // get the local scaled bounds - rectangle bounds; - bounds.min_x = render_round_nearest(curcomp->bounds().x0 * dest.width()); - bounds.min_y = render_round_nearest(curcomp->bounds().y0 * dest.height()); - bounds.max_x = render_round_nearest(curcomp->bounds().x1 * dest.width()); - bounds.max_y = render_round_nearest(curcomp->bounds().y1 * dest.height()); + rectangle bounds( + render_round_nearest(curcomp->bounds().x0 * dest.width()), + render_round_nearest(curcomp->bounds().x1 * dest.width()), + render_round_nearest(curcomp->bounds().y0 * dest.height()), + render_round_nearest(curcomp->bounds().y1 * dest.height())); bounds &= dest.cliprect(); // based on the component type, add to the texture @@ -1255,9 +1255,9 @@ protected: u32 const inva = (1.0f - color().a) * 255.0f; // iterate over X and Y - for (u32 y = bounds.min_y; y <= bounds.max_y; y++) + for (u32 y = bounds.top(); y <= bounds.bottom(); y++) { - for (u32 x = bounds.min_x; x <= bounds.max_x; x++) + for (u32 x = bounds.left(); x <= bounds.right(); x++) { u32 finalr = r; u32 finalg = g; @@ -1308,7 +1308,7 @@ protected: float const ooyradius2 = 1.0f / (yradius * yradius); // iterate over y - for (u32 y = bounds.min_y; y <= bounds.max_y; y++) + for (u32 y = bounds.top(); y <= bounds.bottom(); y++) { float ycoord = ycenter - ((float)y + 0.5f); float xval = xradius * sqrtf(1.0f - (ycoord * ycoord) * ooyradius2); @@ -2157,23 +2157,23 @@ protected: if (m_reelreversed==1) { - basey = bounds.min_y + ((use_state)*(ourheight/num_shown)/(max_state_used/m_numstops)) + curry; + basey = bounds.top() + ((use_state)*(ourheight/num_shown)/(max_state_used/m_numstops)) + curry; } else { - basey = bounds.min_y - ((use_state)*(ourheight/num_shown)/(max_state_used/m_numstops)) + curry; + basey = bounds.top() - ((use_state)*(ourheight/num_shown)/(max_state_used/m_numstops)) + curry; } // wrap around... - if (basey < bounds.min_y) + if (basey < bounds.top()) basey += ((max_state_used)*(ourheight/num_shown)/(max_state_used/m_numstops)); - if (basey > bounds.max_y) + if (basey > bounds.bottom()) basey -= ((max_state_used)*(ourheight/num_shown)/(max_state_used/m_numstops)); int endpos = basey+ourheight/num_shown; // only render the symbol / text if it's atually in view because the code is SLOW - if ((endpos >= bounds.min_y) && (basey <= bounds.max_y)) + if ((endpos >= bounds.top()) && (basey <= bounds.bottom())) { while (1) { @@ -2184,7 +2184,7 @@ protected: } s32 curx; - curx = bounds.min_x + (bounds.width() - width) / 2; + curx = bounds.left() + (bounds.width() - width) / 2; if (m_file[fruit]) if (!m_bitmap[fruit].valid()) @@ -2202,14 +2202,14 @@ protected: { int effy = basey + y; - if (effy >= bounds.min_y && effy <= bounds.max_y) + if (effy >= bounds.top() && effy <= bounds.bottom()) { u32 *src = &tempbitmap2.pix32(y); u32 *d = &dest.pix32(effy); for (int x = 0; x < dest.width(); x++) { int effx = x; - if (effx >= bounds.min_x && effx <= bounds.max_x) + if (effx >= bounds.left() && effx <= bounds.right()) { u32 spix = rgb_t(src[x]).a(); if (spix != 0) @@ -2249,14 +2249,14 @@ protected: { int effy = basey + y; - if (effy >= bounds.min_y && effy <= bounds.max_y) + if (effy >= bounds.top() && effy <= bounds.bottom()) { u32 *src = &tempbitmap.pix32(y); u32 *d = &dest.pix32(effy); for (int x = 0; x < chbounds.width(); x++) { - int effx = curx + x + chbounds.min_x; - if (effx >= bounds.min_x && effx <= bounds.max_x) + int effx = curx + x + chbounds.left(); + if (effx >= bounds.left() && effx <= bounds.right()) { u32 spix = rgb_t(src[x]).a(); if (spix != 0) @@ -2324,15 +2324,15 @@ private: } // wrap around... - if (basex < bounds.min_x) + if (basex < bounds.left()) basex += ((max_state_used)*(ourwidth/num_shown)/(max_state_used/m_numstops)); - if (basex > bounds.max_x) + if (basex > bounds.right()) basex -= ((max_state_used)*(ourwidth/num_shown)/(max_state_used/m_numstops)); int endpos = basex+(ourwidth/num_shown); // only render the symbol / text if it's atually in view because the code is SLOW - if ((endpos >= bounds.min_x) && (basex <= bounds.max_x)) + if ((endpos >= bounds.left()) && (basex <= bounds.right())) { while (1) { @@ -2343,7 +2343,7 @@ private: } s32 curx; - curx = bounds.min_x; + curx = bounds.left(); if (m_file[fruit]) if (!m_bitmap[fruit].valid()) @@ -2361,14 +2361,14 @@ private: { int effy = y; - if (effy >= bounds.min_y && effy <= bounds.max_y) + if (effy >= bounds.top() && effy <= bounds.bottom()) { u32 *src = &tempbitmap2.pix32(y); u32 *d = &dest.pix32(effy); for (int x = 0; x < ourwidth/num_shown; x++) { int effx = basex + x; - if (effx >= bounds.min_x && effx <= bounds.max_x) + if (effx >= bounds.left() && effx <= bounds.right()) { u32 spix = rgb_t(src[x]).a(); if (spix != 0) @@ -2410,14 +2410,14 @@ private: { int effy = y; - if (effy >= bounds.min_y && effy <= bounds.max_y) + if (effy >= bounds.top() && effy <= bounds.bottom()) { u32 *src = &tempbitmap.pix32(y); u32 *d = &dest.pix32(effy); for (int x = 0; x < chbounds.width(); x++) { int effx = basex + curx + x; - if (effx >= bounds.min_x && effx <= bounds.max_x) + if (effx >= bounds.left() && effx <= bounds.right()) { u32 spix = rgb_t(src[x]).a(); if (spix != 0) @@ -2618,17 +2618,17 @@ void layout_element::component::draw_text(render_font &font, bitmap_argb32 &dest { // left case 1: - curx = bounds.min_x; + curx = bounds.left(); break; // right case 2: - curx = bounds.max_x - width; + curx = bounds.right() - width; break; // default to center default: - curx = bounds.min_x + (bounds.width() - width) / 2; + curx = bounds.left() + (bounds.width() - width) / 2; break; } @@ -2656,15 +2656,15 @@ void layout_element::component::draw_text(render_font &font, bitmap_argb32 &dest // copy the data into the target for (int y = 0; y < chbounds.height(); y++) { - int effy = bounds.min_y + y; - if (effy >= bounds.min_y && effy <= bounds.max_y) + int effy = bounds.top() + y; + if (effy >= bounds.top() && effy <= bounds.bottom()) { u32 *src = &tempbitmap.pix32(y); u32 *d = &dest.pix32(effy); for (int x = 0; x < chbounds.width(); x++) { - int effx = curx + x + chbounds.min_x; - if (effx >= bounds.min_x && effx <= bounds.max_x) + int effx = curx + x + chbounds.left(); + if (effx >= bounds.left() && effx <= bounds.right()) { u32 spix = rgb_t(src[x]).a(); if (spix != 0) diff --git a/src/emu/screen.cpp b/src/emu/screen.cpp index 26ef04c43ce..a3f762071b2 100644 --- a/src/emu/screen.cpp +++ b/src/emu/screen.cpp @@ -615,7 +615,7 @@ void screen_device::device_validity_check(validity_checker &valid) const // sanity check display area if (m_type != SCREEN_TYPE_VECTOR && m_type != SCREEN_TYPE_SVG) { - if (m_visarea.empty() || m_visarea.max_x >= m_width || m_visarea.max_y >= m_height) + if (m_visarea.empty() || m_visarea.right() >= m_width || m_visarea.bottom() >= m_height) osd_printf_error("Invalid display area\n"); // sanity check screen formats @@ -886,8 +886,8 @@ void screen_device::device_timer(emu_timer &timer, device_timer_id id, int param // compute the next visible scanline param++; - if (param > m_visarea.max_y) - param = m_visarea.min_y; + if (param > m_visarea.bottom()) + param = m_visarea.top(); m_scanline_timer->adjust(time_until_pos(param), param); break; } @@ -903,12 +903,12 @@ void screen_device::configure(int width, int height, const rectangle &visarea, a // validate arguments assert(width > 0); assert(height > 0); - assert(visarea.min_x >= 0); - assert(visarea.min_y >= 0); -// assert(visarea.max_x < width); -// assert(visarea.max_y < height); - assert(m_type == SCREEN_TYPE_VECTOR || m_type == SCREEN_TYPE_SVG || visarea.min_x < width); - assert(m_type == SCREEN_TYPE_VECTOR || m_type == SCREEN_TYPE_SVG || visarea.min_y < height); + assert(visarea.left() >= 0); + assert(visarea.top() >= 0); +// assert(visarea.right() < width); +// assert(visarea.bottom() < height); + assert(m_type == SCREEN_TYPE_VECTOR || m_type == SCREEN_TYPE_SVG || visarea.left() < width); + assert(m_type == SCREEN_TYPE_VECTOR || m_type == SCREEN_TYPE_SVG || visarea.top() < height); assert(frame_period > 0); // fill in the new parameters @@ -973,9 +973,9 @@ void screen_device::reset_origin(int beamy, int beamx) else m_scanline0_timer->adjust(time_until_pos(0)); - // if we are resetting relative to (visarea.max_y + 1, 0) == VBLANK start, + // if we are resetting relative to (visarea.bottom() + 1, 0) == VBLANK start, // call the VBLANK start timer now; otherwise, adjust it for the future - if (beamy == ((m_visarea.max_y + 1) % m_height) && beamx == 0) + if (beamy == ((m_visarea.bottom() + 1) % m_height) && beamx == 0) vblank_begin(); else m_vblank_begin_timer->adjust(time_until_vblank_start()); @@ -994,8 +994,8 @@ void screen_device::realloc_screen_bitmaps() return; // determine effective size to allocate - s32 effwidth = std::max(m_width, m_visarea.max_x + 1); - s32 effheight = std::max(m_height, m_visarea.max_y + 1); + s32 effwidth = std::max(m_width, m_visarea.right() + 1); + s32 effheight = std::max(m_height, m_visarea.bottom() + 1); // reize all registered screen bitmaps for (auto &item : m_auto_bitmap_list) @@ -1063,21 +1063,20 @@ bool screen_device::update_partial(int scanline) } // set the range of scanlines to render - rectangle clip = m_visarea; - if (m_last_partial_scan > clip.min_y) - clip.min_y = m_last_partial_scan; - if (scanline < clip.max_y) - clip.max_y = scanline; + rectangle clip(m_visarea); + clip.sety( + (std::max)(clip.top(), m_last_partial_scan), + (std::min)(clip.bottom(), scanline)); // skip if entirely outside of visible area - if (clip.min_y > clip.max_y) + if (clip.top() > clip.bottom()) { LOG_PARTIAL_UPDATES(("skipped because outside of visible area\n")); return false; } // otherwise, render - LOG_PARTIAL_UPDATES(("updating %d-%d\n", clip.min_y, clip.max_y)); + LOG_PARTIAL_UPDATES(("updating %d-%d\n", clip.top(), clip.bottom())); g_profiler.start(PROFILER_VIDEO); u32 flags; @@ -1137,7 +1136,7 @@ void screen_device::update_now() int current_hpos = hpos(); rectangle clip = m_visarea; - LOG_PARTIAL_UPDATES(("update_now(): Y=%d, X=%d, last partial %d, partial hpos %d (vis %d %d)\n", current_vpos, current_hpos, m_last_partial_scan, m_partial_scan_hpos, m_visarea.max_x, m_visarea.max_y)); + LOG_PARTIAL_UPDATES(("update_now(): Y=%d, X=%d, last partial %d, partial hpos %d (vis %d %d)\n", current_vpos, current_hpos, m_last_partial_scan, m_partial_scan_hpos, m_visarea.right(), m_visarea.bottom())); // start off by doing a partial update up to the line before us, in case that was necessary if (current_vpos > m_last_partial_scan) @@ -1154,17 +1153,14 @@ void screen_device::update_now() // now finish the previous partial scanline int scanline = current_vpos - 1; - if (m_partial_scan_hpos > clip.min_x) - clip.min_x = m_partial_scan_hpos; - if (current_hpos < clip.max_x) - clip.max_x = current_hpos; - if (m_last_partial_scan > clip.min_y) - clip.min_y = m_last_partial_scan; - if (scanline < clip.max_y) - clip.max_y = scanline; + clip.set( + (std::max)(clip.left(), m_partial_scan_hpos), + (std::min)(clip.right(), current_hpos), + (std::max)(clip.top(), m_last_partial_scan), + (std::min)(clip.bottom(), scanline)); // if there's something to draw, do it - if ((clip.min_x <= clip.max_x) && (clip.min_y <= clip.max_y)) + if (!clip.empty()) { g_profiler.start(PROFILER_VIDEO); @@ -1191,21 +1187,18 @@ void screen_device::update_now() // now draw this partial scanline clip = m_visarea; - if (m_partial_scan_hpos > clip.min_x) - clip.min_x = m_partial_scan_hpos; - if (current_hpos < clip.max_x) - clip.max_x = current_hpos; - if (current_vpos > clip.min_y) - clip.min_y = current_vpos; - if (current_vpos < clip.max_y) - clip.max_y = current_vpos; + clip.set( + (std::max)(clip.left(), m_partial_scan_hpos), + (std::min)(clip.right(), current_hpos), + (std::max)(clip.top(), current_vpos), + (std::min)(clip.bottom(), current_vpos)); // and if there's something to draw, do it - if ((clip.min_x <= clip.max_x) && (clip.min_y <= clip.max_y)) + if (!clip.empty()) { g_profiler.start(PROFILER_VIDEO); - LOG_PARTIAL_UPDATES(("doing scanline partial draw: Y %d X %d-%d\n", clip.max_y, clip.min_x, clip.max_x)); + LOG_PARTIAL_UPDATES(("doing scanline partial draw: Y %d X %d-%d\n", clip.bottom(), clip.left(), clip.right())); u32 flags; screen_bitmap &curbitmap = m_bitmap[m_curbitmap]; @@ -1227,7 +1220,7 @@ void screen_device::update_now() m_last_partial_scan = current_vpos; // if we completed the line, mark it so - if (current_hpos >= m_visarea.max_x) + if (current_hpos >= m_visarea.right()) { m_partial_scan_hpos = 0; m_last_partial_scan = current_vpos + 1; @@ -1267,7 +1260,7 @@ int screen_device::vpos() const vpos = delta / m_scantime; // adjust for the fact that VBLANK starts at the bottom of the visible area - return (m_visarea.max_y + 1 + vpos) % m_height; + return (m_visarea.bottom() + 1 + vpos) % m_height; } @@ -1307,7 +1300,7 @@ attotime screen_device::time_until_pos(int vpos, int hpos) const assert(hpos >= 0); // since we measure time relative to VBLANK, compute the scanline offset from VBLANK - vpos += m_height - (m_visarea.max_y + 1); + vpos += m_height - (m_visarea.bottom() + 1); vpos %= m_height; // compute the delta for the given X,Y position @@ -1545,11 +1538,11 @@ void screen_device::finalize_burnin() return; // compute the scaled visible region - rectangle scaledvis; - scaledvis.min_x = m_visarea.min_x * m_burnin.width() / m_width; - scaledvis.max_x = m_visarea.max_x * m_burnin.width() / m_width; - scaledvis.min_y = m_visarea.min_y * m_burnin.height() / m_height; - scaledvis.max_y = m_visarea.max_y * m_burnin.height() / m_height; + rectangle scaledvis( + m_visarea.left() * m_burnin.width() / m_width, + m_visarea.right() * m_burnin.width() / m_width, + m_visarea.top() * m_burnin.height() / m_height, + m_visarea.bottom() * m_burnin.height() / m_height); // wrap a bitmap around the memregion we care about bitmap_argb32 finalmap(scaledvis.width(), scaledvis.height()); diff --git a/src/emu/screen.h b/src/emu/screen.h index 4d0fddf17ef..45374fef1e7 100644 --- a/src/emu/screen.h +++ b/src/emu/screen.h @@ -279,11 +279,11 @@ public: int vpos() const; int hpos() const; DECLARE_READ_LINE_MEMBER(vblank) const { return (machine().time() < m_vblank_end_time) ? 1 : 0; } - DECLARE_READ_LINE_MEMBER(hblank) const { int const curpos = hpos(); return (curpos < m_visarea.min_x || curpos > m_visarea.max_x) ? 1 : 0; } + DECLARE_READ_LINE_MEMBER(hblank) const { int const curpos = hpos(); return (curpos < m_visarea.left() || curpos > m_visarea.right()) ? 1 : 0; } // timing attotime time_until_pos(int vpos, int hpos = 0) const; - attotime time_until_vblank_start() const { return time_until_pos(m_visarea.max_y + 1); } + attotime time_until_vblank_start() const { return time_until_pos(m_visarea.bottom() + 1); } attotime time_until_vblank_end() const; attotime time_until_update() const { return (m_video_attributes & VIDEO_UPDATE_AFTER_VBLANK) ? time_until_vblank_end() : time_until_vblank_start(); } attotime scan_period() const { return attotime(0, m_scantime); } diff --git a/src/emu/tilemap.cpp b/src/emu/tilemap.cpp index 0b7b748a494..9425ee88c16 100644 --- a/src/emu/tilemap.cpp +++ b/src/emu/tilemap.cpp @@ -953,8 +953,8 @@ g_profiler.start(PROFILER_TILEMAP_DRAW); // flip the tilemap around the center of the visible area rectangle visarea = screen.visible_area(); - u32 width = visarea.min_x + visarea.max_x + 1; - u32 height = visarea.min_y + visarea.max_y + 1; + u32 width = visarea.left() + visarea.right() + 1; + u32 height = visarea.top() + visarea.bottom() + 1; // XY scrolling playfield if (m_scrollrows == 1 && m_scrollcols == 1) @@ -962,8 +962,8 @@ g_profiler.start(PROFILER_TILEMAP_DRAW); // iterate to handle wraparound int scrollx = effective_rowscroll(0, width); int scrolly = effective_colscroll(0, height); - for (int ypos = scrolly - m_height; ypos <= blit.cliprect.max_y; ypos += m_height) - for (int xpos = scrollx - m_width; xpos <= blit.cliprect.max_x; xpos += m_width) + for (int ypos = scrolly - m_height; ypos <= blit.cliprect.bottom(); ypos += m_height) + for (int xpos = scrollx - m_width; xpos <= blit.cliprect.right(); xpos += m_width) draw_instance(screen, dest, blit, xpos, ypos); } @@ -975,10 +975,10 @@ g_profiler.start(PROFILER_TILEMAP_DRAW); // iterate over Y to handle wraparound int rowheight = m_height / m_scrollrows; int scrolly = effective_colscroll(0, height); - for (int ypos = scrolly - m_height; ypos <= original_cliprect.max_y; ypos += m_height) + for (int ypos = scrolly - m_height; ypos <= original_cliprect.bottom(); ypos += m_height) { - int const firstrow = std::max((original_cliprect.min_y - ypos) / rowheight, 0); - int const lastrow = std::min((original_cliprect.max_y - ypos) / rowheight, s32(m_scrollrows) - 1); + int const firstrow = std::max((original_cliprect.top() - ypos) / rowheight, 0); + int const lastrow = std::min((original_cliprect.bottom() - ypos) / rowheight, s32(m_scrollrows) - 1); // iterate over rows in the tilemap int nextrow; @@ -995,12 +995,11 @@ g_profiler.start(PROFILER_TILEMAP_DRAW); continue; // update the cliprect just for this set of rows - blit.cliprect.min_y = currow * rowheight + ypos; - blit.cliprect.max_y = nextrow * rowheight - 1 + ypos; + blit.cliprect.sety(currow * rowheight + ypos, nextrow * rowheight - 1 + ypos); blit.cliprect &= original_cliprect; // iterate over X to handle wraparound - for (int xpos = scrollx - m_width; xpos <= original_cliprect.max_x; xpos += m_width) + for (int xpos = scrollx - m_width; xpos <= original_cliprect.right(); xpos += m_width) draw_instance(screen, dest, blit, xpos, ypos); } } @@ -1028,15 +1027,14 @@ g_profiler.start(PROFILER_TILEMAP_DRAW); continue; // iterate over X to handle wraparound - for (int xpos = scrollx - m_width; xpos <= original_cliprect.max_x; xpos += m_width) + for (int xpos = scrollx - m_width; xpos <= original_cliprect.right(); xpos += m_width) { // update the cliprect just for this set of columns - blit.cliprect.min_x = curcol * colwidth + xpos; - blit.cliprect.max_x = nextcol * colwidth - 1 + xpos; + blit.cliprect.setx(curcol * colwidth + xpos, nextcol * colwidth - 1 + xpos); blit.cliprect &= original_cliprect; // iterate over Y to handle wraparound - for (int ypos = scrolly - m_height; ypos <= original_cliprect.max_y; ypos += m_height) + for (int ypos = scrolly - m_height; ypos <= original_cliprect.bottom(); ypos += m_height) draw_instance(screen, dest, blit, xpos, ypos); } } @@ -1115,10 +1113,10 @@ void tilemap_t::draw_instance(screen_device &screen, _BitmapClass &dest, const b { // clip destination coordinates to the tilemap // note that x2/y2 are exclusive, not inclusive - int x1 = std::max(xpos, blit.cliprect.min_x); - int x2 = std::min(xpos + (int)m_width, blit.cliprect.max_x + 1); - int y1 = std::max(ypos, blit.cliprect.min_y); - int y2 = std::min(ypos + (int)m_height, blit.cliprect.max_y + 1); + int x1 = (std::max)(xpos, blit.cliprect.left()); + int x2 = (std::min)(xpos + int(m_width), blit.cliprect.right() + 1); + int y1 = (std::max)(ypos, blit.cliprect.top()); + int y2 = (std::min)(ypos + int(m_height), blit.cliprect.bottom() + 1); // if totally clipped, stop here if (x1 >= x2 || y1 >= y2) @@ -1305,14 +1303,14 @@ void tilemap_t::draw_roz_core(screen_device &screen, _BitmapClass &destbitmap, c u8 alpha = blit.alpha; // pre-advance based on the cliprect - startx += blit.cliprect.min_x * incxx + blit.cliprect.min_y * incyx; - starty += blit.cliprect.min_x * incxy + blit.cliprect.min_y * incyy; + startx += blit.cliprect.left() * incxx + blit.cliprect.top() * incyx; + starty += blit.cliprect.left() * incxy + blit.cliprect.top() * incyy; // extract start/end points - int sx = blit.cliprect.min_x; - int sy = blit.cliprect.min_y; - int ex = blit.cliprect.max_x; - int ey = blit.cliprect.max_y; + int sx = blit.cliprect.left(); + int sy = blit.cliprect.top(); + int ex = blit.cliprect.right(); + int ey = blit.cliprect.bottom(); // optimized loop for the not rotated case if (incxy == 0 && incyx == 0 && !wraparound) @@ -1476,8 +1474,8 @@ void tilemap_t::draw_debug(screen_device &screen, bitmap_rgb32 &dest, u32 scroll realize_all_dirty_tiles(); // iterate to handle wraparound - for (int ypos = scrolly - m_height; ypos <= blit.cliprect.max_y; ypos += m_height) - for (int xpos = scrollx - m_width; xpos <= blit.cliprect.max_x; xpos += m_width) + for (int ypos = scrolly - m_height; ypos <= blit.cliprect.bottom(); ypos += m_height) + for (int xpos = scrollx - m_width; xpos <= blit.cliprect.right(); xpos += m_width) draw_instance(screen, dest, blit, xpos, ypos); } diff --git a/src/lib/util/bitmap.cpp b/src/lib/util/bitmap.cpp index c8ceb5d3eab..a0a1e92f4d9 100644 --- a/src/lib/util/bitmap.cpp +++ b/src/lib/util/bitmap.cpp @@ -129,7 +129,7 @@ bitmap_t::bitmap_t(bitmap_format format, uint8_t bpp, void *base, int width, int bitmap_t::bitmap_t(bitmap_format format, uint8_t bpp, bitmap_t &source, const rectangle &subrect) : m_alloc() , m_allocbytes(0) - , m_base(source.raw_pixptr(subrect.min_y, subrect.min_x)) + , m_base(source.raw_pixptr(subrect.top(), subrect.left())) , m_rowpixels(source.m_rowpixels) , m_width(subrect.width()) , m_height(subrect.height()) @@ -332,7 +332,7 @@ void bitmap_t::wrap(const bitmap_t &source, const rectangle &subrect) reset(); // copy relevant fields - m_base = source.raw_pixptr(subrect.min_y, subrect.min_x); + m_base = source.raw_pixptr(subrect.top(), subrect.left()); m_rowpixels = source.m_rowpixels; m_width = subrect.width(); m_height = subrect.height(); @@ -391,29 +391,29 @@ void bitmap_t::fill(uint32_t color, const rectangle &cliprect) { case 8: // 8bpp always uses memset - for (int32_t y = fill.min_y; y <= fill.max_y; y++) - memset(raw_pixptr(y, fill.min_x), (uint8_t)color, fill.width()); + for (int32_t y = fill.top(); y <= fill.bottom(); y++) + memset(raw_pixptr(y, fill.left()), uint8_t(color), fill.width()); break; case 16: // 16bpp can use memset if the bytes are equal - if ((uint8_t)(color >> 8) == (uint8_t)color) + if (uint8_t(color >> 8) == uint8_t(color)) { - for (int32_t y = fill.min_y; y <= fill.max_y; y++) - memset(raw_pixptr(y, fill.min_x), (uint8_t)color, fill.width() * 2); + for (int32_t y = fill.top(); y <= fill.bottom(); y++) + memset(raw_pixptr(y, fill.left()), uint8_t(color), fill.width() * 2); } else { // Fill the first line the hard way - uint16_t *destrow = &pixt(fill.min_y); - for (int32_t x = fill.min_x; x <= fill.max_x; x++) - destrow[x] = (uint16_t)color; + uint16_t *destrow = &pixt(fill.top()); + for (int32_t x = fill.left(); x <= fill.right(); x++) + destrow[x] = uint16_t(color); // For the other lines, just copy the first one - void *destrow0 = &pixt(fill.min_y, fill.min_x); - for (int32_t y = fill.min_y + 1; y <= fill.max_y; y++) + void *destrow0 = &pixt(fill.top(), fill.left()); + for (int32_t y = fill.top() + 1; y <= fill.bottom(); y++) { - destrow = &pixt(y, fill.min_x); + destrow = &pixt(y, fill.left()); memcpy(destrow, destrow0, fill.width() * 2); } } @@ -423,21 +423,21 @@ void bitmap_t::fill(uint32_t color, const rectangle &cliprect) // 32bpp can use memset if the bytes are equal if ((uint8_t)(color >> 8) == (uint8_t)color && (uint16_t)(color >> 16) == (uint16_t)color) { - for (int32_t y = fill.min_y; y <= fill.max_y; y++) - memset(&pixt(y, fill.min_x), (uint8_t)color, fill.width() * 4); + for (int32_t y = fill.top(); y <= fill.bottom(); y++) + memset(&pixt(y, fill.left()), uint8_t(color), fill.width() * 4); } else { // Fill the first line the hard way - uint32_t *destrow = &pixt(fill.min_y); - for (int32_t x = fill.min_x; x <= fill.max_x; x++) - destrow[x] = (uint32_t)color; + uint32_t *destrow = &pixt(fill.top()); + for (int32_t x = fill.left(); x <= fill.right(); x++) + destrow[x] = uint32_t(color); // For the other lines, just copy the first one - uint32_t *destrow0 = &pixt(fill.min_y, fill.min_x); - for (int32_t y = fill.min_y + 1; y <= fill.max_y; y++) + uint32_t *destrow0 = &pixt(fill.top(), fill.left()); + for (int32_t y = fill.top() + 1; y <= fill.bottom(); y++) { - destrow = &pixt(y, fill.min_x); + destrow = &pixt(y, fill.left()); memcpy(destrow, destrow0, fill.width() * 4); } } @@ -445,23 +445,23 @@ void bitmap_t::fill(uint32_t color, const rectangle &cliprect) case 64: // 64bpp can use memset if the bytes are equal - if ((uint8_t)(color >> 8) == (uint8_t)color && (uint16_t)(color >> 16) == (uint16_t)color) + if (uint8_t(color >> 8) == uint8_t(color) && uint16_t(color >> 16) == uint16_t(color)) // FIXME: really? wat about the upper bits that would be zeroed when done the "hard way"? { - for (int32_t y = fill.min_y; y <= fill.max_y; y++) - memset(&pixt(y, fill.min_x), (uint8_t)color, fill.width() * 8); + for (int32_t y = fill.top(); y <= fill.bottom(); y++) + memset(&pixt(y, fill.left()), uint8_t(color), fill.width() * 8); } else { // Fill the first line the hard way - uint64_t *destrow = &pixt(fill.min_y); - for (int32_t x = fill.min_x; x <= fill.max_x; x++) - destrow[x] = (uint64_t)color; + uint64_t *destrow = &pixt(fill.top()); + for (int32_t x = fill.left(); x <= fill.right(); x++) + destrow[x] = uint64_t(color); // For the other lines, just copy the first one - uint64_t *destrow0 = &pixt(fill.min_y, fill.min_x); - for (int32_t y = fill.min_y + 1; y <= fill.max_y; y++) + uint64_t *destrow0 = &pixt(fill.top(), fill.left()); + for (int32_t y = fill.top() + 1; y <= fill.bottom(); y++) { - destrow = &pixt(y, fill.min_x); + destrow = &pixt(y, fill.left()); memcpy(destrow, destrow0, fill.width() * 8); } } diff --git a/src/lib/util/bitmap.h b/src/lib/util/bitmap.h index 7b0fc34610f..efb18f7e456 100644 --- a/src/lib/util/bitmap.h +++ b/src/lib/util/bitmap.h @@ -43,16 +43,16 @@ class rectangle { public: // construction/destruction - rectangle() - : min_x(0), max_x(0), min_y(0), max_y(0) { } - rectangle(int32_t minx, int32_t maxx, int32_t miny, int32_t maxy) - : min_x(minx), max_x(maxx), min_y(miny), max_y(maxy) { } + constexpr rectangle() { } + constexpr rectangle(int32_t minx, int32_t maxx, int32_t miny, int32_t maxy) + : min_x(minx), max_x(maxx), min_y(miny), max_y(maxy) + { } // getters - int32_t left() const { return min_x; } - int32_t right() const { return max_x; } - int32_t top() const { return min_y; } - int32_t bottom() const { return max_y; } + constexpr int32_t left() const { return min_x; } + constexpr int32_t right() const { return max_x; } + constexpr int32_t top() const { return min_y; } + constexpr int32_t bottom() const { return max_y; } // compute intersection with another rect rectangle &operator&=(const rectangle &src) @@ -75,21 +75,21 @@ public: } // comparisons - bool operator==(const rectangle &rhs) const { return min_x == rhs.min_x && max_x == rhs.max_x && min_y == rhs.min_y && max_y == rhs.max_y; } - bool operator!=(const rectangle &rhs) const { return min_x != rhs.min_x || max_x != rhs.max_x || min_y != rhs.min_y || max_y != rhs.max_y; } - bool operator>(const rectangle &rhs) const { return min_x < rhs.min_x && min_y < rhs.min_y && max_x > rhs.max_x && max_y > rhs.max_y; } - bool operator>=(const rectangle &rhs) const { return min_x <= rhs.min_x && min_y <= rhs.min_y && max_x >= rhs.max_x && max_y >= rhs.max_y; } - bool operator<(const rectangle &rhs) const { return min_x >= rhs.min_x || min_y >= rhs.min_y || max_x <= rhs.max_x || max_y <= rhs.max_y; } - bool operator<=(const rectangle &rhs) const { return min_x > rhs.min_x || min_y > rhs.min_y || max_x < rhs.max_x || max_y < rhs.max_y; } + constexpr bool operator==(const rectangle &rhs) const { return min_x == rhs.min_x && max_x == rhs.max_x && min_y == rhs.min_y && max_y == rhs.max_y; } + constexpr bool operator!=(const rectangle &rhs) const { return min_x != rhs.min_x || max_x != rhs.max_x || min_y != rhs.min_y || max_y != rhs.max_y; } + constexpr bool operator>(const rectangle &rhs) const { return min_x < rhs.min_x && min_y < rhs.min_y && max_x > rhs.max_x && max_y > rhs.max_y; } + constexpr bool operator>=(const rectangle &rhs) const { return min_x <= rhs.min_x && min_y <= rhs.min_y && max_x >= rhs.max_x && max_y >= rhs.max_y; } + constexpr bool operator<(const rectangle &rhs) const { return min_x >= rhs.min_x || min_y >= rhs.min_y || max_x <= rhs.max_x || max_y <= rhs.max_y; } + constexpr bool operator<=(const rectangle &rhs) const { return min_x > rhs.min_x || min_y > rhs.min_y || max_x < rhs.max_x || max_y < rhs.max_y; } // other helpers - bool empty() const { return (min_x > max_x || min_y > max_y); } - bool contains(int32_t x, int32_t y) const { return (x >= min_x && x <= max_x && y >= min_y && y <= max_y); } - bool contains(const rectangle &rect) const { return (min_x <= rect.min_x && max_x >= rect.max_x && min_y <= rect.min_y && max_y >= rect.max_y); } - int32_t width() const { return max_x + 1 - min_x; } - int32_t height() const { return max_y + 1 - min_y; } - int32_t xcenter() const { return (min_x + max_x + 1) / 2; } - int32_t ycenter() const { return (min_y + max_y + 1) / 2; } + constexpr bool empty() const { return (min_x > max_x) || (min_y > max_y); } + constexpr bool contains(int32_t x, int32_t y) const { return (x >= min_x) && (x <= max_x) && (y >= min_y) && (y <= max_y); } + constexpr bool contains(const rectangle &rect) const { return (min_x <= rect.min_x) && (max_x >= rect.max_x) && (min_y <= rect.min_y) && (max_y >= rect.max_y); } + constexpr int32_t width() const { return max_x + 1 - min_x; } + constexpr int32_t height() const { return max_y + 1 - min_y; } + constexpr int32_t xcenter() const { return (min_x + max_x + 1) / 2; } + constexpr int32_t ycenter() const { return (min_y + max_y + 1) / 2; } // setters void set(int32_t minx, int32_t maxx, int32_t miny, int32_t maxy) { min_x = minx; max_x = maxx; min_y = miny; max_y = maxy; } @@ -106,10 +106,10 @@ public: void offsety(int32_t delta) { min_y += delta; max_y += delta; } // internal state - int32_t min_x; // minimum X, or left coordinate - int32_t max_x; // maximum X, or right coordinate (inclusive) - int32_t min_y; // minimum Y, or top coordinate - int32_t max_y; // maximum Y, or bottom coordinate (inclusive) + int32_t min_x = 0; // minimum X, or left coordinate + int32_t max_x = 0; // maximum X, or right coordinate (inclusive) + int32_t min_y = 0; // minimum Y, or top coordinate + int32_t max_y = 0; // maximum Y, or bottom coordinate (inclusive) }; diff --git a/src/mame/drivers/accomm.cpp b/src/mame/drivers/accomm.cpp index 4670a882007..9ef4100f7d1 100644 --- a/src/mame/drivers/accomm.cpp +++ b/src/mame/drivers/accomm.cpp @@ -238,17 +238,15 @@ uint32_t accomm_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap { int i; int x = 0; - int pal[16]; int scanline = screen.vpos(); rectangle r = cliprect; - r.min_y = r.max_y = scanline; + r.sety(scanline, scanline); if (scanline == 0) - { m_ula.screen_addr = m_ula.screen_start - m_ula.screen_base; - } /* set up palette */ + int pal[16]; switch( m_ula.screen_mode ) { case 0: case 3: case 4: case 6: case 7: /* 2 colour mode */ diff --git a/src/mame/drivers/alg.cpp b/src/mame/drivers/alg.cpp index b72d8a61b3a..96dc185ba6b 100644 --- a/src/mame/drivers/alg.cpp +++ b/src/mame/drivers/alg.cpp @@ -102,8 +102,8 @@ int alg_state::get_lightgun_pos(int player, int *x, int *y) if (xpos == -1 || ypos == -1) return false; - *x = visarea.min_x + xpos * visarea.width() / 255; - *y = visarea.min_y + ypos * visarea.height() / 255; + *x = visarea.left() + xpos * visarea.width() / 255; + *y = visarea.top() + ypos * visarea.height() / 255; return true; } diff --git a/src/mame/drivers/apple1.cpp b/src/mame/drivers/apple1.cpp index bb81a6bdc85..36b9ecf6fa3 100644 --- a/src/mame/drivers/apple1.cpp +++ b/src/mame/drivers/apple1.cpp @@ -358,14 +358,14 @@ uint32_t apple1_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap // the cursor 555 timer counts 0.52 of a second; the cursor is ON for // 2 of those counts and OFF for the last one. - if (((int)(machine().time().as_double() / (0.52 / 3.0)) % 3) < 2) + if ((int(machine().time().as_double() / (0.52 / 3.0)) % 3) < 2) { curs_save = m_vram[(m_cursy * 40) + m_cursx]; m_vram[(m_cursy * 40) + m_cursx] = 0x40; cursor_blink = 1; } - for (int row = 0; row < cliprect.max_y; row += 8) + for (int row = 0; row < cliprect.bottom(); row += 8) { for (int col = 0; col < 40; col++) { diff --git a/src/mame/drivers/astrof.cpp b/src/mame/drivers/astrof.cpp index c6f3f85802b..954418c4465 100644 --- a/src/mame/drivers/astrof.cpp +++ b/src/mame/drivers/astrof.cpp @@ -374,7 +374,7 @@ void astrof_state::video_update_common( bitmap_rgb32 &bitmap, const rectangle &c if (!m_flipscreen) y = ~y; - if ((y <= cliprect.min_y) || (y >= cliprect.max_y)) + if ((y <= cliprect.top()) || (y >= cliprect.bottom())) continue; if (m_screen_off) diff --git a/src/mame/drivers/atarisy4.cpp b/src/mame/drivers/atarisy4.cpp index 977845b7795..4ccb756928e 100644 --- a/src/mame/drivers/atarisy4.cpp +++ b/src/mame/drivers/atarisy4.cpp @@ -245,13 +245,13 @@ uint32_t atarisy4_state::screen_update_atarisy4(screen_device &screen, bitmap_rg //uint32_t offset = m_gpu.dpr << 5; - for (y = cliprect.min_y; y <= cliprect.max_y; ++y) + for (y = cliprect.top(); y <= cliprect.bottom(); ++y) { uint16_t *src = &m_screen_ram[(offset + (4096 * y)) / 2]; - uint32_t *dest = &bitmap.pix32(y, cliprect.min_x); + uint32_t *dest = &bitmap.pix32(y, cliprect.left()); int x; - for (x = cliprect.min_x; x < cliprect.max_x; x += 2) + for (x = cliprect.left(); x < cliprect.right(); x += 2) { uint16_t data = *src++; diff --git a/src/mame/drivers/bfcobra.cpp b/src/mame/drivers/bfcobra.cpp index 0215b85ce1c..c38ea142449 100644 --- a/src/mame/drivers/bfcobra.cpp +++ b/src/mame/drivers/bfcobra.cpp @@ -408,13 +408,13 @@ uint32_t bfcobra_state::screen_update_bfcobra(screen_device &screen, bitmap_rgb3 lorescol = m_col8bit; } - for (y = cliprect.min_y; y <= cliprect.max_y; ++y) + for (y = cliprect.top(); y <= cliprect.bottom(); ++y) { uint16_t y_offset = (y + m_v_scroll) * 256; src = &m_video_ram[offset + y_offset]; dest = &bitmap.pix32(y); - for (x = cliprect.min_x; x <= cliprect.max_x / 2; ++x) + for (x = cliprect.left(); x <= cliprect.right() / 2; ++x) { uint8_t x_offset = x + m_h_scroll; uint8_t pen = *(src + x_offset); diff --git a/src/mame/drivers/bmcpokr.cpp b/src/mame/drivers/bmcpokr.cpp index 288882bc8de..fcd3c212560 100644 --- a/src/mame/drivers/bmcpokr.cpp +++ b/src/mame/drivers/bmcpokr.cpp @@ -236,11 +236,10 @@ void bmcpokr_state::draw_layer(screen_device &screen, bitmap_ind16 &bitmap, cons { if (linescroll) { - if ( (y < cliprect.min_y) || (y > cliprect.max_y) ) + if ( (y < cliprect.top()) || (y > cliprect.bottom()) ) continue; - clip.min_y = y; - clip.max_y = y; + clip.sety(y, y); } int sx = (scroll[y] & 0xff) * 4; diff --git a/src/mame/drivers/c65.cpp b/src/mame/drivers/c65.cpp index 770b4a7fd61..597a6ed16c1 100644 --- a/src/mame/drivers/c65.cpp +++ b/src/mame/drivers/c65.cpp @@ -147,9 +147,9 @@ uint32_t c65_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, uint8_t *cptr = &m_iplrom[((m_VIC3_ControlA & 0x40) ? 0x9000: 0xd000) + ((m_VIC2_VS_CB_Base & 0x2) << 10)]; // TODO: border area - for(int y=cliprect.min_y;y<=cliprect.max_y;y++) + for(int y=cliprect.top();y<=cliprect.bottom();y++) { - for(int x=cliprect.min_x;x<=cliprect.max_x;x++) + for(int x=cliprect.left();x<=cliprect.right();x++) { //int, xi,yi,xm,ym,dot_x; int xi = inner_x_char(x / pixel_width); diff --git a/src/mame/drivers/casloopy.cpp b/src/mame/drivers/casloopy.cpp index ff2df37a817..060dfdd4a95 100644 --- a/src/mame/drivers/casloopy.cpp +++ b/src/mame/drivers/casloopy.cpp @@ -297,7 +297,7 @@ uint32_t casloopy_state::screen_update(screen_device &screen, bitmap_ind16 &bitm count = test; - for (y=cliprect.min_y;y myclip.max_x+1 ) + if( ex > myclip.right()+1 ) { /* clip right */ - int pixels = ex-myclip.max_x-1; + int pixels = ex-myclip.right()-1; ex -= pixels; } - if( ey > myclip.max_y+1 ) + if( ey > myclip.bottom()+1 ) { /* clip bottom */ - int pixels = ey-myclip.max_y-1; + int pixels = ey-myclip.bottom()-1; ey -= pixels; } @@ -985,11 +985,11 @@ void cps3_state::cps3_draw_tilemapsprite_line(int tmnum, int drawline, bitmap_rg drawline&=0x3ff; - if (drawline>cliprect.max_y+4) return; + if (drawline>cliprect.bottom()+4) return; - clip.set(cliprect.min_x, cliprect.max_x, drawline, drawline); + clip.set(cliprect.left(), cliprect.right(), drawline, drawline); - for (x=0;x<(cliprect.max_x/16)+2;x++) + for (x=0;x<(cliprect.right()/16)+2;x++) { uint32_t dat; int tileno; @@ -1057,10 +1057,9 @@ uint32_t cps3_state::screen_update_cps3(screen_device &screen, bitmap_rgb32 &bit fszx = (fullscreenzoomx<<16)/0x40; fszy = (fullscreenzoomy<<16)/0x40; - m_renderbuffer_clip.min_x = 0; - m_renderbuffer_clip.max_x = ((m_screenwidth*fszx)>>16)-1; - m_renderbuffer_clip.min_y = 0; - m_renderbuffer_clip.max_y = ((224*fszx)>>16)-1; + m_renderbuffer_clip.set( + 0, ((m_screenwidth*fszx)>>16)-1, + 0, ((224*fszx)>>16)-1); m_renderbuffer_bitmap.fill(0, m_renderbuffer_clip); diff --git a/src/mame/drivers/ddenlovr.cpp b/src/mame/drivers/ddenlovr.cpp index fce55440bad..0097e04ec0d 100644 --- a/src/mame/drivers/ddenlovr.cpp +++ b/src/mame/drivers/ddenlovr.cpp @@ -1633,9 +1633,9 @@ void ddenlovr_state::copylayer(bitmap_ind16 &bitmap, const rectangle &cliprect, if (((m_ddenlovr_layer_enable2 << 4) | m_ddenlovr_layer_enable) & (1 << layer)) { - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (y = cliprect.top(); y <= cliprect.bottom(); y++) { - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (x = cliprect.left(); x <= cliprect.right(); x++) { int pen = m_ddenlovr_pixmap[layer][512 * ((y + scrolly) & 0x1ff) + ((x + scrollx) & 0x1ff)]; if ((pen & transmask) != transpen) diff --git a/src/mame/drivers/dooyong.cpp b/src/mame/drivers/dooyong.cpp index 148e828b8c5..fa73754a06d 100644 --- a/src/mame/drivers/dooyong.cpp +++ b/src/mame/drivers/dooyong.cpp @@ -691,7 +691,7 @@ void dooyong_68k_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap int const color = buffered_spriteram[offs+7] & 0x000f; //TODO: This priority mechanism works for known games, but seems a bit strange. //Are we missing something? (The obvious spare palette bit isn't it.) - int const pri = (((color == 0x00) || (color == 0x0f)) ? 0xfc : 0xf0); + int const pri = GFX_PMASK_4 | (((color == 0x00) || (color == 0x0f)) ? GFX_PMASK_2 : 0); int const width = buffered_spriteram[offs+1] & 0x000f; int const height = (buffered_spriteram[offs+1] & 0x00f0) >> 4; @@ -753,12 +753,12 @@ uint32_t popbingo_state::screen_update_popbingo(screen_device &screen, bitmap_in m_bg_bitmap[1].fill(m_palette->black_pen(), cliprect); m_bg[1]->draw(screen, m_bg_bitmap[1], cliprect, 0, 1); - for (int y = cliprect.min_y; cliprect.max_y >= y; y++) + for (int y = cliprect.top(); cliprect.bottom() >= y; y++) { uint16_t const *const bg_src(&m_bg_bitmap[0].pix16(y, 0)); uint16_t const *const bg2_src(&m_bg_bitmap[1].pix16(y, 0)); uint16_t *const dst(&bitmap.pix16(y, 0)); - for (int x = cliprect.min_x; cliprect.max_x >= x; x++) + for (int x = cliprect.left(); cliprect.right() >= x; x++) dst[x] = 0x100U | (bg_src[x] << 4) | bg2_src[x]; } diff --git a/src/mame/drivers/firefox.cpp b/src/mame/drivers/firefox.cpp index 994b6f47edb..bbd1994f3f9 100644 --- a/src/mame/drivers/firefox.cpp +++ b/src/mame/drivers/firefox.cpp @@ -251,14 +251,14 @@ void firefox_state::video_start() { m_bgtiles = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(firefox_state::bgtile_get_info),this), TILEMAP_SCAN_ROWS, 8,8, 64,64); m_bgtiles->set_transparent_pen(0); - m_bgtiles->set_scrolldy(m_screen->visible_area().min_y, 0); + m_bgtiles->set_scrolldy(m_screen->visible_area().top(), 0); } uint32_t firefox_state::screen_update_firefox(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { int sprite; - int gfxtop = screen.visible_area().min_y; + int gfxtop = screen.visible_area().top(); bitmap.fill(m_palette->pen_color(256), cliprect); diff --git a/src/mame/drivers/fp200.cpp b/src/mame/drivers/fp200.cpp index 478ac7c536a..61753f3f7ad 100644 --- a/src/mame/drivers/fp200.cpp +++ b/src/mame/drivers/fp200.cpp @@ -98,7 +98,7 @@ uint32_t fp200_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap l_offs = 0; r_offs = 0; - for(int y=cliprect.min_y;y= 224) src3 = &videoram[get_bit3_addr(effy << 8)]; - /* loop over X */ - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + // loop over X + for (x = cliprect.left(); x <= cliprect.right(); x++) { uint8_t pix = src[x / 4] >> (x & 3); pix = ((pix >> 2) & 4) | ((pix << 1) & 2); - /* if we're in the lower region, get the 3rd bit */ - if (src3 != nullptr) + // if we're in the lower region, get the 3rd bit + if (src3) pix |= (src3[(x / 8) * 2] >> (x & 7)) & 1; dst[x] = pix; diff --git a/src/mame/drivers/popobear.cpp b/src/mame/drivers/popobear.cpp index f973e7daa78..de8ae698ff4 100644 --- a/src/mame/drivers/popobear.cpp +++ b/src/mame/drivers/popobear.cpp @@ -414,7 +414,7 @@ uint32_t popobear_state::screen_update(screen_device &screen, bitmap_ind16 &bitm uint16_t val = m_vram[scrollbase/2 + line]; uint16_t upper = (m_vram[scrollbase2/2 + line]&0xff00)>>8; - clip.min_y = clip.max_y = line; + clip.sety(line, line); m_bg_tilemap[1]->set_scrollx(0,(val&0x00ff) | (upper << 8)); m_bg_tilemap[1]->set_scrolly(0,((val&0xff00)>>8)-line); @@ -439,7 +439,7 @@ uint32_t popobear_state::screen_update(screen_device &screen, bitmap_ind16 &bitm uint16_t val = m_vram[scrollbase/2 + line]; uint16_t upper = (m_vram[scrollbase2/2 + line]&0x00ff)>>0; - clip.min_y = clip.max_y = line; + clip.sety(line, line); m_bg_tilemap[0]->set_scrollx(0,(val&0x00ff) | (upper << 8)); m_bg_tilemap[0]->set_scrolly(0,((val&0xff00)>>8)-line); diff --git a/src/mame/drivers/riscpc.cpp b/src/mame/drivers/riscpc.cpp index 0ccd9663b15..b08056fdbfa 100644 --- a/src/mame/drivers/riscpc.cpp +++ b/src/mame/drivers/riscpc.cpp @@ -196,10 +196,11 @@ void riscpc_state::vidc20_dynamic_screen_change() hblank_period = (m_vidc20_horz_reg[HCR] & 0x3ffc); vblank_period = (m_vidc20_vert_reg[VCR] & 0x3fff); /* note that we use the border registers as the visible area */ - visarea.min_x = (m_vidc20_horz_reg[HBSR] & 0x3ffe); - visarea.max_x = (m_vidc20_horz_reg[HBER] & 0x3ffe)-1; - visarea.min_y = (m_vidc20_vert_reg[VBSR] & 0x1fff); - visarea.max_y = (m_vidc20_vert_reg[VBER] & 0x1fff)-1; + visarea.set( + (m_vidc20_horz_reg[HBSR] & 0x3ffe), + (m_vidc20_horz_reg[HBER] & 0x3ffe) - 1, + (m_vidc20_vert_reg[VBSR] & 0x1fff), + (m_vidc20_vert_reg[VBER] & 0x1fff) - 1); m_screen->configure(hblank_period, vblank_period, visarea, m_screen->frame_period().attoseconds() ); logerror("VIDC20: successfully changed the screen to:\n Display Size = %d x %d\n Border Size %d x %d\n Cycle Period %d x %d\n", diff --git a/src/mame/drivers/sbrkout.cpp b/src/mame/drivers/sbrkout.cpp index a4f68428d88..3ad241a169a 100644 --- a/src/mame/drivers/sbrkout.cpp +++ b/src/mame/drivers/sbrkout.cpp @@ -182,7 +182,7 @@ TIMER_CALLBACK_MEMBER(sbrkout_state::scanline_callback) m_dac->write((videoram[0x380 + 0x11] & (scanline >> 2)) != 0); /* on the VBLANK, read the pot and schedule an interrupt time for it */ - if (scanline == m_screen->visible_area().max_y + 1) + if (scanline == m_screen->visible_area().bottom() + 1) { uint8_t potvalue = ioport("PADDLE")->read(); m_pot_timer->adjust(m_screen->time_until_pos(56 + (potvalue / 2), (potvalue % 2) * 128)); @@ -322,7 +322,7 @@ WRITE_LINE_MEMBER(sbrkout_state::coincount_w) READ8_MEMBER(sbrkout_state::sync_r) { int hpos = m_screen->hpos(); - m_sync2_value = (hpos >= 128 && hpos <= m_screen->visible_area().max_x); + m_sync2_value = (hpos >= 128 && hpos <= m_screen->visible_area().right()); return m_screen->vpos(); } diff --git a/src/mame/includes/realbrk.h b/src/mame/includes/realbrk.h index 6e40143e1e0..14a548366eb 100644 --- a/src/mame/includes/realbrk.h +++ b/src/mame/includes/realbrk.h @@ -1,5 +1,10 @@ // license:BSD-3-Clause // copyright-holders:Luca Elia +#ifndef MAME_INCLUDES_REALBRK_H +#define MAME_INCLUDES_REALBRK_H + +#pragma once + #include "machine/tmp68301.h" #include "emupal.h" #include "screen.h" @@ -79,8 +84,7 @@ private: uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_dai2kaku(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, int layer); - void dai2kaku_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, int layer); + template void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, int layer); DECLARE_WRITE_LINE_MEMBER(vblank_irq); void base_mem(address_map &map); @@ -89,3 +93,5 @@ private: void pkgnshdx_mem(address_map &map); void realbrk_mem(address_map &map); }; + +#endif // MAME_INCLUDES_REALBRK_H diff --git a/src/mame/machine/amiga.cpp b/src/mame/machine/amiga.cpp index 89c7f28ae8c..bcda93d108c 100644 --- a/src/mame/machine/amiga.cpp +++ b/src/mame/machine/amiga.cpp @@ -278,7 +278,7 @@ TIMER_CALLBACK_MEMBER( amiga_state::scanline_callback ) } // vblank end - if (scanline == m_screen->visible_area().min_y) + if (scanline == m_screen->visible_area().top()) { m_cia_0->tod_w(0); } diff --git a/src/mame/machine/archimds.cpp b/src/mame/machine/archimds.cpp index 18168ddeb59..088c2bc21e1 100644 --- a/src/mame/machine/archimds.cpp +++ b/src/mame/machine/archimds.cpp @@ -884,22 +884,18 @@ void archimedes_state::vidc_dynamic_res_change() (m_vidc_regs[VIDC_HBER] >= m_vidc_regs[VIDC_HBSR]) && (m_vidc_regs[VIDC_VBER] >= m_vidc_regs[VIDC_VBSR])) { - rectangle visarea; - attoseconds_t refresh; - - visarea.min_x = 0; - visarea.min_y = 0; - visarea.max_x = m_vidc_regs[VIDC_HBER] - m_vidc_regs[VIDC_HBSR] - 1; - visarea.max_y = (m_vidc_regs[VIDC_VBER] - m_vidc_regs[VIDC_VBSR]) * (m_vidc_interlace+1); + rectangle const visarea( + 0, m_vidc_regs[VIDC_HBER] - m_vidc_regs[VIDC_HBSR] - 1, + 0, (m_vidc_regs[VIDC_VBER] - m_vidc_regs[VIDC_VBSR]) * (m_vidc_interlace + 1)); m_vidc_vblank_time = m_vidc_regs[VIDC_VBER] * (m_vidc_interlace+1); //logerror("Configuring: htotal %d vtotal %d border %d x %d display origin %d x %d vblank = %d\n", // m_vidc_regs[VIDC_HCR], m_vidc_regs[VIDC_VCR], - // visarea.max_x, visarea.max_y, + // visarea.right(), visarea.bottom(), // m_vidc_regs[VIDC_HDER]-m_vidc_regs[VIDC_HDSR],m_vidc_regs[VIDC_VDER]-m_vidc_regs[VIDC_VDSR]+1, // m_vidc_vblank_time); - refresh = HZ_TO_ATTOSECONDS(pixel_rate[m_vidc_pixel_clk]) * m_vidc_regs[VIDC_HCR] * m_vidc_regs[VIDC_VCR]; + attoseconds_t const refresh = HZ_TO_ATTOSECONDS(pixel_rate[m_vidc_pixel_clk]) * m_vidc_regs[VIDC_HCR] * m_vidc_regs[VIDC_VCR]; m_screen->configure(m_vidc_regs[VIDC_HCR], m_vidc_regs[VIDC_VCR] * (m_vidc_interlace+1), visarea, refresh); } diff --git a/src/mame/machine/deco_irq.cpp b/src/mame/machine/deco_irq.cpp index c22ca908adc..0654edc8755 100644 --- a/src/mame/machine/deco_irq.cpp +++ b/src/mame/machine/deco_irq.cpp @@ -108,14 +108,14 @@ TIMER_CALLBACK_MEMBER( deco_irq_device::scanline_callback ) } // lightgun? - if (m_lightgun_latch >= visible.min_y && m_lightgun_latch <= visible.max_y && y == m_lightgun_latch) + if (m_lightgun_latch >= visible.top() && m_lightgun_latch <= visible.bottom() && y == m_lightgun_latch) { m_lightgun_irq = true; m_lightgun_irq_cb(ASSERT_LINE); } // vblank-in? - if (y == (visible.max_y + 1)) + if (y == (visible.bottom() + 1)) { m_vblank_irq = true; m_vblank_irq_cb(ASSERT_LINE); diff --git a/src/mame/machine/electron.cpp b/src/mame/machine/electron.cpp index 725a57bb467..269ba54aa98 100644 --- a/src/mame/machine/electron.cpp +++ b/src/mame/machine/electron.cpp @@ -18,9 +18,9 @@ void electron_state::waitforramsync() { int cycles = 0; - if (!(m_ula.screen_mode & 4) && (m_screen->vpos() > m_screen->visible_area().min_y) && (m_screen->vpos() < m_screen->visible_area().max_y) && !m_screen->hblank()) + if (!(m_ula.screen_mode & 4) && (m_screen->vpos() > m_screen->visible_area().top()) && (m_screen->vpos() < m_screen->visible_area().bottom()) && !m_screen->hblank()) { - cycles += (m_screen->visible_area().max_x - m_screen->hpos()) / 16; + cycles += (m_screen->visible_area().right() - m_screen->hpos()) / 16; } if (cycles & 1) cycles++; diff --git a/src/mame/video/agat7.cpp b/src/mame/video/agat7.cpp index da54f00fdde..e165ae96c60 100644 --- a/src/mame/video/agat7.cpp +++ b/src/mame/video/agat7.cpp @@ -168,8 +168,8 @@ void agat7video_device::text_update_lores(screen_device &screen, bitmap_ind16 &b int fg = 0; int bg = 0; - beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); - endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); + beginrow = std::max(beginrow, cliprect.top() - (cliprect.top() % 8)); + endrow = std::min(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); for (row = beginrow; row <= endrow; row += 8) { @@ -198,8 +198,8 @@ void agat7video_device::text_update_hires(screen_device &screen, bitmap_ind16 &b uint8_t ch; int fg, bg; - beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); - endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); + beginrow = std::max(beginrow, cliprect.top() - (cliprect.top() % 8)); + endrow = std::min(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); if (m_start_address & 0x800) { fg = 7; bg = 0; @@ -227,8 +227,8 @@ void agat7video_device::graph_update_mono(screen_device &screen, bitmap_ind16 &b uint8_t gfx, v; int fg = 7, bg = 0; - beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); - endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); + beginrow = std::max(beginrow, cliprect.top() - (cliprect.top() % 8)); + endrow = std::min(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); for (row = beginrow; row <= endrow; row++) { @@ -256,8 +256,8 @@ void agat7video_device::graph_update_hires(screen_device &screen, bitmap_ind16 & uint16_t *p; uint8_t gfx, v; - beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); - endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); + beginrow = std::max(beginrow, cliprect.top() - (cliprect.top() % 8)); + endrow = std::min(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); for (row = beginrow; row <= endrow; row++) { @@ -287,8 +287,8 @@ void agat7video_device::graph_update_lores(screen_device &screen, bitmap_ind16 & uint16_t *p; uint8_t gfx, v; - beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); - endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); + beginrow = std::max(beginrow, cliprect.top() - (cliprect.top() % 8)); + endrow = std::min(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); for (row = beginrow; row <= endrow; row++) { diff --git a/src/mame/video/amiga.cpp b/src/mame/video/amiga.cpp index 83bf7d1dc8f..7409e5d471e 100644 --- a/src/mame/video/amiga.cpp +++ b/src/mame/video/amiga.cpp @@ -817,7 +817,7 @@ void amiga_state::render_scanline(bitmap_ind16 &bitmap, int scanline) /* to render, we must have bitplane DMA enabled, at least 1 plane, and be within the */ /* vertical display window */ if ((CUSTOM_REG(REG_DMACON) & (DMACON_BPLEN | DMACON_DMAEN)) == (DMACON_BPLEN | DMACON_DMAEN) && - planes > 0 && scanline >= m_diw.min_y && scanline < m_diw.max_y) + planes > 0 && scanline >= m_diw.top() && scanline < m_diw.bottom()) { int pfpix0 = 0, pfpix1 = 0, collide; @@ -922,7 +922,7 @@ void amiga_state::render_scanline(bitmap_ind16 &bitmap, int scanline) CUSTOM_REG(REG_CLXDAT) |= 0x001; /* if we are within the display region, render */ - if (dst != nullptr && x >= m_diw.min_x && x < m_diw.max_x) + if (dst != nullptr && x >= m_diw.left() && x < m_diw.right()) { int pix, pri; @@ -1012,7 +1012,7 @@ void amiga_state::render_scanline(bitmap_ind16 &bitmap, int scanline) } // end of the line: time to add the modulos - if (scanline >= m_diw.min_y && scanline < m_diw.max_y) + if (scanline >= m_diw.top() && scanline < m_diw.bottom()) { // update odd planes for (pl = 0; pl < planes; pl += 2) @@ -1054,11 +1054,11 @@ uint32_t amiga_state::screen_update_amiga(screen_device &screen, bitmap_ind16 &b { // sometimes the core tells us to render a bunch of lines to keep up (resolution change, for example) // this causes trouble for us since it can happen at any time - if (cliprect.min_y != cliprect.max_y) + if (cliprect.top() != cliprect.bottom()) return 0; // render each scanline in the visible region - for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) render_scanline(bitmap, y); return 0; diff --git a/src/mame/video/amigaaga.cpp b/src/mame/video/amigaaga.cpp index 0cfc1f23c87..987cbdeb4ad 100644 --- a/src/mame/video/amigaaga.cpp +++ b/src/mame/video/amigaaga.cpp @@ -596,7 +596,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline) /* to render, we must have bitplane DMA enabled, at least 1 plane, and be within the */ /* vertical display window */ if ((CUSTOM_REG(REG_DMACON) & (DMACON_BPLEN | DMACON_DMAEN)) == (DMACON_BPLEN | DMACON_DMAEN) && - planes > 0 && scanline >= m_diw.min_y && scanline < m_diw.max_y) + planes > 0 && scanline >= m_diw.top() && scanline < m_diw.bottom()) { int pfpix0 = 0, pfpix1 = 0, collide; @@ -701,7 +701,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline) CUSTOM_REG(REG_CLXDAT) |= 0x001; /* if we are within the display region, render */ - if (dst != nullptr && x >= m_diw.min_x && x < m_diw.max_x) + if (dst != nullptr && x >= m_diw.left() && x < m_diw.right()) { int pix, pri; @@ -814,7 +814,7 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline) #endif /* end of the line: time to add the modulos */ - if (scanline >= m_diw.min_y && scanline < m_diw.max_y) + if (scanline >= m_diw.top() && scanline < m_diw.bottom()) { /* update odd planes */ for (pl = 0; pl < planes; pl += 2) @@ -853,11 +853,11 @@ void amiga_state::aga_render_scanline(bitmap_rgb32 &bitmap, int scanline) uint32_t amiga_state::screen_update_amiga_aga(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - if (cliprect.min_y != cliprect.max_y) + if (cliprect.top() != cliprect.bottom()) return 0; // render each scanline in the visible region - for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) aga_render_scanline(bitmap, y); return 0; diff --git a/src/mame/video/apple2.cpp b/src/mame/video/apple2.cpp index be61550aa25..31229729742 100644 --- a/src/mame/video/apple2.cpp +++ b/src/mame/video/apple2.cpp @@ -361,8 +361,8 @@ void a2_video_device::lores_update(screen_device &screen, bitmap_ind16 &bitmap, } /* perform adjustments */ - beginrow = std::max(beginrow, cliprect.min_y); - endrow = std::min(endrow, cliprect.max_y); + beginrow = (std::max)(beginrow, cliprect.top()); + endrow = (std::min)(endrow, cliprect.bottom()); if (!(m_sysconfig & 0x03)) { @@ -461,8 +461,8 @@ void a2_video_device::dlores_update(screen_device &screen, bitmap_ind16 &bitmap, } /* perform adjustments */ - beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); - endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); + beginrow = (std::max)(beginrow, cliprect.top() - (cliprect.top() % 8)); + endrow = (std::min)(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); if (!(m_sysconfig & 0x03)) { @@ -607,8 +607,8 @@ void a2_video_device::text_update(screen_device &screen, bitmap_ind16 &bitmap, c start_address = m_page2 ? 0x800 : 0x400; } - beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); - endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); + beginrow = (std::max)(beginrow, cliprect.top() - (cliprect.top() % 8)); + endrow = (std::min)(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); switch (m_sysconfig & 0x03) { @@ -654,8 +654,8 @@ void a2_video_device::text_update_orig(screen_device &screen, bitmap_ind16 &bitm int fg = 0; int bg = 0; - beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); - endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); + beginrow = (std::max)(beginrow, cliprect.top() - (cliprect.top() % 8)); + endrow = (std::min)(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); switch (m_sysconfig & 0x03) { @@ -685,8 +685,8 @@ void a2_video_device::text_update_jplus(screen_device &screen, bitmap_ind16 &bit int fg = 0; int bg = 0; - beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); - endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); + beginrow = (std::max)(beginrow, cliprect.top() - (cliprect.top() % 8)); + endrow = (std::min)(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); switch (m_sysconfig & 0x03) { @@ -716,8 +716,8 @@ void a2_video_device::text_update_ultr(screen_device &screen, bitmap_ind16 &bitm int fg = 0; int bg = 0; - beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); - endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); + beginrow = (std::max)(beginrow, cliprect.top() - (cliprect.top() % 8)); + endrow = (std::min)(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); switch (m_sysconfig & 0x03) { @@ -753,19 +753,19 @@ void a2_video_device::hgr_update(screen_device &screen, bitmap_ind16 &bitmap, co int begincol = 0, endcol = 40; /* sanity checks */ - if (beginrow < cliprect.min_y) - beginrow = cliprect.min_y; - if (endrow > cliprect.max_y) - endrow = cliprect.max_y; + if (beginrow < cliprect.top()) + beginrow = cliprect.top(); + if (endrow > cliprect.bottom()) + endrow = cliprect.bottom(); if (endrow < beginrow) return; // we generate 2 pixels per "column" so adjust - if (begincol < (cliprect.min_x/14)) - begincol = (cliprect.min_x/14); - if (endcol > (cliprect.max_x/14)) - endcol = (cliprect.max_x/14); - if (cliprect.max_x > 39*14) + if (begincol < (cliprect.left()/14)) + begincol = (cliprect.left()/14); + if (endcol > (cliprect.right()/14)) + endcol = (cliprect.right()/14); + if (cliprect.right() > 39*14) endcol = 40; if (endcol < begincol) return; @@ -872,10 +872,10 @@ void a2_video_device::hgr_update_tk2000(screen_device &screen, bitmap_ind16 &bit int mon_type = m_sysconfig & 0x03; /* sanity checks */ - if (beginrow < cliprect.min_y) - beginrow = cliprect.min_y; - if (endrow > cliprect.max_y) - endrow = cliprect.max_y; + if (beginrow < cliprect.top()) + beginrow = cliprect.top(); + if (endrow > cliprect.bottom()) + endrow = cliprect.bottom(); if (endrow < beginrow) return; @@ -962,10 +962,10 @@ void a2_video_device::dhgr_update(screen_device &screen, bitmap_ind16 &bitmap, c int mon_type = m_sysconfig & 0x03; /* sanity checks */ - if (beginrow < cliprect.min_y) - beginrow = cliprect.min_y; - if (endrow > cliprect.max_y) - endrow = cliprect.max_y; + if (beginrow < cliprect.top()) + beginrow = cliprect.top(); + if (endrow > cliprect.bottom()) + endrow = cliprect.bottom(); if (endrow < beginrow) return; @@ -1084,7 +1084,7 @@ uint32_t a2_video_device::screen_update_GS(screen_device &screen, bitmap_rgb32 & int beamy; uint16_t *a2pixel; - beamy = cliprect.min_y; + beamy = cliprect.top(); if (m_newvideo & 0x80) { @@ -1302,8 +1302,8 @@ void a2_video_device::text_updateGS(screen_device &screen, bitmap_ind16 &bitmap, start_address = m_page2 ? 0x800 : 0x400; } - beginrow = std::max(beginrow, cliprect.min_y - (cliprect.min_y % 8)); - endrow = std::min(endrow, cliprect.max_y - (cliprect.max_y % 8) + 7); + beginrow = (std::max)(beginrow, cliprect.top() - (cliprect.top() % 8)); + endrow = (std::min)(endrow, cliprect.bottom() - (cliprect.bottom() % 8) + 7); for (row = beginrow; row <= endrow; row += 8) { diff --git a/src/mame/video/apple3.cpp b/src/mame/video/apple3.cpp index 724907d6c23..cfc4a675c5b 100644 --- a/src/mame/video/apple3.cpp +++ b/src/mame/video/apple3.cpp @@ -149,8 +149,8 @@ void apple3_state::text40(bitmap_ind16 &bitmap, const rectangle &cliprect) uint8_t *ram = m_ram->pointer(); uint32_t ram_size = m_ram->size(); int smooth = m_va | (m_vb << 1) | (m_vc << 2); - int beginrow = (cliprect.min_y - (cliprect.min_y % 8)) / 8; - int endrow = (cliprect.max_y - (cliprect.max_y % 8) + 7) / 8; + int beginrow = (cliprect.top() - (cliprect.top() % 8)) / 8; + int endrow = (cliprect.bottom() - (cliprect.bottom() % 8) + 7) / 8; for (y = beginrow; y <= endrow; y++) { @@ -220,8 +220,8 @@ void apple3_state::text80(bitmap_ind16 &bitmap, const rectangle &cliprect) uint8_t *ram = m_ram->pointer(); uint32_t ram_size = m_ram->size(); int smooth = m_va | (m_vb << 1) | (m_vc << 2); - int beginrow = (cliprect.min_y - (cliprect.min_y % 8)) / 8; - int endrow = (cliprect.max_y - (cliprect.max_y % 8) + 7) / 8; + int beginrow = (cliprect.top() - (cliprect.top() % 8)) / 8; + int endrow = (cliprect.bottom() - (cliprect.bottom() % 8) + 7) / 8; for (y = beginrow; y <= endrow; y++) { @@ -284,7 +284,7 @@ void apple3_state::graphics_hgr(bitmap_ind16 &bitmap, const rectangle &cliprect) uint8_t *ram = m_ram->pointer(); int smooth = m_va | (m_vb << 1) | (m_vc << 2); - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (y = cliprect.top(); y <= cliprect.bottom(); y++) { ly = y; if (m_smoothscr) @@ -329,7 +329,7 @@ void apple3_state::graphics_chgr(bitmap_ind16 &bitmap, const rectangle &cliprect uint8_t *ram = m_ram->pointer(); int smooth = m_va | (m_vb << 1) | (m_vc << 2); - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (y = cliprect.top(); y <= cliprect.bottom(); y++) { ly = y; if (m_smoothscr) @@ -386,7 +386,7 @@ void apple3_state::graphics_shgr(bitmap_ind16 &bitmap, const rectangle &cliprect uint8_t *ram = m_ram->pointer(); int smooth = m_va | (m_vb << 1) | (m_vc << 2); - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (y = cliprect.top(); y <= cliprect.bottom(); y++) { ly = y; if (m_smoothscr) @@ -441,7 +441,7 @@ void apple3_state::graphics_chires(bitmap_ind16 &bitmap, const rectangle &clipre uint8_t *ram = m_ram->pointer(); int smooth = m_va | (m_vb << 1) | (m_vc << 2); - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (y = cliprect.top(); y <= cliprect.bottom(); y++) { ly = y; if (m_smoothscr) diff --git a/src/mame/video/aquarium.cpp b/src/mame/video/aquarium.cpp index 75562c6386f..89a2929e6b5 100644 --- a/src/mame/video/aquarium.cpp +++ b/src/mame/video/aquarium.cpp @@ -80,12 +80,12 @@ void aquarium_state::video_start() void aquarium_state::mix_sprite_bitmap(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority_mask, int priority_value) { - for (int y = cliprect.min_y;y <= cliprect.max_y;y++) + for (int y = cliprect.top();y <= cliprect.bottom();y++) { uint16_t* srcline = &m_temp_sprite_bitmap.pix16(y); uint16_t* dstline = &bitmap.pix16(y); - for (int x = cliprect.min_x;x <= cliprect.max_x;x++) + for (int x = cliprect.left();x <= cliprect.right();x++) { uint16_t pixel = srcline[x]; diff --git a/src/mame/video/arcadecl.cpp b/src/mame/video/arcadecl.cpp index 57569f0040d..446ebb928a5 100644 --- a/src/mame/video/arcadecl.cpp +++ b/src/mame/video/arcadecl.cpp @@ -78,11 +78,11 @@ uint32_t arcadecl_state::screen_update(screen_device &screen, bitmap_ind16 &bitm // draw and merge the MO bitmap_ind16 &mobitmap = m_mob->bitmap(); for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); - for (int x = rect->min_x; x <= rect->max_x; x++) + for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { // not yet verified @@ -104,13 +104,13 @@ uint32_t arcadecl_state::screen_update(screen_device &screen, bitmap_ind16 &bitm uint32_t sparkz_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // update any dirty scanlines - for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { const uint16_t *const src = &m_bitmap[256 * y]; uint16_t *const dst = &bitmap.pix16(y); /* regenerate the line */ - for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) + for (int x = cliprect.left() & ~1; x <= cliprect.right(); x += 2) { int bits = src[(x - 8) / 2]; dst[x + 0] = bits >> 8; diff --git a/src/mame/video/atarig42.cpp b/src/mame/video/atarig42.cpp index b553cc0f512..aa427b3d088 100644 --- a/src/mame/video/atarig42.cpp +++ b/src/mame/video/atarig42.cpp @@ -174,10 +174,10 @@ uint32_t atarig42_state::screen_update_atarig42(screen_device &screen, bitmap_in /* copy the motion objects on top */ { bitmap_ind16 &mo_bitmap = m_rle->vram(0); - int left = cliprect.min_x; - int top = cliprect.min_y; - int right = cliprect.max_x + 1; - int bottom = cliprect.max_y + 1; + int left = cliprect.left(); + int top = cliprect.top(); + int right = cliprect.right() + 1; + int bottom = cliprect.bottom() + 1; int x, y; /* now blend with the playfield */ diff --git a/src/mame/video/atarigt.cpp b/src/mame/video/atarigt.cpp index d9cab371fb3..67563b639c5 100644 --- a/src/mame/video/atarigt.cpp +++ b/src/mame/video/atarigt.cpp @@ -503,7 +503,7 @@ uint32_t atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb3 const pen_t *mram = &m_palette->pens()[(color_latch & 0xc0) << 7]; /* now do the nasty blend */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (y = cliprect.top(); y <= cliprect.bottom(); y++) { uint16_t *an = &m_an_bitmap.pix16(y); uint16_t *pf = &m_pf_bitmap.pix16(y); @@ -514,7 +514,7 @@ uint32_t atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb3 /* Primal Rage: no TRAM, slightly different priorities */ if (m_is_primrage) { - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (x = cliprect.left(); x <= cliprect.right(); x++) { uint8_t pfpri = (pf[x] >> 10) & 7; uint8_t mopri = mo[x] >> ATARIRLE_PRIORITY_SHIFT; @@ -548,7 +548,7 @@ uint32_t atarigt_state::screen_update_atarigt(screen_device &screen, bitmap_rgb3 /* T-Mek: full TRAM and all effects */ else { - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (x = cliprect.left(); x <= cliprect.right(); x++) { uint8_t pfpri = (pf[x] >> 10) & 7; uint8_t mopri = mo[x] >> ATARIRLE_PRIORITY_SHIFT; diff --git a/src/mame/video/atarigx2.cpp b/src/mame/video/atarigx2.cpp index 3159d1980a5..7a0d8229f27 100644 --- a/src/mame/video/atarigx2.cpp +++ b/src/mame/video/atarigx2.cpp @@ -182,10 +182,10 @@ uint32_t atarigx2_state::screen_update_atarigx2(screen_device &screen, bitmap_in /* copy the motion objects on top */ { bitmap_ind16 &mo_bitmap = m_rle->vram(0); - int left = cliprect.min_x; - int top = cliprect.min_y; - int right = cliprect.max_x + 1; - int bottom = cliprect.max_y + 1; + int left = cliprect.left(); + int top = cliprect.top(); + int right = cliprect.left() + 1; + int bottom = cliprect.bottom() + 1; int x, y; /* now blend with the playfield */ diff --git a/src/mame/video/atarimo.cpp b/src/mame/video/atarimo.cpp index 35a63f30a38..589da0a3c5d 100644 --- a/src/mame/video/atarimo.cpp +++ b/src/mame/video/atarimo.cpp @@ -161,8 +161,8 @@ atari_motion_objects_device::atari_motion_objects_device(const machine_config &m void atari_motion_objects_device::draw(bitmap_ind16 &bitmap, const rectangle &cliprect) { // compute start/stop bands - int startband = ((cliprect.min_y + m_yscroll - m_slipoffset) & m_bitmapymask) >> m_slipshift; - int stopband = ((cliprect.max_y + m_yscroll - m_slipoffset) & m_bitmapymask) >> m_slipshift; + int startband = ((cliprect.top() + m_yscroll - m_slipoffset) & m_bitmapymask) >> m_slipshift; + int stopband = ((cliprect.bottom() + m_yscroll - m_slipoffset) & m_bitmapymask) >> m_slipshift; if (startband > stopband) startband -= m_bitmapheight >> m_slipshift; if (m_slipshift == 0) @@ -358,7 +358,7 @@ void atari_motion_objects_device::device_timer(emu_timer &timer, device_timer_id if (param > 0) screen().update_partial(param - 1); param += 64; - if (param >= screen().visible_area().max_y) + if (param >= screen().visible_area().bottom()) param = 0; timer.adjust(screen().time_until_pos(param), param); break; @@ -504,19 +504,19 @@ void atari_motion_objects_device::render_object(bitmap_ind16 &bitmap, const rect for (int y = 0, sy = ypos; y < height; y++, sy += yadv) { // clip the Y coordinate - if (sy <= cliprect.min_y - m_tileheight) + if (sy <= cliprect.top() - m_tileheight) { code += width; continue; } - else if (sy > cliprect.max_y) + else if (sy > cliprect.bottom()) break; // loop over the width for (int x = 0, sx = xpos; x < width; x++, sx += xadv, code++) { // clip the X coordinate - if (sx <= -cliprect.min_x - m_tilewidth || sx > cliprect.max_x) + if (sx <= -cliprect.left() - m_tilewidth || sx > cliprect.right()) continue; // draw the sprite @@ -533,19 +533,19 @@ void atari_motion_objects_device::render_object(bitmap_ind16 &bitmap, const rect for (int x = 0, sx = xpos; x < width; x++, sx += xadv) { // clip the X coordinate - if (sx <= cliprect.min_x - m_tilewidth) + if (sx <= cliprect.left() - m_tilewidth) { code += height; continue; } - else if (sx > cliprect.max_x) + else if (sx > cliprect.right()) break; // loop over the height for (int y = 0, sy = ypos; y < height; y++, sy += yadv, code++) { // clip the X coordinate - if (sy <= -cliprect.min_y - m_tileheight || sy > cliprect.max_y) + if (sy <= -cliprect.top() - m_tileheight || sy > cliprect.bottom()) continue; // draw the sprite diff --git a/src/mame/video/atarirle.cpp b/src/mame/video/atarirle.cpp index 5c54a2a785d..fb5240f2b62 100644 --- a/src/mame/video/atarirle.cpp +++ b/src/mame/video/atarirle.cpp @@ -103,7 +103,7 @@ WRITE8_MEMBER(atari_rle_objects_device::control_write) if (scanline < cliprect.max_y) cliprect.max_y = scanline; -//logerror(" partial erase %d-%d (frame %d)\n", cliprect.min_y, cliprect.max_y, (oldbits & ATARIRLE_CONTROL_FRAME) >> 2); + //logerror(" partial erase %d-%d (frame %d)\n", cliprect.top(), cliprect.bottom(), (oldbits & ATARIRLE_CONTROL_FRAME) >> 2); // erase the bitmap m_vram[0][(oldbits & ATARIRLE_CONTROL_FRAME) >> 2].fill(0, cliprect); @@ -155,7 +155,7 @@ void atari_rle_objects_device::vblank_callback(screen_device &screen, bool state if (m_partial_scanline + 1 > cliprect.min_y) cliprect.min_y = m_partial_scanline + 1; - //logerror(" partial erase %d-%d (frame %d)\n", cliprect.min_y, cliprect.max_y, (m_control_bits & ATARIRLE_CONTROL_FRAME) >> 2); + //logerror(" partial erase %d-%d (frame %d)\n", cliprect.top(), cliprect.bottom(), (m_control_bits & ATARIRLE_CONTROL_FRAME) >> 2); // erase the bitmap m_vram[0][(m_control_bits & ATARIRLE_CONTROL_FRAME) >> 2].fill(0, cliprect); @@ -213,10 +213,7 @@ void atari_rle_objects_device::device_start() // set up a cliprect m_cliprect = screen().visible_area(); if (m_rightclip != 0) - { - m_cliprect.min_x = m_leftclip; - m_cliprect.max_x = m_rightclip; - } + m_cliprect.setx(m_leftclip, m_rightclip); // compute the checksums memset(m_checksums, 0, sizeof(m_checksums)); @@ -500,7 +497,7 @@ if (count++ == atarirle_hilite_index) x = (int16_t)(x | ~m_xposmask.mask()); if (y & ((m_yposmask.mask() + 1) >> 1)) y = (int16_t)(y | ~m_yposmask.mask()); - x += m_cliprect.min_x; + x += m_cliprect.left(); // merge priority and color color = (color << 4) | (priority << ATARIRLE_PRIORITY_SHIFT); @@ -536,7 +533,7 @@ void atari_rle_objects_device::draw_rle(bitmap_ind16 &bitmap, const rectangle &c if (hflip) scaled_xoffs = ((xscale * info.width) >> 12) - scaled_xoffs; -//if (clip.min_y == screen().visible_area().min_y) +//if (clip.top() == screen().visible_area().top()) //logerror(" Sprite: c=%04X l=%04X h=%d X=%4d (o=%4d w=%3d) Y=%4d (o=%4d h=%d) s=%04X\n", // code, color, hflip, // x, -scaled_xoffs, (xscale * info.width) >> 12, @@ -579,30 +576,30 @@ void atari_rle_objects_device::draw_rle_zoom(bitmap_ind16 &bitmap, const rectang // left edge clip int pixels_to_skip = 0; bool xclipped = false; - if (sx < clip.min_x) - pixels_to_skip = clip.min_x - sx, xclipped = true; - if (sx > clip.max_x) + if (sx < clip.left()) + pixels_to_skip = clip.left() - sx, xclipped = true; + if (sx > clip.right()) return; // right edge clip - if (ex > clip.max_x) - ex = clip.max_x, xclipped = true; - else if (ex < clip.min_x) + if (ex > clip.right()) + ex = clip.right(), xclipped = true; + else if (ex < clip.left()) return; // top edge clip - if (sy < clip.min_y) + if (sy < clip.top()) { - sourcey += (clip.min_y - sy) * dy; - sy = clip.min_y; + sourcey += (clip.top() - sy) * dy; + sy = clip.top(); } - else if (sy > clip.max_y) + else if (sy > clip.bottom()) return; // bottom edge clip - if (ey > clip.max_y) - ey = clip.max_y; - else if (ey < clip.min_y) + if (ey > clip.bottom()) + ey = clip.bottom(); + else if (ey < clip.top()) return; // loop top to bottom @@ -758,30 +755,30 @@ void atari_rle_objects_device::draw_rle_zoom_hflip(bitmap_ind16 &bitmap, const r // left edge clip int pixels_to_skip = 0; bool xclipped = false; - if (sx < clip.min_x) - sx = clip.min_x, xclipped = true; - if (sx > clip.max_x) + if (sx < clip.left()) + sx = clip.left(), xclipped = true; + if (sx > clip.right()) return; // right edge clip - if (ex > clip.max_x) - pixels_to_skip = ex - clip.max_x, xclipped = true; - else if (ex < clip.min_x) + if (ex > clip.right()) + pixels_to_skip = ex - clip.right(), xclipped = true; + else if (ex < clip.left()) return; // top edge clip - if (sy < clip.min_y) + if (sy < clip.top()) { - sourcey += (clip.min_y - sy) * dy; - sy = clip.min_y; + sourcey += (clip.top() - sy) * dy; + sy = clip.top(); } - else if (sy > clip.max_y) + else if (sy > clip.bottom()) return; // bottom edge clip - if (ey > clip.max_y) - ey = clip.max_y; - else if (ey < clip.min_y) + if (ey > clip.bottom()) + ey = clip.bottom(); + else if (ey < clip.top()) return; // loop top to bottom @@ -933,10 +930,10 @@ void atari_rle_objects_device::hilite_object(bitmap_ind16 &bitmap, int hilite) int y = m_yposmask.extract(m_ram, hilite); if (x & ((m_xposmask.mask() + 1) >> 1)) - x = (int16_t)(x | ~m_xposmask.mask()); + x = int16_t(x | ~m_xposmask.mask()); if (y & ((m_yposmask.mask() + 1) >> 1)) - y = (int16_t)(y | ~m_yposmask.mask()); - x += m_cliprect.min_x; + y = int16_t(y | ~m_yposmask.mask()); + x += m_cliprect.left(); // merge priority and color color = (color << 4) | (priority << ATARIRLE_PRIORITY_SHIFT); @@ -969,27 +966,27 @@ void atari_rle_objects_device::hilite_object(bitmap_ind16 &bitmap, int hilite) // left edge clip const rectangle &visarea = screen().visible_area(); - if (sx < visarea.min_x) - sx = visarea.min_x; - if (sx > visarea.max_x) + if (sx < visarea.left()) + sx = visarea.left(); + if (sx > visarea.right()) break; // right edge clip - if (ex > visarea.max_x) - ex = visarea.max_x; - else if (ex < visarea.min_x) + if (ex > visarea.right()) + ex = visarea.right(); + else if (ex < visarea.left()) break; // top edge clip - if (sy < visarea.min_y) - sy = visarea.min_y; - else if (sy > visarea.max_y) + if (sy < visarea.top()) + sy = visarea.top(); + else if (sy > visarea.bottom()) break; // bottom edge clip - if (ey > visarea.max_y) - ey = visarea.max_y; - else if (ey < visarea.min_y) + if (ey > visarea.bottom()) + ey = visarea.bottom(); + else if (ey < visarea.left()) break; for (int ty = sy; ty <= ey; ty++) diff --git a/src/mame/video/atarisy1.cpp b/src/mame/video/atarisy1.cpp index be249e8e873..d5f550200b5 100644 --- a/src/mame/video/atarisy1.cpp +++ b/src/mame/video/atarisy1.cpp @@ -291,7 +291,7 @@ WRITE16_MEMBER( atarisy1_state::atarisy1_yscroll_w ) /* because this latches a new value into the scroll base, we need to adjust for the scanline */ adjusted_scroll = newscroll; - if (scanline <= m_screen->visible_area().max_y) + if (scanline <= m_screen->visible_area().bottom()) adjusted_scroll -= (scanline + 1); m_playfield_tilemap->set_scrolly(0, adjusted_scroll); @@ -472,11 +472,11 @@ uint32_t atarisy1_state::screen_update_atarisy1(screen_device &screen, bitmap_in // draw and merge the MO bitmap_ind16 &mobitmap = m_mob->bitmap(); for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); - for (int x = rect->min_x; x <= rect->max_x; x++) + for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { /* high priority MO? */ diff --git a/src/mame/video/atarisy2.cpp b/src/mame/video/atarisy2.cpp index 0c735cccc4f..4dc92540ca8 100644 --- a/src/mame/video/atarisy2.cpp +++ b/src/mame/video/atarisy2.cpp @@ -248,12 +248,12 @@ uint32_t atarisy2_state::screen_update_atarisy2(screen_device &screen, bitmap_in /* draw and merge the MO */ bitmap_ind16 &mobitmap = m_mob->bitmap(); for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); uint8_t *pri = &priority_bitmap.pix8(y); - for (int x = rect->min_x; x <= rect->max_x; x++) + for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; diff --git a/src/mame/video/atarivad.cpp b/src/mame/video/atarivad.cpp index 85a80776954..0798a0d7b8a 100644 --- a/src/mame/video/atarivad.cpp +++ b/src/mame/video/atarivad.cpp @@ -26,24 +26,24 @@ DEFINE_DEVICE_TYPE(ATARI_VAD, atari_vad_device, "atarivad", "Atari VAD") //------------------------------------------------- atari_vad_device::atari_vad_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, ATARI_VAD, tag, owner, clock), - device_video_interface(mconfig, *this), - m_scanline_int_cb(*this), - m_alpha_tilemap(*this, "alpha"), - m_playfield_tilemap(*this, "playfield"), - m_playfield2_tilemap(*this, "playfield2"), - m_mob(*this, "mob"), - m_eof_data(*this, "eof"), - m_scanline_int_timer(nullptr), - m_tilerow_update_timer(nullptr), - m_eof_timer(nullptr), - m_palette_bank(0), - m_pf0_xscroll_raw(0), - m_pf0_yscroll(0), - m_pf1_xscroll_raw(0), - m_pf1_yscroll(0), - m_mo_xscroll(0), - m_mo_yscroll(0) + : device_t(mconfig, ATARI_VAD, tag, owner, clock) + , device_video_interface(mconfig, *this) + , m_scanline_int_cb(*this) + , m_alpha_tilemap(*this, "alpha") + , m_playfield_tilemap(*this, "playfield") + , m_playfield2_tilemap(*this, "playfield2") + , m_mob(*this, "mob") + , m_eof_data(*this, "eof") + , m_scanline_int_timer(nullptr) + , m_tilerow_update_timer(nullptr) + , m_eof_timer(nullptr) + , m_palette_bank(0) + , m_pf0_xscroll_raw(0) + , m_pf0_yscroll(0) + , m_pf1_xscroll_raw(0) + , m_pf1_yscroll(0) + , m_mo_xscroll(0) + , m_mo_yscroll(0) { } @@ -76,7 +76,7 @@ READ16_MEMBER(atari_vad_device::control_read) int result = screen().vpos(); if (result > 255) result = 255; - if (result > screen().visible_area().max_y) + if (result > screen().visible_area().bottom()) result |= 0x4000; return result; } @@ -423,7 +423,7 @@ void atari_vad_device::update_parameter(uint16_t newword) void atari_vad_device::update_tilerow(emu_timer &timer, int scanline) { // skip if out of bounds, or not enabled - if (scanline <= screen().visible_area().max_y && (m_control[0x0a] & 0x2000) != 0 && m_alpha_tilemap != nullptr) + if (scanline <= screen().visible_area().bottom() && (m_control[0x0a] & 0x2000) != 0 && m_alpha_tilemap != nullptr) { // iterate over non-visible alpha tiles in this row int offset = scanline / 8 * 64 + 48 + 2 * (scanline % 8); diff --git a/src/mame/video/badlands.cpp b/src/mame/video/badlands.cpp index c8c0a955b99..beab5dd320f 100644 --- a/src/mame/video/badlands.cpp +++ b/src/mame/video/badlands.cpp @@ -112,11 +112,11 @@ uint32_t badlands_state::screen_update_badlands(screen_device &screen, bitmap_in // draw and merge the MO bitmap_ind16 &mobitmap = m_mob->bitmap(); for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); - for (int x = rect->min_x; x <= rect->max_x; x++) + for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { /* not yet verified diff --git a/src/mame/video/batman.cpp b/src/mame/video/batman.cpp index e9ee2caa8e9..1b0d8632864 100644 --- a/src/mame/video/batman.cpp +++ b/src/mame/video/batman.cpp @@ -118,12 +118,12 @@ uint32_t batman_state::screen_update_batman(screen_device &screen, bitmap_ind16 // draw and merge the MO bitmap_ind16 &mobitmap = m_vad->mob().bitmap(); for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); uint8_t *pri = &priority_bitmap.pix8(y); - for (int x = rect->min_x; x <= rect->max_x; x++) + for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { /* verified on real hardware: @@ -190,11 +190,11 @@ uint32_t batman_state::screen_update_batman(screen_device &screen, bitmap_ind16 /* now go back and process the upper bit of MO priority */ for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); - for (int x = rect->min_x; x <= rect->max_x; x++) + for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; diff --git a/src/mame/video/beathead.cpp b/src/mame/video/beathead.cpp index 5c6586b4fdc..daff388b72a 100644 --- a/src/mame/video/beathead.cpp +++ b/src/mame/video/beathead.cpp @@ -145,29 +145,29 @@ uint32_t beathead_state::screen_update(screen_device &screen, bitmap_ind16 &bitm int x, y; /* generate the final screen */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (y = cliprect.top(); y <= cliprect.bottom(); y++) { pen_t pen_base = (*m_palette_select & 0x7f) * 256; uint16_t scanline[336]; /* blanking */ if (m_finescroll & 8) - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (x = cliprect.left(); x <= cliprect.right(); x++) scanline[x] = pen_base; /* non-blanking */ else { offs_t scanline_offset = m_vram_latch_offset + (m_finescroll & 3); - offs_t src = scanline_offset + cliprect.min_x; + offs_t src = scanline_offset + cliprect.left(); /* unswizzle the scanline first */ - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (x = cliprect.left(); x <= cliprect.right(); x++) scanline[x] = pen_base | videoram[BYTE4_XOR_LE(src++)]; } /* then draw it */ - draw_scanline16(bitmap, cliprect.min_x, y, cliprect.width(), &scanline[cliprect.min_x], nullptr); + draw_scanline16(bitmap, cliprect.left(), y, cliprect.width(), &scanline[cliprect.left()], nullptr); } return 0; } diff --git a/src/mame/video/blstroid.cpp b/src/mame/video/blstroid.cpp index af8c6b9a12e..19c8307f2b8 100644 --- a/src/mame/video/blstroid.cpp +++ b/src/mame/video/blstroid.cpp @@ -149,11 +149,11 @@ uint32_t blstroid_state::screen_update_blstroid(screen_device &screen, bitmap_in /* draw and merge the MO */ bitmap_ind16 &mobitmap = m_mob->bitmap(); for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); - for (int x = rect->min_x; x <= rect->max_x; x++) + for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { /* verified via schematics diff --git a/src/mame/video/boogwing.cpp b/src/mame/video/boogwing.cpp index 407d47b6085..52564201416 100644 --- a/src/mame/video/boogwing.cpp +++ b/src/mame/video/boogwing.cpp @@ -40,7 +40,7 @@ void boogwing_state::mix_boogwing(screen_device &screen, bitmap_rgb32 &bitmap, c uint16_t *srcline1, *srcline2; uint8_t *srcpriline; - for (y=cliprect.min_y;y<=cliprect.max_y;y++) + for (y=cliprect.top();y<=cliprect.bottom();y++) { srcline1=&sprite_bitmap1->pix16(y,0); srcline2=&sprite_bitmap2->pix16(y,0); @@ -48,7 +48,7 @@ void boogwing_state::mix_boogwing(screen_device &screen, bitmap_rgb32 &bitmap, c dstline=&bitmap.pix32(y,0); - for (x=cliprect.min_x;x<=cliprect.max_x;x++) + for (x=cliprect.left();x<=cliprect.right();x++) { uint16_t pix1 = srcline1[x]; uint16_t pix2 = srcline2[x]; diff --git a/src/mame/video/ccastles.cpp b/src/mame/video/ccastles.cpp index 99bab35d18e..96981f086d2 100644 --- a/src/mame/video/ccastles.cpp +++ b/src/mame/video/ccastles.cpp @@ -272,14 +272,14 @@ uint32_t ccastles_state::screen_update_ccastles(screen_device &screen, bitmap_in } /* draw the bitmap to the screen, looping over Y */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (y = cliprect.top(); y <= cliprect.bottom(); y++) { uint16_t *dst = &bitmap.pix16(y); /* if we're in the VBLANK region, just fill with black */ if (m_syncprom[y] & 1) { - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (x = cliprect.left(); x <= cliprect.right(); x++) dst[x] = black; } @@ -296,7 +296,7 @@ uint32_t ccastles_state::screen_update_ccastles(screen_device &screen, bitmap_in src = &m_videoram[effy * 128]; /* loop over X */ - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (x = cliprect.left(); x <= cliprect.right(); x++) { /* if we're in the HBLANK region, just store black */ if (x >= 256) diff --git a/src/mame/video/cinemat.cpp b/src/mame/video/cinemat.cpp index e1f9c120e3a..5d38416f280 100644 --- a/src/mame/video/cinemat.cpp +++ b/src/mame/video/cinemat.cpp @@ -22,10 +22,10 @@ void cinemat_state::cinemat_vector_callback(int16_t sx, int16_t sy, int16_t ex, int intensity = 0xff; /* adjust for slop */ - sx = sx - visarea.min_x; - ex = ex - visarea.min_x; - sy = sy - visarea.min_y; - ey = ey - visarea.min_y; + sx -= visarea.left(); + ex -= visarea.left(); + sy -= visarea.top(); + ey -= visarea.top(); /* point intensity is determined by the shift value */ if (sx == ex && sy == ey) diff --git a/src/mame/video/cloak.cpp b/src/mame/video/cloak.cpp index ae98e819927..d550499533f 100644 --- a/src/mame/video/cloak.cpp +++ b/src/mame/video/cloak.cpp @@ -182,8 +182,8 @@ void cloak_state::draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) { int x, y; - for (y = cliprect.min_y; y <= cliprect.max_y; y++) - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for (x = cliprect.left(); x <= cliprect.right(); x++) { pen_t pen = m_current_bitmap_videoram_displayed[(y << 8) | x] & 0x07; diff --git a/src/mame/video/cloud9.cpp b/src/mame/video/cloud9.cpp index 5a6eea3e0cb..af1d5d5c6d1 100644 --- a/src/mame/video/cloud9.cpp +++ b/src/mame/video/cloud9.cpp @@ -246,14 +246,14 @@ uint32_t cloud9_state::screen_update_cloud9(screen_device &screen, bitmap_ind16 } /* draw the bitmap to the screen, looping over Y */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (y = cliprect.top(); y <= cliprect.bottom(); y++) { uint16_t *dst = &bitmap.pix16(y); /* if we're in the VBLANK region, just fill with black */ if (~m_syncprom[y] & 2) { - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (x = cliprect.left(); x <= cliprect.right(); x++) dst[x] = black; } @@ -269,7 +269,7 @@ uint32_t cloud9_state::screen_update_cloud9(screen_device &screen, bitmap_ind16 src[1] = &m_videoram[0x0000 | (effy * 64)]; /* loop over X */ - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (x = cliprect.left(); x <= cliprect.right(); x++) { /* if we're in the HBLANK region, just store black */ if (x >= 256) diff --git a/src/mame/video/copsnrob.cpp b/src/mame/video/copsnrob.cpp index 66bb9e0ebd5..109f13fcf9b 100644 --- a/src/mame/video/copsnrob.cpp +++ b/src/mame/video/copsnrob.cpp @@ -122,7 +122,7 @@ uint32_t copsnrob_state::screen_update_copsnrob(screen_device &screen, bitmap_in { if (val & mask1) { - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (y = cliprect.top(); y <= cliprect.bottom(); y++) if (m_bulletsram[y] & mask2) bitmap.pix16(y, 256 - x) = 1; } diff --git a/src/mame/video/cvs.cpp b/src/mame/video/cvs.cpp index a88258bcd67..47645bb080a 100644 --- a/src/mame/video/cvs.cpp +++ b/src/mame/video/cvs.cpp @@ -224,11 +224,11 @@ uint32_t cvs_state::screen_update_cvs(screen_device &screen, bitmap_ind16 &bitma { int y; - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (y = cliprect.top(); y <= cliprect.bottom(); y++) { int x; - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (x = cliprect.left(); x <= cliprect.right(); x++) { int pixel0 = s2636_0_bitmap.pix16(y, x); int pixel1 = s2636_1_bitmap.pix16(y, x); @@ -328,7 +328,7 @@ void cvs_state::cvs_update_stars(bitmap_ind16 &bitmap, const rectangle &cliprect if (flip_screen_y()) y = ~y; - if ((y >= cliprect.min_y) && (y <= cliprect.max_y) && + if ((y >= cliprect.top()) && (y <= cliprect.bottom()) && (update_always || (m_palette->pen_indirect(bitmap.pix16(y, x)) == 0))) bitmap.pix16(y, x) = star_pen; } diff --git a/src/mame/video/cyberbal.cpp b/src/mame/video/cyberbal.cpp index bce32eb631a..0f470c6b7ff 100644 --- a/src/mame/video/cyberbal.cpp +++ b/src/mame/video/cyberbal.cpp @@ -233,11 +233,11 @@ uint32_t cyberbal_base_state::update_one_screen(screen_device &screen, bitmap_in /* draw and merge the MO */ bitmap_ind16 &mobitmap = curmob.bitmap(); for (const sparse_dirty_rect *rect = curmob.first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); - for (int x = rect->min_x; x <= rect->max_x; x++) + for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { /* not verified: logic is all controlled in a PAL diff --git a/src/mame/video/cybstorm.cpp b/src/mame/video/cybstorm.cpp index 4cedc1d9482..ba8b8358965 100644 --- a/src/mame/video/cybstorm.cpp +++ b/src/mame/video/cybstorm.cpp @@ -129,12 +129,12 @@ uint32_t cybstorm_state::screen_update_cybstorm(screen_device &screen, bitmap_in /* draw and merge the MO */ bitmap_ind16 &mobitmap = m_vad->mob().bitmap(); for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); uint8_t *pri = &priority_bitmap.pix8(y); - for (int x = rect->min_x; x <= rect->max_x; x++) + for (int x = rect->left(); x <= rect->right(); x++) if (mo[x]) { int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; @@ -175,12 +175,12 @@ uint32_t cybstorm_state::screen_update_cybstorm(screen_device &screen, bitmap_in /* now go back and process the upper bit of MO priority */ for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); int count = 0; - for (int x = rect->min_x; x <= rect->max_x || (count && x < bitmap.width()); x++) + for (int x = rect->left(); x <= rect->right() || (count && x < bitmap.width()); x++) { const uint16_t START_MARKER = ((4 << atari_motion_objects_device::PRIORITY_SHIFT) | 3); const uint16_t END_MARKER = ((4 << atari_motion_objects_device::PRIORITY_SHIFT) | 7); diff --git a/src/mame/video/dassault.cpp b/src/mame/video/dassault.cpp index 94c989f66bc..7c7f8e7b550 100644 --- a/src/mame/video/dassault.cpp +++ b/src/mame/video/dassault.cpp @@ -37,12 +37,12 @@ void dassault_state::mixdassaultlayer(bitmap_rgb32 &bitmap, bitmap_ind16* sprite uint16_t* srcline; uint32_t* dstline; - for (y=cliprect.min_y;y<=cliprect.max_y;y++) + for (y=cliprect.top();y<=cliprect.bottom();y++) { srcline=&sprite_bitmap->pix16(y,0); dstline=&bitmap.pix32(y,0); - for (x=cliprect.min_x;x<=cliprect.max_x;x++) + for (x=cliprect.left();x<=cliprect.right();x++) { uint16_t pix = srcline[x]; diff --git a/src/mame/video/decbac06.cpp b/src/mame/video/decbac06.cpp index 8f30ba0d737..590a569e245 100644 --- a/src/mame/video/decbac06.cpp +++ b/src/mame/video/decbac06.cpp @@ -68,23 +68,23 @@ Priority word (Midres): DEFINE_DEVICE_TYPE(DECO_BAC06, deco_bac06_device, "deco_back06", "DECO BAC06 Tilemap") deco_bac06_device::deco_bac06_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, DECO_BAC06, tag, owner, clock), - m_pf_data(nullptr), - m_pf_rowscroll(nullptr), - m_pf_colscroll(nullptr), - m_tile_region_8(0), - m_tile_region_16(0), - m_supports_8x8(true), - m_supports_16x16(true), - m_supports_rc_scroll(true), - m_gfxcolmask(0), - m_rambank(0), - m_gfxregion8x8(0), - m_gfxregion16x16(0), - m_wide(0), - m_bppmult(0), - m_bppmask(0), - m_gfxdecode(*this, finder_base::DUMMY_TAG) + : device_t(mconfig, DECO_BAC06, tag, owner, clock) + , m_pf_data(nullptr) + , m_pf_rowscroll(nullptr) + , m_pf_colscroll(nullptr) + , m_tile_region_8(0) + , m_tile_region_16(0) + , m_supports_8x8(true) + , m_supports_16x16(true) + , m_supports_rc_scroll(true) + , m_gfxcolmask(0) + , m_rambank(0) + , m_gfxregion8x8(0) + , m_gfxregion16x16(0) + , m_wide(0) + , m_bppmult(0) + , m_bppmask(0) + , m_gfxdecode(*this, finder_base::DUMMY_TAG) { for (int i = 0; i < 8; i++) { @@ -282,7 +282,7 @@ void deco_bac06_device::custom_tilemap_draw(bitmap_ind16 &bitmap, else src_y = scrolly; - for (y=0; y<=cliprect.max_y; y++) { + for (y=0; y<=cliprect.bottom(); y++) { if (row_scroll_enabled) src_x=scrollx + rowscroll_ptr[(src_y >> (control1[3]&0xf))&(0x1ff>>(control1[3]&0xf))]; else @@ -291,7 +291,7 @@ void deco_bac06_device::custom_tilemap_draw(bitmap_ind16 &bitmap, if (m_flip_screen) src_x=(src_bitmap.width() - 256) - src_x; - for (x=0; x<=cliprect.max_x; x++) { + for (x=0; x<=cliprect.right(); x++) { if (col_scroll_enabled) column_offset=colscroll_ptr[((src_x >> 3) >> (control1[2]&0xf))&(0x3f>>(control1[2]&0xf))]; diff --git a/src/mame/video/deco16ic.cpp b/src/mame/video/deco16ic.cpp index 7ff4d8dc5e6..b7e2dca7739 100644 --- a/src/mame/video/deco16ic.cpp +++ b/src/mame/video/deco16ic.cpp @@ -460,8 +460,8 @@ void deco16ic_device::custom_tilemap_draw( if (!BIT(control0, 7)) return; - int starty = cliprect.min_y; - int endy = cliprect.max_y+1; + int starty = cliprect.top(); + int endy = cliprect.bottom() + 1; width_mask = src_bitmap0->width() - 1; height_mask = src_bitmap0->height() - 1; diff --git a/src/mame/video/deco32.cpp b/src/mame/video/deco32.cpp index 75fdba3b035..6db1f9a645d 100644 --- a/src/mame/video/deco32.cpp +++ b/src/mame/video/deco32.cpp @@ -184,9 +184,9 @@ uint32_t dragngun_state::screen_update_dragngun(screen_device &screen, bitmap_rg // // really, it needs optimizing .. // so for now we only draw these 2 layers on the last update call - if (cliprect.max_y == 247) + if (cliprect.bottom() == 247) { - rectangle clip(cliprect.min_x, cliprect.max_x, 8, 247); + rectangle clip(cliprect.left(), cliprect.right(), 8, 247); m_sprgenzoom->dragngun_draw_sprites(bitmap,clip,m_spriteram->buffer(), m_sprite_layout_ram[0], m_sprite_layout_ram[1], m_sprite_lookup_ram[0], m_sprite_lookup_ram[1], m_sprite_ctrl, screen.priority(), m_temp_render_bitmap ); diff --git a/src/mame/video/deco_mlc.cpp b/src/mame/video/deco_mlc.cpp index 273fc492444..6c60a5f6e7b 100644 --- a/src/mame/video/deco_mlc.cpp +++ b/src/mame/video/deco_mlc.cpp @@ -74,16 +74,16 @@ void deco_mlc_state::drawgfxzoomline(uint32_t* dest,const rectangle &clip,gfx_el x_index_base = 0; } - if( sx < clip.min_x) + if( sx < clip.left()) { /* clip left */ - int pixels = clip.min_x-sx; + int pixels = clip.left()-sx; sx += pixels; x_index_base += pixels*dx; } /* NS 980211 - fixed incorrect clipping */ - if( ex > clip.max_x+1 ) + if( ex > clip.right()+1 ) { /* clip right */ - int pixels = ex-clip.max_x-1; + int pixels = ex-clip.right()-1; ex -= pixels; } @@ -245,16 +245,11 @@ void deco_mlc_state::draw_sprites( const rectangle &cliprect, int scanline, uint int min_y = m_clip_ram[(clipper*4)+0]; int max_y = m_clip_ram[(clipper*4)+1]; - if (scanlinemax_y)) continue; - if (scanline>max_y) - continue; - - - user_clip.min_x=m_clip_ram[(clipper*4)+2]; - user_clip.max_x=m_clip_ram[(clipper*4)+3]; + user_clip.setx(m_clip_ram[(clipper*4)+2], m_clip_ram[(clipper*4)+3]); user_clip &= cliprect; /* Any colours out of range (for the bpp value) trigger 'shadow' mode */ @@ -548,7 +543,7 @@ uint32_t deco_mlc_state::screen_update(screen_device &screen, bitmap_rgb32 &bitm // temp_bitmap->fill(0, cliprect); bitmap.fill(m_palette->pen(0), cliprect); /* Pen 0 fill colour confirmed from Skull Fang level 2 */ - for (int i=cliprect.min_y;i<=cliprect.max_y;i++) + for (int i=cliprect.top();i<=cliprect.bottom();i++) { uint32_t *dest = &bitmap.pix32(i); diff --git a/src/mame/video/deco_zoomspr.cpp b/src/mame/video/deco_zoomspr.cpp index d63941c62a4..e930e82d458 100644 --- a/src/mame/video/deco_zoomspr.cpp +++ b/src/mame/video/deco_zoomspr.cpp @@ -93,27 +93,27 @@ inline void deco_zoomspr_device::dragngun_drawgfxzoom( y_index = 0; } - if( sx < clip.min_x) + if( sx < clip.left()) { /* clip left */ - int pixels = clip.min_x-sx; + int pixels = clip.left()-sx; sx += pixels; x_index_base += pixels*dx; } - if( sy < clip.min_y ) + if( sy < clip.top() ) { /* clip top */ - int pixels = clip.min_y-sy; + int pixels = clip.top()-sy; sy += pixels; y_index += pixels*dy; } /* NS 980211 - fixed incorrect clipping */ - if( ex > clip.max_x+1 ) + if( ex > clip.right()+1 ) { /* clip right */ - int pixels = ex-clip.max_x-1; + int pixels = ex-clip.right()-1; ex -= pixels; } - if( ey > clip.max_y+1 ) + if( ey > clip.bottom()+1 ) { /* clip bottom */ - int pixels = ey-clip.max_y-1; + int pixels = ey-clip.bottom()-1; ey -= pixels; } @@ -396,12 +396,12 @@ void deco_zoomspr_device::dragngun_draw_sprites( bitmap_rgb32 &bitmap, const rec } } - for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { uint32_t *src = &temp_bitmap.pix32(y); uint32_t *dst = &bitmap.pix32(y); - for (int x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { uint32_t srcpix = src[x]; diff --git a/src/mame/video/decocass.cpp b/src/mame/video/decocass.cpp index a93edf2fbfc..bf06d8cd5a9 100644 --- a/src/mame/video/decocass.cpp +++ b/src/mame/video/decocass.cpp @@ -252,10 +252,10 @@ void decocass_state::draw_special_priority(bitmap_ind16 &bitmap, bitmap_ind8 &pr const uint8_t *objdata1 = m_gfxdecode->gfx(3)->get_data(1); assert(m_gfxdecode->gfx(3)->rowbytes() == 64); - for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { const int dy = y - sy; - for (int x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { const int dx = x - sx; @@ -308,7 +308,7 @@ void decocass_state::draw_center(bitmap_ind16 &bitmap, const rectangle &cliprect sx = (m_center_h_shift_space >> 2) & 0x3c; for (y = 0; y < 4; y++) - if ((sy + y) >= cliprect.min_y && (sy + y) <= cliprect.max_y) + if ((sy + y) >= cliprect.top() && (sy + y) <= cliprect.bottom()) { if (((sy + y) & m_color_center_bot & 3) == (sy & m_color_center_bot & 3)) for (x = 0; x < 256; x++) @@ -588,10 +588,10 @@ void decocass_state::draw_missiles(bitmap_ind16 &bitmap, bitmap_ind8 &priority, sy = 240 - sy + missile_y_adjust_flip_screen; } sy -= missile_y_adjust; - if (sy >= cliprect.min_y && sy <= cliprect.max_y) + if (sy >= cliprect.top() && sy <= cliprect.bottom()) for (x = 0; x < 4; x++) { - if (sx >= cliprect.min_x && sx <= cliprect.max_x) + if (sx >= cliprect.left() && sx <= cliprect.right()) { bitmap.pix16(sy, sx) = (m_color_missiles & 7) | 8; priority.pix8(sy, sx) |= 1 << 2; @@ -607,10 +607,10 @@ void decocass_state::draw_missiles(bitmap_ind16 &bitmap, bitmap_ind8 &priority, sy = 240 - sy + missile_y_adjust_flip_screen; } sy -= missile_y_adjust; - if (sy >= cliprect.min_y && sy <= cliprect.max_y) + if (sy >= cliprect.top() && sy <= cliprect.bottom()) for (x = 0; x < 4; x++) { - if (sx >= cliprect.min_x && sx <= cliprect.max_x) + if (sx >= cliprect.left() && sx <= cliprect.right()) { bitmap.pix16(sy, sx) = ((m_color_missiles >> 4) & 7) | 8; priority.pix8(sy, sx) |= 1 << 3; @@ -663,13 +663,13 @@ void decocass_state::draw_edge(bitmap_ind16 &bitmap, const rectangle &cliprect, // technically our y drawing probably shouldn't wrap / mask, but simply draw the 128pixel high 'edge' at the requested position // see note above this funciton - for (y=clip.min_y; y<=clip.max_y;y++) + for (y=clip.top(); y<=clip.bottom(); y++) { int srcline = (y + scrolly) & 0x1ff; uint16_t* src = &srcbitmap->pix16(srcline); uint16_t* dst = &bitmap.pix16(y); - for (x=clip.min_x; x<=clip.max_x;x++) + for (x=clip.left(); x<=clip.right(); x++) { int srccol = 0; diff --git a/src/mame/video/decospr.cpp b/src/mame/video/decospr.cpp index ba893bf3726..bdd2d1a02f9 100644 --- a/src/mame/video/decospr.cpp +++ b/src/mame/video/decospr.cpp @@ -183,7 +183,7 @@ void decospr_device::alloc_sprite_bitmap() template void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle &cliprect, uint16_t* spriteram, int sizewords) { - //printf("cliprect %04x, %04x\n", cliprect.min_y, cliprect.max_y); + //printf("cliprect %04x, %04x\n", cliprect.top(), cliprect.bottom()); if (m_sprite_bitmap.valid() && !m_pri_cb.isnull()) fatalerror("m_sprite_bitmap && m_pri_cb is invalid\n"); @@ -274,7 +274,7 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle & y = ((y&0x1ff) + m_y_offset)&0x1ff; - if (cliprect.max_x>256) + if (cliprect.right()>256) { x = x & 0x01ff; y = y & 0x01ff; @@ -318,7 +318,7 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle & if (flipscreen ^ m_flipallx) { - if (cliprect.max_x>256) + if (cliprect.right()>256) x = 304 - x; else x = 240 - x; @@ -334,11 +334,11 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle & { int ypos; ypos = y + mult * multi; - if ((ypos<=cliprect.max_y) && (ypos>=(cliprect.min_y)-16)) + if ((ypos<=cliprect.bottom()) && (ypos>=(cliprect.top())-16)) { if(!m_sprite_bitmap.valid()) { - if ((ypos<=cliprect.max_y) && (ypos>=(cliprect.min_y)-16)) + if ((ypos<=cliprect.bottom()) && (ypos>=(cliprect.top())-16)) { if (!m_pri_cb.isnull()) m_gfxdecode->gfx(m_gfxregion)->prio_transpen(bitmap,cliprect, @@ -463,7 +463,7 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle & { ypos = y + mult2 * (h-yy); - if ((ypos<=cliprect.max_y) && (ypos>=(cliprect.min_y)-16)) + if ((ypos<=cliprect.bottom()) && (ypos>=(cliprect.top())-16)) { m_gfxdecode->gfx(m_gfxregion)->prio_transpen(bitmap,cliprect, sprite + yy + h * xx, @@ -475,7 +475,7 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle & ypos -= 512; // wrap-around y - if ((ypos<=cliprect.max_y) && (ypos>=(cliprect.min_y-16))) + if ((ypos<=cliprect.bottom()) && (ypos>=(cliprect.top()-16))) { m_gfxdecode->gfx(m_gfxregion)->prio_transpen(bitmap,cliprect, sprite + yy + h * xx, @@ -490,7 +490,7 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle & { ypos = y + mult2 * (h-yy); - if ((ypos<=cliprect.max_y) && (ypos>=(cliprect.min_y)-16)) + if ((ypos<=cliprect.bottom()) && (ypos>=(cliprect.top())-16)) { m_gfxdecode->gfx(m_gfxregion)->transpen(bitmap,cliprect, sprite + yy + h * xx, @@ -502,7 +502,7 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle & ypos -= 512; // wrap-around y - if ((ypos<=cliprect.max_y) && (ypos>=(cliprect.min_y-16))) + if ((ypos<=cliprect.bottom()) && (ypos>=(cliprect.top()-16))) { m_gfxdecode->gfx(m_gfxregion)->transpen(bitmap,cliprect, sprite + yy + h * xx, @@ -517,7 +517,7 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle & { ypos = y + mult2 * (h-yy); - if ((ypos<=cliprect.max_y) && (ypos>=(cliprect.min_y)-16)) + if ((ypos<=cliprect.bottom()) && (ypos>=(cliprect.top())-16)) { m_gfxdecode->gfx(m_gfxregion)->transpen_raw(m_sprite_bitmap,cliprect, sprite + yy + h * xx, @@ -529,7 +529,7 @@ void decospr_device::draw_sprites_common(_BitmapClass &bitmap, const rectangle & ypos -= 512; // wrap-around y - if ((ypos<=cliprect.max_y) && (ypos>=(cliprect.min_y-16))) + if ((ypos<=cliprect.bottom()) && (ypos>=(cliprect.top()-16))) { m_gfxdecode->gfx(m_gfxregion)->transpen_raw(m_sprite_bitmap,cliprect, sprite + yy + h * xx, @@ -567,14 +567,14 @@ void decospr_device::inefficient_copy_sprite_bitmap(bitmap_rgb32 &bitmap, const uint16_t* srcline; uint32_t* dstline; - for (y=cliprect.min_y;y<=cliprect.max_y;y++) + for (y=cliprect.top();y<=cliprect.bottom();y++) { srcline= &m_sprite_bitmap.pix16(y); dstline= &bitmap.pix32(y); if (alpha==0xff) { - for (x=cliprect.min_x;x<=cliprect.max_x;x++) + for (x=cliprect.left();x<=cliprect.right();x++) { uint16_t pix = srcline[x]; @@ -589,7 +589,7 @@ void decospr_device::inefficient_copy_sprite_bitmap(bitmap_rgb32 &bitmap, const } else { - for (x=cliprect.min_x;x<=cliprect.max_x;x++) + for (x=cliprect.left();x<=cliprect.right();x++) { uint16_t pix = srcline[x]; diff --git a/src/mame/video/dragrace.cpp b/src/mame/video/dragrace.cpp index e28c710c854..d13441aed68 100644 --- a/src/mame/video/dragrace.cpp +++ b/src/mame/video/dragrace.cpp @@ -63,8 +63,7 @@ uint32_t dragrace_state::screen_update_dragrace(screen_device &screen, bitmap_in m_bg_tilemap->set_scrollx(0, 16 * xh + xl - 8); m_bg_tilemap->set_scrolly(0, 16 * yh + yl); - if (rect.min_y < y + 0) rect.min_y = y + 0; - if (rect.max_y > y + 3) rect.max_y = y + 3; + rect.sety((std::max)(rect.top(), y + 0), (std::min)(rect.bottom(), y + 3)); m_bg_tilemap->draw(screen, bitmap, rect, 0, 0); } diff --git a/src/mame/video/dynax.cpp b/src/mame/video/dynax.cpp index 347a69f4150..94933026f61 100644 --- a/src/mame/video/dynax.cpp +++ b/src/mame/video/dynax.cpp @@ -748,7 +748,7 @@ void dynax_state::jantouki_copylayer( bitmap_ind16 &bitmap, const rectangle &cli uint16_t *dst; uint16_t *dstbase = &bitmap.pix16(sy); - if ((sy < cliprect.min_y) || (sy > cliprect.max_y)) + if ((sy < cliprect.top()) || (sy > cliprect.bottom())) { src1 += 256; src2 += 256; @@ -912,7 +912,7 @@ int dynax_state::debug_viewer(bitmap_ind16 &bitmap, const rectangle &cliprect ) if (m_layer_layout != LAYOUT_MJDIALQ2) memset(m_pixmap[0][1].get(), 0, sizeof(uint8_t) * 0x100 * 0x100); for (m_hanamai_layer_half = 0; m_hanamai_layer_half < 2; m_hanamai_layer_half++) - blitter_drawgfx(0, 1, m_blitter_gfx, i, 0, cliprect.min_x, cliprect.min_y, 3, 0); + blitter_drawgfx(0, 1, m_blitter_gfx, i, 0, cliprect.left(), cliprect.top(), 3, 0); if (m_layer_layout != LAYOUT_MJDIALQ2) hanamai_copylayer(bitmap, cliprect, 0); diff --git a/src/mame/video/electron.cpp b/src/mame/video/electron.cpp index 64f6b1b11ec..a5050c3bcf4 100644 --- a/src/mame/video/electron.cpp +++ b/src/mame/video/electron.cpp @@ -85,13 +85,13 @@ inline void electron_state::electron_plot_pixel(bitmap_ind16 &bitmap, int x, int uint32_t electron_state::screen_update_electron(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int min_x = screen.visible_area().min_x; - int min_y = screen.visible_area().min_y; + int min_x = screen.visible_area().left(); + int min_y = screen.visible_area().top(); int x = min_x; int pal[16]; int scanline = screen.vpos(); rectangle r = cliprect; - r.min_y = r.max_y = scanline; + r.sety(scanline, scanline); /* set up palette */ switch( m_ula.screen_mode ) diff --git a/src/mame/video/eprom.cpp b/src/mame/video/eprom.cpp index 6fbb6e34657..93becde10bc 100644 --- a/src/mame/video/eprom.cpp +++ b/src/mame/video/eprom.cpp @@ -219,11 +219,11 @@ uint32_t eprom_state::screen_update_eprom(screen_device &screen, bitmap_ind16 &b // draw and merge the MO bitmap_ind16 &mobitmap = m_mob->bitmap(); for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); - for (int x = rect->min_x; x <= rect->max_x; x++) + for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { /* verified from the GALs on the real PCB; equations follow @@ -325,11 +325,11 @@ uint32_t eprom_state::screen_update_eprom(screen_device &screen, bitmap_ind16 &b /* now go back and process the upper bit of MO priority */ for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); - for (int x = rect->min_x; x <= rect->max_x; x++) + for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; @@ -366,11 +366,11 @@ uint32_t eprom_state::screen_update_guts(screen_device &screen, bitmap_ind16 &bi // draw and merge the MO bitmap_ind16 &mobitmap = m_mob->bitmap(); for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); - for (int x = rect->min_x; x <= rect->max_x; x++) + for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { int mopriority = (mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT) & 7; @@ -391,11 +391,11 @@ uint32_t eprom_state::screen_update_guts(screen_device &screen, bitmap_ind16 &bi /* now go back and process the upper bit of MO priority */ for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); - for (int x = rect->min_x; x <= rect->max_x; x++) + for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; diff --git a/src/mame/video/equites.cpp b/src/mame/video/equites.cpp index 6df9a32706a..82dec063f58 100644 --- a/src/mame/video/equites.cpp +++ b/src/mame/video/equites.cpp @@ -338,13 +338,13 @@ void splndrbt_state::splndrbt_draw_sprites(bitmap_ind16 &bitmap, const rectangle { int const y = yhalf ? sy + 1 + yy : sy - yy; - if (y >= cliprect.min_y && y <= cliprect.max_y) + if (y >= cliprect.top() && y <= cliprect.bottom()) { for (x = 0; x <= (scalex << 1); ++x) { int bx = (sx + x) & 0xff; - if (bx >= cliprect.min_x && bx <= cliprect.max_x) + if (bx >= cliprect.left() && bx <= cliprect.right()) { int xx = scalex ? (x * 29 + scalex) / (scalex << 1) + 1 : 16; // FIXME This is wrong. Should use the PROM. int const offset = (fx ? (31 - xx) : xx) + ((fy ^ yhalf) ? (16 + line) : (15 - line)) * gfx->rowbytes(); @@ -382,7 +382,7 @@ void splndrbt_state::splndrbt_copy_bg(bitmap_ind16 &dst_bitmap, const rectangle for (dst_y = 32; dst_y < 256-32; ++dst_y) { - if (dst_y >= cliprect.min_y && dst_y <= cliprect.max_y) + if (dst_y >= cliprect.top() && dst_y <= cliprect.bottom()) { const uint8_t * const romline = &xrom[(dst_y ^ dinvert) << 5]; const uint16_t * const src_line = &src_bitmap.pix16((src_y + scroll_y) & 0x1ff); diff --git a/src/mame/video/exidy440.cpp b/src/mame/video/exidy440.cpp index 3aba8684ea7..12de6ba3be0 100644 --- a/src/mame/video/exidy440.cpp +++ b/src/mame/video/exidy440.cpp @@ -307,7 +307,7 @@ void exidy440_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c uint8_t *src; /* skip if out of range */ - if (yoffs < cliprect.min_y || yoffs >= cliprect.max_y + 16) + if (yoffs < cliprect.top() || yoffs >= cliprect.bottom() + 16) continue; /* get a pointer to the source image */ @@ -328,11 +328,11 @@ void exidy440_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c sy += (VBSTART - VBEND); /* stop if we get before the current scanline */ - if (yoffs < cliprect.min_y) + if (yoffs < cliprect.top()) break; /* only draw scanlines that are in this cliprect */ - if (yoffs <= cliprect.max_y) + if (yoffs <= cliprect.bottom()) { uint8_t *old = &m_local_videoram[sy * 512 + xoffs]; int currx = xoffs; @@ -389,8 +389,8 @@ void exidy440_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, c void exidy440_state::update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int scroll_offset, int check_collision) { /* draw any dirty scanlines from the VRAM directly */ - int sy = scroll_offset + cliprect.min_y; - for (int y = cliprect.min_y; y <= cliprect.max_y; y++, sy++) + int sy = scroll_offset + cliprect.top(); + for (int y = cliprect.top(); y <= cliprect.bottom(); y++, sy++) { /* wrap at the bottom of the screen */ if (sy >= VBSTART) @@ -418,7 +418,7 @@ uint32_t exidy440_state::screen_update_exidy440(screen_device &screen, bitmap_in update_screen(screen, bitmap, cliprect, 0, true); /* generate an interrupt once/frame for the beam */ - if (cliprect.max_y == screen.visible_area().max_y) + if (cliprect.bottom() == screen.visible_area().bottom()) { int i; diff --git a/src/mame/video/fantland.cpp b/src/mame/video/fantland.cpp index a1a64f97014..44a9a742e46 100644 --- a/src/mame/video/fantland.cpp +++ b/src/mame/video/fantland.cpp @@ -73,7 +73,7 @@ void fantland_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect // wheelrun is the only game with a smaller visible area const rectangle &visarea = m_screen->visible_area(); - int special = (visarea.max_y - visarea.min_y + 1) < 0x100; + int special = visarea.height() < 0x100; for ( ; ram < indx_ram; ram += 8,ram2++) { diff --git a/src/mame/video/firetrk.cpp b/src/mame/video/firetrk.cpp index c19477615ee..d59c205aab7 100644 --- a/src/mame/video/firetrk.cpp +++ b/src/mame/video/firetrk.cpp @@ -323,8 +323,8 @@ void firetrk_state::check_collision(int which) { int y, x; - for (y = playfield_window.min_y; y <= playfield_window.max_y; y++) - for (x = playfield_window.min_x; x <= playfield_window.max_x; x++) + for (y = playfield_window.top(); y <= playfield_window.bottom(); y++) + for (x = playfield_window.left(); x <= playfield_window.right(); x++) { pen_t a = m_helper1.pix16(y, x); pen_t b = m_helper2.pix16(y, x); @@ -353,7 +353,7 @@ uint32_t firetrk_state::screen_update_firetrk(screen_device &screen, bitmap_ind1 draw_text(bitmap, cliprect, m_alpha_num_ram + 0x00, 296, 0x10, 0x10); draw_text(bitmap, cliprect, m_alpha_num_ram + 0x10, 8, 0x10, 0x10); - if (cliprect.max_y == screen.visible_area().max_y) + if (cliprect.bottom() == screen.visible_area().bottom()) { m_tilemap2->draw(screen, m_helper1, playfield_window, 0, 0); @@ -386,7 +386,7 @@ uint32_t firetrk_state::screen_update_superbug(screen_device &screen, bitmap_ind draw_text(bitmap, cliprect, m_alpha_num_ram + 0x00, 296, 0x10, 0x10); draw_text(bitmap, cliprect, m_alpha_num_ram + 0x10, 8, 0x10, 0x10); - if (cliprect.max_y == screen.visible_area().max_y) + if (cliprect.bottom() == screen.visible_area().bottom()) { m_tilemap2->draw(screen, m_helper1, playfield_window, 0, 0); @@ -416,7 +416,7 @@ uint32_t firetrk_state::screen_update_montecar(screen_device &screen, bitmap_ind draw_text(bitmap, cliprect, m_alpha_num_ram + 0x00, 24, 0x20, 0x08); draw_text(bitmap, cliprect, m_alpha_num_ram + 0x20, 16, 0x20, 0x08); - if (cliprect.max_y == screen.visible_area().max_y) + if (cliprect.bottom() == screen.visible_area().bottom()) { m_tilemap2->draw(screen, m_helper1, playfield_window, 0, 0); diff --git a/src/mame/video/galaxia.cpp b/src/mame/video/galaxia.cpp index 94b6c423c61..fa7b24c9f5d 100644 --- a/src/mame/video/galaxia.cpp +++ b/src/mame/video/galaxia.cpp @@ -120,9 +120,9 @@ uint32_t galaxia_state::screen_update_galaxia(screen_device &screen, bitmap_ind1 cvs_update_stars(bitmap, cliprect, STAR_PEN, 1); m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (y = cliprect.top(); y <= cliprect.bottom(); y++) { - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (x = cliprect.left(); x <= cliprect.right(); x++) { bool bullet = m_bullet_ram[y] && x == (m_bullet_ram[y] ^ 0xff); bool background = (bitmap.pix16(y, x) & 3) != 0; @@ -185,7 +185,7 @@ uint32_t galaxia_state::screen_update_astrowar(screen_device &screen, bitmap_ind m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); copybitmap(m_temp_bitmap, bitmap, 0, 0, 0, 0, cliprect); - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (y = cliprect.top(); y <= cliprect.bottom(); y++) { // draw bullets (guesswork) if (m_bullet_ram[y]) @@ -201,14 +201,14 @@ uint32_t galaxia_state::screen_update_astrowar(screen_device &screen, bitmap_ind if (pos) bitmap.pix16(y, pos-1) = BULLET_PEN; } - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (x = cliprect.left(); x <= cliprect.right(); x++) { // NOTE: similar to zac2650.c, the sprite chip runs at a different frequency than the background generator // the exact timing ratio is unknown, so we'll have to do with guesswork float s_ratio = 256.0f / 196.0f; float sx = x * s_ratio; - if ((int)(sx + 0.5f) > cliprect.max_x) + if ((int)(sx + 0.5f) > cliprect.right()) break; // copy the S2636 bitmap into the main bitmap and check collision diff --git a/src/mame/video/galspnbl.cpp b/src/mame/video/galspnbl.cpp index 9b442a3b0bf..1c7308ff402 100644 --- a/src/mame/video/galspnbl.cpp +++ b/src/mame/video/galspnbl.cpp @@ -38,12 +38,12 @@ VIDEO_START_MEMBER(galspnbl_state,galspnbl) void galspnbl_state::mix_sprite_layer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri) { - for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { uint16_t *dd = &bitmap.pix16(y); uint16_t *sd2 = &m_sprite_bitmap.pix16(y); - for (int x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { uint16_t sprpixel = (sd2[x]); //uint16_t sprpri = (sprpixel >> 8) & 3; diff --git a/src/mame/video/gamate.cpp b/src/mame/video/gamate.cpp index 6d678a625e0..5bb9a1e771d 100644 --- a/src/mame/video/gamate.cpp +++ b/src/mame/video/gamate.cpp @@ -261,13 +261,13 @@ int gamate_video_device::get_pixel_from_vram(int x, int y) uint32_t gamate_video_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { //printf("updating scanline %d\n", y); int real_x, real_y; get_real_x_and_y(real_x, real_y, y); - for (int x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { int pix = get_pixel_from_vram(x + real_x, real_y); diff --git a/src/mame/video/gauntlet.cpp b/src/mame/video/gauntlet.cpp index b003e45522b..e43f30c4d0a 100644 --- a/src/mame/video/gauntlet.cpp +++ b/src/mame/video/gauntlet.cpp @@ -168,11 +168,11 @@ uint32_t gauntlet_state::screen_update_gauntlet(screen_device &screen, bitmap_in /* draw and merge the MO */ bitmap_ind16 &mobitmap = m_mob->bitmap(); for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); - for (int x = rect->min_x; x <= rect->max_x; x++) + for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { /* verified via schematics: diff --git a/src/mame/video/harddriv.cpp b/src/mame/video/harddriv.cpp index 931ff46e207..e2da5ba8d83 100644 --- a/src/mame/video/harddriv.cpp +++ b/src/mame/video/harddriv.cpp @@ -420,7 +420,7 @@ TMS340X0_SCANLINE_IND16_CB_MEMBER(harddriv_state::scanline_driver) for (x = params->heblnk; x < params->hsblnk; x++) dest[x] = m_gfx_palettebank * 256 + vram_base[BYTE_XOR_LE(coladdr++ & 0xfff)]; - if (scanline == screen.visible_area().max_y) + if (scanline == screen.visible_area().bottom()) display_speedups(); } @@ -438,6 +438,6 @@ TMS340X0_SCANLINE_IND16_CB_MEMBER(harddriv_state::scanline_multisync) for (x = params->heblnk; x < params->hsblnk; x++) dest[x] = m_gfx_palettebank * 256 + vram_base[BYTE_XOR_LE(coladdr++ & 0x7ff)]; - if (scanline == screen.visible_area().max_y) + if (scanline == screen.visible_area().bottom()) display_speedups(); } diff --git a/src/mame/video/irobot.cpp b/src/mame/video/irobot.cpp index cdeef307727..1ff2031e48e 100644 --- a/src/mame/video/irobot.cpp +++ b/src/mame/video/irobot.cpp @@ -352,7 +352,7 @@ uint32_t irobot_state::screen_update_irobot(screen_device &screen, bitmap_ind16 int x, y, offs; /* copy the polygon bitmap */ - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (y = cliprect.top(); y <= cliprect.bottom(); y++) draw_scanline8(bitmap, 0, y, BITMAP_WIDTH, &bitmap_base[y * BITMAP_WIDTH], nullptr); /* redraw the non-zero characters in the alpha layer */ diff --git a/src/mame/video/jaguar.cpp b/src/mame/video/jaguar.cpp index 803d5e14061..fde197a7ca1 100644 --- a/src/mame/video/jaguar.cpp +++ b/src/mame/video/jaguar.cpp @@ -204,8 +204,8 @@ inline void jaguar_state::get_crosshair_xy(int player, int &x, int &y) const rectangle &visarea = m_screen->visible_area(); /* only 2 lightguns are connected */ - x = visarea.min_x + (((ioport(player ? "FAKE2_X" : "FAKE1_X")->read() & 0xff) * visarea.width()) >> 8); - y = visarea.min_y + (((ioport(player ? "FAKE2_Y" : "FAKE1_Y")->read() & 0xff) * visarea.height()) >> 8); + x = visarea.left() + (((ioport(player ? "FAKE2_X" : "FAKE1_X")->read() & 0xff) * visarea.width()) >> 8); + y = visarea.top() + (((ioport(player ? "FAKE2_Y" : "FAKE1_Y")->read() & 0xff) * visarea.height()) >> 8); } @@ -752,7 +752,7 @@ void jaguar_state::scanline_update(int param) if ((m_gpu_regs[VMODE] & 1) && vc >= (m_gpu_regs[VDB] & 0x7ff)) { uint32_t *dest = &m_screen_bitmap.pix32(vc >> 1); - int maxx = visarea.max_x; + int maxx = visarea.right(); int hde = effective_hvalue(m_gpu_regs[HDE]) >> 1; uint16_t x,scanline[760]; uint8_t y,pixel_width = ((m_gpu_regs[VMODE]>>10)&3)+1; @@ -761,7 +761,7 @@ void jaguar_state::scanline_update(int param) if (ENABLE_BORDERS && vc % 2 == 0) { rgb_t border = rgb_t(m_gpu_regs[BORD1] & 0xff, m_gpu_regs[BORD1] >> 8, m_gpu_regs[BORD2] & 0xff); - for (x = visarea.min_x; x <= visarea.max_x; x++) + for (x = visarea.left(); x <= visarea.right(); x++) dest[x] = border; } diff --git a/src/mame/video/jedi.cpp b/src/mame/video/jedi.cpp index d3ce309fa28..d99be2e9568 100644 --- a/src/mame/video/jedi.cpp +++ b/src/mame/video/jedi.cpp @@ -108,8 +108,8 @@ void jedi_state::do_pen_lookup(bitmap_rgb32 &bitmap, const rectangle &cliprect) get_pens(pens); - for (y = cliprect.min_y; y <= cliprect.max_y; y++) - for(x = cliprect.min_x; x <= cliprect.max_x; x++) + for (y = cliprect.top(); y <= cliprect.bottom(); y++) + for(x = cliprect.left(); x <= cliprect.right(); x++) bitmap.pix32(y, x) = pens[bitmap.pix32(y, x)]; } @@ -158,12 +158,12 @@ void jedi_state::draw_background_and_text(bitmap_rgb32 &bitmap, const rectangle memset(background_line_buffer, 0, 0x200 * sizeof(int)); - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (y = cliprect.top(); y <= cliprect.bottom(); y++) { int x; int bg_last_col = 0; - for (x = cliprect.min_x; x <= cliprect.max_x; x += 2) + for (x = cliprect.left(); x <= cliprect.right(); x += 2) { int tx_col1, tx_col2, bg_col; int bg_tempcol; @@ -285,7 +285,7 @@ void jedi_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect) int i; uint16_t x = spriteram[offs + 0x100] + ((spriteram[offs + 0x40] & 0x01) << 8) - 2; - if ((y < cliprect.min_y) || (y > cliprect.max_y)) + if ((y < cliprect.top()) || (y > cliprect.bottom())) continue; if (flip_x) diff --git a/src/mame/video/klax.cpp b/src/mame/video/klax.cpp index b8a3129a35c..d32022c5d2b 100644 --- a/src/mame/video/klax.cpp +++ b/src/mame/video/klax.cpp @@ -100,11 +100,11 @@ uint32_t klax_state::screen_update_klax(screen_device &screen, bitmap_ind16 &bit // draw and merge the MO bitmap_ind16 &mobitmap = m_mob->bitmap(); for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); - for (int x = rect->min_x; x <= rect->max_x; x++) + for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { /* verified from schematics: diff --git a/src/mame/video/leland.cpp b/src/mame/video/leland.cpp index d0dedd09e74..6408f1d1d9d 100644 --- a/src/mame/video/leland.cpp +++ b/src/mame/video/leland.cpp @@ -450,13 +450,13 @@ uint32_t leland_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap m_tilemap->draw(screen, bitmap, cliprect, 0); /* for each scanline in the visible region */ - for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { uint16_t *const dst = &bitmap.pix16(y); uint8_t const *const fg_src = &m_video_ram[y << 8]; /* for each pixel on the scanline */ - for (int x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { /* build the pen, background is d0-d5 */ pen_t pen = dst[x] & 0x3f; diff --git a/src/mame/video/lemmings.cpp b/src/mame/video/lemmings.cpp index 70d13de215a..c7c3f80a4f4 100644 --- a/src/mame/video/lemmings.cpp +++ b/src/mame/video/lemmings.cpp @@ -118,11 +118,11 @@ void lemmings_state::lemmings_copy_bitmap(bitmap_rgb32& bitmap, int* xscroll, in int y,x; const pen_t *paldata = m_palette->pens(); - for (y=cliprect.min_y; yset_flip_screen(true); @@ -157,12 +155,10 @@ uint32_t lemmings_state::screen_update_lemmings(screen_device &screen, bitmap_rg } else { - rect.max_x = 159; - rect.min_x = 0; + rect.setx(0, 159); lemmings_copy_bitmap(bitmap, &x0, &y, rect); - rect.max_x = 319; - rect.min_x = 160; + rect.setx(160, 319); lemmings_copy_bitmap(bitmap, &x1, &y, rect); } diff --git a/src/mame/video/mac.cpp b/src/mame/video/mac.cpp index 5883d7f102d..ccf6bcfc245 100644 --- a/src/mame/video/mac.cpp +++ b/src/mame/video/mac.cpp @@ -226,7 +226,6 @@ VIDEO_RESET_MEMBER(mac_state,maceagle) VIDEO_RESET_MEMBER(mac_state,macrbv) { - rectangle visarea; int htotal, vtotal; double framerate; int view; @@ -242,16 +241,14 @@ VIDEO_RESET_MEMBER(mac_state,macrbv) m_rbv_type = RBV_TYPE_RBV; - visarea.min_x = 0; - visarea.min_y = 0; view = 0; m_rbv_montype = m_montype.read_safe(2); + rectangle visarea; switch (m_rbv_montype) { case 1: // 15" portrait display - visarea.max_x = 640-1; - visarea.max_y = 870-1; + visarea.set(0, 640-1, 0, 870-1); htotal = 832; vtotal = 918; framerate = 75.0; @@ -259,8 +256,7 @@ VIDEO_RESET_MEMBER(mac_state,macrbv) break; case 2: // 12" RGB - visarea.max_x = 512-1; - visarea.max_y = 384-1; + visarea.set(0, 512-1, 0, 384-1); htotal = 640; vtotal = 407; framerate = 60.15; @@ -268,15 +264,14 @@ VIDEO_RESET_MEMBER(mac_state,macrbv) case 6: // 13" RGB default: - visarea.max_x = 640-1; - visarea.max_y = 480-1; + visarea.set(0, 640-1, 0, 480-1); htotal = 800; vtotal = 525; framerate = 59.94; break; } -// printf("RBV reset: monitor is %dx%d @ %f Hz\n", visarea.max_x+1, visarea.max_y+1, framerate); +// logerror("RBV reset: monitor is %dx%d @ %f Hz\n", visarea.width(), visarea.height(), framerate); m_screen->configure(htotal, vtotal, visarea, HZ_TO_ATTOSECONDS(framerate)); render_target *target = machine().render().first_target(); target->set_view(view); @@ -284,7 +279,6 @@ VIDEO_RESET_MEMBER(mac_state,macrbv) VIDEO_RESET_MEMBER(mac_state,macsonora) { - rectangle visarea; int htotal, vtotal; double framerate; int view = 0; @@ -300,15 +294,12 @@ VIDEO_RESET_MEMBER(mac_state,macsonora) m_rbv_type = RBV_TYPE_SONORA; - visarea.min_x = 0; - visarea.min_y = 0; - m_rbv_montype = m_montype.read_safe(2); + rectangle visarea; switch (m_rbv_montype) { case 1: // 15" portrait display - visarea.max_x = 640-1; - visarea.max_y = 870-1; + visarea.set(0, 640-1, 0, 870-1); htotal = 832; vtotal = 918; framerate = 75.0; @@ -316,8 +307,7 @@ VIDEO_RESET_MEMBER(mac_state,macsonora) break; case 2: // 12" RGB - visarea.max_x = 512-1; - visarea.max_y = 384-1; + visarea.set(0, 512-1, 0, 384-1); htotal = 640; vtotal = 407; framerate = 60.15; @@ -325,15 +315,14 @@ VIDEO_RESET_MEMBER(mac_state,macsonora) case 6: // 13" RGB default: - visarea.max_x = 640-1; - visarea.max_y = 480-1; + visarea.set(0, 640-1, 0, 480-1); htotal = 800; vtotal = 525; framerate = 59.94; break; } -// printf("Sonora reset: monitor is %dx%d @ %f Hz\n", visarea.max_x+1, visarea.max_y+1, framerate); +// logerror("Sonora reset: monitor is %dx%d @ %f Hz\n", visarea.width(), visarea.height(), framerate); m_screen->configure(htotal, vtotal, visarea, HZ_TO_ATTOSECONDS(framerate)); render_target *target = machine().render().first_target(); target->set_view(view); diff --git a/src/mame/video/madalien.cpp b/src/mame/video/madalien.cpp index f07b9badfcf..41e49f8aa1c 100644 --- a/src/mame/video/madalien.cpp +++ b/src/mame/video/madalien.cpp @@ -155,11 +155,8 @@ VIDEO_START_MEMBER(madalien_state,madalien) void madalien_state::draw_edges(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int flip, int scroll_mode) { - rectangle clip_edge1; - rectangle clip_edge2; - - clip_edge1 = cliprect; - clip_edge2 = cliprect; + rectangle clip_edge1(cliprect); + rectangle clip_edge2(cliprect); if (flip) { @@ -205,7 +202,7 @@ void madalien_state::draw_headlight(bitmap_ind16 &bitmap, const rectangle &clipr if (flip) hy = ~hy; - if ((hy < cliprect.min_y) || (hy > cliprect.max_y)) + if ((hy < cliprect.top()) || (hy > cliprect.bottom())) continue; for (x = 0; x < 0x80; x++) @@ -215,7 +212,7 @@ void madalien_state::draw_headlight(bitmap_ind16 &bitmap, const rectangle &clipr if (flip) hx = ~hx; - if ((hx < cliprect.min_x) || (hx > cliprect.max_x)) + if ((hx < cliprect.left()) || (hx > cliprect.right())) continue; if (m_headlight_bitmap->pix16(y, x) != 0) @@ -283,9 +280,9 @@ uint32_t madalien_state::screen_update_madalien(screen_device &screen, bitmap_in min_x = 0xff - max_x_save; } - for (y = cliprect.min_y; y <= cliprect.max_y ; y++) + for (y = cliprect.top(); y <= cliprect.bottom(); y++) for (x = min_x; x <= max_x; x++) - if ((x >= cliprect.min_x) && (x <= cliprect.max_x)) + if ((x >= cliprect.left()) && (x <= cliprect.right())) bitmap.pix16(y, x) |= 8; } diff --git a/src/mame/video/mermaid.cpp b/src/mame/video/mermaid.cpp index 035ec20ca30..00a57d3c3f0 100644 --- a/src/mame/video/mermaid.cpp +++ b/src/mame/video/mermaid.cpp @@ -230,8 +230,8 @@ uint8_t mermaid_state::collision_check( rectangle& rect ) int x; int y; - for (y = rect.min_y; y <= rect.max_y; y++) - for (x = rect.min_x; x <= rect.max_x; x++) + for (y = rect.top(); y <= rect.bottom(); y++) + for (x = rect.left(); x <= rect.right(); x++) { uint16_t a = m_palette->pen_indirect(m_helper.pix16(y, x)) & 0x3f; uint16_t b = m_palette->pen_indirect(m_helper2.pix16(y, x)) & 0x3f; @@ -289,11 +289,9 @@ void mermaid_state::collision_update() sy = 240 - sy; } - rect.min_x = sx; - rect.min_y = sy; - rect.max_x = sx + m_gfxdecode->gfx(1)->width() - 1; - rect.max_y = sy + m_gfxdecode->gfx(1)->height() - 1; - + rect.set( + sx, sx + m_gfxdecode->gfx(1)->width() - 1, + sy, sy + m_gfxdecode->gfx(1)->height() - 1); rect &= visarea; // check collision sprite - background @@ -392,11 +390,9 @@ void mermaid_state::collision_update() sy = 240 - sy; } - rect.min_x = sx; - rect.min_y = sy; - rect.max_x = sx + m_gfxdecode->gfx(1)->width() - 1; - rect.max_y = sy + m_gfxdecode->gfx(1)->height() - 1; - + rect.set( + sx, sx + m_gfxdecode->gfx(1)->width() - 1, + sy, sy + m_gfxdecode->gfx(1)->height() - 1); rect &= visarea; // check collision sprite - sprite @@ -473,11 +469,9 @@ void mermaid_state::collision_update() sy = 240 - sy; } - rect.min_x = sx; - rect.min_y = sy; - rect.max_x = sx + m_gfxdecode->gfx(1)->width() - 1; - rect.max_y = sy + m_gfxdecode->gfx(1)->height() - 1; - + rect.set( + sx, sx + m_gfxdecode->gfx(1)->width() - 1, + sy, sy + m_gfxdecode->gfx(1)->height() - 1); rect &= visarea; // check collision sprite - sprite diff --git a/src/mame/video/namcos21.cpp b/src/mame/video/namcos21.cpp index 5fdb1deda54..db10b9fe6ca 100644 --- a/src/mame/video/namcos21.cpp +++ b/src/mame/video/namcos21.cpp @@ -103,13 +103,13 @@ void namcos21_state::copy_visible_poly_framebuffer(bitmap_ind16 &bitmap, const r { /* blit the visible framebuffer */ int sy; - for( sy=clip.min_y; sy<=clip.max_y; sy++ ) + for( sy=clip.top(); sy<=clip.bottom(); sy++ ) { uint16_t *dest = &bitmap.pix16(sy); const uint16_t *pPen = m_mpPolyFrameBufferPens2.get()+NAMCOS21_POLY_FRAME_WIDTH*sy; const uint16_t *pZ = m_mpPolyFrameBufferZ2.get()+NAMCOS21_POLY_FRAME_WIDTH*sy; int sx; - for( sx=clip.min_x; sx<=clip.max_x; sx++ ) + for( sx=clip.left(); sx<=clip.right(); sx++ ) { int z = pZ[sx]; //if( pZ[sx]!=0x7fff ) @@ -429,17 +429,17 @@ uint32_t namcos21_state::screen_update_driveyes(screen_device &screen, bitmap_in void namcos21_state::winrun_bitmap_draw(bitmap_ind16 &bitmap, const rectangle &cliprect) { uint8_t *videoram = m_videoram.get(); - //printf("%d %d (%d %d) - %04x %04x %04x|%04x %04x\n",cliprect.min_y,cliprect.max_y,m_screen->vpos(),m_gpu_intc->get_posirq_line(),m_winrun_gpu_register[0],m_winrun_gpu_register[2/2],m_winrun_gpu_register[4/2],m_winrun_gpu_register[0xa/2],m_winrun_gpu_register[0xc/2]); + //printf("%d %d (%d %d) - %04x %04x %04x|%04x %04x\n",cliprect.top(),cliprect.bottom(),m_screen->vpos(),m_gpu_intc->get_posirq_line(),m_winrun_gpu_register[0],m_winrun_gpu_register[2/2],m_winrun_gpu_register[4/2],m_winrun_gpu_register[0xa/2],m_winrun_gpu_register[0xc/2]); - int yscroll = -cliprect.min_y+(int16_t)m_winrun_gpu_register[0x2/2]; + int yscroll = -cliprect.top()+(int16_t)m_winrun_gpu_register[0x2/2]; int xscroll = 0;//m_winrun_gpu_register[0xc/2] >> 7; int base = 0x1000+0x100*(m_winrun_color&0xf); int sx,sy; - for( sy=cliprect.min_y; sy<=cliprect.max_y; sy++ ) + for( sy=cliprect.top(); sy<=cliprect.bottom(); sy++ ) { const uint8_t *pSource = &videoram[((yscroll+sy)&0x3ff)*0x200]; uint16_t *pDest = &bitmap.pix16(sy); - for( sx=cliprect.min_x; sx<=cliprect.max_x; sx++ ) + for( sx=cliprect.left(); sx<=cliprect.right(); sx++ ) { int pen = pSource[(sx+xscroll) & 0x1ff]; switch( pen ) diff --git a/src/mame/video/namcos22.cpp b/src/mame/video/namcos22.cpp index 19cabcc08bd..f5765af21d6 100644 --- a/src/mame/video/namcos22.cpp +++ b/src/mame/video/namcos22.cpp @@ -307,11 +307,11 @@ void namcos22_renderer::poly3d_drawquad(screen_device &screen, bitmap_rgb32 &bit int cy = 240 + node->data.quad.vy; m_clipx = cx; m_clipy = cy; - m_cliprect.set(cx + node->data.quad.vw, cx - node->data.quad.vw, cy + node->data.quad.vh, cy - node->data.quad.vh); - if (m_cliprect.min_x < 0) m_cliprect.min_x = 0; - if (m_cliprect.max_x > 639) m_cliprect.max_x = 639; - if (m_cliprect.min_y < 0) m_cliprect.min_y = 0; - if (m_cliprect.max_y > 479) m_cliprect.max_y = 479; + m_cliprect.set( + std::max(cx + node->data.quad.vw, 0), + std::min(cx - node->data.quad.vw, 639), + std::max(cy + node->data.quad.vh, 0), + std::min(cy - node->data.quad.vh, 479)); // non-direct case: project and z-clip if (!direct) @@ -583,11 +583,11 @@ void namcos22_renderer::poly3d_drawsprite( void namcos22_renderer::render_sprite(screen_device &screen, bitmap_rgb32 &bitmap, struct namcos22_scenenode *node) { // scene clip - m_cliprect.set(node->data.sprite.cx_min, node->data.sprite.cx_max, node->data.sprite.cy_min, node->data.sprite.cy_max); - if (m_cliprect.min_x < 0) m_cliprect.min_x = 0; - if (m_cliprect.max_x > 639) m_cliprect.max_x = 639; - if (m_cliprect.min_y < 0) m_cliprect.min_y = 0; - if (m_cliprect.max_y > 479) m_cliprect.max_y = 479; + m_cliprect.set( + std::max(node->data.sprite.cx_min, 0), + std::min(node->data.sprite.cx_max, 639), + std::max(node->data.sprite.cy_min, 0), + std::min(node->data.sprite.cy_max, 479)); int offset = 0; @@ -602,20 +602,19 @@ void namcos22_renderer::render_sprite(screen_device &screen, bitmap_rgb32 &bitma code += nthword(&m_state.m_spriteram[0x800/4], offset + node->data.sprite.linktype*4); poly3d_drawsprite( - screen, - bitmap, - code, - node->data.sprite.color, - node->data.sprite.flipx, - node->data.sprite.flipy, - node->data.sprite.xpos + col * node->data.sprite.sizex, - node->data.sprite.ypos + row * node->data.sprite.sizey, - (node->data.sprite.sizex << 16) / 32, - (node->data.sprite.sizey << 16) / 32, - node->data.sprite.cz, - node->data.sprite.pri, - 0xff - node->data.sprite.translucency - ); + screen, + bitmap, + code, + node->data.sprite.color, + node->data.sprite.flipx, + node->data.sprite.flipy, + node->data.sprite.xpos + col * node->data.sprite.sizex, + node->data.sprite.ypos + row * node->data.sprite.sizey, + (node->data.sprite.sizex << 16) / 32, + (node->data.sprite.sizey << 16) / 32, + node->data.sprite.cz, + node->data.sprite.pri, + 0xff - node->data.sprite.translucency); offset++; } } @@ -1895,12 +1894,12 @@ void namcos22_state::namcos22s_mix_text_layer(screen_device &screen, bitmap_rgb3 rgbaint_t fade_color(0, m_screen_fade_r, m_screen_fade_g, m_screen_fade_b); // mix textlayer with poly/sprites - for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { src = &m_mix_bitmap->pix16(y); dest = &bitmap.pix32(y); pri = &screen.priority().pix8(y); - for (int x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { // skip if transparent or under poly/sprite if (pri[x] == prival) @@ -1970,12 +1969,12 @@ void namcos22_state::namcos22_mix_text_layer(screen_device &screen, bitmap_rgb32 }; // mix textlayer with poly/sprites - for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { src = &m_mix_bitmap->pix16(y); dest = &bitmap.pix32(y); pri = &screen.priority().pix8(y); - for (int x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { uint32_t pixel = dest[x]; @@ -2314,10 +2313,10 @@ uint32_t namcos22_state::screen_update_namcos22s(screen_device &screen, bitmap_r const uint8_t *rlut = (const uint8_t *)&m_mixer[0x100/4]; const uint8_t *glut = (const uint8_t *)&m_mixer[0x200/4]; const uint8_t *blut = (const uint8_t *)&m_mixer[0x300/4]; - for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { uint32_t *dest = &bitmap.pix32(y); - for (int x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { int rgb = dest[x]; int r = rlut[NATIVE_ENDIAN_VALUE_LE_BE(3, 0) ^ ((rgb >> 16) & 0xff)]; diff --git a/src/mame/video/offtwall.cpp b/src/mame/video/offtwall.cpp index 1bdd845059f..d7217b32847 100644 --- a/src/mame/video/offtwall.cpp +++ b/src/mame/video/offtwall.cpp @@ -87,11 +87,11 @@ uint32_t offtwall_state::screen_update_offtwall(screen_device &screen, bitmap_in // draw and merge the MO bitmap_ind16 &mobitmap = m_vad->mob().bitmap(); for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); - for (int x = rect->min_x; x <= rect->max_x; x++) + for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { /* not yet verified diff --git a/src/mame/video/quasar.cpp b/src/mame/video/quasar.cpp index 8f94b3b89e0..8450ffe354f 100644 --- a/src/mame/video/quasar.cpp +++ b/src/mame/video/quasar.cpp @@ -170,11 +170,11 @@ uint32_t quasar_state::screen_update_quasar(screen_device &screen, bitmap_ind16 { int y; - for (y = cliprect.min_y; y <= cliprect.max_y; y++) + for (y = cliprect.top(); y <= cliprect.bottom(); y++) { int x; - for (x = cliprect.min_x; x <= cliprect.max_x; x++) + for (x = cliprect.left(); x <= cliprect.right(); x++) { int pixel0 = s2636_0_bitmap.pix16(y, x); int pixel1 = s2636_1_bitmap.pix16(y, x); diff --git a/src/mame/video/rampart.cpp b/src/mame/video/rampart.cpp index d4ea5e1a2d0..4798bb4d8c8 100644 --- a/src/mame/video/rampart.cpp +++ b/src/mame/video/rampart.cpp @@ -76,11 +76,11 @@ uint32_t rampart_state::screen_update_rampart(screen_device &screen, bitmap_ind1 // draw and merge the MO bitmap_ind16 &mobitmap = m_mob->bitmap(); for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); - for (int x = rect->min_x; x <= rect->max_x; x++) + for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { /* the PCB supports more complex priorities, but the PAL is not stuffed, so we get the default */ @@ -101,13 +101,13 @@ uint32_t rampart_state::screen_update_rampart(screen_device &screen, bitmap_ind1 void rampart_state::rampart_bitmap_render(bitmap_ind16 &bitmap, const rectangle &cliprect) { /* update any dirty scanlines */ - for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { const uint16_t *src = &m_bitmap[256 * y]; uint16_t *dst = &bitmap.pix16(y); /* regenerate the line */ - for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) + for (int x = cliprect.left() & ~1; x <= cliprect.right(); x += 2) { int bits = src[(x - 8) / 2]; dst[x + 0] = bits >> 8; diff --git a/src/mame/video/realbrk.cpp b/src/mame/video/realbrk.cpp index 0b419694fd6..02b1118f122 100644 --- a/src/mame/video/realbrk.cpp +++ b/src/mame/video/realbrk.cpp @@ -184,81 +184,74 @@ void realbrk_state::video_start() ***************************************************************************/ -void realbrk_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, int layer) +// DaiDaiKakumei +// layer : 0== bghigh +void realbrk_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int layer) { - int offs; + int const max_x(m_screen->width()); + int const max_y(m_screen->height()); - int max_x = m_screen->width(); - int max_y = m_screen->height(); - - rectangle spritetile_clip(0, 31, 0, 31); - - for ( offs = 0x3000/2; offs < 0x3600/2; offs += 2/2 ) + for (int offs = 0x3000 / 2; offs < 0x3600 / 2; offs += 2 / 2) { - int sx, sy, dim, zoom, flip, color, attr, code, flipx, flipy, gfx, rot, pri; + if (BIT(m_spriteram[offs], 15)) + continue; - int x, xdim, xnum, xstart, xend, xinc; - int y, ydim, ynum, ystart, yend, yinc; + uint16_t const *const s(&m_spriteram[(m_spriteram[offs] & 0x3ff) * 16 / 2]); - if (m_spriteram[offs] & 0x8000) - continue; + int sy = s[0]; - uint16_t const *const s = &m_spriteram[(m_spriteram[offs] & 0x3ff) * 16/2]; + int sx = s[1]; - sy = s[ 0 ]; - sx = s[ 1 ]; - dim = s[ 2 ]; - zoom = s[ 3 ]; - flip = s[ 4 ]; - color = s[ 5 ]; - attr = s[ 6 ]; - code = s[ 7 ]; + int xnum = ((s[2] >> 0) & 0x001f) + 1; + int ynum = ((s[2] >> 8) & 0x001f) + 1; - pri = flip & 0x03; + int xdim = ((s[3] >> 0) & 0x00ff) << (16 - 6 + 4); + int ydim = ((s[3] >> 8) & 0x00ff) << (16 - 6 + 4); - if(pri != layer) - continue; + int flipx = BIT(s[4], 8); + int flipy = BIT(s[4], 9); + int rot = (s[4] >> 4) & 0x0003; + int pri = (s[4] >> 0) & 0x0003; + + int color = s[5]; - xnum = ((dim >> 0) & 0x1f) + 1; - ynum = ((dim >> 8) & 0x1f) + 1; + int gfx = (s[6] & 0x0001) + 2; - flipx = flip & 0x0100; - flipy = flip & 0x0200; - rot = (flip & 0x0030) >> 4; + int code = s[7]; - gfx = (attr & 0x0001) + 2; + if (pri != layer) + continue; sx = ((sx & 0x1ff) - (sx & 0x200)) << 16; sy = ((sy & 0x0ff) - (sy & 0x100)) << 16; - xdim = ((zoom & 0x00ff) >> 0) << (16-6+4); - ydim = ((zoom & 0xff00) >> 8) << (16-6+4); - - if (flip_screen_x()) { flipx = !flipx; sx = (max_x << 16) - sx - xnum * xdim; } - if (flip_screen_y()) { flipy = !flipy; sy = (max_y << 16) - sy - ynum * ydim; } + if (flip_screen_x()) { flipx = !flipx; sx = (max_x << 16) - sx - xnum * xdim; } + if (flip_screen_y()) { flipy = !flipy; sy = (max_y << 16) - sy - ynum * ydim; } + int xstart, xend, xinc; if (flipx) { xstart = xnum-1; xend = -1; xinc = -1; } else { xstart = 0; xend = xnum; xinc = +1; } + int ystart, yend, yinc; if (flipy) { ystart = ynum-1; yend = -1; yinc = -1; } else { ystart = 0; yend = ynum; yinc = +1; } - - // The positioning of the rotated sprites makes it look as if - // the sprite source is scanned in a constant pattern left to right, - // top to bottom, and the destination plotting pattern is varied. - // copyrozbitmap works the other way. - - // Rotating a sprite when drawgfxzoom draws a tile at a time means - // - rotating each sprite tile - // - transforming each tile position - // - compensating for the offset introduced by the difference in - // scanning patterns between the original mechanism and copyrozbitmap - - - for (y = ystart; y != yend; y += yinc) + /* + The positioning of the rotated sprites makes it look as if + the sprite source is scanned in a constant pattern left to right, + top to bottom, and the destination plotting pattern is varied. + copyrozbitmap works the other way. + + Rotating a sprite when drawgfxzoom draws a tile at a time means + - rotating each sprite tile + - transforming each tile position + - compensating for the offset introduced by the difference in + scanning patterns between the original mechanism and copyrozbitmap + */ + for (int y = ystart; y != yend; y += yinc) { - for (x = xstart; x != xend; x += xinc) + for (int x = xstart; x != xend; x += xinc) { int currx = (sx + x * xdim) / 0x10000; int curry = (sy + y * ydim) / 0x10000; @@ -266,159 +259,79 @@ void realbrk_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect, int scalex = (sx + (x + 1) * xdim) / 0x10000 - currx; int scaley = (sy + (y + 1) * ydim) / 0x10000 - curry; - // buffer the tile and rotate it into bitmap - if( rot ) + if (Rotatable && rot) { - m_tmpbitmap0->fill(0, spritetile_clip ); - m_tmpbitmap1->fill(0, spritetile_clip ); - m_gfxdecode->gfx(gfx)->zoom_transpen(*m_tmpbitmap0,spritetile_clip, - code++, - color, - flipx, flipy, - 0,0, - (rot & 1 ? scaley : scalex) << 12, (rot & 1 ? scalex : scaley) << 12,0); + // buffer the tile and rotate it into bitmap + constexpr rectangle spritetile_clip(0, 31, 0, 31); + m_tmpbitmap0->fill(0, spritetile_clip); + m_tmpbitmap1->fill(0, spritetile_clip); + m_gfxdecode->gfx(gfx)->zoom_transpen(*m_tmpbitmap0, spritetile_clip, + code++, + color, + flipx, flipy, + 0, 0, + ((rot & 1) ? scaley : scalex) << 12, ((rot & 1) ? scalex : scaley) << 12, + 0); // peek at the unrotated sprite - // copybitmap_trans( bitmap,*m_tmpbitmap0, 0,0, 50+(x * xdim/0x10000),50+(y * ydim/0x10000), cliprect, 0 ); - } - - switch( rot ) - { + // copybitmap_trans(bitmap, *m_tmpbitmap0, 0,0, 50 + (x * xdim / 0x10000), 50 + (y * ydim/0x10000), cliprect, 0); + switch (rot) + { case 0x1: // rot 90 - copyrozbitmap_trans( *m_tmpbitmap1, m_tmpbitmap1->cliprect(), *m_tmpbitmap0, - (uint32_t)0<<16, - (uint32_t)16<<16, - 0 << 16, - 0xffff << 16, - 1 << 16, - 0 << 16, - 0, 0 ); - - currx = (sx - (y+1) * ydim) / 0x10000; - curry = (sy + x * xdim) / 0x10000; - - copybitmap_trans( bitmap,*m_tmpbitmap1, 0,0, currx,curry, cliprect, 0 ); + copyrozbitmap_trans(*m_tmpbitmap1, m_tmpbitmap1->cliprect(), *m_tmpbitmap0, + uint32_t(0) << 16, + uint32_t(16) << 16, + 0 << 16, + 0xffff << 16, + 1 << 16, + 0 << 16, + 0, 0); + + currx = (sx - (y + 1) * ydim) / 0x10000; + curry = (sy + x * xdim) / 0x10000; break; case 0x2: // rot 180 - copyrozbitmap_trans( *m_tmpbitmap1, m_tmpbitmap1->cliprect(), *m_tmpbitmap0, - (uint32_t)16<<16, - (uint32_t)16<<16, - 0xffff << 16, - 0 << 16, - 0 << 16, - 0xffff << 16, - 0, 0 ); - - currx = (sx - (x+1) * xdim) / 0x10000; - curry = (sy - (y+1) * ydim) / 0x10000; - - copybitmap_trans( bitmap,*m_tmpbitmap1, 0,0, currx,curry, cliprect, 0 ); + copyrozbitmap_trans(*m_tmpbitmap1, m_tmpbitmap1->cliprect(), *m_tmpbitmap0, + uint32_t(16) << 16, + uint32_t(16) << 16, + 0xffff << 16, + 0 << 16, + 0 << 16, + 0xffff << 16, + 0, 0); + + currx = (sx - (x + 1) * xdim) / 0x10000; + curry = (sy - (y + 1) * ydim) / 0x10000; break; case 0x3: // rot 270 - copyrozbitmap_trans( *m_tmpbitmap1, m_tmpbitmap1->cliprect(), *m_tmpbitmap0, - (uint32_t)16<<16, - (uint32_t)0<<16, - 0 << 16, - 1 << 16, - 0xffff << 16, - 0 << 16, - 0, 0 ); - - currx = (sx + y * ydim) / 0x10000; - curry = (sy - (x+1) * xdim) / 0x10000; - - copybitmap_trans( bitmap,*m_tmpbitmap1, 0,0, currx,curry, cliprect, 0 ); + copyrozbitmap_trans(*m_tmpbitmap1, m_tmpbitmap1->cliprect(), *m_tmpbitmap0, + uint32_t(16) << 16, + uint32_t(0) << 16, + 0 << 16, + 1 << 16, + 0xffff << 16, + 0 << 16, + 0, 0); + + currx = (sx + y * ydim) / 0x10000; + curry = (sy - (x + 1) * xdim) / 0x10000; break; + } - default: - m_gfxdecode->gfx(gfx)->zoom_transpen(bitmap,cliprect, - code++, - color, - flipx, flipy, - currx, curry, - scalex << 12, scaley << 12,0); - break; + copybitmap_trans(bitmap, *m_tmpbitmap1, 0, 0, currx, curry, cliprect, 0); + } + else + { + m_gfxdecode->gfx(gfx)->zoom_transpen(bitmap, cliprect, + code++, + color, + flipx, flipy, + currx, curry, + scalex << 12, scaley << 12, + 0); } - - } - } - } -} - -/* DaiDaiKakumei */ -/* layer : 0== bghighwidth(); - int max_y = m_screen->height(); - - for ( offs = 0x3000/2; offs < 0x3600/2; offs += 2/2 ) - { - int sx, sy, dim, zoom, flip, color, attr, code, flipx, flipy, gfx; - - int x, xdim, xnum, xstart, xend, xinc; - int y, ydim, ynum, ystart, yend, yinc; - - uint16_t *s; - - if (m_spriteram[offs] & 0x8000) continue; - - s = &m_spriteram[(m_spriteram[offs] & 0x3ff) * 16/2]; - - sy = s[ 0 ]; - sx = s[ 1 ]; - dim = s[ 2 ]; - zoom = s[ 3 ]; - flip = s[ 4 ]; - color = s[ 5 ]; - attr = s[ 6 ]; - code = s[ 7 ]; - - if(( flip & 0x03 ) != layer ) continue; - - xnum = ((dim >> 0) & 0x1f) + 1; - ynum = ((dim >> 8) & 0x1f) + 1; - - flipx = flip & 0x0100; - flipy = flip & 0x0200; - - gfx = (attr & 0x0001) + 2; - - sx = ((sx & 0x1ff) - (sx & 0x200)) << 16; - sy = ((sy & 0x0ff) - (sy & 0x100)) << 16; - - xdim = ((zoom & 0x00ff) >> 0) << (16-6+4); - ydim = ((zoom & 0xff00) >> 8) << (16-6+4); - - if (flip_screen_x()) { flipx = !flipx; sx = (max_x << 16) - sx - xnum * xdim; } - if (flip_screen_y()) { flipy = !flipy; sy = (max_y << 16) - sy - ynum * ydim; } - - if (flipx) { xstart = xnum-1; xend = -1; xinc = -1; } - else { xstart = 0; xend = xnum; xinc = +1; } - - if (flipy) { ystart = ynum-1; yend = -1; yinc = -1; } - else { ystart = 0; yend = ynum; yinc = +1; } - - for (y = ystart; y != yend; y += yinc) - { - for (x = xstart; x != xend; x += xinc) - { - int currx = (sx + x * xdim) / 0x10000; - int curry = (sy + y * ydim) / 0x10000; - - int scalex = (sx + (x + 1) * xdim) / 0x10000 - currx; - int scaley = (sy + (y + 1) * ydim) / 0x10000 - curry; - - m_gfxdecode->gfx(gfx)->zoom_transpen(bitmap,cliprect, - code++, - color, - flipx, flipy, - currx, curry, - scalex << 12, scaley << 12,0); } } } @@ -465,46 +378,46 @@ WRITE16_MEMBER(realbrk_state::vregs_w) uint32_t realbrk_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int layers_ctrl = -1; - m_tilemap[0]->set_scrolly(0, m_vregs[0x0/2]); m_tilemap[0]->set_scrollx(0, m_vregs[0x2/2]); m_tilemap[1]->set_scrolly(0, m_vregs[0x4/2]); m_tilemap[1]->set_scrollx(0, m_vregs[0x6/2]); -#ifdef MAME_DEBUG -if ( machine().input().code_pressed(KEYCODE_Z) ) -{ - int msk = 0; - if (machine().input().code_pressed(KEYCODE_Q)) msk |= 1; - if (machine().input().code_pressed(KEYCODE_W)) msk |= 2; - if (machine().input().code_pressed(KEYCODE_E)) msk |= 4; - if (machine().input().code_pressed(KEYCODE_A)) msk |= 8; - if (msk != 0) layers_ctrl &= msk; -} -#endif - if (m_disable_video) { bitmap.fill(m_palette->black_pen(), cliprect); return 0; } - else - bitmap.fill(m_vregs[0xc/2] & 0x7fff, cliprect); - if (layers_ctrl & 8) draw_sprites(bitmap,cliprect,3); // Unknown - if (layers_ctrl & 8) draw_sprites(bitmap,cliprect,2); // Under m_tilemap[1], Under m_tilemap[0] + bitmap.fill(m_vregs[0xc / 2] & 0x7fff, cliprect); + screen.priority().fill(0, cliprect); + + int layers_ctrl(-1); +#ifdef MAME_DEBUG + if (machine().input().code_pressed(KEYCODE_Z)) + { + int msk(0); + if (machine().input().code_pressed(KEYCODE_Q)) msk |= 1; + if (machine().input().code_pressed(KEYCODE_W)) msk |= 2; + if (machine().input().code_pressed(KEYCODE_E)) msk |= 4; + if (machine().input().code_pressed(KEYCODE_A)) msk |= 8; + if (msk) layers_ctrl &= msk; + } +#endif + + if (layers_ctrl & 8) draw_sprites(bitmap, cliprect, 3); // Unknown + if (layers_ctrl & 8) draw_sprites(bitmap, cliprect, 2); // Under m_tilemap[1], Under m_tilemap[0] - if (layers_ctrl & 2) m_tilemap[1]->draw(screen, bitmap, cliprect, 0,0); + if (layers_ctrl & 2) m_tilemap[1]->draw(screen, bitmap, cliprect, 0, 1); - if (layers_ctrl & 8) draw_sprites(bitmap,cliprect,1); // Over m_tilemap[1], Under m_tilemap[0] + if (layers_ctrl & 8) draw_sprites(bitmap,cliprect, 1); // Over m_tilemap[1], Under m_tilemap[0] - if (layers_ctrl & 1) m_tilemap[0]->draw(screen, bitmap, cliprect, 0,0); + if (layers_ctrl & 1) m_tilemap[0]->draw(screen, bitmap, cliprect, 0, 2); - if (layers_ctrl & 8) draw_sprites(bitmap,cliprect,0); // Over m_tilemap[1], Over m_tilemap[0] + if (layers_ctrl & 8) draw_sprites(bitmap,cliprect, 0); // Over m_tilemap[1], Over m_tilemap[0] - if (layers_ctrl & 4) m_tilemap[2]->draw(screen, bitmap, cliprect, 0,0); + if (layers_ctrl & 4) m_tilemap[2]->draw(screen, bitmap, cliprect, 0, 4); // popmessage("%04x",m_vregs[0x8/2]); return 0; @@ -513,85 +426,79 @@ if ( machine().input().code_pressed(KEYCODE_Z) ) /* DaiDaiKakumei */ uint32_t realbrk_state::screen_update_dai2kaku(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int layers_ctrl = -1; - int offs; - - int const bgy0 = m_vregs[0x0/2]; - int const bgx0 = m_vregs[0x2/2]; - int const bgy1 = m_vregs[0x4/2]; - int const bgx1 = m_vregs[0x6/2]; - // bg0 - if( m_vregs[8/2] & (0x0100)){ + int const bgy0(m_vregs[0x0 / 2]); + int const bgx0(m_vregs[0x2 / 2]); + if (BIT(m_vregs[8 / 2], 8)) + { m_tilemap[0]->set_scroll_rows(512); - for(offs=0; offs<(512); offs++) { - m_tilemap[0]->set_scrollx(offs, bgx0 - (m_vram_ras[1][offs]&0x3ff) ); - } - } else { + for (int offs = 0; offs < 512; offs++) + m_tilemap[0]->set_scrollx(offs, bgx0 - (m_vram_ras[1][offs] & 0x3ff)); + } + else + { m_tilemap[0]->set_scroll_rows(1); - m_tilemap[0]->set_scrollx(0, bgx0 ); + m_tilemap[0]->set_scrollx(0, bgx0); } - m_tilemap[0]->set_scrolly(0, bgy0 ); + m_tilemap[0]->set_scrolly(0, bgy0); // bg1 - if( m_vregs[8/2] & (0x0001)){ + int const bgy1(m_vregs[0x4 / 2]); + int const bgx1(m_vregs[0x6 / 2]); + if (BIT(m_vregs[8 / 2], 0)) + { m_tilemap[1]->set_scroll_rows(512); - for(offs=0; offs<(512); offs++) { - m_tilemap[1]->set_scrollx(offs, bgx1 - (m_vram_ras[1][offs]&0x3ff) ); - } - } else { + for (int offs = 0; offs < 512; offs++) + m_tilemap[1]->set_scrollx(offs, bgx1 - (m_vram_ras[1][offs] & 0x3ff)); + } + else + { m_tilemap[1]->set_scroll_rows(1); - m_tilemap[1]->set_scrollx(0, bgx1 ); + m_tilemap[1]->set_scrollx(0, bgx1); } - m_tilemap[1]->set_scrolly(0, bgy1 ); - -#ifdef MAME_DEBUG -if ( machine().input().code_pressed(KEYCODE_Z) ) -{ - int msk = 0; - if (machine().input().code_pressed(KEYCODE_Q)) msk |= 1; - if (machine().input().code_pressed(KEYCODE_W)) msk |= 2; - if (machine().input().code_pressed(KEYCODE_E)) msk |= 4; - if (machine().input().code_pressed(KEYCODE_A)) msk |= 8; - if (msk != 0) layers_ctrl &= msk; -} -#endif + m_tilemap[1]->set_scrolly(0, bgy1); if (m_disable_video) { bitmap.fill(m_palette->black_pen(), cliprect); return 0; } - else - bitmap.fill(m_vregs[0xc/2] & 0x7fff, cliprect); + bitmap.fill(m_vregs[0xc/2] & 0x7fff, cliprect); + screen.priority().fill(0, cliprect); + + int layers_ctrl(-1); +#ifdef MAME_DEBUG + if (machine().input().code_pressed(KEYCODE_Z)) + { + int msk(0); + if (machine().input().code_pressed(KEYCODE_Q)) msk |= 1; + if (machine().input().code_pressed(KEYCODE_W)) msk |= 2; + if (machine().input().code_pressed(KEYCODE_E)) msk |= 4; + if (machine().input().code_pressed(KEYCODE_A)) msk |= 8; + if (msk) layers_ctrl &= msk; + } +#endif + bool const bgpri(BIT(m_vregs[8 / 2], 15)); // spr 0 - if (layers_ctrl & 8) dai2kaku_draw_sprites(bitmap,cliprect,2); + if (layers_ctrl & 8) draw_sprites(bitmap, cliprect, 2); // bglow - if( m_vregs[8/2] & (0x8000)){ - if (layers_ctrl & 1) m_tilemap[0]->draw(screen, bitmap, cliprect, 0,0); - } else { - if (layers_ctrl & 2) m_tilemap[1]->draw(screen, bitmap, cliprect, 0,0); - } + if (layers_ctrl & (bgpri ? 1 : 2)) m_tilemap[bgpri ? 0 : 1]->draw(screen, bitmap, cliprect, 0, 1); // spr 1 - if (layers_ctrl & 8) dai2kaku_draw_sprites(bitmap,cliprect,1); + if (layers_ctrl & 8) draw_sprites(bitmap, cliprect, 1); // bghigh - if( m_vregs[8/2] & (0x8000)){ - if (layers_ctrl & 2) m_tilemap[1]->draw(screen, bitmap, cliprect, 0,0); - } else { - if (layers_ctrl & 1) m_tilemap[0]->draw(screen, bitmap, cliprect, 0,0); - } + if (layers_ctrl & (bgpri ? 2 : 1)) m_tilemap[bgpri ? 1 : 0]->draw(screen, bitmap, cliprect, 0, 2); // spr 2 - if (layers_ctrl & 8) dai2kaku_draw_sprites(bitmap,cliprect,0); + if (layers_ctrl & 8) draw_sprites(bitmap, cliprect, 0); // fix - if (layers_ctrl & 4) m_tilemap[2]->draw(screen, bitmap, cliprect, 0,0); + if (layers_ctrl & 4) m_tilemap[2]->draw(screen, bitmap, cliprect, 0, 4); // usrintf_showmessage("%04x",m_vregs[0x8/2]); return 0; diff --git a/src/mame/video/relief.cpp b/src/mame/video/relief.cpp index e5d64c94d22..26b344682ef 100644 --- a/src/mame/video/relief.cpp +++ b/src/mame/video/relief.cpp @@ -107,12 +107,12 @@ uint32_t relief_state::screen_update_relief(screen_device &screen, bitmap_ind16 // draw and merge the MO bitmap_ind16 &mobitmap = m_vad->mob().bitmap(); for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); uint8_t *pri = &priority_bitmap.pix8(y); - for (int x = rect->min_x; x <= rect->max_x; x++) + for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { /* verified from the GALs on the real PCB; equations follow diff --git a/src/mame/video/rohga.cpp b/src/mame/video/rohga.cpp index e1e6da0e055..73833d5dc9a 100644 --- a/src/mame/video/rohga.cpp +++ b/src/mame/video/rohga.cpp @@ -95,12 +95,12 @@ void rohga_state::mixwizdfirelayer(bitmap_rgb32 &bitmap, const rectangle &clipre uint32_t* dstline; - for (y=cliprect.min_y;y<=cliprect.max_y;y++) + for (y=cliprect.top();y<=cliprect.bottom();y++) { srcline=&sprite_bitmap->pix16(y,0); dstline=&bitmap.pix32(y,0); - for (x=cliprect.min_x;x<=cliprect.max_x;x++) + for (x=cliprect.left();x<=cliprect.right();x++) { uint16_t pix = srcline[x]; @@ -183,7 +183,7 @@ void rohga_state::mixnitroballlayer(screen_device &screen, bitmap_rgb32 &bitmap, uint16_t *srcline1, *srcline2; uint8_t *srcpriline; - for (y=cliprect.min_y;y<=cliprect.max_y;y++) + for (y=cliprect.top();y<=cliprect.bottom();y++) { srcline1=&sprite_bitmap1->pix16(y,0); srcline2=&sprite_bitmap2->pix16(y,0); @@ -191,7 +191,7 @@ void rohga_state::mixnitroballlayer(screen_device &screen, bitmap_rgb32 &bitmap, dstline=&bitmap.pix32(y,0); - for (x=cliprect.min_x;x<=cliprect.max_x;x++) + for (x=cliprect.left();x<=cliprect.right();x++) { uint16_t pix1 = srcline1[x]; uint16_t pix2 = srcline2[x]; diff --git a/src/mame/video/shuuz.cpp b/src/mame/video/shuuz.cpp index eb0aa7089cf..af83bede0e0 100644 --- a/src/mame/video/shuuz.cpp +++ b/src/mame/video/shuuz.cpp @@ -86,11 +86,11 @@ uint32_t shuuz_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, // draw and merge the MO bitmap_ind16 &mobitmap = m_vad->mob().bitmap(); for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); - for (int x = rect->min_x; x <= rect->max_x; x++) + for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { /* verified from the GALs on the real PCB; equations follow diff --git a/src/mame/video/skullxbo.cpp b/src/mame/video/skullxbo.cpp index 8ebc443e31a..dd0507fa1a1 100644 --- a/src/mame/video/skullxbo.cpp +++ b/src/mame/video/skullxbo.cpp @@ -120,7 +120,7 @@ WRITE16_MEMBER( skullxbo_state::skullxbo_yscroll_w ) m_screen->update_partial(scanline); /* adjust the effective scroll for the current scanline */ - if (scanline > m_screen->visible_area().max_y) + if (scanline > m_screen->visible_area().bottom()) scanline = 0; effscroll = (newscroll >> 7) - scanline; @@ -241,11 +241,11 @@ uint32_t skullxbo_state::screen_update_skullxbo(screen_device &screen, bitmap_in // draw and merge the MO bitmap_ind16 &mobitmap = m_mob->bitmap(); for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); - for (int x = rect->min_x; x <= rect->max_x; x++) + for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { /* verified from the GALs on the real PCB; equations follow diff --git a/src/mame/video/sprint2.cpp b/src/mame/video/sprint2.cpp index 537f8d9dea3..ac826694ae7 100644 --- a/src/mame/video/sprint2.cpp +++ b/src/mame/video/sprint2.cpp @@ -83,8 +83,8 @@ uint8_t sprint2_state::collision_check(rectangle& rect) int x; int y; - for (y = rect.min_y; y <= rect.max_y; y++) - for (x = rect.min_x; x <= rect.max_x; x++) + for (y = rect.top(); y <= rect.bottom(); y++) + for (x = rect.left(); x <= rect.right(); x++) { uint16_t a = m_palette->pen_indirect(m_helper.pix16(y, x)); @@ -155,13 +155,11 @@ WRITE_LINE_MEMBER(sprint2_state::screen_vblank_sprint2) for (i = 0; i < 2; i++) { - rectangle rect; - - rect.min_x = get_sprite_x(video_ram, i); - rect.min_y = get_sprite_y(video_ram, i); - rect.max_x = get_sprite_x(video_ram, i) + m_gfxdecode->gfx(1)->width() - 1; - rect.max_y = get_sprite_y(video_ram, i) + m_gfxdecode->gfx(1)->height() - 1; - + rectangle rect( + get_sprite_x(video_ram, i), + get_sprite_x(video_ram, i) + m_gfxdecode->gfx(1)->width() - 1, + get_sprite_y(video_ram, i), + get_sprite_y(video_ram, i) + m_gfxdecode->gfx(1)->height() - 1); rect &= visarea; /* check for sprite-tilemap collisions */ diff --git a/src/mame/video/sprint4.cpp b/src/mame/video/sprint4.cpp index 9df60a4710f..0c7429ef3c8 100644 --- a/src/mame/video/sprint4.cpp +++ b/src/mame/video/sprint4.cpp @@ -90,19 +90,17 @@ WRITE_LINE_MEMBER(sprint4_state::screen_vblank) for (int i = 0; i < 4; i++) { - rectangle rect; - int bank = 0; uint8_t horz = m_videoram[0x390 + 2 * i + 0]; uint8_t vert = m_videoram[0x398 + 2 * i + 0]; uint8_t code = m_videoram[0x398 + 2 * i + 1]; - rect.min_x = horz - 15; - rect.min_y = vert - 15; - rect.max_x = horz - 15 + m_gfxdecode->gfx(1)->width() - 1; - rect.max_y = vert - 15 + m_gfxdecode->gfx(1)->height() - 1; - + rectangle rect( + horz - 15, + horz - 15 + m_gfxdecode->gfx(1)->width() - 1, + vert - 15, + vert - 15 + m_gfxdecode->gfx(1)->height() - 1); rect &= m_screen->visible_area(); m_playfield->draw(*m_screen, m_helper, rect, 0, 0); @@ -117,8 +115,8 @@ WRITE_LINE_MEMBER(sprint4_state::screen_vblank) horz - 15, vert - 15, 1); - for (int y = rect.min_y; y <= rect.max_y; y++) - for (int x = rect.min_x; x <= rect.max_x; x++) + for (int y = rect.top(); y <= rect.bottom(); y++) + for (int x = rect.left(); x <= rect.right(); x++) if (m_palette->pen_indirect(m_helper.pix16(y, x)) != 0) m_collision[i] = 1; } diff --git a/src/mame/video/tank8.cpp b/src/mame/video/tank8.cpp index d38ca8dbbf4..a1c515cfba2 100644 --- a/src/mame/video/tank8.cpp +++ b/src/mame/video/tank8.cpp @@ -210,7 +210,7 @@ WRITE_LINE_MEMBER(tank8_state::screen_vblank) draw_sprites(m_helper2, visarea); draw_bullets(m_helper3, visarea); - for (y = visarea.min_y; y <= visarea.max_y; y++) + for (y = visarea.top(); y <= visarea.bottom(); y++) { int _state = 0; @@ -221,7 +221,7 @@ WRITE_LINE_MEMBER(tank8_state::screen_vblank) if ((m_screen->frame_number() ^ y) & 1) continue; /* video display is interlaced */ - for (x = visarea.min_x; x <= visarea.max_x; x++) + for (x = visarea.left(); x <= visarea.right(); x++) { uint8_t index; diff --git a/src/mame/video/thunderj.cpp b/src/mame/video/thunderj.cpp index b2a5e3506fc..e51c58d899f 100644 --- a/src/mame/video/thunderj.cpp +++ b/src/mame/video/thunderj.cpp @@ -119,12 +119,12 @@ uint32_t thunderj_state::screen_update_thunderj(screen_device &screen, bitmap_in // draw and merge the MO bitmap_ind16 &mobitmap = m_vad->mob().bitmap(); for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); uint8_t *pri = &priority_bitmap.pix8(y); - for (int x = rect->min_x; x <= rect->max_x; x++) + for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { /* verified from the GALs on the real PCB; equations follow @@ -217,11 +217,11 @@ uint32_t thunderj_state::screen_update_thunderj(screen_device &screen, bitmap_in /* now go back and process the upper bit of MO priority */ for (const sparse_dirty_rect *rect = m_vad->mob().first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); - for (int x = rect->min_x; x <= rect->max_x; x++) + for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; -- cgit v1.2.3 From 142e1842c3f37b713bc2e1ddf4ee54fd3584419f Mon Sep 17 00:00:00 2001 From: Robbbert Date: Sat, 28 Jul 2018 02:51:02 +1000 Subject: (nw) super6 : notes, cleanup --- src/mame/drivers/super6.cpp | 99 +++++++++++++++++++++------------------------ src/mame/includes/super6.h | 4 +- 2 files changed, 48 insertions(+), 55 deletions(-) diff --git a/src/mame/drivers/super6.cpp b/src/mame/drivers/super6.cpp index 69a284b8ce5..8fa0153a9c3 100644 --- a/src/mame/drivers/super6.cpp +++ b/src/mame/drivers/super6.cpp @@ -2,12 +2,20 @@ // copyright-holders:Curt Coder /* - TODO: - - floppy (cannot be implemented currently since this is another case of halting the cpu mid-instruction) - - interrupts - - DMA - - peripheral interfaces +ToDo: +- peripheral interfaces + +- Fix floppy. It needs to WAIT the cpu whenever port 0x14 is read, wait + for either DRQ ir INTRQ to assert, then release the cpu and then do the + actual port read. Our Z80 cannot do that. + The schematic isn't clear, but it seems the 2 halves of U16 (as shown) have + a common element, so that activity on one side can affect what happens on + the other side. + If you uncomment the line in fdc_intrq_w, and change the BOGUSWAIT to WAIT + in fdc_r, then load up the cpm disk (from software list), it will read the + CP/M boot track into memory and attempt to run it. However, it has an issue + and returns to the monitor. The other disks are useless. */ @@ -193,11 +201,9 @@ READ8_MEMBER( super6_state::fdc_r ) */ - // don't crash please... but it's true, WAIT does nothing in our Z80 - //fatalerror("Z80 WAIT not supported by MAME core\n"); m_maincpu->set_input_line(Z80_INPUT_LINE_BOGUSWAIT, ASSERT_LINE); - return !m_fdc->intrq_r() << 7; + return m_fdc->intrq_r() ? 0x7f : 0xff; } @@ -224,21 +230,24 @@ WRITE8_MEMBER( super6_state::fdc_w ) */ // disk drive select - floppy_image_device *m_floppy = nullptr; + floppy_image_device *floppy = nullptr; if ((data & 3) == 0) - m_floppy = m_floppy0->get_device(); + floppy = m_floppy0->get_device(); if ((data & 3) == 1) - m_floppy = m_floppy1->get_device(); + floppy = m_floppy1->get_device(); - m_fdc->set_floppy(m_floppy); - if (m_floppy) m_floppy->mon_w(0); + m_fdc->set_floppy(floppy); + if (floppy) floppy->mon_w(0); // head select - if (m_floppy) m_floppy->ss_w(BIT(data, 2)); + if (floppy) floppy->ss_w(BIT(data, 2)); // disk density m_fdc->dden_w(!BIT(data, 3)); + + // disk size + m_fdc->set_unscaled_clock (BIT(data, 4) ? 1'000'000 : 2'000'000); // division occurs inside fdc depending on ENMF } @@ -263,6 +272,7 @@ void super6_state::super6_mem(address_map &map) void super6_state::super6_io(address_map &map) { map.global_mask(0xff); + map.unmap_value_high(); map(0x00, 0x03).rw(m_dart, FUNC(z80dart_device::ba_cd_r), FUNC(z80dart_device::ba_cd_w)); map(0x04, 0x07).rw(m_pio, FUNC(z80pio_device::read), FUNC(z80pio_device::write)); map(0x08, 0x0b).rw(m_ctc, FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); @@ -289,7 +299,7 @@ void super6_state::super6_io(address_map &map) static INPUT_PORTS_START( super6 ) PORT_START("J7") - PORT_DIPNAME( 0x0f, 0x0f, "SIO Channel A Baud Rate" ) PORT_DIPLOCATION("J7:1,2,3,4") + PORT_DIPNAME( 0x0f, 0x0e, "SIO Channel A Baud Rate" ) PORT_DIPLOCATION("J7:1,2,3,4") PORT_DIPSETTING( 0x00, "50" ) PORT_DIPSETTING( 0x01, "75" ) PORT_DIPSETTING( 0x02, "110" ) @@ -330,11 +340,6 @@ INPUT_PORTS_END // Z80CTC //------------------------------------------------- -TIMER_DEVICE_CALLBACK_MEMBER( super6_state::ctc_tick ) -{ - m_ctc->trg0(1); - m_ctc->trg0(0); -} //------------------------------------------------- // Z80DMA @@ -376,14 +381,15 @@ static void super6_floppies(device_slot_interface &device) WRITE_LINE_MEMBER( super6_state::fdc_intrq_w ) { - if (state) m_maincpu->set_input_line(Z80_INPUT_LINE_BOGUSWAIT, CLEAR_LINE); + if (state) m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, CLEAR_LINE); - m_ctc->trg3(!state); + m_ctc->trg3(state); // J6 pin 7-8 + // m_maincpu->set_state_int(Z80_AF, 0x7f00); // hack, see notes } WRITE_LINE_MEMBER( super6_state::fdc_drq_w ) { - if (state) m_maincpu->set_input_line(Z80_INPUT_LINE_BOGUSWAIT, CLEAR_LINE); + if (state) m_maincpu->set_input_line(Z80_INPUT_LINE_WAIT, CLEAR_LINE); m_dma->rdy_w(state); } @@ -393,24 +399,14 @@ WRITE_LINE_MEMBER( super6_state::fdc_drq_w ) // z80_daisy_config super6_daisy_chain //------------------------------------------------- -static const z80_daisy_config super6_daisy_chain[] = -{ - { Z80CTC_TAG }, - { Z80DART_TAG }, - { Z80PIO_TAG }, - { nullptr } -}; - - -static DEVICE_INPUT_DEFAULTS_START( terminal ) - DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_19200 ) - DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_19200 ) - DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) - DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_8 ) - DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) - DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_1 ) -DEVICE_INPUT_DEFAULTS_END - +// no evidence of daisy chain in use - removed for now +//static const z80_daisy_config super6_daisy_chain[] = +//{ +// { Z80CTC_TAG }, +// { Z80DART_TAG }, +// { Z80PIO_TAG }, +// { nullptr } +//}; //************************************************************************** @@ -435,11 +431,6 @@ void super6_state::machine_reset() m_bank0 = m_bank1 = 0; bankswitch(); - - uint8_t baud = m_j7->read(); - - m_brg->write_str(baud & 0x0f); - m_brg->write_stt((baud >> 4) & 0x07); } @@ -457,17 +448,19 @@ MACHINE_CONFIG_START(super6_state::super6) MCFG_DEVICE_ADD(m_maincpu, Z80, 24_MHz_XTAL / 4) MCFG_DEVICE_PROGRAM_MAP(super6_mem) MCFG_DEVICE_IO_MAP(super6_io) - MCFG_Z80_DAISY_CHAIN(super6_daisy_chain) + //MCFG_Z80_DAISY_CHAIN(super6_daisy_chain) // devices MCFG_DEVICE_ADD(m_ctc, Z80CTC, 24_MHz_XTAL / 4) + MCFG_Z80CTC_ZC0_CB(WRITELINE(m_ctc, z80ctc_device, trg1)) // J6 pin 2-3 MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", super6_state, ctc_tick, attotime::from_hz(24_MHz_XTAL / 16)) + clock_device &ctc_tick(CLOCK(config, "ctc_tick", 24_MHz_XTAL / 16)); + ctc_tick.signal_handler().set(m_ctc, FUNC(z80ctc_device::trg0)); // J6 pin 1-14 (1.5MHz) MCFG_DEVICE_ADD(m_dma, Z80DMA, 24_MHz_XTAL / 6) - MCFG_Z80DMA_OUT_BUSREQ_CB(INPUTLINE(Z80_TAG, INPUT_LINE_HALT)) - MCFG_Z80DMA_OUT_INT_CB(WRITELINE(Z80CTC_TAG, z80ctc_device, trg2)) + MCFG_Z80DMA_OUT_BUSREQ_CB(WRITELINE(m_dma, z80dma_device, bai_w)) + MCFG_Z80DMA_OUT_INT_CB(WRITELINE(m_ctc, z80ctc_device, trg2)) MCFG_Z80DMA_IN_MREQ_CB(READ8(*this, super6_state, memory_read_byte)) MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(*this, super6_state, memory_write_byte)) MCFG_Z80DMA_IN_IORQ_CB(READ8(*this, super6_state, io_read_byte)) @@ -476,12 +469,15 @@ MACHINE_CONFIG_START(super6_state::super6) MCFG_DEVICE_ADD(m_pio, Z80PIO, 24_MHz_XTAL / 4) MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_DEVICE_ADD(WD2793_TAG, WD2793, 1000000) + MCFG_DEVICE_ADD(m_fdc, WD2793, 24_MHz_XTAL / 12) + MCFG_WD_FDC_FORCE_READY MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(*this, super6_state, fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(*this, super6_state, fdc_drq_w)) MCFG_FLOPPY_DRIVE_ADD(m_floppy0, super6_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) MCFG_FLOPPY_DRIVE_ADD(m_floppy1, super6_floppies, nullptr, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_SOUND(true) MCFG_DEVICE_ADD(m_dart, Z80DART, 24_MHz_XTAL / 4) MCFG_Z80DART_OUT_TXDA_CB(WRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) @@ -494,7 +490,6 @@ MACHINE_CONFIG_START(super6_state::super6) MCFG_DEVICE_ADD(RS232_A_TAG, RS232_PORT, default_rs232_devices, "terminal") MCFG_RS232_RXD_HANDLER(WRITELINE(m_dart, z80dart_device, rxa_w)) - MCFG_SLOT_OPTION_DEVICE_INPUT_DEFAULTS("terminal", terminal) MCFG_DEVICE_ADD(RS232_B_TAG, RS232_PORT, default_rs232_devices, nullptr) MCFG_RS232_RXD_HANDLER(WRITELINE(m_dart, z80dart_device, rxb_w)) diff --git a/src/mame/includes/super6.h b/src/mame/includes/super6.h index d9641bda2a3..1ea9122c9fc 100644 --- a/src/mame/includes/super6.h +++ b/src/mame/includes/super6.h @@ -9,7 +9,7 @@ #include "machine/z80daisy.h" #include "machine/com8116.h" #include "machine/ram.h" -#include "machine/timer.h" +#include "machine/clock.h" #include "machine/wd_fdc.h" #include "machine/z80ctc.h" #include "machine/z80dart.h" @@ -59,8 +59,6 @@ private: DECLARE_WRITE8_MEMBER( bank1_w ); DECLARE_WRITE_LINE_MEMBER( fdc_intrq_w ); DECLARE_WRITE_LINE_MEMBER( fdc_drq_w ); - - TIMER_DEVICE_CALLBACK_MEMBER(ctc_tick); DECLARE_READ8_MEMBER(memory_read_byte); DECLARE_WRITE8_MEMBER(memory_write_byte); DECLARE_READ8_MEMBER(io_read_byte); -- cgit v1.2.3 From af6434355d67ecf4761a3ed8627b70fd19a43b9b Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sat, 28 Jul 2018 04:06:48 +1000 Subject: make a few more atari things use rect getters/setters (nw) --- src/mame/video/atarigx2.cpp | 2 +- src/mame/video/atarimo.cpp | 2 +- src/mame/video/atarirle.cpp | 12 +++++------- src/mame/video/galaxia.cpp | 8 ++++---- src/mame/video/sprint8.cpp | 4 ++-- src/mame/video/starshp1.cpp | 22 ++++++++-------------- src/mame/video/toobin.cpp | 4 ++-- src/mame/video/triplhnt.cpp | 6 +++--- src/mame/video/tunhunt.cpp | 4 ++-- src/mame/video/ultratnk.cpp | 16 +++++++--------- src/mame/video/vindictr.cpp | 12 ++++++------ src/mame/video/wolfpack.cpp | 38 ++++++++++---------------------------- src/mame/video/xybots.cpp | 4 ++-- 13 files changed, 53 insertions(+), 81 deletions(-) diff --git a/src/mame/video/atarigx2.cpp b/src/mame/video/atarigx2.cpp index 7a0d8229f27..8d0b98235b0 100644 --- a/src/mame/video/atarigx2.cpp +++ b/src/mame/video/atarigx2.cpp @@ -184,7 +184,7 @@ uint32_t atarigx2_state::screen_update_atarigx2(screen_device &screen, bitmap_in bitmap_ind16 &mo_bitmap = m_rle->vram(0); int left = cliprect.left(); int top = cliprect.top(); - int right = cliprect.left() + 1; + int right = cliprect.right() + 1; int bottom = cliprect.bottom() + 1; int x, y; diff --git a/src/mame/video/atarimo.cpp b/src/mame/video/atarimo.cpp index 589da0a3c5d..3db58a6d8d2 100644 --- a/src/mame/video/atarimo.cpp +++ b/src/mame/video/atarimo.cpp @@ -185,7 +185,7 @@ void atari_motion_objects_device::draw(bitmap_ind16 &bitmap, const rectangle &cl bandclip.min_y -= m_bitmapheight; // maximum Y is based on the minimum - bandclip.max_y = bandclip.min_y + (1 << m_slipshift) - 1; + bandclip.set_height(1 << m_slipshift); // keep within the cliprect bandclip &= cliprect; diff --git a/src/mame/video/atarirle.cpp b/src/mame/video/atarirle.cpp index fb5240f2b62..7c0882619bf 100644 --- a/src/mame/video/atarirle.cpp +++ b/src/mame/video/atarirle.cpp @@ -97,11 +97,10 @@ WRITE8_MEMBER(atari_rle_objects_device::control_write) if ((oldbits & ATARIRLE_CONTROL_ERASE) != 0) { // compute the top and bottom of the rect - rectangle cliprect = m_cliprect; - if (m_partial_scanline + 1 > cliprect.min_y) - cliprect.min_y = m_partial_scanline + 1; - if (scanline < cliprect.max_y) - cliprect.max_y = scanline; + rectangle cliprect(m_cliprect); + cliprect.sety( + (std::max)(cliprect.top(), m_partial_scanline + 1), + (std::min)(cliprect.bottom(), scanline)); //logerror(" partial erase %d-%d (frame %d)\n", cliprect.top(), cliprect.bottom(), (oldbits & ATARIRLE_CONTROL_FRAME) >> 2); @@ -152,8 +151,7 @@ void atari_rle_objects_device::vblank_callback(screen_device &screen, bool state { // compute top only; bottom is equal to visible_area rectangle cliprect = m_cliprect; - if (m_partial_scanline + 1 > cliprect.min_y) - cliprect.min_y = m_partial_scanline + 1; + cliprect.sety((std::max)(cliprect.top(), m_partial_scanline + 1), cliprect.bottom()); //logerror(" partial erase %d-%d (frame %d)\n", cliprect.top(), cliprect.bottom(), (m_control_bits & ATARIRLE_CONTROL_FRAME) >> 2); diff --git a/src/mame/video/galaxia.cpp b/src/mame/video/galaxia.cpp index fa7b24c9f5d..6cfbcdb5e80 100644 --- a/src/mame/video/galaxia.cpp +++ b/src/mame/video/galaxia.cpp @@ -208,7 +208,7 @@ uint32_t galaxia_state::screen_update_astrowar(screen_device &screen, bitmap_ind float s_ratio = 256.0f / 196.0f; float sx = x * s_ratio; - if ((int)(sx + 0.5f) > cliprect.right()) + if (int(sx + 0.5f) > cliprect.right()) break; // copy the S2636 bitmap into the main bitmap and check collision @@ -217,11 +217,11 @@ uint32_t galaxia_state::screen_update_astrowar(screen_device &screen, bitmap_ind if (S2636_IS_PIXEL_DRAWN(pixel)) { // S2636 vs. background collision detection - if ((m_temp_bitmap.pix16(y, (int)(sx)) | m_temp_bitmap.pix16(y, (int)(sx + 0.5f))) & 1) + if ((m_temp_bitmap.pix16(y, int(sx)) | m_temp_bitmap.pix16(y, int(sx + 0.5f))) & 1) m_collision_register |= 0x01; - bitmap.pix16(y, (int)(sx)) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE; - bitmap.pix16(y, (int)(sx + 0.5f)) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE; + bitmap.pix16(y, int(sx)) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE; + bitmap.pix16(y, int(sx + 0.5f)) = S2636_PIXEL_COLOR(pixel) | SPRITE_PEN_BASE; } } } diff --git a/src/mame/video/sprint8.cpp b/src/mame/video/sprint8.cpp index 9971b6d627e..a3ce7092c30 100644 --- a/src/mame/video/sprint8.cpp +++ b/src/mame/video/sprint8.cpp @@ -170,12 +170,12 @@ WRITE_LINE_MEMBER(sprint8_state::screen_vblank) draw_sprites(m_helper1, visarea); - for (int y = visarea.min_y; y <= visarea.max_y; y++) + for (int y = visarea.top(); y <= visarea.bottom(); y++) { const uint16_t* p1 = &m_helper1.pix16(y); const uint16_t* p2 = &m_helper2.pix16(y); - for (int x = visarea.min_x; x <= visarea.max_x; x++) + for (int x = visarea.left(); x <= visarea.right(); x++) if (p1[x] != 0x20 && p2[x] == 0x23) m_collision_timer->adjust(m_screen->time_until_pos(y + 24, x), m_palette->pen_indirect(p1[x])); } diff --git a/src/mame/video/starshp1.cpp b/src/mame/video/starshp1.cpp index 947d6eb9438..0e63333814b 100644 --- a/src/mame/video/starshp1.cpp +++ b/src/mame/video/starshp1.cpp @@ -305,14 +305,11 @@ void starshp1_state::draw_circle(bitmap_ind16 &bitmap) int starshp1_state::spaceship_collision(bitmap_ind16 &bitmap, const rectangle &rect) { - int x; - int y; - - for (y = rect.min_y; y <= rect.max_y; y++) + for (int y = rect.top(); y <= rect.bottom(); y++) { const uint16_t* pLine = &m_helper.pix16(y); - for (x = rect.min_x; x <= rect.max_x; x++) + for (int x = rect.left(); x <= rect.right(); x++) if (pLine[x] != 0) return 1; } @@ -337,10 +334,10 @@ int starshp1_state::circle_collision(const rectangle &rect) int r = get_radius(); - return point_in_circle(rect.min_x, rect.min_y, center_x, center_y, r) || - point_in_circle(rect.min_x, rect.max_y, center_x, center_y, r) || - point_in_circle(rect.max_x, rect.min_y, center_x, center_y, r) || - point_in_circle(rect.max_x, rect.max_y, center_x, center_y, r); + return point_in_circle(rect.left(), rect.top(), center_x, center_y, r) || + point_in_circle(rect.left(), rect.bottom(), center_x, center_y, r) || + point_in_circle(rect.right(), rect.top(), center_x, center_y, r) || + point_in_circle(rect.right(), rect.bottom(), center_x, center_y, r); } @@ -378,13 +375,10 @@ WRITE_LINE_MEMBER(starshp1_state::screen_vblank_starshp1) // rising edge if (state) { - rectangle rect; const rectangle &visarea = m_screen->visible_area(); - rect.min_x = get_sprite_hpos(13); - rect.min_y = get_sprite_vpos(13); - rect.max_x = rect.min_x + m_gfxdecode->gfx(1)->width() - 1; - rect.max_y = rect.min_y + m_gfxdecode->gfx(1)->height() - 1; + rectangle rect(get_sprite_hpos(13), 0, get_sprite_vpos(13), 0); + rect.set_size(m_gfxdecode->gfx(1)->width(), m_gfxdecode->gfx(1)->height()); rect &= m_helper.cliprect(); diff --git a/src/mame/video/toobin.cpp b/src/mame/video/toobin.cpp index d16fce21cd1..643b6d7f26d 100644 --- a/src/mame/video/toobin.cpp +++ b/src/mame/video/toobin.cpp @@ -224,13 +224,13 @@ uint32_t toobin_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap /* draw and merge the MO */ bitmap_ind16 &mobitmap = m_mob->bitmap(); const pen_t *palette = m_palette->pens(); - for (int y = cliprect.min_y; y <= cliprect.max_y; y++) + for (int y = cliprect.top(); y <= cliprect.bottom(); y++) { uint32_t *dest = &bitmap.pix32(y); uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &m_pfbitmap.pix16(y); uint8_t *pri = &priority_bitmap.pix8(y); - for (int x = cliprect.min_x; x <= cliprect.max_x; x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) { uint16_t pix = pf[x]; if (mo[x] != 0xffff) diff --git a/src/mame/video/triplhnt.cpp b/src/mame/video/triplhnt.cpp index e1b95963282..0984d3f99de 100644 --- a/src/mame/video/triplhnt.cpp +++ b/src/mame/video/triplhnt.cpp @@ -83,7 +83,7 @@ void triplhnt_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec m_gfxdecode->gfx(m_sprite_zoom)->opaque(m_helper,cliprect, 2 * code + m_sprite_bank, 0, code & 8, 0, - rect.min_x, rect.min_y); + rect.left(), rect.top()); rect &= cliprect; @@ -93,9 +93,9 @@ void triplhnt_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec int x; int y; - for (x = rect.min_x; x <= rect.max_x; x++) + for (x = rect.left(); x <= rect.right(); x++) { - for (y = rect.min_y; y <= rect.max_y; y++) + for (y = rect.top(); y <= rect.bottom(); y++) { pen_t a = m_helper.pix16(y, x); pen_t b = bitmap.pix16(y, x); diff --git a/src/mame/video/tunhunt.cpp b/src/mame/video/tunhunt.cpp index 5fe83d29341..3f9100cad93 100644 --- a/src/mame/video/tunhunt.cpp +++ b/src/mame/video/tunhunt.cpp @@ -291,7 +291,7 @@ void tunhunt_state::draw_box(bitmap_ind16 &bitmap, const rectangle &cliprect) for( y=0; y<256; y++ ) { - if (0xff-y >= cliprect.min_y && 0xff-y <= cliprect.max_y) + if (0xff-y >= cliprect.top() && 0xff-y <= cliprect.bottom()) for( x=0; x<256; x++ ) { color = 0; @@ -308,7 +308,7 @@ void tunhunt_state::draw_box(bitmap_ind16 &bitmap, const rectangle &cliprect) z = x0; /* give priority to rightmost spans */ } } - if (x >= cliprect.min_x && x <= cliprect.max_x) + if (x >= cliprect.left() && x <= cliprect.right()) bitmap.pix16(0xff-y, x) = color; } } diff --git a/src/mame/video/ultratnk.cpp b/src/mame/video/ultratnk.cpp index 797089cd82f..68113aec3c6 100644 --- a/src/mame/video/ultratnk.cpp +++ b/src/mame/video/ultratnk.cpp @@ -95,19 +95,17 @@ WRITE_LINE_MEMBER(ultratnk_state::screen_vblank) for (int i = 0; i < 4; i++) { - rectangle rect; - int bank = 0; uint8_t horz = m_videoram[0x390 + 2 * i + 0]; uint8_t vert = m_videoram[0x398 + 2 * i + 0]; uint8_t code = m_videoram[0x398 + 2 * i + 1]; - rect.min_x = horz - 15; - rect.min_y = vert - 15; - rect.max_x = horz - 15 + m_gfxdecode->gfx(1)->width() - 1; - rect.max_y = vert - 15 + m_gfxdecode->gfx(1)->height() - 1; - + rectangle rect( + horz - 15, + horz - 15 + m_gfxdecode->gfx(1)->width() - 1, + vert - 15, + vert - 15 + m_gfxdecode->gfx(1)->height() - 1); rect &= m_screen->visible_area(); m_playfield->draw(*m_screen, m_helper, rect, 0, 0); @@ -122,8 +120,8 @@ WRITE_LINE_MEMBER(ultratnk_state::screen_vblank) horz - 15, vert - 15, 1); - for (int y = rect.min_y; y <= rect.max_y; y++) - for (int x = rect.min_x; x <= rect.max_x; x++) + for (int y = rect.top(); y <= rect.bottom(); y++) + for (int x = rect.left(); x <= rect.right(); x++) if (m_palette->pen_indirect(m_helper.pix16(y, x)) != BG) m_collision[i] = 1; } diff --git a/src/mame/video/vindictr.cpp b/src/mame/video/vindictr.cpp index 810700c2e83..0b243780a87 100644 --- a/src/mame/video/vindictr.cpp +++ b/src/mame/video/vindictr.cpp @@ -179,8 +179,8 @@ void vindictr_state::scanline_update(screen_device &screen, int scanline) /* a new vscroll latches the offset into a counter; we must adjust for this */ int offset = scanline; const rectangle &visible_area = screen.visible_area(); - if (offset > visible_area.max_y) - offset -= visible_area.max_y + 1; + if (offset > visible_area.bottom()) + offset -= visible_area.bottom() + 1; if (m_playfield_yscroll != ((data - offset) & 0x1ff)) { @@ -213,11 +213,11 @@ uint32_t vindictr_state::screen_update_vindictr(screen_device &screen, bitmap_in // draw and merge the MO bitmap_ind16 &mobitmap = m_mob->bitmap(); for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); - for (int x = rect->min_x; x <= rect->max_x; x++) + for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { /* partially verified via schematics (there are a lot of PALs involved!): @@ -253,11 +253,11 @@ uint32_t vindictr_state::screen_update_vindictr(screen_device &screen, bitmap_in /* now go back and process the upper bit of MO priority */ for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); - for (int x = rect->min_x; x <= rect->max_x; x++) + for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { int mopriority = mo[x] >> atari_motion_objects_device::PRIORITY_SHIFT; diff --git a/src/mame/video/wolfpack.cpp b/src/mame/video/wolfpack.cpp index 0d35050a597..b00c6d983f6 100644 --- a/src/mame/video/wolfpack.cpp +++ b/src/mame/video/wolfpack.cpp @@ -195,14 +195,10 @@ void wolfpack_state::draw_torpedo(bitmap_ind16 &bitmap, const rectangle &cliprec void wolfpack_state::draw_pt(bitmap_ind16 &bitmap, const rectangle &cliprect) { - rectangle rect = cliprect; - - if (!(m_pt_pic & 0x20)) - rect.min_x = 256; - - if (!(m_pt_pic & 0x10)) - rect.max_x = 255; - + rectangle rect(cliprect); + rect.setx( + (m_pt_pic & 0x20) ? rect.left() : 256, + (m_pt_pic & 0x10) ? rect.right() : 255); m_gfxdecode->gfx(2)->transpen(bitmap,rect, m_pt_pic, @@ -223,19 +219,11 @@ void wolfpack_state::draw_pt(bitmap_ind16 &bitmap, const rectangle &cliprect) void wolfpack_state::draw_water(palette_device &palette, bitmap_ind16 &bitmap, const rectangle &cliprect) { - rectangle rect = cliprect; - - int x; - int y; - - if (rect.max_y > 127) - rect.max_y = 127; - - for (y = rect.min_y; y <= rect.max_y; y++) + for (int y = cliprect.top(); y <= (std::min)(cliprect.bottom(), 127); y++) { uint16_t* p = &bitmap.pix16(y); - for (x = rect.min_x; x <= rect.max_x; x++) + for (int x = cliprect.left(); x <= cliprect.right(); x++) p[x] = palette.pen_indirect(p[x]) | 0x08; } } @@ -243,9 +231,6 @@ void wolfpack_state::draw_water(palette_device &palette, bitmap_ind16 &bitmap, c uint32_t wolfpack_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int i; - int j; - uint8_t color = 0x48; if (m_ship_size & 0x10) color += 0x13; if (m_ship_size & 0x20) color += 0x22; @@ -259,8 +244,8 @@ uint32_t wolfpack_state::screen_update(screen_device &screen, bitmap_ind16 &bitm bitmap.fill(m_video_invert, cliprect); - for (i = 0; i < 8; i++) - for (j = 0; j < 32; j++) + for (int i = 0; i < 8; i++) + for (int j = 0; j < 32; j++) { int code = m_alpha_num_ram[32 * i + j]; @@ -286,19 +271,16 @@ WRITE_LINE_MEMBER(wolfpack_state::screen_vblank) // rising edge if (state) { - int x; - int y; - m_helper.fill(0); draw_ship(m_helper, m_helper.cliprect()); - for (y = 128; y < 224 - m_torpedo_v; y++) + for (int y = 128; y < 224 - m_torpedo_v; y++) { int x1 = 248 - m_torpedo_h - 1; int x2 = 248 - m_torpedo_h + 1; - for (x = 2 * x1; x < 2 * x2; x++) + for (int x = 2 * x1; x < 2 * x2; x++) { if (x < 0 || x >= m_helper.width()) continue; diff --git a/src/mame/video/xybots.cpp b/src/mame/video/xybots.cpp index 6502f0f6256..5bcd5d17181 100644 --- a/src/mame/video/xybots.cpp +++ b/src/mame/video/xybots.cpp @@ -98,11 +98,11 @@ uint32_t xybots_state::screen_update_xybots(screen_device &screen, bitmap_ind16 // draw and merge the MO bitmap_ind16 &mobitmap = m_mob->bitmap(); for (const sparse_dirty_rect *rect = m_mob->first_dirty_rect(cliprect); rect != nullptr; rect = rect->next()) - for (int y = rect->min_y; y <= rect->max_y; y++) + for (int y = rect->top(); y <= rect->bottom(); y++) { uint16_t *mo = &mobitmap.pix16(y); uint16_t *pf = &bitmap.pix16(y); - for (int x = rect->min_x; x <= rect->max_x; x++) + for (int x = rect->left(); x <= rect->right(); x++) if (mo[x] != 0xffff) { /* verified via schematics: -- cgit v1.2.3 From 1dd5c61ae473bed7ec7bd29e2c575bd13b34777a Mon Sep 17 00:00:00 2001 From: DavidHaywood <28625134+DavidHaywood@users.noreply.github.com> Date: Fri, 27 Jul 2018 20:45:42 +0100 Subject: new clones marked as NOT WORKING The King of Fighters - Road to Revenge / The King of Fighters 2002 Unlimited Match (Japan) [CoolFox, brizzo] --- src/mame/drivers/y2.cpp | 16 ++++++++++++++-- src/mame/mame.lst | 1 + 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/mame/drivers/y2.cpp b/src/mame/drivers/y2.cpp index f67b35e0957..c1f78b935c4 100644 --- a/src/mame/drivers/y2.cpp +++ b/src/mame/drivers/y2.cpp @@ -82,7 +82,7 @@ MACHINE_CONFIG_START(system_board_y2_state::system_board_y2) MACHINE_CONFIG_END ROM_START( kof2002um ) - ROM_REGION( 0x8000000, "boot", 0 ) // presumably the boot code (encrypted?) + ROM_REGION( 0x8000000, "boot", 0 ) // sound program only? or boot too? ROM_LOAD( "s29gl01gp11fcr2.u103", 0x0000000, 0x8000000, CRC(722cbad1) SHA1(0292be12255ee4bd586166a3f5cd108c5453295b) ) ROM_REGION( 0x42000000, "nand_u101", 0 ) // presumably accessed like a filesystem (encrypted) @@ -91,6 +91,18 @@ ROM_START( kof2002um ) ROM_LOAD( "nand08gw3b2cn6.u102", 0x00000000, 0x42000000, CRC(ac2dc586) SHA1(5168b4c0c6343b6c040a206da04fa7cdbc3b35b9) ) ROM_END +ROM_START( kof2002umj ) + ROM_REGION( 0x8000000, "boot", 0 ) // sound program only? or boot too? + ROM_LOAD( "s29gl01gp11fcr2.u103", 0x0000000, 0x8000000, CRC(916c9d68) SHA1(65c09f75b6a71b0d79a827c6829d1c05d8699a32) ) + + ROM_REGION( 0x42000000, "nand_u101", 0 ) // presumably accessed like a filesystem (encrypted) + ROM_LOAD( "nand08gw3b2cn6.u101", 0x00000000, 0x42000000, CRC(46e03f1d) SHA1(62d8eeb7513e851bf11a26a84b5d310270f3fcf6) ) + ROM_REGION( 0x42000000, "nand_u102", 0 ) + ROM_LOAD( "nand08gw3b2cn6.u102", 0x00000000, 0x42000000, CRC(db931dca) SHA1(1b1fc88732944e9ede09e584c7b07e28a59df3e2) ) +ROM_END + + /* The title screen shows "The King of Fighters - Road to Revenge" (Chinese / English) while the speech on the title screen announcer says "The King of Fighters 2002 Unlimited Match" There is a PS2 version with the Unlimited Match title screen, but unless it's used for a different region the arcade doesn't show that title, only announces it. */ -GAME( 2009, kof2002um, 0, system_board_y2, system_board_y2, system_board_y2_state, empty_init, ROT0, "SNK Playmore / New Channel", "The King of Fighters - Road to Revenge / The King of Fighters 2002 Unlimited Match", MACHINE_IS_SKELETON ) +GAME( 2009, kof2002um, 0, system_board_y2, system_board_y2, system_board_y2_state, empty_init, ROT0, "SNK Playmore / New Channel", "The King of Fighters - Road to Revenge / The King of Fighters 2002 Unlimited Match (China)", MACHINE_IS_SKELETON ) // also Export? +GAME( 2009, kof2002umj, kof2002um, system_board_y2, system_board_y2, system_board_y2_state, empty_init, ROT0, "SNK Playmore / New Channel", "The King of Fighters - Road to Revenge / The King of Fighters 2002 Unlimited Match (Japan)", MACHINE_IS_SKELETON ) diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 23183dd9d2a..a0b3c195877 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -39353,6 +39353,7 @@ xyonix // [1989 Philko] @source:y2.cpp kof2002um // (c)2009 SNK Playmore / New Channel +kof2002umj // (c)2009 SNK Playmore / New Channel @source:yiear.cpp yiear // GX407 (c) 1985 -- cgit v1.2.3 From f9b28ee6f5b8aeffa8d664e66dc3e2589474c193 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Fri, 27 Jul 2018 22:34:45 +0200 Subject: Prevent aggressive incompetence (nw) --- src/devices/cpu/psx/psx.cpp | 12 ++++++------ src/devices/cpu/score/score.cpp | 2 +- src/emu/diexec.cpp | 4 +++- src/emu/diexec.h | 5 ----- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/devices/cpu/psx/psx.cpp b/src/devices/cpu/psx/psx.cpp index a8366bdea91..050a090b456 100644 --- a/src/devices/cpu/psx/psx.cpp +++ b/src/devices/cpu/psx/psx.cpp @@ -1456,12 +1456,12 @@ void psxcpu_device::update_cop0(int reg) { if (ip & CAUSE_IP0) debugger_exception_hook(EXC_INT); if (ip & CAUSE_IP1) debugger_exception_hook(EXC_INT); - if (ip & CAUSE_IP2) debugger_interrupt_hook(PSXCPU_IRQ0); - if (ip & CAUSE_IP3) debugger_interrupt_hook(PSXCPU_IRQ1); - if (ip & CAUSE_IP4) debugger_interrupt_hook(PSXCPU_IRQ2); - if (ip & CAUSE_IP5) debugger_interrupt_hook(PSXCPU_IRQ3); - if (ip & CAUSE_IP6) debugger_interrupt_hook(PSXCPU_IRQ4); - if (ip & CAUSE_IP7) debugger_interrupt_hook(PSXCPU_IRQ5); + if (ip & CAUSE_IP2) standard_irq_callback(PSXCPU_IRQ0); + if (ip & CAUSE_IP3) standard_irq_callback(PSXCPU_IRQ1); + if (ip & CAUSE_IP4) standard_irq_callback(PSXCPU_IRQ2); + if (ip & CAUSE_IP5) standard_irq_callback(PSXCPU_IRQ3); + if (ip & CAUSE_IP6) standard_irq_callback(PSXCPU_IRQ4); + if (ip & CAUSE_IP7) standard_irq_callback(PSXCPU_IRQ5); m_op = m_cache->read_dword(m_pc); execute_unstoppable_instructions(1); exception(EXC_INT); diff --git a/src/devices/cpu/score/score.cpp b/src/devices/cpu/score/score.cpp index 3a3b1ce6b15..bf5b434cb06 100644 --- a/src/devices/cpu/score/score.cpp +++ b/src/devices/cpu/score/score.cpp @@ -325,7 +325,7 @@ void score7_cpu_device::check_irq() if (m_pending_interrupt[i]) { m_pending_interrupt[i] = false; - debugger_interrupt_hook(i); + standard_irq_callback(i); gen_exception(EXCEPTION_INTERRUPT, i); return; } diff --git a/src/emu/diexec.cpp b/src/emu/diexec.cpp index 37fdcaa362c..67cb9bd123f 100644 --- a/src/emu/diexec.cpp +++ b/src/emu/diexec.cpp @@ -522,7 +522,9 @@ int device_execute_interface::standard_irq_callback(int irqline) vector = m_driver_irq(device(), irqline); // notify the debugger - debugger_interrupt_hook(irqline); + if (device().machine().debug_flags & DEBUG_FLAG_ENABLED) + device().debug()->interrupt_hook(irqline); + return vector; } diff --git a/src/emu/diexec.h b/src/emu/diexec.h index 3c9d754434e..e4973c2296f 100644 --- a/src/emu/diexec.h +++ b/src/emu/diexec.h @@ -237,11 +237,6 @@ protected: if (device().machine().debug_flags & DEBUG_FLAG_ENABLED) device().debug()->exception_hook(exception); } - void debugger_interrupt_hook(int irqline) - { - if (device().machine().debug_flags & DEBUG_FLAG_ENABLED) - device().debug()->interrupt_hook(irqline); - } private: // internal information about the state of inputs -- cgit v1.2.3 From 5460bc0d3d80560992121d9837ddc5f1f434ee07 Mon Sep 17 00:00:00 2001 From: smf- Date: Fri, 27 Jul 2018 21:56:06 +0100 Subject: prevent HOLD_LINE & irq acknowledge infection (nw) --- src/devices/cpu/psx/psx.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/devices/cpu/psx/psx.cpp b/src/devices/cpu/psx/psx.cpp index 050a090b456..9ea179f6716 100644 --- a/src/devices/cpu/psx/psx.cpp +++ b/src/devices/cpu/psx/psx.cpp @@ -1456,12 +1456,12 @@ void psxcpu_device::update_cop0(int reg) { if (ip & CAUSE_IP0) debugger_exception_hook(EXC_INT); if (ip & CAUSE_IP1) debugger_exception_hook(EXC_INT); - if (ip & CAUSE_IP2) standard_irq_callback(PSXCPU_IRQ0); - if (ip & CAUSE_IP3) standard_irq_callback(PSXCPU_IRQ1); - if (ip & CAUSE_IP4) standard_irq_callback(PSXCPU_IRQ2); - if (ip & CAUSE_IP5) standard_irq_callback(PSXCPU_IRQ3); - if (ip & CAUSE_IP6) standard_irq_callback(PSXCPU_IRQ4); - if (ip & CAUSE_IP7) standard_irq_callback(PSXCPU_IRQ5); + //if (ip & CAUSE_IP2) debugger_interrupt_hook(PSXCPU_IRQ0); + //if (ip & CAUSE_IP3) debugger_interrupt_hook(PSXCPU_IRQ1); + //if (ip & CAUSE_IP4) debugger_interrupt_hook(PSXCPU_IRQ2); + //if (ip & CAUSE_IP5) debugger_interrupt_hook(PSXCPU_IRQ3); + //if (ip & CAUSE_IP6) debugger_interrupt_hook(PSXCPU_IRQ4); + //if (ip & CAUSE_IP7) debugger_interrupt_hook(PSXCPU_IRQ5); m_op = m_cache->read_dword(m_pc); execute_unstoppable_instructions(1); exception(EXC_INT); -- cgit v1.2.3 From 20b5f5d0e6f73b9ce6fffa4fc5dbe3f2b83d2a27 Mon Sep 17 00:00:00 2001 From: smf- Date: Fri, 27 Jul 2018 22:01:32 +0100 Subject: vgmplay: start all clocks at zero and reset all sound chips on a song change [smf] --- src/devices/sound/2203intf.cpp | 2 +- src/devices/sound/2608intf.cpp | 15 +- src/devices/sound/2608intf.h | 1 + src/devices/sound/c6280.cpp | 4 +- src/devices/sound/fm.cpp | 8 + src/devices/sound/fm.h | 1 + src/devices/sound/fmopl.cpp | 2 +- src/devices/sound/gb.cpp | 10 + src/devices/sound/gb.h | 1 + src/devices/sound/ym2413.cpp | 8 + src/devices/sound/ym2413.h | 1 + src/emu/schedule.cpp | 51 ++--- src/emu/sound.cpp | 39 +++- src/mame/drivers/vgmplay.cpp | 427 ++++++++++++++++++++--------------------- 14 files changed, 305 insertions(+), 265 deletions(-) diff --git a/src/devices/sound/2203intf.cpp b/src/devices/sound/2203intf.cpp index 8b415d08b5d..faf3072e94e 100644 --- a/src/devices/sound/2203intf.cpp +++ b/src/devices/sound/2203intf.cpp @@ -40,7 +40,7 @@ void ym2203_device::device_timer(emu_timer &timer, device_timer_id id, int param void ym2203_device::timer_handler(int c, int count, int clock) { - if( count == 0 ) + if( count == 0 || clock == 0) { /* Reset FM Timer */ m_timer[c]->enable(false); } diff --git a/src/devices/sound/2608intf.cpp b/src/devices/sound/2608intf.cpp index 959f29e14b1..4dc5bedf02f 100644 --- a/src/devices/sound/2608intf.cpp +++ b/src/devices/sound/2608intf.cpp @@ -11,9 +11,6 @@ - Control Write B - Data Write B - TODO: - - fix set_unscaled_clock() changes (currently done only by vgmplay driver) - ***************************************************************************/ #include "emu.h" @@ -52,7 +49,7 @@ void ym2608_device::device_timer(emu_timer &timer, device_timer_id id, int param void ym2608_device::timer_handler(int c,int count,int clock) { - if( count == 0 ) + if( count == 0 || clock == 0 ) { /* Reset FM Timer */ m_timer[c]->enable(false); } @@ -110,6 +107,16 @@ void ym2608_device::device_start() assert_always(m_chip != nullptr, "Error creating YM2608 chip"); } +//------------------------------------------------- +// device_clock_changed +//------------------------------------------------- + +void ym2608_device::device_clock_changed() +{ + m_stream->set_sample_rate(clock() / 72); + ym2608_clock_changed(m_chip, clock(), clock() / 72); +} + //------------------------------------------------- // device_stop - device-specific stop //------------------------------------------------- diff --git a/src/devices/sound/2608intf.h b/src/devices/sound/2608intf.h index 7272f5778e9..cf96aa35be9 100644 --- a/src/devices/sound/2608intf.h +++ b/src/devices/sound/2608intf.h @@ -32,6 +32,7 @@ protected: // device-level overrides virtual const tiny_rom_entry *device_rom_region() const override; virtual void device_start() override; + virtual void device_clock_changed() override; virtual void device_post_load() override; virtual void device_stop() override; virtual void device_reset() override; diff --git a/src/devices/sound/c6280.cpp b/src/devices/sound/c6280.cpp index c0a91f36651..53ac35ede3d 100644 --- a/src/devices/sound/c6280.cpp +++ b/src/devices/sound/c6280.cpp @@ -277,14 +277,14 @@ void c6280_device::calculate_clocks() /* Make waveform frequency table */ for (int i = 0; i < 4096; i += 1) { - double step = ((clock() / rate) * 4096) / (i + 1); + double step = (16 * 4096) / (i + 1); m_wave_freq_tab[(1 + i) & 0xFFF] = (uint32_t)step; } /* Make noise frequency table */ for (int i = 0; i < 32; i += 1) { - double step = ((clock() / rate) * 32) / (i+1); + double step = (16 * 32) / (i+1); m_noise_freq_tab[i] = (uint32_t)step; } diff --git a/src/devices/sound/fm.cpp b/src/devices/sound/fm.cpp index 9213e230b88..169e9239ee1 100644 --- a/src/devices/sound/fm.cpp +++ b/src/devices/sound/fm.cpp @@ -3011,6 +3011,14 @@ void * ym2608_init(device_t *device, int clock, int rate, void *pcmrom,int pcmsi return F2608; } +void ym2608_clock_changed(void *chip, int clock, int rate) +{ + ym2608_state *F2608 = (ym2608_state *)chip; + + F2608->OPN.ST.clock = clock; + F2608->OPN.ST.rate = rate; +} + /* shut down emulator */ void ym2608_shutdown(void *chip) { diff --git a/src/devices/sound/fm.h b/src/devices/sound/fm.h index 60bdb9c4ec0..e774a9cf5bd 100644 --- a/src/devices/sound/fm.h +++ b/src/devices/sound/fm.h @@ -136,6 +136,7 @@ void ym2203_postload(void *chip); void * ym2608_init(device_t *device, int baseclock, int rate, void *pcmroma,int pcmsizea, FM_TIMERHANDLER TimerHandler,FM_IRQHANDLER IRQHandler, const ssg_callbacks *ssg); +void ym2608_clock_changed(void *chip, int clock, int rate); void ym2608_shutdown(void *chip); void ym2608_reset_chip(void *chip); void ym2608_update_one(void *chip, FMSAMPLE **buffer, int length); diff --git a/src/devices/sound/fmopl.cpp b/src/devices/sound/fmopl.cpp index 2e1be1b4266..dbcd3429128 100644 --- a/src/devices/sound/fmopl.cpp +++ b/src/devices/sound/fmopl.cpp @@ -1631,7 +1631,7 @@ void FM_OPL::initialize() /*logerror("freqbase=%f\n", freqbase);*/ /* Timer base time */ - TimerBase = attotime::from_hz(clock) * 72; + TimerBase = clock ? attotime::from_hz(clock) * 72 : attotime::zero; /* make fnumber -> increment counter table */ for( i=0 ; i < 1024 ; i++ ) diff --git a/src/devices/sound/gb.cpp b/src/devices/sound/gb.cpp index c65b3872d00..c662d456ef6 100644 --- a/src/devices/sound/gb.cpp +++ b/src/devices/sound/gb.cpp @@ -169,6 +169,16 @@ void gameboy_sound_device::device_start() } +//------------------------------------------------- +// device_clock_changed +//------------------------------------------------- + +void gameboy_sound_device::device_clock_changed() +{ + m_timer->adjust(clocks_to_attotime(FRAME_CYCLES / 128), 0, clocks_to_attotime(FRAME_CYCLES / 128)); +} + + //------------------------------------------------- // device_reset //------------------------------------------------- diff --git a/src/devices/sound/gb.h b/src/devices/sound/gb.h index f4139d0b1a6..e559f5c7301 100644 --- a/src/devices/sound/gb.h +++ b/src/devices/sound/gb.h @@ -21,6 +21,7 @@ protected: // device-level overrides virtual void device_start() override; + virtual void device_clock_changed() override; virtual void device_reset() override; // sound stream update overrides diff --git a/src/devices/sound/ym2413.cpp b/src/devices/sound/ym2413.cpp index 4d9da3d1dee..69ad6b31e33 100644 --- a/src/devices/sound/ym2413.cpp +++ b/src/devices/sound/ym2413.cpp @@ -1615,6 +1615,14 @@ void ym2413_device::device_start() } } +//------------------------------------------------- +// device_clock_changed +//------------------------------------------------- +void ym2413_device::device_clock_changed() +{ + m_stream->set_sample_rate(clock() / 72); +} + //------------------------------------------------- // device_reset - device-specific reset //------------------------------------------------- diff --git a/src/devices/sound/ym2413.h b/src/devices/sound/ym2413.h index 410ed10fcf9..8f496645ee9 100644 --- a/src/devices/sound/ym2413.h +++ b/src/devices/sound/ym2413.h @@ -19,6 +19,7 @@ public: protected: // device-level overrides virtual void device_start() override; + virtual void device_clock_changed() override; virtual void device_reset() override; // sound stream update overrides diff --git a/src/emu/schedule.cpp b/src/emu/schedule.cpp index d281446d6c6..ba6c5e79302 100644 --- a/src/emu/schedule.cpp +++ b/src/emu/schedule.cpp @@ -452,7 +452,12 @@ void device_scheduler::timeslice() { // only process if this CPU is executing or truly halted (not yielding) // and if our target is later than the CPU's current time (coarse check) - if (EXPECTED((exec->m_suspend == 0 || exec->m_eatcycles) && target.seconds() >= exec->m_localtime.seconds())) + if (exec->m_suspend != 0) + { + if (exec->m_eatcycles) + exec->m_localtime = target; + } + else if (target.seconds() >= exec->m_localtime.seconds()) { // compute how many attoseconds to execute this CPU attoseconds_t delta = target.attoseconds() - exec->m_localtime.attoseconds(); @@ -467,33 +472,29 @@ void device_scheduler::timeslice() int ran = exec->m_cycles_running = divu_64x32(u64(delta) >> exec->m_divshift, exec->m_divisor); LOG((" cpu '%s': %d (%d cycles)\n", exec->device().tag(), delta, exec->m_cycles_running)); - // if we're not suspended, actually execute - if (exec->m_suspend == 0) + g_profiler.start(exec->m_profiler); + + // note that this global variable cycles_stolen can be modified + // via the call to cpu_execute + exec->m_cycles_stolen = 0; + m_executing_device = exec; + *exec->m_icountptr = exec->m_cycles_running; + if (!call_debugger) + exec->run(); + else { - g_profiler.start(exec->m_profiler); - - // note that this global variable cycles_stolen can be modified - // via the call to cpu_execute - exec->m_cycles_stolen = 0; - m_executing_device = exec; - *exec->m_icountptr = exec->m_cycles_running; - if (!call_debugger) - exec->run(); - else - { - exec->debugger_start_cpu_hook(target); - exec->run(); - exec->debugger_stop_cpu_hook(); - } - - // adjust for any cycles we took back - assert(ran >= *exec->m_icountptr); - ran -= *exec->m_icountptr; - assert(ran >= exec->m_cycles_stolen); - ran -= exec->m_cycles_stolen; - g_profiler.stop(); + exec->debugger_start_cpu_hook(target); + exec->run(); + exec->debugger_stop_cpu_hook(); } + // adjust for any cycles we took back + assert(ran >= *exec->m_icountptr); + ran -= *exec->m_icountptr; + assert(ran >= exec->m_cycles_stolen); + ran -= exec->m_cycles_stolen; + g_profiler.stop(); + // account for these cycles exec->m_totalcycles += ran; diff --git a/src/emu/sound.cpp b/src/emu/sound.cpp index 775d85057dd..cff1fb9dc25 100644 --- a/src/emu/sound.cpp +++ b/src/emu/sound.cpp @@ -264,6 +264,9 @@ void sound_stream::set_input(int index, sound_stream *input_stream, int output_i void sound_stream::update() { + if (!m_attoseconds_per_sample) + return; + // determine the number of samples since the start of this second attotime time = m_device.machine().time(); s32 update_sampindex = s32(time.attoseconds() / m_attoseconds_per_sample); @@ -439,8 +442,17 @@ void sound_stream::apply_sample_rate_changes() recompute_sample_rate_data(); // reset our sample indexes to the current time - m_output_sampindex = s64(m_output_sampindex) * s64(m_sample_rate) / old_rate; - m_output_update_sampindex = s64(m_output_update_sampindex) * s64(m_sample_rate) / old_rate; + if (old_rate) + { + m_output_sampindex = s64(m_output_sampindex) * s64(m_sample_rate) / old_rate; + m_output_update_sampindex = s64(m_output_update_sampindex) * s64(m_sample_rate) / old_rate; + } + else + { + m_output_sampindex = m_device.machine().sound().last_update().attoseconds() / m_attoseconds_per_sample; + m_output_update_sampindex = m_output_sampindex; + } + m_output_base_sampindex = m_output_sampindex - m_max_samples_per_update; // clear out the buffer @@ -471,15 +483,22 @@ void sound_stream::recompute_sample_rate_data() throw emu_fatalerror("Incompatible sample rates as input of a synchronous stream: %d and %d\n", m_sample_rate, input.m_source->m_stream->m_sample_rate); } } - if (!m_sample_rate) - m_sample_rate = 1000; } // recompute the timing parameters attoseconds_t update_attoseconds = m_device.machine().sound().update_attoseconds(); - m_attoseconds_per_sample = ATTOSECONDS_PER_SECOND / m_sample_rate; - m_max_samples_per_update = (update_attoseconds + m_attoseconds_per_sample - 1) / m_attoseconds_per_sample; + + if (m_sample_rate) + { + m_attoseconds_per_sample = ATTOSECONDS_PER_SECOND / m_sample_rate; + m_max_samples_per_update = (update_attoseconds + m_attoseconds_per_sample - 1) / m_attoseconds_per_sample; + } + else + { + m_attoseconds_per_sample = 0; + m_max_samples_per_update = 0; + } // update resample and output buffer sizes allocate_resample_buffers(); @@ -490,7 +509,7 @@ void sound_stream::recompute_sample_rate_data() { // if we have a source, see if its sample rate changed - if (input.m_source != nullptr) + if (input.m_source != nullptr && input.m_source->m_stream->m_sample_rate) { // okay, we have a new sample rate; recompute the latency to be the maximum // sample period between us and our input @@ -511,6 +530,10 @@ void sound_stream::recompute_sample_rate_data() input.m_latency_attoseconds = std::max(input.m_latency_attoseconds, latency); assert(input.m_latency_attoseconds < update_attoseconds); } + else + { + input.m_latency_attoseconds = 0; + } } // If synchronous, prime the timer @@ -653,7 +676,7 @@ stream_sample_t *sound_stream::generate_resampled_data(stream_input &input, u32 { // if we don't have an output to pull data from, generate silence stream_sample_t *dest = &input.m_resample[0]; - if (input.m_source == nullptr) + if (input.m_source == nullptr || input.m_source->m_buffer.size() == 0) { memset(dest, 0, numsamples * sizeof(*dest)); return &input.m_resample[0]; diff --git a/src/mame/drivers/vgmplay.cpp b/src/mame/drivers/vgmplay.cpp index 0ddedb3ffe7..63646e7b1a0 100644 --- a/src/mame/drivers/vgmplay.cpp +++ b/src/mame/drivers/vgmplay.cpp @@ -720,11 +720,11 @@ void vgmplay_device::execute_run() pulse_act_led(LED_AY8910); uint8_t reg = m_file->read_byte(m_pc+1); if(reg & 0x80) { - m_io->write_byte(A_AY8910A+1, reg & 0x7f); - m_io->write_byte(A_AY8910A+0, m_file->read_byte(m_pc+2)); - } else { m_io->write_byte(A_AY8910B+1, reg & 0x7f); m_io->write_byte(A_AY8910B+0, m_file->read_byte(m_pc+2)); + } else { + m_io->write_byte(A_AY8910A+1, reg & 0x7f); + m_io->write_byte(A_AY8910A+0, m_file->read_byte(m_pc+2)); } m_pc += 3; break; @@ -792,9 +792,9 @@ void vgmplay_device::execute_run() pulse_act_led(LED_POKEY); uint8_t offset = m_file->read_byte(m_pc+1); if (offset & 0x80) - m_io->write_byte(A_POKEYA + (offset & 0x7f), m_file->read_byte(m_pc+2)); - else m_io->write_byte(A_POKEYB + (offset & 0x7f), m_file->read_byte(m_pc+2)); + else + m_io->write_byte(A_POKEYA + (offset & 0x7f), m_file->read_byte(m_pc+2)); m_pc += 3; break; } @@ -1419,12 +1419,23 @@ uint8_t vgmplay_state::r8(int off) const return 0; } +static const ay8910_device::psg_type_t vgm_ay8910_type(uint8_t vgm_type) +{ + return (vgm_type & 0x10) ? ay8910_device::PSG_TYPE_YM : ay8910_device::PSG_TYPE_AY; +} + +static const uint8_t vgm_ay8910_flags(uint8_t vgm_flags) +{ + uint8_t flags = 0; + if (vgm_flags & 1) flags |= AY8910_LEGACY_OUTPUT; + if (vgm_flags & 2) flags |= AY8910_SINGLE_OUTPUT; + if (vgm_flags & 4) flags |= AY8910_DISCRETE_OUTPUT; + return flags; +} + QUICKLOAD_LOAD_MEMBER(vgmplay_state, load_file) { - // Disable executing devices if not required - m_pokey[0]->set_unscaled_clock(0); - m_pokey[1]->set_unscaled_clock(0); - m_qsound->set_unscaled_clock(0); + m_vgmplay->stop(); m_file_data.resize(quickload_size); @@ -1495,188 +1506,157 @@ QUICKLOAD_LOAD_MEMBER(vgmplay_state, load_file) if (version >= 0x150 && r32(0x34)) data_start = r32(0x34) + 0x34; - // Parse clocks - if(r32(0x0c)) - m_sn76496->set_unscaled_clock(r32(0x0c)); - if(r32(0x10)) - m_ym2413->set_unscaled_clock(r32(0x10)); - if(version >= 0x110 && r32(0x2c)) - m_ym2612->set_unscaled_clock(r32(0x2c)); - if(version >= 0x110 && r32(0x30)) - m_ym2151->set_unscaled_clock(r32(0x30)); - - if(version >= 0x151 && r32(0x38)) - m_segapcm->set_unscaled_clock(r32(0x38)); - - if(version >= 0x151 && r32(0x3c)) - m_segapcm->set_bank(r32(0x3c)); - - if (data_start > 0x40) - { - if(version >= 0x151 && r32(0x40)) - m_rf5c68->set_unscaled_clock(r32(0x40)); - if(version >= 0x151 && r32(0x44)) { - uint32_t clock = r32(0x44); - m_ym2203[0]->set_unscaled_clock(clock & ~0x40000000); - if (clock & 0x40000000) - { - clock &= ~0x40000000; - m_ym2203[1]->set_unscaled_clock(clock); - } - } - if(version >= 0x151 && r32(0x48)) - m_ym2608->set_unscaled_clock(r32(0x48)); - if(version >= 0x151 && r32(0x4c)) - logerror("Warning: file requests an unsupported %s\n", r32(0x4c) & 0x80000000 ? "YM2610B" : "YM2610"); - if(version >= 0x151 && r32(0x50)) { - m_ym3812->set_unscaled_clock(r32(0x50)); - } - if(version >= 0x151 && r32(0x54)) { - m_ym3526->set_unscaled_clock(r32(0x54)); - } - if(version >= 0x151 && r32(0x58)) - logerror("Warning: file requests an unsupported Y8950\n"); - if(version >= 0x151 && r32(0x5c)) - logerror("Warning: file requests an unsupported YMF262\n"); - if(version >= 0x151 && r32(0x60)) - logerror("Warning: file requests an unsupported YMF278B\n"); - if(version >= 0x151 && r32(0x64)) { - m_ymf271->set_unscaled_clock(r32(0x64)); - } - if(version >= 0x151 && r32(0x68)) { - m_ymz280b->set_unscaled_clock(r32(0x68)); - } - if(version >= 0x151 && r32(0x6c)) - m_rf5c164->set_unscaled_clock(r32(0x6c)); - if(version >= 0x151 && r32(0x70)) - logerror("Warning: file requests an unsupported PWM\n"); - if(version >= 0x151 && r32(0x74)) { - uint32_t clock = r32(0x74); - m_ay8910[0]->set_unscaled_clock(clock & ~0x40000000); - if (clock & 0x40000000) { - clock &= ~0x40000000; - m_ay8910[1]->set_unscaled_clock(clock); - } - } - if(version >= 0x151 && r8(0x78)) { - uint8_t type = r8(0x78); - if (type & 0x10) - { - m_ay8910[0]->set_psg_type(ay8910_device::PSG_TYPE_YM); - m_ay8910[1]->set_psg_type(ay8910_device::PSG_TYPE_YM); - } - } - if(version >= 0x151 && r8(0x79)) { - uint8_t flags = r8(0x79); - uint8_t to_set = 0; - if (flags & 1) - to_set |= AY8910_LEGACY_OUTPUT; - if (flags & 2) - to_set |= AY8910_SINGLE_OUTPUT; - if (flags & 4) - to_set |= AY8910_DISCRETE_OUTPUT; - m_ay8910[0]->set_flags(to_set); - m_ay8910[1]->set_flags(to_set); - } - if(version >= 0x151 && r8(0x7a)) { - uint8_t flags = r8(0x7a); - uint8_t to_set = 0; - if (flags & 1) - to_set |= AY8910_LEGACY_OUTPUT; - if (flags & 2) - to_set |= AY8910_SINGLE_OUTPUT; - if (flags & 4) - to_set |= AY8910_DISCRETE_OUTPUT; - m_ym2203[0]->set_flags(to_set); - m_ym2203[1]->set_flags(to_set); - } - } - - if (data_start > 0x80) - { - if(version >= 0x161 && r32(0x80)) { - m_dmg->set_unscaled_clock(r32(0x80)); - } - if(version >= 0x161 && r32(0x84)) { - m_nescpu->set_unscaled_clock(r32(0x84)); - m_nescpu->m_apu->set_unscaled_clock(r32(0x84)); - } - if(version >= 0x161 && r32(0x88)) { - uint32_t clock = r32(0x88); - m_multipcm[0]->set_unscaled_clock(clock & ~0x40000000); - if (clock & 0x40000000) { - clock &= ~0x40000000; - m_multipcm[1]->set_unscaled_clock(clock); - } - } - if(version >= 0x161 && r8(0x95)) { - m_k054539[0]->init_flags(r8(0x95)); - m_k054539[1]->init_flags(r8(0x95)); - } - if(version >= 0x161 && r32(0x98)) { - m_okim6295_clock[0] = r32(0x98); - m_okim6295_pin7[0] = 0; - if (m_okim6295_clock[0] & 0x80000000) { - m_okim6295_clock[0] &= ~0x80000000; - m_okim6295_pin7[0] = 1; - } - m_okim6295[0]->config_pin7(m_okim6295_pin7[0] ? okim6295_device::PIN7_HIGH : okim6295_device::PIN7_LOW); // FIXME: no guarantee this device hasn't started yet - may be better to wait for it to start then use set_pin7 - m_okim6295[0]->set_unscaled_clock(m_okim6295_clock[0] & ~0xc0000000); - if (m_okim6295_clock[0] & 0x40000000) { - m_okim6295_clock[0] &= ~0x40000000; - m_okim6295_clock[1] = m_okim6295_clock[0]; - m_okim6295_pin7[1] = m_okim6295_pin7[0]; - m_okim6295[1]->config_pin7(m_okim6295_pin7[1] ? okim6295_device::PIN7_HIGH : okim6295_device::PIN7_LOW); // FIXME: no guarantee this device hasn't started yet - may be better to wait for it to start then use set_pin7 - m_okim6295[1]->set_unscaled_clock(m_okim6295_clock[1]); - } - } - if(version >= 0x161 && r32(0x9c)) { - m_k051649->set_unscaled_clock(r32(0x9c)); - } - if(version >= 0x161 && r32(0xa0)) { - uint32_t clock = r32(0xa0); - m_k054539[0]->set_unscaled_clock(clock & ~0x40000000); - if (clock & 0x40000000) { - clock &= ~0x40000000; - m_k054539[1]->set_unscaled_clock(clock); - } - } - if(version >= 0x161 && r32(0xac)) { - m_k053260->set_unscaled_clock(r32(0xac)); - } - if(version >= 0x161 && r32(0xa4)) { - m_c6280->set_unscaled_clock(r32(0xa4)); - } - if(version >= 0x161 && r32(0xb0)) { - uint32_t clock = r32(0xb0); - m_pokey[0]->set_unscaled_clock(clock & ~0x40000000); - if (clock & 0x40000000) { - clock &= ~0x40000000; - m_pokey[1]->set_unscaled_clock(clock); - } - } - if(version >= 0x161 && r32(0xb4)) { - m_qsound->set_unscaled_clock(r32(0xb4) * 15); // * 15 multipler for correct pitch - } - } + if (data_start < header_size) + logerror("Warning: data starts within header\n"); - if (data_start > 0xc0) - { - if(version >= 0x171 && r8(0xd6)) { - m_c352->set_divider(r8(0xd6) * 4); - } - if(version >= 0x171 && r32(0xd8)) { - m_x1_010->set_unscaled_clock(r32(0xd8)); - } - if(version >= 0x171 && r32(0xdc)) { - m_c352->set_unscaled_clock(r32(0xdc)); - } - if(version >= 0x171 && r32(0xe0)) { - m_ga20->set_unscaled_clock(r32(0xe0)); - } - } - - m_vgmplay->reset(); + // Parse clocks + m_sn76496->set_unscaled_clock(r32(0x0c) & ~0xc0000000); + if (r32(0x0c) & 0xc0000000) + logerror("Warning: file requests an unsupported %s\n", r32(0x0c) & 0x80000000 ? "Y6W28" : "2nd SN76496"); + + m_ym2413->set_unscaled_clock(r32(0x10) & ~0x40000000); + if (r32(0x10) & 0x40000000) + logerror("Warning: file requests an unsupported 2nd YM2413\n"); + + m_ym2612->set_unscaled_clock((version >= 0x110 ? r32(0x2c) : r32(0x10)) & ~0x40000000); + if (version >= 0x110 && (r32(0x2c) & 0x40000000)) + logerror("Warning: file requests an unsupported 2nd YM2612\n"); + + m_ym2151->set_unscaled_clock((version >= 0x110 ? r32(0x30) : r32(0x10)) & ~0x40000000); + if (version >= 0x110 && (r32(0x30) & 0x40000000)) + logerror("Warning: file requests an unsupported 2nd YM2151\n"); + + m_segapcm->set_unscaled_clock(version >= 0x151 ? r32(0x38) : 0); + m_segapcm->set_bank(version >= 0x151 ? r32(0x3c) : 0); + + m_rf5c68->set_unscaled_clock(version >= 0x151 ? r32(0x40) : 0); + m_ym2203[0]->set_unscaled_clock(version >= 0x151 ? r32(0x44) & ~0x40000000 : 0); + m_ym2203[1]->set_unscaled_clock(version >= 0x151 && (r32(0x44) & 0x40000000) ? r32(0x44) & ~0x40000000 : 0); + m_ym2608->set_unscaled_clock(version >= 0x151 ? r32(0x48) & ~0x40000000 : 0); + if (version >= 0x151 && (r32(0x48) & 0x40000000)) + logerror("Warning: file requests an unsupported 2nd YM2608\n"); + + if (version >= 0x151 && r32(0x4c)) + logerror("Warning: file requests an unsupported %s\n", r32(0x4c) & 0x80000000 ? "YM2610B" : "YM2610"); + + m_ym3812->set_unscaled_clock(version >= 0x151 ? r32(0x50) & ~0x40000000 : 0); + if (version >= 0x151 && (r32(0x50) & 0x40000000)) + logerror("Warning: file requests an unsupported 2nd YM3812\n"); + + m_ym3526->set_unscaled_clock(version >= 0x151 ? r32(0x54) & ~0x40000000 : 0); + if (version >= 0x151 && (r32(0x54) & 0x40000000)) + logerror("Warning: file requests an unsupported 2nd YM3526\n"); + + if(version >= 0x151 && r32(0x58)) + logerror("Warning: file requests an unsupported Y8950\n"); + if(version >= 0x151 && r32(0x5c)) + logerror("Warning: file requests an unsupported YMF262\n"); + if(version >= 0x151 && r32(0x60)) + logerror("Warning: file requests an unsupported YMF278B\n"); + + m_ymf271->set_unscaled_clock(version >= 0x151 ? r32(0x64) & ~0x40000000 : 0); + if (version >= 0x151 && (r32(0x64) & 0x40000000)) + logerror("Warning: file requests an unsupported 2nd YMF271\n"); + + m_ymz280b->set_unscaled_clock(version >= 0x151 ? r32(0x68) & ~0x40000000 : 0); + if (version >= 0x151 && (r32(0x68) & 0x40000000)) + logerror("Warning: file requests an unsupported 2nd YMZ280B\n"); + + m_rf5c164->set_unscaled_clock(version >= 0x151 ? r32(0x6c) : 0); + + if(version >= 0x151 && r32(0x70)) + logerror("Warning: file requests an unsupported PWM\n"); + + m_ay8910[0]->set_unscaled_clock(version >= 0x151 ? r32(0x74) & ~0x40000000 : 0); + m_ay8910[1]->set_unscaled_clock(version >= 0x151 && (r32(0x74) & 0x40000000) ? r32(0x74) & ~0x40000000 : 0); + m_ay8910[0]->set_psg_type(vgm_ay8910_type(version >= 0x151 ? r8(0x78) : 0)); + m_ay8910[1]->set_psg_type(vgm_ay8910_type(version >= 0x151 ? r8(0x78) : 0)); + m_ay8910[0]->set_flags(vgm_ay8910_flags(version >= 0x151 ? r8(0x79) : 0)); + m_ay8910[1]->set_flags(vgm_ay8910_flags(version >= 0x151 ? r8(0x79) : 0)); + m_ym2203[0]->set_flags(vgm_ay8910_flags(version >= 0x151 ? r8(0x7a) : 0)); + m_ym2203[1]->set_flags(vgm_ay8910_flags(version >= 0x151 ? r8(0x7a) : 0)); + m_ym2608->set_flags(vgm_ay8910_flags(version >= 0x151 ? r8(0x7b) : 0)); + + m_dmg->set_unscaled_clock(version >= 0x161 ? r32(0x80) & ~0x40000000 : 0); + if (version >= 0x161 && (r32(0x80) & 0x40000000)) + logerror("Warning: file requests an unsupported 2nd DMG\n"); + + m_nescpu->set_unscaled_clock(version >= 0x161 ? r32(0x84) & ~0x40000000 : 0); + m_nescpu->m_apu->set_unscaled_clock(version >= 0x161 ? r32(0x84) & ~0x40000000 : 0); + if (version >= 0x161 && (r32(0x84) & 0x40000000)) + logerror("Warning: file requests an unsupported 2nd NES APU\n"); + + m_multipcm[0]->set_unscaled_clock(version >= 0x161 ? r32(0x88) & ~0x40000000 : 0); + m_multipcm[1]->set_unscaled_clock(version >= 0x161 && (r32(0x88) & 0x40000000) ? r32(0x88) & ~0x40000000 : 0); + + if (version >= 0x161 && r32(0x8c)) + logerror("Warning: file requests an unsupported uPD7759\n"); + if (version >= 0x161 && r32(0x90)) + logerror("Warning: file requests an unsupported OKIM6258\n"); + + m_k054539[0]->init_flags(version >= 0x161 ? r8(0x95) : 0); + m_k054539[1]->init_flags(version >= 0x161 ? r8(0x95) : 0); + + m_okim6295_clock[0] = version >= 0x161 ? r32(0x98) & 0xc0000000 : 0; + m_okim6295_clock[1] = version >= 0x161 && (r32(0x98) & 0x40000000) ? r32(0x98) & 0xc0000000 : 0; + m_okim6295[0]->set_unscaled_clock(m_okim6295_clock[0]); + m_okim6295[1]->set_unscaled_clock(m_okim6295_clock[1]); + + m_okim6295_pin7[0] = version >= 0x161 && (r32(0x98) & 0x80000000) ? 1 : 0; + m_okim6295_pin7[1] = version >= 0x161 && (r32(0x98) & 0x40000000) && (r32(0x98) & 0x80000000) ? 1 : 0; + m_okim6295[0]->set_pin7(m_okim6295_pin7[0] ? okim6295_device::PIN7_HIGH : okim6295_device::PIN7_LOW); + m_okim6295[1]->set_pin7(m_okim6295_pin7[1] ? okim6295_device::PIN7_HIGH : okim6295_device::PIN7_LOW); + + m_k051649->set_unscaled_clock(version >= 0x161 ? r32(0x9c) & ~0x40000000 : 0); + if (version >= 0x161 && (r32(0x9c) & 0x40000000)) + logerror("Warning: file requests an unsupported 2nd K051649\n"); + + m_k054539[0]->set_unscaled_clock(version >= 0x161 ? r32(0xa0) & ~0x40000000 : 0); + m_k054539[1]->set_unscaled_clock(version >= 0x161 && (r32(0xa0) & 0x40000000) ? r32(0xa0) & ~0x40000000 : 0); + + m_c6280->set_unscaled_clock(version >= 0x161 ? r32(0xa4) & ~0x40000000 : 0); + if (version >= 0x161 && (r32(0xa4) & 0x40000000)) + logerror("Warning: file requests an unsupported 2nd C6280\n"); + + if (version >= 0x161 && r32(0x90)) + logerror("Warning: file requests an unsupported C140\n"); + + m_k053260->set_unscaled_clock(version >= 0x161 ? r32(0xac) & ~0x40000000 : 0); + if (version >= 0x161 && (r32(0xac) & 0x40000000)) + logerror("Warning: file requests an unsupported 2nd K053260\n"); + + m_pokey[0]->set_unscaled_clock(version >= 0x161 ? r32(0xb0) & ~0x40000000 : 0); + m_pokey[1]->set_unscaled_clock(version >= 0x161 && (r32(0xb0) & 0x40000000) ? r32(0xb0) & ~0x40000000 : 0); + m_qsound->set_unscaled_clock(version >= 0x161 ? r32(0xb4) * 15 : 0); // * 15 multipler for correct pitch + + if (version >= 0x151 && r32(0xb8)) + logerror("Warning: file requests an unsupported SCSP\n"); + if (version >= 0x151 && r32(0xc0)) + logerror("Warning: file requests an unsupported WonderSwan\n"); + if (version >= 0x151 && r32(0xc4)) + logerror("Warning: file requests an unsupported VSU\n"); + if (version >= 0x151 && r32(0xc8)) + logerror("Warning: file requests an unsupported SAA1099\n"); + if (version >= 0x151 && r32(0xcc)) + logerror("Warning: file requests an unsupported ES5503\n"); + if (version >= 0x151 && r32(0xd0)) + logerror("Warning: file requests an unsupported %s\n", r32(0xd0) & 0x80000000 ? "ES5506" : "ES5505"); + + m_c352->set_divider(version >= 0x171 && r8(0xd6) ? r8(0xd6) * 4 : 1); + + m_x1_010->set_unscaled_clock(version >= 0x171 ? r32(0xd8) & ~0x40000000 : 0); + if (version >= 0x171 && (r32(0xd8) & 0x40000000)) + logerror("Warning: file requests an unsupported 2nd X1-010\n"); + + m_c352->set_unscaled_clock(version >= 0x171 ? r32(0xdc) & ~0x40000000 : 0); + if (version >= 0x171 && (r32(0xd8) & 0x40000000)) + logerror("Warning: file requests an unsupported 2nd C352\n"); + + m_ga20->set_unscaled_clock(version >= 0x171 ? r32(0xe0) & ~0x40000000 : 0); + if (version >= 0x171 && (r32(0xd8) & 0x40000000)) + logerror("Warning: file requests an unsupported 2nd GA20\n"); + + machine().schedule_soft_reset(); return image_init_result::PASS; } @@ -2008,69 +1988,68 @@ MACHINE_CONFIG_START(vgmplay_state::vgmplay) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - MCFG_DEVICE_ADD("ym2612", YM2612, 7670454) + MCFG_DEVICE_ADD("ym2612", YM2612, 0) MCFG_SOUND_ROUTE(0, "lspeaker", 1) MCFG_SOUND_ROUTE(1, "rspeaker", 1) - MCFG_DEVICE_ADD("ym2151", YM2151, 3579545) + MCFG_DEVICE_ADD("ym2151", YM2151, 0) MCFG_SOUND_ROUTE(0, "lspeaker", 1) MCFG_SOUND_ROUTE(1, "rspeaker", 1) - MCFG_DEVICE_ADD("ym2413", YM2413, 3579545) + MCFG_DEVICE_ADD("ym2413", YM2413, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1) - MCFG_DEVICE_ADD("sn76496", SN76496, 3579545) + MCFG_DEVICE_ADD("sn76496", SN76496, 0) MCFG_SOUND_ROUTE(0, "lspeaker", 0.5) MCFG_SOUND_ROUTE(0, "rspeaker", 0.5) - MCFG_DEVICE_ADD("segapcm", SEGAPCM, 4000000) + MCFG_DEVICE_ADD("segapcm", SEGAPCM, 0) MCFG_SEGAPCM_BANK(BANK_512) // Should be configurable for yboard... MCFG_DEVICE_ADDRESS_MAP(0, segapcm_map) MCFG_SOUND_ROUTE(0, "lspeaker", 1) MCFG_SOUND_ROUTE(1, "rspeaker", 1) - MCFG_DEVICE_ADD("multipcma", MULTIPCM, 8000000) + MCFG_DEVICE_ADD("multipcma", MULTIPCM, 0) MCFG_DEVICE_ADDRESS_MAP(0, multipcma_map) MCFG_SOUND_ROUTE(0, "lspeaker", 1) MCFG_SOUND_ROUTE(1, "rspeaker", 1) - MCFG_DEVICE_ADD("multipcmb", MULTIPCM, 8000000) + MCFG_DEVICE_ADD("multipcmb", MULTIPCM, 0) MCFG_DEVICE_ADDRESS_MAP(0, multipcmb_map) MCFG_SOUND_ROUTE(0, "lspeaker", 1) MCFG_SOUND_ROUTE(1, "rspeaker", 1) - MCFG_DEVICE_ADD("dmg", DMG_APU, XTAL(4'194'304)) + MCFG_DEVICE_ADD("dmg", DMG_APU, 0) MCFG_SOUND_ROUTE(0, "lspeaker", 1) MCFG_SOUND_ROUTE(1, "rspeaker", 1) - MCFG_DEVICE_ADD("ay8910a", AY8910, 1500000) + MCFG_DEVICE_ADD("ay8910a", AY8910, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.33) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.33) - MCFG_DEVICE_ADD("ay8910b", AY8910, 1500000) + MCFG_DEVICE_ADD("ay8910b", AY8910, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.33) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.33) - MCFG_DEVICE_ADD("ym2203a", YM2203, 4000000) + MCFG_DEVICE_ADD("ym2203a", YM2203, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.25) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.25) - MCFG_DEVICE_ADD("ym2203b", YM2203, 4000000) + MCFG_DEVICE_ADD("ym2203b", YM2203, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.25) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.25) - MCFG_DEVICE_ADD("ym3526", YM3526, 4000000) + MCFG_DEVICE_ADD("ym3526", YM3526, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.5) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.5) - MCFG_DEVICE_ADD("ym3812", YM3812, 4000000) + MCFG_DEVICE_ADD("ym3812", YM3812, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50) - MCFG_DEVICE_ADD("nescpu", N2A03, 1000000) + MCFG_DEVICE_ADD("nescpu", N2A03, 0) MCFG_DEVICE_PROGRAM_MAP(nescpu_map) - MCFG_DEVICE_DISABLE() MCFG_DEVICE_MODIFY("nescpu:nesapu") MCFG_SOUND_ROUTES_RESET() @@ -2082,90 +2061,90 @@ MACHINE_CONFIG_START(vgmplay_state::vgmplay) MCFG_DEVICE_IO_MAP(h6280_io_map) MCFG_DEVICE_DISABLE() - MCFG_DEVICE_ADD("c6280", C6280, 3579545) + MCFG_DEVICE_ADD("c6280", C6280, 0) MCFG_C6280_CPU("h6280") MCFG_SOUND_ROUTE(0, "lspeaker", 1) MCFG_SOUND_ROUTE(1, "rspeaker", 1) - MCFG_K053260_ADD("k053260", 3579545) + MCFG_K053260_ADD("k053260", 0) MCFG_DEVICE_ADDRESS_MAP(0, k053260_map) MCFG_SOUND_ROUTE(0, "lspeaker", 1) MCFG_SOUND_ROUTE(1, "rspeaker", 1) - MCFG_DEVICE_ADD("pokeya", POKEY, 1789772) + MCFG_DEVICE_ADD("pokeya", POKEY, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.5) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.5) - MCFG_DEVICE_ADD("pokeyb", POKEY, 1789772) + MCFG_DEVICE_ADD("pokeyb", POKEY, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.5) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.5) - MCFG_DEVICE_ADD("c352", C352, 1000000, 288) + MCFG_DEVICE_ADD("c352", C352, 0, 1) MCFG_DEVICE_ADDRESS_MAP(0, c352_map) MCFG_SOUND_ROUTE(0, "lspeaker", 1) MCFG_SOUND_ROUTE(1, "rspeaker", 1) - MCFG_DEVICE_ADD("okim6295a", OKIM6295, 1000000, okim6295_device::PIN7_HIGH) + MCFG_DEVICE_ADD("okim6295a", OKIM6295, 0, okim6295_device::PIN7_HIGH) MCFG_DEVICE_ADDRESS_MAP(0, okim6295a_map) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.25) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.25) - MCFG_DEVICE_ADD("okim6295b", OKIM6295, 1000000, okim6295_device::PIN7_HIGH) + MCFG_DEVICE_ADD("okim6295b", OKIM6295, 0, okim6295_device::PIN7_HIGH) MCFG_DEVICE_ADDRESS_MAP(0, okim6295b_map) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.25) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.25) - MCFG_DEVICE_ADD("ymf271", YMF271, 16934400) + MCFG_DEVICE_ADD("ymf271", YMF271, 0) MCFG_DEVICE_ADDRESS_MAP(0, ymf271_map) MCFG_SOUND_ROUTE(0, "lspeaker", 1) MCFG_SOUND_ROUTE(1, "rspeaker", 1) - MCFG_DEVICE_ADD("ymz280b", YMZ280B, 16934400) + MCFG_DEVICE_ADD("ymz280b", YMZ280B, 0) MCFG_DEVICE_ADDRESS_MAP(0, ymz280b_map) MCFG_SOUND_ROUTE(0, "lspeaker", 1) MCFG_SOUND_ROUTE(1, "rspeaker", 1) - MCFG_DEVICE_ADD("ym2608", YM2608, 8000000) + MCFG_DEVICE_ADD("ym2608", YM2608, 0) MCFG_SOUND_ROUTE(0, "lspeaker", 0.25) MCFG_SOUND_ROUTE(0, "rspeaker", 0.25) MCFG_SOUND_ROUTE(1, "lspeaker", 0.50) MCFG_SOUND_ROUTE(2, "rspeaker", 0.50) - MCFG_DEVICE_ADD("k054539a", K054539, XTAL(18'432'000)) + MCFG_DEVICE_ADD("k054539a", K054539, 0) MCFG_DEVICE_ADDRESS_MAP(0, k054539a_map) MCFG_SOUND_ROUTE(0, "lspeaker", 1) MCFG_SOUND_ROUTE(1, "rspeaker", 1) - MCFG_DEVICE_ADD("k054539b", K054539, XTAL(18'432'000)) + MCFG_DEVICE_ADD("k054539b", K054539, 0) MCFG_DEVICE_ADDRESS_MAP(0, k054539b_map) MCFG_SOUND_ROUTE(0, "lspeaker", 1) MCFG_SOUND_ROUTE(1, "rspeaker", 1) - MCFG_DEVICE_ADD("qsound", QSOUND) + MCFG_DEVICE_ADD("qsound", QSOUND, 0) MCFG_DEVICE_ADDRESS_MAP(0, qsound_map) MCFG_SOUND_ROUTE(0, "lspeaker", 1) MCFG_SOUND_ROUTE(1, "rspeaker", 1) - MCFG_K051649_ADD("k051649", 3579545) + MCFG_K051649_ADD("k051649", 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.33) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.33) - IREMGA20(config, m_ga20, 3579545); + IREMGA20(config, m_ga20, 0); m_ga20->set_addrmap(0, &vgmplay_state::ga20_map); m_ga20->add_route(0, "lspeaker", 1); m_ga20->add_route(1, "rspeaker", 1); - RF5C68(config, m_rf5c68, 12500000); + RF5C68(config, m_rf5c68, 0); m_rf5c68->set_addrmap(0, &vgmplay_state::rf5c68_map); m_rf5c68->add_route(0, "lspeaker", 1); m_rf5c68->add_route(1, "rspeaker", 1); - RF5C68(config, m_rf5c164, 12500000); // TODO : !!RF5C164!! + RF5C68(config, m_rf5c164, 0); // TODO : !!RF5C164!! m_rf5c164->set_addrmap(0, &vgmplay_state::rf5c164_map); m_rf5c164->add_route(0, "lspeaker", 1); m_rf5c164->add_route(1, "rspeaker", 1); - X1_010(config, m_x1_010, 16000000); + X1_010(config, m_x1_010, 0); m_x1_010->set_addrmap(0, &vgmplay_state::x1_010_map); m_x1_010->add_route(0, "lspeaker", 1); m_x1_010->add_route(1, "rspeaker", 1); -- cgit v1.2.3 From d289ae98cb1fae51d8af5e942e09eac9719fc599 Mon Sep 17 00:00:00 2001 From: smf- Date: Sat, 28 Jul 2018 01:03:35 +0100 Subject: "All header sizes are valid for all versions from 1.50 on, as long as header has at least 64 bytes. If the VGM data starts at an offset that is lower than 0x100, all overlapping header bytes have to be handled as they were zero." (nw) --- src/mame/drivers/vgmplay.cpp | 160 +++++++++++++++++++------------------------ 1 file changed, 72 insertions(+), 88 deletions(-) diff --git a/src/mame/drivers/vgmplay.cpp b/src/mame/drivers/vgmplay.cpp index 63646e7b1a0..b5412b142d3 100644 --- a/src/mame/drivers/vgmplay.cpp +++ b/src/mame/drivers/vgmplay.cpp @@ -1491,23 +1491,7 @@ QUICKLOAD_LOAD_MEMBER(vgmplay_state, load_file) uint32_t version = r32(8); logerror("File version %x.%02x\n", version >> 8, version & 0xff); - uint32_t header_size = 0; - if(version < 0x151) - header_size = 0x40; - else if(version < 0x161) - header_size = 0x80; - else if(version < 0x171) - header_size = 0xc0; - else - header_size = 0x100; - logerror("Header size according to version is %x, header size according to header is %x\n", header_size, r32(0x34) + 0x34); - - uint32_t data_start = header_size; - if (version >= 0x150 && r32(0x34)) - data_start = r32(0x34) + 0x34; - - if (data_start < header_size) - logerror("Warning: data starts within header\n"); + uint32_t data_start = version >= 0x150 ? r32(0x34) + 0x34 : 0x40; // Parse clocks m_sn76496->set_unscaled_clock(r32(0x0c) & ~0xc0000000); @@ -1526,134 +1510,134 @@ QUICKLOAD_LOAD_MEMBER(vgmplay_state, load_file) if (version >= 0x110 && (r32(0x30) & 0x40000000)) logerror("Warning: file requests an unsupported 2nd YM2151\n"); - m_segapcm->set_unscaled_clock(version >= 0x151 ? r32(0x38) : 0); - m_segapcm->set_bank(version >= 0x151 ? r32(0x3c) : 0); + m_segapcm->set_unscaled_clock(version >= 0x151 && data_start >= 0x3c ? r32(0x38) : 0); + m_segapcm->set_bank(version >= 0x151 && data_start >= 0x40 ? r32(0x3c) : 0); - m_rf5c68->set_unscaled_clock(version >= 0x151 ? r32(0x40) : 0); - m_ym2203[0]->set_unscaled_clock(version >= 0x151 ? r32(0x44) & ~0x40000000 : 0); - m_ym2203[1]->set_unscaled_clock(version >= 0x151 && (r32(0x44) & 0x40000000) ? r32(0x44) & ~0x40000000 : 0); - m_ym2608->set_unscaled_clock(version >= 0x151 ? r32(0x48) & ~0x40000000 : 0); - if (version >= 0x151 && (r32(0x48) & 0x40000000)) + m_rf5c68->set_unscaled_clock(version >= 0x151 && data_start >= 0x44 ? r32(0x40) : 0); + m_ym2203[0]->set_unscaled_clock(version >= 0x151 && data_start >= 0x48 ? r32(0x44) & ~0x40000000 : 0); + m_ym2203[1]->set_unscaled_clock(version >= 0x151 && data_start >= 0x48 && (r32(0x44) & 0x40000000) ? r32(0x44) & ~0x40000000 : 0); + m_ym2608->set_unscaled_clock(version >= 0x151 && data_start >= 0x4c ? r32(0x48) & ~0x40000000 : 0); + if (version >= 0x151 && data_start >= 0x4c && (r32(0x48) & 0x40000000)) logerror("Warning: file requests an unsupported 2nd YM2608\n"); - if (version >= 0x151 && r32(0x4c)) + if (version >= 0x151 && data_start >= 0x50 && r32(0x4c)) logerror("Warning: file requests an unsupported %s\n", r32(0x4c) & 0x80000000 ? "YM2610B" : "YM2610"); - m_ym3812->set_unscaled_clock(version >= 0x151 ? r32(0x50) & ~0x40000000 : 0); - if (version >= 0x151 && (r32(0x50) & 0x40000000)) + m_ym3812->set_unscaled_clock(version >= 0x151 && data_start >= 0x54 ? r32(0x50) & ~0x40000000 : 0); + if (version >= 0x151 && data_start >= 0x54 && (r32(0x50) & 0x40000000)) logerror("Warning: file requests an unsupported 2nd YM3812\n"); - m_ym3526->set_unscaled_clock(version >= 0x151 ? r32(0x54) & ~0x40000000 : 0); - if (version >= 0x151 && (r32(0x54) & 0x40000000)) + m_ym3526->set_unscaled_clock(version >= 0x151 && data_start >= 0x58 ? r32(0x54) & ~0x40000000 : 0); + if (version >= 0x151 && data_start >= 0x58 && (r32(0x54) & 0x40000000)) logerror("Warning: file requests an unsupported 2nd YM3526\n"); - if(version >= 0x151 && r32(0x58)) + if(version >= 0x151 && data_start >= 0x5c && r32(0x58)) logerror("Warning: file requests an unsupported Y8950\n"); - if(version >= 0x151 && r32(0x5c)) + if(version >= 0x151 && data_start >= 0x60 && r32(0x5c)) logerror("Warning: file requests an unsupported YMF262\n"); - if(version >= 0x151 && r32(0x60)) + if(version >= 0x151 && data_start >= 0x64 && r32(0x60)) logerror("Warning: file requests an unsupported YMF278B\n"); - m_ymf271->set_unscaled_clock(version >= 0x151 ? r32(0x64) & ~0x40000000 : 0); - if (version >= 0x151 && (r32(0x64) & 0x40000000)) + m_ymf271->set_unscaled_clock(version >= 0x151 && data_start >= 0x68 ? r32(0x64) & ~0x40000000 : 0); + if (version >= 0x151 && data_start >= 0x68 && (r32(0x64) & 0x40000000)) logerror("Warning: file requests an unsupported 2nd YMF271\n"); - m_ymz280b->set_unscaled_clock(version >= 0x151 ? r32(0x68) & ~0x40000000 : 0); - if (version >= 0x151 && (r32(0x68) & 0x40000000)) + m_ymz280b->set_unscaled_clock(version >= 0x151 && data_start >= 0x6c ? r32(0x68) & ~0x40000000 : 0); + if (version >= 0x151 && data_start >= 0x6c && (r32(0x68) & 0x40000000)) logerror("Warning: file requests an unsupported 2nd YMZ280B\n"); - m_rf5c164->set_unscaled_clock(version >= 0x151 ? r32(0x6c) : 0); + m_rf5c164->set_unscaled_clock(version >= 0x151 && data_start >= 0x70 ? r32(0x6c) : 0); - if(version >= 0x151 && r32(0x70)) + if(version >= 0x151 && data_start >= 0x74 && r32(0x70)) logerror("Warning: file requests an unsupported PWM\n"); - m_ay8910[0]->set_unscaled_clock(version >= 0x151 ? r32(0x74) & ~0x40000000 : 0); - m_ay8910[1]->set_unscaled_clock(version >= 0x151 && (r32(0x74) & 0x40000000) ? r32(0x74) & ~0x40000000 : 0); - m_ay8910[0]->set_psg_type(vgm_ay8910_type(version >= 0x151 ? r8(0x78) : 0)); - m_ay8910[1]->set_psg_type(vgm_ay8910_type(version >= 0x151 ? r8(0x78) : 0)); - m_ay8910[0]->set_flags(vgm_ay8910_flags(version >= 0x151 ? r8(0x79) : 0)); - m_ay8910[1]->set_flags(vgm_ay8910_flags(version >= 0x151 ? r8(0x79) : 0)); - m_ym2203[0]->set_flags(vgm_ay8910_flags(version >= 0x151 ? r8(0x7a) : 0)); - m_ym2203[1]->set_flags(vgm_ay8910_flags(version >= 0x151 ? r8(0x7a) : 0)); - m_ym2608->set_flags(vgm_ay8910_flags(version >= 0x151 ? r8(0x7b) : 0)); - - m_dmg->set_unscaled_clock(version >= 0x161 ? r32(0x80) & ~0x40000000 : 0); - if (version >= 0x161 && (r32(0x80) & 0x40000000)) + m_ay8910[0]->set_unscaled_clock(version >= 0x151 && data_start >= 0x78 ? r32(0x74) & ~0x40000000 : 0); + m_ay8910[1]->set_unscaled_clock(version >= 0x151 && data_start >= 0x78 && (r32(0x74) & 0x40000000) ? r32(0x74) & ~0x40000000 : 0); + m_ay8910[0]->set_psg_type(vgm_ay8910_type(version >= 0x151 && data_start >= 0x7c ? r8(0x78) : 0)); + m_ay8910[1]->set_psg_type(vgm_ay8910_type(version >= 0x151 && data_start >= 0x7c ? r8(0x78) : 0)); + m_ay8910[0]->set_flags(vgm_ay8910_flags(version >= 0x151 && data_start >= 0x7a ? r8(0x79) : 0)); + m_ay8910[1]->set_flags(vgm_ay8910_flags(version >= 0x151 && data_start >= 0x7a ? r8(0x79) : 0)); + m_ym2203[0]->set_flags(vgm_ay8910_flags(version >= 0x151 && data_start >= 0x7b ? r8(0x7a) : 0)); + m_ym2203[1]->set_flags(vgm_ay8910_flags(version >= 0x151 && data_start >= 0x7b ? r8(0x7a) : 0)); + m_ym2608->set_flags(vgm_ay8910_flags(version >= 0x151 && data_start >= 0x7c ? r8(0x7b) : 0)); + + m_dmg->set_unscaled_clock(version >= 0x161 && data_start >= 0x84 ? r32(0x80) & ~0x40000000 : 0); + if (version >= 0x161 && data_start >= 0x84 && (r32(0x80) & 0x40000000)) logerror("Warning: file requests an unsupported 2nd DMG\n"); - m_nescpu->set_unscaled_clock(version >= 0x161 ? r32(0x84) & ~0x40000000 : 0); - m_nescpu->m_apu->set_unscaled_clock(version >= 0x161 ? r32(0x84) & ~0x40000000 : 0); - if (version >= 0x161 && (r32(0x84) & 0x40000000)) + m_nescpu->set_unscaled_clock(version >= 0x161 && data_start >= 0x88 ? r32(0x84) & ~0x40000000 : 0); + m_nescpu->m_apu->set_unscaled_clock(version >= 0x161 && data_start >= 0x88 ? r32(0x84) & ~0x40000000 : 0); + if (version >= 0x161 && data_start >= 0x88 && (r32(0x84) & 0x40000000)) logerror("Warning: file requests an unsupported 2nd NES APU\n"); - m_multipcm[0]->set_unscaled_clock(version >= 0x161 ? r32(0x88) & ~0x40000000 : 0); - m_multipcm[1]->set_unscaled_clock(version >= 0x161 && (r32(0x88) & 0x40000000) ? r32(0x88) & ~0x40000000 : 0); + m_multipcm[0]->set_unscaled_clock(version >= 0x161 && data_start >= 0x8c ? r32(0x88) & ~0x40000000 : 0); + m_multipcm[1]->set_unscaled_clock(version >= 0x161 && data_start >= 0x8c && (r32(0x88) & 0x40000000) ? r32(0x88) & ~0x40000000 : 0); - if (version >= 0x161 && r32(0x8c)) + if (version >= 0x161 && data_start >= 0x90 && r32(0x8c)) logerror("Warning: file requests an unsupported uPD7759\n"); - if (version >= 0x161 && r32(0x90)) + if (version >= 0x161 && data_start >= 0x94 && r32(0x90)) logerror("Warning: file requests an unsupported OKIM6258\n"); - m_k054539[0]->init_flags(version >= 0x161 ? r8(0x95) : 0); - m_k054539[1]->init_flags(version >= 0x161 ? r8(0x95) : 0); + m_k054539[0]->init_flags(version >= 0x161 && data_start >= 0x96 ? r8(0x95) : 0); + m_k054539[1]->init_flags(version >= 0x161 && data_start >= 0x96 ? r8(0x95) : 0); - m_okim6295_clock[0] = version >= 0x161 ? r32(0x98) & 0xc0000000 : 0; - m_okim6295_clock[1] = version >= 0x161 && (r32(0x98) & 0x40000000) ? r32(0x98) & 0xc0000000 : 0; + m_okim6295_clock[0] = version >= 0x161 && data_start >= 0x9c ? r32(0x98) & 0xc0000000 : 0; + m_okim6295_clock[1] = version >= 0x161 && data_start >= 0x9c && (r32(0x98) & 0x40000000) ? r32(0x98) & 0xc0000000 : 0; m_okim6295[0]->set_unscaled_clock(m_okim6295_clock[0]); m_okim6295[1]->set_unscaled_clock(m_okim6295_clock[1]); - m_okim6295_pin7[0] = version >= 0x161 && (r32(0x98) & 0x80000000) ? 1 : 0; - m_okim6295_pin7[1] = version >= 0x161 && (r32(0x98) & 0x40000000) && (r32(0x98) & 0x80000000) ? 1 : 0; + m_okim6295_pin7[0] = version >= 0x161 && data_start >= 0x9c && (r32(0x98) & 0x80000000) ? 1 : 0; + m_okim6295_pin7[1] = version >= 0x161 && data_start >= 0x9c && (r32(0x98) & 0x40000000) && (r32(0x98) & 0x80000000) ? 1 : 0; m_okim6295[0]->set_pin7(m_okim6295_pin7[0] ? okim6295_device::PIN7_HIGH : okim6295_device::PIN7_LOW); m_okim6295[1]->set_pin7(m_okim6295_pin7[1] ? okim6295_device::PIN7_HIGH : okim6295_device::PIN7_LOW); - m_k051649->set_unscaled_clock(version >= 0x161 ? r32(0x9c) & ~0x40000000 : 0); - if (version >= 0x161 && (r32(0x9c) & 0x40000000)) + m_k051649->set_unscaled_clock(version >= 0x161 && data_start >= 0xa0 ? r32(0x9c) & ~0x40000000 : 0); + if (version >= 0x161 && data_start >= 0xa0 && (r32(0x9c) & 0x40000000)) logerror("Warning: file requests an unsupported 2nd K051649\n"); - m_k054539[0]->set_unscaled_clock(version >= 0x161 ? r32(0xa0) & ~0x40000000 : 0); - m_k054539[1]->set_unscaled_clock(version >= 0x161 && (r32(0xa0) & 0x40000000) ? r32(0xa0) & ~0x40000000 : 0); + m_k054539[0]->set_unscaled_clock(version >= 0x161 && data_start >= 0xa4 ? r32(0xa0) & ~0x40000000 : 0); + m_k054539[1]->set_unscaled_clock(version >= 0x161 && data_start >= 0xa4 && (r32(0xa0) & 0x40000000) ? r32(0xa0) & ~0x40000000 : 0); - m_c6280->set_unscaled_clock(version >= 0x161 ? r32(0xa4) & ~0x40000000 : 0); - if (version >= 0x161 && (r32(0xa4) & 0x40000000)) + m_c6280->set_unscaled_clock(version >= 0x161 && data_start >= 0xa8 ? r32(0xa4) & ~0x40000000 : 0); + if (version >= 0x161 && data_start >= 0xa8 && (r32(0xa4) & 0x40000000)) logerror("Warning: file requests an unsupported 2nd C6280\n"); - if (version >= 0x161 && r32(0x90)) + if (version >= 0x161 && data_start >= 0xac && r32(0xa8)) logerror("Warning: file requests an unsupported C140\n"); - m_k053260->set_unscaled_clock(version >= 0x161 ? r32(0xac) & ~0x40000000 : 0); - if (version >= 0x161 && (r32(0xac) & 0x40000000)) + m_k053260->set_unscaled_clock(version >= 0x161 && data_start >= 0xb0 ? r32(0xac) & ~0x40000000 : 0); + if (version >= 0x161 && data_start >= 0xb0 && (r32(0xac) & 0x40000000)) logerror("Warning: file requests an unsupported 2nd K053260\n"); - m_pokey[0]->set_unscaled_clock(version >= 0x161 ? r32(0xb0) & ~0x40000000 : 0); - m_pokey[1]->set_unscaled_clock(version >= 0x161 && (r32(0xb0) & 0x40000000) ? r32(0xb0) & ~0x40000000 : 0); - m_qsound->set_unscaled_clock(version >= 0x161 ? r32(0xb4) * 15 : 0); // * 15 multipler for correct pitch + m_pokey[0]->set_unscaled_clock(version >= 0x161 && data_start >= 0xb4 ? r32(0xb0) & ~0x40000000 : 0); + m_pokey[1]->set_unscaled_clock(version >= 0x161 && data_start >= 0xb4 && (r32(0xb0) & 0x40000000) ? r32(0xb0) & ~0x40000000 : 0); + m_qsound->set_unscaled_clock(version >= 0x161 && data_start >= 0xb8 ? r32(0xb4) * 15 : 0); // * 15 multipler for correct pitch - if (version >= 0x151 && r32(0xb8)) + if (version >= 0x151 && data_start >= 0xbc && r32(0xb8)) logerror("Warning: file requests an unsupported SCSP\n"); - if (version >= 0x151 && r32(0xc0)) + if (version >= 0x151 && data_start >= 0xc4 && r32(0xc0)) logerror("Warning: file requests an unsupported WonderSwan\n"); - if (version >= 0x151 && r32(0xc4)) + if (version >= 0x151 && data_start >= 0xc8 && r32(0xc4)) logerror("Warning: file requests an unsupported VSU\n"); - if (version >= 0x151 && r32(0xc8)) + if (version >= 0x151 && data_start >= 0xcc && r32(0xc8)) logerror("Warning: file requests an unsupported SAA1099\n"); - if (version >= 0x151 && r32(0xcc)) + if (version >= 0x151 && data_start >= 0xd0 && r32(0xcc)) logerror("Warning: file requests an unsupported ES5503\n"); - if (version >= 0x151 && r32(0xd0)) + if (version >= 0x151 && data_start >= 0xd4 && r32(0xd0)) logerror("Warning: file requests an unsupported %s\n", r32(0xd0) & 0x80000000 ? "ES5506" : "ES5505"); - m_c352->set_divider(version >= 0x171 && r8(0xd6) ? r8(0xd6) * 4 : 1); + m_c352->set_divider(version >= 0x171 && data_start >= 0xd7 && r8(0xd6) ? r8(0xd6) * 4 : 1); - m_x1_010->set_unscaled_clock(version >= 0x171 ? r32(0xd8) & ~0x40000000 : 0); - if (version >= 0x171 && (r32(0xd8) & 0x40000000)) + m_x1_010->set_unscaled_clock(version >= 0x171 && data_start >= 0xdc ? r32(0xd8) & ~0x40000000 : 0); + if (version >= 0x171 && data_start >= 0xdc && (r32(0xd8) & 0x40000000)) logerror("Warning: file requests an unsupported 2nd X1-010\n"); - m_c352->set_unscaled_clock(version >= 0x171 ? r32(0xdc) & ~0x40000000 : 0); - if (version >= 0x171 && (r32(0xd8) & 0x40000000)) + m_c352->set_unscaled_clock(version >= 0x171 && data_start >= 0xe0 ? r32(0xdc) & ~0x40000000 : 0); + if (version >= 0x171 && data_start >= 0xe0 && (r32(0xdc) & 0x40000000)) logerror("Warning: file requests an unsupported 2nd C352\n"); - m_ga20->set_unscaled_clock(version >= 0x171 ? r32(0xe0) & ~0x40000000 : 0); - if (version >= 0x171 && (r32(0xd8) & 0x40000000)) + m_ga20->set_unscaled_clock(version >= 0x171 && data_start >= 0xe4 ? r32(0xe0) & ~0x40000000 : 0); + if (version >= 0x171 && data_start >= 0xe4 && (r32(0xe0) & 0x40000000)) logerror("Warning: file requests an unsupported 2nd GA20\n"); machine().schedule_soft_reset(); -- cgit v1.2.3 From a103080fc666621524c9afbfb683b20b1c21a544 Mon Sep 17 00:00:00 2001 From: braintro Date: Fri, 27 Jul 2018 19:56:13 -0500 Subject: new working clone - WWF WrestleFest (US) Out of whatsnew: Minor clean up: Correct OKI Clock for wwfwfest sets Update rom names to MAME convention minor ROM name corrections New Clone Added ----------------------------------------- WWF WrestleFest (US) [SpinalFeyd, The Dumping Union] --- src/mame/drivers/ddragon3.cpp | 78 ++++++++++++++++++++++++++++++------------- src/mame/mame.lst | 7 ++-- 2 files changed, 58 insertions(+), 27 deletions(-) diff --git a/src/mame/drivers/ddragon3.cpp b/src/mame/drivers/ddragon3.cpp index ddd459e6bf3..a364b8b0520 100644 --- a/src/mame/drivers/ddragon3.cpp +++ b/src/mame/drivers/ddragon3.cpp @@ -932,7 +932,7 @@ MACHINE_CONFIG_START(wwfwfest_state::wwfwfest) MCFG_SOUND_ROUTE(0, "mono", 0.45) MCFG_SOUND_ROUTE(1, "mono", 0.45) - MCFG_DEVICE_ADD("oki", OKIM6295, 1024188, okim6295_device::PIN7_HIGH) /* Verified - Pin 7 tied to +5VDC */ + MCFG_DEVICE_ADD("oki", OKIM6295, 1.056_MHz_XTAL, okim6295_device::PIN7_HIGH) /* Verified - Pin 7 tied to +5VDC */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90) MACHINE_CONFIG_END @@ -981,8 +981,8 @@ ROM_END ROM_START( ddragon3j ) ROM_REGION( 0x80000, "maincpu", 0 ) /* 64k for cpu code */ - ROM_LOAD16_BYTE( "30j15.ic78", 0x00001, 0x40000, CRC(40618cbc) SHA1(cb05498003a45d773983501d3a0f1584a25dcdd3) ) - ROM_LOAD16_BYTE( "30j14.ic79", 0x00000, 0x20000, CRC(96827e80) SHA1(499c0c67d55ff4816ad8832d1d8836eb7432bd13) ) + ROM_LOAD16_BYTE( "30j15-0.ic78", 0x00001, 0x40000, CRC(40618cbc) SHA1(cb05498003a45d773983501d3a0f1584a25dcdd3) ) + ROM_LOAD16_BYTE( "30j14-0.ic79", 0x00000, 0x20000, CRC(96827e80) SHA1(499c0c67d55ff4816ad8832d1d8836eb7432bd13) ) ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for sound cpu code */ ROM_LOAD( "30j13.ic43", 0x00000, 0x10000, CRC(1e974d9b) SHA1(8e54ff747efe587a2e971c15e729445c4e232f0f) ) @@ -1115,7 +1115,7 @@ ROM_START( ctribe ) ROM_REGION( 0x80000, "maincpu", 0 ) /* 64k for cpu code */ ROM_LOAD16_BYTE( "28a16-2.ic26", 0x00001, 0x20000, CRC(c46b2e63) SHA1(86ace715dca48c78a46da1d102de47e5f948a86c) ) ROM_LOAD16_BYTE( "28a15-2.ic25", 0x00000, 0x20000, CRC(3221c755) SHA1(0f6fe5cd6947f6547585eedb7fc5e6af8544b1f7) ) - ROM_LOAD16_BYTE( "28j17-0.104", 0x40001, 0x10000, CRC(8c2c6dbd) SHA1(b99b9be6e0bdc8340fedd258819c4df587926a84) ) + ROM_LOAD16_BYTE( "28j17-0.104", 0x40001, 0x10000, CRC(8c2c6dbd) SHA1(b99b9be6e0bdc8340fedd258819c4df587926a84) ) /* No EVEN rom! */ ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for sound cpu code */ @@ -1145,11 +1145,11 @@ ROM_START( ctribe ) ROM_LOAD( "28.ic44", 0x0000, 0x0100, CRC(964329ef) SHA1(f26846571a16d27b726f689049deb0188103aadb) ) ROM_END -ROM_START( ctribe1 ) +ROM_START( ctribeua ) ROM_REGION( 0x80000, "maincpu", 0 ) /* 64k for cpu code */ ROM_LOAD16_BYTE( "1_28a16-2.ic26", 0x00001, 0x20000, CRC(f00f8443) SHA1(3c099b6bea9956cc60ce4a9a5d790ac2bf7d77bd) ) ROM_LOAD16_BYTE( "1_28a15-2.ic25", 0x00000, 0x20000, CRC(dd70079f) SHA1(321b523fefec2a962d0afa20b33428e7caea8958) ) - ROM_LOAD16_BYTE( "28j17-0.104", 0x40001, 0x10000, CRC(8c2c6dbd) SHA1(b99b9be6e0bdc8340fedd258819c4df587926a84) ) + ROM_LOAD16_BYTE( "28j17-0.104", 0x40001, 0x10000, CRC(8c2c6dbd) SHA1(b99b9be6e0bdc8340fedd258819c4df587926a84) ) /* No EVEN rom! */ ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for sound cpu code */ @@ -1179,11 +1179,11 @@ ROM_START( ctribe1 ) ROM_LOAD( "28.ic44", 0x0000, 0x0100, CRC(964329ef) SHA1(f26846571a16d27b726f689049deb0188103aadb) ) ROM_END -ROM_START( ctribeo ) // only main program code differs from ctribe1 set +ROM_START( ctribeu1 ) // only main program code differs from ctribe1 set ROM_REGION( 0x80000, "maincpu", 0 ) /* 64k for cpu code */ ROM_LOAD16_BYTE( "28a16-1.ic26", 0x00001, 0x20000, CRC(d108f36f) SHA1(af53fa441b9ddfc639abb573864a9b351633c6b7) ) ROM_LOAD16_BYTE( "28a15-1.ic25", 0x00000, 0x20000, CRC(3f5693a3) SHA1(2d4516506ad1d68ac45242fe149bba1b4b53eb45) ) - ROM_LOAD16_BYTE( "28j17-0.104", 0x40001, 0x10000, CRC(8c2c6dbd) SHA1(b99b9be6e0bdc8340fedd258819c4df587926a84) ) + ROM_LOAD16_BYTE( "28j17-0.104", 0x40001, 0x10000, CRC(8c2c6dbd) SHA1(b99b9be6e0bdc8340fedd258819c4df587926a84) ) /* No EVEN rom! */ ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for sound cpu code */ @@ -1215,9 +1215,9 @@ ROM_END ROM_START( ctribej ) ROM_REGION( 0x80000, "maincpu", 0 ) /* 64k for cpu code */ - ROM_LOAD16_BYTE( "28j16-02.26", 0x00001, 0x20000, CRC(658b8568) SHA1(899682f6ab28b184654c51c1169216974043f1b9) ) - ROM_LOAD16_BYTE( "28j15-12.25", 0x00000, 0x20000, CRC(50aac7e7) SHA1(af77107f325f9b45a92c544328d3073ed1db5465) ) - ROM_LOAD16_BYTE( "28j17-0.104", 0x40001, 0x10000, CRC(8c2c6dbd) SHA1(b99b9be6e0bdc8340fedd258819c4df587926a84) ) + ROM_LOAD16_BYTE( "28j16-2.ic26", 0x00001, 0x20000, CRC(658b8568) SHA1(899682f6ab28b184654c51c1169216974043f1b9) ) + ROM_LOAD16_BYTE( "28j15-2.ic25", 0x00000, 0x20000, CRC(50aac7e7) SHA1(af77107f325f9b45a92c544328d3073ed1db5465) ) + ROM_LOAD16_BYTE( "28j17-0.104", 0x40001, 0x10000, CRC(8c2c6dbd) SHA1(b99b9be6e0bdc8340fedd258819c4df587926a84) ) /* No EVEN rom! */ ROM_REGION( 0x10000, "audiocpu", 0 ) /* 64k for sound cpu code */ @@ -1385,7 +1385,36 @@ ROM_START( wwfwfestu ) ROM_LOAD( "31j1.ic2", 0x00000, 0x40000, CRC(82ed7155) SHA1(b338e1150ffe3277c11d4d6e801a7d3bd7c58492) ) /* 2,3 */ ROM_END -ROM_START( wwfwfestb ) +ROM_START( wwfwfestu1 ) + ROM_REGION( 0x80000, "maincpu", 0 ) /* Main CPU (68000) */ + ROM_LOAD16_BYTE( "31a13-0.ic19", 0x00001, 0x40000, CRC(a01c7c95) SHA1(298b9eeaeb8a207cbb02f4bea87436f0421697fe) ) /* label had a blue stripe down the side */ + ROM_LOAD16_BYTE( "31a14-0.ic18", 0x00000, 0x40000, CRC(30824d0b) SHA1(54281c76f380225516877648645a619d8417816e) ) /* label had a blue stripe down the side */ + + ROM_REGION( 0x10000, "audiocpu", 0 ) /* Sound CPU (Z80) */ + ROM_LOAD( "31a11-0.ic42", 0x00000, 0x10000, CRC(5ddebfea) SHA1(30073963e965250d94f0dc3bd261a054850adf95) ) /* labeled as 31A11-0 but same data 31A11-2 */ + + ROM_REGION( 0x80000, "oki", 0 ) /* ADPCM samples */ + ROM_LOAD( "31j10.ic73", 0x00000, 0x80000, CRC(6c522edb) SHA1(8005d59c94160638ba2ea7caf4e991fff03003d5) ) + + ROM_REGION( 0x20000, "gfx1", 0 ) /* FG0 Tiles (8x8) */ + ROM_LOAD( "31a12-0.ic33", 0x00000, 0x20000, CRC(d0803e20) SHA1(b68758e9a5522396f831a3972571f8aed54c64de) ) + + ROM_REGION( 0x800000, "gfx2", 0 ) /* SPR Tiles (16x16), 27080 Mask ROM's */ + ROM_LOAD( "31j3.ic9", 0x000000, 0x100000, CRC(e395cf1d) SHA1(241f98145e295993c9b6a44dc087a9b61fbc9a6f) ) /* Tiles 0 */ + ROM_LOAD( "31j2.ic8", 0x100000, 0x100000, CRC(b5a97465) SHA1(08d82c29a5c02b83fdbd0bad649b74eb35ab7e54) ) /* Tiles 1 */ + ROM_LOAD( "31j5.ic11", 0x200000, 0x100000, CRC(2ce545e8) SHA1(82173e58a8476a6fe9d2c990fce1f71af117a0ea) ) /* Tiles 0 */ + ROM_LOAD( "31j4.ic10", 0x300000, 0x100000, CRC(00edb66a) SHA1(926606d1923936b6e75391b1ab03b369d9822d13) ) /* Tiles 1 */ + ROM_LOAD( "31j6.ic12", 0x400000, 0x100000, CRC(79956cf8) SHA1(52207263620a6b6dde66d3f8749b772577899ea5) ) /* Tiles 0 */ + ROM_LOAD( "31j7.ic13", 0x500000, 0x100000, CRC(74d774c3) SHA1(a723ac5d481bf91b12e17652fbb2d869c886dec0) ) /* Tiles 1 */ + ROM_LOAD( "31j9.ic15", 0x600000, 0x100000, CRC(dd387289) SHA1(2cad42d4e7cd1a49346f844058ae18c38bc686a8) ) /* Tiles 0 */ + ROM_LOAD( "31j8.ic14", 0x700000, 0x100000, CRC(44abe127) SHA1(c723e1dea117534e976d2d383e634faf073cd57b) ) /* Tiles 1 */ + + ROM_REGION( 0x80000, "gfx3", 0 ) /* BG0 / BG1 Tiles (16x16) */ + ROM_LOAD( "31j0.ic1", 0x40000, 0x40000, CRC(8a12b450) SHA1(2e15c949efcda8bb6f11afe3ff07ba1dee9c771c) ) /* 0,1 */ + ROM_LOAD( "31j1.ic2", 0x00000, 0x40000, CRC(82ed7155) SHA1(b338e1150ffe3277c11d4d6e801a7d3bd7c58492) ) /* 2,3 */ +ROM_END + +ROM_START( wwfwfestub ) ROM_REGION( 0x80000, "maincpu", 0 ) /* Main CPU (68000) */ ROM_LOAD16_BYTE( "3", 0x00000, 0x40000, CRC(ea73369c) SHA1(be614a342f9014251810fa30ec56fec03f7c8ef3) ) ROM_LOAD16_BYTE( "2", 0x00001, 0x40000, CRC(632bb3a4) SHA1(9c04fed5aeefc683810cfbd9b3318e155ed9813f) ) @@ -1486,15 +1515,16 @@ GAME( 1990, ddragon3j, ddragon3, ddragon3, ddragon3, ddragon3_state, empty_ini GAME( 1990, ddragon3p, ddragon3, ddragon3, ddragon3, ddragon3_state, empty_init, ROT0, "Technos Japan", "Double Dragon 3 - The Rosetta Stone (prototype)", MACHINE_SUPPORTS_SAVE ) GAME( 1990, ddragon3b, ddragon3, ddragon3b, ddragon3b, ddragon3_state, empty_init, ROT0, "bootleg", "Double Dragon 3 - The Rosetta Stone (bootleg)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, ctribe, 0, ctribe, ctribe, ddragon3_state, empty_init, ROT0, "Technos Japan", "The Combatribes (US)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, ctribe1, ctribe, ctribe, ctribe, ddragon3_state, empty_init, ROT0, "Technos Japan", "The Combatribes (US set 1?)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, ctribeo, ctribe, ctribe, ctribe, ddragon3_state, empty_init, ROT0, "Technos Japan", "The Combatribes (US, older)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, ctribej, ctribe, ctribe, ctribe, ddragon3_state, empty_init, ROT0, "Technos Japan", "The Combatribes (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, ctribeb, ctribe, ctribe, ctribeb, ddragon3_state, empty_init, ROT0, "bootleg", "The Combatribes (bootleg set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, ctribeb2, ctribe, ctribe, ctribeb, ddragon3_state, empty_init, ROT0, "bootleg", "The Combatribes (bootleg set 2)", MACHINE_SUPPORTS_SAVE ) - -GAME( 1991, wwfwfest, 0, wwfwfest, wwfwfest, wwfwfest_state, empty_init, ROT0, "Technos Japan (Tecmo license)", "WWF WrestleFest (World)", MACHINE_SUPPORTS_SAVE ) // Euro label but shows FBI "Winners Don't Do drugs" logo -GAME( 1991, wwfwfestu, wwfwfest, wwfwfest, wwfwfest, wwfwfest_state, empty_init, ROT0, "Technos Japan", "WWF WrestleFest (US)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, wwfwfestb, wwfwfest, wwfwfstb, wwfwfest, wwfwfest_state, empty_init, ROT0, "bootleg", "WWF WrestleFest (US bootleg)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, wwfwfestj, wwfwfest, wwfwfest, wwfwfesta, wwfwfest_state, empty_init, ROT0, "Technos Japan (Tecmo license)", "WWF WrestleFest (Japan)", MACHINE_SUPPORTS_SAVE ) -GAME( 1991, wwfwfestk, wwfwfest, wwfwfest, wwfwfesta, wwfwfest_state, empty_init, ROT0, "Technos Japan (Tecmo license)", "WWF WrestleFest (Korea)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, ctribe, 0, ctribe, ctribe, ddragon3_state, empty_init, ROT0, "Technos Japan", "The Combatribes (US, rev 2, set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, ctribeua, ctribe, ctribe, ctribe, ddragon3_state, empty_init, ROT0, "Technos Japan", "The Combatribes (US, rev 2, set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, ctribeu1, ctribe, ctribe, ctribe, ddragon3_state, empty_init, ROT0, "Technos Japan", "The Combatribes (US, rev 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, ctribej, ctribe, ctribe, ctribe, ddragon3_state, empty_init, ROT0, "Technos Japan", "The Combatribes (Japan, rev 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, ctribeb, ctribe, ctribe, ctribeb, ddragon3_state, empty_init, ROT0, "bootleg", "The Combatribes (bootleg set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, ctribeb2, ctribe, ctribe, ctribeb, ddragon3_state, empty_init, ROT0, "bootleg", "The Combatribes (bootleg set 2)", MACHINE_SUPPORTS_SAVE ) + +GAME( 1991, wwfwfest, 0, wwfwfest, wwfwfest, wwfwfest_state, empty_init, ROT0, "Technos Japan (Tecmo license)", "WWF WrestleFest (World)", MACHINE_SUPPORTS_SAVE ) // Euro label but shows FBI "Winners Don't Do drugs" logo +GAME( 1991, wwfwfestu, wwfwfest, wwfwfest, wwfwfest, wwfwfest_state, empty_init, ROT0, "Technos Japan", "WWF WrestleFest (US, rev 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, wwfwfestu1, wwfwfest, wwfwfest, wwfwfest, wwfwfest_state, empty_init, ROT0, "Technos Japan", "WWF WrestleFest (US)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, wwfwfestub, wwfwfest, wwfwfstb, wwfwfest, wwfwfest_state, empty_init, ROT0, "bootleg", "WWF WrestleFest (US bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, wwfwfestj, wwfwfest, wwfwfest, wwfwfesta, wwfwfest_state, empty_init, ROT0, "Technos Japan (Tecmo license)", "WWF WrestleFest (Japan)", MACHINE_SUPPORTS_SAVE ) +GAME( 1991, wwfwfestk, wwfwfest, wwfwfest, wwfwfesta, wwfwfest_state, empty_init, ROT0, "Technos Japan (Tecmo license)", "WWF WrestleFest (Korea)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/mame.lst b/src/mame/mame.lst index a0b3c195877..867b6da3793 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -11036,20 +11036,21 @@ tstrikea // Game Room @source:ddragon3.cpp ctribe // TA-0028 (c) 1990 (US) -ctribe1 // TA-0028 (c) 1990 (US) ctribeb // bootleg ctribeb2 // bootleg ctribej // TA-0028 (c) 1990 (Japan) -ctribeo // TA-0028 (c) 1990 (US) +ctribeu1 // TA-0028 (c) 1990 (US) +ctribeua // TA-0028 (c) 1990 (US) ddragon3 // TA-0030 (c) 1990 ddragon3b // bootleg ddragon3j // TA-0030 (c) 1990 (Japan) ddragon3p // TA-0030 (c) 1990 wwfwfest // TA-0031 (c) 1991 + Tecmo license (World) -wwfwfestb // bootleg wwfwfestj // TA-0031 (c) 1991 + Tecmo license (Japan) wwfwfestk // TA-0031 (c) 1991 + Tecmo license (Korea) wwfwfestu // TA-0031 (c) 1991 (US) +wwfwfestu1 // TA-0031 (c) 1991 (US) +wwfwfestub // bootleg @source:ddribble.cpp ddribble // GX690 (c) 1986 -- cgit v1.2.3 From a4cc8c9af4817f0706a7a926e5bbaee5f2381131 Mon Sep 17 00:00:00 2001 From: smf- Date: Sat, 28 Jul 2018 02:00:19 +0100 Subject: vgmplay: preliminary hook up of YM2610 [smf] --- src/devices/sound/2610intf.cpp | 12 +++++++++++- src/devices/sound/2610intf.h | 1 + src/devices/sound/fm.cpp | 8 ++++++++ src/devices/sound/fm.h | 1 + src/mame/drivers/vgmplay.cpp | 28 ++++++++++++++++++++++++++-- src/mame/layout/vgmplay.lay | 4 ++++ 6 files changed, 51 insertions(+), 3 deletions(-) diff --git a/src/devices/sound/2610intf.cpp b/src/devices/sound/2610intf.cpp index ae208511d03..6b2e2886d8c 100644 --- a/src/devices/sound/2610intf.cpp +++ b/src/devices/sound/2610intf.cpp @@ -51,7 +51,7 @@ void ym2610_device::device_timer(emu_timer &timer, device_timer_id id, int param void ym2610_device::timer_handler(int c,int count,int clock) { - if( count == 0 ) + if( count == 0 || clock == 0 ) { /* Reset FM Timer */ m_timer[c]->enable(false); } @@ -128,6 +128,16 @@ void ym2610_device::device_start() assert_always(m_chip != nullptr, "Error creating YM2610 chip"); } +//------------------------------------------------- +// device_clock_changed +//------------------------------------------------- + +void ym2610_device::device_clock_changed() +{ + m_stream->set_sample_rate(clock() / 72); + ym2610_clock_changed(m_chip, clock(), clock() / 72); +} + //------------------------------------------------- // device_stop - device-specific stop //------------------------------------------------- diff --git a/src/devices/sound/2610intf.h b/src/devices/sound/2610intf.h index bb25f97b51e..583091a666b 100644 --- a/src/devices/sound/2610intf.h +++ b/src/devices/sound/2610intf.h @@ -37,6 +37,7 @@ protected: // device-level overrides virtual void device_start() override; + virtual void device_clock_changed() override; virtual void device_post_load() override; virtual void device_stop() override; virtual void device_reset() override; diff --git a/src/devices/sound/fm.cpp b/src/devices/sound/fm.cpp index 169e9239ee1..e93d009f65f 100644 --- a/src/devices/sound/fm.cpp +++ b/src/devices/sound/fm.cpp @@ -3691,6 +3691,14 @@ void *ym2610_init(device_t *device, int clock, int rate, void *pcmroma,int pcmsi return F2610; } +void ym2610_clock_changed(void *chip, int clock, int rate) +{ + ym2610_state *F2610 = (ym2610_state *)chip; + + F2610->OPN.ST.clock = clock; + F2610->OPN.ST.rate = rate; +} + /* shut down emulator */ void ym2610_shutdown(void *chip) { diff --git a/src/devices/sound/fm.h b/src/devices/sound/fm.h index e774a9cf5bd..7b919ea7402 100644 --- a/src/devices/sound/fm.h +++ b/src/devices/sound/fm.h @@ -152,6 +152,7 @@ void ym2608_postload(void *chip); void * ym2610_init(device_t *device, int baseclock, int rate, void *pcmroma,int pcmasize,void *pcmromb,int pcmbsize, FM_TIMERHANDLER TimerHandler,FM_IRQHANDLER IRQHandler, const ssg_callbacks *ssg); +void ym2610_clock_changed(void *chip, int clock, int rate); void ym2610_shutdown(void *chip); void ym2610_reset_chip(void *chip); void ym2610_update_one(void *chip, FMSAMPLE **buffer, int length); diff --git a/src/mame/drivers/vgmplay.cpp b/src/mame/drivers/vgmplay.cpp index b5412b142d3..135551df23f 100644 --- a/src/mame/drivers/vgmplay.cpp +++ b/src/mame/drivers/vgmplay.cpp @@ -14,6 +14,7 @@ #include "cpu/m6502/n2a03.h" #include "sound/2203intf.h" #include "sound/2608intf.h" +#include "sound/2610intf.h" #include "sound/2612intf.h" #include "sound/3526intf.h" #include "sound/3812intf.h" @@ -93,6 +94,7 @@ public: A_YMF271 = 0x00013040, A_YMZ280B = 0x00013050, A_YM2608 = 0x00013060, + A_YM2610 = 0x00013070, A_K054539A = 0x00013400, A_K054539B = 0x00013800, A_QSOUND = 0x00013c00, @@ -199,6 +201,7 @@ private: LED_RF5C164, LED_X1_010, + LED_YM2610, LED_COUNT }; @@ -336,6 +339,7 @@ private: required_device m_ymf271; required_device m_ymz280b; required_device m_ym2608; + required_device m_ym2610; required_device m_qsound; required_device m_k051649; required_device m_ga20; @@ -629,6 +633,14 @@ void vgmplay_device::execute_run() m_pc += 3; break; + case 0x58: + case 0x59: + pulse_act_led(LED_YM2610); + m_io->write_byte(A_YM2610 + 0 + ((code & 1) << 1), m_file->read_byte(m_pc + 1)); + m_io->write_byte(A_YM2610 + 1 + ((code & 1) << 1), m_file->read_byte(m_pc + 2)); + m_pc += 3; + break; + case 0xA5: pulse_act_led(LED_YM2203); m_io->write_byte(A_YM2203B+0, m_file->read_byte(m_pc+1)); @@ -1394,6 +1406,7 @@ vgmplay_state::vgmplay_state(const machine_config &mconfig, device_type type, co , m_ymf271(*this, "ymf271") , m_ymz280b(*this, "ymz280b") , m_ym2608(*this, "ym2608") + , m_ym2610(*this, "ym2610") , m_qsound(*this, "qsound") , m_k051649(*this, "k051649") , m_ga20(*this, "ga20") @@ -1520,8 +1533,11 @@ QUICKLOAD_LOAD_MEMBER(vgmplay_state, load_file) if (version >= 0x151 && data_start >= 0x4c && (r32(0x48) & 0x40000000)) logerror("Warning: file requests an unsupported 2nd YM2608\n"); - if (version >= 0x151 && data_start >= 0x50 && r32(0x4c)) - logerror("Warning: file requests an unsupported %s\n", r32(0x4c) & 0x80000000 ? "YM2610B" : "YM2610"); + m_ym2610->set_unscaled_clock(version >= 0x151 && data_start >= 0x50 ? r32(0x4c) & ~0xc0000000 : 0); + if (version >= 0x151 && data_start >= 0x50 && (r32(0x4c) & 0x40000000)) + logerror("Warning: file requests an unsupported 2nd YM2610\n"); + if (version >= 0x151 && data_start >= 0x50 && (r32(0x4c) & 0x80000000)) + logerror("Warning: file requests an unsupported YM2610B\n"); m_ym3812->set_unscaled_clock(version >= 0x151 && data_start >= 0x54 ? r32(0x50) & ~0x40000000 : 0); if (version >= 0x151 && data_start >= 0x54 && (r32(0x50) & 0x40000000)) @@ -1849,6 +1865,7 @@ void vgmplay_state::soundchips_map(address_map &map) map(vgmplay_device::A_YMF271, vgmplay_device::A_YMF271+0xf).w(m_ymf271, FUNC(ymf271_device::write)); map(vgmplay_device::A_YMZ280B, vgmplay_device::A_YMZ280B+0x1).w(m_ymz280b, FUNC(ymz280b_device::write)); map(vgmplay_device::A_YM2608, vgmplay_device::A_YM2608+0x3).w(m_ym2608, FUNC(ym2608_device::write)); + map(vgmplay_device::A_YM2610, vgmplay_device::A_YM2610+0x3).w(m_ym2610, FUNC(ym2610_device::write)); map(vgmplay_device::A_K054539A, vgmplay_device::A_K054539A+0x22f).w("k054539a", FUNC(k054539_device::write)); map(vgmplay_device::A_K054539B, vgmplay_device::A_K054539B+0x22f).w("k054539b", FUNC(k054539_device::write)); map(vgmplay_device::A_QSOUND, vgmplay_device::A_QSOUND+0x2).w(m_qsound, FUNC(qsound_device::qsound_w)); @@ -2094,6 +2111,12 @@ MACHINE_CONFIG_START(vgmplay_state::vgmplay) MCFG_SOUND_ROUTE(1, "lspeaker", 0.50) MCFG_SOUND_ROUTE(2, "rspeaker", 0.50) + MCFG_DEVICE_ADD("ym2610", YM2610, 0) + MCFG_SOUND_ROUTE(0, "lspeaker", 0.25) + MCFG_SOUND_ROUTE(0, "rspeaker", 0.25) + MCFG_SOUND_ROUTE(1, "lspeaker", 0.50) + MCFG_SOUND_ROUTE(2, "rspeaker", 0.50) + MCFG_DEVICE_ADD("k054539a", K054539, 0) MCFG_DEVICE_ADDRESS_MAP(0, k054539a_map) MCFG_SOUND_ROUTE(0, "lspeaker", 1) @@ -2136,6 +2159,7 @@ MACHINE_CONFIG_END ROM_START( vgmplay ) ROM_REGION( 0x80000, "ym2608", ROMREGION_ERASE00 ) + ROM_REGION( 0x80000, "ym2610", ROMREGION_ERASE00 ) ROM_END CONS( 2016, vgmplay, 0, 0, vgmplay, vgmplay, vgmplay_state, empty_init, "MAME", "VGM player", MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mame/layout/vgmplay.lay b/src/mame/layout/vgmplay.lay index 30efd5be8c9..c9e062853c9 100644 --- a/src/mame/layout/vgmplay.lay +++ b/src/mame/layout/vgmplay.lay @@ -29,6 +29,7 @@ 24: RF5C68 25: RF5C164 26: X1-010 + 27: YM2610 --> @@ -65,6 +66,7 @@ + @@ -126,6 +128,7 @@ + @@ -157,6 +160,7 @@ + -- cgit v1.2.3 From 688ee5064609cfc06ffc66e587e36827ed0fb432 Mon Sep 17 00:00:00 2001 From: AJR Date: Fri, 27 Jul 2018 21:10:44 -0400 Subject: notetaker: Add UART interrupts (nw) --- src/mame/drivers/notetaker.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/mame/drivers/notetaker.cpp b/src/mame/drivers/notetaker.cpp index fea32461bd9..34a0ba61357 100644 --- a/src/mame/drivers/notetaker.cpp +++ b/src/mame/drivers/notetaker.cpp @@ -846,13 +846,15 @@ MACHINE_CONFIG_START(notetaker_state::notetakr) MCFG_TMS9927_VSYN_CALLBACK(WRITELINE("iop_pic8259", pic8259_device, ir4_w)) // note this triggers interrupts on both the iop (ir7) and emulatorcpu (ir4) MCFG_VIDEO_SET_SCREEN("screen") - MCFG_DEVICE_ADD( "kbduart", AY31015, 0 ) // HD6402, == AY-3-1015D - MCFG_AY31015_RX_CLOCK(960_kHz_XTAL) // hard-wired to 960KHz xtal #f11 (60000 baud, 16 clocks per baud) - MCFG_AY31015_TX_CLOCK(960_kHz_XTAL) // hard-wired to 960KHz xtal #f11 (60000 baud, 16 clocks per baud) - - MCFG_DEVICE_ADD( "eiauart", AY31015, 0 ) // HD6402, == AY-3-1015D - MCFG_AY31015_RX_CLOCK(((960_kHz_XTAL/10)/4)/5) // hard-wired through an mc14568b divider set to divide by 4, the result set to divide by 5; this resulting 4800hz signal being 300 baud (16 clocks per baud) - MCFG_AY31015_TX_CLOCK(((960_kHz_XTAL/10)/4)/5) // hard-wired through an mc14568b divider set to divide by 4, the result set to divide by 5; this resulting 4800hz signal being 300 baud (16 clocks per baud) + AY31015(config, m_kbduart, 0); // HD6402, == AY-3-1015D + m_kbduart->set_rx_clock(960_kHz_XTAL); // hard-wired to 960KHz xtal #f11 (60000 baud, 16 clocks per baud) + m_kbduart->set_tx_clock(960_kHz_XTAL); // hard-wired to 960KHz xtal #f11 (60000 baud, 16 clocks per baud) + m_kbduart->write_dav_callback().set("iop_pic8259", FUNC(pic8259_device::ir6_w)); // DataRecvd = KbdInt + + AY31015(config, m_eiauart, 0); // HD6402, == AY-3-1015D + m_eiauart->set_rx_clock(((960_kHz_XTAL/10)/4)/5); // hard-wired through an mc14568b divider set to divide by 4, the result set to divide by 5; this resulting 4800hz signal being 300 baud (16 clocks per baud) + m_eiauart->set_tx_clock(((960_kHz_XTAL/10)/4)/5); // hard-wired through an mc14568b divider set to divide by 4, the result set to divide by 5; this resulting 4800hz signal being 300 baud (16 clocks per baud) + m_eiauart->write_dav_callback().set("iop_pic8259", FUNC(pic8259_device::ir3_w)); // EIADataReady = EIAInt /* Floppy */ MCFG_DEVICE_ADD("wd1791", FD1791, (((24_MHz_XTAL/3)/2)/2)) // 2mhz, from 24mhz ip clock divided by 6 via 8284, an additional 2 by LS161 at #e1 on display/floppy board -- cgit v1.2.3 From c72d28ba0c37ad31719c258787114afcda6404f4 Mon Sep 17 00:00:00 2001 From: AJR Date: Fri, 27 Jul 2018 22:03:35 -0400 Subject: osbexec.cpp: Miscellaneous updates (nw) - Even better hookup for modem RS232 port (including transmission clocks) - Use ripple counter device for "RTC" and blink timer - More object finder arrays and devcb3 usage --- src/devices/machine/ripple_counter.h | 2 +- src/mame/drivers/osbexec.cpp | 138 +++++++++++++++-------------------- 2 files changed, 58 insertions(+), 82 deletions(-) diff --git a/src/devices/machine/ripple_counter.h b/src/devices/machine/ripple_counter.h index c322b4fa718..e61c1ec5ef8 100644 --- a/src/devices/machine/ripple_counter.h +++ b/src/devices/machine/ripple_counter.h @@ -34,7 +34,7 @@ class ripple_counter_device : public device_t, public device_rom_interface { public: // construction/destruction - ripple_counter_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + ripple_counter_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0); // configuration void set_stages(u8 stages) { m_count_mask = (1U << stages) - 1; set_rom_addr_width(stages); } diff --git a/src/mame/drivers/osbexec.cpp b/src/mame/drivers/osbexec.cpp index 9b19456acf1..0b608a602e6 100644 --- a/src/mame/drivers/osbexec.cpp +++ b/src/mame/drivers/osbexec.cpp @@ -15,6 +15,7 @@ #include "machine/input_merger.h" #include "machine/pit8253.h" #include "machine/ram.h" +#include "machine/ripple_counter.h" #include "machine/wd_fdc.h" #include "machine/z80sio.h" #include "sound/spkrdev.h" @@ -40,12 +41,12 @@ public: , m_screen(*this, "screen") , m_mb8877(*this, "mb8877") , m_messram( *this, RAM_TAG) - , m_pia_0(*this, "pia_0") - , m_pia_1(*this, "pia_1") + , m_pia(*this, "pia_%u", 0U) + , m_rtc(*this, "rtc") , m_sio(*this, "sio") , m_speaker(*this, "speaker") - , m_floppy0(*this, "mb8877:0:525ssdd") - , m_floppy1(*this, "mb8877:1:525ssdd") + , m_floppy(*this, "mb8877:%u:525ssdd", 0U) + , m_kbd_row(*this, "ROW%u", 0U) { } void osbexec(machine_config &config); @@ -57,12 +58,12 @@ private: required_device m_screen; required_device m_mb8877; required_device m_messram; - required_device m_pia_0; - required_device m_pia_1; + required_device_array m_pia; + required_device m_rtc; required_device m_sio; required_device m_speaker; - required_device m_floppy0; - required_device m_floppy1; + required_device_array m_floppy; + required_ioport_array<8> m_kbd_row; virtual void video_start() override; @@ -86,9 +87,6 @@ private: /* PIA 1 (UD8) */ - /* Vblank counter ("RTC") */ - uint8_t m_rtc; - void set_banks() { uint8_t *ram_ptr = m_messram->pointer(); @@ -181,29 +179,9 @@ READ8_MEMBER(osbexec_state::osbexec_kbd_r) { uint8_t data = 0xFF; - if ( offset & 0x0100 ) - data &= ioport( "ROW0" )->read(); - - if ( offset & 0x0200 ) - data &= ioport( "ROW1" )->read(); - - if ( offset & 0x0400 ) - data &= ioport( "ROW2" )->read(); - - if ( offset & 0x0800 ) - data &= ioport( "ROW3" )->read(); - - if ( offset & 0x1000 ) - data &= ioport( "ROW4" )->read(); - - if ( offset & 0x2000 ) - data &= ioport( "ROW5" )->read(); - - if ( offset & 0x4000 ) - data &= ioport( "ROW6" )->read(); - - if ( offset & 0x8000 ) - data &= ioport( "ROW7" )->read(); + for (int j = 0; j < 8; j++) + if (BIT(offset, j + 8)) + data &= m_kbd_row[j]->read(); return data; } @@ -211,7 +189,8 @@ READ8_MEMBER(osbexec_state::osbexec_kbd_r) READ8_MEMBER(osbexec_state::osbexec_rtc_r) { - return m_rtc; + // 74LS244 buffer @ UF13 + return m_rtc->count(); } @@ -229,11 +208,11 @@ void osbexec_state::osbexec_mem(address_map &map) void osbexec_state::osbexec_io(address_map &map) { map.unmap_value_high(); - map(0x00, 0x03).mirror(0xff00).rw(m_pia_0, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); /* 6821 PIA @ UD12 */ + map(0x00, 0x03).mirror(0xff00).rw(m_pia[0], FUNC(pia6821_device::read), FUNC(pia6821_device::write)); /* 6821 PIA @ UD12 */ map(0x04, 0x07).mirror(0xff00).rw("ctc", FUNC(pit8253_device::read), FUNC(pit8253_device::write)); /* 8253 @UD1 */ map(0x08, 0x0B).mirror(0xff00).rw(m_mb8877, FUNC(wd_fdc_device_base::read), FUNC(wd_fdc_device_base::write)); /* MB8877 @ UB17 input clock = 1MHz */ map(0x0C, 0x0F).mirror(0xff00).rw(m_sio, FUNC(z80sio_device::ba_cd_r), FUNC(z80sio_device::ba_cd_w)); /* SIO @ UD4 */ - map(0x10, 0x13).mirror(0xff00).rw(m_pia_1, FUNC(pia6821_device::read), FUNC(pia6821_device::write)); /* 6821 PIA @ UD8 */ + map(0x10, 0x13).mirror(0xff00).rw(m_pia[1], FUNC(pia6821_device::read), FUNC(pia6821_device::write)); /* 6821 PIA @ UD8 */ map(0x14, 0x17).select(0xff00).r(FUNC(osbexec_state::osbexec_kbd_r)); /* KBD */ map(0x18, 0x1b).mirror(0xff00).r(FUNC(osbexec_state::osbexec_rtc_r)); /* "RTC" @ UE13/UF13 */ /* ?? - vid ? */ @@ -395,12 +374,12 @@ WRITE8_MEMBER(osbexec_state::osbexec_pia0_b_w) switch ( data & 0x06 ) { case 0x02: - m_mb8877->set_floppy(m_floppy1); - m_floppy1->mon_w(0); + m_mb8877->set_floppy(m_floppy[1].target()); + m_floppy[1]->mon_w(0); break; case 0x04: - m_mb8877->set_floppy(m_floppy0); - m_floppy0->mon_w(0); + m_mb8877->set_floppy(m_floppy[0].target()); + m_floppy[0]->mon_w(0); break; default: m_mb8877->set_floppy(nullptr); @@ -426,40 +405,41 @@ WRITE_LINE_MEMBER(osbexec_state::osbexec_pia0_cb2_w) WRITE_LINE_MEMBER(osbexec_state::modem_txclk_w) { if (BIT(m_pia0_portb, 5)) - m_sio->txca_w(!state); + m_sio->txca_w(state); } WRITE_LINE_MEMBER(osbexec_state::modem_rxclk_w) { if (BIT(m_pia0_portb, 4)) - m_sio->rxca_w(!state); + m_sio->rxca_w(state); } WRITE_LINE_MEMBER(osbexec_state::modem_dsr_w) { - m_pia0_portb &= 0xbf; - if (!state) + if (state) m_pia0_portb |= 0x40; + else + m_pia0_portb &= 0xbf; } WRITE_LINE_MEMBER(osbexec_state::modem_ri_w) { - m_pia0_portb &= 0x7f; - if (!state) + if (state) m_pia0_portb |= 0x80; + else + m_pia0_portb &= 0x7f; } WRITE_LINE_MEMBER(osbexec_state::comm_clk_a_w) { - //if (!BIT(m_pia0_portb, 5)) + if (!BIT(m_pia0_portb, 5)) m_sio->txca_w(state); - //if (!BIT(m_pia0_portb, 4)) + if (!BIT(m_pia0_portb, 4)) m_sio->rxca_w(state); - //m_modem->txclk_w(!state); } @@ -483,18 +463,6 @@ TIMER_CALLBACK_MEMBER(osbexec_state::osbexec_video_callback) { int y = m_screen->vpos(); - /* Start of frame */ - if ( y == 0 ) - { - /* Clear CB1 on PIA @ UD12 */ - m_pia_0->cb1_w(0); - } - else if ( y == 240 ) - { - /* Set CB1 on PIA @ UD12 */ - m_pia_0->cb1_w(1); - m_rtc++; - } if ( y < 240 ) { uint16_t row_addr = ( y / 10 ) * 128; @@ -509,15 +477,15 @@ TIMER_CALLBACK_MEMBER(osbexec_state::osbexec_video_callback) uint8_t font_bits = m_fontram[ ( ( attr & 0x10 ) ? 0x800 : 0 ) + ( ch & 0x7f ) * 16 + char_line ]; /* Check for underline */ - if ( ( attr & 0x40 ) && char_line == 9 ) + if (BIT(attr, 6) && char_line == 9) font_bits = 0xFF; /* Check for blink */ - if ( ( attr & 0x20 ) && ( m_rtc & 0x10 ) ) + if (BIT(attr, 5) && BIT(m_rtc->count(), 4)) font_bits = 0; /* Check for inverse video */ - if ( ( ch & 0x80 ) && ! ( attr & 0x10 ) ) + if (BIT(ch, 7) && !BIT(attr, 4)) font_bits ^= 0xFF; for ( int b = 0; b < 8; b++ ) @@ -555,8 +523,6 @@ void osbexec_state::machine_reset() m_video_timer->adjust( m_screen->time_until_pos( 0, 0 ) ); - m_rtc = 0; - // D0 cleared on interrupt acknowledge cycle by TTL gates at UC21 and UA18 m_maincpu->set_input_line_vector(0, 0xfe); } @@ -575,17 +541,21 @@ MACHINE_CONFIG_START(osbexec_state::osbexec) MCFG_DEVICE_IO_MAP(osbexec_io) MCFG_Z80_DAISY_CHAIN(osbexec_daisy_config) - MCFG_SCREEN_ADD_MONOCHROME(m_screen, RASTER, rgb_t::green()) - MCFG_SCREEN_UPDATE_DRIVER(osbexec_state, screen_update) - MCFG_SCREEN_RAW_PARAMS(MAIN_CLOCK/2, 768, 0, 640, 260, 0, 240) /* May not be correct */ - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_color(rgb_t::green()); + m_screen->set_screen_update(FUNC(osbexec_state::screen_update)); + m_screen->set_raw(MAIN_CLOCK/2, 768, 0, 640, 260, 0, 240); /* May not be correct */ + m_screen->set_palette("palette"); + m_screen->screen_vblank().set(m_pia[0], FUNC(pia6821_device::cb1_w)); + m_screen->screen_vblank().append(m_rtc, FUNC(ripple_counter_device::clock_w)).invert(); + MCFG_PALETTE_ADD_MONOCHROME_HIGHLIGHT("palette") SPEAKER(config, "mono").front_center(); MCFG_DEVICE_ADD(m_speaker, SPEAKER_SOUND) MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) - MCFG_DEVICE_ADD(m_pia_0, PIA6821, 0) + MCFG_DEVICE_ADD(m_pia[0], PIA6821, 0) MCFG_PIA_READPA_HANDLER(READ8(*this, osbexec_state, osbexec_pia0_a_r)) MCFG_PIA_READPB_HANDLER(READ8(*this, osbexec_state, osbexec_pia0_b_r)) MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, osbexec_state, osbexec_pia0_a_w)) @@ -595,12 +565,15 @@ MACHINE_CONFIG_START(osbexec_state::osbexec) MCFG_PIA_IRQA_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<0>)) MCFG_PIA_IRQB_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<1>)) - MCFG_DEVICE_ADD(m_pia_1, PIA6821, 0) + MCFG_DEVICE_ADD(m_pia[1], PIA6821, 0) MCFG_PIA_IRQA_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<2>)) MCFG_PIA_IRQB_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<3>)) INPUT_MERGER_ANY_HIGH(config, "mainirq").output_handler().set_inputline(m_maincpu, 0); + RIPPLE_COUNTER(config, m_rtc); // 74LS393 @ UE13 + m_rtc->set_stages(8); // two halves cascaded + Z80SIO(config, m_sio, MAIN_CLOCK/6); m_sio->out_txda_callback().set(MODEM_PORT_TAG, FUNC(rs232_port_device::write_txd)); m_sio->out_dtra_callback().set(MODEM_PORT_TAG, FUNC(rs232_port_device::write_dtr)); @@ -610,13 +583,14 @@ MACHINE_CONFIG_START(osbexec_state::osbexec) m_sio->out_rtsb_callback().set(PRINTER_PORT_TAG, FUNC(rs232_port_device::write_rts)); m_sio->out_int_callback().set("mainirq", FUNC(input_merger_device::in_w<4>)); - MCFG_DEVICE_ADD("ctc", PIT8253, 0) - MCFG_PIT8253_CLK0(MAIN_CLOCK / 13) // divided by 74S161 @ UC25 - MCFG_PIT8253_CLK1(MAIN_CLOCK / 13) // divided by 74S161 @ UC25 - MCFG_PIT8253_CLK2(MAIN_CLOCK / 12) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, osbexec_state, comm_clk_a_w)) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(m_sio, z80sio_device, rxtxcb_w)) - //MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, osbexec_state, spindle_clk_w)) + pit8253_device &ctc(PIT8253(config, "ctc", 0)); + ctc.set_clk<0>(MAIN_CLOCK / 13); // divided by 74S161 @ UC25 + ctc.set_clk<1>(MAIN_CLOCK / 13); // divided by 74S161 @ UC25 + ctc.set_clk<2>(MAIN_CLOCK / 12); + ctc.out_handler<0>().set(FUNC(osbexec_state::comm_clk_a_w)); + ctc.out_handler<0>().append(MODEM_PORT_TAG, FUNC(rs232_port_device::write_etc)); + ctc.out_handler<1>().set(m_sio, FUNC(z80sio_device::rxtxcb_w)); + //ctc.out_handler<2>().set(FUNC(osbexec_state::spindle_clk_w)); rs232_port_device &modem_port(RS232_PORT(config, MODEM_PORT_TAG, default_rs232_devices, nullptr)); modem_port.rxd_handler().set(m_sio, FUNC(z80sio_device::rxa_w)); @@ -624,6 +598,8 @@ MACHINE_CONFIG_START(osbexec_state::osbexec) modem_port.dsr_handler().set(FUNC(osbexec_state::modem_dsr_w)); modem_port.ri_handler().set(FUNC(osbexec_state::modem_ri_w)); modem_port.cts_handler().set(m_sio, FUNC(z80sio_device::ctsa_w)); + modem_port.txc_handler().set(FUNC(osbexec_state::modem_txclk_w)); + modem_port.rxc_handler().set(FUNC(osbexec_state::modem_rxclk_w)); rs232_port_device &printer_port(RS232_PORT(config, PRINTER_PORT_TAG, default_rs232_devices, nullptr)); printer_port.rxd_handler().set(m_sio, FUNC(z80sio_device::rxb_w)); @@ -631,7 +607,7 @@ MACHINE_CONFIG_START(osbexec_state::osbexec) printer_port.cts_handler().set(m_sio, FUNC(z80sio_device::ctsb_w)); MCFG_DEVICE_ADD("mb8877", MB8877, MAIN_CLOCK/24) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(m_pia_1, pia6821_device, cb1_w)) + MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(m_pia[1], pia6821_device, cb1_w)) MCFG_FLOPPY_DRIVE_ADD("mb8877:0", osborne2_floppies, "525ssdd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("mb8877:1", osborne2_floppies, "525ssdd", floppy_image_device::default_floppy_formats) -- cgit v1.2.3 From f2a59faed6cf393293b98440cd78cd3e15127679 Mon Sep 17 00:00:00 2001 From: cam900 Date: Sat, 28 Jul 2018 11:10:19 +0900 Subject: ymf262.cpp : Add device_clock_changed ymz278b.cpp : Add device_post_load for FM part, Add device_clock_changed --- src/devices/sound/262intf.cpp | 11 +++++++++++ src/devices/sound/262intf.h | 1 + src/devices/sound/ymf262.cpp | 20 +++++++++++++++----- src/devices/sound/ymf262.h | 1 + src/devices/sound/ymf278b.cpp | 19 +++++++++++++++++++ src/devices/sound/ymf278b.h | 2 ++ 6 files changed, 49 insertions(+), 5 deletions(-) diff --git a/src/devices/sound/262intf.cpp b/src/devices/sound/262intf.cpp index c4da329ecff..905d9afd8b6 100644 --- a/src/devices/sound/262intf.cpp +++ b/src/devices/sound/262intf.cpp @@ -109,6 +109,17 @@ void ymf262_device::device_reset() ymf262_reset_chip(m_chip); } +//------------------------------------------------- +// device_clock_changed - called if the clock +// changes +//------------------------------------------------- + +void ymf262_device::device_clock_changed() +{ + int rate = clock()/288; + ymf262_clock_changed(m_chip,clock(),rate); + m_stream->set_sample_rate(rate); +} READ8_MEMBER( ymf262_device::read ) { diff --git a/src/devices/sound/262intf.h b/src/devices/sound/262intf.h index 9f1575ccb01..cefaebd814c 100644 --- a/src/devices/sound/262intf.h +++ b/src/devices/sound/262intf.h @@ -26,6 +26,7 @@ protected: virtual void device_start() override; virtual void device_stop() override; virtual void device_reset() override; + virtual void device_clock_changed() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; diff --git a/src/devices/sound/ymf262.cpp b/src/devices/sound/ymf262.cpp index f69c15da9d4..666e377d5a8 100644 --- a/src/devices/sound/ymf262.cpp +++ b/src/devices/sound/ymf262.cpp @@ -1401,6 +1401,15 @@ static void OPL3_initalize(OPL3 *chip) } +static void OPL3_clock_changed(OPL3 *chip, int clock, int rate) +{ + chip->clock = clock; + chip->rate = rate; + + /* init global tables */ + OPL3_initalize(chip); +} + static inline void FM_KEYON(OPL3_SLOT *SLOT, uint32_t key_set) { if( !SLOT->key ) @@ -2360,11 +2369,7 @@ static OPL3 *OPL3Create(device_t *device, int clock, int rate, int type) chip->device = device; chip->type = type; - chip->clock = clock; - chip->rate = rate; - - /* init global tables */ - OPL3_initalize(chip); + OPL3_clock_changed(chip, clock, rate); /* reset chip */ OPL3ResetChip(chip); @@ -2531,6 +2536,11 @@ void * ymf262_init(device_t *device, int clock, int rate) return chip; } +void ymf262_clock_changed(void *chip, int clock, int rate) +{ + OPL3_clock_changed((OPL3 *)chip, clock, rate); +} + void ymf262_post_load(void *chip) { OPL3 *opl3 = (OPL3 *)chip; for (int ch=0; ch<18; ch++) { diff --git a/src/devices/sound/ymf262.h b/src/devices/sound/ymf262.h index b82a89b9724..bd1eed7cbe7 100644 --- a/src/devices/sound/ymf262.h +++ b/src/devices/sound/ymf262.h @@ -24,6 +24,7 @@ typedef void (*OPL3_UPDATEHANDLER)(device_t *device,int min_interval_us); void *ymf262_init(device_t *device, int clock, int rate); +void ymf262_clock_changed(void *chip, int clock, int rate); void ymf262_post_load(void *chip); void ymf262_shutdown(void *chip); void ymf262_reset_chip(void *chip); diff --git a/src/devices/sound/ymf278b.cpp b/src/devices/sound/ymf278b.cpp index d44f8cdaf00..e0e0dae40d2 100644 --- a/src/devices/sound/ymf278b.cpp +++ b/src/devices/sound/ymf278b.cpp @@ -777,6 +777,14 @@ READ8_MEMBER( ymf278b_device::read ) /**************************************************************************/ +//------------------------------------------------- +// device_post_load - device-specific post load +//------------------------------------------------- +void ymf278b_device::device_post_load() +{ + ymf262_post_load(m_ymf262); +} + //------------------------------------------------- // device_reset - device-specific reset //------------------------------------------------- @@ -841,6 +849,17 @@ void ymf278b_device::device_stop() m_ymf262 = nullptr; } +void ymf278b_device::device_clock_changed() +{ + m_stream->set_sample_rate(clock()/768); + + // YMF262 related + + int ymf262_clock = clock() / (19/8.0); + ymf262_clock_changed(m_ymf262, ymf262_clock, ymf262_clock / 288); + m_stream_ymf262->set_sample_rate(ymf262_clock / 288); +} + void ymf278b_device::rom_bank_updated() { m_stream->update(); diff --git a/src/devices/sound/ymf278b.h b/src/devices/sound/ymf278b.h index 39456acfbe1..7b12ae322f9 100644 --- a/src/devices/sound/ymf278b.h +++ b/src/devices/sound/ymf278b.h @@ -24,9 +24,11 @@ public: protected: // device-level overrides + virtual void device_post_load() override; virtual void device_start() override; virtual void device_reset() override; virtual void device_stop() override; + virtual void device_clock_changed() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; -- cgit v1.2.3 From b9190bee99f1a7bc3ff5a0ff7c3a23fbf76a8c72 Mon Sep 17 00:00:00 2001 From: cam900 Date: Sat, 28 Jul 2018 12:43:01 +0900 Subject: virtual.lua : Add YM2610 compile --- scripts/target/mame/virtual.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/target/mame/virtual.lua b/scripts/target/mame/virtual.lua index 8407fe9df9e..0ea38d385f3 100644 --- a/scripts/target/mame/virtual.lua +++ b/scripts/target/mame/virtual.lua @@ -46,6 +46,7 @@ SOUNDS["YM2151"] = true SOUNDS["YM2203"] = true SOUNDS["YM2413"] = true SOUNDS["YM2608"] = true +SOUNDS["YM2610"] = true SOUNDS["YM2612"] = true SOUNDS["YM3526"] = true SOUNDS["YM3812"] = true -- cgit v1.2.3 From 952bdf962a554ffab077a79d8b4429e451b4a82d Mon Sep 17 00:00:00 2001 From: AJR Date: Fri, 27 Jul 2018 23:42:59 -0400 Subject: imd_dsk.cpp: Add some sanity checking on geometry --- src/lib/formats/imd_dsk.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/lib/formats/imd_dsk.cpp b/src/lib/formats/imd_dsk.cpp index 8476da6ac38..51337a7f890 100644 --- a/src/lib/formats/imd_dsk.cpp +++ b/src/lib/formats/imd_dsk.cpp @@ -433,6 +433,9 @@ bool imd_format::load(io_generic *io, uint32_t form_factor, floppy_image *image) if(pos >= size) return false; + int tracks, heads; + image->get_maximal_geometry(tracks, heads); + while(pos < size) { uint8_t mode = img[pos++]; uint8_t track = img[pos++]; @@ -440,8 +443,23 @@ bool imd_format::load(io_generic *io, uint32_t form_factor, floppy_image *image) uint8_t sector_count = img[pos++]; uint8_t ssize = img[pos++]; + if(track >= tracks) + { + osd_printf_error("imd_format: Track %d exceeds maximum of %d\n", track, tracks); + return false; + } + + if((head & 0x3f) >= heads) + { + osd_printf_error("imd_format: Head %d exceeds maximum of %d\n", head & 0x3f, heads); + return false; + } + if(ssize == 0xff) - throw emu_fatalerror("imd_format: Unsupported variable sector size on track %d head %d", track, head); + { + osd_printf_error("imd_format: Unsupported variable sector size on track %d head %d", track, head & 0x3f); + return false; + } uint32_t actual_size = ssize < 7 ? 128 << ssize : 8192; -- cgit v1.2.3 From 31aaae7491ea4233de75456af178054e650f4344 Mon Sep 17 00:00:00 2001 From: arbee Date: Fri, 27 Jul 2018 23:53:38 -0400 Subject: New machines promoted to WORKING - Apple IIc Plus [R. Belmont, M. Guidero, Leon Bottou] Only the first 3.5" drive works right now and there are no 5.25" drives and no accelerator yet. --- src/devices/machine/applefdc.h | 3 +- src/mame/drivers/apple2e.cpp | 187 +++++++++++++++++++++++++++++++++-------- 2 files changed, 152 insertions(+), 38 deletions(-) diff --git a/src/devices/machine/applefdc.h b/src/devices/machine/applefdc.h index 0190b57e4e6..3e70a8630ab 100644 --- a/src/devices/machine/applefdc.h +++ b/src/devices/machine/applefdc.h @@ -72,6 +72,8 @@ public: // accessor uint8_t get_lines(); + virtual void device_reset() override; + protected: enum applefdc_t { @@ -85,7 +87,6 @@ protected: // device-level overrides virtual void device_start() override; - virtual void device_reset() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; // other protecteds diff --git a/src/mame/drivers/apple2e.cpp b/src/mame/drivers/apple2e.cpp index d485237893b..6dec2fa1d70 100644 --- a/src/mame/drivers/apple2e.cpp +++ b/src/mame/drivers/apple2e.cpp @@ -171,7 +171,7 @@ Address bus A0-A11 is Y0-Y11 #define A2_UPPERBANK_TAG "inhbank" #define IIC_ACIA1_TAG "acia1" #define IIC_ACIA2_TAG "acia2" -#define IICP_IWM_TAG "iwm" +#define IICP_IWM_TAG "fdc" #define LASER128_UDC_TAG "l128udc" #define PRINTER_PORT_TAG "printer" #define MODEM_PORT_TAG "modem" @@ -393,6 +393,9 @@ public: void r2000bank_map(address_map &map); void r4000bank_map(address_map &map); void spectred_keyb_map(address_map &map); + + bool m_35sel, m_hdsel, m_intdrive; + private: int m_speaker_state; int m_cassette_state, m_cassette_out; @@ -435,6 +438,9 @@ private: uint8_t m_migram[0x800]; uint16_t m_migpage; + bool m_zipunlocked; + int m_zipstage; + uint8_t *m_ram_ptr, *m_rom_ptr, *m_cec_ptr; int m_ram_size; @@ -486,21 +492,36 @@ private: uint8_t apple2e_state::mig_r(uint16_t offset) { + //printf("mig_r @ %x\n", offset + 0xc00); // MIG RAM window - if (offset < 0x20) + if ((offset >= 0x200) && (offset < 0x220)) { return m_migram[m_migpage + offset]; } - // increment MIG RAM window - if (offset == 0x20) + // increment MIG RAM window and return previous value + if ((offset >= 0x220) && (offset < 0x240)) { + uint8_t rv = m_migram[m_migpage + offset]; m_migpage += 0x20; - m_migpage &= 0x7ff; // make sure we wrap + m_migpage &= 0x7ff; + return rv; + } + + if ((offset >= 0x240) && (offset < 0x260)) + { + m_hdsel = false; + sony_set_sel_line(m_iicpiwm, 0); + } + + if ((offset >= 0x260) && (offset < 0x280)) + { + m_hdsel = true; + sony_set_sel_line(m_iicpiwm, 0x80); } // reset MIG RAM window - if (offset == 0xa0) + if (offset == 0x2a0) { m_migpage = 0; } @@ -510,22 +531,58 @@ uint8_t apple2e_state::mig_r(uint16_t offset) void apple2e_state::mig_w(uint16_t offset, uint8_t data) { + //printf("mig_w %x @ %x\n", data, offset + 0xc00); + + if (offset == 0x40) + { + m_iicpiwm->device_reset(); + return; + } + + if ((offset >= 0x80) && (offset < 0xa0)) + { + //printf("MIG: enable internal drive on d2\n"); + m_intdrive = true; + return; + } + + if ((offset >= 0xc0) && (offset < 0xe0)) + { + //printf("MIG: disable internal drive\n"); + m_intdrive = false; + return; + } + // MIG RAM window - if (offset < 0x20) + if ((offset >= 0x200) && (offset < 0x220)) { m_migram[m_migpage + offset] = data; return; } - // increment MIG RAM window - if (offset == 0x20) + // increment MIG RAM window, but write value at old location first + if ((offset >= 0x220) && (offset < 0x240)) { + m_migram[m_migpage + offset] = data; m_migpage += 0x20; m_migpage &= 0x7ff; // make sure we wrap + return; + } + + if ((offset >= 0x240) && (offset < 0x260)) + { + m_35sel = false; + return; + } + + if ((offset >= 0x260) && (offset < 0x280)) + { + m_35sel = true; + return; } // reset MIG RAM window - if (offset == 0xa0) + if (offset == 0x2a0) { m_migpage = 0; } @@ -853,6 +910,11 @@ void apple2e_state::machine_start() save_item(NAME(m_mockingboard4c)); save_item(NAME(m_intc8rom)); save_item(NAME(m_cec_bank)); + save_item(NAME(m_35sel)); + save_item(NAME(m_hdsel)); + save_item(NAME(m_intdrive)); + save_item(NAME(m_zipunlocked)); + save_item(NAME(m_zipstage)); } void apple2e_state::machine_reset() @@ -875,6 +937,8 @@ void apple2e_state::machine_reset() m_mockingboard4c = false; m_intc8rom = false; m_cec_bank = 0; + m_zipunlocked = false; + m_zipstage = 0; // IIe prefers INTCXROM default to off, IIc has it always on if (m_rom_ptr[0x3bc0] == 0x00) @@ -1391,6 +1455,14 @@ void apple2e_state::do_io(address_space &space, int offset, bool is_iic) m_romswitch = !m_romswitch; update_slotrom_banks(); + // MIG is reset when ROMSWITCH turns off + if ((m_isiicplus) && !(m_romswitch)) + { + m_migpage = 0; + m_intdrive = false; + m_35sel = false; + } + // if LC is not enabled if (!m_lcram) { @@ -1986,6 +2058,34 @@ WRITE8_MEMBER(apple2e_state::c000_iic_w) m_strobe = 0; break; + case 0x5a: // IIC+ accelerator unlock + if (m_isiicplus) + { + if (data == 0x5a) + { + m_zipstage++; + if (m_zipstage == 4) + { + m_zipunlocked = true; + } + } + else if (data == 0xa5) + { + // put settings into effect and lock + m_zipunlocked = false; + m_zipstage = 0; + } + else + { + // disable acceleration and lock + m_zipunlocked = false; + m_zipstage = 0; + } + } + break; + + case 0x5b: + case 0x78: case 0x79: m_vbl = false; @@ -2113,6 +2213,11 @@ READ8_MEMBER(apple2e_state::c080_r) } else { + if ((m_isiicplus) && (slot == 6)) + { + return m_iicpiwm->read(offset % 0x10); + } + if (m_slotdevice[slot] != nullptr) { return m_slotdevice[slot]->read_c0nx(offset % 0x10); @@ -2143,6 +2248,12 @@ WRITE8_MEMBER(apple2e_state::c080_w) } else { + if ((m_isiicplus) && (slot == 6)) + { + m_iicpiwm->write(offset % 0x10, data); + return; + } + if (m_slotdevice[slot] != nullptr) { m_slotdevice[slot]->write_c0nx(offset % 0x10, data); @@ -2291,11 +2402,6 @@ READ8_MEMBER(apple2e_state::c400_cec_bank_r) { return m_rom_ptr[0x4400 + offset READ8_MEMBER(apple2e_state::c800_r) { - if ((m_isiicplus) && (m_romswitch) && (offset >= 0x600) && (offset < 0x700)) - { - return mig_r(offset-0x600); - } - if ((offset == 0x7ff) && !machine().side_effects_disabled()) { m_cnxx_slot = CNXX_UNCLAIMED; @@ -2313,11 +2419,6 @@ READ8_MEMBER(apple2e_state::c800_r) READ8_MEMBER(apple2e_state::c800_int_r) { - if ((m_isiicplus) && (m_romswitch) && (offset >= 0x600) && (offset < 0x700)) - { - return mig_r(offset-0x600); - } - if ((offset == 0x7ff) && !machine().side_effects_disabled()) { m_cnxx_slot = CNXX_UNCLAIMED; @@ -2335,9 +2436,9 @@ READ8_MEMBER(apple2e_state::c800_int_r) READ8_MEMBER(apple2e_state::c800_b2_int_r) { - if ((m_isiicplus) && (m_romswitch) && (offset >= 0x600) && (offset < 0x700)) + if ((m_isiicplus) && (m_romswitch) && (((offset >= 0x400) && (offset < 0x500)) || ((offset >= 0x600) && (offset < 0x700)))) { - return mig_r(offset-0x600); + return mig_r(offset-0x400); } if ((offset == 0x7ff) && !machine().side_effects_disabled()) @@ -2352,9 +2453,9 @@ READ8_MEMBER(apple2e_state::c800_b2_int_r) WRITE8_MEMBER(apple2e_state::c800_w) { - if ((m_isiicplus) && (m_romswitch) && (offset >= 0x600) && (offset < 0x700)) + if ((m_isiicplus) && (m_romswitch) && (((offset >= 0x400) && (offset < 0x500)) || ((offset >= 0x600) && (offset < 0x700)))) { - mig_w(offset-0x600, data); + mig_w(offset-0x400, data); return; } @@ -2400,22 +2501,11 @@ WRITE8_MEMBER(apple2e_state::inh_w) READ8_MEMBER(apple2e_state::lc_romswitch_r) { - if ((offset >= 0xc00) && (offset < 0xd00)) - { - return mig_r(offset-0xc00); - } - return m_rom_ptr[0x5000 + offset]; } WRITE8_MEMBER(apple2e_state::lc_romswitch_w) { - if ((offset >= 0xc00) && (offset < 0xd00)) - { - mig_w(offset-0xc00, data); - return; - } - lc_w(space, offset, data); } @@ -4126,10 +4216,26 @@ MACHINE_CONFIG_START(apple2e_state::apple2c) MCFG_RAM_EXTRA_OPTIONS("128K") MACHINE_CONFIG_END +static void apple2cp_set_enable_lines(device_t *device,int enable_mask) +{ + apple2e_state *state = device->machine().driver_data(); + +// printf("set_enable_lines: 35sel %d int %d enable_mask %d\n", state->m_35sel, state->m_intdrive, enable_mask); + + if ((state->m_35sel) && (state->m_intdrive) && (enable_mask == 2)) + { + sony_set_enable_lines(device, 1); + } + else + { + sony_set_enable_lines(device, 0); + } +} + const applefdc_interface a2cp_interface = { sony_set_lines, /* set_lines */ - sony_set_enable_lines, /* set_enable_lines */ + apple2cp_set_enable_lines, /* set_enable_lines */ sony_read_data, /* read_data */ sony_write_data, /* write_data */ @@ -4145,10 +4251,17 @@ static const floppy_interface apple2cp_floppy35_floppy_interface = MACHINE_CONFIG_START(apple2e_state::apple2cp) apple2c(config); + MCFG_DEVICE_REPLACE("maincpu", M65C02, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ + MCFG_DEVICE_PROGRAM_MAP(apple2c_memexp_map) + MCFG_DEVICE_REMOVE("sl4") MCFG_DEVICE_REMOVE("sl6") MCFG_IWM_ADD(IICP_IWM_TAG, a2cp_interface) MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(apple2cp_floppy35_floppy_interface) + + MCFG_RAM_MODIFY(RAM_TAG) + MCFG_RAM_DEFAULT_SIZE("128K") + MCFG_RAM_EXTRA_OPTIONS("128K, 384K, 640K, 896K, 1152K") MACHINE_CONFIG_END MACHINE_CONFIG_START(apple2e_state::apple2c_iwm) @@ -4553,4 +4666,4 @@ COMP( 1985, apple2c0, apple2c, 0, apple2c_iwm, apple2c, apple2e_state, COMP( 1986, apple2c3, apple2c, 0, apple2c_mem, apple2c, apple2e_state, empty_init, "Apple Computer", "Apple //c (Original Memory Expansion)", MACHINE_SUPPORTS_SAVE ) COMP( 1986, apple2c4, apple2c, 0, apple2c_mem, apple2c, apple2e_state, empty_init, "Apple Computer", "Apple //c (rev 4)", MACHINE_SUPPORTS_SAVE ) COMP( 1987, ceci, 0, apple2, ceci, ceci, apple2e_state, empty_init, "Shaanxi Province Computer Factory", "China Education Computer I", MACHINE_SUPPORTS_SAVE ) -COMP( 1988, apple2cp, apple2c, 0, apple2cp, apple2c, apple2e_state, empty_init, "Apple Computer", "Apple //c Plus", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) +COMP( 1988, apple2cp, apple2c, 0, apple2cp, apple2c, apple2e_state, empty_init, "Apple Computer", "Apple //c Plus", MACHINE_SUPPORTS_SAVE ) -- cgit v1.2.3 From c5a244d32cb0dc5cb7e7608b55b3caed4e9c9efa Mon Sep 17 00:00:00 2001 From: AJR Date: Sat, 28 Jul 2018 00:54:52 -0400 Subject: flopimg.h: Add debug asserts to help catch geometry errors (nw) --- src/lib/formats/flopimg.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/formats/flopimg.h b/src/lib/formats/flopimg.h index fe6d8ed35dd..b7f4d542db2 100644 --- a/src/lib/formats/flopimg.h +++ b/src/lib/formats/flopimg.h @@ -735,7 +735,7 @@ public: @param head head number @return a pointer to the data buffer for this track and head */ - std::vector &get_buffer(int track, int head, int subtrack = 0) { return track_array[track*4+subtrack][head].cell_data; } + std::vector &get_buffer(int track, int head, int subtrack = 0) { assert(track < tracks && head < heads); return track_array[track*4+subtrack][head].cell_data; } //! Sets the write splice position. //! The "track splice" information indicates where to start writing @@ -749,9 +749,9 @@ public: @param head @param pos the position */ - void set_write_splice_position(int track, int head, uint32_t pos, int subtrack = 0) { track_array[track*4+subtrack][head].write_splice = pos; } + void set_write_splice_position(int track, int head, uint32_t pos, int subtrack = 0) { assert(track < tracks && head < heads); track_array[track*4+subtrack][head].write_splice = pos; } //! @return the current write splice position. - uint32_t get_write_splice_position(int track, int head, int subtrack = 0) const { return track_array[track*4+subtrack][head].write_splice; } + uint32_t get_write_splice_position(int track, int head, int subtrack = 0) const { assert(track < tracks && head < heads); return track_array[track*4+subtrack][head].write_splice; } //! @return the maximal geometry supported by this format. void get_maximal_geometry(int &tracks, int &heads) const; -- cgit v1.2.3 From a1c39dbf90766ba4905b05100280ce1295e4f956 Mon Sep 17 00:00:00 2001 From: AJR Date: Sat, 28 Jul 2018 00:55:33 -0400 Subject: osbexec: Eliminate bogus memory regions (nw) --- src/mame/drivers/osbexec.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/mame/drivers/osbexec.cpp b/src/mame/drivers/osbexec.cpp index 0b608a602e6..6acb93a6a06 100644 --- a/src/mame/drivers/osbexec.cpp +++ b/src/mame/drivers/osbexec.cpp @@ -71,10 +71,8 @@ private: bitmap_ind16 m_bitmap; - memory_region *m_fontram_region; - memory_region *m_vram_region; - uint8_t *m_fontram; - uint8_t *m_vram; + std::unique_ptr m_fontram; + std::unique_ptr m_vram; uint8_t *m_ram_0000; uint8_t *m_ram_c000; uint8_t m_temp_attr; @@ -110,7 +108,7 @@ private: } if ( m_pia0_porta & 0x40 ) - m_ram_c000 = m_vram_region->base(); + m_ram_c000 = m_vram.get(); } DECLARE_WRITE8_MEMBER(osbexec_0000_w); @@ -502,14 +500,8 @@ TIMER_CALLBACK_MEMBER(osbexec_state::osbexec_video_callback) void osbexec_state::init_osbexec() { - m_fontram_region = machine().memory().region_alloc( "fontram", 0x1000, 1, ENDIANNESS_LITTLE); - m_vram_region = machine().memory().region_alloc( "vram", 0x2000, 1, ENDIANNESS_LITTLE ); - m_vram = m_vram_region->base(); - m_fontram = m_fontram_region->base(); - - - memset( m_fontram, 0x00, 0x1000 ); - memset( m_vram, 0x00, 0x2000 ); + m_vram = make_unique_clear(0x2000); + m_fontram = make_unique_clear(0x1000); m_video_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(osbexec_state::osbexec_video_callback),this)); } -- cgit v1.2.3 From 9164b0c5bd86ce44df4783e6a26173c04dd90202 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sat, 28 Jul 2018 15:03:09 +1000 Subject: ignore SVG dimensions, like we always did (nw) --- src/emu/screen.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/emu/screen.cpp b/src/emu/screen.cpp index a3f762071b2..2ec5b660876 100644 --- a/src/emu/screen.cpp +++ b/src/emu/screen.cpp @@ -722,10 +722,15 @@ void screen_device::device_start() m_svg = std::make_unique(reg); machine().output().set_notifier(nullptr, svg_renderer::output_notifier, m_svg.get()); - // The OSD picks up the size before start is called, so this only affect the info display if it's called up in-game - m_width = m_svg->width(); - m_height = m_svg->height(); - m_visarea.set(0, m_width-1, 0, m_height-1); + // don't do this - SVG units are arbitrary and interpreting them as pixels causes bad things to happen + // just render at the size/aspect ratio supplied by the driver + if (false) + { + // The OSD picks up the size before start is called, so this only affect the info display if it's called up in-game + m_width = m_svg->width(); + m_height = m_svg->height(); + m_visarea.set(0, m_width - 1, 0, m_height - 1); + } } // if we have a palette and it's not started, wait for it -- cgit v1.2.3 From 0e389bf1af2a8a2075924077f5b28c022a6ea513 Mon Sep 17 00:00:00 2001 From: smf- Date: Sat, 28 Jul 2018 06:04:58 +0100 Subject: add device_clock_changed (nw) --- src/devices/sound/qsound.cpp | 8 ++++++++ src/devices/sound/qsound.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/devices/sound/qsound.cpp b/src/devices/sound/qsound.cpp index 197c1f03be7..0c49495427a 100644 --- a/src/devices/sound/qsound.cpp +++ b/src/devices/sound/qsound.cpp @@ -227,6 +227,14 @@ void qsound_device::device_start() save_item(NAME(m_channel)); } +//------------------------------------------------- +// device_clock_changed +//------------------------------------------------- + +void qsound_device::device_clock_changed() +{ + m_stream->set_sample_rate(clock() / 2 / 1248); +} //------------------------------------------------- // device_reset - device-specific reset diff --git a/src/devices/sound/qsound.h b/src/devices/sound/qsound.h index f5be0c106d8..10c6c93c4cb 100644 --- a/src/devices/sound/qsound.h +++ b/src/devices/sound/qsound.h @@ -27,6 +27,7 @@ protected: tiny_rom_entry const *device_rom_region() const override; virtual void device_add_mconfig(machine_config &config) override; virtual void device_start() override; + virtual void device_clock_changed() override; virtual void device_reset() override; // device_sound_interface implementation -- cgit v1.2.3 From 830e6d31f7162204dd44a3a7e9485eec7e9a4264 Mon Sep 17 00:00:00 2001 From: cam900 Date: Sat, 28 Jul 2018 12:51:50 +0900 Subject: y2.cpp : Add notes/Romanization, Fix metadata --- src/mame/drivers/y2.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mame/drivers/y2.cpp b/src/mame/drivers/y2.cpp index c1f78b935c4..a5eafc7a80f 100644 --- a/src/mame/drivers/y2.cpp +++ b/src/mame/drivers/y2.cpp @@ -81,7 +81,7 @@ MACHINE_CONFIG_START(system_board_y2_state::system_board_y2) SPEAKER(config, "mono").front_center(); MACHINE_CONFIG_END -ROM_START( kof2002um ) +ROM_START( kof2002um ) // The King of Fighters 复仇之路/Fùchóu zhī lù/Road to Revenge ROM_REGION( 0x8000000, "boot", 0 ) // sound program only? or boot too? ROM_LOAD( "s29gl01gp11fcr2.u103", 0x0000000, 0x8000000, CRC(722cbad1) SHA1(0292be12255ee4bd586166a3f5cd108c5453295b) ) @@ -104,5 +104,5 @@ ROM_END /* The title screen shows "The King of Fighters - Road to Revenge" (Chinese / English) while the speech on the title screen announcer says "The King of Fighters 2002 Unlimited Match" There is a PS2 version with the Unlimited Match title screen, but unless it's used for a different region the arcade doesn't show that title, only announces it. */ -GAME( 2009, kof2002um, 0, system_board_y2, system_board_y2, system_board_y2_state, empty_init, ROT0, "SNK Playmore / New Channel", "The King of Fighters - Road to Revenge / The King of Fighters 2002 Unlimited Match (China)", MACHINE_IS_SKELETON ) // also Export? -GAME( 2009, kof2002umj, kof2002um, system_board_y2, system_board_y2, system_board_y2_state, empty_init, ROT0, "SNK Playmore / New Channel", "The King of Fighters - Road to Revenge / The King of Fighters 2002 Unlimited Match (Japan)", MACHINE_IS_SKELETON ) +GAME( 2009, kof2002um, 0, system_board_y2, system_board_y2, system_board_y2_state, empty_init, ROT0, "SNK Playmore / New Channel", "The King of Fighters - Fuchou Zhi Lu/Road to Revenge / The King of Fighters 2002 Unlimited Match (China)", MACHINE_IS_SKELETON ) // also Export? +GAME( 2009, kof2002umj, kof2002um, system_board_y2, system_board_y2, system_board_y2_state, empty_init, ROT0, "SNK Playmore", "The King of Fighters 2002 Unlimited Match (Japan)", MACHINE_IS_SKELETON ) -- cgit v1.2.3 From 98100466500e2a794679f14b7817779318b7376f Mon Sep 17 00:00:00 2001 From: David Haywood Date: Sat, 28 Jul 2018 06:13:49 +0100 Subject: tlcs870 - ALU flags, passes internal RAM check (nw) (#3797) * tlcs870 - ALU flags, passes internal RAM check (nw) * interrupt wait loop depends on JF always getting set --- src/devices/cpu/tlcs870/tlcs870.cpp | 5 +- src/devices/cpu/tlcs870/tlcs870.h | 20 +- src/devices/cpu/tlcs870/tlcs870_ops.cpp | 16 +- src/devices/cpu/tlcs870/tlcs870_ops_helper.cpp | 384 +++++++++++++++++++++++-- src/devices/cpu/tlcs870/tlcs870_ops_reg.cpp | 10 +- src/devices/cpu/tlcs870/tlcs870_ops_src.cpp | 6 +- src/mame/drivers/hng64.cpp | 66 +++-- 7 files changed, 451 insertions(+), 56 deletions(-) diff --git a/src/devices/cpu/tlcs870/tlcs870.cpp b/src/devices/cpu/tlcs870/tlcs870.cpp index db201179719..a855697cfb7 100644 --- a/src/devices/cpu/tlcs870/tlcs870.cpp +++ b/src/devices/cpu/tlcs870/tlcs870.cpp @@ -294,8 +294,6 @@ void tlcs870_device::execute_set_input(int inputnum, int state) void tlcs870_device::execute_run() { - - while (m_icount > 0) { m_prvpc.d = m_pc.d; @@ -311,7 +309,8 @@ void tlcs870_device::execute_run() if (m_cycles) { - m_icount -= m_cycles * 4; // 1 machine cycle = 4 clock cycles? + //m_icount -= m_cycles * 4; // 1 machine cycle = 4 clock cycles? (unclear, execution seems far too slow even for the ram test this way) + m_icount -= m_cycles; } else { diff --git a/src/devices/cpu/tlcs870/tlcs870.h b/src/devices/cpu/tlcs870/tlcs870.h index 7b8c8c256be..846cf818961 100644 --- a/src/devices/cpu/tlcs870/tlcs870.h +++ b/src/devices/cpu/tlcs870/tlcs870.h @@ -308,8 +308,6 @@ private: void do_CALL_insrc(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr); void do_JP_insrc(const uint8_t opbyte0, const uint8_t opbyte1, const uint16_t srcaddr); - uint16_t do_alu(int op, uint16_t param1, uint16_t param2); - // tlcs870_ops_dst.cpp void do_dstprefixtype_opcode(const uint8_t opbyte0); @@ -362,10 +360,26 @@ private: void do_CALL_gg(const uint8_t opbyte0, const uint8_t opbyte1); void do_JP_gg(const uint8_t opbyte0, const uint8_t opbyte1); + + // ALU related + uint16_t do_or(uint16_t param1, uint16_t param2); + uint16_t do_xor(uint16_t param1, uint16_t param2); + uint16_t do_and(uint16_t param1, uint16_t param2); + + uint8_t do_add_8bit(uint16_t param1, uint16_t param2); + uint8_t do_sub_8bit(uint16_t param1, uint16_t param2); + void do_cmp_8bit(uint16_t param1, uint16_t param2); + uint8_t do_alu_8bit(int op, uint16_t param1, uint16_t param2); + + uint8_t do_add_16bit(uint32_t param1, uint32_t param2); + uint8_t do_sub_16bit(uint32_t param1, uint32_t param2); + void do_cmp_16bit(uint32_t param1, uint32_t param2); + uint16_t do_alu_16bit(int op, uint32_t param1, uint32_t param2); + + // Generic opcode helpers void handle_div(const int reg); void handle_mul(const int reg); void handle_swap(const int reg); - uint8_t handle_SHLC(uint8_t val); uint8_t handle_SHRC(uint8_t val); uint8_t handle_DAS(uint8_t val); diff --git a/src/devices/cpu/tlcs870/tlcs870_ops.cpp b/src/devices/cpu/tlcs870/tlcs870_ops.cpp index 034d967bca6..2a79879c8fa 100644 --- a/src/devices/cpu/tlcs870/tlcs870_ops.cpp +++ b/src/devices/cpu/tlcs870/tlcs870_ops.cpp @@ -944,8 +944,10 @@ void tlcs870_device::do_JRS_T_a(const uint8_t opbyte0) { m_cycles += 2; m_addr = m_tmppc + 2 + val; - set_JF(); } + + // always gets set? + set_JF(); } void tlcs870_device::do_JRS_F_a(const uint8_t opbyte0) @@ -967,8 +969,10 @@ void tlcs870_device::do_JRS_F_a(const uint8_t opbyte0) { m_cycles += 2; m_addr = m_tmppc + 2 + val; - set_JF(); } + + // manual isn't clear in description, but probably always set? + set_JF(); } void tlcs870_device::do_CALLV_n(const uint8_t opbyte0) @@ -1015,8 +1019,10 @@ void tlcs870_device::do_JR_cc_a(const uint8_t opbyte0) { m_cycles += 2; m_addr = m_tmppc + 2 + val; - set_JF(); } + + // manual isn't clear in description, but probably always set? + set_JF(); } void tlcs870_device::do_LD_CF_inxbit(const uint8_t opbyte0) @@ -1149,7 +1155,7 @@ void tlcs870_device::do_ALUOP_A_n(const uint8_t opbyte0) const int aluop = (opbyte0 & 0x7); const uint8_t val = READ8(); - const uint8_t result = do_alu(aluop, get_reg8(REG_A), val); + const uint8_t result = do_alu_8bit(aluop, get_reg8(REG_A), val); if (aluop != 0x07) // CMP doesn't write back { @@ -1176,7 +1182,7 @@ void tlcs870_device::do_ALUOP_A_inx(const uint8_t opbyte0) const uint16_t addr = READ8(); const uint8_t val = RM8(addr); - const uint8_t result = do_alu(aluop, get_reg8(REG_A), val); + const uint8_t result = do_alu_8bit(aluop, get_reg8(REG_A), val); if (aluop != 0x07) // CMP doesn't write back { diff --git a/src/devices/cpu/tlcs870/tlcs870_ops_helper.cpp b/src/devices/cpu/tlcs870/tlcs870_ops_helper.cpp index e2a11b57661..8f494ba7475 100644 --- a/src/devices/cpu/tlcs870/tlcs870_ops_helper.cpp +++ b/src/devices/cpu/tlcs870/tlcs870_ops_helper.cpp @@ -216,60 +216,404 @@ const bool tlcs870_device::check_jump_condition(int param1) return takejump; } +/* + All 16-bit ALU ops that would set the 'H' flag list the behavior as undefined. + Logically the half flag would be the 8/9 bit carry (usual C flag) in a 16-bit + op, but since this isn't listed as being the case there's a chance the behavior + is something unexpected, such as still using the 3/4 carry, or, if it's + internally handled as 4 4-bit operations, maybe the 12/13 bit carry + + This needs testing on hardware. + + (8-bit) JF ZF CF HF + ADDC C Z C H + ADD C Z C H + SUBB C Z C H + SUB C Z C H + AND Z Z - - + XOR Z Z - - + OR Z Z - - + CMP Z Z C H + + (16-bit) + ADDC C Z C U + ADD C Z C U + SUBB C Z C U + SUB C Z C U + AND Z Z - - + XOR Z Z - - + OR Z Z - - + CMP Z Z C U + +*/ + +uint8_t tlcs870_device::do_add_8bit(uint16_t param1, uint16_t param2) +{ + uint16_t result = param1 + param2; + + if (result & 0x100) + { + set_CF(); + } + else + { + clear_CF(); + } + + if ((result & 0xff) == 0x00) + { + set_ZF(); + } + else + { + clear_ZF(); + } + + uint8_t temp = (param1 & 0xf) + (param2 & 0xf); + + if (temp & 0x10) + { + set_HF(); + } + else + { + clear_HF(); + } + + // JF is copied from CF + is_ZF() ? set_CF() : clear_CF(); + + return result; +} + +uint8_t tlcs870_device::do_add_16bit(uint32_t param1, uint32_t param2) +{ + uint32_t result = param1 + param2; + + if (result & 0x10000) + { + set_CF(); + } + else + { + clear_CF(); + } + + if ((result & 0xffff) == 0x00) + { + set_ZF(); + } + else + { + clear_ZF(); + } + + // unknown, manual says undefined, see note above + uint8_t temp = (param1 & 0xff) + (param2 & 0xff); + + if (temp & 0x100) + { + set_HF(); + } + else + { + clear_HF(); + } + + // JF is copied from CF + is_ZF() ? set_CF() : clear_CF(); + + return result; +} + +uint8_t tlcs870_device::do_sub_8bit(uint16_t param1, uint16_t param2) +{ + uint16_t result = param1 - param2; + + if (param1 < param2) + { + set_CF(); + } + else + { + clear_CF(); + } + + if ((param1 & 0xf) < (param2 & 0xf)) + { + set_HF(); + } + else + { + clear_HF(); + } + + if ((result & 0xff) == 0x00) + { + set_ZF(); + } + else + { + clear_ZF(); + } + + // JF is copied from CF + is_ZF() ? set_CF() : clear_CF(); + + return result; +} + + +uint8_t tlcs870_device::do_sub_16bit(uint32_t param1, uint32_t param2) +{ + uint32_t result = param1 - param2; + + if (param1 < param2) + { + set_CF(); + } + else + { + clear_CF(); + } + + // unknown, manual says undefined, see note above + if ((param1 & 0xff) < (param2 & 0xff)) + { + set_HF(); + } + else + { + clear_HF(); + } + + if ((result & 0xffff) == 0x0000) + { + set_ZF(); + } + else + { + clear_ZF(); + } + + // JF is copied from CF + is_ZF() ? set_CF() : clear_CF(); + + return result; +} + +void tlcs870_device::do_cmp_8bit(uint16_t param1, uint16_t param2) +{ + if (param1 < param2) + { + set_CF(); + } + else + { + clear_CF(); + } + + if ((param1 & 0xf) < (param2 & 0xf)) // see note above about half flag + { + set_HF(); + } + else + { + clear_HF(); + } + + if (param1 == param2) + { + set_ZF(); + } + else + { + clear_ZF(); + } + + // JF is copied from ZF + is_ZF() ? set_JF() : clear_JF(); +} + +void tlcs870_device::do_cmp_16bit(uint32_t param1, uint32_t param2) +{ + if (param1 < param2) + { + set_CF(); + } + else + { + clear_CF(); + } + + // unknown, manual says undefined, see note above + if ((param1 & 0xff) < (param2 & 0xff)) + { + set_HF(); + } + else + { + clear_HF(); + } + + if (param1 == param2) + { + set_ZF(); + } + else + { + clear_ZF(); + } + + // JF is copied from ZF + is_ZF() ? set_JF() : clear_JF(); +} + + +uint16_t tlcs870_device::do_and(uint16_t param1, uint16_t param2) +{ + uint16_t result = param1 & param2; + + if (result == 0x00) + { + set_ZF(); + } + else + { + clear_ZF(); + } + + // JF is copied from ZF + is_ZF() ? set_JF() : clear_JF(); + + return result; +} + +uint16_t tlcs870_device::do_xor(uint16_t param1, uint16_t param2) +{ + uint16_t result = param1 ^ param2; -uint16_t tlcs870_device::do_alu(int op, uint16_t param1, uint16_t param2) + if (result == 0x00) + { + set_ZF(); + } + else + { + clear_ZF(); + } + + // JF is copied from ZF + is_ZF() ? set_JF() : clear_JF(); + + return result; +} + +uint16_t tlcs870_device::do_or(uint16_t param1, uint16_t param2) +{ + uint16_t result = param1 | param2; + + if (result == 0x00) + { + set_ZF(); + } + else + { + clear_ZF(); + } + + // JF is copied from ZF + is_ZF() ? set_JF() : clear_JF(); + + return result; +} + +uint8_t tlcs870_device::do_alu_8bit(int op, uint16_t param1, uint16_t param2) { uint16_t result = 0x00; - // TODO: flags switch (op) { case 0x0: // ADDC - result = param1 + param2; - result += is_CF(); + param2 += is_CF(); + result = do_add_8bit(param1, param2); break; case 0x1: // ADD - result = param1 + param2; + result = do_add_8bit(param1, param2); break; case 0x2: // SUBB - result = param1 - param2; - result -= is_CF(); + param2 += is_CF(); + result = do_sub_8bit(param1, param2); break; case 0x3: // SUB - result = param1 - param2; + result = do_sub_8bit(param1, param2); break; case 0x4: // AND - result = param1 & param2; + result = do_and(param1, param2); break; case 0x5: // XOR - result = param1 ^ param2; + result = do_xor(param1, param2); break; case 0x6: // OR - result = param1 | param2; + result = do_or(param1, param2); break; case 0x7: // CMP - if (param1 < param2) - { - set_CF(); - } - else - { - clear_CF(); - } + do_cmp_8bit(param1, param2); break; - } return result; } +uint16_t tlcs870_device::do_alu_16bit(int op, uint32_t param1, uint32_t param2) +{ + uint32_t result = 0x0000; + + switch (op) + { + case 0x0: // ADDC + param2 += is_CF(); + result = do_add_16bit(param1, param2); + break; + + case 0x1: // ADD + result = do_add_16bit(param1, param2); + break; + + case 0x2: // SUBB + param2 += is_CF(); + result = do_sub_16bit(param1, param2); + break; + + case 0x3: // SUB + result = do_sub_16bit(param1, param2); + break; + + case 0x4: // AND + result = do_and(param1, param2); + break; + + case 0x5: // XOR + result = do_xor(param1, param2); + break; + + case 0x6: // OR + result = do_or(param1, param2); + break; + + case 0x7: // CMP + do_cmp_16bit(param1, param2); + break; + } + + return result; +} uint8_t tlcs870_device::handle_SHLC(uint8_t val) { diff --git a/src/devices/cpu/tlcs870/tlcs870_ops_reg.cpp b/src/devices/cpu/tlcs870/tlcs870_ops_reg.cpp index 4bcc361c51d..484ce98fbb5 100644 --- a/src/devices/cpu/tlcs870/tlcs870_ops_reg.cpp +++ b/src/devices/cpu/tlcs870/tlcs870_ops_reg.cpp @@ -333,7 +333,7 @@ void tlcs870_device::do_ALUOP_A_g(const uint8_t opbyte0, const uint8_t opbyte1) const int aluop = (opbyte1 & 0x7); - const uint8_t result = do_alu(aluop, get_reg8(REG_A), get_reg8(opbyte0 & 0x7)); + const uint8_t result = do_alu_8bit(aluop, get_reg8(REG_A), get_reg8(opbyte0 & 0x7)); if (aluop != 0x07) // CMP doesn't write back { @@ -357,7 +357,7 @@ void tlcs870_device::do_ALUOP_g_A(const uint8_t opbyte0, const uint8_t opbyte1) m_cycles = 3; const int aluop = (opbyte1 & 0x7); - const uint8_t result = do_alu(aluop, get_reg8(opbyte0 & 0x7), get_reg8(REG_A)); + const uint8_t result = do_alu_8bit(aluop, get_reg8(opbyte0 & 0x7), get_reg8(REG_A)); if (aluop != 0x07) // CMP doesn't write back { @@ -384,7 +384,7 @@ void tlcs870_device::do_ALUOP_g_n(const uint8_t opbyte0, const uint8_t opbyte1) const uint8_t n = READ8(); - const uint8_t result = do_alu(aluop, get_reg8(opbyte0 & 0x7), n); + const uint8_t result = do_alu_8bit(aluop, get_reg8(opbyte0 & 0x7), n); if (aluop != 0x07) // CMP doesn't write back { @@ -413,7 +413,7 @@ void tlcs870_device::do_ALUOP_WA_gg(const uint8_t opbyte0, const uint8_t opbyte1 const int aluop = (opbyte1 & 0x7); - const uint16_t result = do_alu(aluop, get_reg16(REG_WA), get_reg16(opbyte0 & 0x3)); + const uint16_t result = do_alu_16bit(aluop, get_reg16(REG_WA), get_reg16(opbyte0 & 0x3)); if (aluop != 0x07) // CMP doesn't write back { @@ -441,7 +441,7 @@ void tlcs870_device::do_ALUOP_gg_mn(const uint8_t opbyte0, const uint8_t opbyte1 const uint16_t mn = READ16(); - const uint16_t result = do_alu(aluop, get_reg16(opbyte0 & 0x3), mn); + const uint16_t result = do_alu_16bit(aluop, get_reg16(opbyte0 & 0x3), mn); if (aluop != 0x07) // CMP doesn't write back { diff --git a/src/devices/cpu/tlcs870/tlcs870_ops_src.cpp b/src/devices/cpu/tlcs870/tlcs870_ops_src.cpp index 22c718a2078..0d1a5ae6205 100644 --- a/src/devices/cpu/tlcs870/tlcs870_ops_src.cpp +++ b/src/devices/cpu/tlcs870/tlcs870_ops_src.cpp @@ -524,7 +524,7 @@ void tlcs870_device::do_ALUOP_insrc_inHL(const uint8_t opbyte0, const uint8_t op const uint16_t HL = get_reg16(REG_HL); - const uint8_t result = do_alu(aluop, val, RM8(HL)); + const uint8_t result = do_alu_8bit(aluop, val, RM8(HL)); if (aluop != 0x07) // CMP doesn't write back { @@ -618,7 +618,7 @@ void tlcs870_device::do_ALUOP_insrc_n(const uint8_t opbyte0, const uint8_t opbyt const int aluop = (opbyte1 & 0x7); const uint8_t val = RM8(srcaddr); - const uint8_t result = do_alu(aluop, val, n); + const uint8_t result = do_alu_8bit(aluop, val, n); if (aluop != 0x07) // CMP doesn't write back { @@ -710,7 +710,7 @@ void tlcs870_device::do_ALUOP_A_insrc(const uint8_t opbyte0, const uint8_t opbyt const int aluop = (opbyte1 & 0x7); const uint8_t val = RM8(srcaddr); - const uint8_t result = do_alu(aluop, get_reg8(REG_A), val); + const uint8_t result = do_alu_8bit(aluop, get_reg8(REG_A), val); if (aluop != 0x07) // CMP doesn't write back { diff --git a/src/mame/drivers/hng64.cpp b/src/mame/drivers/hng64.cpp index 0ca4a5ea2e2..19f68c69c3d 100644 --- a/src/mame/drivers/hng64.cpp +++ b/src/mame/drivers/hng64.cpp @@ -1532,24 +1532,56 @@ void hng64_state::machine_reset() reset_sound(); } -READ8_MEMBER(hng64_state::ioport0_r) { logerror("ioport0_r\n"); return 0xff; } -READ8_MEMBER(hng64_state::ioport1_r) { logerror("ioport1_r\n"); return 0xff; } -READ8_MEMBER(hng64_state::ioport2_r) { logerror("ioport2_r\n"); return 0xff; } -READ8_MEMBER(hng64_state::ioport3_r) { logerror("ioport3_r\n"); return 0xff; } -READ8_MEMBER(hng64_state::ioport4_r) { logerror("ioport4_r\n"); return 0xff; } -READ8_MEMBER(hng64_state::ioport5_r) { logerror("ioport5_r\n"); return 0xff; } -READ8_MEMBER(hng64_state::ioport6_r) { logerror("ioport6_r\n"); return 0xff; } -READ8_MEMBER(hng64_state::ioport7_r) { logerror("ioport7_r\n"); return 0xff; } - -WRITE8_MEMBER(hng64_state::ioport0_w) { logerror("ioport0_w %02x\n", data); } -WRITE8_MEMBER(hng64_state::ioport1_w) { logerror("ioport1_w %02x\n", data); } -WRITE8_MEMBER(hng64_state::ioport2_w) { logerror("ioport2_w %02x\n", data); } -WRITE8_MEMBER(hng64_state::ioport3_w) { logerror("ioport3_w %02x\n", data); } -WRITE8_MEMBER(hng64_state::ioport4_w) { logerror("ioport4_w %02x\n", data); } -WRITE8_MEMBER(hng64_state::ioport5_w) { logerror("ioport5_w %02x\n", data); } -WRITE8_MEMBER(hng64_state::ioport6_w) { logerror("ioport6_w %02x\n", data); } -WRITE8_MEMBER(hng64_state::ioport7_w) { logerror("ioport7_w %02x\n", data); } +// used +READ8_MEMBER(hng64_state::ioport0_r) +{ + logerror("%s: ioport0_r\n", machine().describe_context()); + return 0x03; // expects 0x03 after writing it to port 0 earlier +} + +// used +READ8_MEMBER(hng64_state::ioport1_r) +{ + logerror("%s: ioport1_r\n", machine().describe_context()); + return 0xff; +} + +// used +WRITE8_MEMBER(hng64_state::ioport0_w) +{ + logerror("%s: ioport0_w %02x\n", machine().describe_context(), data); +} + +// used +WRITE8_MEMBER(hng64_state::ioport1_w) +{ + logerror("%s: ioport1_w %02x\n", machine().describe_context(), data); +} + +// used +WRITE8_MEMBER(hng64_state::ioport3_w) +{ + logerror("%s: ioport3_w %02x\n", machine().describe_context(), data); +} + +// used +WRITE8_MEMBER(hng64_state::ioport7_w) +{ + logerror("%s: ioport7_w %02x\n", machine().describe_context(), data); +} +// check if these are used +READ8_MEMBER(hng64_state::ioport2_r) { logerror("%s: ioport2_r\n", machine().describe_context()); return 0xff; } +READ8_MEMBER(hng64_state::ioport3_r) { logerror("%s: ioport3_r\n", machine().describe_context()); return 0xff; } +READ8_MEMBER(hng64_state::ioport4_r) { logerror("%s: ioport4_r\n", machine().describe_context()); return 0xff; } +READ8_MEMBER(hng64_state::ioport5_r) { logerror("%s: ioport5_r\n", machine().describe_context()); return 0xff; } +READ8_MEMBER(hng64_state::ioport6_r) { logerror("%s: ioport6_r\n", machine().describe_context()); return 0xff; } +READ8_MEMBER(hng64_state::ioport7_r) { logerror("%s: ioport7_r\n", machine().describe_context()); return 0xff; } + +WRITE8_MEMBER(hng64_state::ioport2_w) { logerror("%s: ioport2_w %02x\n", machine().describe_context(), data); } +WRITE8_MEMBER(hng64_state::ioport4_w) { logerror("%s: ioport4_w %02x\n", machine().describe_context(), data); } +WRITE8_MEMBER(hng64_state::ioport5_w) { logerror("%s: ioport5_w %02x\n", machine().describe_context(), data); } +WRITE8_MEMBER(hng64_state::ioport6_w) { logerror("%s: ioport6_w %02x\n", machine().describe_context(), data); } MACHINE_CONFIG_START(hng64_state::hng64) /* basic machine hardware */ -- cgit v1.2.3 From 7ecf21cbdd603fbe3f308461ed0c8d25f1497b67 Mon Sep 17 00:00:00 2001 From: smf- Date: Sat, 28 Jul 2018 09:19:24 +0100 Subject: added device_clock_changed (nw) --- src/devices/sound/sn76496.cpp | 5 +++++ src/devices/sound/sn76496.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/devices/sound/sn76496.cpp b/src/devices/sound/sn76496.cpp index 0c08ca0cb2e..87f1a95486e 100644 --- a/src/devices/sound/sn76496.cpp +++ b/src/devices/sound/sn76496.cpp @@ -267,6 +267,11 @@ void sn76496_base_device::device_start() register_for_save_states(); } +void sn76496_base_device::device_clock_changed() +{ + m_sound->set_sample_rate(clock()/2); +} + WRITE8_MEMBER( sn76496_base_device::stereo_w ) { m_sound->update(); diff --git a/src/devices/sound/sn76496.h b/src/devices/sound/sn76496.h index 0a129260e4d..b3d330e0c2c 100644 --- a/src/devices/sound/sn76496.h +++ b/src/devices/sound/sn76496.h @@ -48,6 +48,7 @@ protected: uint32_t clock); virtual void device_start() override; + virtual void device_clock_changed() override; virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override; private: -- cgit v1.2.3 From 8474f0462640aafdfe89466902d3936bc08ecd8e Mon Sep 17 00:00:00 2001 From: smf- Date: Sat, 28 Jul 2018 09:53:42 +0100 Subject: fixed oki clock (nw) --- src/mame/drivers/vgmplay.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mame/drivers/vgmplay.cpp b/src/mame/drivers/vgmplay.cpp index 135551df23f..790dadc3ab8 100644 --- a/src/mame/drivers/vgmplay.cpp +++ b/src/mame/drivers/vgmplay.cpp @@ -1597,8 +1597,8 @@ QUICKLOAD_LOAD_MEMBER(vgmplay_state, load_file) m_k054539[0]->init_flags(version >= 0x161 && data_start >= 0x96 ? r8(0x95) : 0); m_k054539[1]->init_flags(version >= 0x161 && data_start >= 0x96 ? r8(0x95) : 0); - m_okim6295_clock[0] = version >= 0x161 && data_start >= 0x9c ? r32(0x98) & 0xc0000000 : 0; - m_okim6295_clock[1] = version >= 0x161 && data_start >= 0x9c && (r32(0x98) & 0x40000000) ? r32(0x98) & 0xc0000000 : 0; + m_okim6295_clock[0] = version >= 0x161 && data_start >= 0x9c ? r32(0x98) & ~0xc0000000 : 0; + m_okim6295_clock[1] = version >= 0x161 && data_start >= 0x9c && (r32(0x98) & 0x40000000) ? r32(0x98) & ~0xc0000000 : 0; m_okim6295[0]->set_unscaled_clock(m_okim6295_clock[0]); m_okim6295[1]->set_unscaled_clock(m_okim6295_clock[1]); -- cgit v1.2.3 From 9b5a95713cc7ad08acb6da3d39a294a755fedbe7 Mon Sep 17 00:00:00 2001 From: smf- Date: Sat, 28 Jul 2018 11:24:41 +0100 Subject: make the software list "special" to prevent pausing while typing (nw) --- src/frontend/mame/ui/imgcntrl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frontend/mame/ui/imgcntrl.cpp b/src/frontend/mame/ui/imgcntrl.cpp index ab502a39834..3312e5d54e7 100644 --- a/src/frontend/mame/ui/imgcntrl.cpp +++ b/src/frontend/mame/ui/imgcntrl.cpp @@ -206,7 +206,7 @@ void menu_control_device_image::handle() break; } m_software_info_name.clear(); - menu::stack_push(ui(), container(), m_sld, m_image.image_interface(), m_software_info_name); + menu::stack_push_special_main(ui(), container(), m_sld, m_image.image_interface(), m_software_info_name); m_state = SELECT_PARTLIST; break; -- cgit v1.2.3 From 982077e1614c82a6328cb96afbc621a607a6d950 Mon Sep 17 00:00:00 2001 From: smf- Date: Sat, 28 Jul 2018 11:59:33 +0100 Subject: added device_clock_changed (nw) --- src/devices/sound/k053260.cpp | 10 ++++++++++ src/devices/sound/k053260.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/devices/sound/k053260.cpp b/src/devices/sound/k053260.cpp index 764f02487f9..cc5294b0b59 100644 --- a/src/devices/sound/k053260.cpp +++ b/src/devices/sound/k053260.cpp @@ -104,6 +104,16 @@ void k053260_device::device_start() } +//------------------------------------------------- +// device_clock_changed +//------------------------------------------------- + +void k053260_device::device_clock_changed() +{ + m_stream->set_sample_rate(clock() / CLOCKS_PER_SAMPLE); +} + + //------------------------------------------------- // device_reset - device-specific reset //------------------------------------------------- diff --git a/src/devices/sound/k053260.h b/src/devices/sound/k053260.h index a938a420090..9edb1d522f5 100644 --- a/src/devices/sound/k053260.h +++ b/src/devices/sound/k053260.h @@ -47,6 +47,7 @@ public: protected: // device-level overrides virtual void device_start() override; + virtual void device_clock_changed() override; virtual void device_reset() override; // sound stream update overrides -- cgit v1.2.3 From 2612cd60c0e18173b1476413959280214141bf2a Mon Sep 17 00:00:00 2001 From: smf- Date: Sat, 28 Jul 2018 12:54:08 +0100 Subject: vgmplay: Fixed K054539 [smf] --- src/devices/sound/k054539.cpp | 5 +++++ src/devices/sound/k054539.h | 1 + src/mame/drivers/vgmplay.cpp | 8 ++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/devices/sound/k054539.cpp b/src/devices/sound/k054539.cpp index 862f8e2f175..35f45bf4fa6 100644 --- a/src/devices/sound/k054539.cpp +++ b/src/devices/sound/k054539.cpp @@ -535,6 +535,11 @@ void k054539_device::device_start() init_chip(); } +void k054539_device::device_clock_changed() +{ + stream->set_sample_rate(clock() / 384); +} + void k054539_device::device_reset() { regs[0x22c] = 0; diff --git a/src/devices/sound/k054539.h b/src/devices/sound/k054539.h index a8a6507963a..0b79173f205 100644 --- a/src/devices/sound/k054539.h +++ b/src/devices/sound/k054539.h @@ -67,6 +67,7 @@ public: protected: // device-level overrides virtual void device_start() override; + virtual void device_clock_changed() override; virtual void device_reset() override; virtual void device_post_load() override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; diff --git a/src/mame/drivers/vgmplay.cpp b/src/mame/drivers/vgmplay.cpp index 790dadc3ab8..5e9cea25ac7 100644 --- a/src/mame/drivers/vgmplay.cpp +++ b/src/mame/drivers/vgmplay.cpp @@ -885,7 +885,7 @@ void vgmplay_device::execute_run() case 0xd3: { pulse_act_led(LED_K054539); - uint16_t offset = m_file->read_byte(m_pc+1) << 16 | m_file->read_byte(m_pc+2); + uint16_t offset = m_file->read_byte(m_pc+1) << 8 | m_file->read_byte(m_pc+2); if (offset & 0x8000) m_io->write_byte(A_K054539B + (offset & 0x3ff), m_file->read_byte(m_pc+3)); else @@ -1611,6 +1611,8 @@ QUICKLOAD_LOAD_MEMBER(vgmplay_state, load_file) if (version >= 0x161 && data_start >= 0xa0 && (r32(0x9c) & 0x40000000)) logerror("Warning: file requests an unsupported 2nd K051649\n"); + m_k054539[0]->set_clock_scale(384); // HACK: VGMs contain 48,000 instead of 18,432,000 + m_k054539[1]->set_clock_scale(384); // HACK: VGMs contain 48,000 instead of 18,432,000 m_k054539[0]->set_unscaled_clock(version >= 0x161 && data_start >= 0xa4 ? r32(0xa0) & ~0x40000000 : 0); m_k054539[1]->set_unscaled_clock(version >= 0x161 && data_start >= 0xa4 && (r32(0xa0) & 0x40000000) ? r32(0xa0) & ~0x40000000 : 0); @@ -1627,7 +1629,9 @@ QUICKLOAD_LOAD_MEMBER(vgmplay_state, load_file) m_pokey[0]->set_unscaled_clock(version >= 0x161 && data_start >= 0xb4 ? r32(0xb0) & ~0x40000000 : 0); m_pokey[1]->set_unscaled_clock(version >= 0x161 && data_start >= 0xb4 && (r32(0xb0) & 0x40000000) ? r32(0xb0) & ~0x40000000 : 0); - m_qsound->set_unscaled_clock(version >= 0x161 && data_start >= 0xb8 ? r32(0xb4) * 15 : 0); // * 15 multipler for correct pitch + + m_qsound->set_clock_scale(15); // HACK: VGMs contain 4,000,000 instead of 60,000,000 + m_qsound->set_unscaled_clock(version >= 0x161 && data_start >= 0xb8 ? r32(0xb4) : 0); if (version >= 0x151 && data_start >= 0xbc && r32(0xb8)) logerror("Warning: file requests an unsupported SCSP\n"); -- cgit v1.2.3 From 2b8fc7d6f52e12c19b4db3071287b554e7e42f34 Mon Sep 17 00:00:00 2001 From: smf- Date: Sat, 28 Jul 2018 13:57:34 +0100 Subject: vgmplay don't crash on YM3438 songs [smf] --- src/devices/sound/2612intf.cpp | 2 +- src/devices/sound/rf5c68.cpp | 9 +++++++++ src/devices/sound/rf5c68.h | 1 + src/mame/drivers/vgmplay.cpp | 4 +++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/devices/sound/2612intf.cpp b/src/devices/sound/2612intf.cpp index 7350d04a624..21ca436a004 100644 --- a/src/devices/sound/2612intf.cpp +++ b/src/devices/sound/2612intf.cpp @@ -42,7 +42,7 @@ void ym2612_device::device_timer(emu_timer &timer, device_timer_id id, int param void ym2612_device::timer_handler(int c,int count,int clock) { - if( count == 0 ) + if( count == 0 || clock == 0 ) { /* Reset FM Timer */ m_timer[c]->enable(false); } diff --git a/src/devices/sound/rf5c68.cpp b/src/devices/sound/rf5c68.cpp index 1509ab8d8b8..a00bd45d522 100644 --- a/src/devices/sound/rf5c68.cpp +++ b/src/devices/sound/rf5c68.cpp @@ -65,6 +65,15 @@ void rf5c68_device::device_start() save_item(NAME(m_enable)); } +//------------------------------------------------- +// device_clock_changed +//------------------------------------------------- + +void rf5c68_device::device_clock_changed() +{ + m_stream->set_sample_rate(clock() / 384); +} + //------------------------------------------------- // memory_space_config - return a description of // any address spaces owned by this device diff --git a/src/devices/sound/rf5c68.h b/src/devices/sound/rf5c68.h index f0c202e0e04..7d3fc2ba600 100644 --- a/src/devices/sound/rf5c68.h +++ b/src/devices/sound/rf5c68.h @@ -46,6 +46,7 @@ public: protected: // device-level overrides virtual void device_start() override; + virtual void device_clock_changed() override; // sound stream update overrides virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override; diff --git a/src/mame/drivers/vgmplay.cpp b/src/mame/drivers/vgmplay.cpp index 5e9cea25ac7..76f86eb5b61 100644 --- a/src/mame/drivers/vgmplay.cpp +++ b/src/mame/drivers/vgmplay.cpp @@ -1515,7 +1515,9 @@ QUICKLOAD_LOAD_MEMBER(vgmplay_state, load_file) if (r32(0x10) & 0x40000000) logerror("Warning: file requests an unsupported 2nd YM2413\n"); - m_ym2612->set_unscaled_clock((version >= 0x110 ? r32(0x2c) : r32(0x10)) & ~0x40000000); + m_ym2612->set_unscaled_clock((version >= 0x110 ? r32(0x2c) : r32(0x10)) & ~0xc0000000); + if (version >= 0x110 && (r32(0x2c) & 0x80000000)) + logerror("Warning: file requests an unsupported YM3438\n"); if (version >= 0x110 && (r32(0x2c) & 0x40000000)) logerror("Warning: file requests an unsupported 2nd YM2612\n"); -- cgit v1.2.3 From fa84557cb241291751966196028ca8adfc41705c Mon Sep 17 00:00:00 2001 From: smf- Date: Sat, 28 Jul 2018 14:31:55 +0100 Subject: updated warning checks (nw) --- src/mame/drivers/vgmplay.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/mame/drivers/vgmplay.cpp b/src/mame/drivers/vgmplay.cpp index 76f86eb5b61..df1744f8543 100644 --- a/src/mame/drivers/vgmplay.cpp +++ b/src/mame/drivers/vgmplay.cpp @@ -1635,17 +1635,21 @@ QUICKLOAD_LOAD_MEMBER(vgmplay_state, load_file) m_qsound->set_clock_scale(15); // HACK: VGMs contain 4,000,000 instead of 60,000,000 m_qsound->set_unscaled_clock(version >= 0x161 && data_start >= 0xb8 ? r32(0xb4) : 0); - if (version >= 0x151 && data_start >= 0xbc && r32(0xb8)) + if (version >= 0x171 && data_start >= 0xbc && r32(0xb8)) logerror("Warning: file requests an unsupported SCSP\n"); - if (version >= 0x151 && data_start >= 0xc4 && r32(0xc0)) + + if (version >= 0x170 && data_start >= 0xc0 && r32(0xbc)) + logerror("Warning: file requests an unsupported Extra Header\n"); + + if (version >= 0x171 && data_start >= 0xc4 && r32(0xc0)) logerror("Warning: file requests an unsupported WonderSwan\n"); - if (version >= 0x151 && data_start >= 0xc8 && r32(0xc4)) + if (version >= 0x171 && data_start >= 0xc8 && r32(0xc4)) logerror("Warning: file requests an unsupported VSU\n"); - if (version >= 0x151 && data_start >= 0xcc && r32(0xc8)) + if (version >= 0x171 && data_start >= 0xcc && r32(0xc8)) logerror("Warning: file requests an unsupported SAA1099\n"); - if (version >= 0x151 && data_start >= 0xd0 && r32(0xcc)) + if (version >= 0x171 && data_start >= 0xd0 && r32(0xcc)) logerror("Warning: file requests an unsupported ES5503\n"); - if (version >= 0x151 && data_start >= 0xd4 && r32(0xd0)) + if (version >= 0x171 && data_start >= 0xd4 && r32(0xd0)) logerror("Warning: file requests an unsupported %s\n", r32(0xd0) & 0x80000000 ? "ES5506" : "ES5505"); m_c352->set_divider(version >= 0x171 && data_start >= 0xd7 && r8(0xd6) ? r8(0xd6) * 4 : 1); -- cgit v1.2.3 From 2f26bb178842a471726f97e05d155e7670d47c6f Mon Sep 17 00:00:00 2001 From: AJR Date: Sat, 28 Jul 2018 10:59:54 -0400 Subject: seibucop.cpp: Minor documentation mistake (nw) --- src/mame/machine/seibucop/seibucop.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/machine/seibucop/seibucop.cpp b/src/mame/machine/seibucop/seibucop.cpp index 229eda863a8..d45698b4f97 100644 --- a/src/mame/machine/seibucop/seibucop.cpp +++ b/src/mame/machine/seibucop/seibucop.cpp @@ -1310,7 +1310,7 @@ WRITE16_MEMBER( raiden2cop_device::cop_unk_param_b_w) COMBINE_DATA(&m_cop_unk_param_b); } -// cupsoc always writes 0xF before commands 0x5105, 0x5905, 0xD104 and 0xF105 and 0xE before 0xD104, then resets this to zero +// cupsoc always writes 0xF before commands 0x5105, 0x5905, 0xD104 and 0xF105 and 0xE before 0xDDE5, then resets this to zero // zeroteam writes 0xE here before 0xEDE5, then resets it to zero WRITE16_MEMBER( raiden2cop_device::cop_precmd_w) { -- cgit v1.2.3 From b1c5b7c40d15a515c7bb12a3cffb7f0d4b5f713c Mon Sep 17 00:00:00 2001 From: Robbbert Date: Sun, 29 Jul 2018 02:04:26 +1000 Subject: (nw) ccs300 : fixed regression --- src/mame/drivers/ccs300.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/mame/drivers/ccs300.cpp b/src/mame/drivers/ccs300.cpp index 170f211315c..3a1366331f9 100644 --- a/src/mame/drivers/ccs300.cpp +++ b/src/mame/drivers/ccs300.cpp @@ -105,13 +105,12 @@ void ccs300_state::init_ccs300() membank("bankw0")->configure_entry(0, &main[0x0000]); } -// bit 7 needs to be stripped off, we do this by choosing 7 bits and even parity static DEVICE_INPUT_DEFAULTS_START( terminal ) DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_7 ) - DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_EVEN ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_2 ) DEVICE_INPUT_DEFAULTS_END -- cgit v1.2.3 From 7bd14bedf6fd824853c406248dd4a36db17ecb7b Mon Sep 17 00:00:00 2001 From: arbee Date: Sat, 28 Jul 2018 20:25:25 -0400 Subject: apple2cp: 5.25" disks are now supported too (nw) --- src/mame/drivers/apple2e.cpp | 87 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 75 insertions(+), 12 deletions(-) diff --git a/src/mame/drivers/apple2e.cpp b/src/mame/drivers/apple2e.cpp index 6dec2fa1d70..72e0a243d07 100644 --- a/src/mame/drivers/apple2e.cpp +++ b/src/mame/drivers/apple2e.cpp @@ -4216,6 +4216,20 @@ MACHINE_CONFIG_START(apple2e_state::apple2c) MCFG_RAM_EXTRA_OPTIONS("128K") MACHINE_CONFIG_END +static void apple2cp_set_lines(device_t *device, uint8_t lines) +{ + apple2e_state *state = device->machine().driver_data(); + + if (state->m_35sel) + { + sony_set_lines(device, lines); + } + else + { + apple525_set_lines(device, lines); + } +} + static void apple2cp_set_enable_lines(device_t *device,int enable_mask) { apple2e_state *state = device->machine().driver_data(); @@ -4226,20 +4240,68 @@ static void apple2cp_set_enable_lines(device_t *device,int enable_mask) { sony_set_enable_lines(device, 1); } + else if (!state->m_35sel) + { + apple525_set_enable_lines(device, enable_mask); + } else { sony_set_enable_lines(device, 0); } } +static uint8_t apple2cp_read_data(device_t *device) +{ + apple2e_state *state = device->machine().driver_data(); + + if (state->m_35sel) + { + return sony_read_data(device); + } + else + { + return apple525_read_data(device); + } + + return 0; +} + +static void apple2cp_write_data(device_t *device, uint8_t data) +{ + apple2e_state *state = device->machine().driver_data(); + + if (state->m_35sel) + { + sony_write_data(device, data); + } + else + { + apple525_write_data(device, data); + } +} + +static int apple2cp_read_status(device_t *device) +{ + apple2e_state *state = device->machine().driver_data(); + + if (state->m_35sel) + { + return sony_read_status(device); + } + else + { + return apple525_read_status(device); + } +} + const applefdc_interface a2cp_interface = { - sony_set_lines, /* set_lines */ + apple2cp_set_lines, /* set_lines */ apple2cp_set_enable_lines, /* set_enable_lines */ - sony_read_data, /* read_data */ - sony_write_data, /* write_data */ - sony_read_status /* read_status */ + apple2cp_read_data, /* read_data */ + apple2cp_write_data, /* write_data */ + apple2cp_read_status /* read_status */ }; static const floppy_interface apple2cp_floppy35_floppy_interface = @@ -4249,6 +4311,13 @@ static const floppy_interface apple2cp_floppy35_floppy_interface = "floppy_3_5" }; +static const floppy_interface floppy_interface = +{ + FLOPPY_STANDARD_5_25_DSHD, + LEGACY_FLOPPY_OPTIONS_NAME(apple2), + "floppy_5_25" +}; + MACHINE_CONFIG_START(apple2e_state::apple2cp) apple2c(config); MCFG_DEVICE_REPLACE("maincpu", M65C02, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ @@ -4257,7 +4326,8 @@ MACHINE_CONFIG_START(apple2e_state::apple2cp) MCFG_DEVICE_REMOVE("sl4") MCFG_DEVICE_REMOVE("sl6") MCFG_IWM_ADD(IICP_IWM_TAG, a2cp_interface) - MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADD(apple2cp_floppy35_floppy_interface) + MCFG_LEGACY_FLOPPY_APPLE_2_DRIVES_ADD(floppy_interface,15,16) + MCFG_LEGACY_FLOPPY_SONY_2_DRIVES_ADDITIONAL_ADD(apple2cp_floppy35_floppy_interface) MCFG_RAM_MODIFY(RAM_TAG) MCFG_RAM_DEFAULT_SIZE("128K") @@ -4294,13 +4364,6 @@ const applefdc_interface fdc_interface = apple525_read_status /* read_status */ }; -static const floppy_interface floppy_interface = -{ - FLOPPY_STANDARD_5_25_DSHD, - LEGACY_FLOPPY_OPTIONS_NAME(apple2), - "floppy_5_25" -}; - MACHINE_CONFIG_START(apple2e_state::laser128) apple2c(config); MCFG_DEVICE_REPLACE("maincpu", M65C02, 1021800) /* close to actual CPU frequency of 1.020484 MHz */ -- cgit v1.2.3 From 51cebe3f60aa2584d02eac8c67455c8691fce934 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sun, 29 Jul 2018 18:01:48 +1000 Subject: qsoundhle: Saturate ROM offsets [superctr] qsound: Apply ADPCM sample bank [superctr] --- src/devices/sound/qsound.cpp | 26 ++++++-------------------- src/devices/sound/qsoundhle.cpp | 29 +++++++++++++++++++++-------- src/devices/sound/qsoundhle.h | 9 ++++----- 3 files changed, 31 insertions(+), 33 deletions(-) diff --git a/src/devices/sound/qsound.cpp b/src/devices/sound/qsound.cpp index 0c49495427a..31d4f08ac6c 100644 --- a/src/devices/sound/qsound.cpp +++ b/src/devices/sound/qsound.cpp @@ -283,7 +283,7 @@ READ16_MEMBER(qsound_device::dsp_sample_r) // FIXME: DSP16 doesn't like bytes, only signed words - should this zero-pad or byte-smear? u8 const byte(read_byte((u32(m_rom_bank) << 16) | m_rom_offset)); if (!machine().side_effects_disabled()) - m_rom_bank = offset; + m_rom_bank = (m_rom_bank & 0x8000U) | offset; return (u16(byte) << 8) | u16(byte); } @@ -331,25 +331,11 @@ WRITE_LINE_MEMBER(qsound_device::dsp_ock_w) WRITE16_MEMBER(qsound_device::dsp_pio_w) { - /* - * FIXME: what does this do when PDX is high? - * There are seemingly two significant points where the program writes PDX1 every sample interval. - * - * Before writing the right-channel sample to SDX - this causes the PSEL 0->1 transition: - * 0:5d4: 996e if true a0 = rnd(a0) - * 0:5d5: 51e0 0000 pdx1 = 0x0000 - * 0:5d7: 49a0 move sdx = a0 - * - * This curious code where it writes out the a word from RAM@0x00f1 - this value seems significant: - * 0:335: 18f1 set r0 = 0x00f1 - * 0:336: 3cd0 nop, a0 = *r0 - * 0:337: d850 p = x*y, y = a1, x = *pt++i - * 0:338: 49e0 move pdx1 = a0 - */ - if (offset) - LOG("QSound: DSP PDX1 = %04X\n", data); - else - m_rom_offset = data; + // PDX0 is used for QSound ROM offset, and PDX1 is used for ADPCM ROM offset + // this prevents spurious PSEL transitions between sending samples to the DAC + // it could still be used to have separate QSound/ADPCM ROM banks + m_rom_bank = (m_rom_bank & 0x7fffU) | u16(offset << 15); + m_rom_offset = data; } diff --git a/src/devices/sound/qsoundhle.cpp b/src/devices/sound/qsoundhle.cpp index 5a57f098454..8d182bb4b1a 100644 --- a/src/devices/sound/qsoundhle.cpp +++ b/src/devices/sound/qsoundhle.cpp @@ -29,6 +29,19 @@ #include "emu.h" #include "qsoundhle.h" +#include +#include + + +namespace { + +constexpr u32 saturate(s64 val) +{ + return std::min(std::max(val, std::numeric_limits::min()), std::numeric_limits::max()); +} + +} // anonymous namespace + // device type definition DEFINE_DEVICE_TYPE(QSOUND_HLE, qsound_hle_device, "qsound_hle", "QSound (HLE)") @@ -41,7 +54,7 @@ DEFINE_DEVICE_TYPE(QSOUND_HLE, qsound_hle_device, "qsound_hle", "QSound (HLE)") // qsound_hle_device - constructor //------------------------------------------------- -qsound_hle_device::qsound_hle_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) +qsound_hle_device::qsound_hle_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : device_t(mconfig, QSOUND_HLE, tag, owner, clock) , device_sound_interface(mconfig, *this) , device_rom_interface(mconfig, *this, 24) @@ -124,14 +137,14 @@ void qsound_hle_device::sound_stream_update(sound_stream &stream, stream_sample_ offs_t const addr(ch.reg[1] | (bank << 16)); // update based on playback rate - uint32_t updated(uint32_t(ch.reg[2] << 4) + ((uint32_t(ch.reg[1]) << 16) | ch.reg[3])); - ch.reg[3] = uint16_t(updated); - if (updated >= (uint32_t(ch.reg[5]) << 16)) - updated -= uint32_t(ch.reg[4]) << 16; - ch.reg[1] = uint16_t(updated >> 16); + s64 updated(s32(u32(ch.reg[2]) << 4) + s32((u32(ch.reg[1]) << 16) | ch.reg[3])); + ch.reg[3] = u16(saturate(updated)); + if (updated >= s32(u32(ch.reg[5]) << 16)) + updated -= s32(u32(ch.reg[4]) << 16); + ch.reg[1] = u16(saturate(updated) >> 16); // get the scaled sample - int32_t const scaled(int32_t(int16_t(ch.reg[6])) * read_sample(addr)); + s32 const scaled(s32(s16(ch.reg[6])) * read_sample(addr)); // apply simple panning *lmix++ += (((scaled >> 8) * ch.lvol) >> 14); @@ -172,7 +185,7 @@ READ8_MEMBER(qsound_hle_device::qsound_r) } -void qsound_hle_device::write_data(uint8_t address, uint16_t data) +void qsound_hle_device::write_data(u8 address, u16 data) { int ch = 0, reg; diff --git a/src/devices/sound/qsoundhle.h b/src/devices/sound/qsoundhle.h index 8f4def443a0..498343ba6cb 100644 --- a/src/devices/sound/qsoundhle.h +++ b/src/devices/sound/qsoundhle.h @@ -34,13 +34,12 @@ protected: virtual void rom_bank_updated() override; private: - // MAME resources sound_stream *m_stream; struct qsound_channel { - uint16_t reg[8]; // channel control registers + u16 reg[8]; // channel control registers // work variables int lvol; // left volume @@ -48,10 +47,10 @@ private: } m_channel[16]; int m_pan_table[33]; // pan volume table - uint16_t m_data; // register latch data + u16 m_data; // register latch data - inline int16_t read_sample(uint32_t offset) { return uint16_t(read_byte(offset)) << 8; } - void write_data(uint8_t address, uint16_t data); + inline s16 read_sample(u32 offset) { return u16(read_byte(offset)) << 8; } + void write_data(u8 address, u16 data); }; DECLARE_DEVICE_TYPE(QSOUND_HLE, qsound_hle_device) -- cgit v1.2.3 From 97ff224d2b545265f69f890235f738b1897a569d Mon Sep 17 00:00:00 2001 From: Robbbert Date: Sun, 29 Jul 2018 20:24:46 +1000 Subject: fccpu20 : fixed terminal display --- src/devices/bus/vme/vme_fccpu20.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/devices/bus/vme/vme_fccpu20.cpp b/src/devices/bus/vme/vme_fccpu20.cpp index af999f0f664..1e38411a44f 100644 --- a/src/devices/bus/vme/vme_fccpu20.cpp +++ b/src/devices/bus/vme/vme_fccpu20.cpp @@ -243,6 +243,15 @@ void vme_fccpu20_device::cpu20_mem(address_map &map) } +static DEVICE_INPUT_DEFAULTS_START( terminal ) + DEVICE_INPUT_DEFAULTS( "RS232_RXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_TXBAUD", 0xff, RS232_BAUD_9600 ) + DEVICE_INPUT_DEFAULTS( "RS232_STARTBITS", 0xff, RS232_STARTBITS_1 ) + DEVICE_INPUT_DEFAULTS( "RS232_DATABITS", 0xff, RS232_DATABITS_7 ) + DEVICE_INPUT_DEFAULTS( "RS232_PARITY", 0xff, RS232_PARITY_NONE ) + DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_2 ) +DEVICE_INPUT_DEFAULTS_END + MACHINE_CONFIG_START(vme_fccpu20_device::device_add_mconfig) /* basic machine hardware */ MCFG_DEVICE_ADD ("maincpu", M68020, CLOCK50 / 3) /* Crytstal verified from picture HCI */ @@ -294,6 +303,7 @@ MACHINE_CONFIG_START(vme_fccpu20_device::device_add_mconfig) MCFG_DEVICE_ADD (RS232P1_TAG, RS232_PORT, default_rs232_devices, "terminal") MCFG_RS232_RXD_HANDLER (WRITELINE ("mpcc", mpcc68561_device, write_rx)) MCFG_RS232_CTS_HANDLER (WRITELINE ("mpcc", mpcc68561_device, cts_w)) + MCFG_SLOT_OPTION_DEVICE_INPUT_DEFAULTS("terminal", terminal) // MPCC2 - RS232 MCFG_DEVICE_ADD (RS232P2_TAG, RS232_PORT, default_rs232_devices, nullptr) -- cgit v1.2.3 From a74434167a2ef96508ef5b3f79f281d5d6f9ffc6 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Sun, 29 Jul 2018 13:03:49 +0200 Subject: indigo: Fix rom loading [O. Galibert] --- src/mame/drivers/indigo.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mame/drivers/indigo.cpp b/src/mame/drivers/indigo.cpp index 7d9b1939ccd..4281179f99b 100644 --- a/src/mame/drivers/indigo.cpp +++ b/src/mame/drivers/indigo.cpp @@ -627,7 +627,7 @@ MACHINE_CONFIG_START(indigo_state::indigo4k) MACHINE_CONFIG_END ROM_START( indigo3k ) - ROM_REGION( 0x40000, "user1", 0 ) + ROM_REGION32_BE( 0x40000, "user1", 0 ) ROM_SYSTEM_BIOS( 0, "401-rev-c", "SGI Version 4.0.1 Rev C LG1/GR2, Jul 9, 1992" ) // dumped over serial connection from boot monitor and swapped ROMX_LOAD( "ip12prom.070-8088-xxx.u56", 0x000000, 0x040000, CRC(25ca912f) SHA1(94b3753d659bfe50b914445cef41290122f43880), ROM_GROUPWORD | ROM_REVERSE | ROM_BIOS(0) ) ROM_SYSTEM_BIOS( 1, "401-rev-d", "SGI Version 4.0.1 Rev D LG1/GR2, Mar 24, 1992" ) // dumped with EPROM programmer @@ -635,8 +635,8 @@ ROM_START( indigo3k ) ROM_END ROM_START( indigo4k ) - ROM_REGION( 0x80000, "user1", 0 ) - ROM_LOAD( "ip20prom.070-8116-004.bin", 0x000000, 0x080000, CRC(940d960e) SHA1(596aba530b53a147985ff3f6f853471ce48c866c) ) + ROM_REGION32_BE( 0x80000, "user1", 0 ) + ROMX_LOAD( "ip20prom.070-8116-004.bin", 0x000000, 0x080000, CRC(940d960e) SHA1(596aba530b53a147985ff3f6f853471ce48c866c), ROM_GROUPDWORD | ROM_REVERSE ) ROM_END // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS -- cgit v1.2.3 From 64afd77e7c7ae7399373dcdff6ecb20ee8d50532 Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Sun, 29 Jul 2018 13:07:56 +0200 Subject: Revert part of 20b5f5d0e6f73b9ce6fffa4fc5dbe3f2b83d2a27 This is damn sensitive code, and generates differences all over the place we don't really explain. The changes should be justified by themselves and tested in collaboration with Tafoid to ensure the differences are not a problem. --- src/emu/schedule.cpp | 51 +++++++++++++++++++++++++-------------------------- src/emu/sound.cpp | 39 ++++++++------------------------------- 2 files changed, 33 insertions(+), 57 deletions(-) diff --git a/src/emu/schedule.cpp b/src/emu/schedule.cpp index ba6c5e79302..d281446d6c6 100644 --- a/src/emu/schedule.cpp +++ b/src/emu/schedule.cpp @@ -452,12 +452,7 @@ void device_scheduler::timeslice() { // only process if this CPU is executing or truly halted (not yielding) // and if our target is later than the CPU's current time (coarse check) - if (exec->m_suspend != 0) - { - if (exec->m_eatcycles) - exec->m_localtime = target; - } - else if (target.seconds() >= exec->m_localtime.seconds()) + if (EXPECTED((exec->m_suspend == 0 || exec->m_eatcycles) && target.seconds() >= exec->m_localtime.seconds())) { // compute how many attoseconds to execute this CPU attoseconds_t delta = target.attoseconds() - exec->m_localtime.attoseconds(); @@ -472,29 +467,33 @@ void device_scheduler::timeslice() int ran = exec->m_cycles_running = divu_64x32(u64(delta) >> exec->m_divshift, exec->m_divisor); LOG((" cpu '%s': %d (%d cycles)\n", exec->device().tag(), delta, exec->m_cycles_running)); - g_profiler.start(exec->m_profiler); - - // note that this global variable cycles_stolen can be modified - // via the call to cpu_execute - exec->m_cycles_stolen = 0; - m_executing_device = exec; - *exec->m_icountptr = exec->m_cycles_running; - if (!call_debugger) - exec->run(); - else + // if we're not suspended, actually execute + if (exec->m_suspend == 0) { - exec->debugger_start_cpu_hook(target); - exec->run(); - exec->debugger_stop_cpu_hook(); + g_profiler.start(exec->m_profiler); + + // note that this global variable cycles_stolen can be modified + // via the call to cpu_execute + exec->m_cycles_stolen = 0; + m_executing_device = exec; + *exec->m_icountptr = exec->m_cycles_running; + if (!call_debugger) + exec->run(); + else + { + exec->debugger_start_cpu_hook(target); + exec->run(); + exec->debugger_stop_cpu_hook(); + } + + // adjust for any cycles we took back + assert(ran >= *exec->m_icountptr); + ran -= *exec->m_icountptr; + assert(ran >= exec->m_cycles_stolen); + ran -= exec->m_cycles_stolen; + g_profiler.stop(); } - // adjust for any cycles we took back - assert(ran >= *exec->m_icountptr); - ran -= *exec->m_icountptr; - assert(ran >= exec->m_cycles_stolen); - ran -= exec->m_cycles_stolen; - g_profiler.stop(); - // account for these cycles exec->m_totalcycles += ran; diff --git a/src/emu/sound.cpp b/src/emu/sound.cpp index cff1fb9dc25..775d85057dd 100644 --- a/src/emu/sound.cpp +++ b/src/emu/sound.cpp @@ -264,9 +264,6 @@ void sound_stream::set_input(int index, sound_stream *input_stream, int output_i void sound_stream::update() { - if (!m_attoseconds_per_sample) - return; - // determine the number of samples since the start of this second attotime time = m_device.machine().time(); s32 update_sampindex = s32(time.attoseconds() / m_attoseconds_per_sample); @@ -442,17 +439,8 @@ void sound_stream::apply_sample_rate_changes() recompute_sample_rate_data(); // reset our sample indexes to the current time - if (old_rate) - { - m_output_sampindex = s64(m_output_sampindex) * s64(m_sample_rate) / old_rate; - m_output_update_sampindex = s64(m_output_update_sampindex) * s64(m_sample_rate) / old_rate; - } - else - { - m_output_sampindex = m_device.machine().sound().last_update().attoseconds() / m_attoseconds_per_sample; - m_output_update_sampindex = m_output_sampindex; - } - + m_output_sampindex = s64(m_output_sampindex) * s64(m_sample_rate) / old_rate; + m_output_update_sampindex = s64(m_output_update_sampindex) * s64(m_sample_rate) / old_rate; m_output_base_sampindex = m_output_sampindex - m_max_samples_per_update; // clear out the buffer @@ -483,22 +471,15 @@ void sound_stream::recompute_sample_rate_data() throw emu_fatalerror("Incompatible sample rates as input of a synchronous stream: %d and %d\n", m_sample_rate, input.m_source->m_stream->m_sample_rate); } } + if (!m_sample_rate) + m_sample_rate = 1000; } // recompute the timing parameters attoseconds_t update_attoseconds = m_device.machine().sound().update_attoseconds(); - - if (m_sample_rate) - { - m_attoseconds_per_sample = ATTOSECONDS_PER_SECOND / m_sample_rate; - m_max_samples_per_update = (update_attoseconds + m_attoseconds_per_sample - 1) / m_attoseconds_per_sample; - } - else - { - m_attoseconds_per_sample = 0; - m_max_samples_per_update = 0; - } + m_attoseconds_per_sample = ATTOSECONDS_PER_SECOND / m_sample_rate; + m_max_samples_per_update = (update_attoseconds + m_attoseconds_per_sample - 1) / m_attoseconds_per_sample; // update resample and output buffer sizes allocate_resample_buffers(); @@ -509,7 +490,7 @@ void sound_stream::recompute_sample_rate_data() { // if we have a source, see if its sample rate changed - if (input.m_source != nullptr && input.m_source->m_stream->m_sample_rate) + if (input.m_source != nullptr) { // okay, we have a new sample rate; recompute the latency to be the maximum // sample period between us and our input @@ -530,10 +511,6 @@ void sound_stream::recompute_sample_rate_data() input.m_latency_attoseconds = std::max(input.m_latency_attoseconds, latency); assert(input.m_latency_attoseconds < update_attoseconds); } - else - { - input.m_latency_attoseconds = 0; - } } // If synchronous, prime the timer @@ -676,7 +653,7 @@ stream_sample_t *sound_stream::generate_resampled_data(stream_input &input, u32 { // if we don't have an output to pull data from, generate silence stream_sample_t *dest = &input.m_resample[0]; - if (input.m_source == nullptr || input.m_source->m_buffer.size() == 0) + if (input.m_source == nullptr) { memset(dest, 0, numsamples * sizeof(*dest)); return &input.m_resample[0]; -- cgit v1.2.3 From 3a732c9b1c32cdb7522eff092d179d3adc3bef7a Mon Sep 17 00:00:00 2001 From: smf- Date: Sun, 29 Jul 2018 13:32:24 +0100 Subject: Fix setting sample rate back to zero & crash for synchronous streams when rate is zero. This fixes all reported bugs. (nw) --- src/emu/schedule.cpp | 51 ++++++++++++++++++++++--------------------- src/emu/sound.cpp | 61 ++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 71 insertions(+), 41 deletions(-) diff --git a/src/emu/schedule.cpp b/src/emu/schedule.cpp index d281446d6c6..ba6c5e79302 100644 --- a/src/emu/schedule.cpp +++ b/src/emu/schedule.cpp @@ -452,7 +452,12 @@ void device_scheduler::timeslice() { // only process if this CPU is executing or truly halted (not yielding) // and if our target is later than the CPU's current time (coarse check) - if (EXPECTED((exec->m_suspend == 0 || exec->m_eatcycles) && target.seconds() >= exec->m_localtime.seconds())) + if (exec->m_suspend != 0) + { + if (exec->m_eatcycles) + exec->m_localtime = target; + } + else if (target.seconds() >= exec->m_localtime.seconds()) { // compute how many attoseconds to execute this CPU attoseconds_t delta = target.attoseconds() - exec->m_localtime.attoseconds(); @@ -467,33 +472,29 @@ void device_scheduler::timeslice() int ran = exec->m_cycles_running = divu_64x32(u64(delta) >> exec->m_divshift, exec->m_divisor); LOG((" cpu '%s': %d (%d cycles)\n", exec->device().tag(), delta, exec->m_cycles_running)); - // if we're not suspended, actually execute - if (exec->m_suspend == 0) + g_profiler.start(exec->m_profiler); + + // note that this global variable cycles_stolen can be modified + // via the call to cpu_execute + exec->m_cycles_stolen = 0; + m_executing_device = exec; + *exec->m_icountptr = exec->m_cycles_running; + if (!call_debugger) + exec->run(); + else { - g_profiler.start(exec->m_profiler); - - // note that this global variable cycles_stolen can be modified - // via the call to cpu_execute - exec->m_cycles_stolen = 0; - m_executing_device = exec; - *exec->m_icountptr = exec->m_cycles_running; - if (!call_debugger) - exec->run(); - else - { - exec->debugger_start_cpu_hook(target); - exec->run(); - exec->debugger_stop_cpu_hook(); - } - - // adjust for any cycles we took back - assert(ran >= *exec->m_icountptr); - ran -= *exec->m_icountptr; - assert(ran >= exec->m_cycles_stolen); - ran -= exec->m_cycles_stolen; - g_profiler.stop(); + exec->debugger_start_cpu_hook(target); + exec->run(); + exec->debugger_stop_cpu_hook(); } + // adjust for any cycles we took back + assert(ran >= *exec->m_icountptr); + ran -= *exec->m_icountptr; + assert(ran >= exec->m_cycles_stolen); + ran -= exec->m_cycles_stolen; + g_profiler.stop(); + // account for these cycles exec->m_totalcycles += ran; diff --git a/src/emu/sound.cpp b/src/emu/sound.cpp index 775d85057dd..ce72846a9c3 100644 --- a/src/emu/sound.cpp +++ b/src/emu/sound.cpp @@ -53,7 +53,7 @@ sound_stream::sound_stream(device_t &device, int inputs, int outputs, int sample : m_device(device), m_next(nullptr), m_sample_rate(sample_rate), - m_new_sample_rate(0), + m_new_sample_rate(0xffffffff), m_attoseconds_per_sample(0), m_max_samples_per_update(0), m_input(inputs), @@ -264,6 +264,9 @@ void sound_stream::set_input(int index, sound_stream *input_stream, int output_i void sound_stream::update() { + if (!m_attoseconds_per_sample) + return; + // determine the number of samples since the start of this second attotime time = m_device.machine().time(); s32 update_sampindex = s32(time.attoseconds() / m_attoseconds_per_sample); @@ -427,25 +430,35 @@ void sound_stream::update_with_accounting(bool second_tick) void sound_stream::apply_sample_rate_changes() { // skip if nothing to do - if (m_new_sample_rate == 0) + if (m_new_sample_rate == 0xffffffff) return; // update to the new rate and remember the old rate u32 old_rate = m_sample_rate; m_sample_rate = m_new_sample_rate; - m_new_sample_rate = 0; + m_new_sample_rate = 0xffffffff; // recompute all the data recompute_sample_rate_data(); // reset our sample indexes to the current time - m_output_sampindex = s64(m_output_sampindex) * s64(m_sample_rate) / old_rate; - m_output_update_sampindex = s64(m_output_update_sampindex) * s64(m_sample_rate) / old_rate; + if (old_rate) + { + m_output_sampindex = s64(m_output_sampindex) * s64(m_sample_rate) / old_rate; + m_output_update_sampindex = s64(m_output_update_sampindex) * s64(m_sample_rate) / old_rate; + } + else + { + m_output_sampindex = m_attoseconds_per_sample ? m_device.machine().sound().last_update().attoseconds() / m_attoseconds_per_sample : 0; + m_output_update_sampindex = m_output_sampindex; + } + m_output_base_sampindex = m_output_sampindex - m_max_samples_per_update; // clear out the buffer - for (auto & elem : m_output) - memset(&elem.m_buffer[0], 0, m_max_samples_per_update * sizeof(elem.m_buffer[0])); + if (m_max_samples_per_update) + for (auto & elem : m_output) + memset(&elem.m_buffer[0], 0, m_max_samples_per_update * sizeof(elem.m_buffer[0])); } @@ -471,15 +484,22 @@ void sound_stream::recompute_sample_rate_data() throw emu_fatalerror("Incompatible sample rates as input of a synchronous stream: %d and %d\n", m_sample_rate, input.m_source->m_stream->m_sample_rate); } } - if (!m_sample_rate) - m_sample_rate = 1000; } // recompute the timing parameters attoseconds_t update_attoseconds = m_device.machine().sound().update_attoseconds(); - m_attoseconds_per_sample = ATTOSECONDS_PER_SECOND / m_sample_rate; - m_max_samples_per_update = (update_attoseconds + m_attoseconds_per_sample - 1) / m_attoseconds_per_sample; + + if (m_sample_rate) + { + m_attoseconds_per_sample = ATTOSECONDS_PER_SECOND / m_sample_rate; + m_max_samples_per_update = (update_attoseconds + m_attoseconds_per_sample - 1) / m_attoseconds_per_sample; + } + else + { + m_attoseconds_per_sample = 0; + m_max_samples_per_update = 0; + } // update resample and output buffer sizes allocate_resample_buffers(); @@ -490,7 +510,7 @@ void sound_stream::recompute_sample_rate_data() { // if we have a source, see if its sample rate changed - if (input.m_source != nullptr) + if (input.m_source != nullptr && input.m_source->m_stream->m_sample_rate) { // okay, we have a new sample rate; recompute the latency to be the maximum // sample period between us and our input @@ -511,14 +531,23 @@ void sound_stream::recompute_sample_rate_data() input.m_latency_attoseconds = std::max(input.m_latency_attoseconds, latency); assert(input.m_latency_attoseconds < update_attoseconds); } + else + { + input.m_latency_attoseconds = 0; + } } // If synchronous, prime the timer if (m_synchronous) { attotime time = m_device.machine().time(); - attoseconds_t next_edge = m_attoseconds_per_sample - (time.attoseconds() % m_attoseconds_per_sample); - m_sync_timer->adjust(attotime(0, next_edge)); + if (m_attoseconds_per_sample) + { + attoseconds_t next_edge = m_attoseconds_per_sample - (time.attoseconds() % m_attoseconds_per_sample); + m_sync_timer->adjust(attotime(0, next_edge)); + } + else + m_sync_timer->adjust(attotime::never); } } @@ -587,7 +616,7 @@ void sound_stream::postload() memset(&elem.m_buffer[0], 0, m_output_bufalloc * sizeof(elem.m_buffer[0])); // recompute the sample indexes to make sense - m_output_sampindex = m_device.machine().sound().last_update().attoseconds() / m_attoseconds_per_sample; + m_output_sampindex = m_attoseconds_per_sample ? m_device.machine().sound().last_update().attoseconds() / m_attoseconds_per_sample : 0; m_output_update_sampindex = m_output_sampindex; m_output_base_sampindex = m_output_sampindex - m_max_samples_per_update; } @@ -653,7 +682,7 @@ stream_sample_t *sound_stream::generate_resampled_data(stream_input &input, u32 { // if we don't have an output to pull data from, generate silence stream_sample_t *dest = &input.m_resample[0]; - if (input.m_source == nullptr) + if (input.m_source == nullptr || input.m_source->m_stream->m_attoseconds_per_sample == 0) { memset(dest, 0, numsamples * sizeof(*dest)); return &input.m_resample[0]; -- cgit v1.2.3 From 6f1d03d56159d86719fac842bafa402ab180de65 Mon Sep 17 00:00:00 2001 From: AJR Date: Sun, 29 Jul 2018 08:55:39 -0400 Subject: mrgame.cpp: Various updates and modernizations (nw) - Screen raw parameters (circuitry is surprisingly similar to Galaxian) - Addressable latch for video CPU - VBLANK callback instead of MCFG_DEVICE_VBLANK_INT (interrupt also acknowledged now) - Separate machine configuration for wcup90, which now displays something --- src/mame/drivers/mrgame.cpp | 231 ++++++++++++++++++++++++++++++-------------- 1 file changed, 156 insertions(+), 75 deletions(-) diff --git a/src/mame/drivers/mrgame.cpp b/src/mame/drivers/mrgame.cpp index 3c460b5ebd4..aa9ddfe0b45 100644 --- a/src/mame/drivers/mrgame.cpp +++ b/src/mame/drivers/mrgame.cpp @@ -10,7 +10,7 @@ Status: - motrshow, motrshowa, dakar working in the electronic sense, but not mechanically - macattck most roms are missing -- wcup90 different hardware, not coded +- wcup90 different hardware, partially coded based on macattck schematic How to set up the machine (motrshow, motrshowa, dakar): - These machines need to be loaded with default settings before they can accept coins @@ -27,16 +27,17 @@ ToDo: - Support for electronic volume control - Audio rom banking - Most sounds missing due to unemulated M114 chip -- wcup90 is different hardware and there's no schematic *****************************************************************************************/ #include "emu.h" #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" +#include "machine/74259.h" #include "machine/i8255.h" #include "machine/nvram.h" #include "machine/timer.h" +//#include "machine/watchdog.h" #include "sound/dac.h" #include "sound/tms5220.h" #include "sound/volt_reg.h" @@ -58,6 +59,7 @@ public: , m_maincpu(*this, "maincpu") , m_audiocpu1(*this, "audiocpu1") , m_audiocpu2(*this, "audiocpu2") + , m_videocpu(*this, "videocpu") , m_io_dsw0(*this, "DSW0") , m_io_dsw1(*this, "DSW1") , m_io_x0(*this, "X0") @@ -65,6 +67,7 @@ public: { } void mrgame(machine_config &config); + void wcup90(machine_config &config); void init_mrgame(); @@ -77,42 +80,55 @@ private: DECLARE_WRITE8_MEMBER(sound_w); DECLARE_WRITE8_MEMBER(triple_w); DECLARE_WRITE8_MEMBER(video_w); - DECLARE_WRITE8_MEMBER(video_ctrl_w); + DECLARE_WRITE_LINE_MEMBER(video_a11_w); + DECLARE_WRITE_LINE_MEMBER(video_a12_w); + DECLARE_WRITE_LINE_MEMBER(video_a13_w); + DECLARE_WRITE_LINE_MEMBER(intst_w); + DECLARE_WRITE_LINE_MEMBER(nmi_intst_w); + DECLARE_WRITE_LINE_MEMBER(flip_w); DECLARE_READ8_MEMBER(col_r); DECLARE_READ8_MEMBER(sound_r); DECLARE_READ8_MEMBER(porta_r); DECLARE_READ8_MEMBER(portc_r); DECLARE_READ8_MEMBER(rsw_r); + DECLARE_WRITE_LINE_MEMBER(vblank_int_w); + DECLARE_WRITE_LINE_MEMBER(vblank_nmi_w); TIMER_DEVICE_CALLBACK_MEMBER(irq_timer); uint32_t screen_update_mrgame(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - std::unique_ptr m_tile_bitmap; - required_device m_palette; - required_shared_ptr m_p_videoram; - required_shared_ptr m_p_objectram; - required_device m_gfxdecode; + void audio1_io(address_map &map); void audio1_map(address_map &map); void audio2_io(address_map &map); void audio2_map(address_map &map); void main_map(address_map &map); void video_map(address_map &map); + void wcup90_video_map(address_map &map); + + virtual void machine_start() override; + virtual void machine_reset() override; + + std::unique_ptr m_tile_bitmap; + required_device m_palette; + required_shared_ptr m_p_videoram; + required_shared_ptr m_p_objectram; + required_device m_gfxdecode; bool m_ack1; bool m_ack2; bool m_ackv; bool m_flip; + bool m_intst; uint8_t m_irq_state; uint8_t m_row_data; uint8_t m_sound_data; uint8_t m_gfx_bank; uint8_t m_video_data; uint8_t m_video_status; - uint8_t m_video_ctrl[8]; - virtual void machine_start() override; - virtual void machine_reset() override; + required_device m_maincpu; required_device m_audiocpu1; required_device m_audiocpu2; + required_device m_videocpu; required_ioport m_io_dsw0; required_ioport m_io_dsw1; required_ioport m_io_x0; @@ -140,11 +156,22 @@ void mrgame_state::video_map(address_map &map) map(0x4000, 0x47ff).ram(); map(0x4800, 0x4bff).mirror(0x0400).ram().share("videoram"); map(0x5000, 0x50ff).mirror(0x0700).ram().share("objectram"); - map(0x6800, 0x6807).mirror(0x07f8).w(FUNC(mrgame_state::video_ctrl_w)); - map(0x7000, 0x77ff).nopr(); //AFR - looks like a watchdog + map(0x6800, 0x6807).mirror(0x07f8).w("selectlatch", FUNC(ls259_device::write_d0)); + map(0x7000, 0x7000).mirror(0x07ff).nopr(); //AFR - watchdog reset map(0x8100, 0x8103).mirror(0x7efc).rw("ppi", FUNC(i8255_device::read), FUNC(i8255_device::write)); } +void mrgame_state::wcup90_video_map(address_map &map) +{ + map(0x0000, 0x7fff).rom().region("video", 0); + map(0x8000, 0x87ff).ram(); + map(0x8800, 0x8bff).mirror(0x0400).ram().share("videoram"); + map(0x9000, 0x90ff).mirror(0x0700).ram().share("objectram"); + map(0xa800, 0xa807).mirror(0x07f8).w("selectlatch", FUNC(ls259_device::write_d0)); + map(0xb000, 0xb000).mirror(0x07ff).nopr(); //AFR - watchdog reset + map(0xc000, 0xc003).mirror(0x3ffc).rw("ppi", FUNC(i8255_device::read), FUNC(i8255_device::write)); +} + void mrgame_state::audio1_map(address_map &map) { map(0x0000, 0x7fff).rom().region("audio1", 0); @@ -225,13 +252,13 @@ static INPUT_PORTS_START( mrgame ) PORT_BIT( 0xe9, IP_ACTIVE_LOW, IPT_UNUSED ) INPUT_PORTS_END -READ8_MEMBER( mrgame_state::rsw_r ) +READ8_MEMBER(mrgame_state::rsw_r) { return m_io_dsw0->read() | ((uint8_t)m_ack1 << 5) | ((uint8_t)m_ack2 << 4); } // this is like a keyboard, energise a row and read the column data -READ8_MEMBER( mrgame_state::col_r ) +READ8_MEMBER(mrgame_state::col_r) { if (m_row_data == 0) return m_io_x0->read(); @@ -246,17 +273,17 @@ READ8_MEMBER( mrgame_state::col_r ) return 0xff; } -WRITE8_MEMBER( mrgame_state::row_w ) +WRITE8_MEMBER(mrgame_state::row_w) { m_row_data = data & 7; } -READ8_MEMBER( mrgame_state::sound_r ) +READ8_MEMBER(mrgame_state::sound_r) { return m_sound_data; } -WRITE8_MEMBER( mrgame_state::sound_w ) +WRITE8_MEMBER(mrgame_state::sound_w) { m_sound_data = data; m_audiocpu1->set_input_line(INPUT_LINE_NMI, BIT(data, 7) ? CLEAR_LINE : ASSERT_LINE); @@ -264,56 +291,73 @@ WRITE8_MEMBER( mrgame_state::sound_w ) } // this produces 24 outputs from three driver chips to drive lamps & solenoids -WRITE8_MEMBER( mrgame_state::triple_w ) +WRITE8_MEMBER(mrgame_state::triple_w) { if ((data & 0x18)==0) m_ackv = BIT(data, 7); } -WRITE8_MEMBER( mrgame_state::video_w ) +WRITE8_MEMBER(mrgame_state::video_w) { m_video_data = data; } -WRITE8_MEMBER( mrgame_state::video_ctrl_w ) +WRITE_LINE_MEMBER(mrgame_state::video_a11_w) { - m_video_ctrl[offset] = data; + m_gfx_bank = (m_gfx_bank & 6) | (state ? 1 : 0); +} - if (offset == 0) - m_gfx_bank = (m_gfx_bank & 6) | BIT(data, 0); - else - if (offset == 3) - m_gfx_bank = (m_gfx_bank & 5) | (BIT(data, 0) << 1); - else - if (offset == 4) - m_gfx_bank = (m_gfx_bank & 3) | (BIT(data, 0) << 2); - else - if (offset == 6) - m_flip = BIT(data, 0); +WRITE_LINE_MEMBER(mrgame_state::video_a12_w) +{ + m_gfx_bank = (m_gfx_bank & 5) | (state ? 2 : 0); +} + +WRITE_LINE_MEMBER(mrgame_state::video_a13_w) +{ + m_gfx_bank = (m_gfx_bank & 3) | (state ? 4 : 0); +} + +WRITE_LINE_MEMBER(mrgame_state::intst_w) +{ + m_intst = state; + if (!state) + m_videocpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); +} + +WRITE_LINE_MEMBER(mrgame_state::nmi_intst_w) +{ + m_intst = state; + if (!state) + m_videocpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); } -WRITE8_MEMBER( mrgame_state::ack1_w ) +WRITE_LINE_MEMBER(mrgame_state::flip_w) +{ + m_flip = state; +} + +WRITE8_MEMBER(mrgame_state::ack1_w) { m_ack1 = BIT(data, 0); } -WRITE8_MEMBER( mrgame_state::ack2_w ) +WRITE8_MEMBER(mrgame_state::ack2_w) { m_ack2 = BIT(data, 0); } -READ8_MEMBER( mrgame_state::porta_r ) +READ8_MEMBER(mrgame_state::porta_r) { return m_video_data; } -WRITE8_MEMBER( mrgame_state::portb_w ) +WRITE8_MEMBER(mrgame_state::portb_w) { m_video_status = data; m_ackv = 0; } -READ8_MEMBER( mrgame_state::portc_r ) +READ8_MEMBER(mrgame_state::portc_r) { return m_io_dsw1->read() | ((uint8_t)m_ackv << 4); } @@ -341,9 +385,21 @@ void mrgame_state::init_mrgame() { } +WRITE_LINE_MEMBER(mrgame_state::vblank_int_w) +{ + if (state && m_intst) + m_videocpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE); +} + +WRITE_LINE_MEMBER(mrgame_state::vblank_nmi_w) +{ + if (state && m_intst) + m_videocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); +} + // This pulses the IRQ pins of both audio cpus. The schematic does not //show which 4040 output is used, so we have guessed. -TIMER_DEVICE_CALLBACK_MEMBER( mrgame_state::irq_timer ) +TIMER_DEVICE_CALLBACK_MEMBER(mrgame_state::irq_timer) { m_irq_state++; // pulse_line of IRQ not allowed, so trying this instead @@ -383,12 +439,12 @@ static const gfx_layout spritelayout = 32*8 }; -static GFXDECODE_START( gfx_mrgame ) - GFXDECODE_ENTRY( "chargen", 0, charlayout, 0, 16 ) - GFXDECODE_ENTRY( "chargen", 0, spritelayout, 0, 16 ) +static GFXDECODE_START(gfx_mrgame) + GFXDECODE_ENTRY("chargen", 0, charlayout, 0, 16) + GFXDECODE_ENTRY("chargen", 0, spritelayout, 0, 16) GFXDECODE_END -PALETTE_INIT_MEMBER( mrgame_state, mrgame) +PALETTE_INIT_MEMBER(mrgame_state, mrgame) { static const int resistances[3] = { 1000, 470, 220 }; double rweights[3], gweights[3], bweights[2]; @@ -479,31 +535,43 @@ uint32_t mrgame_state::screen_update_mrgame(screen_device &screen, bitmap_ind16 MACHINE_CONFIG_START(mrgame_state::mrgame) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68000, XTAL(6'000'000)) + MCFG_DEVICE_ADD("maincpu", M68000, 6_MHz_XTAL) MCFG_DEVICE_PROGRAM_MAP(main_map) MCFG_DEVICE_PERIODIC_INT_DRIVER(mrgame_state, irq1_line_hold, 183) - MCFG_DEVICE_ADD("videocpu", Z80, XTAL(18'432'000)/6) + + MCFG_DEVICE_ADD("videocpu", Z80, 18.432_MHz_XTAL / 6) MCFG_DEVICE_PROGRAM_MAP(video_map) - MCFG_DEVICE_VBLANK_INT_DRIVER("screen", mrgame_state, nmi_line_pulse) - MCFG_DEVICE_ADD("audiocpu1", Z80, XTAL(4'000'000)) + + MCFG_DEVICE_ADD("audiocpu1", Z80, 4_MHz_XTAL) MCFG_DEVICE_PROGRAM_MAP(audio1_map) MCFG_DEVICE_IO_MAP(audio1_io) - MCFG_DEVICE_ADD("audiocpu2", Z80, XTAL(4'000'000)) + + MCFG_DEVICE_ADD("audiocpu2", Z80, 4_MHz_XTAL) MCFG_DEVICE_PROGRAM_MAP(audio2_map) MCFG_DEVICE_IO_MAP(audio2_io) - MCFG_NVRAM_ADD_0FILL("nvram") + MCFG_NVRAM_ADD_0FILL("nvram") // 5564 (x2) + battery + + ls259_device &select(LS259(config, "selectlatch")); // 5B + select.q_out_cb<0>().set(FUNC(mrgame_state::video_a11_w)); + select.q_out_cb<1>().set(FUNC(mrgame_state::nmi_intst_w)); + select.q_out_cb<3>().set(FUNC(mrgame_state::video_a12_w)); + select.q_out_cb<4>().set(FUNC(mrgame_state::video_a13_w)); + select.q_out_cb<6>().set(FUNC(mrgame_state::flip_w)); + + //watchdog_timer_device &watchdog(WATCHDOG_TIMER(config, "watchdog")); // LS393 at 5D (video board) driven by VBLANK + //watchdog.set_vblank_count("screen", 8); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(50) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ - MCFG_SCREEN_SIZE(256, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 255, 8, 247) // If you align with X on test screen some info is chopped off + MCFG_SCREEN_RAW_PARAMS(18.432_MHz_XTAL / 3, 384, 0, 256, 264, 8, 248) // If you align with X on test screen some info is chopped off MCFG_SCREEN_UPDATE_DRIVER(mrgame_state, screen_update_mrgame) MCFG_SCREEN_PALETTE("palette") + MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, mrgame_state, vblank_nmi_w)) + MCFG_PALETTE_ADD("palette", 64) MCFG_PALETTE_INIT_OWNER(mrgame_state, mrgame) + MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mrgame) /* Sound */ @@ -530,6 +598,19 @@ MACHINE_CONFIG_START(mrgame_state::mrgame) MCFG_I8255_IN_PORTC_CB(READ8(*this, mrgame_state, portc_r)) MACHINE_CONFIG_END +MACHINE_CONFIG_START(mrgame_state::wcup90) + mrgame(config); + + MCFG_DEVICE_MODIFY("videocpu") + MCFG_DEVICE_PROGRAM_MAP(wcup90_video_map) + + MCFG_DEVICE_MODIFY("selectlatch") // U48 + MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, mrgame_state, intst_w)) + + MCFG_DEVICE_MODIFY("screen") + MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, mrgame_state, vblank_int_w)) +MACHINE_CONFIG_END + /*------------------------------------------------------------------- / Dakar (06/1988) /-------------------------------------------------------------------*/ @@ -538,14 +619,14 @@ ROM_START(dakar) ROM_LOAD16_BYTE("cpu_ic13.rom", 0x000001, 0x8000, CRC(83183929) SHA1(977ac10a1e78c759eb0550794f2639fe0e2d1507)) ROM_LOAD16_BYTE("cpu_ic14.rom", 0x000000, 0x8000, CRC(2010d28d) SHA1(d262dabd9298566df43df298cf71c974bee1434a)) - ROM_REGION(0x10000, "video", 0) - ROM_LOAD("vid_ic14.rom", 0x00000, 0x8000, CRC(88a9ca81) SHA1(9660d416b2b8f1937cda7bca51bd287641c7730c)) + ROM_REGION(0x8000, "video", 0) + ROM_LOAD("vid_ic14.rom", 0x0000, 0x8000, CRC(88a9ca81) SHA1(9660d416b2b8f1937cda7bca51bd287641c7730c)) - ROM_REGION( 0x10000, "chargen", 0 ) + ROM_REGION(0x10000, "chargen", 0) ROM_LOAD("vid_ic55.rom", 0x0000, 0x8000, CRC(3c68b448) SHA1(f416f00d2de0c71c021fec0e9702ba79b761d5e7)) ROM_LOAD("vid_ic56.rom", 0x8000, 0x8000, CRC(0aac43e9) SHA1(28edfeddb2d54e40425488bad37e3819e4488b0b)) - ROM_REGION( 0x0020, "proms", 0 ) + ROM_REGION(0x0020, "proms", 0) ROM_LOAD("vid_ic66.rom", 0x0000, 0x0020, CRC(c8269b27) SHA1(daa83bfdb1e255b846bbade7f200abeaa9399c06)) ROM_REGION(0x10000, "audio1", 0) @@ -568,14 +649,14 @@ ROM_START(motrshow) ROM_LOAD16_BYTE("cpu_ic13.rom", 0x000001, 0x8000, CRC(e862ca71) SHA1(b02e5f39f9427d58b70b7999a5ff6075beff05ae)) ROM_LOAD16_BYTE("cpu_ic14.rom", 0x000000, 0x8000, CRC(c898ae25) SHA1(f0e1369284a1e0f394f1d40281fd46252016602e)) - ROM_REGION(0x10000, "video", 0) - ROM_LOAD("vid_ic14.rom", 0x00000, 0x8000, CRC(1d4568e2) SHA1(bfc2bb59708ce3a09f9a1b3460ed8d5269840c97)) + ROM_REGION(0x8000, "video", 0) + ROM_LOAD("vid_ic14.rom", 0x0000, 0x8000, CRC(1d4568e2) SHA1(bfc2bb59708ce3a09f9a1b3460ed8d5269840c97)) - ROM_REGION( 0x10000, "chargen", 0 ) + ROM_REGION(0x10000, "chargen", 0) ROM_LOAD("vid_ic55.rom", 0x0000, 0x8000, CRC(c27a4ded) SHA1(9c2c9b17f1e71afb74bdfbdcbabb99ef935d32db)) ROM_LOAD("vid_ic56.rom", 0x8000, 0x8000, CRC(1664ec8d) SHA1(e7b15acdac7dfc51b668e908ca95f02a2b569737)) - ROM_REGION( 0x0020, "proms", 0 ) + ROM_REGION(0x0020, "proms", 0) ROM_LOAD("vid_ic66.rom", 0x0000, 0x0020, CRC(5b585252) SHA1(b88e56ebdce2c3a4b170aff4b05018e7c21a79b8)) ROM_REGION(0x10000, "audio1", 0) @@ -594,14 +675,14 @@ ROM_START(motrshowa) ROM_LOAD16_BYTE("cpuic13a.rom", 0x000001, 0x8000, CRC(2dbdd9d4) SHA1(b404814a4e83ead6da3c57818ae97f23d380f9da)) ROM_LOAD16_BYTE("cpuic14b.rom", 0x000000, 0x8000, CRC(0bd98fec) SHA1(b90a7e997db59740398003ba94a69118b1ee70af)) - ROM_REGION(0x10000, "video", 0) - ROM_LOAD("vid_ic14.rom", 0x00000, 0x8000, CRC(1d4568e2) SHA1(bfc2bb59708ce3a09f9a1b3460ed8d5269840c97)) + ROM_REGION(0x8000, "video", 0) + ROM_LOAD("vid_ic14.rom", 0x0000, 0x8000, CRC(1d4568e2) SHA1(bfc2bb59708ce3a09f9a1b3460ed8d5269840c97)) - ROM_REGION( 0x10000, "chargen", 0 ) + ROM_REGION(0x10000, "chargen", 0) ROM_LOAD("vid_ic55.rom", 0x0000, 0x8000, CRC(c27a4ded) SHA1(9c2c9b17f1e71afb74bdfbdcbabb99ef935d32db)) ROM_LOAD("vid_ic56.rom", 0x8000, 0x8000, CRC(1664ec8d) SHA1(e7b15acdac7dfc51b668e908ca95f02a2b569737)) - ROM_REGION( 0x0020, "proms", 0 ) + ROM_REGION(0x0020, "proms", 0) ROM_LOAD("vid_ic66.rom", 0x0000, 0x0020, CRC(5b585252) SHA1(b88e56ebdce2c3a4b170aff4b05018e7c21a79b8)) ROM_REGION(0x10000, "audio1", 0) @@ -623,17 +704,17 @@ ROM_START(macattck) ROM_LOAD16_BYTE("cpu_ic13.rom", 0x000001, 0x8000, NO_DUMP) ROM_LOAD16_BYTE("cpu_ic14.rom", 0x000000, 0x8000, NO_DUMP) - ROM_REGION(0x10000, "video", 0) - ROM_LOAD("vid_ic91.rom", 0x00000, 0x8000, CRC(42d2ba01) SHA1(c13d38c2798575760461912cef65dde57dfd938c)) + ROM_REGION(0x8000, "video", 0) + ROM_LOAD("vid_ic91.rom", 0x0000, 0x8000, CRC(42d2ba01) SHA1(c13d38c2798575760461912cef65dde57dfd938c)) - ROM_REGION( 0x30000, "chargen", 0 ) + ROM_REGION(0x30000, "chargen", 0) ROM_LOAD("vid_ic14.rom", 0x00000, 0x8000, CRC(f6e047fb) SHA1(6be712dda60257b9e7014315c8fee19812622bf6)) ROM_LOAD("vid_ic15.rom", 0x08000, 0x8000, CRC(405a8f54) SHA1(4d58915763db3c3be2bfc166be1a12285ff2c38b)) ROM_LOAD("vid_ic16.rom", 0x10000, 0x8000, CRC(063ea783) SHA1(385dbfcc8ecd3a784f9a8752d00e060b48d70d6a)) ROM_LOAD("vid_ic17.rom", 0x18000, 0x8000, CRC(9f95abf8) SHA1(d71cf36c8bf27ad41b2d3cebd0af620a34ce0062) BAD_DUMP) ROM_LOAD("vid_ic18.rom", 0x20000, 0x8000, CRC(83ef25f8) SHA1(bab482badb8646b099dbb197ca9af3a126b274e3)) - ROM_REGION( 0x0020, "proms", 0 ) + ROM_REGION(0x0020, "proms", 0) ROM_LOAD("vid_ic61.rom", 0x0000, 0x0020, CRC(538c72ae) SHA1(f704492568257fcc4a4f1189207c6fb6526eb81c) BAD_DUMP) ROM_REGION(0x10000, "audio1", 0) @@ -655,17 +736,17 @@ ROM_START(wcup90) ROM_LOAD16_BYTE("cpu_ic13.rom", 0x000001, 0x8000, CRC(0e2edfb0) SHA1(862fb1f6509fb1f560d0b2bb8a5764f64b259f04)) ROM_LOAD16_BYTE("cpu_ic14.rom", 0x000000, 0x8000, CRC(fdd03165) SHA1(6dc6e68197218f8808436098c26cd04fc3215b1c)) - ROM_REGION(0x10000, "video", 0) - ROM_LOAD("vid_ic91.rom", 0x00000, 0x8000, CRC(3287ad20) SHA1(d5a453efc7292670073f157dca04897be857b8ed)) + ROM_REGION(0x8000, "video", 0) + ROM_LOAD("vid_ic91.rom", 0x0000, 0x8000, CRC(3287ad20) SHA1(d5a453efc7292670073f157dca04897be857b8ed)) - ROM_REGION( 0x30000, "chargen", 0 ) + ROM_REGION(0x30000, "chargen", 0) ROM_LOAD("vid_ic14.rom", 0x00000, 0x8000, CRC(a101d562) SHA1(ad9ad3968f13169572ec60e22e84acf43382b51e)) ROM_LOAD("vid_ic15.rom", 0x08000, 0x8000, CRC(40791e7a) SHA1(788760b8527df48d1825be88099491b6e94f0a19)) ROM_LOAD("vid_ic16.rom", 0x10000, 0x8000, CRC(a7214157) SHA1(a4660180e8491a37028fec8533cf13daf839a7c4)) ROM_LOAD("vid_ic17.rom", 0x18000, 0x8000, CRC(caf4fb04) SHA1(81784a4dc7c671090cf39cafa7d34a6b34523168)) ROM_LOAD("vid_ic18.rom", 0x20000, 0x8000, CRC(83ad2a10) SHA1(37664e5872e6322ee6bb61ec9385876626598152)) - ROM_REGION( 0x0020, "proms", 0 ) + ROM_REGION(0x0020, "proms", 0) ROM_LOAD("vid_ic61.rom", 0x0000, 0x0020, CRC(538c72ae) SHA1(f704492568257fcc4a4f1189207c6fb6526eb81c)) ROM_REGION(0x10000, "audio1", 0) @@ -686,5 +767,5 @@ ROM_END GAME(1988, dakar, 0, mrgame, mrgame, mrgame_state, init_mrgame, ROT0, "Mr Game", "Dakar", MACHINE_MECHANICAL | MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND ) GAME(1989, motrshow, 0, mrgame, mrgame, mrgame_state, init_mrgame, ROT0, "Mr Game", "Motor Show (set 1)", MACHINE_MECHANICAL | MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND ) GAME(1989, motrshowa, motrshow, mrgame, mrgame, mrgame_state, init_mrgame, ROT0, "Mr Game", "Motor Show (set 2)", MACHINE_MECHANICAL | MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND ) -GAME(1990, macattck, 0, mrgame, mrgame, mrgame_state, init_mrgame, ROT0, "Mr Game", "Mac Attack", MACHINE_IS_SKELETON_MECHANICAL) -GAME(1990, wcup90, 0, mrgame, mrgame, mrgame_state, init_mrgame, ROT0, "Mr Game", "World Cup 90", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1990, macattck, 0, wcup90, mrgame, mrgame_state, init_mrgame, ROT0, "Mr Game", "Mac Attack", MACHINE_IS_SKELETON_MECHANICAL) +GAME(1990, wcup90, 0, wcup90, mrgame, mrgame_state, init_mrgame, ROT0, "Mr Game", "World Cup 90", MACHINE_MECHANICAL | MACHINE_NOT_WORKING | MACHINE_IMPERFECT_SOUND | MACHINE_IMPERFECT_GRAPHICS ) -- cgit v1.2.3 From c295fc4daaef3a4d33a3cd1b2792c49695200eb0 Mon Sep 17 00:00:00 2001 From: Robbbert Date: Mon, 30 Jul 2018 00:20:28 +1000 Subject: (nw) jgz80 is not... renamed to unkz80 (unknown manufacturer). --- scripts/target/mame/mess.lua | 2 +- src/mame/drivers/jade.cpp | 102 ------------------------------------------ src/mame/drivers/unkz80.cpp | 103 +++++++++++++++++++++++++++++++++++++++++++ src/mame/mame.lst | 6 +-- src/mame/mess.flt | 2 +- 5 files changed, 108 insertions(+), 107 deletions(-) delete mode 100644 src/mame/drivers/jade.cpp create mode 100644 src/mame/drivers/unkz80.cpp diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index 8c24fcadf41..3d36a02c25c 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -3671,7 +3671,6 @@ files { MAME_DIR .. "src/mame/drivers/imsai.cpp", MAME_DIR .. "src/mame/drivers/indiana.cpp", MAME_DIR .. "src/mame/drivers/itt3030.cpp", - MAME_DIR .. "src/mame/drivers/jade.cpp", MAME_DIR .. "src/mame/drivers/jonos.cpp", MAME_DIR .. "src/mame/drivers/konin.cpp", MAME_DIR .. "src/mame/drivers/kron.cpp", @@ -3766,6 +3765,7 @@ files { MAME_DIR .. "src/mame/drivers/tsispch.cpp", MAME_DIR .. "src/mame/includes/tsispch.h", MAME_DIR .. "src/mame/drivers/tti.cpp", + MAME_DIR .. "src/mame/drivers/unkz80.cpp", MAME_DIR .. "src/mame/drivers/unistar.cpp", MAME_DIR .. "src/mame/drivers/v6809.cpp", MAME_DIR .. "src/mame/drivers/vector4.cpp", diff --git a/src/mame/drivers/jade.cpp b/src/mame/drivers/jade.cpp deleted file mode 100644 index 41e619fb7a6..00000000000 --- a/src/mame/drivers/jade.cpp +++ /dev/null @@ -1,102 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Robbbert -/*************************************************************************** - - Jade JGZ80 (with Serial Parallel Interrupt Controller) - - Single board Z80 computer on a S100 card. - The SPIO board adds four CTCs, two SIOs and one PIO. - - 2013-09-12 Skeleton driver. - - No info found as yet. - - It takes about 8 seconds to start up. - Type HE to get a list of commands. - -****************************************************************************/ - -#include "emu.h" -#include "cpu/z80/z80.h" -#include "machine/clock.h" -#include "machine/z80ctc.h" -#include "machine/z80sio.h" -#include "bus/rs232/rs232.h" -//#include "bus/s100/s100.h" - - -class jade_state : public driver_device -{ -public: - jade_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - { } - - void jade(machine_config &config); - -private: - void io_map(address_map &map); - void mem_map(address_map &map); - - required_device m_maincpu; -}; - - -void jade_state::mem_map(address_map &map) -{ - map.unmap_value_high(); - map(0x0000, 0x07ff).rom().region("roms", 0); - map(0x0800, 0xffff).ram(); -} - -void jade_state::io_map(address_map &map) -{ - map.unmap_value_high(); - map.global_mask(0xff); - map(0x28, 0x2b).rw("ctc2", FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); - map(0x30, 0x33).rw("sio", FUNC(z80sio_device::cd_ba_r), FUNC(z80sio_device::cd_ba_w)); - map(0x40, 0x43).rw("ctc1", FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); -} - -/* Input ports */ -static INPUT_PORTS_START( jade ) -INPUT_PORTS_END - - -MACHINE_CONFIG_START(jade_state::jade) - /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu",Z80, XTAL(4'000'000)) - MCFG_DEVICE_PROGRAM_MAP(mem_map) - MCFG_DEVICE_IO_MAP(io_map) - - Z80CTC(config, "ctc1", 4_MHz_XTAL); - - z80ctc_device &ctc2(Z80CTC(config, "ctc2", 4_MHz_XTAL)); - ctc2.zc_callback<0>().set("sio", FUNC(z80sio_device::rxca_w)); - ctc2.zc_callback<0>().append("sio", FUNC(z80sio_device::txca_w)); - - CLOCK(config, "trg0", 4_MHz_XTAL / 2).signal_handler().set("ctc2", FUNC(z80ctc_device::trg0)); - - /* Devices */ - MCFG_DEVICE_ADD("sio", Z80SIO, XTAL(4'000'000)) - //MCFG_Z80SIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) // no evidence of a daisy chain because IM2 is not set - MCFG_Z80SIO_OUT_TXDA_CB(WRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_Z80SIO_OUT_DTRA_CB(WRITELINE("rs232", rs232_port_device, write_dtr)) - MCFG_Z80SIO_OUT_RTSA_CB(WRITELINE("rs232", rs232_port_device, write_rts)) - - MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(WRITELINE("sio", z80sio_device, rxa_w)) - MCFG_RS232_CTS_HANDLER(WRITELINE("sio", z80sio_device, ctsa_w)) -MACHINE_CONFIG_END - -/* ROM definition */ -ROM_START( jgz80 ) - ROM_REGION( 0x800, "roms", 0 ) - ROM_LOAD( "jgz80.rom", 0x0000, 0x0800, CRC(90c4a1ef) SHA1(8a93a11051cc27f3edca24f0f4297ebe0099964e) ) -ROM_END - -/* Driver */ - -// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS -COMP( 1983, jgz80, 0, 0, jade, jade, jade_state, empty_init, "Jade Computer Products", "JGZ80", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/drivers/unkz80.cpp b/src/mame/drivers/unkz80.cpp new file mode 100644 index 00000000000..0b44b8f0f15 --- /dev/null +++ b/src/mame/drivers/unkz80.cpp @@ -0,0 +1,103 @@ +// license:BSD-3-Clause +// copyright-holders:Robbbert +/*************************************************************************** + +Unknown Z80 (with Serial Parallel Interrupt Controller) + +Single board Z80 computer on a S100 card. +The SPIO board adds four CTCs, two SIOs and one PIO. + +2013-09-12 Skeleton driver. + +No info found as yet. + +It should display P-Mon 4b 08/29/83 SPIC, then pause a bit, +then show a # prompt. Type HE to get a list of commands. + +Currently does nothing due to a SIO regression. + +****************************************************************************/ + +#include "emu.h" +#include "cpu/z80/z80.h" +#include "machine/clock.h" +#include "machine/z80ctc.h" +#include "machine/z80sio.h" +#include "bus/rs232/rs232.h" +//#include "bus/s100/s100.h" + + +class unkz80_state : public driver_device +{ +public: + unkz80_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + { } + + void unkz80(machine_config &config); + +private: + void io_map(address_map &map); + void mem_map(address_map &map); + + required_device m_maincpu; +}; + + +void unkz80_state::mem_map(address_map &map) +{ + map.unmap_value_high(); + map(0x0000, 0x07ff).rom().region("roms", 0); + map(0x0800, 0xffff).ram(); +} + +void unkz80_state::io_map(address_map &map) +{ + map.unmap_value_high(); + map.global_mask(0xff); + map(0x28, 0x2b).rw("ctc2", FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); + map(0x30, 0x33).rw("sio", FUNC(z80sio_device::cd_ba_r), FUNC(z80sio_device::cd_ba_w)); + map(0x40, 0x43).rw("ctc1", FUNC(z80ctc_device::read), FUNC(z80ctc_device::write)); +} + +/* Input ports */ +static INPUT_PORTS_START( unkz80 ) +INPUT_PORTS_END + + +MACHINE_CONFIG_START(unkz80_state::unkz80) + /* basic machine hardware */ + MCFG_DEVICE_ADD("maincpu",Z80, 4_MHz_XTAL) + MCFG_DEVICE_PROGRAM_MAP(mem_map) + MCFG_DEVICE_IO_MAP(io_map) + + Z80CTC(config, "ctc1", 4_MHz_XTAL); + + z80ctc_device &ctc2(Z80CTC(config, "ctc2", 4_MHz_XTAL)); + ctc2.zc_callback<0>().set("sio", FUNC(z80sio_device::rxca_w)); + ctc2.zc_callback<0>().append("sio", FUNC(z80sio_device::txca_w)); + + CLOCK(config, "trg0", 4_MHz_XTAL / 2).signal_handler().set("ctc2", FUNC(z80ctc_device::trg0)); + + /* Devices */ + MCFG_DEVICE_ADD("sio", Z80SIO, 4_MHz_XTAL) + MCFG_Z80SIO_OUT_TXDA_CB(WRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_Z80SIO_OUT_DTRA_CB(WRITELINE("rs232", rs232_port_device, write_dtr)) + MCFG_Z80SIO_OUT_RTSA_CB(WRITELINE("rs232", rs232_port_device, write_rts)) + + MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, "terminal") + MCFG_RS232_RXD_HANDLER(WRITELINE("sio", z80sio_device, rxa_w)) + MCFG_RS232_CTS_HANDLER(WRITELINE("sio", z80sio_device, ctsa_w)) +MACHINE_CONFIG_END + +/* ROM definition */ +ROM_START( unkz80 ) + ROM_REGION( 0x800, "roms", 0 ) + ROM_LOAD( "unkz80.rom", 0x0000, 0x0800, CRC(90c4a1ef) SHA1(8a93a11051cc27f3edca24f0f4297ebe0099964e) ) +ROM_END + +/* Driver */ + +// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS +COMP( 1983, unkz80, 0, 0, unkz80, unkz80, unkz80_state, empty_init, "", "Unknown Z80 computer", MACHINE_NOT_WORKING | MACHINE_NO_SOUND_HW ) diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 867b6da3793..53342be3015 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -15826,9 +15826,6 @@ jackie // (c) 1993 IGS @source:jackpool.cpp jackpool // (c) 1997 Electronic Projects -@source:jade.cpp -jgz80 // Jade JGZ-80 - @source:jaguar.cpp a51mxr3k // ?? (c) 1998 a51mxr3ka // ?? (c) 1998 @@ -37853,6 +37850,9 @@ uts20 // @source:unkhorse.cpp unkhorse // +@source:unkz80.cpp +unkz80 // Unknown + @source:upscope.cpp upscope // (c) 1986 Grand products diff --git a/src/mame/mess.flt b/src/mame/mess.flt index f022750873e..90f375d1471 100644 --- a/src/mame/mess.flt +++ b/src/mame/mess.flt @@ -327,7 +327,6 @@ isbc8010.cpp isbc8030.cpp iskr103x.cpp itt3030.cpp -jade.cpp jonos.cpp jr100.cpp jr200.cpp @@ -748,6 +747,7 @@ tvc.cpp tvgame.cpp tx0.cpp uknc.cpp +unkz80.cpp unichamp.cpp unior.cpp unistar.cpp -- cgit v1.2.3 From c41cf669b80547f3b7a808ceec02cb12ba237fad Mon Sep 17 00:00:00 2001 From: smf- Date: Sun, 29 Jul 2018 15:54:34 +0100 Subject: Revert part of 20b5f5d0e6f73b9ce6fffa4fc5dbe3f2b83d2a27 --- src/emu/schedule.cpp | 51 +++++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/src/emu/schedule.cpp b/src/emu/schedule.cpp index ba6c5e79302..d281446d6c6 100644 --- a/src/emu/schedule.cpp +++ b/src/emu/schedule.cpp @@ -452,12 +452,7 @@ void device_scheduler::timeslice() { // only process if this CPU is executing or truly halted (not yielding) // and if our target is later than the CPU's current time (coarse check) - if (exec->m_suspend != 0) - { - if (exec->m_eatcycles) - exec->m_localtime = target; - } - else if (target.seconds() >= exec->m_localtime.seconds()) + if (EXPECTED((exec->m_suspend == 0 || exec->m_eatcycles) && target.seconds() >= exec->m_localtime.seconds())) { // compute how many attoseconds to execute this CPU attoseconds_t delta = target.attoseconds() - exec->m_localtime.attoseconds(); @@ -472,29 +467,33 @@ void device_scheduler::timeslice() int ran = exec->m_cycles_running = divu_64x32(u64(delta) >> exec->m_divshift, exec->m_divisor); LOG((" cpu '%s': %d (%d cycles)\n", exec->device().tag(), delta, exec->m_cycles_running)); - g_profiler.start(exec->m_profiler); - - // note that this global variable cycles_stolen can be modified - // via the call to cpu_execute - exec->m_cycles_stolen = 0; - m_executing_device = exec; - *exec->m_icountptr = exec->m_cycles_running; - if (!call_debugger) - exec->run(); - else + // if we're not suspended, actually execute + if (exec->m_suspend == 0) { - exec->debugger_start_cpu_hook(target); - exec->run(); - exec->debugger_stop_cpu_hook(); + g_profiler.start(exec->m_profiler); + + // note that this global variable cycles_stolen can be modified + // via the call to cpu_execute + exec->m_cycles_stolen = 0; + m_executing_device = exec; + *exec->m_icountptr = exec->m_cycles_running; + if (!call_debugger) + exec->run(); + else + { + exec->debugger_start_cpu_hook(target); + exec->run(); + exec->debugger_stop_cpu_hook(); + } + + // adjust for any cycles we took back + assert(ran >= *exec->m_icountptr); + ran -= *exec->m_icountptr; + assert(ran >= exec->m_cycles_stolen); + ran -= exec->m_cycles_stolen; + g_profiler.stop(); } - // adjust for any cycles we took back - assert(ran >= *exec->m_icountptr); - ran -= *exec->m_icountptr; - assert(ran >= exec->m_cycles_stolen); - ran -= exec->m_cycles_stolen; - g_profiler.stop(); - // account for these cycles exec->m_totalcycles += ran; -- cgit v1.2.3 From c70d3cf470f805a751799a3dd77870a2dff826ae Mon Sep 17 00:00:00 2001 From: smf- Date: Sun, 29 Jul 2018 16:01:42 +0100 Subject: don't try to update m_totalcycles on devices with a zero clock, as it will crash. (nw) --- src/emu/schedule.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/emu/schedule.cpp b/src/emu/schedule.cpp index d281446d6c6..e2b1497995f 100644 --- a/src/emu/schedule.cpp +++ b/src/emu/schedule.cpp @@ -460,8 +460,12 @@ void device_scheduler::timeslice() delta += ATTOSECONDS_PER_SECOND; assert(delta == (target - exec->m_localtime).as_attoseconds()); + if (exec->m_attoseconds_per_cycle == 0) + { + exec->m_localtime = target; + } // if we have enough for at least 1 cycle, do the math - if (delta >= exec->m_attoseconds_per_cycle) + else if (delta >= exec->m_attoseconds_per_cycle) { // compute how many cycles we want to execute int ran = exec->m_cycles_running = divu_64x32(u64(delta) >> exec->m_divshift, exec->m_divisor); -- cgit v1.2.3 From 2f5417581fb38f76fa20aec53aae4949e391de2f Mon Sep 17 00:00:00 2001 From: Scott Stone Date: Sun, 29 Jul 2018 14:52:11 -0400 Subject: Partial fix for MT#7058 regarding Non-functioning shifter in buggyboy. buggyboyjr still is not fixed (nw) --- src/mame/layout/buggyboy.lay | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mame/layout/buggyboy.lay b/src/mame/layout/buggyboy.lay index 2a19cad8797..c59643e47c1 100644 --- a/src/mame/layout/buggyboy.lay +++ b/src/mame/layout/buggyboy.lay @@ -59,7 +59,7 @@ - + @@ -76,7 +76,7 @@ - + @@ -87,7 +87,7 @@ - + @@ -98,7 +98,7 @@ - + -- cgit v1.2.3 From 700e81c62f30947659c4e54676743595370cb253 Mon Sep 17 00:00:00 2001 From: Justin Kerk Date: Sun, 29 Jul 2018 14:36:56 -0700 Subject: New working software list additions ----------------------------------- ibm5170: ABS Self Running Demo, Disney's The Lion King, Disney's The Lion King (Playable Demo), Microsoft Productivity Pack for Windows, Microsoft Works 3.0b, NETCOM NetCruiser [Justin Kerk] New not working software list additions ----------------------------------- ibm5170: Mitsumi IDE CD-ROM Driver [Justin Kerk] --- hash/ibm5170.xml | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 117 insertions(+), 1 deletion(-) diff --git a/hash/ibm5170.xml b/hash/ibm5170.xml index 2d84e374483..3e769666d49 100644 --- a/hash/ibm5170.xml +++ b/hash/ibm5170.xml @@ -2539,7 +2539,7 @@ - + MS-DOS (Version 6.22, Thai) 1994 Microsoft @@ -4794,6 +4794,19 @@ + + + Mitsumi IDE CD-ROM Driver + 1994 + Mitsumi + + + + + + + + Mitsumi Mouse Driver @@ -5163,6 +5176,18 @@ + + ABS Self Running Demo + 1995 + American Business Solutions + + + + + + + + Acer/Win Supplement @@ -5840,6 +5865,52 @@ + + + Microsoft Productivity Pack for Windows + 1992 + Microsoft + + + + + + + + + + + + + + + + Microsoft Works 3.0b + 1994 + Microsoft + + + + + + + + + + + + + + + + + + + + + + + MikroBITTI Huvi- ja hyötylevyke 1995 (Fin) 1995 @@ -5862,6 +5933,19 @@ + + + NETCOM NetCruiser + 1994 + NETCOM + + + + + + + + Paradox 3.01 (German) @@ -8259,6 +8343,38 @@ + + Disney's The Lion King + 1994 + Virgin Interactive Entertainment, Inc. + + + + + + + + + + + + + + + + + + + Disney's The Lion King (Playable Demo) + 1994 + Virgin Interactive Entertainment + + + + + + + Dogz, Your Computer Pet 1995 -- cgit v1.2.3 From 3a502b10904e711856fd4e909984f3e2c640201c Mon Sep 17 00:00:00 2001 From: smf- Date: Sun, 29 Jul 2018 23:40:43 +0100 Subject: vgmplay added Y8950, YMF262 & YMF278B [smf] --- src/devices/sound/8950intf.cpp | 10 + src/devices/sound/8950intf.h | 1 + src/devices/sound/fmopl.cpp | 5 + src/devices/sound/fmopl.h | 1 + src/devices/sound/ymf262.cpp | 2 +- src/devices/sound/ymf278b.cpp | 5 +- src/mame/drivers/vgmplay.cpp | 880 +++++++++++++++++++++++++++-------------- src/mame/layout/vgmplay.lay | 12 + 8 files changed, 615 insertions(+), 301 deletions(-) diff --git a/src/devices/sound/8950intf.cpp b/src/devices/sound/8950intf.cpp index a6f8be7aa2b..da0049f0a91 100644 --- a/src/devices/sound/8950intf.cpp +++ b/src/devices/sound/8950intf.cpp @@ -100,6 +100,16 @@ void y8950_device::device_start() m_timer[1] = timer_alloc(1); } +//------------------------------------------------- +// device_clock_changed +//------------------------------------------------- + +void y8950_device::device_clock_changed() +{ + m_stream->set_sample_rate(clock() / 72); + y8950_clock_changed(m_chip, clock(), clock() / 72); +} + //------------------------------------------------- // device_stop - device-specific stop //------------------------------------------------- diff --git a/src/devices/sound/8950intf.h b/src/devices/sound/8950intf.h index 83aad8781c0..c1f3163a9ee 100644 --- a/src/devices/sound/8950intf.h +++ b/src/devices/sound/8950intf.h @@ -44,6 +44,7 @@ public: protected: // device-level overrides virtual void device_start() override; + virtual void device_clock_changed() override; virtual void device_stop() override; virtual void device_reset() override; diff --git a/src/devices/sound/fmopl.cpp b/src/devices/sound/fmopl.cpp index dbcd3429128..c7390842710 100644 --- a/src/devices/sound/fmopl.cpp +++ b/src/devices/sound/fmopl.cpp @@ -2408,6 +2408,11 @@ static void Y8950_deltat_status_reset(void *chip, uint8_t changebits) Y8950->STATUS_RESET(changebits); } +void y8950_clock_changed(void *chip, uint32_t clock, uint32_t rate) +{ + reinterpret_cast(chip)->clock_changed(clock, rate); +} + void *y8950_init(device_t *device, uint32_t clock, uint32_t rate) { /* emulator create */ diff --git a/src/devices/sound/fmopl.h b/src/devices/sound/fmopl.h index c5366d7badb..5da3f110830 100644 --- a/src/devices/sound/fmopl.h +++ b/src/devices/sound/fmopl.h @@ -92,6 +92,7 @@ void y8950_set_keyboard_handler(void *chip, OPL_PORTHANDLER_W KeyboardHandler_w, void y8950_set_delta_t_memory(void *chip, void * deltat_mem_ptr, int deltat_mem_size ); void * y8950_init(device_t *device, uint32_t clock, uint32_t rate); +void y8950_clock_changed(void *chip, uint32_t clock, uint32_t rate); void y8950_shutdown(void *chip); void y8950_reset_chip(void *chip); int y8950_write(void *chip, int a, int v); diff --git a/src/devices/sound/ymf262.cpp b/src/devices/sound/ymf262.cpp index 666e377d5a8..280168ef4c1 100644 --- a/src/devices/sound/ymf262.cpp +++ b/src/devices/sound/ymf262.cpp @@ -1351,7 +1351,7 @@ static void OPL3_initalize(OPL3 *chip) /* logerror("YMF262: freqbase=%f\n", chip->freqbase); */ /* Timer base time */ - chip->TimerBase = attotime::from_hz(chip->clock) * (8*36); + chip->TimerBase = chip->clock ? attotime::from_hz(chip->clock) * (8 * 36) : attotime::zero; /* make fnumber -> increment counter table */ for( i=0 ; i < 1024 ; i++ ) diff --git a/src/devices/sound/ymf278b.cpp b/src/devices/sound/ymf278b.cpp index e0e0dae40d2..18451d71732 100644 --- a/src/devices/sound/ymf278b.cpp +++ b/src/devices/sound/ymf278b.cpp @@ -853,6 +853,9 @@ void ymf278b_device::device_clock_changed() { m_stream->set_sample_rate(clock()/768); + m_clock = clock(); + m_timer_base = m_clock ? attotime::from_hz(m_clock) * (19 * 36) : attotime::zero; + // YMF262 related int ymf262_clock = clock() / (19/8.0); @@ -968,7 +971,7 @@ void ymf278b_device::device_start() m_clock = clock(); m_irq_handler.resolve(); - m_timer_base = attotime::from_hz(m_clock) * (19*36); + m_timer_base = m_clock ? attotime::from_hz(m_clock) * (19*36) : attotime::zero; m_timer_a = timer_alloc(TIMER_A); m_timer_b = timer_alloc(TIMER_B); m_timer_busy = timer_alloc(TIMER_BUSY_CLEAR); diff --git a/src/mame/drivers/vgmplay.cpp b/src/mame/drivers/vgmplay.cpp index df1744f8543..4fa28ac9300 100644 --- a/src/mame/drivers/vgmplay.cpp +++ b/src/mame/drivers/vgmplay.cpp @@ -16,9 +16,11 @@ #include "sound/2608intf.h" #include "sound/2610intf.h" #include "sound/2612intf.h" +#include "sound/262intf.h" #include "sound/3526intf.h" #include "sound/3812intf.h" #include "sound/ay8910.h" +#include "sound/8950intf.h" #include "sound/c352.h" #include "sound/c6280.h" #include "sound/gb.h" @@ -37,6 +39,7 @@ #include "sound/ym2151.h" #include "sound/ym2413.h" #include "sound/ymf271.h" +#include "sound/ymf278b.h" #include "sound/ymz280b.h" #include "vgmplay.lh" @@ -69,16 +72,22 @@ public: enum io8_t { REG_SIZE = 0x00000000, - A_YM2612 = 0x00000010, - A_YM2151 = 0x00000020, - A_YM2413 = 0x00000030, - A_YM2203A = 0x00000040, - A_YM2203B = 0x00000050, - A_YM3526 = 0x00000060, - A_YM3812 = 0x00000070, + A_YM2612_0 = 0x00000010, + A_YM2612_1 = 0x00000018, + A_YM2151_0 = 0x00000020, + A_YM2151_1 = 0x00000028, + A_YM2413_0 = 0x00000030, + A_YM2413_1 = 0x00000038, + A_YM2203_0 = 0x00000040, + A_YM2203_1 = 0x00000050, + A_YM3526_0 = 0x00000060, + A_YM3526_1 = 0x00000068, + A_YM3812_0 = 0x00000070, + A_YM3812_1 = 0x00000078, A_AY8910A = 0x00000080, A_AY8910B = 0x00000090, - A_SN76496 = 0x000000a0, + A_SN76496_0 = 0x000000a0, + A_SN76496_1 = 0x000000a8, A_K053260 = 0x000000b0, A_C6280 = 0x000000e0, A_OKIM6295A = 0x000000f0, @@ -91,10 +100,20 @@ public: A_MULTIPCMB = 0x00013010, A_POKEYA = 0x00013020, A_POKEYB = 0x00013030, - A_YMF271 = 0x00013040, - A_YMZ280B = 0x00013050, - A_YM2608 = 0x00013060, - A_YM2610 = 0x00013070, + A_YM2608_0 = 0x00013060, + A_YM2608_1 = 0x00013068, + A_YM2610_0 = 0x00013070, + A_YM2610_1 = 0x00013078, + A_Y8950_0 = 0x00013080, + A_Y8950_1 = 0x00013088, + A_YMF262_0 = 0x00013090, + A_YMF262_1 = 0x00013098, + A_YMF278B_0 = 0x000130a0, + A_YMF278B_1 = 0x000130b0, + A_YMF271_0 = 0x000130c0, + A_YMF271_1 = 0x000130d0, + A_YMZ280B_0 = 0x000130e0, + A_YMZ280B_1 = 0x000130f0, A_K054539A = 0x00013400, A_K054539B = 0x00013800, A_QSOUND = 0x00013c00, @@ -128,17 +147,18 @@ public: virtual std::unique_ptr create_disassembler() override; - DECLARE_READ8_MEMBER(segapcm_rom_r); - DECLARE_READ8_MEMBER(ymf271_rom_r); - DECLARE_READ8_MEMBER(ymz280b_rom_r); + template DECLARE_READ8_MEMBER(segapcm_rom_r); + template DECLARE_READ8_MEMBER(ymf278b_rom_r); + template DECLARE_READ8_MEMBER(ymf271_rom_r); + template DECLARE_READ8_MEMBER(ymz280b_rom_r); template DECLARE_READ8_MEMBER(multipcm_rom_r); - DECLARE_READ8_MEMBER(k053260_rom_r); + template DECLARE_READ8_MEMBER(k053260_rom_r); template DECLARE_READ8_MEMBER(okim6295_rom_r); template DECLARE_READ8_MEMBER(k054539_rom_r); - DECLARE_READ8_MEMBER(c352_rom_r); - DECLARE_READ8_MEMBER(qsound_rom_r); - DECLARE_READ8_MEMBER(ga20_rom_r); - DECLARE_READ8_MEMBER(x1_010_rom_r); + template DECLARE_READ8_MEMBER(c352_rom_r); + template DECLARE_READ8_MEMBER(qsound_rom_r); + template DECLARE_READ8_MEMBER(ga20_rom_r); + template DECLARE_READ8_MEMBER(x1_010_rom_r); template DECLARE_WRITE8_MEMBER(multipcm_bank_hi_w); template DECLARE_WRITE8_MEMBER(multipcm_bank_lo_w); @@ -202,6 +222,9 @@ private: LED_X1_010, LED_YM2610, + LED_Y8950, + LED_YMF262, + LED_YMF278B, LED_COUNT }; @@ -288,43 +311,50 @@ public: DECLARE_WRITE8_MEMBER(scc_w); void vgmplay(machine_config &config); - void c352_map(address_map &map); void file_map(address_map &map); - void ga20_map(address_map &map); - void h6280_io_map(address_map &map); - void h6280_map(address_map &map); - void k053260_map(address_map &map); - void k054539a_map(address_map &map); - void k054539b_map(address_map &map); - void multipcma_map(address_map &map); - void multipcmb_map(address_map &map); - void nescpu_map(address_map &map); - void okim6295a_map(address_map &map); - void okim6295b_map(address_map &map); - void qsound_map(address_map &map); - void rf5c68_map(address_map &map); - void rf5c164_map(address_map &map); - void segapcm_map(address_map &map); void soundchips16_map(address_map &map); void soundchips_map(address_map &map); - void x1_010_map(address_map &map); - void ymf271_map(address_map &map); - void ymz280b_map(address_map &map); + template void segapcm_map(address_map &map); + template void ymf278b_map(address_map &map); + template void ymf271_map(address_map &map); + template void ymz280b_map(address_map &map); + template void c352_map(address_map &map); + template void ga20_map(address_map &map); + template void h6280_io_map(address_map &map); + template void h6280_map(address_map &map); + template void k053260_map(address_map &map); + template void k054539_map(address_map &map); + template void multipcm_map(address_map &map); + template void nescpu_map(address_map &map); + template void okim6295_map(address_map &map); + template void qsound_map(address_map &map); + template void rf5c68_map(address_map &map); + template void rf5c164_map(address_map &map); + template void x1_010_map(address_map &map); private: std::vector m_file_data; required_device m_vgmplay; required_device m_lspeaker; required_device m_rspeaker; - required_device m_ym2612; - required_device m_ym2151; - required_device m_ym2413; + required_device_array m_sn76496; + required_device_array m_ym2413; + required_device_array m_ym2612; + required_device_array m_ym2151; + required_device m_segapcm; + required_device m_rf5c68; + required_shared_ptr m_rf5c68_ram; required_device_array m_ym2203; - required_device m_ym3526; - required_device m_ym3812; + required_device_array m_ym2608; + required_device_array m_ym2610; + required_device_array m_ym3812; + required_device_array m_ym3526; + required_device_array m_y8950; + required_device_array m_ymf262; + required_device_array m_ymf278b; + required_device_array m_ymf271; + required_device_array m_ymz280b; required_device_array m_ay8910; - required_device m_sn76496; - required_device m_segapcm; required_device_array m_multipcm; required_device m_dmg; required_device m_nescpu; @@ -336,16 +366,10 @@ private: required_device_array m_pokey; required_device m_c352; required_device_array m_okim6295; - required_device m_ymf271; - required_device m_ymz280b; - required_device m_ym2608; - required_device m_ym2610; required_device m_qsound; required_device m_k051649; required_device m_ga20; - required_device m_rf5c68; required_device m_rf5c164; // TODO : !!RF5C164!! - required_shared_ptr m_rf5c68_ram; required_shared_ptr m_rf5c164_ram; required_device m_x1_010; @@ -578,94 +602,108 @@ void vgmplay_device::execute_run() debugger_instruction_hook(m_pc); uint8_t code = m_file->read_byte(m_pc); switch(code) { + case 0x30: + pulse_act_led(LED_SN76496); + m_io->write_byte(A_SN76496_1 + 0, m_file->read_byte(m_pc + 1)); + m_pc += 2; + break; + + case 0x3f: + pulse_act_led(LED_SN76496); + m_io->write_byte(A_SN76496_1 + 1, m_file->read_byte(m_pc + 1)); + m_pc += 2; + break; + case 0x4f: pulse_act_led(LED_SN76496); - m_io->write_byte(A_SN76496+0, m_file->read_byte(m_pc+1)); + m_io->write_byte(A_SN76496_0 + 1, m_file->read_byte(m_pc + 1)); m_pc += 2; break; case 0x50: pulse_act_led(LED_SN76496); - m_io->write_byte(A_SN76496+1, m_file->read_byte(m_pc+1)); + m_io->write_byte(A_SN76496_0 + 0, m_file->read_byte(m_pc + 1)); m_pc += 2; break; case 0x51: pulse_act_led(LED_YM2413); - m_io->write_byte(A_YM2413+0, m_file->read_byte(m_pc+1)); - m_io->write_byte(A_YM2413+1, m_file->read_byte(m_pc+2)); + m_io->write_byte(A_YM2413_0 + 0, m_file->read_byte(m_pc + 1)); + m_io->write_byte(A_YM2413_0 + 1, m_file->read_byte(m_pc + 2)); m_pc += 3; break; case 0x52: - pulse_act_led(LED_YM2612); - m_io->write_byte(A_YM2612+0, m_file->read_byte(m_pc+1)); - m_io->write_byte(A_YM2612+1, m_file->read_byte(m_pc+2)); - m_pc += 3; - break; - case 0x53: pulse_act_led(LED_YM2612); - m_io->write_byte(A_YM2612+2, m_file->read_byte(m_pc+1)); - m_io->write_byte(A_YM2612+3, m_file->read_byte(m_pc+2)); + m_io->write_byte(A_YM2612_0 + 0 + ((code & 1) << 1), m_file->read_byte(m_pc + 1)); + m_io->write_byte(A_YM2612_0 + 1 + ((code & 1) << 1), m_file->read_byte(m_pc + 2)); m_pc += 3; break; case 0x54: pulse_act_led(LED_YM2151); - m_io->write_byte(A_YM2151+0, m_file->read_byte(m_pc+1)); - m_io->write_byte(A_YM2151+1, m_file->read_byte(m_pc+2)); + m_io->write_byte(A_YM2151_0 + 0, m_file->read_byte(m_pc + 1)); + m_io->write_byte(A_YM2151_0 + 1, m_file->read_byte(m_pc + 2)); m_pc += 3; break; case 0x55: pulse_act_led(LED_YM2203); - m_io->write_byte(A_YM2203A+0, m_file->read_byte(m_pc+1)); - m_io->write_byte(A_YM2203A+1, m_file->read_byte(m_pc+2)); + m_io->write_byte(A_YM2203_0 + 0, m_file->read_byte(m_pc + 1)); + m_io->write_byte(A_YM2203_0 + 1, m_file->read_byte(m_pc + 2)); m_pc += 3; break; case 0x56: case 0x57: pulse_act_led(LED_YM2608); - m_io->write_byte(A_YM2608+0+((code & 1) << 1), m_file->read_byte(m_pc+1)); - m_io->write_byte(A_YM2608+1+((code & 1) << 1), m_file->read_byte(m_pc+2)); + m_io->write_byte(A_YM2608_0 + 0 + ((code & 1) << 1), m_file->read_byte(m_pc + 1)); + m_io->write_byte(A_YM2608_0 + 1 + ((code & 1) << 1), m_file->read_byte(m_pc + 2)); m_pc += 3; break; case 0x58: case 0x59: pulse_act_led(LED_YM2610); - m_io->write_byte(A_YM2610 + 0 + ((code & 1) << 1), m_file->read_byte(m_pc + 1)); - m_io->write_byte(A_YM2610 + 1 + ((code & 1) << 1), m_file->read_byte(m_pc + 2)); - m_pc += 3; - break; - - case 0xA5: - pulse_act_led(LED_YM2203); - m_io->write_byte(A_YM2203B+0, m_file->read_byte(m_pc+1)); - m_io->write_byte(A_YM2203B+1, m_file->read_byte(m_pc+2)); + m_io->write_byte(A_YM2610_0 + 0 + ((code & 1) << 1), m_file->read_byte(m_pc + 1)); + m_io->write_byte(A_YM2610_0 + 1 + ((code & 1) << 1), m_file->read_byte(m_pc + 2)); m_pc += 3; break; case 0x5a: pulse_act_led(LED_YM3812); - m_io->write_byte(A_YM3812+0, m_file->read_byte(m_pc+1)); - m_io->write_byte(A_YM3812+1, m_file->read_byte(m_pc+2)); + m_io->write_byte(A_YM3812_0 + 0, m_file->read_byte(m_pc + 1)); + m_io->write_byte(A_YM3812_0 + 1, m_file->read_byte(m_pc + 2)); m_pc += 3; break; case 0x5b: pulse_act_led(LED_YM3526); - m_io->write_byte(A_YM3526+0, m_file->read_byte(m_pc+1)); - m_io->write_byte(A_YM3526+1, m_file->read_byte(m_pc+2)); + m_io->write_byte(A_YM3526_0 + 0, m_file->read_byte(m_pc + 1)); + m_io->write_byte(A_YM3526_0 + 1, m_file->read_byte(m_pc + 2)); + m_pc += 3; + break; + + case 0x5c: + pulse_act_led(LED_Y8950); + m_io->write_byte(A_Y8950_0 + 0, m_file->read_byte(m_pc + 1)); + m_io->write_byte(A_Y8950_0 + 1, m_file->read_byte(m_pc + 2)); m_pc += 3; break; case 0x5d: pulse_act_led(LED_YMZ280B); - m_io->write_byte(A_YMZ280B+0, m_file->read_byte(m_pc+1)); - m_io->write_byte(A_YMZ280B+1, m_file->read_byte(m_pc+2)); + m_io->write_byte(A_YMZ280B_0 + 0, m_file->read_byte(m_pc + 1)); + m_io->write_byte(A_YMZ280B_0 + 1, m_file->read_byte(m_pc + 2)); + m_pc += 3; + break; + + case 0x5e: + case 0x5f: + pulse_act_led(LED_YMF262); + m_io->write_byte(A_YMF262_0 + 0 + ((code & 1) << 1), m_file->read_byte(m_pc + 1)); + m_io->write_byte(A_YMF262_0 + 1 + ((code & 1) << 1), m_file->read_byte(m_pc + 2)); m_pc += 3; break; @@ -720,8 +758,8 @@ void vgmplay_device::execute_run() if(m_ym2612_stream_offset >= int(m_data_streams[0].size())) m_ym2612_stream_offset = 0; - m_io->write_byte(A_YM2612+0, 0x2a); - m_io->write_byte(A_YM2612+1, m_data_streams[0][m_ym2612_stream_offset]); + m_io->write_byte(A_YM2612_0+0, 0x2a); + m_io->write_byte(A_YM2612_0+1, m_data_streams[0][m_ym2612_stream_offset]); m_ym2612_stream_offset++; } m_pc += 1; @@ -742,6 +780,87 @@ void vgmplay_device::execute_run() break; } + case 0xa1: + pulse_act_led(LED_YM2413); + m_io->write_byte(A_YM2413_1 + 0, m_file->read_byte(m_pc + 1)); + m_io->write_byte(A_YM2413_1 + 1, m_file->read_byte(m_pc + 2)); + m_pc += 3; + break; + + case 0xa2: + case 0xa3: + pulse_act_led(LED_YM2612); + m_io->write_byte(A_YM2612_1 + 0 + ((code & 1) << 1), m_file->read_byte(m_pc + 1)); + m_io->write_byte(A_YM2612_1 + 1 + ((code & 1) << 1), m_file->read_byte(m_pc + 2)); + m_pc += 3; + break; + + case 0xa4: + pulse_act_led(LED_YM2151); + m_io->write_byte(A_YM2151_1 + 0, m_file->read_byte(m_pc + 1)); + m_io->write_byte(A_YM2151_1 + 1, m_file->read_byte(m_pc + 2)); + m_pc += 3; + break; + + case 0xa5: + pulse_act_led(LED_YM2203); + m_io->write_byte(A_YM2203_1 + 0, m_file->read_byte(m_pc + 1)); + m_io->write_byte(A_YM2203_1 + 1, m_file->read_byte(m_pc + 2)); + m_pc += 3; + break; + + case 0xa6: + case 0xa7: + pulse_act_led(LED_YM2608); + m_io->write_byte(A_YM2608_0 + 0 + ((code & 1) << 1), m_file->read_byte(m_pc + 1)); + m_io->write_byte(A_YM2608_0 + 1 + ((code & 1) << 1), m_file->read_byte(m_pc + 2)); + m_pc += 3; + break; + + case 0xa8: + case 0xa9: + pulse_act_led(LED_YM2610); + m_io->write_byte(A_YM2610_0 + 0 + ((code & 1) << 1), m_file->read_byte(m_pc + 1)); + m_io->write_byte(A_YM2610_0 + 1 + ((code & 1) << 1), m_file->read_byte(m_pc + 2)); + m_pc += 3; + break; + + case 0xaa: + pulse_act_led(LED_YM3812); + m_io->write_byte(A_YM3812_1 + 0, m_file->read_byte(m_pc + 1)); + m_io->write_byte(A_YM3812_1 + 1, m_file->read_byte(m_pc + 2)); + m_pc += 3; + break; + + case 0xab: + pulse_act_led(LED_YM3526); + m_io->write_byte(A_YM3526_1 + 0, m_file->read_byte(m_pc + 1)); + m_io->write_byte(A_YM3526_1 + 1, m_file->read_byte(m_pc + 2)); + m_pc += 3; + break; + + case 0xac: + pulse_act_led(LED_Y8950); + m_io->write_byte(A_Y8950_1 + 0, m_file->read_byte(m_pc + 1)); + m_io->write_byte(A_Y8950_1 + 1, m_file->read_byte(m_pc + 2)); + m_pc += 3; + break; + + case 0xad: + pulse_act_led(LED_YMZ280B); + m_io->write_byte(A_YMZ280B_1 + 0, m_file->read_byte(m_pc + 1)); + m_io->write_byte(A_YMZ280B_1 + 1, m_file->read_byte(m_pc + 2)); + m_pc += 3; + break; + + case 0xae: + case 0xaf: + pulse_act_led(LED_YMF262); + m_io->write_byte(A_YMF262_1 + 0 + ((code & 1) << 1), m_file->read_byte(m_pc + 1)); + m_io->write_byte(A_YMF262_1 + 1 + ((code & 1) << 1), m_file->read_byte(m_pc + 2)); + m_pc += 3; + break; + case 0xb0: pulse_act_led(LED_RF5C68); m_io->write_byte(A_RF5C68 + m_file->read_byte(m_pc+1), m_file->read_byte(m_pc+2)); @@ -865,11 +984,37 @@ void vgmplay_device::execute_run() break; } + case 0xd0: + { + pulse_act_led(LED_YMF278B); + uint8_t offset = m_file->read_byte(m_pc + 1); + if (offset & 0x80) + { + m_io->write_byte(A_YMF278B_1 + (offset & 7) * 2, m_file->read_byte(m_pc + 2)); + m_io->write_byte(A_YMF278B_1 + (offset & 7) * 2 + 1, m_file->read_byte(m_pc + 3)); + } + else + { + m_io->write_byte(A_YMF278B_0 + (offset & 7) * 2, m_file->read_byte(m_pc + 2)); + m_io->write_byte(A_YMF278B_0 + (offset & 7) * 2 + 1, m_file->read_byte(m_pc + 3)); + } + m_pc += 4; + break; + } + case 0xd1: { pulse_act_led(LED_YMF271); uint8_t offset = m_file->read_byte(m_pc+1); - m_io->write_byte(A_YMF271 + (offset & 7) * 2, m_file->read_byte(m_pc+2)); - m_io->write_byte(A_YMF271 + (offset & 7) * 2 + 1, m_file->read_byte(m_pc+3)); + if (offset & 0x80) + { + m_io->write_byte(A_YMF271_1 + (offset & 7) * 2, m_file->read_byte(m_pc + 2)); + m_io->write_byte(A_YMF271_1 + (offset & 7) * 2 + 1, m_file->read_byte(m_pc + 3)); + } + else + { + m_io->write_byte(A_YMF271_0 + (offset & 7) * 2, m_file->read_byte(m_pc + 2)); + m_io->write_byte(A_YMF271_0 + (offset & 7) * 2 + 1, m_file->read_byte(m_pc + 3)); + } m_pc += 4; break; } @@ -979,72 +1124,68 @@ uint32_t vgmplay_disassembler::opcode_alignment() const offs_t vgmplay_disassembler::disassemble(std::ostream &stream, offs_t pc, const data_buffer &opcodes, const data_buffer ¶ms) { switch(opcodes.r8(pc)) { + case 0x30: + util::stream_format(stream, "psg.1 write %02x", opcodes.r8(pc + 1)); + return 2 | SUPPORTED; + + case 0x3f: + util::stream_format(stream, "psg.1 r06 = %02x", opcodes.r8(pc + 1)); + return 2 | SUPPORTED; + case 0x4f: - util::stream_format(stream, "psg r06 = %02x", opcodes.r8(pc+1)); + util::stream_format(stream, "psg.0 r06 = %02x", opcodes.r8(pc + 1)); return 2 | SUPPORTED; case 0x50: - util::stream_format(stream, "psg write %02x", opcodes.r8(pc+1)); + util::stream_format(stream, "psg.0 write %02x", opcodes.r8(pc + 1)); return 2 | SUPPORTED; case 0x51: - util::stream_format(stream, "ym2413 r%02x = %02x", opcodes.r8(pc+1), opcodes.r8(pc+2)); + util::stream_format(stream, "ym2413.0 r%02x = %02x", opcodes.r8(pc + 1), opcodes.r8(pc + 2)); return 3 | SUPPORTED; case 0x52: - util::stream_format(stream, "ym2612.0 r%02x = %02x", opcodes.r8(pc+1), opcodes.r8(pc+2)); - return 3 | SUPPORTED; - case 0x53: - util::stream_format(stream, "ym2612.1 r%02x = %02x", opcodes.r8(pc+1), opcodes.r8(pc+2)); + util::stream_format(stream, "ym2612.0 %d r%02x = %02x", opcodes.r8(pc) & 1, opcodes.r8(pc + 1), opcodes.r8(pc + 2)); return 3 | SUPPORTED; case 0x54: - util::stream_format(stream, "ym2151 r%02x = %02x", opcodes.r8(pc+1), opcodes.r8(pc+2)); + util::stream_format(stream, "ym2151.0 r%02x = %02x", opcodes.r8(pc + 1), opcodes.r8(pc + 2)); return 3 | SUPPORTED; case 0x55: - util::stream_format(stream, "ym2203a r%02x = %02x", opcodes.r8(pc+1), opcodes.r8(pc+2)); + util::stream_format(stream, "ym2203.0 r%02x = %02x", opcodes.r8(pc + 1), opcodes.r8(pc + 2)); return 3 | SUPPORTED; case 0x56: - util::stream_format(stream, "ym2608.0 r%02x = %02x", opcodes.r8(pc+1), opcodes.r8(pc+2)); - return 3 | SUPPORTED; - case 0x57: - util::stream_format(stream, "ym2608.1 r%02x = %02x", opcodes.r8(pc+1), opcodes.r8(pc+2)); + util::stream_format(stream, "ym2608.0 %d r%02x = %02x", opcodes.r8(pc) & 1, opcodes.r8(pc + 1), opcodes.r8(pc + 2)); return 3 | SUPPORTED; case 0x58: - util::stream_format(stream, "ym2610.0 r%02x = %02x", opcodes.r8(pc+1), opcodes.r8(pc+2)); - return 3 | SUPPORTED; - case 0x59: - util::stream_format(stream, "ym2610.1 r%02x = %02x", opcodes.r8(pc+1), opcodes.r8(pc+2)); + util::stream_format(stream, "ym2610.0 %d r%02x = %02x", opcodes.r8(pc) & 1, opcodes.r8(pc + 1), opcodes.r8(pc + 2)); return 3 | SUPPORTED; case 0x5a: - util::stream_format(stream, "ym3812 r%02x = %02x", opcodes.r8(pc+1), opcodes.r8(pc+2)); + util::stream_format(stream, "ym3812.0 r%02x = %02x", opcodes.r8(pc + 1), opcodes.r8(pc + 2)); return 3 | SUPPORTED; case 0x5b: - util::stream_format(stream, "ym3526 r%02x = %02x", opcodes.r8(pc+1), opcodes.r8(pc+2)); + util::stream_format(stream, "ym3526.0 r%02x = %02x", opcodes.r8(pc+1), opcodes.r8(pc+2)); return 3 | SUPPORTED; case 0x5c: - util::stream_format(stream, "y8950 r%02x = %02x", opcodes.r8(pc+1), opcodes.r8(pc+2)); + util::stream_format(stream, "y8950.0 r%02x = %02x", opcodes.r8(pc+1), opcodes.r8(pc+2)); return 3 | SUPPORTED; case 0x5d: - util::stream_format(stream, "ymz280b r%02x = %02x", opcodes.r8(pc+1), opcodes.r8(pc+2)); + util::stream_format(stream, "ymz280b.0 r%02x = %02x", opcodes.r8(pc+1), opcodes.r8(pc+2)); return 3 | SUPPORTED; case 0x5e: - util::stream_format(stream, "ymf262.0 r%02x = %02x", opcodes.r8(pc+1), opcodes.r8(pc+2)); - return 3 | SUPPORTED; - case 0x5f: - util::stream_format(stream, "ymf262.1 r%02x = %02x", opcodes.r8(pc+1), opcodes.r8(pc+2)); + util::stream_format(stream, "ymf262.0 %d r%02x = %02x", opcodes.r8(pc) & 1, opcodes.r8(pc + 1), opcodes.r8(pc + 2)); return 3 | SUPPORTED; case 0x61: { @@ -1156,8 +1297,47 @@ offs_t vgmplay_disassembler::disassemble(std::ostream &stream, offs_t pc, const util::stream_format(stream, "ay8910 r%02x = %02x", opcodes.r8(pc+1), opcodes.r8(pc+2)); return 3 | SUPPORTED; + case 0xa1: + util::stream_format(stream, "ym2413.1 r%02x = %02x", opcodes.r8(pc+1), opcodes.r8(pc+2)); + return 3 | SUPPORTED; + + case 0xa2: + case 0xa3: + util::stream_format(stream, "ym2612.1 %d r%02x = %02x", opcodes.r8(pc) & 1, opcodes.r8(pc+1), opcodes.r8(pc+2)); + return 3 | SUPPORTED; + + case 0xa4: + util::stream_format(stream, "ym2151.1 r%02x = %02x", opcodes.r8(pc+1), opcodes.r8(pc+2)); + return 3 | SUPPORTED; + case 0xa5: - util::stream_format(stream, "ym2203b r%02x = %02x", opcodes.r8(pc+1), opcodes.r8(pc+2)); + util::stream_format(stream, "ym2203.1 r%02x = %02x", opcodes.r8(pc+1), opcodes.r8(pc+2)); + return 3 | SUPPORTED; + + case 0xa6: + case 0xa7: + util::stream_format(stream, "ym2608.1 %d r%02x = %02x", opcodes.r8(pc) & 1, opcodes.r8(pc + 1), opcodes.r8(pc + 2)); + return 3 | SUPPORTED; + + case 0xaa: + util::stream_format(stream, "ym3812.1 r%02x = %02x", opcodes.r8(pc + 1), opcodes.r8(pc + 2)); + return 3 | SUPPORTED; + + case 0xab: + util::stream_format(stream, "ym3526.1 r%02x = %02x", opcodes.r8(pc + 1), opcodes.r8(pc + 2)); + return 3 | SUPPORTED; + + case 0xac: + util::stream_format(stream, "y8950.1 r%02x = %02x", opcodes.r8(pc + 1), opcodes.r8(pc + 2)); + return 3 | SUPPORTED; + + case 0xad: + util::stream_format(stream, "ymz280b.1 r%02x = %02x", opcodes.r8(pc + 1), opcodes.r8(pc + 2)); + return 3 | SUPPORTED; + + case 0xae: + case 0xaf: + util::stream_format(stream, "ymf262.1 %d r%02x = %02x", opcodes.r8(pc) & 1, opcodes.r8(pc + 1), opcodes.r8(pc + 2)); return 3 | SUPPORTED; case 0xb0: @@ -1233,11 +1413,11 @@ offs_t vgmplay_disassembler::disassemble(std::ostream &stream, offs_t pc, const return 4 | SUPPORTED; case 0xd0: - util::stream_format(stream, "ymf278b r%02x.%02x = %02x", opcodes.r8(pc+1), opcodes.r8(pc+2), opcodes.r8(pc+3)); + util::stream_format(stream, "ymf278b.%d r%02x.%02x = %02x", BIT(opcodes.r8(pc + 1), 7), opcodes.r8(pc+1) & 0x7f, opcodes.r8(pc+2), opcodes.r8(pc+3)); return 4 | SUPPORTED; case 0xd1: - util::stream_format(stream, "ymf271 r%02x.%02x = %02x", opcodes.r8(pc+1), opcodes.r8(pc+2), opcodes.r8(pc+3)); + util::stream_format(stream, "ymf271.%d r%02x.%02x = %02x", BIT(opcodes.r8(pc + 1), 7), opcodes.r8(pc+1), opcodes.r8(pc+2), opcodes.r8(pc+3)); return 4 | SUPPORTED; case 0xd2: @@ -1283,19 +1463,28 @@ uint8_t vgmplay_device::rom_r(int chip, uint8_t type, offs_t offset) return 0; } +template READ8_MEMBER(vgmplay_device::segapcm_rom_r) { - return rom_r(0, 0x80, offset); + return rom_r(Chip, 0x80, offset); +} + +template +READ8_MEMBER(vgmplay_device::ymf278b_rom_r) +{ + return rom_r(Chip, 0x84, offset); } +template READ8_MEMBER(vgmplay_device::ymf271_rom_r) { - return rom_r(0, 0x85, offset); + return rom_r(Chip, 0x85, offset); } +template READ8_MEMBER(vgmplay_device::ymz280b_rom_r) { - return rom_r(0, 0x86, offset); + return rom_r(Chip, 0x86, offset); } template @@ -1353,29 +1542,34 @@ READ8_MEMBER(vgmplay_device::k054539_rom_r) return rom_r(Chip, 0x8c, offset); } +template READ8_MEMBER(vgmplay_device::k053260_rom_r) { - return rom_r(0, 0x8e, offset); + return rom_r(Chip, 0x8e, offset); } +template READ8_MEMBER(vgmplay_device::qsound_rom_r) { - return rom_r(0, 0x8f, offset); + return rom_r(Chip, 0x8f, offset); } +template READ8_MEMBER(vgmplay_device::x1_010_rom_r) { - return rom_r(0, 0x91, offset); + return rom_r(Chip, 0x91, offset); } +template READ8_MEMBER(vgmplay_device::c352_rom_r) { - return rom_r(0, 0x92, offset); + return rom_r(Chip, 0x92, offset); } +template READ8_MEMBER(vgmplay_device::ga20_rom_r) { - return rom_r(0, 0x93, offset); + return rom_r(Chip, 0x93, offset); } vgmplay_state::vgmplay_state(const machine_config &mconfig, device_type type, const char *tag) @@ -1383,15 +1577,24 @@ vgmplay_state::vgmplay_state(const machine_config &mconfig, device_type type, co , m_vgmplay(*this, "vgmplay") , m_lspeaker(*this, "lspeaker") , m_rspeaker(*this, "rspeaker") - , m_ym2612(*this, "ym2612") - , m_ym2151(*this, "ym2151") - , m_ym2413(*this, "ym2413") - , m_ym2203(*this, "ym2203%c", 'a') - , m_ym3526(*this, "ym3526") - , m_ym3812(*this, "ym3812") - , m_ay8910(*this, "ay8910%c", 'a') - , m_sn76496(*this, "sn76496") + , m_sn76496(*this, "sn76496.%d", 0) + , m_ym2413(*this, "ym2413.%d", 0) + , m_ym2612(*this, "ym2612.%d", 0) + , m_ym2151(*this, "ym2151.%d", 0) , m_segapcm(*this, "segapcm") + , m_rf5c68(*this, "rf5c68") + , m_rf5c68_ram(*this, "rf5c68_ram") + , m_ym2203(*this, "ym2203.%d", 0) + , m_ym2608(*this, "ym2608.%d", 0) + , m_ym2610(*this, "ym2610.%d", 0) + , m_ym3812(*this, "ym3812.%d", 0) + , m_ym3526(*this, "ym3526.%d", 0) + , m_y8950(*this, "y8950.%d", 0) + , m_ymf262(*this, "ymf262.%d", 0) + , m_ymf278b(*this, "ymf278b.%d", 0) + , m_ymf271(*this, "ymf271.%d", 0) + , m_ymz280b(*this, "ymz280b.%d", 0) + , m_ay8910(*this, "ay8910%c", 'a') , m_multipcm(*this, "multipcm%c", 'a') , m_dmg(*this, "dmg") , m_nescpu(*this, "nescpu") @@ -1403,16 +1606,10 @@ vgmplay_state::vgmplay_state(const machine_config &mconfig, device_type type, co , m_pokey(*this, "pokey%c", 'a') , m_c352(*this, "c352") , m_okim6295(*this, "okim6295%c", 'a') - , m_ymf271(*this, "ymf271") - , m_ymz280b(*this, "ymz280b") - , m_ym2608(*this, "ym2608") - , m_ym2610(*this, "ym2610") , m_qsound(*this, "qsound") , m_k051649(*this, "k051649") , m_ga20(*this, "ga20") - , m_rf5c68(*this, "rf5c68") , m_rf5c164(*this, "rf5c164") - , m_rf5c68_ram(*this, "rf5c68_ram") , m_rf5c164_ram(*this, "rf5c164_ram") , m_x1_010(*this, "x1_010") { @@ -1507,23 +1704,21 @@ QUICKLOAD_LOAD_MEMBER(vgmplay_state, load_file) uint32_t data_start = version >= 0x150 ? r32(0x34) + 0x34 : 0x40; // Parse clocks - m_sn76496->set_unscaled_clock(r32(0x0c) & ~0xc0000000); - if (r32(0x0c) & 0xc0000000) - logerror("Warning: file requests an unsupported %s\n", r32(0x0c) & 0x80000000 ? "Y6W28" : "2nd SN76496"); + m_sn76496[0]->set_unscaled_clock(r32(0x0c) & ~0xc0000000); + m_sn76496[1]->set_unscaled_clock(r32(0x0c) & 0x40000000 ? r32(0x0c) & ~0xc0000000 : 0); + if (r32(0x0c) & 0x80000000) + logerror("Warning: file requests an unsupported T6W28"); - m_ym2413->set_unscaled_clock(r32(0x10) & ~0x40000000); - if (r32(0x10) & 0x40000000) - logerror("Warning: file requests an unsupported 2nd YM2413\n"); + m_ym2413[0]->set_unscaled_clock(r32(0x10) & ~0x40000000); + m_ym2413[1]->set_unscaled_clock(r32(0x10) & 0x40000000 ? r32(0x10) & ~0x40000000 : 0); - m_ym2612->set_unscaled_clock((version >= 0x110 ? r32(0x2c) : r32(0x10)) & ~0xc0000000); + m_ym2612[0]->set_unscaled_clock((version >= 0x110 ? r32(0x2c) : r32(0x10)) & ~0xc0000000); + m_ym2612[1]->set_unscaled_clock((version >= 0x110 ? r32(0x2c) : r32(0x10)) & 0x40000000 ? (version >= 0x110 ? r32(0x2c) : r32(0x10)) & ~0xc0000000 : 0); if (version >= 0x110 && (r32(0x2c) & 0x80000000)) logerror("Warning: file requests an unsupported YM3438\n"); - if (version >= 0x110 && (r32(0x2c) & 0x40000000)) - logerror("Warning: file requests an unsupported 2nd YM2612\n"); - m_ym2151->set_unscaled_clock((version >= 0x110 ? r32(0x30) : r32(0x10)) & ~0x40000000); - if (version >= 0x110 && (r32(0x30) & 0x40000000)) - logerror("Warning: file requests an unsupported 2nd YM2151\n"); + m_ym2151[0]->set_unscaled_clock((version >= 0x110 ? r32(0x30) : r32(0x10)) & ~0x40000000); + m_ym2151[1]->set_unscaled_clock((version >= 0x110 ? r32(0x30) : r32(0x10)) & 0x40000000 ? (version >= 0x110 ? r32(0x30) : r32(0x10)) & ~0x40000000 : 0); m_segapcm->set_unscaled_clock(version >= 0x151 && data_start >= 0x3c ? r32(0x38) : 0); m_segapcm->set_bank(version >= 0x151 && data_start >= 0x40 ? r32(0x3c) : 0); @@ -1531,38 +1726,28 @@ QUICKLOAD_LOAD_MEMBER(vgmplay_state, load_file) m_rf5c68->set_unscaled_clock(version >= 0x151 && data_start >= 0x44 ? r32(0x40) : 0); m_ym2203[0]->set_unscaled_clock(version >= 0x151 && data_start >= 0x48 ? r32(0x44) & ~0x40000000 : 0); m_ym2203[1]->set_unscaled_clock(version >= 0x151 && data_start >= 0x48 && (r32(0x44) & 0x40000000) ? r32(0x44) & ~0x40000000 : 0); - m_ym2608->set_unscaled_clock(version >= 0x151 && data_start >= 0x4c ? r32(0x48) & ~0x40000000 : 0); - if (version >= 0x151 && data_start >= 0x4c && (r32(0x48) & 0x40000000)) - logerror("Warning: file requests an unsupported 2nd YM2608\n"); + m_ym2608[0]->set_unscaled_clock(version >= 0x151 && data_start >= 0x4c ? r32(0x48) & ~0x40000000 : 0); + m_ym2608[1]->set_unscaled_clock(version >= 0x151 && data_start >= 0x4c && r32(0x48) & 0x40000000 ? r32(0x48) & ~0x40000000 : 0); - m_ym2610->set_unscaled_clock(version >= 0x151 && data_start >= 0x50 ? r32(0x4c) & ~0xc0000000 : 0); - if (version >= 0x151 && data_start >= 0x50 && (r32(0x4c) & 0x40000000)) - logerror("Warning: file requests an unsupported 2nd YM2610\n"); + m_ym2610[0]->set_unscaled_clock(version >= 0x151 && data_start >= 0x50 ? r32(0x4c) & ~0xc0000000 : 0); + m_ym2610[1]->set_unscaled_clock(version >= 0x151 && data_start >= 0x50 && r32(0x4c) & 0x40000000 ? r32(0x4c) & ~0xc0000000 : 0); if (version >= 0x151 && data_start >= 0x50 && (r32(0x4c) & 0x80000000)) logerror("Warning: file requests an unsupported YM2610B\n"); - m_ym3812->set_unscaled_clock(version >= 0x151 && data_start >= 0x54 ? r32(0x50) & ~0x40000000 : 0); - if (version >= 0x151 && data_start >= 0x54 && (r32(0x50) & 0x40000000)) - logerror("Warning: file requests an unsupported 2nd YM3812\n"); - - m_ym3526->set_unscaled_clock(version >= 0x151 && data_start >= 0x58 ? r32(0x54) & ~0x40000000 : 0); - if (version >= 0x151 && data_start >= 0x58 && (r32(0x54) & 0x40000000)) - logerror("Warning: file requests an unsupported 2nd YM3526\n"); - - if(version >= 0x151 && data_start >= 0x5c && r32(0x58)) - logerror("Warning: file requests an unsupported Y8950\n"); - if(version >= 0x151 && data_start >= 0x60 && r32(0x5c)) - logerror("Warning: file requests an unsupported YMF262\n"); - if(version >= 0x151 && data_start >= 0x64 && r32(0x60)) - logerror("Warning: file requests an unsupported YMF278B\n"); - - m_ymf271->set_unscaled_clock(version >= 0x151 && data_start >= 0x68 ? r32(0x64) & ~0x40000000 : 0); - if (version >= 0x151 && data_start >= 0x68 && (r32(0x64) & 0x40000000)) - logerror("Warning: file requests an unsupported 2nd YMF271\n"); - - m_ymz280b->set_unscaled_clock(version >= 0x151 && data_start >= 0x6c ? r32(0x68) & ~0x40000000 : 0); - if (version >= 0x151 && data_start >= 0x6c && (r32(0x68) & 0x40000000)) - logerror("Warning: file requests an unsupported 2nd YMZ280B\n"); + m_ym3812[0]->set_unscaled_clock(version >= 0x151 && data_start >= 0x54 ? r32(0x50) & ~0x40000000 : 0); + m_ym3812[1]->set_unscaled_clock(version >= 0x151 && data_start >= 0x54 && r32(0x50) & 0x40000000 ? r32(0x50) & ~0x40000000 : 0); + m_ym3526[0]->set_unscaled_clock(version >= 0x151 && data_start >= 0x58 ? r32(0x54) & ~0x40000000 : 0); + m_ym3526[1]->set_unscaled_clock(version >= 0x151 && data_start >= 0x58 && r32(0x54) & 0x40000000 ? r32(0x54) & ~0x40000000 : 0); + m_y8950[0]->set_unscaled_clock(version >= 0x151 && data_start >= 0x5c ? r32(0x58) & ~0x40000000 : 0); + m_y8950[1]->set_unscaled_clock(version >= 0x151 && data_start >= 0x5c && r32(0x58) & 0x40000000 ? r32(0x58) & ~0x40000000 : 0); + m_ymf262[0]->set_unscaled_clock(version >= 0x151 && data_start >= 0x60 ? r32(0x5c) & ~0x40000000 : 0); + m_ymf262[1]->set_unscaled_clock(version >= 0x151 && data_start >= 0x60 && r32(0x5c) & 0x40000000 ? r32(0x5c) & ~0x40000000 : 0); + m_ymf278b[0]->set_unscaled_clock(version >= 0x151 && data_start >= 0x64 ? r32(0x60) & ~0x40000000 : 0); + m_ymf278b[1]->set_unscaled_clock(version >= 0x151 && data_start >= 0x64 && r32(0x60) & 0x40000000 ? r32(0x60) & ~0x40000000 : 0); + m_ymf271[0]->set_unscaled_clock(version >= 0x151 && data_start >= 0x68 ? r32(0x64) & ~0x40000000 : 0); + m_ymf271[1]->set_unscaled_clock(version >= 0x151 && data_start >= 0x68 && r32(0x64) & 0x40000000 ? r32(0x64) & ~0x40000000 : 0); + m_ymz280b[0]->set_unscaled_clock(version >= 0x151 && data_start >= 0x6c ? r32(0x68) & ~0x40000000 : 0); + m_ymz280b[1]->set_unscaled_clock(version >= 0x151 && data_start >= 0x6c && r32(0x68) & 0x40000000 ? r32(0x68) & ~0x40000000 : 0); m_rf5c164->set_unscaled_clock(version >= 0x151 && data_start >= 0x70 ? r32(0x6c) : 0); @@ -1577,7 +1762,8 @@ QUICKLOAD_LOAD_MEMBER(vgmplay_state, load_file) m_ay8910[1]->set_flags(vgm_ay8910_flags(version >= 0x151 && data_start >= 0x7a ? r8(0x79) : 0)); m_ym2203[0]->set_flags(vgm_ay8910_flags(version >= 0x151 && data_start >= 0x7b ? r8(0x7a) : 0)); m_ym2203[1]->set_flags(vgm_ay8910_flags(version >= 0x151 && data_start >= 0x7b ? r8(0x7a) : 0)); - m_ym2608->set_flags(vgm_ay8910_flags(version >= 0x151 && data_start >= 0x7c ? r8(0x7b) : 0)); + m_ym2608[0]->set_flags(vgm_ay8910_flags(version >= 0x151 && data_start >= 0x7c ? r8(0x7b) : 0)); + m_ym2608[1]->set_flags(vgm_ay8910_flags(version >= 0x151 && data_start >= 0x7c ? r8(0x7b) : 0)); m_dmg->set_unscaled_clock(version >= 0x161 && data_start >= 0x84 ? r32(0x80) & ~0x40000000 : 0); if (version >= 0x161 && data_start >= 0x84 && (r32(0x80) & 0x40000000)) @@ -1831,20 +2017,44 @@ void vgmplay_state::soundchips16_map(address_map &map) void vgmplay_state::soundchips_map(address_map &map) { - map(vgmplay_device::REG_SIZE, vgmplay_device::REG_SIZE+3).r(FUNC(vgmplay_state::file_size_r)); - map(vgmplay_device::A_YM2612, vgmplay_device::A_YM2612+3).w(m_ym2612, FUNC(ym2612_device::write)); - map(vgmplay_device::A_YM2151, vgmplay_device::A_YM2151+1).w(m_ym2151, FUNC(ym2151_device::write)); - map(vgmplay_device::A_YM2413, vgmplay_device::A_YM2413+1).w(m_ym2413, FUNC(ym2413_device::write)); - map(vgmplay_device::A_YM2203A, vgmplay_device::A_YM2203A+1).w("ym2203a", FUNC(ym2203_device::write)); - map(vgmplay_device::A_YM2203B, vgmplay_device::A_YM2203B+1).w("ym2203b", FUNC(ym2203_device::write)); - map(vgmplay_device::A_YM3526, vgmplay_device::A_YM3526+1).w(m_ym3526, FUNC(ym3526_device::write)); - map(vgmplay_device::A_YM3812, vgmplay_device::A_YM3812+1).w(m_ym3812, FUNC(ym3812_device::write)); + map(vgmplay_device::REG_SIZE, vgmplay_device::REG_SIZE + 3).r(FUNC(vgmplay_state::file_size_r)); + map(vgmplay_device::A_SN76496_0 + 0, vgmplay_device::A_SN76496_0 + 0).w(m_sn76496[0], FUNC(sn76496_device::command_w)); +// map(vgmplay_device::A_SN76496_0 + 1, vgmplay_device::A_SN76496_0 + 1).w(m_sn76496[0], FUNC(sn76496_device::stereo_w)); // TODO: GG stereo + map(vgmplay_device::A_SN76496_1 + 0, vgmplay_device::A_SN76496_1 + 0).w(m_sn76496[1], FUNC(sn76496_device::command_w)); +// map(vgmplay_device::A_SN76496_1 + 1, vgmplay_device::A_SN76496_1 + 1).w(m_sn76496[1], FUNC(sn76496_device::stereo_w)); // TODO: GG stereo + map(vgmplay_device::A_YM2413_0, vgmplay_device::A_YM2413_0 + 1).w(m_ym2413[0], FUNC(ym2413_device::write)); + map(vgmplay_device::A_YM2413_1, vgmplay_device::A_YM2413_1 + 1).w(m_ym2413[1], FUNC(ym2413_device::write)); + map(vgmplay_device::A_YM2612_0, vgmplay_device::A_YM2612_0 + 3).w(m_ym2612[0], FUNC(ym2612_device::write)); + map(vgmplay_device::A_YM2612_1, vgmplay_device::A_YM2612_1 + 3).w(m_ym2612[1], FUNC(ym2612_device::write)); + map(vgmplay_device::A_YM2151_0, vgmplay_device::A_YM2151_0 + 1).w(m_ym2151[0], FUNC(ym2151_device::write)); + map(vgmplay_device::A_YM2151_1, vgmplay_device::A_YM2151_1 + 1).w(m_ym2151[1], FUNC(ym2151_device::write)); + map(vgmplay_device::A_SEGAPCM, vgmplay_device::A_SEGAPCM + 0x7ff).w(m_segapcm, FUNC(segapcm_device::sega_pcm_w)); + map(vgmplay_device::A_RF5C68, vgmplay_device::A_RF5C68 + 0xf).w(m_rf5c68, FUNC(rf5c68_device::rf5c68_w)); + map(vgmplay_device::A_RF5C68RAM, vgmplay_device::A_RF5C68RAM + 0xffff).w(m_rf5c68, FUNC(rf5c68_device::rf5c68_mem_w)); + map(vgmplay_device::A_YM2203_0, vgmplay_device::A_YM2203_0 + 1).w(m_ym2203[0], FUNC(ym2203_device::write)); + map(vgmplay_device::A_YM2203_1, vgmplay_device::A_YM2203_1 + 1).w(m_ym2203[1], FUNC(ym2203_device::write)); + map(vgmplay_device::A_YM2608_0, vgmplay_device::A_YM2608_0 + 0x3).w(m_ym2608[0], FUNC(ym2608_device::write)); + map(vgmplay_device::A_YM2608_1, vgmplay_device::A_YM2608_1 + 0x3).w(m_ym2608[1], FUNC(ym2608_device::write)); + map(vgmplay_device::A_YM2610_0, vgmplay_device::A_YM2610_0 + 0x3).w(m_ym2610[0], FUNC(ym2610_device::write)); + map(vgmplay_device::A_YM2610_1, vgmplay_device::A_YM2610_1 + 0x3).w(m_ym2610[1], FUNC(ym2610_device::write)); + map(vgmplay_device::A_YM3812_0, vgmplay_device::A_YM3812_0 + 1).w(m_ym3812[0], FUNC(ym3812_device::write)); + map(vgmplay_device::A_YM3812_1, vgmplay_device::A_YM3812_1 + 1).w(m_ym3812[1], FUNC(ym3812_device::write)); + map(vgmplay_device::A_YM3526_0, vgmplay_device::A_YM3526_0 + 1).w(m_ym3526[0], FUNC(ym3526_device::write)); + map(vgmplay_device::A_YM3526_1, vgmplay_device::A_YM3526_1 + 1).w(m_ym3526[1], FUNC(ym3526_device::write)); + map(vgmplay_device::A_Y8950_0, vgmplay_device::A_Y8950_0 + 1).w(m_y8950[0], FUNC(y8950_device::write)); + map(vgmplay_device::A_Y8950_1, vgmplay_device::A_Y8950_1 + 1).w(m_y8950[1], FUNC(y8950_device::write)); + map(vgmplay_device::A_YMF262_0, vgmplay_device::A_YMF262_0 + 1).w(m_ymf262[0], FUNC(ymf262_device::write)); + map(vgmplay_device::A_YMF262_1, vgmplay_device::A_YMF262_1 + 1).w(m_ymf262[1], FUNC(ymf262_device::write)); + map(vgmplay_device::A_YMF278B_0, vgmplay_device::A_YMF278B_0 + 0xf).w(m_ymf278b[0], FUNC(ymf278b_device::write)); + map(vgmplay_device::A_YMF278B_1, vgmplay_device::A_YMF278B_1 + 0xf).w(m_ymf278b[1], FUNC(ymf278b_device::write)); + map(vgmplay_device::A_YMF271_0, vgmplay_device::A_YMF271_0 + 0xf).w(m_ymf271[0], FUNC(ymf271_device::write)); + map(vgmplay_device::A_YMF271_1, vgmplay_device::A_YMF271_1 + 0xf).w(m_ymf271[1], FUNC(ymf271_device::write)); + map(vgmplay_device::A_YMZ280B_0, vgmplay_device::A_YMZ280B_0 + 0x1).w(m_ymz280b[0], FUNC(ymz280b_device::write)); + map(vgmplay_device::A_YMZ280B_1, vgmplay_device::A_YMZ280B_1 + 0x1).w(m_ymz280b[1], FUNC(ymz280b_device::write)); map(vgmplay_device::A_AY8910A, vgmplay_device::A_AY8910A).w("ay8910a", FUNC(ay8910_device::data_w)); map(vgmplay_device::A_AY8910A+1, vgmplay_device::A_AY8910A+1).w("ay8910a", FUNC(ay8910_device::address_w)); map(vgmplay_device::A_AY8910B, vgmplay_device::A_AY8910B).w("ay8910b", FUNC(ay8910_device::data_w)); map(vgmplay_device::A_AY8910B+1, vgmplay_device::A_AY8910B+1).w("ay8910b", FUNC(ay8910_device::address_w)); -// AM_RANGE(vgmplay_device::A_SN76496+0, vgmplay_device::A_SN76496+0) AM_DEVWRITE ("sn76496", sn76496_device, stereo_w) - map(vgmplay_device::A_SN76496+1, vgmplay_device::A_SN76496+1).w(m_sn76496, FUNC(sn76496_device::command_w)); map(vgmplay_device::A_K053260, vgmplay_device::A_K053260+0x2f).w(m_k053260, FUNC(k053260_device::write)); map(vgmplay_device::A_C6280, vgmplay_device::A_C6280+0xf).w(m_c6280, FUNC(c6280_device::c6280_w)); map(vgmplay_device::A_OKIM6295A, vgmplay_device::A_OKIM6295A).w("okim6295a", FUNC(okim6295_device::write)); @@ -1859,7 +2069,6 @@ void vgmplay_state::soundchips_map(address_map &map) map(vgmplay_device::A_OKIM6295B+0xe, vgmplay_device::A_OKIM6295B+0xe).w("vgmplay", FUNC(vgmplay_device::okim6295_nmk112_enable_w<1>)); map(vgmplay_device::A_OKIM6295B+0xf, vgmplay_device::A_OKIM6295B+0xf).w("vgmplay", FUNC(vgmplay_device::okim6295_bank_w<1>)); map(vgmplay_device::A_OKIM6295B+0x10, vgmplay_device::A_OKIM6295B+0x13).w("vgmplay", FUNC(vgmplay_device::okim6295_nmk112_bank_w<1>)); - map(vgmplay_device::A_SEGAPCM, vgmplay_device::A_SEGAPCM+0x7ff).w(m_segapcm, FUNC(segapcm_device::sega_pcm_w)); map(vgmplay_device::A_GAMEBOY, vgmplay_device::A_GAMEBOY+0x16).w(m_dmg, FUNC(gameboy_sound_device::sound_w)); map(vgmplay_device::A_GAMEBOY+0x20, vgmplay_device::A_GAMEBOY+0x2f).w(m_dmg, FUNC(gameboy_sound_device::wave_w)); map(vgmplay_device::A_NESAPU, vgmplay_device::A_NESAPU+0x1f).w("nescpu:nesapu", FUNC(nesapu_device::write)); @@ -1872,112 +2081,113 @@ void vgmplay_state::soundchips_map(address_map &map) map(vgmplay_device::A_MULTIPCMB+8, vgmplay_device::A_MULTIPCMB+11).w("vgmplay", FUNC(vgmplay_device::multipcm_bank_lo_w<1>)); map(vgmplay_device::A_POKEYA, vgmplay_device::A_POKEYA+0xf).w("pokeya", FUNC(pokey_device::write)); map(vgmplay_device::A_POKEYB, vgmplay_device::A_POKEYB+0xf).w("pokeyb", FUNC(pokey_device::write)); - map(vgmplay_device::A_YMF271, vgmplay_device::A_YMF271+0xf).w(m_ymf271, FUNC(ymf271_device::write)); - map(vgmplay_device::A_YMZ280B, vgmplay_device::A_YMZ280B+0x1).w(m_ymz280b, FUNC(ymz280b_device::write)); - map(vgmplay_device::A_YM2608, vgmplay_device::A_YM2608+0x3).w(m_ym2608, FUNC(ym2608_device::write)); - map(vgmplay_device::A_YM2610, vgmplay_device::A_YM2610+0x3).w(m_ym2610, FUNC(ym2610_device::write)); map(vgmplay_device::A_K054539A, vgmplay_device::A_K054539A+0x22f).w("k054539a", FUNC(k054539_device::write)); map(vgmplay_device::A_K054539B, vgmplay_device::A_K054539B+0x22f).w("k054539b", FUNC(k054539_device::write)); map(vgmplay_device::A_QSOUND, vgmplay_device::A_QSOUND+0x2).w(m_qsound, FUNC(qsound_device::qsound_w)); map(vgmplay_device::A_K051649, vgmplay_device::A_K051649+0xf).w(FUNC(vgmplay_state::scc_w)); map(vgmplay_device::A_GA20, vgmplay_device::A_GA20+0x1f).w(m_ga20, FUNC(iremga20_device::irem_ga20_w)); - map(vgmplay_device::A_RF5C68, vgmplay_device::A_RF5C68+0xf).w(m_rf5c68, FUNC(rf5c68_device::rf5c68_w)); map(vgmplay_device::A_RF5C164, vgmplay_device::A_RF5C164+0xf).w(m_rf5c164, FUNC(rf5c68_device::rf5c68_w)); - map(vgmplay_device::A_RF5C68RAM, vgmplay_device::A_RF5C68RAM+0xffff).w(m_rf5c68, FUNC(rf5c68_device::rf5c68_mem_w)); map(vgmplay_device::A_RF5C164RAM, vgmplay_device::A_RF5C164RAM+0xffff).w(m_rf5c164, FUNC(rf5c68_device::rf5c68_mem_w)); map(vgmplay_device::A_X1_010, vgmplay_device::A_X1_010+0x1fff).w(m_x1_010, FUNC(x1_010_device::write)); } +template void vgmplay_state::segapcm_map(address_map &map) { - map(0, 0x1fffff).r("vgmplay", FUNC(vgmplay_device::segapcm_rom_r)); + map(0, 0x1fffff).r("vgmplay", FUNC(vgmplay_device::segapcm_rom_r)); } -void vgmplay_state::multipcma_map(address_map &map) +template +void vgmplay_state::ymf278b_map(address_map &map) { - map(0, 0x3fffff).r("vgmplay", FUNC(vgmplay_device::multipcm_rom_r<0>)); + map(0, 0x3fffff).r("vgmplay", FUNC(vgmplay_device::ymf278b_rom_r)); } -void vgmplay_state::multipcmb_map(address_map &map) +template +void vgmplay_state::ymf271_map(address_map &map) { - map(0, 0x3fffff).r("vgmplay", FUNC(vgmplay_device::multipcm_rom_r<1>)); + map(0, 0x7fffff).r("vgmplay", FUNC(vgmplay_device::ymf271_rom_r)); } -void vgmplay_state::k053260_map(address_map &map) +template +void vgmplay_state::ymz280b_map(address_map &map) { - map(0, 0x1fffff).r("vgmplay", FUNC(vgmplay_device::k053260_rom_r)); + map(0, 0xffffff).r("vgmplay", FUNC(vgmplay_device::ymz280b_rom_r)); } -void vgmplay_state::okim6295a_map(address_map &map) +template +void vgmplay_state::multipcm_map(address_map &map) { - map(0, 0x3ffff).r("vgmplay", FUNC(vgmplay_device::okim6295_rom_r<0>)); + map(0, 0x3fffff).r("vgmplay", FUNC(vgmplay_device::multipcm_rom_r)); } -void vgmplay_state::okim6295b_map(address_map &map) +template +void vgmplay_state::k053260_map(address_map &map) { - map(0, 0x3ffff).r("vgmplay", FUNC(vgmplay_device::okim6295_rom_r<1>)); + map(0, 0x1fffff).r("vgmplay", FUNC(vgmplay_device::k053260_rom_r)); } -void vgmplay_state::k054539a_map(address_map &map) +template +void vgmplay_state::okim6295_map(address_map &map) { - map(0, 0xffffff).r("vgmplay", FUNC(vgmplay_device::k054539_rom_r<0>)); + map(0, 0x3ffff).r("vgmplay", FUNC(vgmplay_device::okim6295_rom_r)); } -void vgmplay_state::k054539b_map(address_map &map) +template +void vgmplay_state::k054539_map(address_map &map) { - map(0, 0xffffff).r("vgmplay", FUNC(vgmplay_device::k054539_rom_r<1>)); + map(0, 0xffffff).r("vgmplay", FUNC(vgmplay_device::k054539_rom_r)); } +template void vgmplay_state::c352_map(address_map &map) { - map(0, 0xffffff).r("vgmplay", FUNC(vgmplay_device::c352_rom_r)); + map(0, 0xffffff).r("vgmplay", FUNC(vgmplay_device::c352_rom_r)); } +template void vgmplay_state::qsound_map(address_map &map) { - map(0, 0xffffff).r("vgmplay", FUNC(vgmplay_device::qsound_rom_r)); -} - -void vgmplay_state::ymf271_map(address_map &map) -{ - map(0, 0x7fffff).r("vgmplay", FUNC(vgmplay_device::ymf271_rom_r)); -} - -void vgmplay_state::ymz280b_map(address_map &map) -{ - map(0, 0xffffff).r("vgmplay", FUNC(vgmplay_device::ymz280b_rom_r)); + map(0, 0xffffff).r("vgmplay", FUNC(vgmplay_device::qsound_rom_r)); } +template void vgmplay_state::ga20_map(address_map &map) { - map(0, 0xfffff).r("vgmplay", FUNC(vgmplay_device::ga20_rom_r)); + map(0, 0xfffff).r("vgmplay", FUNC(vgmplay_device::ga20_rom_r)); } +template void vgmplay_state::x1_010_map(address_map &map) { - map(0, 0xfffff).r("vgmplay", FUNC(vgmplay_device::x1_010_rom_r)); + map(0, 0xfffff).r("vgmplay", FUNC(vgmplay_device::x1_010_rom_r)); } +template void vgmplay_state::nescpu_map(address_map &map) { map(0, 0xffff).ram().share("nesapu_ram"); } +template void vgmplay_state::rf5c68_map(address_map &map) { map(0, 0xffff).ram().share("rf5c68_ram"); } +template void vgmplay_state::rf5c164_map(address_map &map) { map(0, 0xffff).ram().share("rf5c164_ram"); } +template void vgmplay_state::h6280_map(address_map &map) { map(0, 0xffff).noprw(); } +template void vgmplay_state::h6280_io_map(address_map &map) { map(0, 3).noprw(); @@ -1999,35 +2209,146 @@ MACHINE_CONFIG_START(vgmplay_state::vgmplay) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - MCFG_DEVICE_ADD("ym2612", YM2612, 0) - MCFG_SOUND_ROUTE(0, "lspeaker", 1) - MCFG_SOUND_ROUTE(1, "rspeaker", 1) + SN76496(config, m_sn76496[0], 0); + m_sn76496[0]->add_route(0, "lspeaker", 0.5); + m_sn76496[0]->add_route(0, "rspeaker", 0.5); - MCFG_DEVICE_ADD("ym2151", YM2151, 0) - MCFG_SOUND_ROUTE(0, "lspeaker", 1) - MCFG_SOUND_ROUTE(1, "rspeaker", 1) + SN76496(config, m_sn76496[1], 0); + m_sn76496[1]->add_route(0, "lspeaker", 0.5); + m_sn76496[1]->add_route(0, "rspeaker", 0.5); - MCFG_DEVICE_ADD("ym2413", YM2413, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1) + YM2413(config, m_ym2413[0], 0); + m_ym2413[0]->add_route(ALL_OUTPUTS, "lspeaker", 1); + m_ym2413[0]->add_route(ALL_OUTPUTS, "rspeaker", 1); - MCFG_DEVICE_ADD("sn76496", SN76496, 0) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.5) - MCFG_SOUND_ROUTE(0, "rspeaker", 0.5) + YM2413(config, m_ym2413[1], 0); + m_ym2413[1]->add_route(0, "lspeaker", 1); + m_ym2413[1]->add_route(1, "rspeaker", 1); + + YM2612(config, m_ym2612[0], 0); + m_ym2612[0]->add_route(0, "lspeaker", 1); + m_ym2612[0]->add_route(1, "rspeaker", 1); + + YM2612(config, m_ym2612[1], 0); + m_ym2612[1]->add_route(0, "lspeaker", 1); + m_ym2612[1]->add_route(1, "rspeaker", 1); + + YM2151(config, m_ym2151[0], 0); + m_ym2151[0]->add_route(0, "lspeaker", 1); + m_ym2151[0]->add_route(1, "rspeaker", 1); + + YM2151(config, m_ym2151[1], 0); + m_ym2151[1]->add_route(0, "lspeaker", 1); + m_ym2151[1]->add_route(1, "rspeaker", 1); MCFG_DEVICE_ADD("segapcm", SEGAPCM, 0) MCFG_SEGAPCM_BANK(BANK_512) // Should be configurable for yboard... - MCFG_DEVICE_ADDRESS_MAP(0, segapcm_map) + MCFG_DEVICE_ADDRESS_MAP(0, segapcm_map<0>) MCFG_SOUND_ROUTE(0, "lspeaker", 1) MCFG_SOUND_ROUTE(1, "rspeaker", 1) + RF5C68(config, m_rf5c68, 0); + m_rf5c68->set_addrmap(0, &vgmplay_state::rf5c68_map<0>); + m_rf5c68->add_route(0, "lspeaker", 1); + m_rf5c68->add_route(1, "rspeaker", 1); + + YM2203(config, m_ym2203[0], 0); + m_ym2203[0]->add_route(ALL_OUTPUTS, "lspeaker", 0.25); + m_ym2203[0]->add_route(ALL_OUTPUTS, "rspeaker", 0.25); + + YM2203(config, m_ym2203[1], 0); + m_ym2203[1]->add_route(ALL_OUTPUTS, "lspeaker", 0.25); + m_ym2203[1]->add_route(ALL_OUTPUTS, "rspeaker", 0.25); + + YM2608(config, m_ym2608[0], 0); + m_ym2608[0]->add_route(ALL_OUTPUTS, "lspeaker", 1); + m_ym2608[0]->add_route(ALL_OUTPUTS, "rspeaker", 1); + + YM2608(config, m_ym2608[1], 0); + m_ym2608[1]->add_route(ALL_OUTPUTS, "lspeaker", 1); + m_ym2608[1]->add_route(ALL_OUTPUTS, "rspeaker", 1); + + YM2610(config, m_ym2610[0], 0); + m_ym2610[0]->add_route(0, "lspeaker", 0.25); + m_ym2610[0]->add_route(0, "rspeaker", 0.25); + m_ym2610[0]->add_route(1, "lspeaker", 0.50); + m_ym2610[0]->add_route(2, "rspeaker", 0.50); + + YM2610(config, m_ym2610[1], 0); + m_ym2610[1]->add_route(0, "lspeaker", 0.25); + m_ym2610[1]->add_route(0, "rspeaker", 0.25); + m_ym2610[1]->add_route(1, "lspeaker", 0.50); + m_ym2610[1]->add_route(2, "rspeaker", 0.50); + + YM3812(config, m_ym3812[0], 0); + m_ym3812[0]->add_route(ALL_OUTPUTS, "lspeaker", 0.5); + m_ym3812[0]->add_route(ALL_OUTPUTS, "rspeaker", 0.5); + + YM3812(config, m_ym3812[1], 0); + m_ym3812[1]->add_route(ALL_OUTPUTS, "lspeaker", 0.5); + m_ym3812[1]->add_route(ALL_OUTPUTS, "rspeaker", 0.5); + + YM3526(config, m_ym3526[0], 0); + m_ym3526[0]->add_route(ALL_OUTPUTS, "lspeaker", 0.5); + m_ym3526[0]->add_route(ALL_OUTPUTS, "rspeaker", 0.5); + + YM3526(config, m_ym3526[1], 0); + m_ym3526[1]->add_route(ALL_OUTPUTS, "lspeaker", 0.5); + m_ym3526[1]->add_route(ALL_OUTPUTS, "rspeaker", 0.5); + + Y8950(config, m_y8950[0], 0); + m_y8950[0]->add_route(ALL_OUTPUTS, "lspeaker", 0.40); + m_y8950[0]->add_route(ALL_OUTPUTS, "rspeaker", 0.40); + + Y8950(config, m_y8950[1], 0); + m_y8950[1]->add_route(ALL_OUTPUTS, "lspeaker", 0.40); + m_y8950[1]->add_route(ALL_OUTPUTS, "rspeaker", 0.40); + + YMF262(config, m_ymf262[0], 0); + m_ymf262[0]->add_route(ALL_OUTPUTS, "lspeaker", 1.00); + m_ymf262[0]->add_route(ALL_OUTPUTS, "rspeaker", 1.00); + + YMF262(config, m_ymf262[1], 0); + m_ymf262[1]->add_route(ALL_OUTPUTS, "lspeaker", 1.00); + m_ymf262[1]->add_route(ALL_OUTPUTS, "rspeaker", 1.00); + + YMF278B(config, m_ymf278b[0], 0); + m_ymf278b[0]->set_addrmap(0, &vgmplay_state::ymf278b_map<0>); + m_ymf278b[0]->add_route(ALL_OUTPUTS, "lspeaker", 0.25); + m_ymf278b[0]->add_route(ALL_OUTPUTS, "rspeaker", 0.25); + + YMF278B(config, m_ymf278b[1], 0); + m_ymf278b[1]->set_addrmap(0, &vgmplay_state::ymf278b_map<1>); + m_ymf278b[1]->add_route(ALL_OUTPUTS, "lspeaker", 0.25); + m_ymf278b[1]->add_route(ALL_OUTPUTS, "rspeaker", 0.25); + + YMF271(config, m_ymf271[0], 0); + m_ymf271[0]->set_addrmap(0, &vgmplay_state::ymf271_map<0>); + m_ymf271[0]->add_route(ALL_OUTPUTS, "lspeaker", 0.25); + m_ymf271[0]->add_route(ALL_OUTPUTS, "rspeaker", 0.25); + + YMF271(config, m_ymf271[1], 0); + m_ymf271[1]->set_addrmap(0, &vgmplay_state::ymf271_map<0>); + m_ymf271[1]->add_route(ALL_OUTPUTS, "lspeaker", 0.25); + m_ymf271[1]->add_route(ALL_OUTPUTS, "rspeaker", 0.25); + + YMZ280B(config, m_ymz280b[0], 0); + m_ymz280b[0]->set_addrmap(0, &vgmplay_state::ymz280b_map<0>); + m_ymz280b[0]->add_route(ALL_OUTPUTS, "lspeaker", 0.25); + m_ymz280b[0]->add_route(ALL_OUTPUTS, "rspeaker", 0.25); + + YMZ280B(config, m_ymz280b[1], 0); + m_ymz280b[1]->set_addrmap(0, &vgmplay_state::ymz280b_map<1>); + m_ymz280b[1]->add_route(ALL_OUTPUTS, "lspeaker", 0.25); + m_ymz280b[1]->add_route(ALL_OUTPUTS, "rspeaker", 0.25); + MCFG_DEVICE_ADD("multipcma", MULTIPCM, 0) - MCFG_DEVICE_ADDRESS_MAP(0, multipcma_map) + MCFG_DEVICE_ADDRESS_MAP(0, multipcm_map<0>) MCFG_SOUND_ROUTE(0, "lspeaker", 1) MCFG_SOUND_ROUTE(1, "rspeaker", 1) MCFG_DEVICE_ADD("multipcmb", MULTIPCM, 0) - MCFG_DEVICE_ADDRESS_MAP(0, multipcmb_map) + MCFG_DEVICE_ADDRESS_MAP(0, multipcm_map<1>) MCFG_SOUND_ROUTE(0, "lspeaker", 1) MCFG_SOUND_ROUTE(1, "rspeaker", 1) @@ -2043,24 +2364,8 @@ MACHINE_CONFIG_START(vgmplay_state::vgmplay) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.33) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.33) - MCFG_DEVICE_ADD("ym2203a", YM2203, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.25) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.25) - - MCFG_DEVICE_ADD("ym2203b", YM2203, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.25) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.25) - - MCFG_DEVICE_ADD("ym3526", YM3526, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.5) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.5) - - MCFG_DEVICE_ADD("ym3812", YM3812, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50) - MCFG_DEVICE_ADD("nescpu", N2A03, 0) - MCFG_DEVICE_PROGRAM_MAP(nescpu_map) + MCFG_DEVICE_PROGRAM_MAP(nescpu_map<0>) MCFG_DEVICE_MODIFY("nescpu:nesapu") MCFG_SOUND_ROUTES_RESET() @@ -2068,8 +2373,8 @@ MACHINE_CONFIG_START(vgmplay_state::vgmplay) MCFG_SOUND_ROUTE(ALL_OUTPUTS, ":rspeaker", 0.50) MCFG_DEVICE_ADD("h6280", H6280, 1000000) - MCFG_DEVICE_PROGRAM_MAP(h6280_map) - MCFG_DEVICE_IO_MAP(h6280_io_map) + MCFG_DEVICE_PROGRAM_MAP(h6280_map<0>) + MCFG_DEVICE_IO_MAP(h6280_io_map<0>) MCFG_DEVICE_DISABLE() MCFG_DEVICE_ADD("c6280", C6280, 0) @@ -2078,7 +2383,7 @@ MACHINE_CONFIG_START(vgmplay_state::vgmplay) MCFG_SOUND_ROUTE(1, "rspeaker", 1) MCFG_K053260_ADD("k053260", 0) - MCFG_DEVICE_ADDRESS_MAP(0, k053260_map) + MCFG_DEVICE_ADDRESS_MAP(0, k053260_map<0>) MCFG_SOUND_ROUTE(0, "lspeaker", 1) MCFG_SOUND_ROUTE(1, "rspeaker", 1) @@ -2091,54 +2396,32 @@ MACHINE_CONFIG_START(vgmplay_state::vgmplay) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.5) MCFG_DEVICE_ADD("c352", C352, 0, 1) - MCFG_DEVICE_ADDRESS_MAP(0, c352_map) + MCFG_DEVICE_ADDRESS_MAP(0, c352_map<0>) MCFG_SOUND_ROUTE(0, "lspeaker", 1) MCFG_SOUND_ROUTE(1, "rspeaker", 1) MCFG_DEVICE_ADD("okim6295a", OKIM6295, 0, okim6295_device::PIN7_HIGH) - MCFG_DEVICE_ADDRESS_MAP(0, okim6295a_map) + MCFG_DEVICE_ADDRESS_MAP(0, okim6295_map<0>) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.25) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.25) MCFG_DEVICE_ADD("okim6295b", OKIM6295, 0, okim6295_device::PIN7_HIGH) - MCFG_DEVICE_ADDRESS_MAP(0, okim6295b_map) + MCFG_DEVICE_ADDRESS_MAP(0, okim6295_map<1>) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.25) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.25) - MCFG_DEVICE_ADD("ymf271", YMF271, 0) - MCFG_DEVICE_ADDRESS_MAP(0, ymf271_map) - MCFG_SOUND_ROUTE(0, "lspeaker", 1) - MCFG_SOUND_ROUTE(1, "rspeaker", 1) - - MCFG_DEVICE_ADD("ymz280b", YMZ280B, 0) - MCFG_DEVICE_ADDRESS_MAP(0, ymz280b_map) - MCFG_SOUND_ROUTE(0, "lspeaker", 1) - MCFG_SOUND_ROUTE(1, "rspeaker", 1) - - MCFG_DEVICE_ADD("ym2608", YM2608, 0) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.25) - MCFG_SOUND_ROUTE(0, "rspeaker", 0.25) - MCFG_SOUND_ROUTE(1, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(2, "rspeaker", 0.50) - - MCFG_DEVICE_ADD("ym2610", YM2610, 0) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.25) - MCFG_SOUND_ROUTE(0, "rspeaker", 0.25) - MCFG_SOUND_ROUTE(1, "lspeaker", 0.50) - MCFG_SOUND_ROUTE(2, "rspeaker", 0.50) - MCFG_DEVICE_ADD("k054539a", K054539, 0) - MCFG_DEVICE_ADDRESS_MAP(0, k054539a_map) + MCFG_DEVICE_ADDRESS_MAP(0, k054539_map<0>) MCFG_SOUND_ROUTE(0, "lspeaker", 1) MCFG_SOUND_ROUTE(1, "rspeaker", 1) MCFG_DEVICE_ADD("k054539b", K054539, 0) - MCFG_DEVICE_ADDRESS_MAP(0, k054539b_map) + MCFG_DEVICE_ADDRESS_MAP(0, k054539_map<0>) MCFG_SOUND_ROUTE(0, "lspeaker", 1) MCFG_SOUND_ROUTE(1, "rspeaker", 1) MCFG_DEVICE_ADD("qsound", QSOUND, 0) - MCFG_DEVICE_ADDRESS_MAP(0, qsound_map) + MCFG_DEVICE_ADDRESS_MAP(0, qsound_map<0>) MCFG_SOUND_ROUTE(0, "lspeaker", 1) MCFG_SOUND_ROUTE(1, "rspeaker", 1) @@ -2147,29 +2430,28 @@ MACHINE_CONFIG_START(vgmplay_state::vgmplay) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.33) IREMGA20(config, m_ga20, 0); - m_ga20->set_addrmap(0, &vgmplay_state::ga20_map); + m_ga20->set_addrmap(0, &vgmplay_state::ga20_map<0>); m_ga20->add_route(0, "lspeaker", 1); m_ga20->add_route(1, "rspeaker", 1); - RF5C68(config, m_rf5c68, 0); - m_rf5c68->set_addrmap(0, &vgmplay_state::rf5c68_map); - m_rf5c68->add_route(0, "lspeaker", 1); - m_rf5c68->add_route(1, "rspeaker", 1); - RF5C68(config, m_rf5c164, 0); // TODO : !!RF5C164!! - m_rf5c164->set_addrmap(0, &vgmplay_state::rf5c164_map); + m_rf5c164->set_addrmap(0, &vgmplay_state::rf5c164_map<0>); m_rf5c164->add_route(0, "lspeaker", 1); m_rf5c164->add_route(1, "rspeaker", 1); X1_010(config, m_x1_010, 0); - m_x1_010->set_addrmap(0, &vgmplay_state::x1_010_map); + m_x1_010->set_addrmap(0, &vgmplay_state::x1_010_map<0>); m_x1_010->add_route(0, "lspeaker", 1); m_x1_010->add_route(1, "rspeaker", 1); MACHINE_CONFIG_END ROM_START( vgmplay ) - ROM_REGION( 0x80000, "ym2608", ROMREGION_ERASE00 ) - ROM_REGION( 0x80000, "ym2610", ROMREGION_ERASE00 ) + ROM_REGION( 0x80000, "ym2608.0", ROMREGION_ERASE00 ) + ROM_REGION( 0x80000, "ym2608.1", ROMREGION_ERASE00 ) + ROM_REGION( 0x80000, "ym2610.0", ROMREGION_ERASE00 ) + ROM_REGION( 0x80000, "ym2610.1", ROMREGION_ERASE00 ) + ROM_REGION( 0x80000, "y8950.0", ROMREGION_ERASE00 ) + ROM_REGION( 0x80000, "y8950.1", ROMREGION_ERASE00 ) ROM_END CONS( 2016, vgmplay, 0, 0, vgmplay, vgmplay, vgmplay_state, empty_init, "MAME", "VGM player", MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mame/layout/vgmplay.lay b/src/mame/layout/vgmplay.lay index c9e062853c9..ffeb7b2ee46 100644 --- a/src/mame/layout/vgmplay.lay +++ b/src/mame/layout/vgmplay.lay @@ -30,6 +30,9 @@ 25: RF5C164 26: X1-010 27: YM2610 + 28: Y8950 + 29: YMF262 + 30: YMF278B --> @@ -67,6 +70,9 @@ + + + @@ -129,6 +135,9 @@ + + + @@ -161,6 +170,9 @@ + + + -- cgit v1.2.3 From d14c601a767ff8240a93270dcb18211d773f8e30 Mon Sep 17 00:00:00 2001 From: arbee Date: Sun, 29 Jul 2018 19:29:58 -0400 Subject: New machines added as NOT_WORKING: - Sharp FontWriter FW-600 [R. Belmont, rfka01] --- src/mame/drivers/fontwriter.cpp | 51 +++++++++++++++++++++++++++++++++++++++-- src/mame/mame.lst | 1 + 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/src/mame/drivers/fontwriter.cpp b/src/mame/drivers/fontwriter.cpp index ff07676d05a..eadbd74d06a 100644 --- a/src/mame/drivers/fontwriter.cpp +++ b/src/mame/drivers/fontwriter.cpp @@ -10,6 +10,7 @@ FDC: NEC 72068 (entire PC controller on a chip) 512k RAM Custom gate array + AT28C16 parallel EPROM 640x400 dot-matrix LCD Things to check @@ -22,6 +23,7 @@ #include "emu.h" #include "cpu/m37710/m37710.h" #include "machine/nvram.h" +#include "machine/at28c16.h" #include "screen.h" #include "speaker.h" @@ -34,6 +36,7 @@ public: { } void fontwriter(machine_config &config); + void fw600(machine_config &config); private: virtual void machine_reset() override; @@ -46,15 +49,21 @@ private: m_vbl ^= 0xff; return m_vbl; } + DECLARE_READ8_MEMBER(vbl2_r) + { + m_vbl2 ^= 0x88; + return m_vbl; + } void io_map(address_map &map); void main_map(address_map &map); + void fw600_map(address_map &map); // devices required_device m_maincpu; // driver_device overrides virtual void video_start() override; - uint8_t m_vbl; + uint8_t m_vbl, m_vbl2; }; void fontwriter_state::machine_reset() @@ -80,13 +89,24 @@ void fontwriter_state::main_map(address_map &map) map(0x002000, 0x007fff).ram(); map(0x008000, 0x00ffff).rom().region("maincpu", 0x0000); map(0x020000, 0x04ffff).ram(); - map(0x100000, 0x1007ff).ram(); + map(0x100000, 0x1007ff).rw("at28c16", FUNC(at28c16_device::read), FUNC(at28c16_device::write)); map(0x200000, 0x3fffff).rom().region("maincpu", 0x0000); } void fontwriter_state::io_map(address_map &map) { map(M37710_PORT6, M37710_PORT6).r(FUNC(fontwriter_state::vbl_r)); + map(M37710_PORT7, M37710_PORT7).r(FUNC(fontwriter_state::vbl2_r)); +} + +void fontwriter_state::fw600_map(address_map &map) +{ + map(0x000280, 0x0002ff).ram(); + map(0x000800, 0x000fff).rw("at28c16", FUNC(at28c16_device::read), FUNC(at28c16_device::write)); + map(0x002000, 0x007fff).ram(); + map(0x008000, 0x00ffff).rom().region("maincpu", 0x1f8000); + map(0x020000, 0x04ffff).ram(); + map(0x200000, 0x3fffff).rom().region("maincpu", 0x0000); } static INPUT_PORTS_START( fontwriter ) @@ -105,9 +125,36 @@ MACHINE_CONFIG_START(fontwriter_state::fontwriter) MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 399) MACHINE_CONFIG_END +MACHINE_CONFIG_START(fontwriter_state::fw600) + MCFG_DEVICE_ADD("maincpu", M37720S1, XTAL(16'000'000)) /* M37720S1 @ 16MHz - main CPU */ + MCFG_DEVICE_PROGRAM_MAP(fw600_map) + MCFG_DEVICE_IO_MAP(io_map) + + MCFG_DEVICE_ADD("at28c16", AT28C16, 0) + + MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_REFRESH_RATE(60) + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) + MCFG_SCREEN_UPDATE_DRIVER(fontwriter_state, screen_update) + MCFG_SCREEN_SIZE(640, 400) + MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 399) +MACHINE_CONFIG_END + +ROM_START(fw600) + ROM_REGION(0x200000, "maincpu", 0) /* M37720 program ROM */ + ROM_LOAD( "lh5388n5.bin", 0x000000, 0x100000, CRC(3bcc5c19) SHA1(510e3795faf18e10f2fef69110f96183e7cfee35) ) + ROM_LOAD( "lh5388n9.bin", 0x100000, 0x100000, CRC(be2198df) SHA1(9e42f3a933c6f247c452910af3a2e9196291574a) ) + + ROM_REGION(0x800, "at28c16", 0) /* AT28C16 parallel EPROM */ + ROM_LOAD( "at28c16.bin", 0x000000, 0x000800, CRC(a84eafd9) SHA1(12503a71e98f80819959d41643b1d2773739b923) ) +ROM_END + ROM_START(fw700ger) ROM_REGION(0x200000, "maincpu", 0) /* M37720 program ROM */ ROM_LOAD( "lh5370pd.ic7", 0x000000, 0x200000, CRC(29083e13) SHA1(7e1605f91b53580e75f638f9e6b0917305c35f84) ) + + ROM_REGION(0x800, "at28c16", ROMREGION_ERASE00) /* AT28C16 parallel EPROM */ ROM_END +SYST( 1994, fw600, 0, 0, fw600, fontwriter, fontwriter_state, empty_init, "Sharp", "FontWriter FW-600", MACHINE_NOT_WORKING|MACHINE_NO_SOUND ) SYST( 1994, fw700ger, 0, 0, fontwriter, fontwriter, fontwriter_state, empty_init, "Sharp", "FontWriter FW-700 (German)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND ) diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 53342be3015..4b0a8260777 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -12903,6 +12903,7 @@ fmtownssj // FM-Towns II SJ fmtownsux // 1991.11 FM-Towns II UX @source:fontwriter.cpp +fw600 // (c) Sharp fw700ger // (c) Sharp @source:foodf.cpp -- cgit v1.2.3