mirror of
https://github.com/freewilll/apple2-go.git
synced 2024-05-28 10:41:27 +00:00
Added Disassemble utils
This commit is contained in:
parent
c2163c8197
commit
a43fd7c08c
|
@ -13,24 +13,19 @@ func main() {
|
||||||
endString := flag.String("end", "", "End address")
|
endString := flag.String("end", "", "End address")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
startAddress := utils.DecodeCmdLineAddress(startString)
|
start := utils.DecodeCmdLineAddress(startString)
|
||||||
endAddress := utils.DecodeCmdLineAddress(endString)
|
end := utils.DecodeCmdLineAddress(endString)
|
||||||
|
|
||||||
if startAddress == nil {
|
if start == nil {
|
||||||
panic("Must include -start")
|
panic("Must include -start")
|
||||||
}
|
}
|
||||||
|
|
||||||
if endAddress == nil {
|
if end == nil {
|
||||||
e := uint16(0xffff)
|
e := uint16(0xffff)
|
||||||
endAddress = &e
|
end = &e
|
||||||
}
|
}
|
||||||
|
|
||||||
cpu.InitInstructionDecoder()
|
cpu.InitInstructionDecoder()
|
||||||
mmu.InitApple2eROM()
|
mmu.InitApple2eROM()
|
||||||
|
utils.Disassemble(*start, *end)
|
||||||
cpu.State.PC = *startAddress
|
|
||||||
for cpu.State.PC <= *endAddress {
|
|
||||||
cpu.PrintInstruction(false)
|
|
||||||
cpu.AdvanceInstruction()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -851,7 +851,7 @@ func Run(showInstructions bool, breakAddress *uint16, exitAtBreak bool, disableF
|
||||||
postProcessIncDec(addressMode)
|
postProcessIncDec(addressMode)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fmt.Printf("Unknown opcode $%02x\n", opcode)
|
fmt.Printf("Unknown opcode $%02x at %04x\n", opcode, State.PC)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,3 +60,15 @@ func RunUntilBreakPoint(t *testing.T, breakAddress uint16, seconds int, showInst
|
||||||
t.Fatalf("Did not reach breakpoint at %04x. Got to %04x", breakAddress, cpu.State.PC)
|
t.Fatalf("Did not reach breakpoint at %04x. Got to %04x", breakAddress, cpu.State.PC)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Disassemble(start uint16, end uint16) {
|
||||||
|
oldPC := cpu.State.PC
|
||||||
|
|
||||||
|
cpu.State.PC = start
|
||||||
|
for cpu.State.PC <= end {
|
||||||
|
cpu.PrintInstruction(false)
|
||||||
|
cpu.AdvanceInstruction()
|
||||||
|
}
|
||||||
|
|
||||||
|
cpu.State.PC = oldPC
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user