Made the mc146818 a proper device, modernized it, and added an NVRAM interface

so that drivers don't have to ask it to be manually saved.
This commit is contained in:
Aaron Giles 2010-09-10 23:33:36 +00:00
parent fdc0db7e26
commit 958c161bcc
18 changed files with 339 additions and 225 deletions

View File

@ -863,6 +863,17 @@ void device_t::device_debug_setup()
}
//-------------------------------------------------
// device_timer - called whenever a device timer
// fires
//-------------------------------------------------
void device_t::device_timer(emu_timer &timer, int param, void *ptr)
{
// do nothing by default
}
//-------------------------------------------------
// notify_clock_changed - notify all interfaces
// that the clock has changed

View File

@ -126,6 +126,7 @@ class device_memory_interface;
class device_state_interface;
struct rom_entry;
class machine_config;
class emu_timer;
// exception classes
@ -405,6 +406,8 @@ public:
const region_info *subregion(const char *tag) const;
device_t *subdevice(const char *tag) const;
device_t *siblingdevice(const char *tag) const;
template<class T> inline T *subdevice(const char *tag) { return downcast<T *>(subdevice(tag)); }
template<class T> inline T *siblingdevice(const char *tag) { return downcast<T *>(siblingdevice(tag)); }
// configuration helpers
const device_config &baseconfig() const { return m_baseconfig; }
@ -422,6 +425,7 @@ public:
void set_clock_scale(double clockscale);
attotime clocks_to_attotime(UINT64 clocks) const;
UINT64 attotime_to_clocks(attotime duration) const;
void timer_fired(emu_timer &timer, int param, void *ptr) { device_timer(timer, param, ptr); }
// debugging
device_debug *debug() const { return m_debug; }
@ -456,6 +460,7 @@ protected:
virtual void device_post_load();
virtual void device_clock_changed();
virtual void device_debug_setup();
virtual void device_timer(emu_timer &timer, int param, void *ptr);
//------------------- end derived class overrides

View File

@ -72,69 +72,150 @@
*********************************************************************/
#include "emu.h"
#include "memconv.h"
#include "coreutil.h"
#include "machine/mc146818.h"
//**************************************************************************
// DEBUGGING
//**************************************************************************
#define LOG_MC146818 0
#define MC146818_DATA_SIZE 0x80
struct mc146818_chip
//**************************************************************************
// MACROS
//**************************************************************************
#define HOURS_24 (m_data[0xb]&2)
#define BCD_MODE !(m_data[0xb]&4) // book has other description!
#define CENTURY m_data[50]
#define YEAR m_data[9]
#define MONTH m_data[8]
#define DAY m_data[7]
#define WEEK_DAY m_data[6]
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
const device_type MC146818 = mc146818_device_config::static_alloc_device_config;
//**************************************************************************
// DEVICE CONFIGURATION
//**************************************************************************
//-------------------------------------------------
// mc146818_device_config - constructor
//-------------------------------------------------
mc146818_device_config::mc146818_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
: device_config(mconfig, static_alloc_device_config, "NVRAM", tag, owner, clock),
device_config_nvram_interface(mconfig, *this),
m_type(MC146818_STANDARD)
{
MC146818_TYPE type;
}
UINT8 index;
UINT8 data[MC146818_DATA_SIZE];
UINT16 eindex;
UINT8 edata[0x2000];
//-------------------------------------------------
// static_alloc_device_config - allocate a new
// configuration object
//-------------------------------------------------
int updated; /* update ended interrupt flag */
device_config *mc146818_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
{
return global_alloc(mc146818_device_config(mconfig, tag, owner, clock));
}
attotime last_refresh;
};
static struct mc146818_chip *mc146818;
//-------------------------------------------------
// alloc_device - allocate a new device object
//-------------------------------------------------
device_t *mc146818_device_config::alloc_device(running_machine &machine) const
{
return auto_alloc(&machine, mc146818_device(machine, *this));
}
//-------------------------------------------------
// static_set_interface - configuration helper
// to set the interface
//-------------------------------------------------
void mc146818_device_config::static_set_type(device_config *device, mc146818_type type)
{
downcast<mc146818_device_config *>(device)->m_type = type;
}
#define HOURS_24 (mc146818->data[0xb]&2)
#define BCD_MODE !(mc146818->data[0xb]&4) // book has other description!
#define CENTURY mc146818->data[50]
#define YEAR mc146818->data[9]
#define MONTH mc146818->data[8]
#define DAY mc146818->data[7]
#define WEEK_DAY mc146818->data[6]
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// mc146818_device - constructor
//-------------------------------------------------
mc146818_device::mc146818_device(running_machine &_machine, const mc146818_device_config &config)
: device_t(_machine, config),
device_nvram_interface(_machine, config, *this),
m_config(config),
m_index(0),
m_eindex(0),
m_updated(false),
m_last_refresh(attotime_zero)
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
static void mc146818_set_base_datetime(running_machine *machine);
void mc146818_device::device_start()
{
m_last_refresh = timer_get_time(&m_machine);
emu_timer *timer = device_timer_alloc(*this);
timer_adjust_periodic(timer, ATTOTIME_IN_HZ(1), 0, ATTOTIME_IN_HZ(1));
set_base_datetime();
}
static TIMER_CALLBACK( mc146818_timer )
//-------------------------------------------------
// device_timer - handler timer events
//-------------------------------------------------
void mc146818_device::device_timer(emu_timer &timer, int param, void *ptr)
{
int year/*, month*/;
if (BCD_MODE)
{
mc146818->data[0]=bcd_adjust(mc146818->data[0]+1);
if (mc146818->data[0]>=0x60)
m_data[0]=bcd_adjust(m_data[0]+1);
if (m_data[0]>=0x60)
{
mc146818->data[0]=0;
mc146818->data[2]=bcd_adjust(mc146818->data[2]+1);
if (mc146818->data[2]>=0x60)
m_data[0]=0;
m_data[2]=bcd_adjust(m_data[2]+1);
if (m_data[2]>=0x60)
{
mc146818->data[2]=0;
mc146818->data[4]=bcd_adjust(mc146818->data[4]+1);
m_data[2]=0;
m_data[4]=bcd_adjust(m_data[4]+1);
// different handling of hours
if (mc146818->data[4]>=0x24)
if (m_data[4]>=0x24)
{
mc146818->data[4]=0;
m_data[4]=0;
WEEK_DAY=bcd_adjust(WEEK_DAY+1)%7;
DAY=bcd_adjust(DAY+1);
//month=bcd_2_dec(MONTH);
year=bcd_2_dec(YEAR);
if (mc146818->type!=MC146818_IGNORE_CENTURY) year+=bcd_2_dec(CENTURY)*100;
if (m_config.m_type!=mc146818_device_config::MC146818_IGNORE_CENTURY) year+=bcd_2_dec(CENTURY)*100;
else year+=2000; // save for julian_days_in_month calculation
DAY=bcd_adjust(DAY+1);
if (DAY>gregorian_days_in_month(MONTH, year))
@ -145,7 +226,7 @@ static TIMER_CALLBACK( mc146818_timer )
{
MONTH=1;
YEAR=year=bcd_adjust(YEAR+1);
if (mc146818->type!=MC146818_IGNORE_CENTURY)
if (m_config.m_type!=mc146818_device_config::MC146818_IGNORE_CENTURY)
{
if (year>=0x100)
{
@ -160,27 +241,27 @@ static TIMER_CALLBACK( mc146818_timer )
}
else
{
mc146818->data[0]=mc146818->data[0]+1;
if (mc146818->data[0]>=60)
m_data[0]=m_data[0]+1;
if (m_data[0]>=60)
{
mc146818->data[0]=0;
mc146818->data[2]=mc146818->data[2]+1;
if (mc146818->data[2]>=60) {
mc146818->data[2]=0;
mc146818->data[4]=mc146818->data[4]+1;
m_data[0]=0;
m_data[2]=m_data[2]+1;
if (m_data[2]>=60) {
m_data[2]=0;
m_data[4]=m_data[4]+1;
// different handling of hours //?
if (mc146818->data[4]>=24) {
mc146818->data[4]=0;
if (m_data[4]>=24) {
m_data[4]=0;
WEEK_DAY=(WEEK_DAY+1)%7;
year=YEAR;
if (mc146818->type!=MC146818_IGNORE_CENTURY) year+=CENTURY*100;
if (m_config.m_type!=mc146818_device_config::MC146818_IGNORE_CENTURY) year+=CENTURY*100;
else year+=2000; // save for julian_days_in_month calculation
if (++DAY>gregorian_days_in_month(MONTH, year)) {
DAY=1;
if (++MONTH>12) {
MONTH=1;
YEAR++;
if (mc146818->type!=MC146818_IGNORE_CENTURY) {
if (m_config.m_type!=mc146818_device_config::MC146818_IGNORE_CENTURY) {
if (YEAR>=100) { CENTURY++;YEAR=0; }
} else {
YEAR%=100;
@ -191,218 +272,162 @@ static TIMER_CALLBACK( mc146818_timer )
}
}
}
mc146818->updated = 1; /* clock has been updated */
mc146818->last_refresh = timer_get_time(machine);
m_updated = true; /* clock has been updated */
m_last_refresh = timer_get_time(&m_machine);
}
void mc146818_init(running_machine *machine, MC146818_TYPE type)
//-------------------------------------------------
// nvram_default - called to initialize NVRAM to
// its default state
//-------------------------------------------------
void mc146818_device::nvram_default()
{
mc146818 = auto_alloc_clear(machine, struct mc146818_chip);
mc146818->type = type;
mc146818->last_refresh = timer_get_time(machine);
timer_pulse(machine, ATTOTIME_IN_HZ(1), NULL, 0, mc146818_timer);
mc146818_set_base_datetime(machine);
set_base_datetime();
}
//-------------------------------------------------
// nvram_read - called to read NVRAM from the
// .nv file
//-------------------------------------------------
void mc146818_load(running_machine *machine)
void mc146818_device::nvram_read(mame_file &file)
{
mame_file *file;
file = nvram_fopen(machine, OPEN_FLAG_READ);
if (file)
{
mc146818_load_stream(file);
mame_fclose(file);
}
mame_fread(&file, m_data, sizeof(m_data));
}
//-------------------------------------------------
// nvram_write - called to write NVRAM to the
// .nv file
//-------------------------------------------------
void mc146818_load_stream(mame_file *file)
void mc146818_device::nvram_write(mame_file &file)
{
mame_fread(file, mc146818->data, sizeof(mc146818->data));
mame_fwrite(&file, m_data, sizeof(m_data));
}
//-------------------------------------------------
// dec_2_local - convert from decimal to BCD if
// necessary
//-------------------------------------------------
static int dec_2_local(int a)
inline int mc146818_device::dec_2_local(int a)
{
return BCD_MODE ? dec_2_bcd(a) : a;
}
//-------------------------------------------------
// dec_2_local - convert from decimal to BCD if
// necessary
//-------------------------------------------------
static void mc146818_set_base_datetime(running_machine *machine)
void mc146818_device::set_base_datetime()
{
system_time systime;
machine->base_datetime(systime);
m_machine.base_datetime(systime);
if (HOURS_24 || (systime.local_time.hour < 12))
mc146818->data[4] = dec_2_local(systime.local_time.hour);
m_data[4] = dec_2_local(systime.local_time.hour);
else
mc146818->data[4] = dec_2_local(systime.local_time.hour - 12) | 0x80;
m_data[4] = dec_2_local(systime.local_time.hour - 12) | 0x80;
if (mc146818->type != MC146818_IGNORE_CENTURY)
if (m_config.m_type != mc146818_device_config::MC146818_IGNORE_CENTURY)
CENTURY = dec_2_local(systime.local_time.year /100);
mc146818->data[0] = dec_2_local(systime.local_time.second);
mc146818->data[2] = dec_2_local(systime.local_time.minute);
m_data[0] = dec_2_local(systime.local_time.second);
m_data[2] = dec_2_local(systime.local_time.minute);
DAY = dec_2_local(systime.local_time.day);
MONTH = dec_2_local(systime.local_time.month + 1);
YEAR = dec_2_local(systime.local_time.year % 100);
WEEK_DAY = systime.local_time.weekday;
if (systime.local_time.is_dst)
mc146818->data[0xb] |= 1;
m_data[0xb] |= 1;
else
mc146818->data[0xb] &= ~1;
m_data[0xb] &= ~1;
}
//-------------------------------------------------
// read - I/O handler for reading
//-------------------------------------------------
void mc146818_save(running_machine *machine)
{
mame_file *file;
file = nvram_fopen(machine, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
if (file)
{
mame_fwrite(file, mc146818->data, sizeof(mc146818->data));
mame_fclose(file);
}
}
void mc146818_save_stream(mame_file *file)
{
mame_fwrite(file, mc146818->data, sizeof(mc146818->data));
}
NVRAM_HANDLER( mc146818 )
{
if (file == NULL)
{
mc146818_set_base_datetime(machine);
// init only
}
else if (read_or_write)
{
mc146818_save_stream(file);
}
else
{
mc146818_load_stream(file);
}
}
READ8_HANDLER(mc146818_port_r)
READ8_MEMBER( mc146818_device::read )
{
UINT8 data = 0;
switch (offset) {
case 0:
data = mc146818->index;
data = m_index;
break;
case 1:
switch (mc146818->index % MC146818_DATA_SIZE) {
switch (m_index % MC146818_DATA_SIZE) {
case 0xa:
data = mc146818->data[mc146818->index % MC146818_DATA_SIZE];
if (attotime_compare(attotime_sub(timer_get_time(space->machine), mc146818->last_refresh), ATTOTIME_IN_HZ(32768)) < 0)
data = m_data[m_index % MC146818_DATA_SIZE];
if (attotime_compare(attotime_sub(timer_get_time(space.machine), m_last_refresh), ATTOTIME_IN_HZ(32768)) < 0)
data |= 0x80;
#if 0
/* for pc1512 bios realtime clock test */
mc146818->data[mc146818->index % MC146818_DATA_SIZE] ^= 0x80; /* 0x80 update in progress */
m_data[m_index % MC146818_DATA_SIZE] ^= 0x80; /* 0x80 update in progress */
#endif
break;
case 0xc:
if(mc146818->updated != 0) /* the clock has been updated */
if (m_updated) /* the clock has been updated */
data = 0x10;
else
data = 0x00;
break;
case 0xd:
/* battery ok */
data = mc146818->data[mc146818->index % MC146818_DATA_SIZE] | 0x80;
data = m_data[m_index % MC146818_DATA_SIZE] | 0x80;
break;
default:
data = mc146818->data[mc146818->index % MC146818_DATA_SIZE];
data = m_data[m_index % MC146818_DATA_SIZE];
break;
}
break;
}
if (LOG_MC146818)
logerror("mc146818_port_r(): index=0x%02x data=0x%02x\n", mc146818->index, data);
logerror("mc146818_port_r(): index=0x%02x data=0x%02x\n", m_index, data);
return data;
}
//-------------------------------------------------
// write - I/O handler for writing
//-------------------------------------------------
WRITE8_HANDLER(mc146818_port_w)
WRITE8_MEMBER( mc146818_device::write )
{
if (LOG_MC146818)
logerror("mc146818_port_w(): index=0x%02x data=0x%02x\n", mc146818->index, data);
logerror("mc146818_port_w(): index=0x%02x data=0x%02x\n", m_index, data);
switch (offset) {
case 0:
mc146818->index = data;
m_index = data;
break;
case 1:
switch(mc146818->index % MC146818_DATA_SIZE)
switch(m_index % MC146818_DATA_SIZE)
{
case 0x0b:
if(data & 0x80)
mc146818->updated = 0;
mc146818->data[mc146818->index % MC146818_DATA_SIZE] = data;
m_updated = false;
m_data[m_index % MC146818_DATA_SIZE] = data;
break;
default:
mc146818->data[mc146818->index % MC146818_DATA_SIZE] = data;
m_data[m_index % MC146818_DATA_SIZE] = data;
}
break;
}
}
READ16_HANDLER(mc146818_port16le_r)
{
return read16le_with_read8_handler(mc146818_port_r, space, offset, mem_mask);
}
WRITE16_HANDLER(mc146818_port16le_w)
{
write16le_with_write8_handler(mc146818_port_w, space, offset, data, mem_mask);
}
READ32_HANDLER(mc146818_port32le_r)
{
return read32le_with_read8_handler(mc146818_port_r, space, offset, mem_mask);
}
WRITE32_HANDLER(mc146818_port32le_w)
{
write32le_with_write8_handler(mc146818_port_w, space, offset, data, mem_mask);
}
READ64_HANDLER(mc146818_port64be_r)
{
return read64be_with_read8_handler(mc146818_port_r, space, offset, mem_mask);
}
WRITE64_HANDLER(mc146818_port64be_w)
{
write64be_with_write8_handler(mc146818_port_w, space, offset, data, mem_mask);
}

View File

@ -11,45 +11,107 @@
*********************************************************************/
#ifndef MC146818_H
#define MC146818_H
#ifndef __MC146818_H__
#define __MC146818_H__
typedef enum
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MDRV_MC146818_ADD(_tag, _type) \
MDRV_DEVICE_ADD(_tag, MC146818, 0) \
mc146818_device_config::static_set_type(device, mc146818_device_config::_type); \
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
class mc146818_device;
// ======================> mc146818_device_config
class mc146818_device_config : public device_config,
public device_config_nvram_interface
{
MC146818_STANDARD,
MC146818_IGNORE_CENTURY, // century is NOT set, for systems having other usage of this byte
MC146818_ENHANCED
} MC146818_TYPE;
friend class mc146818_device;
// construction/destruction
mc146818_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
public:
// values
enum mc146818_type
{
MC146818_STANDARD,
MC146818_IGNORE_CENTURY, // century is NOT set, for systems having other usage of this byte
MC146818_ENHANCED
};
// allocators
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
virtual device_t *alloc_device(running_machine &machine) const;
// inline configuration helpers
static void static_set_type(device_config *device, mc146818_type type);
protected:
// internal state
mc146818_type m_type;
};
// ======================> mc146818_device
/* initialize mc146818 emulation, call only once at beginning */
void mc146818_init(running_machine *machine, MC146818_TYPE type);
class mc146818_device : public device_t,
public device_nvram_interface
{
friend class mc146818_device_config;
/* loads data from standard nvram file */
void mc146818_load(running_machine *machine);
// construction/destruction
mc146818_device(running_machine &_machine, const mc146818_device_config &config);
/* loads data from file stream */
void mc146818_load_stream(mame_file *file);
public:
// read/write access
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
/* saves data into standard nvram file */
void mc146818_save(running_machine *machine);
protected:
// device-level overrides
virtual void device_start();
virtual void device_timer(emu_timer &timer, int param, void *ptr);
/* saves data into file stream */
void mc146818_save_stream(mame_file *file);
// device_mc146818_interface overrides
virtual void nvram_default();
virtual void nvram_read(mame_file &file);
virtual void nvram_write(mame_file &file);
NVRAM_HANDLER( mc146818 );
// internal helpers
int dec_2_local(int a);
void set_base_datetime();
// internal state
static const int MC146818_DATA_SIZE = 0x80;
READ8_HANDLER(mc146818_port_r);
WRITE8_HANDLER(mc146818_port_w);
const mc146818_device_config & m_config;
READ16_HANDLER(mc146818_port16le_r);
WRITE16_HANDLER(mc146818_port16le_w);
UINT8 m_index;
UINT8 m_data[MC146818_DATA_SIZE];
READ32_HANDLER(mc146818_port32le_r);
WRITE32_HANDLER(mc146818_port32le_w);
UINT16 m_eindex;
UINT8 m_edata[0x2000];
READ64_HANDLER(mc146818_port64be_r);
WRITE64_HANDLER(mc146818_port64be_w);
bool m_updated; /* update ended interrupt flag */
#endif /* MC146818_H */
attotime m_last_refresh;
};
// device type definition
extern const device_type MC146818;
#endif /* __MC146818_H__ */

View File

@ -56,6 +56,7 @@ public:
attotime period; /* the repeat frequency of the timer */
attotime start; /* time when the timer was started */
attotime expire; /* time when the timer will expire */
device_t * device; /* for device timers, a pointer to the device */
};
@ -368,12 +369,17 @@ void timer_execute_timers(running_machine *machine)
global->callback_timer_expire_time = timer->expire;
/* call the callback */
if (was_enabled && timer->callback != NULL)
if (was_enabled)
{
LOG(("Timer %s:%d[%s] fired (expire=%s)\n", timer->file, timer->line, timer->func, attotime_string(timer->expire, 9)));
g_profiler.start(PROFILER_TIMER_CALLBACK);
(*timer->callback)(machine, timer->ptr, timer->param);
g_profiler.stop();
if (timer->device != NULL)
timer->device->timer_fired(*timer, timer->param, timer->ptr);
else if (timer->callback != NULL)
{
LOG(("Timer %s:%d[%s] fired (expire=%s)\n", timer->file, timer->line, timer->func, attotime_string(timer->expire, 9)));
g_profiler.start(PROFILER_TIMER_CALLBACK);
(*timer->callback)(machine, timer->ptr, timer->param);
g_profiler.stop();
}
}
/* clear the callback timer global */
@ -603,6 +609,7 @@ INLINE emu_timer *_timer_alloc_common(running_machine *machine, timer_fired_func
timer->file = file;
timer->line = line;
timer->func = func;
timer->device = NULL;
/* compute the time of the next firing and insert into the list */
timer->start = time;
@ -626,6 +633,14 @@ emu_timer *_timer_alloc_internal(running_machine *machine, timer_fired_func call
return _timer_alloc_common(machine, callback, ptr, file, line, func, FALSE);
}
emu_timer *device_timer_alloc(device_t &device, void *ptr, int param)
{
emu_timer *timer = _timer_alloc_common(device.machine, NULL, ptr, __FILE__, __LINE__, device.tag(), FALSE);
timer->param = param;
timer->device = &device;
return timer;
}
/*-------------------------------------------------
timer_remove - remove a timer from the

View File

@ -63,8 +63,6 @@ typedef void (*timer_fired_func)(running_machine *machine, void *ptr, INT32 para
typedef void (*timer_device_fired_func)(timer_device &timer, void *ptr, INT32 param);
struct timer_execution_state
{
attotime nextfire; /* time that the head of the timer list will fire */
@ -150,6 +148,9 @@ int timer_count_anonymous(running_machine *machine);
/* allocate a permament timer that isn't primed yet */
emu_timer *_timer_alloc_internal(running_machine *machine, timer_fired_func callback, void *param, const char *file, int line, const char *func);
/* allocate a permament device timer that isn't primed yet */
emu_timer *device_timer_alloc(device_t &device, void *ptr = NULL, int param = 0);
/* adjust the time when this timer will fire and disable any periodic firings */
void timer_adjust_oneshot(emu_timer *which, attotime duration, INT32 param);

View File

@ -290,22 +290,23 @@ PORTB - MECHANICAL METERS
static READ8_HANDLER(mkiv_pia_ina)
{
return mc146818_port_r(space,1);
return space->machine->device<mc146818_device>("rtc")->read(*space,1);
}
//output a
static WRITE8_HANDLER(mkiv_pia_outa)
{
mc146818_device *mc = space->machine->device<mc146818_device>("rtc");
if(rtc_data_strobe)
{
mc146818_port_w(space,1,data);
mc->write(*space,1,data);
//logerror("rtc protocol write data: %02X\n",data);
}
else
{
mc146818_port_w(space,0,data);
mc->write(*space,0,data);
//logerror("rtc protocol write address: %02X\n",data);
}
@ -1166,7 +1167,6 @@ static PALETTE_INIT( aristmk4 )
static DRIVER_INIT( aristmk4 )
{
mc146818_init(machine, MC146818_IGNORE_CENTURY);
shapeRomPtr = (UINT8 *)memory_region(machine, "tile_gfx");
memcpy(shapeRom,shapeRomPtr,sizeof(shapeRom)); // back up
}
@ -1202,7 +1202,6 @@ static MACHINE_CONFIG_START( aristmk4, driver_device )
MDRV_CPU_PROGRAM_MAP(aristmk4_map)
MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
MDRV_MACHINE_START(aristmk4)
MDRV_NVRAM_HANDLER( mc146818 )
MDRV_MACHINE_RESET(aristmk4 )
MDRV_NVRAM_ADD_0FILL("nvram")
@ -1225,6 +1224,7 @@ static MACHINE_CONFIG_START( aristmk4, driver_device )
MDRV_VIA6522_ADD("via6522_0", 0, via_interface) /* 1 MHz.(only 1 or 2 MHz.are valid) */
MDRV_PIA6821_ADD("pia6821_0", aristmk4_pia1_intf)
MDRV_MC6845_ADD("crtc", MC6845, MAIN_CLOCK/8, mc6845_intf)
MDRV_MC146818_ADD("rtc", MC146818_IGNORE_CENTURY)
MDRV_SPEAKER_STANDARD_MONO("mono")

View File

@ -478,7 +478,7 @@ static ADDRESS_MAP_START( calchase_io, ADDRESS_SPACE_IO, 32)
AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8("pit8254", pit8253_r, pit8253_w, 0xffffffff)
AM_RANGE(0x0060, 0x006f) AM_READWRITE(kbdc8042_32le_r, kbdc8042_32le_w)
AM_RANGE(0x0070, 0x007f) AM_READWRITE(mc146818_port32le_r, mc146818_port32le_w)
AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8_MODERN("rtc", mc146818_device, read, write, 0xffffffff)
AM_RANGE(0x0080, 0x009f) AM_READWRITE(at_page32_r, at_page32_w)
AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE("dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
@ -662,7 +662,7 @@ static MACHINE_CONFIG_START( calchase, driver_device )
MDRV_PIC8259_ADD( "pic8259_1", calchase_pic8259_1_config )
MDRV_PIC8259_ADD( "pic8259_2", calchase_pic8259_2_config )
MDRV_IDE_CONTROLLER_ADD("ide", ide_interrupt)
MDRV_NVRAM_HANDLER( mc146818 )
MDRV_MC146818_ADD( "rtc", MC146818_STANDARD )
MDRV_PCI_BUS_ADD("pcibus", 0)
MDRV_PCI_BUS_DEVICE(0, NULL, intel82439tx_pci_r, intel82439tx_pci_w)
MDRV_PCI_BUS_DEVICE(7, NULL, intel82371ab_pci_r, intel82371ab_pci_w)
@ -686,7 +686,6 @@ static DRIVER_INIT( calchase )
bios_ram = auto_alloc_array(machine, UINT32, 0x10000/4);
init_pc_common(machine, PCCOMMON_KEYBOARD_AT, calchase_set_keyb_int);
mc146818_init(machine, MC146818_STANDARD);
intel82439tx_init();

View File

@ -509,7 +509,7 @@ static ADDRESS_MAP_START(gamecstl_io, ADDRESS_SPACE_IO, 32)
AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8("pit8254", pit8253_r, pit8253_w, 0xffffffff)
AM_RANGE(0x0060, 0x006f) AM_READWRITE(kbdc8042_32le_r, kbdc8042_32le_w)
AM_RANGE(0x0070, 0x007f) AM_READWRITE(mc146818_port32le_r, mc146818_port32le_w)
AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8_MODERN("rtc", mc146818_device, read, write, 0xffffffff)
AM_RANGE(0x0080, 0x009f) AM_READWRITE(at_page32_r, at_page32_w)
AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE("dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
@ -682,7 +682,7 @@ static MACHINE_CONFIG_START( gamecstl, driver_device )
MDRV_IDE_CONTROLLER_ADD("ide", ide_interrupt)
MDRV_NVRAM_HANDLER( mc146818 )
MDRV_MC146818_ADD( "rtc", MC146818_STANDARD )
/* video hardware */
MDRV_SCREEN_ADD("screen", RASTER)
@ -735,7 +735,6 @@ static DRIVER_INIT( gamecstl )
bios_ram = auto_alloc_array(machine, UINT32, 0x10000/4);
init_pc_common(machine, PCCOMMON_KEYBOARD_AT, gamecstl_set_keyb_int);
mc146818_init(machine, MC146818_STANDARD);
intel82439tx_init();

View File

@ -912,7 +912,7 @@ static ADDRESS_MAP_START(mediagx_io, ADDRESS_SPACE_IO, 32)
AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_master", io20_r, io20_w, 0xffffffff)
AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8("pit8254", pit8253_r, pit8253_w, 0xffffffff)
AM_RANGE(0x0060, 0x006f) AM_READWRITE(kbdc8042_32le_r, kbdc8042_32le_w)
AM_RANGE(0x0070, 0x007f) AM_READWRITE(mc146818_port32le_r, mc146818_port32le_w)
AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8_MODERN("rtc", mc146818_device, read, write, 0xffffffff)
AM_RANGE(0x0080, 0x009f) AM_READWRITE8(at_page8_r, at_page8_w, 0xffffffff)
AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_slave", pic8259_r, pic8259_w, 0xffffffff)
AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE8("dma8237_2", at_dma8237_2_r, at_dma8237_2_w, 0xffffffff)
@ -1125,7 +1125,7 @@ static MACHINE_CONFIG_START( mediagx, mediagx_state )
MDRV_TIMER_ADD("sound_timer", sound_timer_callback)
MDRV_NVRAM_HANDLER( mc146818 )
MDRV_MC146818_ADD( "rtc", MC146818_STANDARD )
/* video hardware */
MDRV_SCREEN_ADD("screen", RASTER)
@ -1195,7 +1195,6 @@ static void init_mediagx(running_machine *machine)
state->frame_width = state->frame_height = 1;
init_pc_common(machine, PCCOMMON_KEYBOARD_AT,mediagx_set_keyb_int);
mc146818_init(machine, MC146818_STANDARD);
kbdc8042_init(machine, &at8042);
}

View File

@ -373,7 +373,7 @@ static ADDRESS_MAP_START( pcat_io, ADDRESS_SPACE_IO, 32 )
AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8("pit8254", pit8253_r, pit8253_w, 0xffffffff)
AM_RANGE(0x0060, 0x006f) AM_READWRITE(kbdc8042_32le_r, kbdc8042_32le_w)
AM_RANGE(0x0070, 0x007f) AM_READWRITE(mc146818_port32le_r, mc146818_port32le_w)
AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8_MODERN("rtc", mc146818_device, read, write, 0xffffffff)
AM_RANGE(0x0080, 0x009f) AM_READWRITE8(dma_page_select_r,dma_page_select_w, 0xffffffff)
AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE8("dma8237_2", i8237_r, i8237_w, 0xffff)
@ -491,7 +491,6 @@ static MACHINE_START( pcat_dyn )
pcat_dyn_devices.dma8237_2 = machine->device( "dma8237_2" );
init_pc_common(machine, PCCOMMON_KEYBOARD_AT, pcat_dyn_set_keyb_int);
mc146818_init(machine, MC146818_STANDARD);
}
static const gfx_layout CGA_charlayout =
@ -526,7 +525,7 @@ static MACHINE_CONFIG_START( pcat_dyn, driver_device )
MDRV_GFXDECODE( pcat_dyn )
MDRV_MACHINE_START(pcat_dyn)
MDRV_NVRAM_HANDLER( mc146818 )
MDRV_MC146818_ADD( "rtc", MC146818_STANDARD )
// MDRV_FRAGMENT_ADD( at_kbdc8042 )
MDRV_PIC8259_ADD( "pic8259_1", pic8259_1_config )

View File

@ -216,7 +216,6 @@ static MACHINE_START( streetg2 )
cpu_set_irq_callback(machine->device("maincpu"), pcat_irq_callback);
init_pc_common(machine, PCCOMMON_KEYBOARD_AT, streetg2_set_keyb_int);
mc146818_init(machine, MC146818_STANDARD);
memory_configure_bank(machine, "rombank", 0, 0x80, memory_region(machine, "game_prg"), 0x8000 );
memory_set_bank(machine, "rombank", 0);
@ -238,7 +237,7 @@ static MACHINE_CONFIG_START( pcat_nit, driver_device )
MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
MDRV_MACHINE_START(streetg2)
MDRV_NVRAM_HANDLER( mc146818 )
MDRV_MC146818_ADD( "rtc", MC146818_STANDARD )
// MDRV_FRAGMENT_ADD( at_kbdc8042 )
MDRV_FRAGMENT_ADD( pcat_common )

View File

@ -684,7 +684,7 @@ static ADDRESS_MAP_START( filetto_io, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE("pit8253", pit8253_r, pit8253_w) //8253 PIT
AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w) //PPI 8255
AM_RANGE(0x0064, 0x0066) AM_DEVREADWRITE("ppi8255_1", ppi8255_r, ppi8255_w) //PPI 8255
AM_RANGE(0x0070, 0x007f) AM_READWRITE(mc146818_port_r,mc146818_port_w)
AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE_MODERN("rtc", mc146818_device, read, write)
AM_RANGE(0x0080, 0x0087) AM_READWRITE(dma_page_select_r,dma_page_select_w)
AM_RANGE(0x00a0, 0x00af) AM_DEVREADWRITE("pic8259_2", pic8259_r, pic8259_w )
// AM_RANGE(0x0200, 0x020f) AM_RAM //game port
@ -713,7 +713,7 @@ static ADDRESS_MAP_START( tetriskr_io, ADDRESS_SPACE_IO, 8 )
AM_RANGE(0x0040, 0x0043) AM_DEVREADWRITE("pit8253", pit8253_r, pit8253_w) //8253 PIT
AM_RANGE(0x0060, 0x0063) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w) //PPI 8255
AM_RANGE(0x0064, 0x0066) AM_DEVREADWRITE("ppi8255_1", ppi8255_r, ppi8255_w) //PPI 8255
AM_RANGE(0x0070, 0x007f) AM_READWRITE(mc146818_port_r,mc146818_port_w)
AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE_MODERN("rtc", mc146818_device, read, write)
AM_RANGE(0x0080, 0x0087) AM_READWRITE(dma_page_select_r,dma_page_select_w)
AM_RANGE(0x00a0, 0x00af) AM_DEVREADWRITE("pic8259_2", pic8259_r, pic8259_w )
AM_RANGE(0x0200, 0x020f) AM_RAM //game port

View File

@ -357,7 +357,7 @@ static ADDRESS_MAP_START( photoply_io, ADDRESS_SPACE_IO, 32 )
AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8("pit8254", pit8253_r, pit8253_w, 0xffffffff)
AM_RANGE(0x0060, 0x006f) AM_READWRITE(kbdc8042_32le_r, kbdc8042_32le_w)
AM_RANGE(0x0070, 0x007f) AM_RAM//READWRITE(mc146818_port32le_r, mc146818_port32le_w)
AM_RANGE(0x0070, 0x007f) AM_RAM//DEVREADWRITE8_MODERN("rtc", mc146818_device, read, write, 0xffffffff)
AM_RANGE(0x0080, 0x009f) AM_READWRITE8(dma_page_select_r,dma_page_select_w, 0xffffffff)//TODO
AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE8("dma8237_2", i8237_r, i8237_w, 0xffff)
@ -475,7 +475,6 @@ static MACHINE_START( photoply )
photoply_devices.dma8237_2 = machine->device( "dma8237_2" );
init_pc_common(machine, PCCOMMON_KEYBOARD_AT, photoply_set_keyb_int);
mc146818_init(machine, MC146818_STANDARD);
}
static const gfx_layout CGA_charlayout =
@ -512,7 +511,7 @@ static MACHINE_CONFIG_START( photoply, driver_device )
MDRV_GFXDECODE( photoply )
MDRV_MACHINE_START(photoply)
MDRV_NVRAM_HANDLER( mc146818 )
MDRV_MC146818_ADD( "rtc", MC146818_STANDARD )
// MDRV_FRAGMENT_ADD( at_kbdc8042 )
MDRV_PIC8259_ADD( "pic8259_1", pic8259_1_config )

View File

@ -85,7 +85,7 @@ static ADDRESS_MAP_START( quake_io, ADDRESS_SPACE_IO, 32 )
AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
// AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8("pit8254", pit8253_r, pit8253_w, 0xffffffff)
// AM_RANGE(0x0060, 0x006f) AM_READWRITE(kbdc8042_32le_r, kbdc8042_32le_w)
// AM_RANGE(0x0070, 0x007f) AM_READWRITE(mc146818_port32le_r, mc146818_port32le_w)
// AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8_MODERN("rtc", mc146818_device, read, write, 0xffffffff)
// AM_RANGE(0x0080, 0x009f) AM_READWRITE(at_page32_r, at_page32_w)
AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
// AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE("dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)

View File

@ -50,7 +50,7 @@ static ADDRESS_MAP_START(queen_io, ADDRESS_SPACE_IO, 32)
AM_RANGE(0x0020, 0x003f) AM_RAM//AM_DEVREADWRITE8("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
AM_RANGE(0x0040, 0x005f) AM_RAM//AM_DEVREADWRITE8("pit8254", pit8253_r, pit8253_w, 0xffffffff)
AM_RANGE(0x0060, 0x006f) AM_RAM//AM_READWRITE(kbdc8042_32le_r, kbdc8042_32le_w)
AM_RANGE(0x0070, 0x007f) AM_RAM//AM_READWRITE(mc146818_port32le_r, mc146818_port32le_w)
AM_RANGE(0x0070, 0x007f) AM_RAM//AM_DEVREADWRITE8_MODERN("rtc", mc146818_device, read, write, 0xffffffff)
AM_RANGE(0x0080, 0x009f) AM_RAM//AM_READWRITE(at_page32_r, at_page32_w)
AM_RANGE(0x00a0, 0x00bf) AM_RAM//AM_DEVREADWRITE8("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
AM_RANGE(0x00c0, 0x00df) AM_RAM//AM_DEVREADWRITE("dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)

View File

@ -450,7 +450,7 @@ static ADDRESS_MAP_START(taitowlf_io, ADDRESS_SPACE_IO, 32)
AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8("pit8254", pit8253_r, pit8253_w, 0xffffffff)
AM_RANGE(0x0060, 0x006f) AM_READWRITE(kbdc8042_32le_r, kbdc8042_32le_w)
AM_RANGE(0x0070, 0x007f) AM_READWRITE(mc146818_port32le_r, mc146818_port32le_w)
AM_RANGE(0x0070, 0x007f) AM_DEVREADWRITE8_MODERN("rtc", mc146818_device, read, write, 0xffffffff)
AM_RANGE(0x0080, 0x009f) AM_READWRITE(at_page32_r, at_page32_w)
AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE("dma8237_2", at32_dma8237_2_r, at32_dma8237_2_w)
@ -623,7 +623,7 @@ static MACHINE_CONFIG_START( taitowlf, driver_device )
MDRV_IDE_CONTROLLER_ADD("ide", ide_interrupt)
MDRV_NVRAM_HANDLER( mc146818 )
MDRV_MC146818_ADD( "rtc", MC146818_STANDARD )
/* video hardware */
MDRV_SCREEN_ADD("screen", RASTER)
@ -676,7 +676,6 @@ static DRIVER_INIT( taitowlf )
bios_ram = auto_alloc_array(machine, UINT32, 0x10000/4);
init_pc_common(machine, PCCOMMON_KEYBOARD_AT, taitowlf_set_keyb_int);
mc146818_init(machine, MC146818_STANDARD);
intel82439tx_init();

View File

@ -27,6 +27,7 @@
#include "machine/pic8259.h"
#include "machine/pit8253.h"
#include "machine/8042kbdc.h"
#include "machine/mc146818.h"
#define VERBOSE_DBG 0 /* general debug messages */
#define DBG_LOG(N,M,A) \
@ -321,7 +322,7 @@ ADDRESS_MAP_START( pcat32_io_common, ADDRESS_SPACE_IO, 32 )
AM_RANGE(0x0020, 0x003f) AM_DEVREADWRITE8("pic8259_1", pic8259_r, pic8259_w, 0xffffffff)
AM_RANGE(0x0040, 0x005f) AM_DEVREADWRITE8("pit8254", pit8253_r, pit8253_w, 0xffffffff)
AM_RANGE(0x0060, 0x006f) AM_READWRITE8(kbdc8042_8_r, kbdc8042_8_w, 0xffffffff)
AM_RANGE(0x0070, 0x007f) AM_RAM//READWRITE(mc146818_port32le_r, mc146818_port32le_w)
AM_RANGE(0x0070, 0x007f) AM_RAM //AM_DEVREADWRITE8_MODERN("rtc", mc146818_device, read, write, 0xffffffff)
AM_RANGE(0x0080, 0x009f) AM_READWRITE8(dma_page_select_r,dma_page_select_w, 0xffffffff)//TODO
AM_RANGE(0x00a0, 0x00bf) AM_DEVREADWRITE8("pic8259_2", pic8259_r, pic8259_w, 0xffffffff)
AM_RANGE(0x00c0, 0x00df) AM_DEVREADWRITE8("dma8237_2", i8237_r, i8237_w, 0xffff)
@ -333,4 +334,5 @@ MACHINE_CONFIG_FRAGMENT(pcat_common)
MDRV_I8237_ADD( "dma8237_1", XTAL_14_31818MHz/3, dma8237_1_config )
MDRV_I8237_ADD( "dma8237_2", XTAL_14_31818MHz/3, dma8237_2_config )
MDRV_PIT8254_ADD( "pit8254", at_pit8254_config )
// MDRV_MC146818_ADD( "rtc", MC146818_STANDARD )
MACHINE_CONFIG_END