1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-23 20:29:42 +00:00

Ensured that ROM images are loaded and passed to the Amstrad CPC.

This commit is contained in:
Thomas Harte 2017-07-31 18:44:49 -04:00
parent 26b6c03a2a
commit afd409c883
3 changed files with 47 additions and 0 deletions

View File

@ -26,6 +26,9 @@ HalfCycles Machine::perform_machine_cycle(const CPU::Z80::PartialMachineCycle &c
void Machine::flush() {
}
void Machine::set_rom(ROMType type, std::vector<uint8_t> data) {
}
void Machine::setup_output(float aspect_ratio) {
crt_.reset(new Outputs::CRT::CRT(256, 1, Outputs::CRT::DisplayType::PAL50, 1));
crt_->set_rgb_sampling_function(
@ -36,6 +39,7 @@ void Machine::setup_output(float aspect_ratio) {
}
void Machine::close_output() {
crt_.reset();
}
std::shared_ptr<Outputs::CRT::CRT> Machine::get_crt() {

View File

@ -17,6 +17,12 @@
namespace AmstradCPC {
enum ROMType: uint8_t {
OS464, OS664, OS6128,
BASIC464, BASIC664, BASIC6128,
AMSDOS
};
class Machine:
public CPU::Z80::Processor<Machine>,
public CRTMachine::Machine,
@ -37,6 +43,8 @@ class Machine:
void configure_as_target(const StaticAnalyser::Target &target);
void set_rom(ROMType type, std::vector<uint8_t> data);
private:
std::shared_ptr<Outputs::CRT::CRT> crt_;
HalfCycles clock_offset_;

View File

@ -10,6 +10,10 @@
#include "AmstradCPC.hpp"
#import "CSMachine+Subclassing.h"
#import "NSData+StdVector.h"
#import "NSBundle+DataResource.h"
@implementation CSAmstradCPC {
AmstradCPC::Machine _amstradCPC;
}
@ -18,6 +22,37 @@
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"; }
@end