mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-11 08:30:55 +00:00
Made further attempt to get as fas as having the Z80 attempt to do something.
This commit is contained in:
parent
189317b80c
commit
87a021ec2d
@ -414,6 +414,8 @@
|
||||
4BFCA1201ECBDC1500AC40C1 /* Z80AllRAM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFCA11D1ECBD9BD00AC40C1 /* Z80AllRAM.cpp */; };
|
||||
4BFCA1241ECBDCB400AC40C1 /* AllRAMProcessor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BFCA1211ECBDCAF00AC40C1 /* AllRAMProcessor.cpp */; };
|
||||
4BFCA1271ECBE33200AC40C1 /* TestMachineZ80.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4BFCA1261ECBE33200AC40C1 /* TestMachineZ80.mm */; };
|
||||
4BFCA1291ECBE7A700AC40C1 /* zexall.com in Resources */ = {isa = PBXBuildFile; fileRef = 4BFCA1281ECBE7A700AC40C1 /* zexall.com */; };
|
||||
4BFCA12B1ECBE7C400AC40C1 /* ZexallTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BFCA12A1ECBE7C400AC40C1 /* ZexallTests.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@ -981,6 +983,8 @@
|
||||
4BFCA1221ECBDCAF00AC40C1 /* AllRAMProcessor.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = AllRAMProcessor.hpp; sourceTree = "<group>"; };
|
||||
4BFCA1251ECBE33200AC40C1 /* TestMachineZ80.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestMachineZ80.h; sourceTree = "<group>"; };
|
||||
4BFCA1261ECBE33200AC40C1 /* TestMachineZ80.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TestMachineZ80.mm; sourceTree = "<group>"; };
|
||||
4BFCA1281ECBE7A700AC40C1 /* zexall.com */ = {isa = PBXFileReference; lastKnownFileType = file; name = zexall.com; path = Zexall/zexall.com; sourceTree = "<group>"; };
|
||||
4BFCA12A1ECBE7C400AC40C1 /* ZexallTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ZexallTests.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -1036,6 +1040,7 @@
|
||||
4B1414631B588A1100E04248 /* Test Binaries */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4BFCA1281ECBE7A700AC40C1 /* zexall.com */,
|
||||
4B9252CD1E74D28200B76AF1 /* Atari ROMs */,
|
||||
4B44EBF61DC9883B00A7820C /* 6502_functional_test.bin */,
|
||||
4B44EBF41DC987AE00A7820C /* AllSuiteA.bin */,
|
||||
@ -1780,6 +1785,7 @@
|
||||
4BEF6AAB1D35D1C400E73575 /* DPLLTests.swift */,
|
||||
4B1414611B58888700E04248 /* KlausDormannTests.swift */,
|
||||
4B14145F1B58885000E04248 /* WolfgangLorenzTests.swift */,
|
||||
4BFCA12A1ECBE7C400AC40C1 /* ZexallTests.swift */,
|
||||
4B3BA0C41D318B44005DD7A7 /* Bridges */,
|
||||
4B1414631B588A1100E04248 /* Test Binaries */,
|
||||
);
|
||||
@ -2179,6 +2185,7 @@
|
||||
4BB2998A1B587D8400A49093 /* lseix in Resources */,
|
||||
4BB2994E1B587D8400A49093 /* dexn in Resources */,
|
||||
4BB299971B587D8400A49093 /* nopa in Resources */,
|
||||
4BFCA1291ECBE7A700AC40C1 /* zexall.com in Resources */,
|
||||
4BB299521B587D8400A49093 /* eoray in Resources */,
|
||||
4BB299411B587D8400A49093 /* cpyb in Resources */,
|
||||
4BB299A61B587D8400A49093 /* phan in Resources */,
|
||||
@ -2573,6 +2580,7 @@
|
||||
4BEF6AAC1D35D1C400E73575 /* DPLLTests.swift in Sources */,
|
||||
4B3BA0CF1D318B44005DD7A7 /* MOS6522Bridge.mm in Sources */,
|
||||
4BC751B21D157E61006C31D9 /* 6522Tests.swift in Sources */,
|
||||
4BFCA12B1ECBE7C400AC40C1 /* ZexallTests.swift in Sources */,
|
||||
4BB2A9AF1E13367E001A5C23 /* CRCTests.mm in Sources */,
|
||||
4B3BA0D01D318B44005DD7A7 /* MOS6532Bridge.mm in Sources */,
|
||||
4B3BA0C31D318AEC005DD7A7 /* C1540Tests.swift in Sources */,
|
||||
|
@ -13,7 +13,7 @@ typedef NS_ENUM(NSInteger, CSTestMachineZ80Register) {
|
||||
CSTestMachineZ80RegisterStackPointer,
|
||||
};
|
||||
|
||||
@interface TestMachineZ80 : NSObject
|
||||
@interface CSTestMachineZ80 : NSObject
|
||||
|
||||
- (void)setData:(NSData *)data atAddress:(uint16_t)startAddress;
|
||||
- (void)runForNumberOfCycles:(int)cycles;
|
||||
|
@ -16,7 +16,7 @@ static CPU::Z80::Register registerForRegister(CSTestMachineZ80Register reg) {
|
||||
}
|
||||
}
|
||||
|
||||
@implementation TestMachineZ80 {
|
||||
@implementation CSTestMachineZ80 {
|
||||
CPU::Z80::AllRAMProcessor _processor;
|
||||
}
|
||||
|
||||
|
@ -195,7 +195,6 @@ class WolfgangLorenzTests: XCTestCase, CSTestMachine6502JamHandler {
|
||||
|
||||
fileprivate var output: String = ""
|
||||
fileprivate func runWolfgangLorenzTest(_ name: String) {
|
||||
|
||||
var machine: CSTestMachine6502!
|
||||
|
||||
if let filename = Bundle(for: type(of: self)).path(forResource: name, ofType: nil) {
|
||||
@ -298,7 +297,6 @@ class WolfgangLorenzTests: XCTestCase, CSTestMachine6502JamHandler {
|
||||
}
|
||||
|
||||
func testMachine(_ machine: CSTestMachine6502!, didJamAtAddress address: UInt16) {
|
||||
|
||||
switch address {
|
||||
case 0xffd2:
|
||||
machine.setValue(0x00, forAddress: 0x030c)
|
||||
|
26
OSBindings/Mac/Clock SignalTests/ZexallTests.swift
Normal file
26
OSBindings/Mac/Clock SignalTests/ZexallTests.swift
Normal file
@ -0,0 +1,26 @@
|
||||
//
|
||||
// ZexallTests.swift
|
||||
// Clock Signal
|
||||
//
|
||||
// Created by Thomas Harte on 16/05/2017.
|
||||
// Copyright © 2017 Thomas Harte. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import Foundation
|
||||
|
||||
class ZexallTests: XCTestCase {
|
||||
|
||||
func testZexall() {
|
||||
if let filename = Bundle(for: type(of: self)).path(forResource: "zexall", ofType: "com") {
|
||||
if let testData = try? Data(contentsOf: URL(fileURLWithPath: filename)) {
|
||||
|
||||
let machine = CSTestMachineZ80()
|
||||
machine.setData(testData, atAddress: 0x0100)
|
||||
|
||||
machine.runForNumber(ofCycles: 20)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -71,9 +71,19 @@ enum BusOperation {
|
||||
};
|
||||
|
||||
struct MachineCycle {
|
||||
BusOperation operation;
|
||||
const BusOperation operation;
|
||||
const uint16_t *address;
|
||||
uint8_t *value;
|
||||
uint8_t *const value;
|
||||
|
||||
inline int cycle_length() const {
|
||||
static const int cycles_by_bus_operation[6] = {
|
||||
4,
|
||||
3, 3,
|
||||
3, 3,
|
||||
3
|
||||
};
|
||||
return cycles_by_bus_operation[operation];
|
||||
}
|
||||
};
|
||||
|
||||
struct MicroOp {
|
||||
@ -110,13 +120,6 @@ template <class T> class Processor: public MicroOpScheduler<MicroOp> {
|
||||
|
||||
uint8_t operation_;
|
||||
|
||||
constexpr static int cycles_by_bus_operation[6] = {
|
||||
4,
|
||||
3, 3,
|
||||
3, 3,
|
||||
3
|
||||
};
|
||||
|
||||
public:
|
||||
/*!
|
||||
Runs the Z80 for a supplied number of cycles.
|
||||
@ -135,12 +138,12 @@ template <class T> class Processor: public MicroOpScheduler<MicroOp> {
|
||||
};
|
||||
schedule_program(fetch_decode_execute);
|
||||
|
||||
MicroOp *operation = &scheduled_programs_[schedule_programs_read_pointer_][schedule_program_program_counter_];
|
||||
const MicroOp *operation = &scheduled_programs_[schedule_programs_read_pointer_][schedule_program_program_counter_];
|
||||
number_of_cycles_ += number_of_cycles;
|
||||
while(1) {
|
||||
switch(operation->type) {
|
||||
case MicroOp::BusOperation:
|
||||
if(number_of_cycles_ < cycles_by_bus_operation[operation->type]) {
|
||||
if(number_of_cycles_ < operation->machine_cycle.cycle_length()) {
|
||||
return;
|
||||
}
|
||||
perform_machine_cycle(&operation->machine_cycle);
|
||||
@ -168,6 +171,7 @@ template <class T> class Processor: public MicroOpScheduler<MicroOp> {
|
||||
void flush() {}
|
||||
|
||||
int perform_machine_cycle(const MachineCycle *cycle) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
Loading…
x
Reference in New Issue
Block a user