RichCini wrote:
BigDumbDinosaur wrote:
BTW, which microprocessor are you using?
The WDC 65C02 although the board will work with the plain-jane 6502. The ROM code doesn't use any 'C02-specific instructions and runs at 1MHz.
Just an opinion, but if I were you I would not suggest or otherwise encourage the use of the NMOS 6502. Why use hardware with known bugs and a weak fanout? If you stick to the 65C02, not only do you get away from the NMOS hardware issues, you get extra instructions that can make for more succinct programs. For example, in your interrupt handler preamble, you could directly push the X- and Y-registers without going through the accumulator, thus saving some clock cycles. Plus the 65C02 automatically reverts to binary mode when interrupted, which the NMOS part does not do if in BCD mode—this shortcoming has trapped many a programmer over the years.
Quote:
I guess there's no reason for me to use the VIA with either the DS1813 or the R-C/HC14 solution, but connecting it to the VIA saves an AND gate at the expense of additional code if other interrupts are used on that chip. The interrupt line of each I/O device (6551 and two 6522's) can be configured with a diode (cathode to the device). I guess this addresses the fact that they can't be wire-ORed on the WDC devices.
A fundamental tenet of computer circuit design is that a non-maskable interrupt is best reserved for one high priority event, for example incipient power failure—or a panic button. The use of NMI in a wired-OR configuration should be avoided unless there is a compelling reason to do otherwise.
As the NMI input is edge-sensitive, the MPU cannot tell that it has been interrupted more than once when NMI is involved. I discuss this in my 65C816 interrupts article—
see here for the details. The only thing connected to NMI in my POC unit is the "panic button." All other interrupts come in on IRQ.
Commodore used wired-OR on NMI in the VIC-20, C-64 and C-128 as a cost-containment measure, but introduced a booby-trap by virtue of NMIs being used for RS-232 processing. If the Restore key were hit at the exact instance that a 6522/6526 interrupt occurred, the 6502/6510/8502 couldn't tell if the NMI occurred because of a timer underflow, Restore keypress, or some other 6522/6526 event (e.g., a time-of-day clock alarm in the 6526). The default was to check for a timer underflow, which in the C-64 and C-128 occasionally tripped over yet another bug having to do with chip errata in the 6526. Oftentimes, it was necessary to patch into the NMI kernel code in order to sort out this mess in a satisfactory fashion.
Something else to consider is that if you vector your interrupt service routine so the programmer can patch into it to add features (e.g., to support new hardware), you need to be able to temporarily halt interrupt processing while the vector is being changed. With the 65(C)02, you can only change one byte of the vector address per instruction, which opens the door to a crash if an interrupt hits immediately after the first byte has been changed. If your interrupts are coming in on NMI, how would you temporarily tell the MPU to not respond to them until the vector has been changed? If you are using IRQ, it's easy, as all you need is to bracket the vector change instructions with SEI and CLI.
Quote:
If I don't use the VIA, there are 4 NMIB sources plus the "expansion buss" NMIB line.
See above.
Quote:
I don't think there is an 8-input AND gate (only NAND), so could I cascade the two 4-in AND gates in a 74LS21 with pull-ups on the remaining inputs? I really only have room on the board for one more LSXX chip.
You could. However, it's best to use 74AC or 74HC logic, not 74LS.