1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-23 18:31:53 +00:00
CLK/OSBindings/Mac/Clock SignalTests/Bridges/MOS6532Bridge.mm

49 lines
957 B
Plaintext
Raw Normal View History

//
// MOS6532Bridge.m
// Clock Signal
//
// Created by Thomas Harte on 19/06/2016.
// Copyright 2016 Thomas Harte. All rights reserved.
//
#import "MOS6532Bridge.h"
#include "6532.hpp"
class VanillaRIOT: public MOS::MOS6532<VanillaRIOT> {
2016-06-21 01:07:01 +00:00
public:
2017-07-25 01:57:24 +00:00
uint8_t get_port_input(int port) {
2016-06-21 01:07:01 +00:00
return input[port];
}
uint8_t input[2];
};
2017-07-25 01:57:24 +00:00
@implementation MOS6532Bridge {
VanillaRIOT _riot;
}
2017-07-25 01:57:24 +00:00
- (void)setValue:(uint8_t)value forRegister:(NSUInteger)registerNumber {
_riot.write((int)registerNumber, value);
}
2017-07-25 01:57:24 +00:00
- (uint8_t)valueForRegister:(NSUInteger)registerNumber {
return _riot.read((int)registerNumber);
}
2017-07-25 01:57:24 +00:00
- (void)runForCycles:(NSUInteger)numberOfCycles {
_riot.run_for(Cycles((int)numberOfCycles));
}
2017-07-25 01:57:24 +00:00
- (BOOL)irqLine {
return _riot.get_inerrupt_line();
}
2017-07-25 01:57:24 +00:00
- (void)setPortAInput:(uint8_t)portAInput {
2016-06-21 01:07:01 +00:00
_riot.input[0] = _portAInput = portAInput;
}
2017-07-25 01:57:24 +00:00
- (void)setPortBInput:(uint8_t)portBInput {
2016-06-21 01:07:01 +00:00
_riot.input[1] = _portBInput = portBInput;
}
@end