ArticleslgStudy

science

Interrupts in 65xx processors

Interrupts in 65xx processors is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Interrupts in 65xx processors rather than just read about it. In short: The 65xx family of microprocessors, consisting of the MOS Technology 6502 and its derivatives, the WDC 65C02, WDC 65C802 and WDC 65C816, and CSG 65CE02, all handle interrupts in a similar fashion. There are three hardware interrupt signals common to all 65xx processors and one software interrupt, the BRK instruction.

Key takeaways

  • Interrupts in 65xx processors belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Interrupts in 65xx processors to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Interrupts in 65xx processors from memory before moving on to harder problems.

Reference excerpt

The 65xx family of microprocessors, consisting of the MOS Technology 6502 and its derivatives, the WDC 65C02, WDC 65C802 and WDC 65C816, and CSG 65CE02, all handle interrupts in a similar fashion. There are three hardware interrupt signals common to all 65xx processors and one software interrupt, the BRK instruction. The WDC 65C816 adds a fourth hardware interrupt—ABORT, useful for implementing virtual memory architectures—and the COP software interrupt instruction (also present in the 65C802), intended for use in a system with a coprocessor of some type (e.g., a floating-point processor).

Interrupt types

The hardware interrupt signals are all active low, and are as follows:

RESET a reset signal, level-triggered NMI a non-maskable interrupt, edge-triggered IRQ a maskable interrupt, level-triggered ABORT a special-purpose, non-maskable interrupt (65C816 only, see below), level-triggered The detection of a RESET signal causes the processor to enter a system initialization period of six clock cycles, after which it sets the interrupt request disable flag in the status register and loads the program counter with the values stored at the processor initialization vector ($00FFFC–$00FFFD) before commencing execution. If operating in native mode, the 65C816/65C802 are switched back to emulation mode and stay there until returned to native mode under software control.

The detection of an NMI or IRQ signal, as well as the execution of a BRK instruction, will cause the same overall sequence of events, which are, in order:

The processor completes the current instruction and updates registers or memory as required before responding to the interrupt. 65C816/65C802 when operating in native mode: The program bank register (PB, the A16-A23 part of the address bus) is pushed onto the hardware stack. The most significant byte (MSB) of the program counter (PC) is pushed onto the stack. The least significant byte (LSB) of the program counter is pushed onto the stack. The status register (SR) is pushed onto the stack. The interrupt disable flag is set in the status register. 65C816/65C802: PB is loaded with $00. PC is loaded from the relevant vector (see tables). The behavior of the 65C816 when ABORT is asserted differs in some respects from the above description and is separately discussed below. Note that the processor does not push the accumulator and index registers on to the stack—code in the interrupt handler must perform that task, as well as restore the registers at the termination of interrupt processing, as necessary. Also note that the vector for IRQ is the same as that for BRK in all eight bit 65xx processors, as well as in the 65C802/65C816 when operating in emulation mode. When operating in native mode, the 65C802/65C816 provide separate vectors for IRQ and BRK. When set, the interrupt request disable flag (the I bit in the status register) will disable detection of the IRQ signal, but will have no effect on any other interrupts (however, see below section on the WAI instruction implemented in WDC CMOS processors). Additionally, with the 65(c)02 or the 65C816/65C802 operating in emulation mode, the copy of the status register that is pushed on to the stack will have the B flag set if a BRK (software interrupt) was the cause of the interrupt, or cleared if an IRQ was the cause. Hence the interrupt service routine must retrieve a copy of the saved status register from where it was pushed onto the stack and check the status of the B flag in order to distinguish between an IRQ and a BRK. This requirement is eliminated when operating the 65C802/65C816 in native mode, due to the separate vectors for the two interrupt types.

ABORT interrupt The 65C816's ABORTB interrupt input is intended to provide the means to redirect program execution when a hardware exception is detected, such as a page fault or a memory access violation. Hence the processor's response when the ABORTB input is asserted (negated) is different from when IRQB and/or NMIB are asserted. Also, achieving correct operation in response to ABORTB requires that the interrupt occur at the proper time during the machine cycle, whereas no such requirement exists for IRQB or NMIB. When ABORTB is asserted during a valid memory cycle, that is, when the processor has asserted the VDA and/or VPA status outputs, the following sequence of events will occur:

The processor completes the current instruction but does not change the registers or memory in any way—the computational results of the completed instruction are discarded. An abort interrupt does not literally abort an instruction. The program bank (PB, see above) is pushed to the stack. The most significant byte (MSB) of the aborted instruction's address is pushed onto the stack. The least significant byte (LSB) of the aborted instruction's address is pushed onto the stack. The status register is pushed onto the stack. The interrupt disable flag is set in the status register. PB is loaded with $00. The program counter is loaded from the ABORT vector (see tables). As the address pushed to the stack is that of the aborted instruction rather than the contents of the program counter, executing an RTI (ReTurn from Interrupt) following an ABORT interrupt will cause the processor to return to the aborted instruction, rather than the next instruction, as would be the case with the other interrupts. In order for the processor to correctly respond to an abort, system logic must assert (negate) the ABORTB input as soon as a valid address has been placed on the bus and it has been determined that the address constitutes a page fault, memory access violation or other anomaly (e.g., attempted execution of a privileged instruction). Hence the logic must not assert ABORTB until the processor has asserted the VDA or VPA signals. Also, ABORTB must remain asserted until the fall of the phase-two clock and then be immediately released. If these timing constraints are not observed, the abort interrupt handler itself may be aborted, causing registers and/or memory to be changed in a possibly-undefined manner.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Interrupts in 65xx processors

Start with the simplest possible case. Write down what Interrupts in 65xx processors claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Interrupts in 65xx processors before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Interrupts in 65xx processors ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Interrupts in 65xx processors

In research
Interrupts in 65xx processors appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Interrupts in 65xx processors in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Interrupts in 65xx processors is common in secondary-school and first-year university syllabi. It links to neighbouring topics 65xx microprocessors, Interrupts, Machine code, so understanding it makes those chapters shorter.
In everyday life
Look for Interrupts in 65xx processors outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Interrupts in 65xx processors” →

How to study Interrupts in 65xx processors in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Interrupts in 65xx processors means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Interrupts in 65xx processors out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Interrupts in 65xx processors in simple terms?

The 65xx family of microprocessors, consisting of the MOS Technology 6502 and its derivatives, the WDC 65C02, WDC 65C802 and WDC 65C816, and CSG 65CE02, all handle interrupts in a similar fashion. There are three hardware interrupt signals common to all 65xx processors and one software interrupt, t…

Why does Interrupts in 65xx processors matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Interrupts in 65xx processors?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Interrupts in 65xx processors.

Tags

  • 65xx microprocessors
  • Interrupts
  • Machine code

Keep exploring