Imported the ZX80 and 81 system ROMs (though not publicly), added enough code to post their contents into C++ world.

This commit is contained in:
Thomas Harte 2017-06-04 18:08:35 -04:00
parent b0a7c58287
commit c485c460f7
5 changed files with 43 additions and 2 deletions

View File

@ -28,6 +28,9 @@ void Machine::setup_output(float aspect_ratio) {
"}");
}
void Machine::flush() {
}
void Machine::close_output() {
}
@ -44,3 +47,10 @@ void Machine::run_for_cycles(int number_of_cycles) {
void Machine::configure_as_target(const StaticAnalyser::Target &target) {
}
void Machine::set_rom(ROMType type, std::vector<uint8_t> data) {
switch(type) {
case ZX80: zx80_rom_ = data; break;
case ZX81: zx81_rom_ = data; break;
}
}

View File

@ -14,8 +14,15 @@
#include "../../Processors/Z80/Z80.hpp"
#include <cstdint>
#include <vector>
namespace ZX8081 {
enum ROMType: uint8_t {
ZX80, ZX81
};
class Machine:
public CPU::Z80::Processor<Machine>,
public CRTMachine::Machine,
@ -24,6 +31,7 @@ class Machine:
Machine();
int perform_machine_cycle(const CPU::Z80::MachineCycle &cycle);
void flush();
void setup_output(float aspect_ratio);
void close_output();
@ -35,8 +43,12 @@ 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_;
std::vector<uint8_t> zx81_rom_, zx80_rom_, rom_;
std::vector<uint8_t> ram_;
};
}

View File

@ -10,6 +10,10 @@
#include "ZX8081.hpp"
#import "CSMachine+Subclassing.h"
#import "NSData+StdVector.h"
#import "NSBundle+DataResource.h"
@implementation CSZX8081 {
ZX8081::Machine zx8081;
}
@ -21,10 +25,16 @@
- (instancetype)init {
self = [super init];
if(self) {
zx8081.set_rom(ZX8081::ROMType::ZX80, [self rom:@"zx80"].stdVector8);
zx8081.set_rom(ZX8081::ROMType::ZX81, [self rom:@"zx81"].stdVector8);
}
return self;
}
- (NSData *)rom:(NSString *)name {
return [[NSBundle mainBundle] dataForResource:name withExtension:@"rom" subdirectory:@"ROMImages/ZX8081"];
}
#pragma mark - Keyboard Mapping
- (void)clearAllKeys {

View File

@ -775,7 +775,10 @@ template <class T> class Processor {
while(bus_request_line_) {
static MachineCycle bus_acknowledge_cycle = {BusOperation::BusAcknowledge, 1};
number_of_cycles_ -= static_cast<T *>(this)->perform_machine_cycle(bus_acknowledge_cycle) + 1;
if(!number_of_cycles_) return;
if(!number_of_cycles_) {
flush();
return;
}
}
while(!bus_request_line_) {
@ -790,7 +793,7 @@ template <class T> class Processor {
switch(operation->type) {
case MicroOp::BusOperation:
if(number_of_cycles_ < operation->machine_cycle.length) { scheduled_program_counter_--; return; }
if(number_of_cycles_ < operation->machine_cycle.length) { scheduled_program_counter_--; flush(); return; }
number_of_cycles_ -= operation->machine_cycle.length;
last_request_status_ = request_status_;
number_of_cycles_ -= static_cast<T *>(this)->perform_machine_cycle(operation->machine_cycle);

View File

@ -0,0 +1,6 @@
ROM files would ordinarily go here; the copyright status of these is uncertain so they have not been included in this repository.
Expected files:
zx80.rom
zx81.rom