Arthur 2 has much improved IRQ despatch methods; each source of interrupts is given a "device number", and you can set up you own "device driver" to receive only the interrupts from that device.

The device numbers (corresponding to the request bits in IOC) are:

PrinterBusy_DevNo 0

Ringing_DevNo       1
PrinterAck_DevNo 2
VSync_DevNo         3
(PowerOn_DevNo      4 - this should never be seen though!)
Timer0_DevNo        5
Timer1_DevNo        6
FIQDowngrade_DevNo 7
PFIQasIRQ_DevNo     8
Sound_DevNo         9
Serial_DevNo        10
WinnieIRQ_DevNo     11
DiscChanged_DevNo 12
Podule_DevNo        13
SerialTx_DevNo      14
SerialRx_DevNo      15

Device driver code is entered in IRQ mode, with r12 set to the desired value, r3 pointing at IOC, and r0-r3 and r12 corruptible. The interrupt should be serviced, and return done by MOV PC,r14.

Device claim/release

SWI OS_ClaimDeviceVector (&4B):
R0 = Device number
R1 = call address
R2 = R12 value
R0=PFIQ|PIRQ devno -> R3 = interrupt location

                       R4 = interrupt mask

This SWI sets up the given device driver, after stacking the previous driver. It also ensures that the given driver is not already anywhere in the list of drivers (i.e. it isn't the current driver, or any of the stacked drivers).

SWI OS_ReleaseDeviceVector (&4C):
R0 = Device number
R1 = call address
R2 = R12 value
R0=PFIQ|PIRQ devno -> R3 = interrupt location

                       R4 = interrupt mask

This removes the driver from the list of drivers for the given device.

When releasing the vector, the user should not disable the appropriate IRQ in IOC; this is done automatically by the MOS if nobody else is on the chain (i.e. nobody else wants to be that device driver).

Background FIQ processing

Arthur 2 allows FIQ to be claimed in the background. Unlike foreground FIQ claim, background claim may fail. If you receive Service_ClaimFIQinBackground (&47), you are the current FIQ owner, and you are not due to receive a FIQ, then the service should be claimed, after you have relinquished FIQ as usual.

Background claims are released by Service_ReleaseFIQ, as before.