mirror of
https://github.com/romychs/z80go.git
synced 2026-05-08 18:54:07 +03:00
Compare commits
3 Commits
ff2e10afdb
...
3b05332d28
| Author | SHA1 | Date | |
|---|---|---|---|
| 3b05332d28 | |||
| 16e7d1dfb6 | |||
| b8094cd1b3 |
3
cpu.go
3
cpu.go
@ -16,10 +16,9 @@ func NewCPU(core MemIoRW) *CPU {
|
|||||||
z.core = core
|
z.core = core
|
||||||
z.cycleCount = 0
|
z.cycleCount = 0
|
||||||
z.codeCoverageEnabled = false
|
z.codeCoverageEnabled = false
|
||||||
// z.codeCoverage = make(map[uint16]bool)
|
|
||||||
// z.memAccess =
|
// z.memAccess =
|
||||||
z.codeCoverageEnabled = false
|
z.codeCoverageEnabled = false
|
||||||
// z.codeCoverage map[uint16]bool
|
z.codeCoverage = map[uint16]bool{}
|
||||||
z.extendedStackEnabled = false
|
z.extendedStackEnabled = false
|
||||||
//z.extendedStack [65536]uint8
|
//z.extendedStack [65536]uint8
|
||||||
z.extendedStack = map[uint16]PushValueType{}
|
z.extendedStack = map[uint16]PushValueType{}
|
||||||
|
|||||||
@ -39,12 +39,12 @@ func (d *Disassembler) jp(op, cond string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (d *Disassembler) jr(op, cond string) string {
|
func (d *Disassembler) jr(op, cond string) string {
|
||||||
addr := d.pc
|
addr := d.pc + 1
|
||||||
offset := d.getByte()
|
offset := d.getByte()
|
||||||
if offset&0x80 != 0 {
|
if offset&0x80 != 0 {
|
||||||
addr += 0xFF00 | uint16(offset)
|
addr += 0xFF00 | uint16(offset)
|
||||||
} else {
|
} else {
|
||||||
addr += d.pc + uint16(offset)
|
addr += uint16(offset)
|
||||||
}
|
}
|
||||||
if cond != "" {
|
if cond != "" {
|
||||||
cond += sep
|
cond += sep
|
||||||
|
|||||||
@ -90,3 +90,25 @@ func Test_JP_nn(t *testing.T) {
|
|||||||
t.Errorf("Error disassm JP nn, result '%s', expected '%s'", res, expected)
|
t.Errorf("Error disassm JP nn, result '%s', expected '%s'", res, expected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var testJRf = []byte{0x28, 0x09} // JR Z,+9
|
||||||
|
|
||||||
|
func Test_JR_Z_nn(t *testing.T) {
|
||||||
|
expected := " 31EF JR Z, 0x31FA" // PC+2+9
|
||||||
|
setMemory(0x31EF, testJRf)
|
||||||
|
res := disasm.Disassm(0x31EF)
|
||||||
|
if res != expected {
|
||||||
|
t.Errorf("Error disassm JR Z,nn, result '%s', expected '%s'", res, expected)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var testJRb = []byte{0x18, 0xf1} // JR Z,+9
|
||||||
|
|
||||||
|
func Test_JR_mnn(t *testing.T) {
|
||||||
|
expected := " 31F8 JR 0x31EB" // JR back
|
||||||
|
setMemory(0x31F8, testJRb)
|
||||||
|
res := disasm.Disassm(0x31F8)
|
||||||
|
if res != expected {
|
||||||
|
t.Errorf("Error disassm JR -nn, result '%s', expected '%s'", res, expected)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user