(MESS) comx35: Floppy modernization and expansion interface cleanup. (nw)

This commit is contained in:
Curt Coder 2012-11-28 15:58:47 +00:00
parent 21ea8a94e9
commit f2dacf2813
25 changed files with 555 additions and 485 deletions

View File

@ -1,3 +1,96 @@
/***************************************************************************
Copyright Olivier Galibert
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
* Neither the name 'MAME' nor the names of its contributors may be
used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
****************************************************************************/
/*********************************************************************
formats/comx35_dsk.c
COMX-35 disk image format
*********************************************************************/
/*
TODO:
- implement 70 track image detection
*/
#include "emu.h"
#include "formats/comx35_dsk.h"
comx35_format::comx35_format() : wd177x_format(formats)
{
}
const char *comx35_format::name() const
{
return "comx35";
}
const char *comx35_format::description() const
{
return "COMX-35 disk image";
}
const char *comx35_format::extensions() const
{
return "img";
}
// Unverified gap sizes
const comx35_format::format comx35_format::formats[] = {
{ // 70K 5 1/4 inch single density single sided 35 tracks
floppy_image::FF_525, floppy_image::SSSD,
2000, 16, 35, 1, 128, {}, 0, {}, 100, 22, 84
},
{ // 140K 5 1/4 inch single density double sided 35 tracks
floppy_image::FF_525, floppy_image::DSSD,
2000, 16, 35, 2, 128, {}, 0, {}, 100, 22, 84
},
/*{ // 140K 5 1/4 inch quad density single sided 70 tracks
floppy_image::FF_525, floppy_image::SSQD,
2000, 16, 70, 1, 128, {}, 0, {}, 100, 22, 84
},*/
{}
};
const floppy_format_type FLOPPY_COMX35_FORMAT = &floppy_image_format_creator<comx35_format>;
#ifdef UNUSED_CODE
/********************************************************************* /*********************************************************************
formats/comx35_dsk.c formats/comx35_dsk.c
@ -76,3 +169,5 @@ static FLOPPY_CONSTRUCT( comx35_dsk_construct )
LEGACY_FLOPPY_OPTIONS_START( comx35 ) LEGACY_FLOPPY_OPTIONS_START( comx35 )
LEGACY_FLOPPY_OPTION( comx35, "img", "COMX35 floppy disk image", comx35_dsk_identify, comx35_dsk_construct, NULL, NULL ) LEGACY_FLOPPY_OPTION( comx35, "img", "COMX35 floppy disk image", comx35_dsk_identify, comx35_dsk_construct, NULL, NULL )
LEGACY_FLOPPY_OPTIONS_END LEGACY_FLOPPY_OPTIONS_END
#endif

View File

@ -2,17 +2,27 @@
formats/comx35_dsk.h formats/comx35_dsk.h
COMX35 disk images COMX-35 disk image format
*********************************************************************/ *********************************************************************/
#ifndef COMX35_DSK_H #ifndef COMX35_DSK_H_
#define COMX35_DSK_H #define COMX35_DSK_H_
#include "flopimg.h" #include "wd177x_dsk.h"
/**************************************************************************/ class comx35_format : public wd177x_format {
public:
comx35_format();
LEGACY_FLOPPY_OPTIONS_EXTERN(comx35); virtual const char *name() const;
virtual const char *description() const;
virtual const char *extensions() const;
#endif /* COMX35_DSK_H */ private:
static const format formats[];
};
extern const floppy_format_type FLOPPY_COMX35_FORMAT;
#endif

View File

@ -24,19 +24,17 @@
READ8_MEMBER( comx35_state::mem_r ) READ8_MEMBER( comx35_state::mem_r )
{ {
UINT8 *rom = memregion(CDP1802_TAG)->base();
UINT8 *ram = m_ram->pointer();
int extrom = 1; int extrom = 1;
UINT8 data = m_expansion->mrd_r(offset, &extrom); UINT8 data = m_exp->mrd_r(space, offset, &extrom);
if (offset < 0x4000) if (offset < 0x4000)
{ {
if (extrom) data = rom[offset & 0x3fff]; if (extrom) data = m_rom[offset & 0x3fff];
} }
else if (offset >= 0x4000 && offset < 0xc000) else if (offset >= 0x4000 && offset < 0xc000)
{ {
data = ram[offset - 0x4000]; data = m_ram->pointer()[offset - 0x4000];
} }
else if (offset >= 0xf400 && offset < 0xf800) else if (offset >= 0xf400 && offset < 0xf800)
{ {
@ -53,13 +51,11 @@ READ8_MEMBER( comx35_state::mem_r )
WRITE8_MEMBER( comx35_state::mem_w ) WRITE8_MEMBER( comx35_state::mem_w )
{ {
UINT8 *ram = m_ram->pointer(); m_exp->mwr_w(space, offset, data);
m_expansion->mwr_w(offset, data);
if (offset >= 0x4000 && offset < 0xc000) if (offset >= 0x4000 && offset < 0xc000)
{ {
ram[offset - 0x4000] = data; m_ram->pointer()[offset - 0x4000] = data;
} }
else if (offset >= 0xf400 && offset < 0xf800) else if (offset >= 0xf400 && offset < 0xf800)
{ {
@ -78,7 +74,7 @@ WRITE8_MEMBER( comx35_state::mem_w )
READ8_MEMBER( comx35_state::io_r ) READ8_MEMBER( comx35_state::io_r )
{ {
UINT8 data = m_expansion->io_r(offset); UINT8 data = m_exp->io_r(space, offset);
if (offset == 3) if (offset == 3)
{ {
@ -95,7 +91,7 @@ READ8_MEMBER( comx35_state::io_r )
WRITE8_MEMBER( comx35_state::io_w ) WRITE8_MEMBER( comx35_state::io_w )
{ {
m_expansion->io_w(offset, data); m_exp->io_w(space, offset, data);
if (offset >= 3) if (offset >= 3)
{ {
@ -279,7 +275,7 @@ READ_LINE_MEMBER( comx35_state::ef2_r )
READ_LINE_MEMBER( comx35_state::ef4_r ) READ_LINE_MEMBER( comx35_state::ef4_r )
{ {
return m_ef4; // | (m_cassette->input() > 0.0f); return m_exp->ef4_r(); // | (m_cassette->input() > 0.0f);
} }
static COSMAC_SC_WRITE( comx35_sc_w ) static COSMAC_SC_WRITE( comx35_sc_w )
@ -335,23 +331,23 @@ WRITE_LINE_MEMBER( comx35_state::q_w )
m_cassette->output(state ? +1.0 : -1.0); m_cassette->output(state ? +1.0 : -1.0);
// expansion bus // expansion bus
m_expansion->q_w(state); m_exp->q_w(state);
} }
static COSMAC_INTERFACE( cosmac_intf ) static COSMAC_INTERFACE( cosmac_intf )
{ {
DEVCB_LINE_VCC, // wait DEVCB_LINE_VCC, // wait
DEVCB_DRIVER_LINE_MEMBER(comx35_state, clear_r),// clear DEVCB_DRIVER_LINE_MEMBER(comx35_state, clear_r),// clear
DEVCB_NULL, // EF1 DEVCB_NULL, // EF1
DEVCB_DRIVER_LINE_MEMBER(comx35_state, ef2_r), // EF2 DEVCB_DRIVER_LINE_MEMBER(comx35_state, ef2_r), // EF2
DEVCB_NULL, // EF3 DEVCB_NULL, // EF3
DEVCB_DRIVER_LINE_MEMBER(comx35_state, ef4_r), // EF4 DEVCB_DRIVER_LINE_MEMBER(comx35_state, ef4_r), // EF4
DEVCB_DRIVER_LINE_MEMBER(comx35_state, q_w), // Q DEVCB_DRIVER_LINE_MEMBER(comx35_state, q_w), // Q
DEVCB_NULL, // DMA in DEVCB_NULL, // DMA in
DEVCB_NULL, // DMA out DEVCB_NULL, // DMA out
comx35_sc_w, // SC comx35_sc_w, // SC
DEVCB_NULL, // TPA DEVCB_NULL, // TPA
DEVCB_NULL // TPB DEVCB_NULL // TPB
}; };
@ -414,15 +410,9 @@ WRITE_LINE_MEMBER( comx35_state::int_w )
check_interrupt(); check_interrupt();
} }
WRITE_LINE_MEMBER( comx35_state::ef4_w )
{
m_ef4 = state;
}
static COMX_EXPANSION_INTERFACE( expansion_intf ) static COMX_EXPANSION_INTERFACE( expansion_intf )
{ {
DEVCB_DRIVER_LINE_MEMBER(comx35_state, int_w), DEVCB_DRIVER_LINE_MEMBER(comx35_state, int_w),
DEVCB_DRIVER_LINE_MEMBER(comx35_state, ef4_w),
DEVCB_NULL, DEVCB_NULL,
DEVCB_NULL DEVCB_NULL
}; };
@ -469,10 +459,12 @@ void comx35_state::machine_start()
UINT8 *ram = m_ram->pointer(); UINT8 *ram = m_ram->pointer();
memset(ram, 0, 0x8000); memset(ram, 0, 0x8000);
// find memory regions
m_rom = memregion(CDP1802_TAG)->base();
// register for state saving // register for state saving
save_item(NAME(m_clear)); save_item(NAME(m_clear));
save_item(NAME(m_q)); save_item(NAME(m_q));
save_item(NAME(m_ef4));
save_item(NAME(m_iden)); save_item(NAME(m_iden));
save_item(NAME(m_dma)); save_item(NAME(m_dma));
save_item(NAME(m_int)); save_item(NAME(m_int));
@ -487,12 +479,13 @@ void comx35_state::machine_start()
void comx35_state::machine_reset() void comx35_state::machine_reset()
{ {
m_exp->reset();
int t = RES_K(27) * CAP_U(1) * 1000; // t = R1 * C1 int t = RES_K(27) * CAP_U(1) * 1000; // t = R1 * C1
m_clear = 0; m_clear = 0;
m_iden = 1; m_iden = 1;
m_cr1 = 1; m_cr1 = 1;
m_ef4 = CLEAR_LINE;
m_int = CLEAR_LINE; m_int = CLEAR_LINE;
m_prd = CLEAR_LINE; m_prd = CLEAR_LINE;
@ -523,9 +516,6 @@ static MACHINE_CONFIG_START( pal, comx35_state )
MCFG_CDP1871_ADD(CDP1871_TAG, kbc_intf, CDP1869_CPU_CLK_PAL / 8) MCFG_CDP1871_ADD(CDP1871_TAG, kbc_intf, CDP1869_CPU_CLK_PAL / 8)
MCFG_QUICKLOAD_ADD("quickload", comx35_comx, "comx", 0) MCFG_QUICKLOAD_ADD("quickload", comx35_comx, "comx", 0)
MCFG_CASSETTE_ADD(CASSETTE_TAG, cassette_intf) MCFG_CASSETTE_ADD(CASSETTE_TAG, cassette_intf)
MCFG_PRINTER_ADD("printer")
MCFG_COMXPL80_ADD()
// expansion bus // expansion bus
MCFG_COMX_EXPANSION_SLOT_ADD(EXPANSION_TAG, expansion_intf, comx_expansion_cards, "eb", NULL) MCFG_COMX_EXPANSION_SLOT_ADD(EXPANSION_TAG, expansion_intf, comx_expansion_cards, "eb", NULL)
@ -533,6 +523,9 @@ static MACHINE_CONFIG_START( pal, comx35_state )
// internal ram // internal ram
MCFG_RAM_ADD(RAM_TAG) MCFG_RAM_ADD(RAM_TAG)
MCFG_RAM_DEFAULT_SIZE("32K") MCFG_RAM_DEFAULT_SIZE("32K")
// software lists
MCFG_SOFTWARE_LIST_ADD("flop_list", "comx35_flop")
MACHINE_CONFIG_END MACHINE_CONFIG_END
@ -554,9 +547,6 @@ static MACHINE_CONFIG_START( ntsc, comx35_state )
MCFG_CDP1871_ADD(CDP1871_TAG, kbc_intf, CDP1869_CPU_CLK_NTSC / 8) MCFG_CDP1871_ADD(CDP1871_TAG, kbc_intf, CDP1869_CPU_CLK_NTSC / 8)
MCFG_QUICKLOAD_ADD("quickload", comx35_comx, "comx", 0) MCFG_QUICKLOAD_ADD("quickload", comx35_comx, "comx", 0)
MCFG_CASSETTE_ADD(CASSETTE_TAG, cassette_intf) MCFG_CASSETTE_ADD(CASSETTE_TAG, cassette_intf)
MCFG_PRINTER_ADD("printer")
MCFG_COMXPL80_ADD()
// expansion bus // expansion bus
MCFG_COMX_EXPANSION_SLOT_ADD(EXPANSION_TAG, expansion_intf, comx_expansion_cards, "eb", NULL) MCFG_COMX_EXPANSION_SLOT_ADD(EXPANSION_TAG, expansion_intf, comx_expansion_cards, "eb", NULL)
@ -564,6 +554,9 @@ static MACHINE_CONFIG_START( ntsc, comx35_state )
// internal ram // internal ram
MCFG_RAM_ADD(RAM_TAG) MCFG_RAM_ADD(RAM_TAG)
MCFG_RAM_DEFAULT_SIZE("32K") MCFG_RAM_DEFAULT_SIZE("32K")
// software lists
MCFG_SOFTWARE_LIST_ADD("flop_list", "comx35_flop")
MACHINE_CONFIG_END MACHINE_CONFIG_END
@ -577,7 +570,7 @@ MACHINE_CONFIG_END
//------------------------------------------------- //-------------------------------------------------
ROM_START( comx35p ) ROM_START( comx35p )
ROM_REGION( 0x10000, CDP1802_TAG, 0 ) ROM_REGION( 0x4000, CDP1802_TAG, 0 )
ROM_DEFAULT_BIOS( "basic100" ) ROM_DEFAULT_BIOS( "basic100" )
ROM_SYSTEM_BIOS( 0, "basic100", "COMX BASIC V1.00" ) ROM_SYSTEM_BIOS( 0, "basic100", "COMX BASIC V1.00" )
ROMX_LOAD( "comx_10.u21", 0x0000, 0x4000, CRC(68d0db2d) SHA1(062328361629019ceed9375afac18e2b7849ce47), ROM_BIOS(1) ) ROMX_LOAD( "comx_10.u21", 0x0000, 0x4000, CRC(68d0db2d) SHA1(062328361629019ceed9375afac18e2b7849ce47), ROM_BIOS(1) )
@ -599,5 +592,5 @@ ROM_END
//************************************************************************** //**************************************************************************
// YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS // YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS
COMP( 1983, comx35p, 0, 0, pal, comx35, driver_device, 0, "Comx World Operations Ltd", "COMX 35 (PAL)", GAME_IMPERFECT_SOUND ) COMP( 1983, comx35p, 0, 0, pal, comx35, driver_device, 0, "Comx World Operations Ltd", "COMX 35 (PAL)", GAME_IMPERFECT_SOUND )
COMP( 1983, comx35n, comx35p,0, ntsc, comx35, driver_device, 0, "Comx World Operations Ltd", "COMX 35 (NTSC)", GAME_IMPERFECT_SOUND ) COMP( 1983, comx35n, comx35p,0, ntsc, comx35, driver_device, 0, "Comx World Operations Ltd", "COMX 35 (NTSC)", GAME_IMPERFECT_SOUND )

View File

@ -6,8 +6,6 @@
#include "emu.h" #include "emu.h"
#include "cpu/cosmac/cosmac.h" #include "cpu/cosmac/cosmac.h"
#include "sound/cdp1869.h"
#include "sound/wave.h"
#include "formats/comx35_comx.h" #include "formats/comx35_comx.h"
#include "imagedev/cassette.h" #include "imagedev/cassette.h"
#include "imagedev/printer.h" #include "imagedev/printer.h"
@ -25,14 +23,16 @@
#include "machine/comx_thm.h" #include "machine/comx_thm.h"
#include "machine/ram.h" #include "machine/ram.h"
#include "machine/rescap.h" #include "machine/rescap.h"
#include "sound/cdp1869.h"
#include "sound/wave.h"
#define SCREEN_TAG "screen" #define SCREEN_TAG "screen"
#define CDP1870_TAG "u1" #define CDP1870_TAG "u1"
#define CDP1869_TAG "u2" #define CDP1869_TAG "u2"
#define CDP1802_TAG "u3" #define CDP1802_TAG "u3"
#define CDP1871_TAG "u4" #define CDP1871_TAG "u4"
#define EXPANSION_TAG "slot" #define EXPANSION_TAG "exp"
#define COMX35_CHARRAM_SIZE 0x800 #define COMX35_CHARRAM_SIZE 0x800
#define COMX35_CHARRAM_MASK 0x7ff #define COMX35_CHARRAM_MASK 0x7ff
@ -42,13 +42,13 @@ class comx35_state : public driver_device
public: public:
comx35_state(const machine_config &mconfig, device_type type, const char *tag) comx35_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag), : driver_device(mconfig, type, tag),
m_maincpu(*this, CDP1802_TAG), m_maincpu(*this, CDP1802_TAG),
m_vis(*this, CDP1869_TAG), m_vis(*this, CDP1869_TAG),
m_kbe(*this, CDP1871_TAG), m_kbe(*this, CDP1871_TAG),
m_cassette(*this, CASSETTE_TAG), m_cassette(*this, CASSETTE_TAG),
m_ram(*this, RAM_TAG), m_ram(*this, RAM_TAG),
m_expansion(*this, EXPANSION_TAG), m_exp(*this, EXPANSION_TAG),
m_ef4(0) m_char_ram(*this, "char_ram")
{ } { }
required_device<cosmac_device> m_maincpu; required_device<cosmac_device> m_maincpu;
@ -56,7 +56,8 @@ public:
required_device<cdp1871_device> m_kbe; required_device<cdp1871_device> m_kbe;
required_device<cassette_image_device> m_cassette; required_device<cassette_image_device> m_cassette;
required_device<ram_device> m_ram; required_device<ram_device> m_ram;
required_device<comx_expansion_slot_device> m_expansion; required_device<comx_expansion_slot_device> m_exp;
optional_shared_ptr<UINT8> m_char_ram;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
virtual void machine_start(); virtual void machine_start();
@ -82,23 +83,20 @@ public:
DECLARE_WRITE_LINE_MEMBER( q_w ); DECLARE_WRITE_LINE_MEMBER( q_w );
DECLARE_READ_LINE_MEMBER( shift_r ); DECLARE_READ_LINE_MEMBER( shift_r );
DECLARE_READ_LINE_MEMBER( control_r ); DECLARE_READ_LINE_MEMBER( control_r );
DECLARE_WRITE_LINE_MEMBER( ef4_w );
DECLARE_WRITE_LINE_MEMBER( int_w ); DECLARE_WRITE_LINE_MEMBER( int_w );
DECLARE_WRITE_LINE_MEMBER( prd_w ); DECLARE_WRITE_LINE_MEMBER( prd_w );
DECLARE_INPUT_CHANGED_MEMBER( trigger_reset ); DECLARE_INPUT_CHANGED_MEMBER( trigger_reset );
// processor state // processor state
int m_clear; // CPU mode int m_clear; // CPU mode
int m_q; // Q flag int m_q; // Q flag
int m_ef4; // EF4 flag int m_iden; // interrupt/DMA enable
int m_iden; // interrupt/DMA enable int m_dma; // memory refresh DMA
int m_dma; // memory refresh DMA int m_int; // interrupt request
int m_int; // interrupt request int m_prd; // predisplay
int m_prd; // predisplay int m_cr1; // interrupt enable
int m_cr1; // interrupt enable
// video state const UINT8 *m_rom;
UINT8 *m_charram; // character memory
}; };
// ---------- defined in video/comx35.c ---------- // ---------- defined in video/comx35.c ----------

View File

@ -53,9 +53,9 @@ Notes:
// MACROS/CONSTANTS // MACROS/CONSTANTS
//************************************************************************** //**************************************************************************
#define MC6845_TAG "mc6845" #define MC6845_TAG "mc6845"
#define MC6845_SCREEN_TAG "screen80" #define MC6845_SCREEN_TAG "screen80"
#define VIDEORAM_SIZE 0x800 #define VIDEORAM_SIZE 0x800
@ -72,12 +72,15 @@ const device_type COMX_CLM = &device_creator<comx_clm_device>;
ROM_START( comx_clm ) ROM_START( comx_clm )
ROM_REGION( 0x2000, "c000", 0 ) ROM_REGION( 0x2000, "c000", 0 )
ROM_LOAD( "p 1.0.cl1", 0x0000, 0x0800, CRC(b417d30a) SHA1(d428b0467945ecb9aec884211d0f4b1d8d56d738) ) // V1.0 ROM_DEFAULT_BIOS( "v11" )
ROM_LOAD( "p 1.1.cl1", 0x0000, 0x0800, CRC(0a2eaf19) SHA1(3f1f640caef964fb47aaa147cab6d215c2b30e9d) ) // V1.1 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_REGION( 0x800, MC6845_TAG, 0 )
ROM_LOAD( "c 1.0.cl4", 0x0000, 0x0800, CRC(69dd7b07) SHA1(71d368adbb299103d165eab8359a97769e463e26) ) // V1.0 ROMX_LOAD( "c 1.0.cl4", 0x0000, 0x0800, CRC(69dd7b07) SHA1(71d368adbb299103d165eab8359a97769e463e26), ROM_BIOS(1) )
ROM_LOAD( "c 1.1.cl4", 0x0000, 0x0800, CRC(dc9b5046) SHA1(4e041cec03dda6dba5e2598d060c49908a4fab2a) ) // V1.1 ROMX_LOAD( "c 1.1.cl4", 0x0000, 0x0800, CRC(dc9b5046) SHA1(4e041cec03dda6dba5e2598d060c49908a4fab2a), ROM_BIOS(2) )
ROM_END 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) 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++) for (int column = 0; column < x_count; column++)
{ {
UINT8 code = m_video_ram[((ma + column) & 0x7ff)]; 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 x = (column * 8) + bit;
int color = BIT(data, 7) ? 7 : 0; int color = BIT(data, 7) ? 7 : 0;
bitmap.pix32(y, x) = palette[color]; bitmap.pix32(y, x) = RGB_MONOCHROME_WHITE[color];
data <<= 1; 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); 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 = static const mc6845_interface crtc_intf =
{ {
MC6845_SCREEN_TAG, MC6845_SCREEN_TAG,
@ -148,7 +138,7 @@ static const mc6845_interface crtc_intf =
NULL, NULL,
DEVCB_NULL, DEVCB_NULL,
DEVCB_NULL, DEVCB_NULL,
DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, comx_clm_device, hsync_w), DEVCB_NULL,
DEVCB_NULL, DEVCB_NULL,
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_t(mconfig, COMX_CLM, "COMX 80 Column Card", tag, owner, clock),
device_comx_expansion_card_interface(mconfig, *this), device_comx_expansion_card_interface(mconfig, *this),
m_crtc(*this, MC6845_TAG), 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() void comx_clm_device::device_start()
{ {
// find memory regions
m_rom = memregion("c000")->base(); m_rom = memregion("c000")->base();
m_char_rom = memregion(MC6845_TAG)->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 // state saving
save_item(NAME(m_ds)); 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 // 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; UINT8 data = 0xff;
if (offset >= 0xc000 && offset < 0xc800) 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 // 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) if (offset >= 0xd000 && offset < 0xd800)
{ {
m_video_ram[offset & 0x7ff] = data; m_video_ram[offset & 0x7ff] = data;

View File

@ -26,7 +26,7 @@
// ======================> comx_clm_device // ======================> comx_clm_device
class comx_clm_device : public device_t, class comx_clm_device : public device_t,
public device_comx_expansion_card_interface public device_comx_expansion_card_interface
{ {
public: public:
// construction/destruction // construction/destruction
@ -38,26 +38,24 @@ public:
// not really 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); 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: protected:
// device-level overrides // device-level overrides
virtual void device_start(); virtual void device_start();
virtual void device_reset(); 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 // device_comx_expansion_card_interface overrides
virtual void comx_ds_w(int state); virtual int comx_ef4_r();
virtual UINT8 comx_mrd_r(offs_t offset, int *extrom); virtual UINT8 comx_mrd_r(address_space &space, offs_t offset, int *extrom);
virtual void comx_mwr_w(offs_t offset, UINT8 data); virtual void comx_mwr_w(address_space &space, offs_t offset, UINT8 data);
private: private:
required_device<mc6845_device> m_crtc; 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_rom; // program ROM UINT8 *m_char_rom; // character ROM
UINT8 *m_char_rom; // character ROM
UINT8 *m_video_ram; // video RAM
}; };

View File

@ -55,10 +55,10 @@ Notes:
// MACROS/CONSTANTS // MACROS/CONSTANTS
//************************************************************************** //**************************************************************************
#define SLOT1_TAG "slot1" #define SLOT1_TAG "slot1"
#define SLOT2_TAG "slot2" #define SLOT2_TAG "slot2"
#define SLOT3_TAG "slot3" #define SLOT3_TAG "slot3"
#define SLOT4_TAG "slot4" #define SLOT4_TAG "slot4"
@ -76,7 +76,7 @@ const device_type COMX_EB = &device_creator<comx_eb_device>;
ROM_START( comx_eb ) ROM_START( comx_eb )
ROM_REGION( 0x1000, "e000", 0 ) ROM_REGION( 0x1000, "e000", 0 )
ROM_SYSTEM_BIOS( 0, "comx", "Original" ) 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" ) 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) ) 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" ) 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); 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 ) WRITE_LINE_DEVICE_HANDLER( wait_w )
{ {
comx_expansion_slot_device *slot = dynamic_cast<comx_expansion_slot_device *>(device->owner()->owner()); 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 ) static COMX_EXPANSION_INTERFACE( expansion_intf )
{ {
DEVCB_LINE(int_w), DEVCB_LINE(int_w),
DEVCB_LINE(ef4_w),
DEVCB_LINE(wait_w), DEVCB_LINE(wait_w),
DEVCB_LINE(clear_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 // LIVE DEVICE
@ -256,7 +221,6 @@ void comx_eb_device::device_start()
for (int slot = 0; slot < MAX_EB_SLOTS; slot++) for (int slot = 0; slot < MAX_EB_SLOTS; slot++)
{ {
m_int[slot] = CLEAR_LINE; m_int[slot] = CLEAR_LINE;
m_ef4[slot] = CLEAR_LINE;
} }
m_rom = memregion("e000")->base(); m_rom = memregion("e000")->base();
@ -269,6 +233,38 @@ void comx_eb_device::device_start()
void comx_eb_device::device_reset() 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 // 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; 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) 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 // 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++) for (int slot = 0; slot < MAX_EB_SLOTS; slot++)
{ {
if (BIT(m_select, slot) && m_expansion_slot[slot] != NULL) 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 // 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; 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) 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 // 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; 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) 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);
} }
} }
} }

View File

@ -29,7 +29,7 @@
// CONSTANTS // CONSTANTS
//************************************************************************** //**************************************************************************
#define MAX_EB_SLOTS 4 #define MAX_EB_SLOTS 4
@ -40,7 +40,7 @@
// ======================> comx_eb_device // ======================> comx_eb_device
class comx_eb_device : public device_t, class comx_eb_device : public device_t,
public device_comx_expansion_card_interface public device_comx_expansion_card_interface
{ {
public: public:
// construction/destruction // construction/destruction
@ -52,27 +52,26 @@ public:
// not really public // not really public
void set_int(const char *tag, int state); void set_int(const char *tag, int state);
void set_ef4(const char *tag, int state);
protected: protected:
// device-level overrides // device-level overrides
virtual void device_start(); virtual void device_start();
virtual void device_reset(); 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 // device_comx_expansion_card_interface overrides
virtual int comx_ef4_r();
virtual void comx_q_w(int state); virtual void comx_q_w(int state);
virtual UINT8 comx_mrd_r(offs_t offset, int *extrom); virtual UINT8 comx_mrd_r(address_space &space, offs_t offset, int *extrom);
virtual void comx_mwr_w(offs_t offset, UINT8 data); virtual void comx_mwr_w(address_space &space, offs_t offset, UINT8 data);
virtual UINT8 comx_io_r(offs_t offset); virtual UINT8 comx_io_r(address_space &space, offs_t offset);
virtual void comx_io_w(offs_t offset, UINT8 data); virtual void comx_io_w(address_space &space, offs_t offset, UINT8 data);
private: 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_int[MAX_EB_SLOTS];
int m_ef4[MAX_EB_SLOTS];
UINT8 m_select; UINT8 m_select;
}; };

View File

@ -92,7 +92,7 @@ void comx_epr_device::device_reset()
// comx_mrd_r - memory read // 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; 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 // 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) if (offset == 1)
{ {

View File

@ -41,8 +41,8 @@ protected:
virtual void device_config_complete() { m_shortname = "comx_epr"; } virtual void device_config_complete() { m_shortname = "comx_epr"; }
// device_comx_expansion_card_interface overrides // device_comx_expansion_card_interface overrides
virtual UINT8 comx_mrd_r(offs_t offset, int *extrom); virtual UINT8 comx_mrd_r(address_space &space, offs_t offset, int *extrom);
virtual void comx_io_w(offs_t offset, UINT8 data); virtual void comx_io_w(address_space &space, offs_t offset, UINT8 data);
private: private:
UINT8 m_select; UINT8 m_select;

View File

@ -50,7 +50,7 @@ Notes:
// MACROS/CONSTANTS // 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_START( comx_fd )
ROM_REGION( 0x2000, "c000", 0 ) 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 ROM_END
@ -85,47 +85,35 @@ const rom_entry *comx_fd_device::device_rom_region() const
// wd17xx_interface fdc_intf // wd17xx_interface fdc_intf
//------------------------------------------------- //-------------------------------------------------
static const floppy_interface floppy_intf = FLOPPY_FORMATS_MEMBER( comx_fd_device::floppy_formats )
{ FLOPPY_COMX35_FORMAT
DEVCB_NULL, FLOPPY_FORMATS_END
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 ) 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; m_intrq = state;
} }
WRITE_LINE_MEMBER( comx_fd_device::drq_w ) void comx_fd_device::drq_w(bool state)
{ {
m_drq = 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 ) // MACHINE_CONFIG_FRAGMENT( comx_fd )
//------------------------------------------------- //-------------------------------------------------
static MACHINE_CONFIG_FRAGMENT( comx_fd ) static MACHINE_CONFIG_FRAGMENT( comx_fd )
MCFG_WD1770_ADD(WD1770_TAG, fdc_intf) MCFG_WD1770x_ADD(WD1770_TAG, XTAL_8MHz)
MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(floppy_intf)
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 MACHINE_CONFIG_END
@ -141,28 +129,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 // 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_t(mconfig, COMX_FD, "COMX FD", tag, owner, clock),
device_comx_expansion_card_interface(mconfig, *this), device_comx_expansion_card_interface(mconfig, *this),
m_fdc(*this, WD1770_TAG), m_fdc(*this, WD1770_TAG),
m_floppy0(*this, FLOPPY_0), m_floppy0(*this, WD1770_TAG":0"),
m_floppy1(*this, FLOPPY_1), m_floppy1(*this, WD1770_TAG":1"),
m_ds(0), m_ds(0),
m_q(0), m_q(0),
m_addr(0), m_addr(0),
m_intrq(0), m_intrq(false),
m_drq(0), m_drq(false),
m_disb(1) 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() void comx_fd_device::device_start()
{ {
// find memory regions
m_rom = memregion("c000")->base(); 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 // state saving
save_item(NAME(m_ds)); save_item(NAME(m_ds));
save_item(NAME(m_q)); save_item(NAME(m_q));
@ -211,7 +183,24 @@ void comx_fd_device::device_start()
void comx_fd_device::device_reset() void comx_fd_device::device_reset()
{ {
wd17xx_reset(m_fdc); m_fdc->reset();
}
//-------------------------------------------------
// comx_ef4_r - external flag 4 read
//-------------------------------------------------
int comx_fd_device::comx_ef4_r()
{
int state = CLEAR_LINE;
if (m_ds && !m_disb)
{
state = m_drq ? ASSERT_LINE : CLEAR_LINE;
}
return state;
} }
@ -225,23 +214,11 @@ void comx_fd_device::comx_q_w(int state)
} }
//-------------------------------------------------
// comx_ds_w - device select write
//-------------------------------------------------
void comx_fd_device::comx_ds_w(int state)
{
m_ds = state;
update_ef4();
}
//------------------------------------------------- //-------------------------------------------------
// comx_mrd_r - memory read // 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; 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 // 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; UINT8 data = 0xff;
@ -271,11 +248,11 @@ UINT8 comx_fd_device::comx_io_r(offs_t offset)
{ {
if (m_q) if (m_q)
{ {
data = m_intrq; data = m_intrq ? 1 : 0;
} }
else 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 // 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) 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 0 FDC A0
1 A1 1 FDC A1
2 DRIVE0 2 DRIVE0
3 DRIVE1 3 DRIVE1
4 F9 DISB 4 F9 DISB
5 SIDE SELECT 5 SIDE SELECT
*/ */
// latch data to F3 // latch data to F3
m_addr = data & 0x03; m_addr = data & 0x03;
if (BIT(data, 2)) // drive select
{ floppy_image_device *floppy = NULL;
wd17xx_set_drive(m_fdc, 0);
} if (BIT(data, 2)) floppy = m_floppy0->get_device();
else if (BIT(data, 3)) if (BIT(data, 3)) floppy = m_floppy1->get_device();
{
wd17xx_set_drive(m_fdc, 1); m_fdc->set_floppy(floppy);
}
if (floppy) floppy->ss_w(BIT(data, 5));
m_disb = !BIT(data, 4); m_disb = !BIT(data, 4);
update_ef4();
wd17xx_set_side(m_fdc, BIT(data, 5));
} }
else else
{ {
// write data to WD1770 // write data to WD1770
wd17xx_w(m_fdc, machine().driver_data()->generic_space(), m_addr, data); m_fdc->gen_w(m_addr, data);
} }
} }
} }

View File

@ -14,11 +14,9 @@
#include "emu.h" #include "emu.h"
#include "formats/basicdsk.h"
#include "formats/comx35_dsk.h" #include "formats/comx35_dsk.h"
#include "imagedev/flopdrv.h"
#include "machine/comxexp.h" #include "machine/comxexp.h"
#include "machine/wd17xx.h" #include "machine/wd_fdc.h"
@ -29,7 +27,7 @@
// ======================> comx_fd_device // ======================> comx_fd_device
class comx_fd_device : public device_t, class comx_fd_device : public device_t,
public device_comx_expansion_card_interface public device_comx_expansion_card_interface
{ {
public: public:
// construction/destruction // construction/destruction
@ -40,38 +38,40 @@ public:
virtual machine_config_constructor device_mconfig_additions() const; virtual machine_config_constructor device_mconfig_additions() const;
// not really public // not really public
DECLARE_WRITE_LINE_MEMBER( intrq_w ); void intrq_w(bool state);
DECLARE_WRITE_LINE_MEMBER( drq_w ); void drq_w(bool state);
DECLARE_FLOPPY_FORMATS( floppy_formats );
protected: protected:
// device-level overrides // device-level overrides
virtual void device_start(); virtual void device_start();
virtual void device_reset(); 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 // 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 void comx_q_w(int state);
virtual UINT8 comx_mrd_r(offs_t offset, int *extrom); virtual UINT8 comx_mrd_r(address_space &space, offs_t offset, int *extrom);
virtual UINT8 comx_io_r(offs_t offset); virtual UINT8 comx_io_r(address_space &space, offs_t offset);
virtual void comx_io_w(offs_t offset, UINT8 data); virtual void comx_io_w(address_space &space, offs_t offset, UINT8 data);
private: private:
inline void update_ef4(); inline void update_ef4();
// internal state // internal state
required_device<wd1770_device> m_fdc; required_device<wd1770_t> m_fdc;
required_device<legacy_floppy_image_device> m_floppy0; required_device<floppy_connector> m_floppy0;
required_device<legacy_floppy_image_device> m_floppy1; required_device<floppy_connector> m_floppy1;
// floppy state // floppy state
int m_ds; // device select int m_ds; // device select
UINT8 *m_rom; UINT8 *m_rom;
int m_q; // FDC register select int m_q; // FDC register select
int m_addr; // FDC address int m_addr; // FDC address
int m_intrq; // interrupt request bool m_intrq; // interrupt request
int m_drq; // data request bool m_drq; // data request
int m_disb; // data request disable int m_disb; // data request disable
}; };

View File

@ -96,7 +96,7 @@ void comx_joy_device::device_reset()
// comx_mrd_r - I/O read // 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; UINT8 data = 0;

View File

@ -41,7 +41,7 @@ protected:
virtual void device_config_complete() { m_shortname = "comx_joy"; } virtual void device_config_complete() { m_shortname = "comx_joy"; }
// device_comx_expansion_card_interface overrides // 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);
}; };

View File

@ -15,6 +15,8 @@
// MACROS/CONSTANTS // 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_START( comx_prn )
ROM_REGION( 0x2000, "c000", 0 ) ROM_REGION( 0x2000, "c000", 0 )
ROM_LOAD( "printer.bin", 0x0000, 0x0800, CRC(3bbc2b2e) SHA1(08bf7ea4174713ab24969c553affd5c1401876b8) ) ROM_SYSTEM_BIOS( 0, "comx", "COMX" )
ROMX_LOAD( "printer.bin", 0x0000, 0x0800, CRC(3bbc2b2e) SHA1(08bf7ea4174713ab24969c553affd5c1401876b8), ROM_BIOS(1) )
ROM_REGION( 0x2000, "printer_fm", 0 ) ROM_SYSTEM_BIOS( 1, "fm12", "F&M v1.2" )
ROM_LOAD( "f&m.printer.1.2.bin", 0x0000, 0x1000, CRC(2feb997d) SHA1(ee9cb91042696c88ff5f2f44d2f702dc93369ba0) ) 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_REGION( 0x2000, "rs232", 0 )
ROM_LOAD( "rs232.bin", 0x0000, 0x0800, CRC(926ff2d1) SHA1(be02bd388bba0211ea72d4868264a63308e4318d) )
ROM_END 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 // 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) : 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_t(mconfig, COMX_PRN, "COMX-35 Printer Card", tag, owner, clock),
device_comx_expansion_card_interface(mconfig, *this) 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 // 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; 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; return data;
@ -105,23 +137,45 @@ UINT8 comx_prn_device::comx_mrd_r(offs_t offset, int *extrom)
// comx_io_r - I/O read // 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: INP 2 for the printer status, where:
b0=1: Acknowledge Fault b0=1: Acknowledge Fault
b1=0: Device Busy b1=0: Device Busy
b2=0: Paper Empty b2=0: Paper Empty
b3=1: Device Not Selected 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.
*/ */
return 0; /*
bit description
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 // 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);
} }

View File

@ -15,6 +15,8 @@
#include "emu.h" #include "emu.h"
#include "machine/comxexp.h" #include "machine/comxexp.h"
#include "machine/comxpl80.h"
#include "machine/ctronics.h"
@ -25,7 +27,7 @@
// ======================> comx_prn_device // ======================> comx_prn_device
class comx_prn_device : public device_t, class comx_prn_device : public device_t,
public device_comx_expansion_card_interface public device_comx_expansion_card_interface
{ {
public: public:
// construction/destruction // construction/destruction
@ -33,20 +35,23 @@ public:
// optional information overrides // optional information overrides
virtual const rom_entry *device_rom_region() const; virtual const rom_entry *device_rom_region() const;
virtual machine_config_constructor device_mconfig_additions() const;
protected: protected:
// device-level overrides // device-level overrides
virtual void device_start(); virtual void device_start();
virtual void device_reset(); 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 // device_comx_expansion_card_interface overrides
virtual UINT8 comx_mrd_r(offs_t offset, int *extrom); virtual UINT8 comx_mrd_r(address_space &space, offs_t offset, int *extrom);
virtual UINT8 comx_io_r(offs_t offset); virtual UINT8 comx_io_r(address_space &space, offs_t offset);
virtual void comx_io_w(offs_t offset, UINT8 data); virtual void comx_io_w(address_space &space, offs_t offset, UINT8 data);
private: private:
UINT8 *m_rom; // program ROM required_device<centronics_device> m_centronics;
UINT8 *m_rom; // program ROM
}; };

View File

@ -15,7 +15,7 @@
// MACROS/CONSTANTS // 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 // 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; UINT8 data = 0;
@ -84,7 +84,7 @@ UINT8 comx_ram_device::comx_mrd_r(offs_t offset, int *extrom)
// comx_mwr_w - memory write // 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) 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 // 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) if (offset == 1)
{ {

View File

@ -25,7 +25,7 @@
// ======================> comx_ram_device // ======================> comx_ram_device
class comx_ram_device : public device_t, class comx_ram_device : public device_t,
public device_comx_expansion_card_interface public device_comx_expansion_card_interface
{ {
public: public:
// construction/destruction // construction/destruction
@ -38,9 +38,9 @@ protected:
virtual void device_config_complete() { m_shortname = "comx_ram"; } virtual void device_config_complete() { m_shortname = "comx_ram"; }
// device_comx_expansion_card_interface overrides // device_comx_expansion_card_interface overrides
virtual UINT8 comx_mrd_r(offs_t offset, int *extrom); virtual UINT8 comx_mrd_r(address_space &space, offs_t offset, int *extrom);
virtual void comx_mwr_w(offs_t offset, UINT8 data); virtual void comx_mwr_w(address_space &space, offs_t offset, UINT8 data);
virtual void comx_io_w(offs_t offset, UINT8 data); virtual void comx_io_w(address_space &space, offs_t offset, UINT8 data);
private: private:
UINT8 *m_ram; UINT8 *m_ram;

View File

@ -82,7 +82,7 @@ void comx_thm_device::device_reset()
// comx_mrd_r - memory read // 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; 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 // 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: INP 2 is used for the printer status, where:
b0=1: Printer Not Ready b0=1: Printer Not Ready
b1=1: Energizing Head b1=1: Energizing Head
b2=1: Head At Position 0 b2=1: Head At Position 0
*/ */
return 0; return 0;
} }
@ -116,13 +116,13 @@ UINT8 comx_thm_device::comx_io_r(offs_t offset)
// comx_io_w - I/O write // 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: OUT 2 is used to control the thermal printer where:
Q = 0, b0-7: Pixel 1 to 8 Q = 0, b0-7: Pixel 1 to 8
Q = 1, b7: Pixel 9 (if b0-6=#21) Q = 1, b7: Pixel 9 (if b0-6=#21)
Q = 1, b3=1: Move head right Q = 1, b3=1: Move head right
Q = 1, b0-7=#12: Move head left Q = 1, b0-7=#12: Move head left
*/ */
} }

View File

@ -25,7 +25,7 @@
// ======================> comx_thm_device // ======================> comx_thm_device
class comx_thm_device : public device_t, class comx_thm_device : public device_t,
public device_comx_expansion_card_interface public device_comx_expansion_card_interface
{ {
public: public:
// construction/destruction // construction/destruction
@ -38,15 +38,15 @@ protected:
// device-level overrides // device-level overrides
virtual void device_start(); virtual void device_start();
virtual void device_reset(); 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 // device_comx_expansion_card_interface overrides
virtual UINT8 comx_mrd_r(offs_t offset, int *extrom); virtual UINT8 comx_mrd_r(address_space &space, offs_t offset, int *extrom);
virtual UINT8 comx_io_r(offs_t offset); virtual UINT8 comx_io_r(address_space &space, offs_t offset);
virtual void comx_io_w(offs_t offset, UINT8 data); virtual void comx_io_w(address_space &space, offs_t offset, UINT8 data);
private: private:
UINT8 *m_rom; // program ROM UINT8 *m_rom; // program ROM
}; };

View File

@ -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_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()); 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) : 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) device_slot_interface(mconfig, *this)
{ {
} }
@ -86,10 +87,9 @@ void comx_expansion_slot_device::device_config_complete()
// or initialize to defaults if none provided // or initialize to defaults if none provided
else else
{ {
memset(&m_out_int_cb, 0, sizeof(m_out_int_cb)); 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_wait_cb, 0, sizeof(m_out_wait_cb)); memset(&m_out_clear_cb, 0, sizeof(m_out_clear_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 // resolve callbacks
m_out_int_func.resolve(m_out_int_cb, *this); 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_wait_func.resolve(m_out_wait_cb, *this);
m_out_clear_func.resolve(m_out_clear_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 // 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; UINT8 data = 0;
if (m_card != NULL) if (m_card != NULL)
{ {
data = m_card->comx_mrd_r(offset, extrom); data = m_card->comx_mrd_r(space, offset, extrom);
} }
return data; return data;
@ -140,11 +139,11 @@ UINT8 comx_expansion_slot_device::mrd_r(offs_t offset, int *extrom)
// mwr_w - memory write // 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) 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 // 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; UINT8 data = 0;
if (m_card != NULL) if (m_card != NULL)
{ {
data = m_card->comx_io_r(offset); data = m_card->comx_io_r(space, offset);
} }
return data; return data;
@ -170,11 +169,11 @@ UINT8 comx_expansion_slot_device::io_r(offs_t offset)
// sout_w - I/O write // 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) 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::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::wait_w ) { m_out_wait_func(state); }
WRITE_LINE_MEMBER( comx_expansion_slot_device::clear_w ) { m_out_clear_func(state); } WRITE_LINE_MEMBER( comx_expansion_slot_device::clear_w ) { m_out_clear_func(state); }

View File

@ -45,7 +45,7 @@
// CONSTANTS // 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) \ #define MCFG_COMX_EXPANSION_SLOT_ADD(_tag, _config, _slot_intf, _def_slot, _def_inp) \
MCFG_DEVICE_ADD(_tag, COMX_EXPANSION_SLOT, 0) \ MCFG_DEVICE_ADD(_tag, COMX_EXPANSION_SLOT, 0) \
MCFG_DEVICE_CONFIG(_config) \ MCFG_DEVICE_CONFIG(_config) \
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, false) MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, false)
@ -72,10 +72,9 @@
struct comx_expansion_slot_interface struct comx_expansion_slot_interface
{ {
devcb_write_line m_out_int_cb; 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_wait_cb; devcb_write_line m_out_clear_cb;
devcb_write_line m_out_clear_cb;
}; };
@ -84,25 +83,26 @@ struct comx_expansion_slot_interface
class device_comx_expansion_card_interface; class device_comx_expansion_card_interface;
class comx_expansion_slot_device : public device_t, class comx_expansion_slot_device : public device_t,
public comx_expansion_slot_interface, public comx_expansion_slot_interface,
public device_slot_interface public device_slot_interface
{ {
public: public:
// construction/destruction // construction/destruction
comx_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); comx_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual ~comx_expansion_slot_device(); virtual ~comx_expansion_slot_device();
UINT8 mrd_r(offs_t offset, int *extrom); UINT8 mrd_r(address_space &space, offs_t offset, int *extrom);
void mwr_w(offs_t offset, UINT8 data); void mwr_w(address_space &space, offs_t offset, UINT8 data);
UINT8 io_r(offs_t offset); UINT8 io_r(address_space &space, offs_t offset);
void io_w(offs_t offset, UINT8 data); 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( ds_w );
DECLARE_WRITE_LINE_MEMBER( q_w ); DECLARE_WRITE_LINE_MEMBER( q_w );
DECLARE_WRITE_LINE_MEMBER( int_w ); DECLARE_WRITE_LINE_MEMBER( int_w );
DECLARE_WRITE_LINE_MEMBER( ef4_w );
DECLARE_WRITE_LINE_MEMBER( wait_w ); DECLARE_WRITE_LINE_MEMBER( wait_w );
DECLARE_WRITE_LINE_MEMBER( clear_w ); DECLARE_WRITE_LINE_MEMBER( clear_w );
@ -114,10 +114,9 @@ protected:
virtual void device_reset(); virtual void device_reset();
virtual void device_config_complete(); virtual void device_config_complete();
devcb_resolved_write_line m_out_int_func; 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_wait_func; devcb_resolved_write_line m_out_clear_func;
devcb_resolved_write_line m_out_clear_func;
device_comx_expansion_card_interface *m_card; device_comx_expansion_card_interface *m_card;
}; };
@ -137,18 +136,21 @@ public:
protected: protected:
// signals // 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) { }; virtual void comx_q_w(int state) { };
// memory access // memory access
virtual UINT8 comx_mrd_r(offs_t offset, int *extrom) { return 0; }; virtual UINT8 comx_mrd_r(address_space &space, offs_t offset, int *extrom) { return 0; };
virtual void comx_mwr_w(offs_t offset, UINT8 data) { }; virtual void comx_mwr_w(address_space &space, offs_t offset, UINT8 data) { };
// I/O access // I/O access
virtual UINT8 comx_io_r(offs_t offset) { return 0; }; virtual UINT8 comx_io_r(address_space &space, offs_t offset) { return 0; };
virtual void comx_io_w(offs_t offset, UINT8 data) { }; virtual void comx_io_w(address_space &space, offs_t offset, UINT8 data) { };
comx_expansion_slot_device *m_slot; comx_expansion_slot_device *m_slot;
int m_ds;
}; };

View File

@ -31,28 +31,7 @@
// DEVICE DEFINITIONS // DEVICE DEFINITIONS
//************************************************************************** //**************************************************************************
const device_type COMXPL80 = &device_creator<comxpl80_device>; const device_type COMX_PL80 = &device_creator<comx_pl80_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";
}
//------------------------------------------------- //-------------------------------------------------
@ -73,7 +52,7 @@ ROM_END
// rom_region - device-specific ROM region // 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 ); return ROM_NAME( comxpl80 );
} }
@ -83,7 +62,7 @@ const rom_entry *comxpl80_device::device_rom_region() const
// ADDRESS_MAP( comxpl80_mem ) // 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(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(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) 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 ) // 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 ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(0x00, 0x00) AM_WRITE(pa_w) AM_RANGE(0x00, 0x00) AM_WRITE(pa_w)
AM_RANGE(0x01, 0x01) AM_WRITE(pb_w) AM_RANGE(0x01, 0x01) AM_WRITE(pb_w)
@ -132,7 +111,7 @@ MACHINE_CONFIG_END
// machine configurations // 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 ); return MACHINE_CONFIG_NAME( comxpl80 );
} }
@ -165,7 +144,7 @@ INPUT_PORTS_END
// input_ports - device-specific input ports // 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 ); 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) comx_pl80_device::comx_pl80_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, COMXPL80, "COMX PL-80", tag, owner, 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 // device_start - device-specific startup
//------------------------------------------------- //-------------------------------------------------
void comxpl80_device::device_start() void comx_pl80_device::device_start()
{ {
// state saving // state saving
save_item(NAME(m_centronics_data));
save_item(NAME(m_font_addr)); save_item(NAME(m_font_addr));
save_item(NAME(m_x_motor_phase)); save_item(NAME(m_x_motor_phase));
save_item(NAME(m_y_motor_phase)); save_item(NAME(m_y_motor_phase));
@ -208,7 +187,7 @@ void comxpl80_device::device_start()
// device_reset - device-specific reset // 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 - // 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)) if (!BIT(data, 6))
{ {
// read data from Centronics bus // read data from Centronics bus
m_plotter_data = m_centronics_data; m_plotter_data = m_data;
} }
if (BIT(data, 7)) if (BIT(data, 7))
@ -269,7 +248,7 @@ WRITE8_MEMBER( comxpl80_device::pa_w )
// pb_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 - // 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 - // pd_r -
//------------------------------------------------- //-------------------------------------------------
READ8_MEMBER( comxpl80_device::pd_r ) READ8_MEMBER( comx_pl80_device::pd_r )
{ {
/* /*

View File

@ -9,32 +9,12 @@
#pragma once #pragma once
#ifndef __COMXPL80__ #ifndef __COMX_PL80__
#define __COMXPL80__ #define __COMX_PL80__
#include "emu.h" #include "emu.h"
#include "cpu/m6805/m6805.h" #include "cpu/m6805/m6805.h"
#include "machine/ctronics.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) =
@ -42,28 +22,21 @@
// TYPE DEFINITIONS // TYPE DEFINITIONS
//************************************************************************** //**************************************************************************
// ======================> comxpl80_interface // ======================> comx_pl80_device
struct comxpl80_interface class comx_pl80_device : public device_t,
{ public device_centronics_peripheral_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
{ {
public: public:
// construction/destruction // 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 // optional information overrides
virtual const rom_entry *device_rom_region() const; virtual const rom_entry *device_rom_region() const;
virtual machine_config_constructor device_mconfig_additions() const; virtual machine_config_constructor device_mconfig_additions() const;
virtual ioport_constructor device_input_ports() const; virtual ioport_constructor device_input_ports() const;
// not really public
DECLARE_WRITE8_MEMBER( pa_w ); DECLARE_WRITE8_MEMBER( pa_w );
DECLARE_WRITE8_MEMBER( pb_w ); DECLARE_WRITE8_MEMBER( pb_w );
DECLARE_WRITE8_MEMBER( pc_w ); DECLARE_WRITE8_MEMBER( pc_w );
@ -71,14 +44,11 @@ public:
protected: protected:
// device-level overrides // device-level overrides
virtual void device_config_complete() { m_shortname = "comx_pl80"; }
virtual void device_start(); virtual void device_start();
virtual void device_reset(); virtual void device_reset();
virtual void device_config_complete();
private: private:
// printer state
UINT8 m_centronics_data; // centronics data
// PL-80 plotter state // PL-80 plotter state
UINT16 m_font_addr; // font ROM pack address latch UINT16 m_font_addr; // font ROM pack address latch
UINT8 m_x_motor_phase; // X motor phase UINT8 m_x_motor_phase; // X motor phase
@ -91,7 +61,7 @@ private:
// device type definition // device type definition
extern const device_type COMXPL80; extern const device_type COMX_PL80;

View File

@ -47,7 +47,7 @@ static CDP1869_CHAR_RAM_READ( comx35_charram_r )
UINT8 column = pmd & 0x7f; UINT8 column = pmd & 0x7f;
UINT16 charaddr = (column << 4) | cma; UINT16 charaddr = (column << 4) | cma;
return state->m_charram[charaddr]; return state->m_char_ram[charaddr];
} }
static CDP1869_CHAR_RAM_WRITE( comx35_charram_w ) static CDP1869_CHAR_RAM_WRITE( comx35_charram_w )
@ -57,7 +57,7 @@ static CDP1869_CHAR_RAM_WRITE( comx35_charram_w )
UINT8 column = pmd & 0x7f; UINT8 column = pmd & 0x7f;
UINT16 charaddr = (column << 4) | cma; UINT16 charaddr = (column << 4) | cma;
state->m_charram[charaddr] = data; state->m_char_ram[charaddr] = data;
} }
static CDP1869_PCB_READ( comx35_pcb_r ) static CDP1869_PCB_READ( comx35_pcb_r )
@ -103,10 +103,7 @@ static CDP1869_INTERFACE( ntsc_cdp1869_intf )
void comx35_state::video_start() void comx35_state::video_start()
{ {
// allocate memory // allocate memory
m_charram = auto_alloc_array(machine(), UINT8, COMX35_CHARRAM_SIZE); m_char_ram.allocate(COMX35_CHARRAM_SIZE);
// register for save state
save_pointer(NAME(m_charram), COMX35_CHARRAM_SIZE);
} }
/* Machine Drivers */ /* Machine Drivers */