1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-27 01:31:42 +00:00

Ensured that the ROM gets installed. So next for some video action?

This commit is contained in:
Thomas Harte 2016-10-12 18:51:02 -04:00
parent f7d2e988b6
commit e6937d8003
3 changed files with 37 additions and 0 deletions

View File

@ -19,8 +19,25 @@ void Machine::configure_as_target(const StaticAnalyser::Target &target)
{ {
} }
void Machine::set_rom(std::vector<uint8_t> data)
{
memcpy(_rom, data.data(), std::min(data.size(), sizeof(_rom)));
}
unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uint16_t address, uint8_t *value) unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uint16_t address, uint8_t *value)
{ {
if(address > 0xc000)
{
if(isReadOperation(operation)) *value = _rom[address&16383];
}
else
{
if(isReadOperation(operation))
*value = _ram[address];
else
_ram[address] = *value;
}
return 1; return 1;
} }

View File

@ -29,6 +29,8 @@ class Machine:
public: public:
Machine(); Machine();
void set_rom(std::vector<uint8_t> data);
// to satisfy ConfigurationTarget::Machine // to satisfy ConfigurationTarget::Machine
void configure_as_target(const StaticAnalyser::Target &target); void configure_as_target(const StaticAnalyser::Target &target);
@ -44,6 +46,9 @@ class Machine:
virtual void run_for_cycles(int number_of_cycles) { CPU6502::Processor<Machine>::run_for_cycles(number_of_cycles); } virtual void run_for_cycles(int number_of_cycles) { CPU6502::Processor<Machine>::run_for_cycles(number_of_cycles); }
private: private:
// RAM and ROM
uint8_t _ram[65536], _rom[16384];
// Outputs // Outputs
std::shared_ptr<Outputs::CRT::CRT> _crt; std::shared_ptr<Outputs::CRT::CRT> _crt;
}; };

View File

@ -19,6 +19,21 @@
Oric::Machine _oric; Oric::Machine _oric;
} }
- (instancetype)init {
self = [super init];
if(self)
{
NSData *rom = [self rom:@"basic10"];
if(rom) _oric.set_rom(rom.stdVector8);
}
return self;
}
- (NSData *)rom:(NSString *)name
{
return [[NSBundle mainBundle] dataForResource:name withExtension:@"rom" subdirectory:@"ROMImages/Oric"];
}
- (CRTMachine::Machine * const)machine { - (CRTMachine::Machine * const)machine {
return &_oric; return &_oric;
} }