mirror of
https://github.com/holub/mame
synced 2025-05-04 21:43:05 +03:00
6526cia.c: The PC output will now go low for 1 cycle following a read/write of port B. (instead of being toggled immediately) [Curt Coder]
This commit is contained in:
parent
f3ab660bfb
commit
173999b05e
@ -10,9 +10,11 @@
|
||||
#include "emu.h"
|
||||
#include "6526cia.h"
|
||||
|
||||
/***************************************************************************
|
||||
CONSTANTS
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// MACROS / CONSTANTS
|
||||
//**************************************************************************
|
||||
|
||||
/* CIA registers */
|
||||
#define CIA_PRA 0
|
||||
@ -41,20 +43,34 @@
|
||||
#define CIA_CRA_SPMODE 0x40
|
||||
#define CIA_CRA_TODIN 0x80
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// DEVICE CONFIGURATION
|
||||
//**************************************************************************
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
// device type definition
|
||||
const device_type MOS6526R1 = &device_creator<mos6526r1_device>;
|
||||
const device_type MOS6526R2 = &device_creator<mos6526r2_device>;
|
||||
const device_type MOS8520 = &device_creator<mos8520_device>;
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// INLINE HELPERS
|
||||
//**************************************************************************
|
||||
|
||||
inline attotime mos6526_device::cycles_to_time(int c)
|
||||
{
|
||||
return attotime::from_hz(clock()) * c;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// mos6526_device - constructor
|
||||
//-------------------------------------------------
|
||||
@ -174,6 +190,8 @@ void mos6526_device::device_start()
|
||||
}
|
||||
|
||||
/* setup timers */
|
||||
m_pc_timer = timer_alloc(TIMER_PC);
|
||||
|
||||
for (int t = 0; t < (sizeof(m_timer) / sizeof(m_timer[0])); t++)
|
||||
{
|
||||
cia_timer *timer = &m_timer[t];
|
||||
@ -225,6 +243,21 @@ void mos6526_device::device_start()
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_timer - handler timer events
|
||||
//-------------------------------------------------
|
||||
|
||||
void mos6526_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case TIMER_PC:
|
||||
m_out_pc_func(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
set_port_mask_value
|
||||
-------------------------------------------------*/
|
||||
@ -240,9 +273,9 @@ void mos6526_device::set_port_mask_value(int port, int data)
|
||||
|
||||
void mos6526_device::update_pc()
|
||||
{
|
||||
/* this should really be one cycle long */
|
||||
m_out_pc_func(0);
|
||||
m_out_pc_func(1);
|
||||
|
||||
m_pc_timer->adjust(cycles_to_time(1));
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
|
@ -132,12 +132,15 @@ protected:
|
||||
virtual void device_reset();
|
||||
virtual void device_post_load() { }
|
||||
virtual void device_clock_changed() { }
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||
|
||||
static TIMER_CALLBACK( timer_proc );
|
||||
static TIMER_CALLBACK( clock_tod_callback );
|
||||
|
||||
private:
|
||||
static const device_timer_id TIMER_PC = 0;
|
||||
|
||||
inline attotime cycles_to_time(int c);
|
||||
void update_pc();
|
||||
void update_interrupts();
|
||||
void timer_bump(int timer);
|
||||
@ -201,6 +204,8 @@ private:
|
||||
UINT8 m_cnt;
|
||||
UINT8 m_shift;
|
||||
UINT8 m_serial;
|
||||
|
||||
emu_timer *m_pc_timer;
|
||||
};
|
||||
|
||||
class mos6526r1_device : public mos6526_device
|
||||
|
Loading…
Reference in New Issue
Block a user