diff --git a/OSBindings/Mac/Clock SignalTests/Bridges/TestMachine6502.h b/OSBindings/Mac/Clock SignalTests/Bridges/TestMachine6502.h index bf08b825c..fa3b379f5 100644 --- a/OSBindings/Mac/Clock SignalTests/Bridges/TestMachine6502.h +++ b/OSBindings/Mac/Clock SignalTests/Bridges/TestMachine6502.h @@ -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; diff --git a/OSBindings/Mac/Clock SignalTests/Bridges/TestMachine6502.mm b/OSBindings/Mac/Clock SignalTests/Bridges/TestMachine6502.mm index 4d567cd53..ae7768f8b 100644 --- a/OSBindings/Mac/Clock SignalTests/Bridges/TestMachine6502.mm +++ b/OSBindings/Mac/Clock SignalTests/Bridges/TestMachine6502.mm @@ -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(); } diff --git a/OSBindings/Mac/Clock SignalTests/NeskellTests.swift b/OSBindings/Mac/Clock SignalTests/NeskellTests.swift index 82981e11c..523bb5170 100644 --- a/OSBindings/Mac/Clock SignalTests/NeskellTests.swift +++ b/OSBindings/Mac/Clock SignalTests/NeskellTests.swift @@ -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])); } } }