mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 08:49:37 +00:00
Ensured that ROM images are loaded and passed to the Amstrad CPC.
This commit is contained in:
parent
26b6c03a2a
commit
afd409c883
@ -26,6 +26,9 @@ HalfCycles Machine::perform_machine_cycle(const CPU::Z80::PartialMachineCycle &c
|
|||||||
void Machine::flush() {
|
void Machine::flush() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Machine::set_rom(ROMType type, std::vector<uint8_t> data) {
|
||||||
|
}
|
||||||
|
|
||||||
void Machine::setup_output(float aspect_ratio) {
|
void Machine::setup_output(float aspect_ratio) {
|
||||||
crt_.reset(new Outputs::CRT::CRT(256, 1, Outputs::CRT::DisplayType::PAL50, 1));
|
crt_.reset(new Outputs::CRT::CRT(256, 1, Outputs::CRT::DisplayType::PAL50, 1));
|
||||||
crt_->set_rgb_sampling_function(
|
crt_->set_rgb_sampling_function(
|
||||||
@ -36,6 +39,7 @@ void Machine::setup_output(float aspect_ratio) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Machine::close_output() {
|
void Machine::close_output() {
|
||||||
|
crt_.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<Outputs::CRT::CRT> Machine::get_crt() {
|
std::shared_ptr<Outputs::CRT::CRT> Machine::get_crt() {
|
||||||
|
@ -17,6 +17,12 @@
|
|||||||
|
|
||||||
namespace AmstradCPC {
|
namespace AmstradCPC {
|
||||||
|
|
||||||
|
enum ROMType: uint8_t {
|
||||||
|
OS464, OS664, OS6128,
|
||||||
|
BASIC464, BASIC664, BASIC6128,
|
||||||
|
AMSDOS
|
||||||
|
};
|
||||||
|
|
||||||
class Machine:
|
class Machine:
|
||||||
public CPU::Z80::Processor<Machine>,
|
public CPU::Z80::Processor<Machine>,
|
||||||
public CRTMachine::Machine,
|
public CRTMachine::Machine,
|
||||||
@ -37,6 +43,8 @@ class Machine:
|
|||||||
|
|
||||||
void configure_as_target(const StaticAnalyser::Target &target);
|
void configure_as_target(const StaticAnalyser::Target &target);
|
||||||
|
|
||||||
|
void set_rom(ROMType type, std::vector<uint8_t> data);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<Outputs::CRT::CRT> crt_;
|
std::shared_ptr<Outputs::CRT::CRT> crt_;
|
||||||
HalfCycles clock_offset_;
|
HalfCycles clock_offset_;
|
||||||
|
@ -10,6 +10,10 @@
|
|||||||
|
|
||||||
#include "AmstradCPC.hpp"
|
#include "AmstradCPC.hpp"
|
||||||
|
|
||||||
|
#import "CSMachine+Subclassing.h"
|
||||||
|
#import "NSData+StdVector.h"
|
||||||
|
#import "NSBundle+DataResource.h"
|
||||||
|
|
||||||
@implementation CSAmstradCPC {
|
@implementation CSAmstradCPC {
|
||||||
AmstradCPC::Machine _amstradCPC;
|
AmstradCPC::Machine _amstradCPC;
|
||||||
}
|
}
|
||||||
@ -18,6 +22,37 @@
|
|||||||
return &_amstradCPC;
|
return &_amstradCPC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (instancetype)init {
|
||||||
|
self = [super init];
|
||||||
|
if(self) {
|
||||||
|
NSDictionary *roms = @{
|
||||||
|
@(AmstradCPC::ROMType::OS464) : @"os464",
|
||||||
|
@(AmstradCPC::ROMType::OS664) : @"os664",
|
||||||
|
@(AmstradCPC::ROMType::OS6128) : @"os6128",
|
||||||
|
@(AmstradCPC::ROMType::BASIC464) : @"basic464",
|
||||||
|
@(AmstradCPC::ROMType::BASIC664) : @"basic664",
|
||||||
|
@(AmstradCPC::ROMType::BASIC6128) : @"basic6128",
|
||||||
|
@(AmstradCPC::ROMType::AMSDOS) : @"amsdos",
|
||||||
|
};
|
||||||
|
|
||||||
|
for(NSNumber *key in roms.allKeys) {
|
||||||
|
AmstradCPC::ROMType type = (AmstradCPC::ROMType)key.integerValue;
|
||||||
|
NSString *name = roms[key];
|
||||||
|
NSData *data = [self rom:name];
|
||||||
|
if(data) {
|
||||||
|
_amstradCPC.set_rom(type, data.stdVector8);
|
||||||
|
} else {
|
||||||
|
NSLog(@"Amstrad CPC ROM missing: %@", name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSData *)rom:(NSString *)name {
|
||||||
|
return [[NSBundle mainBundle] dataForResource:name withExtension:@"rom" subdirectory:@"ROMImages/AmstradCPC"];
|
||||||
|
}
|
||||||
|
|
||||||
- (NSString *)userDefaultsPrefix { return @"amstradCPC"; }
|
- (NSString *)userDefaultsPrefix { return @"amstradCPC"; }
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
Loading…
Reference in New Issue
Block a user