1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-26 15:32:04 +00:00

Extended to BITs and SETs, accruing three new failures.

This commit is contained in:
Thomas Harte 2017-06-19 21:01:30 -04:00
parent f903408980
commit 378233f53d

View File

@ -773,4 +773,96 @@ class Z80MachineCycleTests: XCTestCase {
]
)
}
// RLD
func testRLD() {
test(
program: [0xed, 0x6f],
busCycles: [
MachineCycle(operation: .readOpcode, length: 4),
MachineCycle(operation: .readOpcode, length: 4),
MachineCycle(operation: .read, length: 3),
MachineCycle(operation: .internalOperation, length: 4),
MachineCycle(operation: .write, length: 3),
]
)
}
// BIT n,r
func testBITr() {
test(
program: [0xcb, 0x40],
busCycles: [
MachineCycle(operation: .readOpcode, length: 4),
MachineCycle(operation: .readOpcode, length: 4),
]
)
}
// SET n,r
func testSETr() {
test(
program: [0xcb, 0xc0],
busCycles: [
MachineCycle(operation: .readOpcode, length: 4),
MachineCycle(operation: .readOpcode, length: 4),
MachineCycle(operation: .read, length: 4),
MachineCycle(operation: .write, length: 3),
]
)
}
// BIT n,(HL)
func testBITHL() {
test(
program: [0xcb, 0x46],
busCycles: [
MachineCycle(operation: .readOpcode, length: 4),
MachineCycle(operation: .readOpcode, length: 4),
MachineCycle(operation: .read, length: 4),
]
)
}
// SET n,(HL)
func testSETHL() {
test(
program: [0xcb, 0xc6],
busCycles: [
MachineCycle(operation: .readOpcode, length: 4),
MachineCycle(operation: .readOpcode, length: 4),
MachineCycle(operation: .read, length: 4),
MachineCycle(operation: .write, length: 3),
]
)
}
// BIT n,(IX+d)
func testBITIX() {
test(
program: [0xdb, 0xcb, 0x00, 0x46],
busCycles: [
MachineCycle(operation: .readOpcode, length: 4),
MachineCycle(operation: .readOpcode, length: 4),
MachineCycle(operation: .read, length: 3),
MachineCycle(operation: .readOpcode, length: 5),
MachineCycle(operation: .read, length: 4),
]
)
}
// SET n,(IX+d)
func testSETIX() {
test(
program: [0xdb, 0xcb, 0x00, 0xc6],
busCycles: [
MachineCycle(operation: .readOpcode, length: 4),
MachineCycle(operation: .readOpcode, length: 4),
MachineCycle(operation: .read, length: 4),
MachineCycle(operation: .readOpcode, length: 5),
MachineCycle(operation: .read, length: 4),
MachineCycle(operation: .write, length: 3),
]
)
}
}