diff options
author | 2012-11-28 15:58:47 +0000 | |
---|---|---|
committer | 2012-11-28 15:58:47 +0000 | |
commit | f2dacf28135ed695ea0b3bb9a4557f753e8b726f (patch) | |
tree | f05fedfedff49c18138392d5cc1355bba0059585 /src/mess/machine | |
parent | 21ea8a94e9d7f8387ace558bf0dcc662d704c71a (diff) |
(MESS) comx35: Floppy modernization and expansion interface cleanup. (nw)
Diffstat (limited to 'src/mess/machine')
-rw-r--r-- | src/mess/machine/comx_clm.c | 56 | ||||
-rw-r--r-- | src/mess/machine/comx_clm.h | 18 | ||||
-rw-r--r-- | src/mess/machine/comx_eb.c | 96 | ||||
-rw-r--r-- | src/mess/machine/comx_eb.h | 21 | ||||
-rw-r--r-- | src/mess/machine/comx_epr.c | 4 | ||||
-rw-r--r-- | src/mess/machine/comx_epr.h | 4 | ||||
-rw-r--r-- | src/mess/machine/comx_fd.c | 153 | ||||
-rw-r--r-- | src/mess/machine/comx_fd.h | 40 | ||||
-rw-r--r-- | src/mess/machine/comx_joy.c | 2 | ||||
-rw-r--r-- | src/mess/machine/comx_joy.h | 2 | ||||
-rw-r--r-- | src/mess/machine/comx_prn.c | 114 | ||||
-rw-r--r-- | src/mess/machine/comx_prn.h | 17 | ||||
-rw-r--r-- | src/mess/machine/comx_ram.c | 8 | ||||
-rw-r--r-- | src/mess/machine/comx_ram.h | 8 | ||||
-rw-r--r-- | src/mess/machine/comx_thm.c | 28 | ||||
-rw-r--r-- | src/mess/machine/comx_thm.h | 12 | ||||
-rw-r--r-- | src/mess/machine/comxexp.c | 41 | ||||
-rw-r--r-- | src/mess/machine/comxexp.h | 48 | ||||
-rw-r--r-- | src/mess/machine/comxpl80.c | 55 | ||||
-rw-r--r-- | src/mess/machine/comxpl80.h | 52 |
20 files changed, 378 insertions, 401 deletions
diff --git a/src/mess/machine/comx_clm.c b/src/mess/machine/comx_clm.c index b34094adb6c..8e4b7669951 100644 --- a/src/mess/machine/comx_clm.c +++ b/src/mess/machine/comx_clm.c @@ -53,9 +53,9 @@ Notes: // MACROS/CONSTANTS //************************************************************************** -#define MC6845_TAG "mc6845" -#define MC6845_SCREEN_TAG "screen80" -#define VIDEORAM_SIZE 0x800 +#define MC6845_TAG "mc6845" +#define MC6845_SCREEN_TAG "screen80" +#define VIDEORAM_SIZE 0x800 @@ -72,12 +72,15 @@ const device_type COMX_CLM = &device_creator<comx_clm_device>; ROM_START( comx_clm ) ROM_REGION( 0x2000, "c000", 0 ) - ROM_LOAD( "p 1.0.cl1", 0x0000, 0x0800, CRC(b417d30a) SHA1(d428b0467945ecb9aec884211d0f4b1d8d56d738) ) // V1.0 - ROM_LOAD( "p 1.1.cl1", 0x0000, 0x0800, CRC(0a2eaf19) SHA1(3f1f640caef964fb47aaa147cab6d215c2b30e9d) ) // V1.1 + ROM_DEFAULT_BIOS( "v11" ) + ROM_SYSTEM_BIOS( 0, "v10", "v1.0" ) + ROMX_LOAD( "p 1.0.cl1", 0x0000, 0x0800, CRC(b417d30a) SHA1(d428b0467945ecb9aec884211d0f4b1d8d56d738), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "v11", "v1.1" ) + ROMX_LOAD( "p 1.1.cl1", 0x0000, 0x0800, CRC(0a2eaf19) SHA1(3f1f640caef964fb47aaa147cab6d215c2b30e9d), ROM_BIOS(2) ) ROM_REGION( 0x800, MC6845_TAG, 0 ) - ROM_LOAD( "c 1.0.cl4", 0x0000, 0x0800, CRC(69dd7b07) SHA1(71d368adbb299103d165eab8359a97769e463e26) ) // V1.0 - ROM_LOAD( "c 1.1.cl4", 0x0000, 0x0800, CRC(dc9b5046) SHA1(4e041cec03dda6dba5e2598d060c49908a4fab2a) ) // V1.1 + ROMX_LOAD( "c 1.0.cl4", 0x0000, 0x0800, CRC(69dd7b07) SHA1(71d368adbb299103d165eab8359a97769e463e26), ROM_BIOS(1) ) + ROMX_LOAD( "c 1.1.cl4", 0x0000, 0x0800, CRC(dc9b5046) SHA1(4e041cec03dda6dba5e2598d060c49908a4fab2a), ROM_BIOS(2) ) ROM_END @@ -97,7 +100,6 @@ const rom_entry *comx_clm_device::device_rom_region() const void comx_clm_device::crtc_update_row(mc6845_device *device, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16 ma, UINT8 ra, UINT16 y, UINT8 x_count, INT8 cursor_x, void *param) { - const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); for (int column = 0; column < x_count; column++) { UINT8 code = m_video_ram[((ma + column) & 0x7ff)]; @@ -114,7 +116,7 @@ void comx_clm_device::crtc_update_row(mc6845_device *device, bitmap_rgb32 &bitma int x = (column * 8) + bit; int color = BIT(data, 7) ? 7 : 0; - bitmap.pix32(y, x) = palette[color]; + bitmap.pix32(y, x) = RGB_MONOCHROME_WHITE[color]; data <<= 1; } @@ -127,18 +129,6 @@ static MC6845_UPDATE_ROW( comx_clm_update_row ) clm->crtc_update_row(device,bitmap,cliprect,ma,ra,y,x_count,cursor_x,param); } -WRITE_LINE_MEMBER( comx_clm_device::hsync_w ) -{ - if (m_ds) - { - m_slot->ef4_w(state); - } - else - { - m_slot->ef4_w(CLEAR_LINE); - } -} - static const mc6845_interface crtc_intf = { MC6845_SCREEN_TAG, @@ -148,7 +138,7 @@ static const mc6845_interface crtc_intf = NULL, DEVCB_NULL, DEVCB_NULL, - DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, comx_clm_device, hsync_w), + DEVCB_NULL, DEVCB_NULL, NULL }; @@ -205,7 +195,7 @@ comx_clm_device::comx_clm_device(const machine_config &mconfig, const char *tag, device_t(mconfig, COMX_CLM, "COMX 80 Column Card", tag, owner, clock), device_comx_expansion_card_interface(mconfig, *this), m_crtc(*this, MC6845_TAG), - m_ds(0) + m_video_ram(*this, "video_ram") { } @@ -216,13 +206,15 @@ comx_clm_device::comx_clm_device(const machine_config &mconfig, const char *tag, void comx_clm_device::device_start() { + // find memory regions m_rom = memregion("c000")->base(); m_char_rom = memregion(MC6845_TAG)->base(); - m_video_ram = auto_alloc_array(machine(), UINT8, VIDEORAM_SIZE); + + // allocate memory + m_video_ram.allocate(VIDEORAM_SIZE); // state saving save_item(NAME(m_ds)); - save_pointer(NAME(m_video_ram), VIDEORAM_SIZE); } @@ -236,12 +228,12 @@ void comx_clm_device::device_reset() //------------------------------------------------- -// comx_ds_w - device select write +// comx_ef4_r - external flag 4 read //------------------------------------------------- -void comx_clm_device::comx_ds_w(int state) +int comx_clm_device::comx_ef4_r() { - m_ds = state; + return m_ds ? m_crtc->hsync_r() : CLEAR_LINE; } @@ -249,10 +241,8 @@ void comx_clm_device::comx_ds_w(int state) // comx_mrd_r - memory read //------------------------------------------------- -UINT8 comx_clm_device::comx_mrd_r(offs_t offset, int *extrom) +UINT8 comx_clm_device::comx_mrd_r(address_space &space, offs_t offset, int *extrom) { - address_space &space = machine().firstcpu->space(AS_PROGRAM); - UINT8 data = 0xff; if (offset >= 0xc000 && offset < 0xc800) @@ -276,10 +266,8 @@ UINT8 comx_clm_device::comx_mrd_r(offs_t offset, int *extrom) // comx_mwr_w - memory write //------------------------------------------------- -void comx_clm_device::comx_mwr_w(offs_t offset, UINT8 data) +void comx_clm_device::comx_mwr_w(address_space &space, offs_t offset, UINT8 data) { - address_space &space = machine().firstcpu->space(AS_PROGRAM); - if (offset >= 0xd000 && offset < 0xd800) { m_video_ram[offset & 0x7ff] = data; diff --git a/src/mess/machine/comx_clm.h b/src/mess/machine/comx_clm.h index f7dd958eec7..67d522e1344 100644 --- a/src/mess/machine/comx_clm.h +++ b/src/mess/machine/comx_clm.h @@ -26,7 +26,7 @@ // ======================> comx_clm_device class comx_clm_device : public device_t, - public device_comx_expansion_card_interface + public device_comx_expansion_card_interface { public: // construction/destruction @@ -38,26 +38,24 @@ public: // not really public void crtc_update_row(mc6845_device *device, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16 ma, UINT8 ra, UINT16 y, UINT8 x_count, INT8 cursor_x, void *param); - DECLARE_WRITE_LINE_MEMBER( hsync_w ); protected: // device-level overrides virtual void device_start(); virtual void device_reset(); - virtual void device_config_complete() { m_shortname = "comx_clm"; } + virtual void device_config_complete() { m_shortname = "comx_clm"; } // device_comx_expansion_card_interface overrides - virtual void comx_ds_w(int state); - virtual UINT8 comx_mrd_r(offs_t offset, int *extrom); - virtual void comx_mwr_w(offs_t offset, UINT8 data); + virtual int comx_ef4_r(); + virtual UINT8 comx_mrd_r(address_space &space, offs_t offset, int *extrom); + virtual void comx_mwr_w(address_space &space, offs_t offset, UINT8 data); private: required_device<mc6845_device> m_crtc; + optional_shared_ptr<UINT8> m_video_ram; - int m_ds; // device select - UINT8 *m_rom; // program ROM - UINT8 *m_char_rom; // character ROM - UINT8 *m_video_ram; // video RAM + UINT8 *m_rom; // program ROM + UINT8 *m_char_rom; // character ROM }; diff --git a/src/mess/machine/comx_eb.c b/src/mess/machine/comx_eb.c index 4221558db2a..185fc109121 100644 --- a/src/mess/machine/comx_eb.c +++ b/src/mess/machine/comx_eb.c @@ -55,10 +55,10 @@ Notes: // MACROS/CONSTANTS //************************************************************************** -#define SLOT1_TAG "slot1" -#define SLOT2_TAG "slot2" -#define SLOT3_TAG "slot3" -#define SLOT4_TAG "slot4" +#define SLOT1_TAG "slot1" +#define SLOT2_TAG "slot2" +#define SLOT3_TAG "slot3" +#define SLOT4_TAG "slot4" @@ -76,7 +76,7 @@ const device_type COMX_EB = &device_creator<comx_eb_device>; ROM_START( comx_eb ) ROM_REGION( 0x1000, "e000", 0 ) ROM_SYSTEM_BIOS( 0, "comx", "Original" ) - ROMX_LOAD( "expansion.e5", 0x0000, 0x1000, CRC(52cb44e2) SHA1(3f9a3d9940b36d4fee5eca9f1359c99d7ed545b9), ROM_BIOS(1) ) + ROMX_LOAD( "expansion.e5", 0x0000, 0x1000, CRC(52cb44e2) SHA1(3f9a3d9940b36d4fee5eca9f1359c99d7ed545b9), ROM_BIOS(1) ) ROM_SYSTEM_BIOS( 1, "fm31", "F&M 3.1" ) ROMX_LOAD( "f&m.expansion.3.1.e5", 0x0000, 0x1000, CRC(818ca2ef) SHA1(ea000097622e7fd472d53e7899e3c83773433045), ROM_BIOS(2) ) ROM_SYSTEM_BIOS( 2, "fm32", "F&M 3.2" ) @@ -114,12 +114,6 @@ WRITE_LINE_DEVICE_HANDLER( int_w ) eb->set_int(device->tag(), state); } -WRITE_LINE_DEVICE_HANDLER( ef4_w ) -{ - comx_eb_device *eb = downcast<comx_eb_device *>(device->owner()); - eb->set_ef4(device->tag(), state); -} - WRITE_LINE_DEVICE_HANDLER( wait_w ) { comx_expansion_slot_device *slot = dynamic_cast<comx_expansion_slot_device *>(device->owner()->owner()); @@ -135,7 +129,6 @@ WRITE_LINE_DEVICE_HANDLER( clear_w ) static COMX_EXPANSION_INTERFACE( expansion_intf ) { DEVCB_LINE(int_w), - DEVCB_LINE(ef4_w), DEVCB_LINE(wait_w), DEVCB_LINE(clear_w) }; @@ -197,34 +190,6 @@ void comx_eb_device::set_int(const char *tag, int state) } -//------------------------------------------------- -// set_ef4 - set EF4 line state -//------------------------------------------------- - -void comx_eb_device::set_ef4(const char *tag, int state) -{ - int slot = 0; - - for (slot = 0; slot < MAX_EB_SLOTS; slot++) - { - if (!strcmp(tag, m_expansion_slot[slot]->tag())) break; - } - - assert(slot < MAX_EB_SLOTS); - - m_ef4[slot] = state; - - int ef4 = CLEAR_LINE; - - for (slot = 0; slot < MAX_EB_SLOTS; slot++) - { - ef4 |= m_ef4[slot]; - } - - m_slot->ef4_w(ef4); -} - - //************************************************************************** // LIVE DEVICE @@ -256,7 +221,6 @@ void comx_eb_device::device_start() for (int slot = 0; slot < MAX_EB_SLOTS; slot++) { m_int[slot] = CLEAR_LINE; - m_ef4[slot] = CLEAR_LINE; } m_rom = memregion("e000")->base(); @@ -269,6 +233,38 @@ void comx_eb_device::device_start() void comx_eb_device::device_reset() { + for (int slot = 0; slot < MAX_EB_SLOTS; slot++) + { + if (m_expansion_slot[slot] != NULL) + { + m_expansion_slot[slot]->device().reset(); + m_expansion_slot[slot]->ds_w(0); + } + } +} + + +//------------------------------------------------- +// comx_ef4_r - external flag 4 read +//------------------------------------------------- + +int comx_eb_device::comx_ef4_r() +{ + int state = CLEAR_LINE; + + for (int slot = 0; slot < MAX_EB_SLOTS; slot++) + { + if (m_expansion_slot[slot] != NULL) + { + if (m_expansion_slot[slot]->ef4_r() == ASSERT_LINE) + { + state = ASSERT_LINE; + break; + } + } + } + + return state; } @@ -292,7 +288,7 @@ void comx_eb_device::comx_q_w(int state) // comx_mrd_r - memory read //------------------------------------------------- -UINT8 comx_eb_device::comx_mrd_r(offs_t offset, int *extrom) +UINT8 comx_eb_device::comx_mrd_r(address_space &space, offs_t offset, int *extrom) { UINT8 data = 0; @@ -311,7 +307,7 @@ UINT8 comx_eb_device::comx_mrd_r(offs_t offset, int *extrom) { if (BIT(m_select, slot) && m_expansion_slot[slot] != NULL) { - data |= m_expansion_slot[slot]->mrd_r(offset, extrom); + data |= m_expansion_slot[slot]->mrd_r(space, offset, extrom); } } } @@ -324,13 +320,13 @@ UINT8 comx_eb_device::comx_mrd_r(offs_t offset, int *extrom) // comx_mwr_w - memory write //------------------------------------------------- -void comx_eb_device::comx_mwr_w(offs_t offset, UINT8 data) +void comx_eb_device::comx_mwr_w(address_space &space, offs_t offset, UINT8 data) { for (int slot = 0; slot < MAX_EB_SLOTS; slot++) { if (BIT(m_select, slot) && m_expansion_slot[slot] != NULL) { - m_expansion_slot[slot]->mwr_w(offset, data); + m_expansion_slot[slot]->mwr_w(space, offset, data); } } } @@ -340,7 +336,7 @@ void comx_eb_device::comx_mwr_w(offs_t offset, UINT8 data) // comx_io_r - I/O read //------------------------------------------------- -UINT8 comx_eb_device::comx_io_r(offs_t offset) +UINT8 comx_eb_device::comx_io_r(address_space &space, offs_t offset) { UINT8 data = 0; @@ -348,7 +344,7 @@ UINT8 comx_eb_device::comx_io_r(offs_t offset) { if (BIT(m_select, slot) && m_expansion_slot[slot] != NULL) { - data |= m_expansion_slot[slot]->io_r(offset); + data |= m_expansion_slot[slot]->io_r(space, offset); } } @@ -360,9 +356,9 @@ UINT8 comx_eb_device::comx_io_r(offs_t offset) // comx_io_w - I/O write //------------------------------------------------- -void comx_eb_device::comx_io_w(offs_t offset, UINT8 data) +void comx_eb_device::comx_io_w(address_space &space, offs_t offset, UINT8 data) { - if (offset == 1) + if (offset == 1 && !(BIT(data, 0))) { m_select = data >> 1; @@ -379,7 +375,7 @@ void comx_eb_device::comx_io_w(offs_t offset, UINT8 data) { if (BIT(m_select, slot) && m_expansion_slot[slot] != NULL) { - m_expansion_slot[slot]->io_w(offset, data); + m_expansion_slot[slot]->io_w(space, offset, data); } } } diff --git a/src/mess/machine/comx_eb.h b/src/mess/machine/comx_eb.h index 99ded642f64..9cfa3c196e4 100644 --- a/src/mess/machine/comx_eb.h +++ b/src/mess/machine/comx_eb.h @@ -29,7 +29,7 @@ // CONSTANTS //************************************************************************** -#define MAX_EB_SLOTS 4 +#define MAX_EB_SLOTS 4 @@ -40,7 +40,7 @@ // ======================> comx_eb_device class comx_eb_device : public device_t, - public device_comx_expansion_card_interface + public device_comx_expansion_card_interface { public: // construction/destruction @@ -52,27 +52,26 @@ public: // not really public void set_int(const char *tag, int state); - void set_ef4(const char *tag, int state); protected: // device-level overrides virtual void device_start(); virtual void device_reset(); - virtual void device_config_complete() { m_shortname = "comx_eb"; } + virtual void device_config_complete() { m_shortname = "comx_eb"; } // device_comx_expansion_card_interface overrides + virtual int comx_ef4_r(); virtual void comx_q_w(int state); - virtual UINT8 comx_mrd_r(offs_t offset, int *extrom); - virtual void comx_mwr_w(offs_t offset, UINT8 data); - virtual UINT8 comx_io_r(offs_t offset); - virtual void comx_io_w(offs_t offset, UINT8 data); + virtual UINT8 comx_mrd_r(address_space &space, offs_t offset, int *extrom); + virtual void comx_mwr_w(address_space &space, offs_t offset, UINT8 data); + virtual UINT8 comx_io_r(address_space &space, offs_t offset); + virtual void comx_io_w(address_space &space, offs_t offset, UINT8 data); private: - UINT8 *m_rom; // program ROM + UINT8 *m_rom; // program ROM - comx_expansion_slot_device *m_expansion_slot[MAX_EB_SLOTS]; + comx_expansion_slot_device *m_expansion_slot[MAX_EB_SLOTS]; int m_int[MAX_EB_SLOTS]; - int m_ef4[MAX_EB_SLOTS]; UINT8 m_select; }; diff --git a/src/mess/machine/comx_epr.c b/src/mess/machine/comx_epr.c index 0c70a3a76a6..2970d5bb22b 100644 --- a/src/mess/machine/comx_epr.c +++ b/src/mess/machine/comx_epr.c @@ -92,7 +92,7 @@ void comx_epr_device::device_reset() // comx_mrd_r - memory read //------------------------------------------------- -UINT8 comx_epr_device::comx_mrd_r(offs_t offset, int *extrom) +UINT8 comx_epr_device::comx_mrd_r(address_space &space, offs_t offset, int *extrom) { UINT8 data = 0; @@ -114,7 +114,7 @@ UINT8 comx_epr_device::comx_mrd_r(offs_t offset, int *extrom) // comx_io_w - I/O write //------------------------------------------------- -void comx_epr_device::comx_io_w(offs_t offset, UINT8 data) +void comx_epr_device::comx_io_w(address_space &space, offs_t offset, UINT8 data) { if (offset == 1) { diff --git a/src/mess/machine/comx_epr.h b/src/mess/machine/comx_epr.h index 195bcaf61e7..e47d4da10d2 100644 --- a/src/mess/machine/comx_epr.h +++ b/src/mess/machine/comx_epr.h @@ -41,8 +41,8 @@ protected: virtual void device_config_complete() { m_shortname = "comx_epr"; } // device_comx_expansion_card_interface overrides - virtual UINT8 comx_mrd_r(offs_t offset, int *extrom); - virtual void comx_io_w(offs_t offset, UINT8 data); + virtual UINT8 comx_mrd_r(address_space &space, offs_t offset, int *extrom); + virtual void comx_io_w(address_space &space, offs_t offset, UINT8 data); private: UINT8 m_select; diff --git a/src/mess/machine/comx_fd.c b/src/mess/machine/comx_fd.c index 5ff3d318d75..97d8b0c7161 100644 --- a/src/mess/machine/comx_fd.c +++ b/src/mess/machine/comx_fd.c @@ -50,7 +50,7 @@ Notes: // MACROS/CONSTANTS //************************************************************************** -#define WD1770_TAG "wd1770" +#define WD1770_TAG "wd1770" @@ -67,7 +67,7 @@ const device_type COMX_FD = &device_creator<comx_fd_device>; ROM_START( comx_fd ) ROM_REGION( 0x2000, "c000", 0 ) - ROM_LOAD( "d.o.s. v1.2.f4", 0x0000, 0x2000, CRC(cf4ecd2e) SHA1(290e19bdc89e3c8059e63d5ae3cca4daa194e1fe) ) + ROM_LOAD( "d.o.s. v1.2.f4", 0x0000, 0x2000, CRC(cf4ecd2e) SHA1(290e19bdc89e3c8059e63d5ae3cca4daa194e1fe) ) ROM_END @@ -85,47 +85,35 @@ const rom_entry *comx_fd_device::device_rom_region() const // wd17xx_interface fdc_intf //------------------------------------------------- -static const floppy_interface floppy_intf = -{ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - FLOPPY_STANDARD_5_25_DSSD, - LEGACY_FLOPPY_OPTIONS_NAME(comx35), - "floppy_5_25", - NULL -}; - -WRITE_LINE_MEMBER( comx_fd_device::intrq_w ) +FLOPPY_FORMATS_MEMBER( comx_fd_device::floppy_formats ) + FLOPPY_COMX35_FORMAT +FLOPPY_FORMATS_END + +static SLOT_INTERFACE_START( comx_fd_floppies ) + SLOT_INTERFACE( "525sd35t", FLOPPY_525_SD_35T ) + SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) +SLOT_INTERFACE_END + +void comx_fd_device::intrq_w(bool state) { m_intrq = state; } -WRITE_LINE_MEMBER( comx_fd_device::drq_w ) +void comx_fd_device::drq_w(bool state) { m_drq = state; - - update_ef4(); } -static const wd17xx_interface fdc_intf = -{ - DEVCB_LINE_VCC, - DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, comx_fd_device, intrq_w), - DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, comx_fd_device, drq_w), - { FLOPPY_0, FLOPPY_1, NULL, NULL } -}; - //------------------------------------------------- // MACHINE_CONFIG_FRAGMENT( comx_fd ) //------------------------------------------------- static MACHINE_CONFIG_FRAGMENT( comx_fd ) - MCFG_WD1770_ADD(WD1770_TAG, fdc_intf) - MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(floppy_intf) + MCFG_WD1770x_ADD(WD1770_TAG, XTAL_8MHz) + + MCFG_FLOPPY_DRIVE_ADD(WD1770_TAG":0", comx_fd_floppies, "525sd35t", NULL, comx_fd_device::floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(WD1770_TAG":1", comx_fd_floppies, NULL, NULL, comx_fd_device::floppy_formats) MACHINE_CONFIG_END @@ -142,28 +130,6 @@ machine_config_constructor comx_fd_device::device_mconfig_additions() const //************************************************************************** -// INLINE HELPERS -//************************************************************************** - -//------------------------------------------------- -// update_ef4 - -//------------------------------------------------- - -inline void comx_fd_device::update_ef4() -{ - if (m_ds && !m_disb) - { - m_slot->ef4_w(!m_drq); - } - else - { - m_slot->ef4_w(CLEAR_LINE); - } -} - - - -//************************************************************************** // LIVE DEVICE //************************************************************************** @@ -175,13 +141,13 @@ comx_fd_device::comx_fd_device(const machine_config &mconfig, const char *tag, d device_t(mconfig, COMX_FD, "COMX FD", tag, owner, clock), device_comx_expansion_card_interface(mconfig, *this), m_fdc(*this, WD1770_TAG), - m_floppy0(*this, FLOPPY_0), - m_floppy1(*this, FLOPPY_1), + m_floppy0(*this, WD1770_TAG":0"), + m_floppy1(*this, WD1770_TAG":1"), m_ds(0), m_q(0), m_addr(0), - m_intrq(0), - m_drq(0), + m_intrq(false), + m_drq(false), m_disb(1) { } @@ -193,8 +159,14 @@ comx_fd_device::comx_fd_device(const machine_config &mconfig, const char *tag, d void comx_fd_device::device_start() { + // find memory regions m_rom = memregion("c000")->base(); + // initialize floppy controller + m_fdc->setup_intrq_cb(wd1770_t::line_cb(FUNC(comx_fd_device::intrq_w), this)); + m_fdc->setup_drq_cb(wd1770_t::line_cb(FUNC(comx_fd_device::drq_w), this)); + m_fdc->dden_w(1); + // state saving save_item(NAME(m_ds)); save_item(NAME(m_q)); @@ -211,29 +183,34 @@ void comx_fd_device::device_start() void comx_fd_device::device_reset() { - wd17xx_reset(m_fdc); + m_fdc->reset(); } //------------------------------------------------- -// comx_q_w - Q write +// comx_ef4_r - external flag 4 read //------------------------------------------------- -void comx_fd_device::comx_q_w(int state) +int comx_fd_device::comx_ef4_r() { - m_q = state; + int state = CLEAR_LINE; + + if (m_ds && !m_disb) + { + state = m_drq ? ASSERT_LINE : CLEAR_LINE; + } + + return state; } //------------------------------------------------- -// comx_ds_w - device select write +// comx_q_w - Q write //------------------------------------------------- -void comx_fd_device::comx_ds_w(int state) +void comx_fd_device::comx_q_w(int state) { - m_ds = state; - - update_ef4(); + m_q = state; } @@ -241,7 +218,7 @@ void comx_fd_device::comx_ds_w(int state) // comx_mrd_r - memory read //------------------------------------------------- -UINT8 comx_fd_device::comx_mrd_r(offs_t offset, int *extrom) +UINT8 comx_fd_device::comx_mrd_r(address_space &space, offs_t offset, int *extrom) { UINT8 data = 0xff; @@ -263,7 +240,7 @@ UINT8 comx_fd_device::comx_mrd_r(offs_t offset, int *extrom) // comx_io_r - I/O read //------------------------------------------------- -UINT8 comx_fd_device::comx_io_r(offs_t offset) +UINT8 comx_fd_device::comx_io_r(address_space &space, offs_t offset) { UINT8 data = 0xff; @@ -271,11 +248,11 @@ UINT8 comx_fd_device::comx_io_r(offs_t offset) { if (m_q) { - data = m_intrq; + data = m_intrq ? 1 : 0; } else { - data = wd17xx_r(m_fdc, machine().driver_data()->generic_space(), m_addr); + data = m_fdc->gen_r(m_addr); } } @@ -287,7 +264,7 @@ UINT8 comx_fd_device::comx_io_r(offs_t offset) // comx_io_w - I/O write //------------------------------------------------- -void comx_fd_device::comx_io_w(offs_t offset, UINT8 data) +void comx_fd_device::comx_io_w(address_space &space, offs_t offset, UINT8 data) { if (offset == 2) { @@ -295,38 +272,36 @@ void comx_fd_device::comx_io_w(offs_t offset, UINT8 data) { /* - bit description + bit description - 0 A0 - 1 A1 - 2 DRIVE0 - 3 DRIVE1 - 4 F9 DISB - 5 SIDE SELECT + 0 FDC A0 + 1 FDC A1 + 2 DRIVE0 + 3 DRIVE1 + 4 F9 DISB + 5 SIDE SELECT - */ + */ // latch data to F3 m_addr = data & 0x03; - if (BIT(data, 2)) - { - wd17xx_set_drive(m_fdc, 0); - } - else if (BIT(data, 3)) - { - wd17xx_set_drive(m_fdc, 1); - } + // drive select + floppy_image_device *floppy = NULL; - m_disb = !BIT(data, 4); - update_ef4(); + if (BIT(data, 2)) floppy = m_floppy0->get_device(); + if (BIT(data, 3)) floppy = m_floppy1->get_device(); + + m_fdc->set_floppy(floppy); - wd17xx_set_side(m_fdc, BIT(data, 5)); + if (floppy) floppy->ss_w(BIT(data, 5)); + + m_disb = !BIT(data, 4); } else { // write data to WD1770 - wd17xx_w(m_fdc, machine().driver_data()->generic_space(), m_addr, data); + m_fdc->gen_w(m_addr, data); } } } diff --git a/src/mess/machine/comx_fd.h b/src/mess/machine/comx_fd.h index e41080a66fd..14742090909 100644 --- a/src/mess/machine/comx_fd.h +++ b/src/mess/machine/comx_fd.h @@ -14,11 +14,9 @@ #include "emu.h" -#include "formats/basicdsk.h" #include "formats/comx35_dsk.h" -#include "imagedev/flopdrv.h" #include "machine/comxexp.h" -#include "machine/wd17xx.h" +#include "machine/wd_fdc.h" @@ -29,7 +27,7 @@ // ======================> comx_fd_device class comx_fd_device : public device_t, - public device_comx_expansion_card_interface + public device_comx_expansion_card_interface { public: // construction/destruction @@ -40,38 +38,40 @@ public: virtual machine_config_constructor device_mconfig_additions() const; // not really public - DECLARE_WRITE_LINE_MEMBER( intrq_w ); - DECLARE_WRITE_LINE_MEMBER( drq_w ); + void intrq_w(bool state); + void drq_w(bool state); + + DECLARE_FLOPPY_FORMATS( floppy_formats ); protected: // device-level overrides virtual void device_start(); virtual void device_reset(); - virtual void device_config_complete() { m_shortname = "comx_fd"; } + virtual void device_config_complete() { m_shortname = "comx_fd"; } // device_comx_expansion_card_interface overrides - virtual void comx_ds_w(int state); + virtual int comx_ef4_r(); virtual void comx_q_w(int state); - virtual UINT8 comx_mrd_r(offs_t offset, int *extrom); - virtual UINT8 comx_io_r(offs_t offset); - virtual void comx_io_w(offs_t offset, UINT8 data); + virtual UINT8 comx_mrd_r(address_space &space, offs_t offset, int *extrom); + virtual UINT8 comx_io_r(address_space &space, offs_t offset); + virtual void comx_io_w(address_space &space, offs_t offset, UINT8 data); private: inline void update_ef4(); // internal state - required_device<wd1770_device> m_fdc; - required_device<legacy_floppy_image_device> m_floppy0; - required_device<legacy_floppy_image_device> m_floppy1; + required_device<wd1770_t> m_fdc; + required_device<floppy_connector> m_floppy0; + required_device<floppy_connector> m_floppy1; // floppy state - int m_ds; // device select + int m_ds; // device select UINT8 *m_rom; - int m_q; // FDC register select - int m_addr; // FDC address - int m_intrq; // interrupt request - int m_drq; // data request - int m_disb; // data request disable + int m_q; // FDC register select + int m_addr; // FDC address + bool m_intrq; // interrupt request + bool m_drq; // data request + int m_disb; // data request disable }; diff --git a/src/mess/machine/comx_joy.c b/src/mess/machine/comx_joy.c index 8b28d6888eb..52960b5a41c 100644 --- a/src/mess/machine/comx_joy.c +++ b/src/mess/machine/comx_joy.c @@ -96,7 +96,7 @@ void comx_joy_device::device_reset() // comx_mrd_r - I/O read //------------------------------------------------- -UINT8 comx_joy_device::comx_io_r(offs_t offset) +UINT8 comx_joy_device::comx_io_r(address_space &space, offs_t offset) { UINT8 data = 0; diff --git a/src/mess/machine/comx_joy.h b/src/mess/machine/comx_joy.h index dd7944fbad3..abbd8437603 100644 --- a/src/mess/machine/comx_joy.h +++ b/src/mess/machine/comx_joy.h @@ -41,7 +41,7 @@ protected: virtual void device_config_complete() { m_shortname = "comx_joy"; } // device_comx_expansion_card_interface overrides - virtual UINT8 comx_io_r(offs_t offset); + virtual UINT8 comx_io_r(address_space &space, offs_t offset); }; diff --git a/src/mess/machine/comx_prn.c b/src/mess/machine/comx_prn.c index 45f8d322aad..de2484a4c3f 100644 --- a/src/mess/machine/comx_prn.c +++ b/src/mess/machine/comx_prn.c @@ -15,6 +15,8 @@ // MACROS/CONSTANTS //************************************************************************** +#define CENTRONICS_TAG "centronics" + //************************************************************************** @@ -30,13 +32,11 @@ const device_type COMX_PRN = &device_creator<comx_prn_device>; ROM_START( comx_prn ) ROM_REGION( 0x2000, "c000", 0 ) - ROM_LOAD( "printer.bin", 0x0000, 0x0800, CRC(3bbc2b2e) SHA1(08bf7ea4174713ab24969c553affd5c1401876b8) ) - - ROM_REGION( 0x2000, "printer_fm", 0 ) - ROM_LOAD( "f&m.printer.1.2.bin", 0x0000, 0x1000, CRC(2feb997d) SHA1(ee9cb91042696c88ff5f2f44d2f702dc93369ba0) ) - - ROM_REGION( 0x2000, "rs232", 0 ) - ROM_LOAD( "rs232.bin", 0x0000, 0x0800, CRC(926ff2d1) SHA1(be02bd388bba0211ea72d4868264a63308e4318d) ) + ROM_SYSTEM_BIOS( 0, "comx", "COMX" ) + ROMX_LOAD( "printer.bin", 0x0000, 0x0800, CRC(3bbc2b2e) SHA1(08bf7ea4174713ab24969c553affd5c1401876b8), ROM_BIOS(1) ) + ROM_SYSTEM_BIOS( 1, "fm12", "F&M v1.2" ) + ROMX_LOAD( "f&m.printer.1.2.bin", 0x0000, 0x1000, CRC(2feb997d) SHA1(ee9cb91042696c88ff5f2f44d2f702dc93369ba0), ROM_BIOS(2) ) + ROM_LOAD( "rs232.bin", 0x1000, 0x0800, CRC(926ff2d1) SHA1(be02bd388bba0211ea72d4868264a63308e4318d) ) ROM_END @@ -50,6 +50,37 @@ const rom_entry *comx_prn_device::device_rom_region() const } +//------------------------------------------------- +// SLOT_INTERFACE( comx_centronics_printer ) +//------------------------------------------------- + +SLOT_INTERFACE_START(comx_centronics_printer) + SLOT_INTERFACE("printer", CENTRONICS_PRINTER) + SLOT_INTERFACE("pl80", COMX_PL80) +SLOT_INTERFACE_END + + +//------------------------------------------------- +// MACHINE_CONFIG_FRAGMENT( comx_prn ) +//------------------------------------------------- + +static MACHINE_CONFIG_FRAGMENT( comx_prn ) + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, standard_centronics, comx_centronics_printer, "pl80", NULL) +MACHINE_CONFIG_END + + +//------------------------------------------------- +// machine_config_additions - device-specific +// machine configurations +//------------------------------------------------- + +machine_config_constructor comx_prn_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( comx_prn ); +} + + + //************************************************************************** // LIVE DEVICE //************************************************************************** @@ -59,8 +90,9 @@ const rom_entry *comx_prn_device::device_rom_region() const //------------------------------------------------- comx_prn_device::comx_prn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, COMX_PRN, "COMX-35 F&M Printer Card", tag, owner, clock), - device_comx_expansion_card_interface(mconfig, *this) + device_t(mconfig, COMX_PRN, "COMX-35 Printer Card", tag, owner, clock), + device_comx_expansion_card_interface(mconfig, *this), + m_centronics(*this, CENTRONICS_TAG) { } @@ -88,13 +120,13 @@ void comx_prn_device::device_reset() // comx_mrd_r - memory read //------------------------------------------------- -UINT8 comx_prn_device::comx_mrd_r(offs_t offset, int *extrom) +UINT8 comx_prn_device::comx_mrd_r(address_space &space, offs_t offset, int *extrom) { UINT8 data = 0; - if (offset >= 0xc000 && offset < 0xd000) + if (offset >= 0xc000 && offset < 0xe000) { - data = m_rom[offset & 0xfff]; + data = m_rom[offset & 0x1fff]; } return data; @@ -105,23 +137,45 @@ UINT8 comx_prn_device::comx_mrd_r(offs_t offset, int *extrom) // comx_io_r - I/O read //------------------------------------------------- -UINT8 comx_prn_device::comx_io_r(offs_t offset) +UINT8 comx_prn_device::comx_io_r(address_space &space, offs_t offset) { /* - Parallel: + Parallel: + + INP 2 for the printer status, where: + b0=1: Acknowledge Fault + b1=0: Device Busy + b2=0: Paper Empty + b3=1: Device Not Selected - INP 2 for the printer status, where: - b0=1: Acknowledge Fault - b1=0: Device Busy - b2=0: Paper Empty - b3=1: Device Not Selected + Serial: - Serial: + INP 2 for the printer status and to start a new range of bits for the next byte. + */ + + /* - INP 2 for the printer status and to start a new range of bits for the next byte. - */ + bit description - return 0; + 0 Acknowledge Fault + 1 Device Busy + 2 Paper Empty + 3 Device Not Selected + 4 + 5 + 6 + 7 + + */ + + UINT8 data = 0; + + data |= m_centronics->ack_r(); + data |= m_centronics->not_busy_r() << 1; + data |= m_centronics->pe_r() << 2; + data |= m_centronics->vcc_r() << 3; + + return data; } @@ -129,15 +183,17 @@ UINT8 comx_prn_device::comx_io_r(offs_t offset) // comx_io_w - I/O write //------------------------------------------------- -void comx_prn_device::comx_io_w(offs_t offset, UINT8 data) +void comx_prn_device::comx_io_w(address_space &space, offs_t offset, UINT8 data) { /* - Parallel: + Parallel: + + OUT 2 is used to send a byte to the printer - OUT 2 is used to send a byte to the printer + Serial: - Serial: + OUT 2 is used to send a bit to the printer + */ - OUT 2 is used to send a bit to the printer - */ + m_centronics->write(data); } diff --git a/src/mess/machine/comx_prn.h b/src/mess/machine/comx_prn.h index c049dc9c58b..b17ef8d79f3 100644 --- a/src/mess/machine/comx_prn.h +++ b/src/mess/machine/comx_prn.h @@ -15,6 +15,8 @@ #include "emu.h" #include "machine/comxexp.h" +#include "machine/comxpl80.h" +#include "machine/ctronics.h" @@ -25,7 +27,7 @@ // ======================> comx_prn_device class comx_prn_device : public device_t, - public device_comx_expansion_card_interface + public device_comx_expansion_card_interface { public: // construction/destruction @@ -33,20 +35,23 @@ public: // optional information overrides virtual const rom_entry *device_rom_region() const; + virtual machine_config_constructor device_mconfig_additions() const; protected: // device-level overrides virtual void device_start(); virtual void device_reset(); - virtual void device_config_complete() { m_shortname = "comx_prn"; } + virtual void device_config_complete() { m_shortname = "comx_prn"; } // device_comx_expansion_card_interface overrides - virtual UINT8 comx_mrd_r(offs_t offset, int *extrom); - virtual UINT8 comx_io_r(offs_t offset); - virtual void comx_io_w(offs_t offset, UINT8 data); + virtual UINT8 comx_mrd_r(address_space &space, offs_t offset, int *extrom); + virtual UINT8 comx_io_r(address_space &space, offs_t offset); + virtual void comx_io_w(address_space &space, offs_t offset, UINT8 data); private: - UINT8 *m_rom; // program ROM + required_device<centronics_device> m_centronics; + + UINT8 *m_rom; // program ROM }; diff --git a/src/mess/machine/comx_ram.c b/src/mess/machine/comx_ram.c index ffdab39b161..681f45856e1 100644 --- a/src/mess/machine/comx_ram.c +++ b/src/mess/machine/comx_ram.c @@ -15,7 +15,7 @@ // MACROS/CONSTANTS //************************************************************************** -#define RAM_SIZE 0x8000 +#define RAM_SIZE 0x8000 @@ -67,7 +67,7 @@ void comx_ram_device::device_reset() // comx_mrd_r - memory read //------------------------------------------------- -UINT8 comx_ram_device::comx_mrd_r(offs_t offset, int *extrom) +UINT8 comx_ram_device::comx_mrd_r(address_space &space, offs_t offset, int *extrom) { UINT8 data = 0; @@ -84,7 +84,7 @@ UINT8 comx_ram_device::comx_mrd_r(offs_t offset, int *extrom) // comx_mwr_w - memory write //------------------------------------------------- -void comx_ram_device::comx_mwr_w(offs_t offset, UINT8 data) +void comx_ram_device::comx_mwr_w(address_space &space, offs_t offset, UINT8 data) { if (offset >= 0xc000 && offset < 0xd000) { @@ -97,7 +97,7 @@ void comx_ram_device::comx_mwr_w(offs_t offset, UINT8 data) // comx_io_w - I/O write //------------------------------------------------- -void comx_ram_device::comx_io_w(offs_t offset, UINT8 data) +void comx_ram_device::comx_io_w(address_space &space, offs_t offset, UINT8 data) { if (offset == 1) { diff --git a/src/mess/machine/comx_ram.h b/src/mess/machine/comx_ram.h index 571d202fa58..f63c2521162 100644 --- a/src/mess/machine/comx_ram.h +++ b/src/mess/machine/comx_ram.h @@ -25,7 +25,7 @@ // ======================> comx_ram_device class comx_ram_device : public device_t, - public device_comx_expansion_card_interface + public device_comx_expansion_card_interface { public: // construction/destruction @@ -38,9 +38,9 @@ protected: virtual void device_config_complete() { m_shortname = "comx_ram"; } // device_comx_expansion_card_interface overrides - virtual UINT8 comx_mrd_r(offs_t offset, int *extrom); - virtual void comx_mwr_w(offs_t offset, UINT8 data); - virtual void comx_io_w(offs_t offset, UINT8 data); + virtual UINT8 comx_mrd_r(address_space &space, offs_t offset, int *extrom); + virtual void comx_mwr_w(address_space &space, offs_t offset, UINT8 data); + virtual void comx_io_w(address_space &space, offs_t offset, UINT8 data); private: UINT8 *m_ram; diff --git a/src/mess/machine/comx_thm.c b/src/mess/machine/comx_thm.c index 8900b66bd91..ea2f90411d2 100644 --- a/src/mess/machine/comx_thm.c +++ b/src/mess/machine/comx_thm.c @@ -82,7 +82,7 @@ void comx_thm_device::device_reset() // comx_mrd_r - memory read //------------------------------------------------- -UINT8 comx_thm_device::comx_mrd_r(offs_t offset, int *extrom) +UINT8 comx_thm_device::comx_mrd_r(address_space &space, offs_t offset, int *extrom) { UINT8 data = 0; @@ -99,14 +99,14 @@ UINT8 comx_thm_device::comx_mrd_r(offs_t offset, int *extrom) // comx_io_r - I/O read //------------------------------------------------- -UINT8 comx_thm_device::comx_io_r(offs_t offset) +UINT8 comx_thm_device::comx_io_r(address_space &space, offs_t offset) { /* - INP 2 is used for the printer status, where: - b0=1: Printer Not Ready - b1=1: Energizing Head - b2=1: Head At Position 0 - */ + INP 2 is used for the printer status, where: + b0=1: Printer Not Ready + b1=1: Energizing Head + b2=1: Head At Position 0 + */ return 0; } @@ -116,13 +116,13 @@ UINT8 comx_thm_device::comx_io_r(offs_t offset) // comx_io_w - I/O write //------------------------------------------------- -void comx_thm_device::comx_io_w(offs_t offset, UINT8 data) +void comx_thm_device::comx_io_w(address_space &space, offs_t offset, UINT8 data) { /* - OUT 2 is used to control the thermal printer where: - Q = 0, b0-7: Pixel 1 to 8 - Q = 1, b7: Pixel 9 (if b0-6=#21) - Q = 1, b3=1: Move head right - Q = 1, b0-7=#12: Move head left - */ + OUT 2 is used to control the thermal printer where: + Q = 0, b0-7: Pixel 1 to 8 + Q = 1, b7: Pixel 9 (if b0-6=#21) + Q = 1, b3=1: Move head right + Q = 1, b0-7=#12: Move head left + */ } diff --git a/src/mess/machine/comx_thm.h b/src/mess/machine/comx_thm.h index b603f920962..bcb8a7ea4b1 100644 --- a/src/mess/machine/comx_thm.h +++ b/src/mess/machine/comx_thm.h @@ -25,7 +25,7 @@ // ======================> comx_thm_device class comx_thm_device : public device_t, - public device_comx_expansion_card_interface + public device_comx_expansion_card_interface { public: // construction/destruction @@ -38,15 +38,15 @@ protected: // device-level overrides virtual void device_start(); virtual void device_reset(); - virtual void device_config_complete() { m_shortname = "comx_thm"; } + virtual void device_config_complete() { m_shortname = "comx_thm"; } // device_comx_expansion_card_interface overrides - virtual UINT8 comx_mrd_r(offs_t offset, int *extrom); - virtual UINT8 comx_io_r(offs_t offset); - virtual void comx_io_w(offs_t offset, UINT8 data); + virtual UINT8 comx_mrd_r(address_space &space, offs_t offset, int *extrom); + virtual UINT8 comx_io_r(address_space &space, offs_t offset); + virtual void comx_io_w(address_space &space, offs_t offset, UINT8 data); private: - UINT8 *m_rom; // program ROM + UINT8 *m_rom; // program ROM }; diff --git a/src/mess/machine/comxexp.c b/src/mess/machine/comxexp.c index 27cfa7f4298..07297ac9d3f 100644 --- a/src/mess/machine/comxexp.c +++ b/src/mess/machine/comxexp.c @@ -28,7 +28,8 @@ const device_type COMX_EXPANSION_SLOT = &device_creator<comx_expansion_slot_devi //------------------------------------------------- device_comx_expansion_card_interface::device_comx_expansion_card_interface(const machine_config &mconfig, device_t &device) - : device_slot_card_interface(mconfig,device) + : device_slot_card_interface(mconfig, device), + m_ds(1) { m_slot = dynamic_cast<comx_expansion_slot_device *>(device.owner()); } @@ -53,7 +54,7 @@ device_comx_expansion_card_interface::~device_comx_expansion_card_interface() //------------------------------------------------- comx_expansion_slot_device::comx_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : - device_t(mconfig, COMX_EXPANSION_SLOT, "COMX-35 expansion slot", tag, owner, clock), + device_t(mconfig, COMX_EXPANSION_SLOT, "COMX-35 expansion slot", tag, owner, clock), device_slot_interface(mconfig, *this) { } @@ -86,10 +87,9 @@ void comx_expansion_slot_device::device_config_complete() // or initialize to defaults if none provided else { - memset(&m_out_int_cb, 0, sizeof(m_out_int_cb)); - memset(&m_out_ef4_cb, 0, sizeof(m_out_ef4_cb)); - memset(&m_out_wait_cb, 0, sizeof(m_out_wait_cb)); - memset(&m_out_clear_cb, 0, sizeof(m_out_clear_cb)); + memset(&m_out_int_cb, 0, sizeof(m_out_int_cb)); + memset(&m_out_wait_cb, 0, sizeof(m_out_wait_cb)); + memset(&m_out_clear_cb, 0, sizeof(m_out_clear_cb)); } } @@ -104,7 +104,6 @@ void comx_expansion_slot_device::device_start() // resolve callbacks m_out_int_func.resolve(m_out_int_cb, *this); - m_out_ef4_func.resolve(m_out_ef4_cb, *this); m_out_wait_func.resolve(m_out_wait_cb, *this); m_out_clear_func.resolve(m_out_clear_cb, *this); } @@ -123,13 +122,13 @@ void comx_expansion_slot_device::device_reset() // mrd_r - memory read //------------------------------------------------- -UINT8 comx_expansion_slot_device::mrd_r(offs_t offset, int *extrom) +UINT8 comx_expansion_slot_device::mrd_r(address_space &space, offs_t offset, int *extrom) { UINT8 data = 0; if (m_card != NULL) { - data = m_card->comx_mrd_r(offset, extrom); + data = m_card->comx_mrd_r(space, offset, extrom); } return data; @@ -140,11 +139,11 @@ UINT8 comx_expansion_slot_device::mrd_r(offs_t offset, int *extrom) // mwr_w - memory write //------------------------------------------------- -void comx_expansion_slot_device::mwr_w(offs_t offset, UINT8 data) +void comx_expansion_slot_device::mwr_w(address_space &space, offs_t offset, UINT8 data) { if (m_card != NULL) { - m_card->comx_mwr_w(offset, data); + m_card->comx_mwr_w(space, offset, data); } } @@ -153,13 +152,13 @@ void comx_expansion_slot_device::mwr_w(offs_t offset, UINT8 data) // io_r - I/O read //------------------------------------------------- -UINT8 comx_expansion_slot_device::io_r(offs_t offset) +UINT8 comx_expansion_slot_device::io_r(address_space &space, offs_t offset) { UINT8 data = 0; if (m_card != NULL) { - data = m_card->comx_io_r(offset); + data = m_card->comx_io_r(space, offset); } return data; @@ -170,11 +169,11 @@ UINT8 comx_expansion_slot_device::io_r(offs_t offset) // sout_w - I/O write //------------------------------------------------- -void comx_expansion_slot_device::io_w(offs_t offset, UINT8 data) +void comx_expansion_slot_device::io_w(address_space &space, offs_t offset, UINT8 data) { if (m_card != NULL) { - m_card->comx_io_w(offset, data); + m_card->comx_io_w(space, offset, data); } } @@ -204,8 +203,18 @@ WRITE_LINE_MEMBER( comx_expansion_slot_device::q_w ) } } +READ_LINE_MEMBER( comx_expansion_slot_device::ef4_r ) +{ + int state = CLEAR_LINE; + + if (m_card != NULL) + { + state = m_card->comx_ef4_r(); + } + + return state; +} WRITE_LINE_MEMBER( comx_expansion_slot_device::int_w ) { m_out_int_func(state); } -WRITE_LINE_MEMBER( comx_expansion_slot_device::ef4_w ) { m_out_ef4_func(state); } WRITE_LINE_MEMBER( comx_expansion_slot_device::wait_w ) { m_out_wait_func(state); } WRITE_LINE_MEMBER( comx_expansion_slot_device::clear_w ) { m_out_clear_func(state); } diff --git a/src/mess/machine/comxexp.h b/src/mess/machine/comxexp.h index 19d9f03f9b7..41861287d6f 100644 --- a/src/mess/machine/comxexp.h +++ b/src/mess/machine/comxexp.h @@ -45,7 +45,7 @@ // CONSTANTS //************************************************************************** -#define COMX_EXPANSION_BUS_TAG "comxexp" +#define COMX_EXPANSION_BUS_TAG "comxexp" @@ -58,8 +58,8 @@ #define MCFG_COMX_EXPANSION_SLOT_ADD(_tag, _config, _slot_intf, _def_slot, _def_inp) \ - MCFG_DEVICE_ADD(_tag, COMX_EXPANSION_SLOT, 0) \ - MCFG_DEVICE_CONFIG(_config) \ + MCFG_DEVICE_ADD(_tag, COMX_EXPANSION_SLOT, 0) \ + MCFG_DEVICE_CONFIG(_config) \ MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, false) @@ -72,10 +72,9 @@ struct comx_expansion_slot_interface { - devcb_write_line m_out_int_cb; - devcb_write_line m_out_ef4_cb; - devcb_write_line m_out_wait_cb; - devcb_write_line m_out_clear_cb; + devcb_write_line m_out_int_cb; + devcb_write_line m_out_wait_cb; + devcb_write_line m_out_clear_cb; }; @@ -84,25 +83,26 @@ struct comx_expansion_slot_interface class device_comx_expansion_card_interface; class comx_expansion_slot_device : public device_t, - public comx_expansion_slot_interface, - public device_slot_interface + public comx_expansion_slot_interface, + public device_slot_interface { public: // construction/destruction comx_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); virtual ~comx_expansion_slot_device(); - UINT8 mrd_r(offs_t offset, int *extrom); - void mwr_w(offs_t offset, UINT8 data); + UINT8 mrd_r(address_space &space, offs_t offset, int *extrom); + void mwr_w(address_space &space, offs_t offset, UINT8 data); - UINT8 io_r(offs_t offset); - void io_w(offs_t offset, UINT8 data); + UINT8 io_r(address_space &space, offs_t offset); + void io_w(address_space &space, offs_t offset, UINT8 data); + + DECLARE_READ_LINE_MEMBER( ef4_r ); DECLARE_WRITE_LINE_MEMBER( ds_w ); DECLARE_WRITE_LINE_MEMBER( q_w ); DECLARE_WRITE_LINE_MEMBER( int_w ); - DECLARE_WRITE_LINE_MEMBER( ef4_w ); DECLARE_WRITE_LINE_MEMBER( wait_w ); DECLARE_WRITE_LINE_MEMBER( clear_w ); @@ -114,10 +114,9 @@ protected: virtual void device_reset(); virtual void device_config_complete(); - devcb_resolved_write_line m_out_int_func; - devcb_resolved_write_line m_out_ef4_func; - devcb_resolved_write_line m_out_wait_func; - devcb_resolved_write_line m_out_clear_func; + devcb_resolved_write_line m_out_int_func; + devcb_resolved_write_line m_out_wait_func; + devcb_resolved_write_line m_out_clear_func; device_comx_expansion_card_interface *m_card; }; @@ -137,18 +136,21 @@ public: protected: // signals - virtual void comx_ds_w(int state) { }; + virtual int comx_ef4_r() { return CLEAR_LINE; } + virtual void comx_ds_w(int state) { m_ds = state; }; virtual void comx_q_w(int state) { }; // memory access - virtual UINT8 comx_mrd_r(offs_t offset, int *extrom) { return 0; }; - virtual void comx_mwr_w(offs_t offset, UINT8 data) { }; + virtual UINT8 comx_mrd_r(address_space &space, offs_t offset, int *extrom) { return 0; }; + virtual void comx_mwr_w(address_space &space, offs_t offset, UINT8 data) { }; // I/O access - virtual UINT8 comx_io_r(offs_t offset) { return 0; }; - virtual void comx_io_w(offs_t offset, UINT8 data) { }; + virtual UINT8 comx_io_r(address_space &space, offs_t offset) { return 0; }; + virtual void comx_io_w(address_space &space, offs_t offset, UINT8 data) { }; comx_expansion_slot_device *m_slot; + + int m_ds; }; diff --git a/src/mess/machine/comxpl80.c b/src/mess/machine/comxpl80.c index 940f780340b..0f0c7477b8d 100644 --- a/src/mess/machine/comxpl80.c +++ b/src/mess/machine/comxpl80.c @@ -31,28 +31,7 @@ // DEVICE DEFINITIONS //************************************************************************** -const device_type COMXPL80 = &device_creator<comxpl80_device>; - -//------------------------------------------------- -// device_config_complete - perform any -// operations now that the configuration is -// complete -//------------------------------------------------- - -void comxpl80_device::device_config_complete() -{ - // inherit a copy of the static data - const comxpl80_interface *intf = reinterpret_cast<const comxpl80_interface *>(static_config()); - if (intf != NULL) - *static_cast<comxpl80_interface *>(this) = *intf; - - // or initialize to defaults if none provided - else - { - } - - m_shortname = "comxpl80"; -} +const device_type COMX_PL80 = &device_creator<comx_pl80_device>; //------------------------------------------------- @@ -73,7 +52,7 @@ ROM_END // rom_region - device-specific ROM region //------------------------------------------------- -const rom_entry *comxpl80_device::device_rom_region() const +const rom_entry *comx_pl80_device::device_rom_region() const { return ROM_NAME( comxpl80 ); } @@ -83,7 +62,7 @@ const rom_entry *comxpl80_device::device_rom_region() const // ADDRESS_MAP( comxpl80_mem ) //------------------------------------------------- -static ADDRESS_MAP_START( comxpl80_mem, AS_PROGRAM, 8, comxpl80_device ) +static ADDRESS_MAP_START( comxpl80_mem, AS_PROGRAM, 8, comx_pl80_device ) /* AM_RANGE(0x000, 0x000) AM_READWRITE(cx005_port_a_r, cx005_port_a_w) AM_RANGE(0x001, 0x001) AM_READWRITE(cx005_port_b_r, cx005_port_b_w) AM_RANGE(0x002, 0x002) AM_READWRITE(cx005_port_c_r, cx005_port_c_w) @@ -106,7 +85,7 @@ ADDRESS_MAP_END // ADDRESS_MAP( comxpl80_io ) //------------------------------------------------- -static ADDRESS_MAP_START( comxpl80_io, AS_IO, 8, comxpl80_device ) +static ADDRESS_MAP_START( comxpl80_io, AS_IO, 8, comx_pl80_device ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x00, 0x00) AM_WRITE(pa_w) AM_RANGE(0x01, 0x01) AM_WRITE(pb_w) @@ -132,7 +111,7 @@ MACHINE_CONFIG_END // machine configurations //------------------------------------------------- -machine_config_constructor comxpl80_device::device_mconfig_additions() const +machine_config_constructor comx_pl80_device::device_mconfig_additions() const { return MACHINE_CONFIG_NAME( comxpl80 ); } @@ -165,7 +144,7 @@ INPUT_PORTS_END // input_ports - device-specific input ports //------------------------------------------------- -ioport_constructor comxpl80_device::device_input_ports() const +ioport_constructor comx_pl80_device::device_input_ports() const { return INPUT_PORTS_NAME( comxpl80 ); } @@ -177,11 +156,12 @@ ioport_constructor comxpl80_device::device_input_ports() const //************************************************************************** //------------------------------------------------- -// comxpl80_device - constructor +// comx_pl80_device - constructor //------------------------------------------------- -comxpl80_device::comxpl80_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, COMXPL80, "COMX PL-80", tag, owner, clock) +comx_pl80_device::comx_pl80_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : device_t(mconfig, COMX_PL80, "COMX PL-80", tag, owner, clock), + device_centronics_peripheral_interface(mconfig, *this) { } @@ -190,10 +170,9 @@ comxpl80_device::comxpl80_device(const machine_config &mconfig, const char *tag, // device_start - device-specific startup //------------------------------------------------- -void comxpl80_device::device_start() +void comx_pl80_device::device_start() { // state saving - save_item(NAME(m_centronics_data)); save_item(NAME(m_font_addr)); save_item(NAME(m_x_motor_phase)); save_item(NAME(m_y_motor_phase)); @@ -208,7 +187,7 @@ void comxpl80_device::device_start() // device_reset - device-specific reset //------------------------------------------------- -void comxpl80_device::device_reset() +void comx_pl80_device::device_reset() { } @@ -217,7 +196,7 @@ void comxpl80_device::device_reset() // pa_w - //------------------------------------------------- -WRITE8_MEMBER( comxpl80_device::pa_w ) +WRITE8_MEMBER( comx_pl80_device::pa_w ) { /* @@ -254,7 +233,7 @@ WRITE8_MEMBER( comxpl80_device::pa_w ) if (!BIT(data, 6)) { // read data from Centronics bus - m_plotter_data = m_centronics_data; + m_plotter_data = m_data; } if (BIT(data, 7)) @@ -269,7 +248,7 @@ WRITE8_MEMBER( comxpl80_device::pa_w ) // pb_w - //------------------------------------------------- -WRITE8_MEMBER( comxpl80_device::pb_w ) +WRITE8_MEMBER( comx_pl80_device::pb_w ) { /* @@ -296,7 +275,7 @@ WRITE8_MEMBER( comxpl80_device::pb_w ) // pc_w - //------------------------------------------------- -WRITE8_MEMBER( comxpl80_device::pc_w ) +WRITE8_MEMBER( comx_pl80_device::pc_w ) { /* @@ -326,7 +305,7 @@ WRITE8_MEMBER( comxpl80_device::pc_w ) // pd_r - //------------------------------------------------- -READ8_MEMBER( comxpl80_device::pd_r ) +READ8_MEMBER( comx_pl80_device::pd_r ) { /* diff --git a/src/mess/machine/comxpl80.h b/src/mess/machine/comxpl80.h index 188c46f11e3..c5bed225cb7 100644 --- a/src/mess/machine/comxpl80.h +++ b/src/mess/machine/comxpl80.h @@ -9,32 +9,12 @@ #pragma once -#ifndef __COMXPL80__ -#define __COMXPL80__ +#ifndef __COMX_PL80__ +#define __COMX_PL80__ #include "emu.h" #include "cpu/m6805/m6805.h" - - - -//************************************************************************** -// MACROS / CONSTANTS -//************************************************************************** - -#define COMXPL80_TAG "comxpl80" - - - -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_COMXPL80_ADD() \ - MCFG_DEVICE_ADD(COMXPL80_TAG, COMXPL80, 0) - - -#define COMXPL80_INTERFACE(_name) \ - const comxpl80_interface (_name) = +#include "machine/ctronics.h" @@ -42,28 +22,21 @@ // TYPE DEFINITIONS //************************************************************************** -// ======================> comxpl80_interface +// ======================> comx_pl80_device -struct comxpl80_interface -{ - devcb_write_line m_out_txd_cb; - devcb_write_line m_out_clock_cb; - devcb_write_line m_out_keydown_cb; -}; - -// ======================> comxpl80_device - -class comxpl80_device : public device_t, - public comxpl80_interface +class comx_pl80_device : public device_t, + public device_centronics_peripheral_interface { public: // construction/destruction - comxpl80_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + comx_pl80_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + // optional information overrides virtual const rom_entry *device_rom_region() const; virtual machine_config_constructor device_mconfig_additions() const; virtual ioport_constructor device_input_ports() const; + // not really public DECLARE_WRITE8_MEMBER( pa_w ); DECLARE_WRITE8_MEMBER( pb_w ); DECLARE_WRITE8_MEMBER( pc_w ); @@ -71,14 +44,11 @@ public: protected: // device-level overrides + virtual void device_config_complete() { m_shortname = "comx_pl80"; } virtual void device_start(); virtual void device_reset(); - virtual void device_config_complete(); private: - // printer state - UINT8 m_centronics_data; // centronics data - // PL-80 plotter state UINT16 m_font_addr; // font ROM pack address latch UINT8 m_x_motor_phase; // X motor phase @@ -91,7 +61,7 @@ private: // device type definition -extern const device_type COMXPL80; +extern const device_type COMX_PL80; |