first public release
This commit is contained in:
19
r_register_prefix_tests.go
Normal file
19
r_register_prefix_tests.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package z80
|
||||
|
||||
import "testing"
|
||||
|
||||
// R must increment once per M1, including post-prefix opcode fetches.
|
||||
func TestR_Increments_On_DDCB(t *testing.T) {
|
||||
cpu, mem, _ := testCPU()
|
||||
cpu.IX = 0x2000
|
||||
mem.WriteByte(0x2001, 0x01)
|
||||
loadProgram(cpu, mem, 0x0000, 0xDD, 0xCB, 0x01, 0x06) // RLC (IX+1)
|
||||
cpu.R = 0
|
||||
r0 := cpu.R & 0x7F
|
||||
mustStep(t, cpu)
|
||||
r1 := cpu.R & 0x7F
|
||||
inc := int((r1 - r0) & 0x7F)
|
||||
if inc != 3 {
|
||||
t.Fatalf("R should increment by 3 M1 cycles (DD, CB, op), got %d", inc)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user