From 9613b35b829d7c82ebe42ba2a2ab5d246457c352 Mon Sep 17 00:00:00 2001 From: mooglyguy Date: Sun, 3 Jun 2018 13:27:34 +0200 Subject: hector: More cleanup, and eliminating machine().device, nw --- src/mame/drivers/hec2hrp.cpp | 261 ++++++++++++++++-------------------------- src/mame/drivers/interact.cpp | 14 +-- src/mame/includes/hec2hrp.h | 90 +++++++++------ src/mame/machine/hec2hrp.cpp | 93 +++++++-------- 4 files changed, 201 insertions(+), 257 deletions(-) diff --git a/src/mame/drivers/hec2hrp.cpp b/src/mame/drivers/hec2hrp.cpp index 45b88184016..3c9f8f0bfe4 100644 --- a/src/mame/drivers/hec2hrp.cpp +++ b/src/mame/drivers/hec2hrp.cpp @@ -33,23 +33,23 @@ => add BR/HR switching => add bank switch for HRX => add device MX80c and bank switching for the ROM - Importante note : the keyboard function add been piked from + Importante note : Keyboard emulation code obtained from DChector project : http://dchector.free.fr/ made by DanielCoulom - (thank's Daniel) - 03/01/2010 Update and clean prog by yo_fr (jj.stac@aliceadsl.fr) + (thanks Daniel) + 03/01/2010 Update and cleanup by yo_fr (jj.stac@aliceadsl.fr) => add the port mapping for keyboard 20/11/2010 : synchronization between uPD765 and Z80 are now OK, CP/M running! JJStacino - 11/11/2011 : add the minidisque support -3 pouces 1/2 driver- JJStacino + 11/11/2011 : add minidisk (3.5") support JJStacino - don't forget to keep some information about these machine see DChector project : http://dchector.free.fr/ made by DanielCoulom - (and thanks to Daniel!) and Yves site : http://hectorvictor.free.fr/ (thank's too Yves!) + for more information about these machines, see the DChector project : http://dchector.free.fr/ made by DanielCoulom + (thanks to Daniel) and Yves site : http://hectorvictor.free.fr/ (thanks too Yves!) + + TODO : Add cartridge functionality + Adjust the one-shot and A/D timing (sn76477) - TODO : Add the cartridge function, - Add diskette support, (done !) - Adjust the one shot and A/D timing (sn76477) ****************************************************************************/ /* Joystick 1 : - clavier numerique : + Numpad : (UP)5 (left)1 (right)3 (down)2 @@ -77,7 +77,6 @@ #include "cpu/z80/z80.h" #include "imagedev/cassette.h" #include "imagedev/printer.h" -#include "machine/upd765.h" /* for floppy disc controller */ #include "sound/discrete.h" /* for 1 Bit sound*/ #include "sound/wave.h" /* for K7 sound*/ @@ -89,83 +88,74 @@ #include "formats/hector_minidisc.h" -/*****************************************************************************/ void hec2hrp_state::hecdisc2_mem(address_map &map) { -/*****************************************************************************/ map.unmap_value_high(); - /* Hardward address mapping*/ - map(0x0000, 0x3fff).bankrw("bank3"); /*zone with ROM at start up, RAM later*/ - + map(0x0000, 0x3fff).bankrw("bank3"); /* ROM at start up, RAM later */ map(0x4000, 0xffff).ram(); - } void hec2hrp_state::hecdisc2_io(address_map &map) { map.unmap_value_high(); map.global_mask(0xff); - // ROM Page managing - map(0x000, 0x00f).rw(this, FUNC(hec2hrp_state::hector_disc2_io00_port_r), FUNC(hec2hrp_state::hector_disc2_io00_port_w)); - // RS232 - 8251 managing - map(0x020, 0x02f).rw(this, FUNC(hec2hrp_state::hector_disc2_io20_port_r), FUNC(hec2hrp_state::hector_disc2_io20_port_w)); - // Hector communication managing - map(0x030, 0x03f).rw(this, FUNC(hec2hrp_state::hector_disc2_io30_port_r), FUNC(hec2hrp_state::hector_disc2_io30_port_w)); - map(0x040, 0x04f).rw(this, FUNC(hec2hrp_state::hector_disc2_io40_port_r), FUNC(hec2hrp_state::hector_disc2_io40_port_w)); - map(0x050, 0x05f).rw(this, FUNC(hec2hrp_state::hector_disc2_io50_port_r), FUNC(hec2hrp_state::hector_disc2_io50_port_w)); - // uPD765 link: - map(0x060, 0x061).m("upd765", FUNC(upd765a_device::map)); - map(0x070, 0x07f).rw("upd765", FUNC(upd765a_device::mdma_r), FUNC(upd765a_device::mdma_w)); + // ROM page handling + map(0x000, 0x00f).rw(this, FUNC(hec2hrp_state::disc2_io00_port_r), FUNC(hec2hrp_state::disc2_io00_port_w)); + // RS232 - 8251 comms handling + map(0x020, 0x02f).rw(this, FUNC(hec2hrp_state::disc2_io20_port_r), FUNC(hec2hrp_state::disc2_io20_port_w)); + // Hector comms handling + map(0x030, 0x03f).rw(this, FUNC(hec2hrp_state::disc2_io30_port_r), FUNC(hec2hrp_state::disc2_io30_port_w)); + map(0x040, 0x04f).rw(this, FUNC(hec2hrp_state::disc2_io40_port_r), FUNC(hec2hrp_state::disc2_io40_port_w)); + map(0x050, 0x05f).rw(this, FUNC(hec2hrp_state::disc2_io50_port_r), FUNC(hec2hrp_state::disc2_io50_port_w)); + // uPD765 link + map(0x060, 0x061).m(m_upd_fdc, FUNC(upd765a_device::map)); + map(0x070, 0x07f).rw(m_upd_fdc, FUNC(upd765a_device::mdma_r), FUNC(upd765a_device::mdma_w)); } -/*****************************************************************************/ void hec2hrp_state::hec2hrp_mem(address_map &map) { -/*****************************************************************************/ map.unmap_value_high(); /* Main ROM page*/ map(0x0000, 0x3fff).rom(); - /* Hardware address mapping*/ - map(0x0800, 0x0808).w(this, FUNC(hec2hrp_state::hector_switch_bank_w));/* Bank management*/ - map(0x1000, 0x1000).w(this, FUNC(hec2hrp_state::hector_color_a_w)); /* Color c0/c1*/ - map(0x1800, 0x1800).w(this, FUNC(hec2hrp_state::hector_color_b_w)); /* Color c2/c3*/ - map(0x2000, 0x2003).w(this, FUNC(hec2hrp_state::hector_sn_2000_w)); /* Sound*/ - map(0x2800, 0x2803).w(this, FUNC(hec2hrp_state::hector_sn_2800_w)); /* Sound*/ - map(0x3000, 0x3000).rw(this, FUNC(hec2hrp_state::hector_cassette_r), FUNC(hec2hrp_state::hector_sn_3000_w));/* Write necessary*/ - map(0x3800, 0x3807).rw(this, FUNC(hec2hrp_state::hector_keyboard_r), FUNC(hec2hrp_state::hector_keyboard_w)); /* Keyboard*/ - - /* Video br mapping*/ + /* Hardware address mapping */ + map(0x0800, 0x0808).w(this, FUNC(hec2hrp_state::switch_bank_w));/* Bank handling */ + map(0x1000, 0x1000).w(this, FUNC(hec2hrp_state::color_a_w)); /* Color c0/c1 */ + map(0x1800, 0x1800).w(this, FUNC(hec2hrp_state::color_b_w)); /* Color c2/c3 */ + map(0x2000, 0x2003).w(this, FUNC(hec2hrp_state::sn_2000_w)); /* Sound */ + map(0x2800, 0x2803).w(this, FUNC(hec2hrp_state::sn_2800_w)); /* Sound */ + map(0x3000, 0x3000).rw(this, FUNC(hec2hrp_state::cassette_r), FUNC(hec2hrp_state::sn_3000_w)); /* Write necessary */ + map(0x3800, 0x3807).rw(this, FUNC(hec2hrp_state::keyboard_r), FUNC(hec2hrp_state::keyboard_w)); /* Keyboard */ + + /* Video br mapping */ map(0x4000, 0x49ff).ram().share("videoram"); - /* continous RAM*/ + /* contiguous RAM */ map(0x4A00, 0xbfff).ram(); - /* from 0xC000 to 0xFFFF => Bank Ram for video and data !*/ + /* from 0xC000 to 0xFFFF => Bank Ram for video and data */ map(0xc000, 0xffff).ram().share("hector_videoram"); } -/*****************************************************************************/ void hec2hrp_state::hec2hrx_mem(address_map &map) { -/*****************************************************************************/ map.unmap_value_high(); /* Main ROM page*/ map(0x0000, 0x3fff).bankr("bank2"); /* Hardware address mapping*/ - map(0x0800, 0x0808).w(this, FUNC(hec2hrp_state::hector_switch_bank_w));/* Bank management*/ - map(0x1000, 0x1000).w(this, FUNC(hec2hrp_state::hector_color_a_w)); /* Color c0/c1*/ - map(0x1800, 0x1800).w(this, FUNC(hec2hrp_state::hector_color_b_w)); /* Color c2/c3*/ - map(0x2000, 0x2003).w(this, FUNC(hec2hrp_state::hector_sn_2000_w)); /* Sound*/ - map(0x2800, 0x2803).w(this, FUNC(hec2hrp_state::hector_sn_2800_w)); /* Sound*/ - map(0x3000, 0x3000).rw(this, FUNC(hec2hrp_state::hector_cassette_r), FUNC(hec2hrp_state::hector_sn_3000_w));/* Write necessary*/ - map(0x3800, 0x3807).rw(this, FUNC(hec2hrp_state::hector_keyboard_r), FUNC(hec2hrp_state::hector_keyboard_w)); /* Keyboard*/ - - /* Video br mapping*/ + map(0x0800, 0x0808).w(this, FUNC(hec2hrp_state::switch_bank_w));/* Bank handling */ + map(0x1000, 0x1000).w(this, FUNC(hec2hrp_state::color_a_w)); /* Color c0/c1 */ + map(0x1800, 0x1800).w(this, FUNC(hec2hrp_state::color_b_w)); /* Color c2/c3 */ + map(0x2000, 0x2003).w(this, FUNC(hec2hrp_state::sn_2000_w)); /* Sound */ + map(0x2800, 0x2803).w(this, FUNC(hec2hrp_state::sn_2800_w)); /* Sound */ + map(0x3000, 0x3000).rw(this, FUNC(hec2hrp_state::cassette_r), FUNC(hec2hrp_state::sn_3000_w)); /* Write necessary */ + map(0x3800, 0x3807).rw(this, FUNC(hec2hrp_state::keyboard_r), FUNC(hec2hrp_state::keyboard_w)); /* Keyboard */ + + /* Video br mapping */ map(0x4000, 0x49ff).ram().share("videoram"); - /* continous RAM*/ + /* contiguous RAM */ map(0x4A00, 0xbfff).ram(); - /* from 0xC000 to 0xFFFF => Bank Ram for video and data !*/ + /* from 0xC000 to 0xFFFF => Bank Ram for video and data */ map(0xc000, 0xffff).bankrw("bank1").share("hector_videoram"); } @@ -173,14 +163,14 @@ void hec2hrp_state::hec2hrp_io(address_map &map) { map.unmap_value_high(); map.global_mask(0xff); - map(0x000, 0x0ff).rw(this, FUNC(hec2hrp_state::hector_io_8255_r), FUNC(hec2hrp_state::hector_io_8255_w)); + map(0x000, 0x0ff).rw(this, FUNC(hec2hrp_state::io_8255_r), FUNC(hec2hrp_state::io_8255_w)); } void hec2hrp_state::hec2hrx_io(address_map &map) { map.unmap_value_high(); map.global_mask(0xff); - map(0x0f0, 0x0ff).rw(this, FUNC(hec2hrp_state::hector_io_8255_r), FUNC(hec2hrp_state::hector_io_8255_w)); + map(0x0f0, 0x0ff).rw(this, FUNC(hec2hrp_state::io_8255_r), FUNC(hec2hrp_state::io_8255_w)); } void hec2hrp_state::hec2mdhrx_io(address_map &map) @@ -188,26 +178,26 @@ void hec2hrp_state::hec2mdhrx_io(address_map &map) map.unmap_value_high(); map.global_mask(0xff); - // Minidisc commands and changing the rom page !*/ + // Minidisc commands and changing the rom page */ map(0x04, 0x07).rw(m_minidisc_fdc, FUNC(fd1793_device::read), FUNC(fd1793_device::write)); map(0x08, 0x08).w(this, FUNC(hec2hrp_state::minidisc_control_w)); - map(0x0f0, 0x0ff).rw(this, FUNC(hec2hrp_state::hector_io_8255_r), FUNC(hec2hrp_state::hector_io_8255_w)); + map(0x0f0, 0x0ff).rw(this, FUNC(hec2hrp_state::io_8255_r), FUNC(hec2hrp_state::io_8255_w)); } void hec2hrp_state::hec2mx40_io(address_map &map) { map.unmap_value_high(); map.global_mask(0xff); - map(0x000, 0x0ef).w(this, FUNC(hec2hrp_state::hector_mx40_io_port_w)); - map(0x0f0, 0x0f3).rw(this, FUNC(hec2hrp_state::hector_io_8255_r), FUNC(hec2hrp_state::hector_io_8255_w)); + map(0x000, 0x0ef).w(this, FUNC(hec2hrp_state::mx40_io_port_w)); + map(0x0f0, 0x0f3).rw(this, FUNC(hec2hrp_state::io_8255_r), FUNC(hec2hrp_state::io_8255_w)); } void hec2hrp_state::hec2mx80_io(address_map &map) { map.unmap_value_high(); map.global_mask(0xff); - map(0x000, 0x0ef).w(this, FUNC(hec2hrp_state::hector_mx80_io_port_w)); - map(0x0f0, 0x0f3).rw(this, FUNC(hec2hrp_state::hector_io_8255_r), FUNC(hec2hrp_state::hector_io_8255_w)); + map(0x000, 0x0ef).w(this, FUNC(hec2hrp_state::mx80_io_port_w)); + map(0x0f0, 0x0f3).rw(this, FUNC(hec2hrp_state::io_8255_r), FUNC(hec2hrp_state::io_8255_w)); } @@ -224,7 +214,7 @@ static INPUT_PORTS_START( hec2hrp ) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Caps Lock") PORT_CODE(KEYCODE_CAPSLOCK) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ctrl") PORT_CODE(KEYCODE_LCONTROL) PORT_CHAR(UCHAR_MAMEKEY(LCONTROL)) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Shift") PORT_CODE(KEYCODE_LSHIFT) PORT_CODE(KEYCODE_RSHIFT) PORT_CHAR(UCHAR_SHIFT_1) - PORT_START("KEY.1") /* [1] - port 3000 @ 1 */ /* touches => 2 1 0 / . - , + */ + PORT_START("KEY.1") /* [1] - port 3000 @ 1 */ /* buttons => 2 1 0 / . - , + */ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("2 \"") PORT_CODE(KEYCODE_2) PORT_CHAR('2') PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1 >") PORT_CODE(KEYCODE_1) PORT_CHAR('1') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("0 <") PORT_CODE(KEYCODE_0) PORT_CHAR('0') @@ -234,7 +224,7 @@ static INPUT_PORTS_START( hec2hrp ) PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('=') PORT_CHAR('+') - PORT_START("KEY.2") /* [1] - port 3000 @ 2 */ /* touches => .. 9 8 7 6 5 4 3 */ + PORT_START("KEY.2") /* [1] - port 3000 @ 2 */ /* buttons => .. 9 8 7 6 5 4 3 */ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("9 )") PORT_CODE(KEYCODE_9) PORT_CHAR('9') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("8 (") PORT_CODE(KEYCODE_8) PORT_CHAR('8') @@ -243,7 +233,7 @@ static INPUT_PORTS_START( hec2hrp ) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("5 %") PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("4 $") PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3 /") PORT_CODE(KEYCODE_3) PORT_CHAR('3') - PORT_START("KEY.3") /* [1] - port 3000 @ 3 */ /* touches => B A .. ? .. = .. ; */ + PORT_START("KEY.3") /* [1] - port 3000 @ 3 */ /* buttons => B A .. ? .. = .. ; */ PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) PORT_CHAR('B') PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("A") PORT_CODE(KEYCODE_Q) PORT_CHAR('Q') PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) @@ -303,9 +293,7 @@ static INPUT_PORTS_START( hec2hrp ) PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED) INPUT_PORTS_END -/*****************************************************************************/ MACHINE_START_MEMBER(hec2hrp_state,hec2hrp) -/*****************************************************************************/ { hector_init(); } @@ -315,35 +303,32 @@ MACHINE_RESET_MEMBER(hec2hrp_state,hec2hrp) // Machines init hector_reset(1, 0); } -/*****************************************************************************/ + MACHINE_START_MEMBER(hec2hrp_state,hec2hrx) -/*****************************************************************************/ { - uint8_t *RAM = memregion("maincpu" )->base(); // pointer to mess ram + uint8_t *RAM = memregion("maincpu")->base(); //Patch rom possible ! - //RAMD2[0xff6b] = 0x0ff; // force verbose mode hector ! + //RAMD2[0xff6b] = 0x0ff; // force verbose mode // Memory install for bank switching - membank("bank1")->configure_entry(HECTOR_BANK_PROG , &RAM[0xc000] ); // Mess ram - membank("bank1")->configure_entry(HECTOR_BANK_VIDEO, m_hector_videoram_hrx); // Video ram + membank("bank1")->configure_entry(HECTOR_BANK_PROG , &RAM[0xc000] ); + membank("bank1")->configure_entry(HECTOR_BANK_VIDEO, m_hector_videoram_hrx); // Video RAM // Set bank HECTOR_BANK_PROG as basic bank membank("bank1")->set_entry(HECTOR_BANK_PROG); -/******************************************************SPECIFIQUE MX ***************************/ - membank("bank2")->configure_entry(HECTORMX_BANK_PAGE0 , &RAM[0x0000] ); // Mess ram - membank("bank2")->configure_entry(HECTORMX_BANK_PAGE1 , memregion("page1")->base() ); // Rom page 1 - membank("bank2")->configure_entry(HECTORMX_BANK_PAGE2 , memregion("page2")->base() ); // Rom page 2 + // MX-specific + membank("bank2")->configure_entry(HECTORMX_BANK_PAGE0 , &RAM[0x0000]); + membank("bank2")->configure_entry(HECTORMX_BANK_PAGE1 , memregion("page1")->base() ); // ROM page 1 + membank("bank2")->configure_entry(HECTORMX_BANK_PAGE2 , memregion("page2")->base() ); // ROM page 2 membank("bank2")->set_entry(HECTORMX_BANK_PAGE0); -/******************************************************SPECIFIQUE MX ***************************/ -/*************************************************SPECIFIQUE DISK II ***************************/ + // Disk II-specific membank("bank3")->configure_entry(DISCII_BANK_ROM , memregion("rom_disc2")->base() ); // ROM membank("bank3")->configure_entry(DISCII_BANK_RAM , memregion("disc2mem" )->base() ); // RAM membank("bank3")->set_entry(DISCII_BANK_ROM); -/*************************************************SPECIFIQUE DISK II ***************************/ - // As video HR ram is in bank, use extern memory + // As video HR ram is in bank, use external memory m_hector_videoram.set_target(m_hector_videoram_hrx,m_hector_videoram.bytes()); hector_init(); @@ -353,52 +338,51 @@ MACHINE_START_MEMBER(hec2hrp_state,hec2mdhrx) /*****************************************************************************/ //minidisc { - uint8_t *RAM = memregion("maincpu" )->base(); // pointer to mess ram + uint8_t *RAM = memregion("maincpu")->base(); // Memory install for bank switching - membank("bank1")->configure_entry(HECTOR_BANK_PROG , &RAM[0xc000] ); // Mess ram - membank("bank1")->configure_entry(HECTOR_BANK_VIDEO, m_hector_videoram_hrx); // Video ram + membank("bank1")->configure_entry(HECTOR_BANK_PROG, &RAM[0xc000]); + membank("bank1")->configure_entry(HECTOR_BANK_VIDEO, m_hector_videoram_hrx); // Video RAM - // Set bank HECTOR_BANK_PROG as basic bank + // Set HECTOR_BANK_PROG as basic bank membank("bank1")->set_entry(HECTOR_BANK_PROG); - //Here the bank 5 is not used for the language switch but for the floppy ROM..... - /******************************************************SPECIFIQUE Mini disque ***************************/ - membank("bank2")->configure_entry(HECTOR_BANK_BASE , &RAM[0x0000] ); // Rom base page - membank("bank2")->configure_entry(HECTOR_BANK_DISC , memregion("page2")->base() ); // Rom page mini disc + //Here, bank 5 is not used for the language switch but for the floppy ROM + + // Mini disk-specific + membank("bank2")->configure_entry(HECTOR_BANK_BASE, &RAM[0x0000]); // ROM base page + membank("bank2")->configure_entry(HECTOR_BANK_DISC, memregion("page2")->base() ); // ROM mini disc page membank("bank2")->set_entry(HECTOR_BANK_BASE); - /******************************************************SPECIFIQUE Mini disque ***************************/ - // As video HR ram is in bank, use extern memory + // As video HR ram is in bank, use external memory m_hector_videoram.set_target(m_hector_videoram_hrx,m_hector_videoram.bytes()); hector_init(); } + MACHINE_RESET_MEMBER(hec2hrp_state,hec2hrx) { - //Hector Memory + // Hector Memory membank("bank1")->set_entry(HECTOR_BANK_PROG); membank("bank2")->set_entry(HECTORMX_BANK_PAGE0); - //DISK II Memory + + // DISK II Memory membank("bank3")->set_entry(DISCII_BANK_ROM); - // Machines init hector_reset(1, 1); hector_disc2_reset(); } -//minidisc + +// Mini disk MACHINE_RESET_MEMBER(hec2hrp_state,hec2mdhrx) { - //Hector Memory + // Hector Memory membank("bank1")->set_entry(HECTOR_BANK_PROG); membank("bank2")->set_entry(HECTORMX_BANK_PAGE0); - // Machines init hector_reset(1, 0); } -/***********************************************************/ -/********* mini disque interface ***************************/ -/***********************************************************/ +// mini disk interface FLOPPY_FORMATS_MEMBER( hec2hrp_state::minidisc_formats ) FLOPPY_HMD_FORMAT @@ -410,10 +394,7 @@ static void minidisc_floppies(device_slot_interface &device) } -/******************************************************************************/ MACHINE_CONFIG_START(hec2hrp_state::hec2hr) -/******************************************************************************/ - /* basic machine hardware */ MCFG_DEVICE_ADD("maincpu", Z80, 5_MHz_XTAL) MCFG_DEVICE_PROGRAM_MAP(hec2hrp_mem) MCFG_DEVICE_IO_MAP(hec2hrp_io) @@ -421,7 +402,6 @@ MACHINE_CONFIG_START(hec2hrp_state::hec2hr) MCFG_MACHINE_RESET_OVERRIDE(hec2hrp_state,hec2hrp) MCFG_MACHINE_START_OVERRIDE(hec2hrp_state,hec2hrp) - /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(400)) /* 2500 not accurate */ @@ -435,20 +415,14 @@ MACHINE_CONFIG_START(hec2hrp_state::hec2hr) hector_audio(config); - /* Gestion cassette*/ MCFG_CASSETTE_ADD( "cassette" ) MCFG_CASSETTE_FORMATS(hector_cassette_formats) MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - /* printer */ MCFG_DEVICE_ADD("printer", PRINTER, 0) - MACHINE_CONFIG_END -/*****************************************************************************/ MACHINE_CONFIG_START(hec2hrp_state::hec2hrp) -/*****************************************************************************/ - /* basic machine hardware */ MCFG_DEVICE_ADD("maincpu", Z80, 5_MHz_XTAL) MCFG_DEVICE_PROGRAM_MAP(hec2hrp_mem) MCFG_DEVICE_IO_MAP(hec2hrp_io) @@ -456,7 +430,6 @@ MACHINE_CONFIG_START(hec2hrp_state::hec2hrp) MCFG_MACHINE_RESET_OVERRIDE(hec2hrp_state,hec2hrp) MCFG_MACHINE_START_OVERRIDE(hec2hrp_state,hec2hrp) - /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(400)) /* 2500 not accurate */ @@ -470,14 +443,11 @@ MACHINE_CONFIG_START(hec2hrp_state::hec2hrp) hector_audio(config); - /* Gestion cassette*/ MCFG_CASSETTE_ADD( "cassette" ) MCFG_CASSETTE_FORMATS(hector_cassette_formats) MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - /* printer */ MCFG_DEVICE_ADD("printer", PRINTER, 0) - MACHINE_CONFIG_END static void hector_floppies(device_slot_interface &device) @@ -485,28 +455,23 @@ static void hector_floppies(device_slot_interface &device) device.option_add("525hd", FLOPPY_525_HD); } -/*****************************************************************************/ MACHINE_CONFIG_START(hec2hrp_state::hec2mx40) -/*****************************************************************************/ - /* basic machine hardware */ MCFG_DEVICE_ADD("maincpu", Z80, 5_MHz_XTAL) MCFG_DEVICE_PROGRAM_MAP(hec2hrx_mem) MCFG_DEVICE_IO_MAP(hec2mx40_io) MCFG_DEVICE_PERIODIC_INT_DRIVER(hec2hrp_state, irq0_line_hold, 50) // put on the Z80 irq in Hz - /* Disc II unit */ MCFG_DEVICE_ADD("disc2cpu", Z80, 4_MHz_XTAL) MCFG_DEVICE_PROGRAM_MAP(hecdisc2_mem) MCFG_DEVICE_IO_MAP(hecdisc2_io) - MCFG_UPD765A_ADD("upd765", false, true) + MCFG_UPD765A_ADD(m_upd_fdc, false, true) MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(*this, hec2hrp_state, disc2_fdc_interrupt)) MCFG_UPD765_DRQ_CALLBACK(WRITELINE(*this, hec2hrp_state, disc2_fdc_dma_irq)) - MCFG_FLOPPY_DRIVE_ADD("upd765:0", hector_floppies, "525hd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765:1", hector_floppies, "525hd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(m_upd_connector[0], hector_floppies, "525hd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(m_upd_connector[1], hector_floppies, "525hd", floppy_image_device::default_floppy_formats) MCFG_MACHINE_RESET_OVERRIDE(hec2hrp_state,hec2hrx) MCFG_MACHINE_START_OVERRIDE(hec2hrp_state,hec2hrx) - /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(400)) /* 2500 not accurate */ @@ -520,19 +485,15 @@ MACHINE_CONFIG_START(hec2hrp_state::hec2mx40) hector_audio(config); - /* Gestion cassette*/ MCFG_CASSETTE_ADD( "cassette" ) MCFG_CASSETTE_FORMATS(hector_cassette_formats) MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - /* printer */ MCFG_DEVICE_ADD("printer", PRINTER, 0) - MACHINE_CONFIG_END -/*****************************************************************************/ + + MACHINE_CONFIG_START(hec2hrp_state::hec2hrx) -/*****************************************************************************/ -/* basic machine hardware */ MCFG_DEVICE_ADD("maincpu", Z80, 5_MHz_XTAL) MCFG_DEVICE_PROGRAM_MAP(hec2hrx_mem) MCFG_DEVICE_IO_MAP(hec2hrx_io) @@ -540,17 +501,15 @@ MACHINE_CONFIG_START(hec2hrp_state::hec2hrx) MCFG_MACHINE_RESET_OVERRIDE(hec2hrp_state,hec2hrx) MCFG_MACHINE_START_OVERRIDE(hec2hrp_state,hec2hrx) - /* Disc II unit */ MCFG_DEVICE_ADD("disc2cpu", Z80, 4_MHz_XTAL) MCFG_DEVICE_PROGRAM_MAP(hecdisc2_mem) MCFG_DEVICE_IO_MAP(hecdisc2_io) - MCFG_UPD765A_ADD("upd765", false, true) + MCFG_UPD765A_ADD(m_upd_fdc, false, true) MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(*this, hec2hrp_state, disc2_fdc_interrupt)) MCFG_UPD765_DRQ_CALLBACK(WRITELINE(*this, hec2hrp_state, disc2_fdc_dma_irq)) - MCFG_FLOPPY_DRIVE_ADD("upd765:0", hector_floppies, "525hd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765:1", hector_floppies, "525hd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(m_upd_connector[0], hector_floppies, "525hd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(m_upd_connector[1], hector_floppies, "525hd", floppy_image_device::default_floppy_formats) - /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(400)) /* 2500 not accurate */ @@ -564,20 +523,14 @@ MACHINE_CONFIG_START(hec2hrp_state::hec2hrx) hector_audio(config); - // Gestion cassette MCFG_CASSETTE_ADD( "cassette" ) MCFG_CASSETTE_FORMATS(hector_cassette_formats) MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - /* printer */ MCFG_DEVICE_ADD("printer", PRINTER, 0) - MACHINE_CONFIG_END -/*****************************************************************************/ + MACHINE_CONFIG_START(hec2hrp_state::hec2mdhrx) -/*****************************************************************************/ -// minidisc -/* basic machine hardware */ MCFG_DEVICE_ADD("maincpu", Z80, 5_MHz_XTAL) MCFG_DEVICE_PROGRAM_MAP(hec2hrx_mem) MCFG_DEVICE_IO_MAP(hec2mdhrx_io) @@ -585,12 +538,10 @@ MACHINE_CONFIG_START(hec2hrp_state::hec2mdhrx) MCFG_MACHINE_RESET_OVERRIDE(hec2hrp_state,hec2mdhrx) MCFG_MACHINE_START_OVERRIDE(hec2hrp_state,hec2mdhrx) - /* Mini Disc */ + /* 3.5" ("mini") disc */ MCFG_DEVICE_ADD("wd179x", FD1793, 1_MHz_XTAL) - MCFG_FLOPPY_DRIVE_ADD("wd179x:0", minidisc_floppies, "dd", hec2hrp_state::minidisc_formats) - /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(400)) /* 2500 not accurate */ @@ -605,20 +556,15 @@ MACHINE_CONFIG_START(hec2hrp_state::hec2mdhrx) hector_audio(config); - // Gestion cassette MCFG_CASSETTE_ADD( "cassette" ) MCFG_CASSETTE_FORMATS(hector_cassette_formats) MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - /* printer */ MCFG_DEVICE_ADD("printer", PRINTER, 0) - MACHINE_CONFIG_END -/*****************************************************************************/ + MACHINE_CONFIG_START(hec2hrp_state::hec2mx80) -/*****************************************************************************/ - /* basic machine hardware */ MCFG_DEVICE_ADD("maincpu", Z80, 5_MHz_XTAL) MCFG_DEVICE_PROGRAM_MAP(hec2hrx_mem) MCFG_DEVICE_IO_MAP(hec2mx80_io) @@ -626,17 +572,15 @@ MACHINE_CONFIG_START(hec2hrp_state::hec2mx80) MCFG_MACHINE_RESET_OVERRIDE(hec2hrp_state,hec2hrx) MCFG_MACHINE_START_OVERRIDE(hec2hrp_state,hec2hrx) - /* Disc II unit */ MCFG_DEVICE_ADD("disc2cpu", Z80, 4_MHz_XTAL) MCFG_DEVICE_PROGRAM_MAP(hecdisc2_mem) MCFG_DEVICE_IO_MAP(hecdisc2_io) - MCFG_UPD765A_ADD("upd765", false, true) + MCFG_UPD765A_ADD(m_upd_fdc, false, true) MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(*this, hec2hrp_state, disc2_fdc_interrupt)) MCFG_UPD765_DRQ_CALLBACK(WRITELINE(*this, hec2hrp_state, disc2_fdc_dma_irq)) - MCFG_FLOPPY_DRIVE_ADD("upd765:0", hector_floppies, "525hd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765:1", hector_floppies, "525hd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(m_upd_connector[0], hector_floppies, "525hd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(m_upd_connector[1], hector_floppies, "525hd", floppy_image_device::default_floppy_formats) - /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(50) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(400)) /* 2500 not accurate */ @@ -650,17 +594,13 @@ MACHINE_CONFIG_START(hec2hrp_state::hec2mx80) hector_audio(config); - /* Gestion cassette*/ MCFG_CASSETTE_ADD( "cassette" ) MCFG_CASSETTE_FORMATS(hector_cassette_formats) MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - /* printer */ MCFG_DEVICE_ADD("printer", PRINTER, 0) +MACHINE_CONFIG_END - MACHINE_CONFIG_END - -/* ROM definition */ ROM_START( hec2hr ) ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) ROM_LOAD( "2hr.bin", 0x0000, 0x1000, CRC(84b9e672) SHA1(8c8b089166122eee565addaed10f84c5ce6d849b)) @@ -695,6 +635,7 @@ ROM_START( hec2hrx ) ROM_LOAD( "d800k.bin" , 0x0000,0x1000, CRC(831bd584) SHA1(9782ee58f570042608d9d568b2c3fc4c6d87d8b9)) ROM_REGION( 0x10000, "disc2mem", ROMREGION_ERASE00 ) ROM_END + // minidisc ROM_START( hec2mdhrx ) ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF ) diff --git a/src/mame/drivers/interact.cpp b/src/mame/drivers/interact.cpp index 4070d5ed292..bfd9ead3b5d 100644 --- a/src/mame/drivers/interact.cpp +++ b/src/mame/drivers/interact.cpp @@ -90,13 +90,13 @@ void interact_state::interact_mem(address_map &map) /* AM_RANGE(0x1000,0x3fff) AM_RAM*/ /* Hardware address mapping*/ -/* AM_RANGE(0x0800,0x0808) AM_WRITE(hector_switch_bank_w)// Bank management not udsed in BR machine*/ - map(0x1000, 0x1000).w(this, FUNC(interact_state::hector_color_a_w)); /* Color c0/c1*/ - map(0x1800, 0x1800).w(this, FUNC(interact_state::hector_color_b_w)); /* Color c2/c3*/ - map(0x2000, 0x2003).w(this, FUNC(interact_state::hector_sn_2000_w)); /* Sound*/ - map(0x2800, 0x2803).w(this, FUNC(interact_state::hector_sn_2800_w)); /* Sound*/ - map(0x3000, 0x3000).rw(this, FUNC(interact_state::hector_cassette_r), FUNC(interact_state::hector_sn_3000_w));/* Write necessary*/ - map(0x3800, 0x3807).rw(this, FUNC(interact_state::hector_keyboard_r), FUNC(interact_state::hector_keyboard_w)); /* Keyboard*/ +/* AM_RANGE(0x0800,0x0808) AM_WRITE(switch_bank_w)// Bank management not udsed in BR machine*/ + map(0x1000, 0x1000).w(this, FUNC(interact_state::color_a_w)); /* Color c0/c1*/ + map(0x1800, 0x1800).w(this, FUNC(interact_state::color_b_w)); /* Color c2/c3*/ + map(0x2000, 0x2003).w(this, FUNC(interact_state::sn_2000_w)); /* Sound*/ + map(0x2800, 0x2803).w(this, FUNC(interact_state::sn_2800_w)); /* Sound*/ + map(0x3000, 0x3000).rw(this, FUNC(interact_state::cassette_r), FUNC(interact_state::sn_3000_w));/* Write necessary*/ + map(0x3800, 0x3807).rw(this, FUNC(interact_state::keyboard_r), FUNC(interact_state::keyboard_w)); /* Keyboard*/ /* Video br mapping*/ map(0x4000, 0x49ff).ram().share("videoram"); diff --git a/src/mame/includes/hec2hrp.h b/src/mame/includes/hec2hrp.h index 7ac2f32f4b9..3083818ae8a 100644 --- a/src/mame/includes/hec2hrp.h +++ b/src/mame/includes/hec2hrp.h @@ -43,10 +43,12 @@ #pragma once -#include "machine/upd765.h" -#include "machine/wd_fdc.h" #include "imagedev/flopdrv.h" #include "imagedev/cassette.h" +#include "imagedev/printer.h" +#include "machine/upd765.h" +#include "machine/wd_fdc.h" +#include "sound/discrete.h" /* for 1 Bit sound*/ #include "sound/sn76477.h" /* for sn sound*/ /* Enum status for high memory bank (c000 - ffff)*/ @@ -83,20 +85,62 @@ public: m_maincpu(*this, "maincpu"), m_disc2cpu(*this, "disc2cpu"), m_cassette(*this, "cassette"), + m_discrete(*this, "discrete"), m_sn(*this, "sn76477"), m_palette(*this, "palette"), m_videoram(*this,"videoram"), m_hector_videoram(*this,"hector_videoram") , m_keyboard(*this, "KEY.%u", 0), m_minidisc_fdc(*this, "wd179x"), - m_floppy0(*this, "wd179x:0") + m_floppy0(*this, "wd179x:0"), + m_upd_fdc(*this, "upd765"), + m_upd_connector(*this, "upd765:%u", 0U), + m_printer(*this, "printer") {} + DECLARE_WRITE8_MEMBER(minidisc_control_w); + + DECLARE_WRITE8_MEMBER(switch_bank_w); + DECLARE_WRITE8_MEMBER(keyboard_w); + DECLARE_READ8_MEMBER(keyboard_r); + DECLARE_WRITE8_MEMBER(sn_2000_w); + DECLARE_WRITE8_MEMBER(sn_2800_w); + DECLARE_READ8_MEMBER(cassette_r); + DECLARE_WRITE8_MEMBER(sn_3000_w); + DECLARE_WRITE8_MEMBER(color_a_w); + DECLARE_WRITE8_MEMBER(color_b_w); + DECLARE_READ8_MEMBER(io_8255_r); + DECLARE_WRITE8_MEMBER(io_8255_w); + DECLARE_WRITE8_MEMBER(mx40_io_port_w); + DECLARE_WRITE8_MEMBER(mx80_io_port_w); + + // disc2 handling + DECLARE_READ8_MEMBER( disc2_io00_port_r); + DECLARE_WRITE8_MEMBER( disc2_io00_port_w); + DECLARE_READ8_MEMBER( disc2_io20_port_r); + DECLARE_WRITE8_MEMBER( disc2_io20_port_w); + DECLARE_READ8_MEMBER( disc2_io30_port_r); + DECLARE_WRITE8_MEMBER( disc2_io30_port_w); + DECLARE_READ8_MEMBER( disc2_io40_port_r); + DECLARE_WRITE8_MEMBER( disc2_io40_port_w); + DECLARE_READ8_MEMBER( disc2_io50_port_r); + DECLARE_WRITE8_MEMBER( disc2_io50_port_w); + + void hec2mx80(machine_config &config); + void hec2hrp(machine_config &config); + void hec2hrx(machine_config &config); + void hec2mx40(machine_config &config); + void hec2mdhrx(machine_config &config); + void hec2hr(machine_config &config); + void hector_audio(machine_config &config); + +protected: DECLARE_FLOPPY_FORMATS(minidisc_formats); required_device m_maincpu; optional_device m_disc2cpu; required_device m_cassette; + required_device m_discrete; required_device m_sn; required_device m_palette; optional_shared_ptr m_videoram; @@ -106,6 +150,11 @@ public: optional_device m_minidisc_fdc; optional_device m_floppy0; + optional_device m_upd_fdc; + optional_device_array m_upd_connector; + + optional_device m_printer; + uint8_t m_hector_flag_hr; uint8_t m_hector_flag_80c; uint8_t m_hector_color[4]; @@ -144,21 +193,6 @@ public: int m_print; uint8_t m_hector_videoram_hrx[0x04000]; - DECLARE_WRITE8_MEMBER(minidisc_control_w); - - DECLARE_WRITE8_MEMBER(hector_switch_bank_w); - DECLARE_WRITE8_MEMBER(hector_keyboard_w); - DECLARE_READ8_MEMBER(hector_keyboard_r); - DECLARE_WRITE8_MEMBER(hector_sn_2000_w); - DECLARE_WRITE8_MEMBER(hector_sn_2800_w); - DECLARE_READ8_MEMBER(hector_cassette_r); - DECLARE_WRITE8_MEMBER(hector_sn_3000_w); - DECLARE_WRITE8_MEMBER(hector_color_a_w); - DECLARE_WRITE8_MEMBER(hector_color_b_w); - DECLARE_READ8_MEMBER(hector_io_8255_r); - DECLARE_WRITE8_MEMBER(hector_io_8255_w); - DECLARE_WRITE8_MEMBER(hector_mx40_io_port_w); - DECLARE_WRITE8_MEMBER(hector_mx80_io_port_w); DECLARE_MACHINE_START(hec2hrp); DECLARE_MACHINE_RESET(hec2hrp); DECLARE_VIDEO_START(hec2hrp); @@ -185,26 +219,8 @@ public: void hector_hr(bitmap_ind16 &bitmap, uint8_t *page, int ymax, int yram); /*----------- defined in machine/hecdisk2.c -----------*/ - // disc2 handling - DECLARE_READ8_MEMBER( hector_disc2_io00_port_r); - DECLARE_WRITE8_MEMBER( hector_disc2_io00_port_w); - DECLARE_READ8_MEMBER( hector_disc2_io20_port_r); - DECLARE_WRITE8_MEMBER( hector_disc2_io20_port_w); - DECLARE_READ8_MEMBER( hector_disc2_io30_port_r); - DECLARE_WRITE8_MEMBER( hector_disc2_io30_port_w); - DECLARE_READ8_MEMBER( hector_disc2_io40_port_r); - DECLARE_WRITE8_MEMBER( hector_disc2_io40_port_w); - DECLARE_READ8_MEMBER( hector_disc2_io50_port_r); - DECLARE_WRITE8_MEMBER( hector_disc2_io50_port_w); - void hector_disc2_reset(); - void hec2mx80(machine_config &config); - void hec2hrp(machine_config &config); - void hec2hrx(machine_config &config); - void hec2mx40(machine_config &config); - void hec2mdhrx(machine_config &config); - void hec2hr(machine_config &config); - void hector_audio(machine_config &config); + void hec2hrp_io(address_map &map); void hec2hrp_mem(address_map &map); void hec2hrx_io(address_map &map); diff --git a/src/mame/machine/hec2hrp.cpp b/src/mame/machine/hec2hrp.cpp index 23ad6776e75..80e68739db2 100644 --- a/src/mame/machine/hec2hrp.cpp +++ b/src/mame/machine/hec2hrp.cpp @@ -44,11 +44,7 @@ #include "includes/hec2hrp.h" #include "cpu/z80/z80.h" -#include "imagedev/cassette.h" -#include "imagedev/printer.h" -#include "machine/upd765.h" /* for floppy disc controller */ #include "sound/wave.h" /* for K7 sound */ -#include "sound/discrete.h" /* for 1 Bit sound*/ #include "speaker.h" @@ -126,7 +122,7 @@ WRITE8_MEMBER( hec2hrp_state::minidisc_control_w ) membank("bank2")->set_entry(BIT(data, 5) ? HECTOR_BANK_BASE : HECTOR_BANK_DISC); } -WRITE8_MEMBER(hec2hrp_state::hector_switch_bank_w) +WRITE8_MEMBER(hec2hrp_state::switch_bank_w) { if (offset==0x00) { @@ -183,12 +179,12 @@ WRITE8_MEMBER(hec2hrp_state::hector_switch_bank_w) } } -WRITE8_MEMBER(hec2hrp_state::hector_keyboard_w) +WRITE8_MEMBER(hec2hrp_state::keyboard_w) { /* nothing to do (read function manages the value) */ } -READ8_MEMBER(hec2hrp_state::hector_keyboard_r) +READ8_MEMBER(hec2hrp_state::keyboard_r) { uint8_t data = 0xff; @@ -257,19 +253,19 @@ READ8_MEMBER(hec2hrp_state::hector_keyboard_r) return m_keyboard[offset]->read(); } -WRITE8_MEMBER(hec2hrp_state::hector_sn_2000_w) +WRITE8_MEMBER(hec2hrp_state::sn_2000_w) { update_state(0x2000+ offset, data); update_sound(space, data); } -WRITE8_MEMBER(hec2hrp_state::hector_sn_2800_w) +WRITE8_MEMBER(hec2hrp_state::sn_2800_w) { update_state(0x2800+ offset, data); update_sound(space, data); } -READ8_MEMBER(hec2hrp_state::hector_cassette_r) +READ8_MEMBER(hec2hrp_state::cassette_r) { double level; uint8_t value = 0; @@ -310,7 +306,7 @@ READ8_MEMBER(hec2hrp_state::hector_cassette_r) } return value; } -WRITE8_MEMBER(hec2hrp_state::hector_sn_3000_w) +WRITE8_MEMBER(hec2hrp_state::sn_3000_w) { m_state3000 = data & 0xf8; /* except bit 0 to 2*/ if ((data & 7) != m_oldstate3000 ) @@ -323,7 +319,7 @@ WRITE8_MEMBER(hec2hrp_state::hector_sn_3000_w) } /* Color Interface */ -WRITE8_MEMBER(hec2hrp_state::hector_color_a_w) +WRITE8_MEMBER(hec2hrp_state::color_a_w) { if (data & 0x40) { @@ -371,9 +367,8 @@ WRITE8_MEMBER(hec2hrp_state::hector_color_a_w) m_oldstate1000=data; /* For next step*/ } -WRITE8_MEMBER(hec2hrp_state::hector_color_b_w) +WRITE8_MEMBER(hec2hrp_state::color_b_w) { - discrete_device *discrete = machine().device("discrete"); m_hector_color[1] = data & 0x07; m_hector_color[3] = (data >> 3) & 0x07; @@ -381,7 +376,7 @@ WRITE8_MEMBER(hec2hrp_state::hector_color_b_w) if (data & 0x40) m_hector_color[2] |= 8; else m_hector_color[2] &= 7; /* Play bit*/ - discrete->write(space, NODE_01, (data & 0x80) ? 0:1 ); + m_discrete->write(space, NODE_01, (data & 0x80) ? 0:1 ); } @@ -390,7 +385,7 @@ WRITE8_MEMBER(hec2hrp_state::hector_color_b_w) ********************************************************************************/ /******************* READ PIO 8255 *******************/ -READ8_MEMBER(hec2hrp_state::hector_io_8255_r) +READ8_MEMBER(hec2hrp_state::io_8255_r) { /* 8255 in mode 0 */ uint8_t data =0; @@ -437,7 +432,7 @@ READ8_MEMBER(hec2hrp_state::hector_io_8255_r) /******************* WRITE PIO 8255 *******************/ -WRITE8_MEMBER(hec2hrp_state::hector_io_8255_w) +WRITE8_MEMBER(hec2hrp_state::io_8255_w) { /* 8255 in mode 0 */ if ((offset & 0x3) == 0x0) /* Port A => to printer or Disc II*/ @@ -445,16 +440,12 @@ WRITE8_MEMBER(hec2hrp_state::hector_io_8255_w) m_hector_port_a = data; /* Port A => to printer*/ /* Caution : The strobe connection to the printer seems not be used - So, all what is send to the Disc2 unit will be printed too! */ + So, everything sent to the Disc2 unit will be printed too! */ - if (BIT(m_hector_port_c_l, 0)) { // PC0 (bit X0)= strobe printer ! - printer_image_device *printer = machine().device("printer"); - printer->output(m_hector_port_a); + if (BIT(m_hector_port_c_l, 0)) // PC0 (bit 0) = strobe printer + { + m_printer->output(m_hector_port_a); } - -#ifdef DEBUG_TRACE_COM_HECTOR - printf("\nEcriture data par Hector %x (dans portA)",data); -#endif } if ((offset & 0x3) == 0x1) /* Port B */ @@ -463,24 +454,24 @@ WRITE8_MEMBER(hec2hrp_state::hector_io_8255_w) if ((offset & 0x3) == 0x2) /* Port C => depending cmd word */ { - if (!BIT(m_hector_port_cmd, 0)) /* cmd -> Quartet inf en sortie ?*/ + if (!BIT(m_hector_port_cmd, 0)) { m_hector_port_c_l = data & 0x0f; - // Utilizing bits port C : PC0 for the printer : strobe! - if (BIT(m_hector_port_c_l, 0)) // PC0 (bit 0)= true + // Utilizing bits port C : PC0 for the printer : strobe + if (BIT(m_hector_port_c_l, 0)) // PC0 (bit 0) = true { /* Port A goes to the printer */ } // Utilizing bits port C : PC1 // PC2 for the communication with disc2 - if (!BIT(m_hector_port_c_l, 1)) // PC1 (bit 1)= true + if (!BIT(m_hector_port_c_l, 1)) // PC1 (bit 1) = true { m_hector_port_b = m_hector_disc2_data_write; m_hector_disc2_data_w_ready = 0x00; } - if (!BIT(m_hector_port_c_l, 2)) // PC2 (bit 2)= true + if (!BIT(m_hector_port_c_l, 2)) // PC2 (bit 2) = true { m_hector_disc2_data_read = m_hector_port_a; - m_hector_disc2_data_r_ready = 0x08; /* memorisation de l'info */ + m_hector_disc2_data_r_ready = 0x08; } } if (!BIT(m_hector_port_cmd, 3)) @@ -496,7 +487,7 @@ WRITE8_MEMBER(hec2hrp_state::hector_io_8255_w) /******************* PIO write handler for MX40 *******************/ -WRITE8_MEMBER(hec2hrp_state::hector_mx40_io_port_w) +WRITE8_MEMBER(hec2hrp_state::mx40_io_port_w) { /* Bank switching on several address */ if ((offset &0x0ff) == 0x40) /* Port page 0*/ @@ -513,7 +504,7 @@ WRITE8_MEMBER(hec2hrp_state::hector_mx40_io_port_w) } /******************* PIO write handlerfor MX80 *******************/ -WRITE8_MEMBER(hec2hrp_state::hector_mx80_io_port_w) +WRITE8_MEMBER(hec2hrp_state::mx80_io_port_w) { if ((offset &0x0ff) == 0x40) /* Port page 0*/ membank("bank2")->set_entry(HECTORMX_BANK_PAGE0); @@ -522,7 +513,7 @@ WRITE8_MEMBER(hec2hrp_state::hector_mx80_io_port_w) membank("bank2")->set_entry(HECTORMX_BANK_PAGE1); m_hector_flag_80c=0; } - if ((offset &0x0ff) == 0x42) /* Port page 2 => port different du MX40*/ + if ((offset &0x0ff) == 0x42) /* Port page 2 => different port on MX40 */ membank("bank2")->set_entry(HECTORMX_BANK_PAGE2); if ((offset &0x0ff) == 0x49) /* Port screen resolution*/ m_hector_flag_80c=1; @@ -772,11 +763,9 @@ void hec2hrp_state::hector_reset(int hr, int with_d2) // Disc II init if (with_d2 == 1) - { - upd765a_device *fdc = machine().device("upd765"); m_disc2cpu->pulse_input_line(INPUT_LINE_RESET, attotime::zero); - fdc->reset(); + m_upd_fdc->reset(); } } @@ -867,7 +856,7 @@ WRITE_LINE_MEMBER( hec2hrp_state::disc2_fdc_dma_irq ) void hec2hrp_state::hector_disc2_reset() { m_disc2cpu->pulse_input_line(INPUT_LINE_RESET, attotime::zero); - machine().device("upd765")->reset(); + m_upd_fdc->reset(); // Select ROM to cold restart membank("bank3")->set_entry(DISCII_BANK_ROM); @@ -883,63 +872,61 @@ void hec2hrp_state::hector_disc2_reset() // Port handling for Z80 Disc II unit -READ8_MEMBER( hec2hrp_state::hector_disc2_io00_port_r) +READ8_MEMBER( hec2hrp_state::disc2_io00_port_r) { /* Switch Disc 2 to RAM */ membank("bank3")->set_entry(DISCII_BANK_RAM); return 0; } -WRITE8_MEMBER( hec2hrp_state::hector_disc2_io00_port_w) +WRITE8_MEMBER( hec2hrp_state::disc2_io00_port_w) { /* Switch Disc 2 to RAM */ membank("bank3")->set_entry(DISCII_BANK_RAM); } -READ8_MEMBER( hec2hrp_state::hector_disc2_io20_port_r) +READ8_MEMBER( hec2hrp_state::disc2_io20_port_r) { // TODO: Implement 8251 chip communication return 0; } -WRITE8_MEMBER( hec2hrp_state::hector_disc2_io20_port_w) +WRITE8_MEMBER( hec2hrp_state::disc2_io20_port_w) { // TODO: Implement 8251 chip communication } -READ8_MEMBER( hec2hrp_state::hector_disc2_io30_port_r) +READ8_MEMBER( hec2hrp_state::disc2_io30_port_r) { return m_hector_disc2_data_r_ready; } -WRITE8_MEMBER( hec2hrp_state::hector_disc2_io30_port_w) +WRITE8_MEMBER( hec2hrp_state::disc2_io30_port_w) { } -READ8_MEMBER( hec2hrp_state::hector_disc2_io40_port_r) /* Read data sent to Hector by Disc2 */ +READ8_MEMBER( hec2hrp_state::disc2_io40_port_r) /* Read data sent to Hector by Disc2 */ { m_hector_disc2_data_r_ready = 0x00; return m_hector_disc2_data_read; } -WRITE8_MEMBER( hec2hrp_state::hector_disc2_io40_port_w) /* Write data sent by Disc2 to Hector */ +WRITE8_MEMBER( hec2hrp_state::disc2_io40_port_w) /* Write data sent by Disc2 to Hector */ { m_hector_disc2_data_write = data; m_hector_disc2_data_w_ready = 0x80; } -READ8_MEMBER( hec2hrp_state::hector_disc2_io50_port_r) +READ8_MEMBER( hec2hrp_state::disc2_io50_port_r) { return m_hector_disc2_data_w_ready; } -WRITE8_MEMBER( hec2hrp_state::hector_disc2_io50_port_w) +WRITE8_MEMBER( hec2hrp_state::disc2_io50_port_w) { - upd765a_device *fdc = machine().device("upd765"); - /* FDC Motor Control - Bit 0/1 defines the state of the FDD 0/1 motor */ - machine().device("upd765:0")->get_device()->mon_w(BIT(data, 0)); // FLoppy motor A - machine().device("upd765:1")->get_device()->mon_w(BIT(data, 1)); // Floppy motor B + m_upd_connector[0]->get_device()->mon_w(BIT(data, 0)); // FLoppy motor A + m_upd_connector[1]->get_device()->mon_w(BIT(data, 1)); // Floppy motor B /* Write bit TC uPD765 on D4 of port I/O 50 */ - fdc->tc_w(BIT(data, 4)); + m_upd_fdc->tc_w(BIT(data, 4)); /* allow interrupts by ANDing with RNMI signal */ -- cgit v1.2.3