missed files (nw)

This commit is contained in:
R. Belmont 2014-01-02 05:41:38 +00:00
parent 2870d782ad
commit 8398f4f89f
4 changed files with 70 additions and 80 deletions

View File

@ -39,7 +39,6 @@
#include "emu.h"
#include "cuda.h"
#include "cpu/m6805/m6805.h"
#include "machine/6522via.h"
#include "sound/asc.h"
#include "includes/mac.h"
@ -130,10 +129,11 @@ void cuda_device::send_port(address_space &space, UINT8 offset, UINT8 data)
printf("CU ADB: 0->1 time %lld\n", machine().time().as_ticks(1000000) - last_adb_time);
}*/
// allow the linechange handler to override us
adb_in = (data & 0x80) ? true : false;
m_adb_dtime = (int)(machine().time().as_ticks(1000000) - last_adb_time);
m_out_adb_func(((data & 0x80) >> 7) ^ 1);
write_linechange(((data & 0x80) >> 7) ^ 1);
last_adb = data & 0x80;
last_adb_time = machine().time().as_ticks(1000000);
@ -155,8 +155,7 @@ void cuda_device::send_port(address_space &space, UINT8 offset, UINT8 data)
printf("CU-> VIA_DATA: %d (PC=%x)\n", (data>>5)&1, m_maincpu->pc());
#endif
via_data = (data>>5) & 1;
via6522_device *via1 = machine().device<via6522_device>("via6522_0");
via1->write_cb2(via_data);
write_via_data(via_data);
}
if (via_clock != ((data>>4)&1))
{
@ -164,8 +163,7 @@ void cuda_device::send_port(address_space &space, UINT8 offset, UINT8 data)
printf("CU-> VIA_CLOCK: %d (PC=%x)\n", ((data>>4)&1)^1, m_maincpu->pc());
#endif
via_clock = (data>>4) & 1;
via6522_device *via1 = machine().device<via6522_device>("via6522_0");
via1->write_cb1(via_clock);
write_via_clock(via_clock);
}
}
break;
@ -180,8 +178,8 @@ void cuda_device::send_port(address_space &space, UINT8 offset, UINT8 data)
// falling edge, should reset the machine too
if ((ports[2] & 8) && !(data&8))
{
m_out_reset_func(ASSERT_LINE);
m_out_reset_func(CLEAR_LINE);
write_reset(ASSERT_LINE);
write_reset(CLEAR_LINE);
// if PRAM's waiting to be loaded, transfer it now
if (!pram_loaded)
@ -385,6 +383,10 @@ WRITE8_MEMBER( cuda_device::pram_w )
cuda_device::cuda_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, CUDA, "Apple Cuda", tag, owner, clock, "cuda", __FILE__),
device_nvram_interface(mconfig, *this),
write_reset(*this),
write_linechange(*this),
write_via_clock(*this),
write_via_data(*this),
m_maincpu(*this, CUDA_CPU_TAG)
{
}
@ -406,8 +408,10 @@ void cuda_device::static_set_type(device_t &device, int type)
void cuda_device::device_start()
{
m_out_reset_func.resolve(m_out_reset_cb, *this);
m_out_adb_func.resolve(m_out_adb_cb, *this);
write_reset.resolve_safe();
write_linechange.resolve_safe();
write_via_clock.resolve_safe();
write_via_data.resolve_safe();
m_timer = timer_alloc(0, NULL);
m_prog_timer = timer_alloc(1, NULL);
@ -507,21 +511,6 @@ void cuda_device::device_timer(emu_timer &timer, device_timer_id id, int param,
}
}
void cuda_device::device_config_complete()
{
// inherit a copy of the static data
const cuda_interface *intf = reinterpret_cast<const cuda_interface *>(static_config());
if (intf != NULL)
{
*static_cast<cuda_interface *>(this) = *intf;
}
// or initialize to defaults if none provided
else
{
memset(&m_out_reset_cb, 0, sizeof(m_out_reset_cb));
}
}
// the 6805 program clears PRAM on startup (on h/w it's always running once a battery is inserted)
// we deal with that by loading pram from disk to a secondary buffer and then slapping it into "live"
// once the cuda reboots the 68k

View File

@ -19,14 +19,12 @@
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_CUDA_ADD(_type, _config) \
#define MCFG_CUDA_ADD(_type) \
MCFG_DEVICE_ADD(CUDA_TAG, CUDA, 0) \
MCFG_DEVICE_CONFIG(_config) \
MCFG_CUDA_TYPE(_type)
#define MCFG_CUDA_REPLACE(_type, _config) \
#define MCFG_CUDA_REPLACE(_type) \
MCFG_DEVICE_REPLACE(CUDA_TAG, CUDA, 0) \
MCFG_DEVICE_CONFIG(_config) \
MCFG_CUDA_TYPE(_type)
#define MCFG_CUDA_REMOVE() \
@ -38,19 +36,25 @@
#define MCFG_CUDA_REMOVE() \
MCFG_DEVICE_REMOVE(CUDA_TAG)
#define MCFG_CUDA_RESET_CALLBACK(_cb) \
downcast<cuda_device *>(device)->set_reset_cb(DEVCB2_##_cb);
#define MCFG_CUDA_LINECHANGE_CALLBACK(_cb) \
downcast<cuda_device *>(device)->set_linechange_cb(DEVCB2_##_cb);
#define MCFG_CUDA_VIA_CLOCK_CALLBACK(_cb) \
downcast<cuda_device *>(device)->set_via_clock_cb(DEVCB2_##_cb);
#define MCFG_CUDA_VIA_DATA_CALLBACK(_cb) \
downcast<cuda_device *>(device)->set_via_data_cb(DEVCB2_##_cb);
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
struct cuda_interface
{
devcb_write_line m_out_reset_cb;
devcb_write_line m_out_adb_cb;
};
// ======================> cuda_device
class cuda_device : public device_t, public device_nvram_interface, public cuda_interface
class cuda_device : public device_t, public device_nvram_interface
{
public:
// construction/destruction
@ -91,11 +95,17 @@ public:
int rom_offset;
template<class _write> void set_reset_cb(_write wr) { write_reset.set_callback(wr); }
template<class _write> void set_linechange_cb(_write wr) { write_linechange.set_callback(wr); }
template<class _write> void set_via_clock_cb(_write wr) { write_via_clock.set_callback(wr); }
template<class _write> void set_via_data_cb(_write wr) { write_via_data.set_callback(wr); }
devcb2_write_line write_reset, write_linechange, write_via_clock, write_via_data;
protected:
// device-level overrides
virtual void device_start();
virtual void device_reset();
virtual void device_config_complete();
virtual machine_config_constructor device_mconfig_additions() const;
virtual const rom_entry *device_rom_region() const;
@ -121,9 +131,6 @@ private:
bool pram_loaded;
void send_port(address_space &space, UINT8 offset, UINT8 data);
devcb_resolved_write_line m_out_reset_func;
devcb_resolved_write_line m_out_adb_func;
};
// device type definition

View File

@ -38,7 +38,6 @@
#include "emu.h"
#include "egret.h"
#include "cpu/m6805/m6805.h"
#include "machine/6522via.h"
#include "sound/asc.h"
#include "includes/mac.h"
@ -131,7 +130,7 @@ void egret_device::send_port(address_space &space, UINT8 offset, UINT8 data)
adb_in = (data & 0x80) ? true : false;
m_adb_dtime = (int)(machine().time().as_ticks(1000000) - last_adb_time);
m_out_adb_func(((data & 0x80) >> 7) ^ 1);
write_linechange(((data & 0x80) >> 7) ^ 1);
last_adb = data & 0x80;
last_adb_time = machine().time().as_ticks(1000000);
@ -153,8 +152,7 @@ void egret_device::send_port(address_space &space, UINT8 offset, UINT8 data)
printf("EG-> VIA_DATA: %d (PC=%x)\n", (data>>5)&1, m_maincpu->pc());
#endif
via_data = (data>>5) & 1;
via6522_device *via1 = machine().device<via6522_device>("via6522_0");
via1->write_cb2(via_data);
write_via_data(via_data);
}
if (via_clock != ((data>>4)&1))
{
@ -162,8 +160,7 @@ void egret_device::send_port(address_space &space, UINT8 offset, UINT8 data)
printf("EG-> VIA_CLOCK: %d (PC=%x)\n", ((data>>4)&1)^1, m_maincpu->pc());
#endif
via_clock = (data>>4) & 1;
via6522_device *via1 = machine().device<via6522_device>("via6522_0");
via1->write_cb1(via_clock^1);
write_via_clock(via_clock^1);
}
}
break;
@ -187,7 +184,7 @@ void egret_device::send_port(address_space &space, UINT8 offset, UINT8 data)
}
}
m_out_reset_func((reset_line & 8) ? ASSERT_LINE : CLEAR_LINE);
write_reset((reset_line & 8) ? ASSERT_LINE : CLEAR_LINE);
}
break;
}
@ -337,6 +334,10 @@ WRITE8_MEMBER( egret_device::pram_w )
egret_device::egret_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, EGRET, "Apple Egret", tag, owner, clock, "egret", __FILE__),
device_nvram_interface(mconfig, *this),
write_reset(*this),
write_linechange(*this),
write_via_clock(*this),
write_via_data(*this),
m_maincpu(*this, EGRET_CPU_TAG)
{
}
@ -352,30 +353,16 @@ void egret_device::static_set_type(device_t &device, int type)
egret.rom_offset = type;
}
void egret_device::device_config_complete()
{
// inherit a copy of the static data
const egret_interface *intf = reinterpret_cast<const egret_interface *>(static_config());
if (intf != NULL)
{
*static_cast<egret_interface *>(this) = *intf;
}
// or initialize to defaults if none provided
else
{
memset(&m_out_reset_cb, 0, sizeof(m_out_reset_cb));
memset(&m_out_adb_cb, 0, sizeof(m_out_adb_cb));
}
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void egret_device::device_start()
{
m_out_reset_func.resolve(m_out_reset_cb, *this);
m_out_adb_func.resolve(m_out_adb_cb, *this);
write_reset.resolve_safe();
write_linechange.resolve_safe();
write_via_clock.resolve_safe();
write_via_data.resolve_safe();
m_timer = timer_alloc(0, NULL);
save_item(NAME(ddrs[0]));

View File

@ -21,14 +21,12 @@
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_EGRET_ADD(_type, _config) \
#define MCFG_EGRET_ADD(_type) \
MCFG_DEVICE_ADD(EGRET_TAG, EGRET, 0) \
MCFG_DEVICE_CONFIG(_config) \
MCFG_EGRET_TYPE(_type)
#define MCFG_EGRET_REPLACE(_type, _config) \
#define MCFG_EGRET_REPLACE(_type) \
MCFG_DEVICE_REPLACE(EGRET_TAG, EGRET, 0) \
MCFG_DEVICE_CONFIG(_config) \
MCFG_EGRET_TYPE(_type)
#define MCFG_EGRET_TYPE(_type) \
@ -37,19 +35,25 @@
#define MCFG_EGRET_REMOVE() \
MCFG_DEVICE_REMOVE(EGRET_TAG)
#define MCFG_EGRET_RESET_CALLBACK(_cb) \
downcast<egret_device *>(device)->set_reset_cb(DEVCB2_##_cb);
#define MCFG_EGRET_LINECHANGE_CALLBACK(_cb) \
downcast<egret_device *>(device)->set_linechange_cb(DEVCB2_##_cb);
#define MCFG_EGRET_VIA_CLOCK_CALLBACK(_cb) \
downcast<egret_device *>(device)->set_via_clock_cb(DEVCB2_##_cb);
#define MCFG_EGRET_VIA_DATA_CALLBACK(_cb) \
downcast<egret_device *>(device)->set_via_data_cb(DEVCB2_##_cb);
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
struct egret_interface
{
devcb_write_line m_out_reset_cb;
devcb_write_line m_out_adb_cb;
};
// ======================> egret_device
class egret_device : public device_t, public device_nvram_interface, public egret_interface
class egret_device : public device_t, public device_nvram_interface
{
public:
// construction/destruction
@ -90,11 +94,17 @@ public:
int rom_offset;
template<class _write> void set_reset_cb(_write wr) { write_reset.set_callback(wr); }
template<class _write> void set_linechange_cb(_write wr) { write_linechange.set_callback(wr); }
template<class _write> void set_via_clock_cb(_write wr) { write_via_clock.set_callback(wr); }
template<class _write> void set_via_data_cb(_write wr) { write_via_data.set_callback(wr); }
devcb2_write_line write_reset, write_linechange, write_via_clock, write_via_data;
protected:
// device-level overrides
virtual void device_start();
virtual void device_reset();
virtual void device_config_complete();
virtual machine_config_constructor device_mconfig_additions() const;
virtual const rom_entry *device_rom_region() const;
@ -120,9 +130,6 @@ private:
bool pram_loaded;
void send_port(address_space &space, UINT8 offset, UINT8 data);
devcb_resolved_write_line m_out_reset_func;
devcb_resolved_write_line m_out_adb_func;
};
// device type definition