1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-22 12:33:29 +00:00

Test stack result, pass first test.

This commit is contained in:
Thomas Harte 2023-09-21 10:00:26 -04:00
parent 797ce89a26
commit 5731ab75a6
3 changed files with 11 additions and 0 deletions

View File

@ -40,6 +40,7 @@ extern const uint8_t CSTestMachine6502JamOpcode;
- (nonnull instancetype)initWithProcessor:(CSTestMachine6502Processor)processor;
- (void)setData:(nonnull NSData *)data atAddress:(uint32_t)startAddress;
- (nonnull NSData *)dataAtAddress:(uint32_t)address length:(uint32_t)length;
- (void)runForNumberOfCycles:(int)cycles;
- (void)runForNumberOfInstructions:(int)instructions;

View File

@ -93,6 +93,12 @@ static CPU::MOS6502::Register registerForRegister(CSTestMachine6502Register reg)
_processor->set_data_at_address(startAddress, data.length, (const uint8_t *)data.bytes);
}
- (nonnull NSData *)dataAtAddress:(uint32_t)address length:(uint32_t)length {
NSMutableData *data = [[NSMutableData alloc] initWithLength:length];
_processor->get_data_at_address(address, length, (uint8_t *)data.mutableBytes);
return data;
}
- (BOOL)isJammed {
return _processor->is_jammed();
}

View File

@ -44,6 +44,10 @@ class NeskellTests: XCTestCase {
func testAHX_TAS_SHX_SHY() {
if let result = runTest(resource: "ahx_tas_shx_shy_test") {
XCTAssertEqual(result.value(for: .stackPointer), 0xf2)
let stackData = result.data(atAddress: 0x1f3, length: 0x200 - 0x1f3)
XCTAssertEqual(stackData,
Data([0x01, 0xC9, 0x01, 0x80, 0xC0, 0xE0, 0x01, 0x55, 0x80, 0x80, 0x01, 0x34, 0x10]));
}
}
}