Skip to content

Commit

Permalink
fix nmi handler crash
Browse files Browse the repository at this point in the history
  • Loading branch information
cornelk committed May 30, 2024
1 parent 39e32ad commit ce69a0c
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions internal/disasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,10 @@ func (dis *Disasm) initializeIrqHandlers() {
if nmi != 0 {
dis.logger.Debug("NMI handler", log.String("address", fmt.Sprintf("0x%04X", nmi)))
offsetInfo := dis.mapper.offsetInfo(nmi)
offsetInfo.Label = "NMI"
offsetInfo.SetType(program.CallDestination)
if offsetInfo != nil {
offsetInfo.Label = "NMI"
offsetInfo.SetType(program.CallDestination)
}
dis.handlers.NMI = "NMI"
}

Expand All @@ -214,13 +216,15 @@ func (dis *Disasm) initializeIrqHandlers() {
if irq != 0 {
dis.logger.Debug("IRQ handler", log.String("address", fmt.Sprintf("0x%04X", irq)))
offsetInfo = dis.mapper.offsetInfo(irq)
if offsetInfo.Label == "" {
offsetInfo.Label = "IRQ"
dis.handlers.IRQ = "IRQ"
} else {
dis.handlers.IRQ = offsetInfo.Label
if offsetInfo != nil {
if offsetInfo.Label == "" {
offsetInfo.Label = "IRQ"
dis.handlers.IRQ = "IRQ"
} else {
dis.handlers.IRQ = offsetInfo.Label
}
offsetInfo.SetType(program.CallDestination)
}
offsetInfo.SetType(program.CallDestination)
}

if nmi == reset {
Expand Down

0 comments on commit ce69a0c

Please sign in to comment.