libsidplayfp  1.0.3
Public Member Functions | Protected Member Functions | Protected Attributes | Friends
MOS6526 Class Reference

#include <mos6526.h>

Inheritance diagram for MOS6526:
component c64cia1 c64cia2

List of all members.

Public Member Functions

virtual void reset ()
const char * credits () const
void setDayOfTimeRate (unsigned int clock)

Protected Member Functions

 MOS6526 (EventContext *context)
void bTick ()
void tod ()
void trigger ()
void underflowA ()
void underflowB ()
void trigger (uint8_t interruptMask)
void clear ()
void serialPort ()
virtual void interrupt (bool state)=0
virtual void portA ()
virtual void portB ()
uint8_t read (uint_least8_t addr)
void write (uint_least8_t addr, uint8_t data)

Protected Attributes

uint8_t regs [0x10]
uint8_t & pra
uint8_t & prb
uint8_t & ddra
uint8_t & ddrb
TimerA timerA
TimerB timerB
uint8_t sdr_out
bool sdr_buffered
int sdr_count
uint8_t icr
uint8_t idr
EventContextevent_context
bool m_todlatched
bool m_todstopped
uint8_t m_todclock [4]
uint8_t m_todalarm [4]
uint8_t m_todlatch [4]
event_clock_t m_todCycles
event_clock_t m_todPeriod
bool triggerScheduled
EventCallback< MOS6526bTickEvent
EventCallback< MOS6526todEvent
EventCallback< MOS6526triggerEvent

Friends

class TimerA
class TimerB

Detailed Description

This class is heavily based on the ciacore/ciatimer source code from VICE. The CIA state machine is lifted as-is. Big thanks to VICE project!

Author:
alankila

Constructor & Destructor Documentation

MOS6526::MOS6526 ( EventContext context) [protected]

Create a new CIA.

Parameters:
ctxthe event context

Member Function Documentation

void MOS6526::bTick ( ) [protected]

This event exists solely to break the ambiguity of what scheduling on top of PHI1 causes, because there is no ordering between events on same phase. Thus it is scheduled in PHI2 to ensure the b.event() is run once before the value changes.

  • PHI1 a.event() (which calls underFlow())
  • PHI1 b.event()
  • PHI2 bTick.event()
  • PHI1 a.event()
  • PHI1 b.event()
void MOS6526::clear ( ) [protected]

Clear interrupt state.

const char* MOS6526::credits ( ) const [inline, virtual]

Get the credits.

Returns:
the credits

Implements component.

virtual void MOS6526::interrupt ( bool  state) [protected, pure virtual]

Signal interrupt.

Parameters:
stateinterrupt state

Implemented in c64cia2, and c64cia1.

uint8_t MOS6526::read ( uint_least8_t  addr) [protected, virtual]

Read CIA register.

Parameters:
addrregister address to read (lowest 4 bits)

Implements component.

void MOS6526::reset ( ) [virtual]

Reset CIA.

Implements component.

Reimplemented in c64cia1.

void MOS6526::serialPort ( ) [protected]

Handle the serial port.

void MOS6526::setDayOfTimeRate ( unsigned int  clock)

Set day-of-time event occurence of rate.

Parameters:
clock
void MOS6526::tod ( ) [protected]

TOD event.

void MOS6526::trigger ( ) [protected]

Signal interrupt to CPU.

void MOS6526::trigger ( uint8_t  interruptMask) [protected]

Trigger an interrupt.

Parameters:
interruptMaskInterrupt flag number
void MOS6526::underflowA ( ) [protected]

Timer A underflow

void MOS6526::underflowB ( ) [protected]

Timer B underflow.

void MOS6526::write ( uint_least8_t  addr,
uint8_t  data 
) [protected, virtual]

Write CIA register.

Parameters:
addrregister address to write (lowest 4 bits)
datavalue to write

Implements component.


Member Data Documentation

Event context.

uint8_t MOS6526::icr [protected]

Interrupt control register

uint8_t MOS6526::idr [protected]

Interrupt data register

uint8_t MOS6526::regs[0x10] [protected]

These are all CIA registers.

TimerA MOS6526::timerA [protected]

Timers A and B.

bool MOS6526::triggerScheduled [protected]

Have we already scheduled CIA->CPU interrupt transition?


The documentation for this class was generated from the following files: