apple2-go/cmd/disasm.go
2018-05-11 10:03:21 +01:00

37 lines
647 B
Go

package main
import (
"flag"
"mos6502go/cpu"
"mos6502go/mmu"
"mos6502go/utils"
)
func main() {
startString := flag.String("start", "", "Start address")
endString := flag.String("end", "", "End address")
flag.Parse()
startAddress := utils.DecodeCmdLineAddress(startString)
endAddress := utils.DecodeCmdLineAddress(endString)
if startAddress == nil {
panic("Must include -start")
}
if endAddress == nil {
e := uint16(0xffff)
endAddress = &e
}
cpu.InitInstructionDecoder()
mmu.InitApple2eROM()
cpu.State.PC = *startAddress
for cpu.State.PC <= *endAddress {
cpu.PrintInstruction(false)
cpu.AdvanceInstruction()
}
}