RichCini wrote:
This is excellent! I'm actually using the 1813 for handling reset on the board (DS1813-10). I'll give this a try since I have a bunch of them, and there's space on the board for it.
Make sure you haven't forgotten what BDD said about NMI timing: "
If your only use for /NMI is to regain control when a program goes berserk...," because the delay introduced by the DS1813 may make that line nearly useless for anything else.
Quote:
Regarding Garth's comment...the commented-out code is right from the Commodore kernal ROM in the NMI handler (with the RS232 stuff removed), as is the SEI.
Everyone goofs once in a while--even them. Since it didn't cause any problems, it didn't get caught. It's redundant. Another possibility that comes to mind is that something else could branch to there so the program counter gets there without an actual interrupt; but that might cause problems at RTI time.
Quote:
Regarding the SEI, would disabling interrupts prevent the NMI code from being interrupted by an IRQ interrupt from another source?
The interrupt sequences already set the interrupt-disable flag, I, which affects only the IRQ input, not the NMI input. Interrupts on the IRQ\ pin are the only ones that are ignored while this bit is set. It does not affect NMI's or BRK's, but IRQ's are automatically ignored.
Quote:
Why would the commented-out code, which disables and re-enables the interrupts on that VIA, cause the system to go into lala land?
Because, as the comment on one of the lines says, you disable all VIA1 interrupts, then, two lines later, enable them again; so the NMI line goes up, and then back down; and since it's non-maskable, and the CA1 interrupt was not taken care of, that extra falling edge on NMI makes it enter the routine again. And again. And again. And again. I think you'll have to read port A to stop the problem.
Quote:
EDIT: Doesn't NMI also push the processor status word? So, jumping from the handler to the monitor leaves an extra byte on the stack, doesn't it?
Yes. That's why the ISR doesn't need extra instructions to save P.
Garth, the interrupts junkie.