1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-17 13:29:02 +00:00
CLK/OSBindings/Mac/Clock Signal/Machine/Wrappers/CSZX8081.mm
Thomas Harte 78ee46270b Transfers possession of keyboard mappings from the Mac side over to individual machines.
Specifically by establishing an intermediate representation of a useful mix between the American and British IBM and Mac keyboard layouts, and routing through that.
2017-10-12 22:25:02 -04:00

63 lines
1.6 KiB
Plaintext

//
// CSZX8081.m
// Clock Signal
//
// Created by Thomas Harte on 04/06/2017.
// Copyright © 2017 Thomas Harte. All rights reserved.
//
#import "CSZX8081.h"
#include "ZX8081.hpp"
#import "CSMachine+Subclassing.h"
#import "NSData+StdVector.h"
#import "NSBundle+DataResource.h"
@implementation CSZX8081 {
std::unique_ptr<ZX8081::Machine> _zx8081;
}
- (instancetype)initWithIntendedTarget:(const StaticAnalyser::Target &)target {
ZX8081::Machine *machine = ZX8081::Machine::ZX8081(target);
self = [super initWithMachine:machine];
if(self) {
_zx8081.reset(machine);
_zx8081->set_rom(ZX8081::ROMType::ZX80, [self rom:@"zx80"].stdVector8);
_zx8081->set_rom(ZX8081::ROMType::ZX81, [self rom:@"zx81"].stdVector8);
}
return self;
}
- (NSData *)rom:(NSString *)name {
return [[NSBundle mainBundle] dataForResource:name withExtension:@"rom" subdirectory:@"ROMImages/ZX8081"];
}
- (NSString *)userDefaultsPrefix { return @"zx8081"; }
#pragma mark - Options
- (void)setUseFastLoadingHack:(BOOL)useFastLoadingHack {
@synchronized(self) {
_useFastLoadingHack = useFastLoadingHack;
_zx8081->set_use_fast_tape_hack(useFastLoadingHack ? true : false);
}
}
- (void)setTapeIsPlaying:(BOOL)tapeIsPlaying {
@synchronized(self) {
_tapeIsPlaying = tapeIsPlaying;
_zx8081->set_tape_is_playing(tapeIsPlaying ? true : false);
}
}
- (void)setUseAutomaticTapeMotorControl:(BOOL)useAutomaticTapeMotorControl {
@synchronized(self) {
_useAutomaticTapeMotorControl = useAutomaticTapeMotorControl;
_zx8081->set_use_automatic_tape_motor_control(useAutomaticTapeMotorControl ? true : false);
}
}
@end