mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-25 18:30:21 +00:00
Merge branch 'master' into PLLParsing
This commit is contained in:
commit
ba83dfd454
@ -8,29 +8,26 @@
|
||||
|
||||
#import "C1540Bridge.h"
|
||||
#include "C1540.hpp"
|
||||
#include "NSData+StdVector.h"
|
||||
|
||||
class VanillaSerialPort: public Commodore::Serial::Port {
|
||||
public:
|
||||
void set_input(Commodore::Serial::Line line, Commodore::Serial::LineLevel value)
|
||||
{
|
||||
void set_input(Commodore::Serial::Line line, Commodore::Serial::LineLevel value) {
|
||||
_input_line_levels[(int)line] = value;
|
||||
}
|
||||
|
||||
Commodore::Serial::LineLevel _input_line_levels[5];
|
||||
};
|
||||
|
||||
@implementation C1540Bridge
|
||||
{
|
||||
@implementation C1540Bridge {
|
||||
Commodore::C1540::Machine _c1540;
|
||||
std::shared_ptr<Commodore::Serial::Bus> _serialBus;
|
||||
std::shared_ptr<VanillaSerialPort> _serialPort;
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if(self)
|
||||
{
|
||||
if(self) {
|
||||
_serialBus.reset(new ::Commodore::Serial::Bus);
|
||||
_serialPort.reset(new VanillaSerialPort);
|
||||
|
||||
@ -40,43 +37,35 @@ class VanillaSerialPort: public Commodore::Serial::Port {
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setROM:(NSData *)ROM
|
||||
{
|
||||
_c1540.set_rom((uint8_t *)ROM.bytes);
|
||||
- (void)setROM:(NSData *)ROM {
|
||||
_c1540.set_rom(ROM.stdVector8);
|
||||
}
|
||||
|
||||
- (void)runForCycles:(NSUInteger)numberOfCycles
|
||||
{
|
||||
- (void)runForCycles:(NSUInteger)numberOfCycles {
|
||||
_c1540.run_for_cycles((int)numberOfCycles);
|
||||
}
|
||||
|
||||
- (void)setAttentionLine:(BOOL)attentionLine
|
||||
{
|
||||
- (void)setAttentionLine:(BOOL)attentionLine {
|
||||
_serialPort->set_output(Commodore::Serial::Line::Attention, attentionLine ? Commodore::Serial::LineLevel::High : Commodore::Serial::LineLevel::Low);
|
||||
}
|
||||
|
||||
- (BOOL)attentionLine
|
||||
{
|
||||
- (BOOL)attentionLine {
|
||||
return _serialPort->_input_line_levels[Commodore::Serial::Line::Attention];
|
||||
}
|
||||
|
||||
- (void)setDataLine:(BOOL)dataLine
|
||||
{
|
||||
- (void)setDataLine:(BOOL)dataLine {
|
||||
_serialPort->set_output(Commodore::Serial::Line::Data, dataLine ? Commodore::Serial::LineLevel::High : Commodore::Serial::LineLevel::Low);
|
||||
}
|
||||
|
||||
- (BOOL)dataLine
|
||||
{
|
||||
- (BOOL)dataLine {
|
||||
return _serialPort->_input_line_levels[Commodore::Serial::Line::Data];
|
||||
}
|
||||
|
||||
- (void)setClockLine:(BOOL)clockLine
|
||||
{
|
||||
- (void)setClockLine:(BOOL)clockLine {
|
||||
_serialPort->set_output(Commodore::Serial::Line::Clock, clockLine ? Commodore::Serial::LineLevel::High : Commodore::Serial::LineLevel::Low);
|
||||
}
|
||||
|
||||
- (BOOL)clockLine
|
||||
{
|
||||
- (BOOL)clockLine {
|
||||
return _serialPort->_input_line_levels[Commodore::Serial::Line::Clock];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user