MOS6526 Class Referenceabstract

`#include <mos6526.h>`

Inheritance diagram for MOS6526:

## Public Member Functions

virtual void | reset ()
void | setDayOfTimeRate (unsigned int clock)

## Static Public Member Functions

static const char * | credits ()

## Protected Member Functions

| MOS6526 (EventContext *context)
void | bTick ()
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]
| These are all CIA registers.
uint8_t | icr
| Interrupt control register.
uint8_t | idr
| Interrupt data register.
EventContext & | event_context
| Event context.
Tod | tod
| TOD.
bool | triggerScheduled
| Have we already scheduled CIA->CPU interrupt transition?
uint8_t & | pra
| Ports.
uint8_t & | prb
| Ports.
uint8_t & | ddra
| Ports.
uint8_t & | ddrb
| Ports.
TimerA | timerA
| Timers A and B.
TimerB | timerB
| Timers A and B.
uint8_t | sdr_out
| Serial Data Registers.
bool | sdr_buffered
| Serial Data Registers.
int | sdr_count
| Serial Data Registers.
EventCallback< MOS6526 > | bTickEvent
| Events.
EventCallback< MOS6526 > | triggerEvent
| Events.

## Friends

class | TimerA
class | TimerB
class | Tod

## 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

  context | the 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.

static const char* MOS6526::credits | ( |  | ) |

inline static

Get the credits.

Returns
  the credits

virtual void MOS6526::interrupt | ( | bool | state | ) |

protected pure virtual

Signal interrupt.

Parameters

  state | interrupt state

Implemented in c64cia2, and c64cia1.

uint8_t MOS6526::read | ( | uint_least8_t | addr | ) |

protected virtual

Read CIA register.

Parameters

  addr | register 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 | ) |

inline

Set day-of-time event occurence of rate.

Parameters

  clock |

void MOS6526::trigger | ( |  | ) |

protected

Signal interrupt to CPU.

void MOS6526::trigger | ( | uint8_t | interruptMask | ) |

protected

Trigger an interrupt.

Parameters

  interruptMask | Interrupt 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

  addr | register address to write (lowest 4 bits)
  data | value to write

Implements component.

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

- mos6526.h
- mos6526.cpp