457 The user supplied event handling routine is entered with interrupts disabled and it should not enable interrupts. The routine should return ( RTS ) after a short period, say one millisecond maximum, and should preserve the processors P, A, X and Y registers. Interrupt handling The whole machine runs under continuous interrupts but nonetheless the user can easily add his or her own interrupts and handling routines. Because the machine runs under interrupts, software timing loops should not be used. Several hardware timers are available to the user and these should be used wherever possible. NMI – non-maskable interrupt In general these should be avoided.
When a disc filing system ROM is fitted NMIs will be handled by the ROM. Again, it should be emphasised that NMI is reserved for the operating system. When an IRQ is detected the operating system immediately indirects through location &204 (IRQ1V) to an operating system routine which handles all anticipated internal IRQS. If the operating system is unable to deal with the IRQ (because it has come from an unexpected device such as the user 6522), then the system indirects through &206 (IRQ2V). Thus the user routine for handling IRQs should normally be indirected via IRQ2V but if top priority is required the user routine can be indirected via IRQ1V.
IRQ - interrupt request In either case the user supplied routine must return control to the operating system routine to ensure clean handling.