1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 23:52:26 +00:00

Added a through path to the Objective-C for setting region and memory size.

This commit is contained in:
Thomas Harte 2016-08-14 14:14:59 -04:00
parent f15d89239f
commit b5af1746d5
2 changed files with 37 additions and 2 deletions

View File

@ -10,6 +10,19 @@
#import "CSKeyboardMachine.h"
#import "CSFastLoading.h"
typedef NS_ENUM(NSInteger, CSVic20Region)
{
CSVic20RegionPAL,
CSVic20RegionNTSC
};
typedef NS_ENUM(NSInteger, CSVic20MemorySize)
{
CSVic20MemorySize5Kb,
CSVic20MemorySize8Kb,
CSVic20MemorySize32Kb,
};
@interface CSVic20 : CSMachine <CSKeyboardMachine, CSFastLoading>
- (void)setKernelROM:(nonnull NSData *)rom;
@ -24,5 +37,7 @@
@property (nonatomic, assign) BOOL useFastLoadingHack;
@property (nonatomic, assign) BOOL shouldLoadAutomatically;
@property (nonatomic, assign) CSVic20Region region;
@property (nonatomic, assign) CSVic20MemorySize memorySize;
@end

View File

@ -190,18 +190,38 @@ using namespace Commodore::Vic20;
}
}
#pragma mark - Public configuration options
- (void)setUseFastLoadingHack:(BOOL)useFastLoadingHack {
_useFastLoadingHack = useFastLoadingHack;
@synchronized(self) {
_useFastLoadingHack = useFastLoadingHack;
_vic20.set_use_fast_tape_hack(useFastLoadingHack ? true : false);
}
}
- (void)setShouldLoadAutomatically:(BOOL)shouldLoadAutomatically {
_shouldLoadAutomatically = shouldLoadAutomatically;
@synchronized(self) {
_shouldLoadAutomatically = shouldLoadAutomatically;
_vic20.set_should_automatically_load_media(shouldLoadAutomatically ? true : false);
}
}
- (void)setRegion:(CSVic20Region)region {
_region = region;
@synchronized(self) {
_vic20.set_region( (region == CSVic20RegionPAL) ? Commodore::Vic20::Region::PAL : Commodore::Vic20::Region::NTSC);
}
}
- (void)setMemorySize:(CSVic20MemorySize)memorySize {
_memorySize = memorySize;
@synchronized(self) {
switch(memorySize) {
case CSVic20MemorySize5Kb: _vic20.set_memory_size(Commodore::Vic20::Default); break;
case CSVic20MemorySize8Kb: _vic20.set_memory_size(Commodore::Vic20::ThreeKB); break;
case CSVic20MemorySize32Kb: _vic20.set_memory_size(Commodore::Vic20::ThirtyTwoKB); break;
}
}
}
@end