1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-11 08:30:55 +00:00

Added a quick snippet test, discovering that I've cut a cycle from read/modify/writes.

This commit is contained in:
Thomas Harte 2015-08-13 02:18:41 +01:00
parent 503d684af0
commit 975836c30f
2 changed files with 14 additions and 6 deletions

View File

@ -62,6 +62,14 @@ class TimingTests: XCTestCase, CSTestMachineJamHandler {
self.runTest(code, expectedRunLength: 14)
}
func testSnippet1() {
let code: [UInt8] = [
0x8d, 0x08, 0x00, // [4] STA $0008
0xc6, 0xb4, // [5] DEC $B4
CSTestMachineJamOpcode]
self.runTest(code, expectedRunLength: 9)
}
func runTest(code: [UInt8], expectedRunLength: UInt32) {
let machine = CSTestMachine()

View File

@ -147,7 +147,7 @@ template <class T> class Processor {
#define Read(op) CycleFetchOperandFromAddress, op
#define Write(op) op, CycleWriteOperandToAddress
#define ReadModifyWrite(...) CycleFetchOperandFromAddress, __VA_ARGS__, CycleWriteOperandToAddress
#define ReadModifyWrite(...) CycleFetchOperandFromAddress, CycleWriteOperandToAddress, __VA_ARGS__, CycleWriteOperandToAddress
#define AbsoluteRead(op) Program(Absolute, Read(op))
#define AbsoluteXRead(op) Program(AbsoluteX, Read(op))
@ -186,7 +186,7 @@ template <class T> class Processor {
#define ImpliedNop() {OperationMoveToNextProgram}
#define ImmediateNop() Program(OperationIncrementPC)
static const MicroOp operations[256][9] = {
static const MicroOp operations[256][10] = {
/* 0x00 BRK */ Program(CycleIncPCPushPCH, CyclePushPCL, OperationSetOperandFromFlagsWithBRKSet, CyclePushOperand, CycleSetIReadBRKLow, CycleReadBRKHigh),
/* 0x01 ORA x, ind */ IndexedIndirectRead(OperationORA),