mirror of
https://github.com/freewilll/apple2-go.git
synced 2024-12-29 03:29:47 +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")
|
||||
flag.Parse()
|
||||
|
||||
startAddress := utils.DecodeCmdLineAddress(startString)
|
||||
endAddress := utils.DecodeCmdLineAddress(endString)
|
||||
start := utils.DecodeCmdLineAddress(startString)
|
||||
end := utils.DecodeCmdLineAddress(endString)
|
||||
|
||||
if startAddress == nil {
|
||||
if start == nil {
|
||||
panic("Must include -start")
|
||||
}
|
||||
|
||||
if endAddress == nil {
|
||||
if end == nil {
|
||||
e := uint16(0xffff)
|
||||
endAddress = &e
|
||||
end = &e
|
||||
}
|
||||
|
||||
cpu.InitInstructionDecoder()
|
||||
mmu.InitApple2eROM()
|
||||
|
||||
cpu.State.PC = *startAddress
|
||||
for cpu.State.PC <= *endAddress {
|
||||
cpu.PrintInstruction(false)
|
||||
cpu.AdvanceInstruction()
|
||||
}
|
||||
utils.Disassemble(*start, *end)
|
||||
}
|
||||
|
@ -851,7 +851,7 @@ func Run(showInstructions bool, breakAddress *uint16, exitAtBreak bool, disableF
|
||||
postProcessIncDec(addressMode)
|
||||
|
||||
default:
|
||||
fmt.Printf("Unknown opcode $%02x\n", opcode)
|
||||
fmt.Printf("Unknown opcode $%02x at %04x\n", opcode, State.PC)
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
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