2015-07-17 00:15:30 +00:00
|
|
|
//
|
|
|
|
// Machine.h
|
2015-07-26 19:25:11 +00:00
|
|
|
// CLK
|
2015-07-17 00:15:30 +00:00
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 29/06/2015.
|
|
|
|
// Copyright © 2015 Thomas Harte. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
|
|
|
|
typedef NS_ENUM(NSInteger, CSTestMachineRegister) {
|
2015-07-31 00:51:32 +00:00
|
|
|
CSTestMachineRegisterLastOperationAddress,
|
|
|
|
CSTestMachineRegisterProgramCounter,
|
|
|
|
CSTestMachineRegisterStackPointer,
|
|
|
|
CSTestMachineRegisterFlags,
|
2015-08-13 00:55:23 +00:00
|
|
|
CSTestMachineRegisterA,
|
|
|
|
CSTestMachineRegisterX,
|
|
|
|
CSTestMachineRegisterY,
|
2015-07-17 00:15:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern const uint8_t CSTestMachineJamOpcode;
|
|
|
|
|
|
|
|
@class CSTestMachine;
|
|
|
|
@protocol CSTestMachineJamHandler <NSObject>
|
|
|
|
- (void)testMachine:(CSTestMachine *)machine didJamAtAddress:(uint16_t)address;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface CSTestMachine : NSObject
|
|
|
|
|
|
|
|
- (void)setData:(NSData *)data atAddress:(uint16_t)startAddress;
|
|
|
|
- (void)runForNumberOfCycles:(int)cycles;
|
|
|
|
|
|
|
|
- (void)setValue:(uint8_t)value forAddress:(uint16_t)address;
|
|
|
|
- (uint8_t)valueForAddress:(uint16_t)address;
|
|
|
|
- (void)setValue:(uint16_t)value forRegister:(CSTestMachineRegister)reg;
|
|
|
|
- (uint16_t)valueForRegister:(CSTestMachineRegister)reg;
|
|
|
|
|
2015-07-31 20:44:53 +00:00
|
|
|
//- (void)reset;
|
2015-07-17 00:15:30 +00:00
|
|
|
- (void)returnFromSubroutine;
|
|
|
|
|
|
|
|
@property (nonatomic, readonly) BOOL isJammed;
|
2015-08-13 00:06:56 +00:00
|
|
|
@property (nonatomic, readonly) uint32_t timestamp;
|
2015-07-17 00:15:30 +00:00
|
|
|
@property (nonatomic, weak) id <CSTestMachineJamHandler> jamHandler;
|
|
|
|
|
|
|
|
@end
|