1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-25 03:32:01 +00:00

The emulated Oric now has access to both versions of the BASIC ROM and picks between them based on the static analyser's recommendation.

This commit is contained in:
Thomas Harte 2016-11-15 10:39:16 +08:00
parent ab64731d51
commit e2cdfae8a7
4 changed files with 23 additions and 5 deletions

View File

@ -36,11 +36,20 @@ void Machine::configure_as_target(const StaticAnalyser::Target &target)
{
set_typer_for_string(target.loadingCommand.c_str());
}
if(target.oric.use_atmos_rom)
{
memcpy(_rom, _basic11.data(), std::min(_basic11.size(), sizeof(_rom)));
}
else
{
memcpy(_rom, _basic10.data(), std::min(_basic10.size(), sizeof(_rom)));
}
}
void Machine::set_rom(std::vector<uint8_t> data)
void Machine::set_rom(ROM rom, const std::vector<uint8_t> &data)
{
memcpy(_rom, data.data(), std::min(data.size(), sizeof(_rom)));
if(rom == BASIC11) _basic11 = std::move(data); else _basic10 = std::move(data);
}
unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uint16_t address, uint8_t *value)

View File

@ -51,6 +51,10 @@ enum Key: uint16_t {
TerminateSequence = 0xffff, NotMapped = 0xfffe
};
enum ROM {
BASIC10, BASIC11
};
class Machine:
public CPU6502::Processor<Machine>,
public CRTMachine::Machine,
@ -62,7 +66,7 @@ class Machine:
public:
Machine();
void set_rom(std::vector<uint8_t> data);
void set_rom(ROM rom, const std::vector<uint8_t> &data);
void set_key_state(uint16_t key, bool isPressed);
void clear_all_keys();
@ -93,6 +97,7 @@ class Machine:
private:
// RAM and ROM
std::vector<uint8_t> _basic11, _basic10;
uint8_t _ram[65536], _rom[16384];
int _cycles_since_video_update;
inline void update_video();

View File

@ -25,8 +25,11 @@
self = [super init];
if(self)
{
NSData *rom = [self rom:@"basic11"]; // test108j
if(rom) _oric.set_rom(rom.stdVector8);
NSData *basic10 = [self rom:@"basic10"];
NSData *basic11 = [self rom:@"basic11"]; // test108j
if(basic10) _oric.set_rom(Oric::BASIC10, basic10.stdVector8);
if(basic11) _oric.set_rom(Oric::BASIC11, basic11.stdVector8);
}
return self;
}

View File

@ -108,6 +108,7 @@ void StaticAnalyser::Oric::AddTargets(
}
}
// TODO: really this should add two targets if not all votes agree
target.oric.use_atmos_rom = basic11_votes >= basic10_votes;
if(target.tapes.size() || target.disks.size() || target.cartridges.size())