IRQ is an interrupt request. Imagine if you're a worker and suddenly you receive a call from your boss saying that you should eat lunch now. After you eat it, obviously you will come back to your job normally. That's how IRQ works.
In the programming and hardware world, IRQ has various usages, like updating the clock and polling your mouse and keyboard on your computer for example.
Usually IRQs are used when the CPU have to do something instantly, so it's interrupted and forced to run a code that is timing important.
In SNES, IRQ has usually just two purposes:
- Interrupt the CPU when the screen reaches certain position at drawing (either on a specific scanline (V count) or a horizontal position (H count) or both).
- Interrupt the CPU when a cart asks so (a SA-1 cart for example gives SA-1 CPU the power to send a IRQ to the SNES as well vice-versa).
In SMW, the first case is used to update the layer 3 registers and it's trigged just after the status bar is displayed on screen (position #$25). It's also used on mode 7 battles to change the screen mode mid-screen. Hence why you still can see the status bar on each boss, because the screen starts on mode 1 and after the status bar an IRQ changes to mode 7.
IRQs on SNES, as well HDMA, can be used to change any H-blank register, at whatever times you want. It's basically a manual HDMA, because obviously you don't need to waste two or three HDMA channels just to update the layer 3 registers at certain screen position and nothing more.
For SA-1 Pack, IRQs are also used for another purpose. Both SA-1 and SNES can invoke IRQs against each other and I use it to tell one of the CPUs to run a specific code. SA-1 for example can interrupt the SNES to run a specific code that SA-1 can't run like writing to WRAM.
- SnesLab Discord