Identifying 6522 Internal Interrupt Sources from 6502 Applications
[Up to Source Code Repository]
Identifying One of 7 Possible Internal Interrupts for the 6522
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
IRQ(R) EN(R) |
T1 | T2 | CB1 | CB2 | SR | CA1 | CA2 |
Referring to the above figure, it can be seen that seven possible conditions may set an internal interupt in the IFR register of the 6522: T1, T2, CB1, CB2, RT, CA1, and CA2. If all of the internal resources of the 6522 are used simultaneously, as is often the case, then all possibilities should be checked. A simple program which will identify one out of 7 interrupts appears below:
ONEOF7 ASL A BMI TIMER1 ASL A BMI TIMER2 ASL A ...The program checks successively bit 6, bit 5, bit 4, etc., by simply shifting the contents of the accumulator left by one bit position every time. It should be noted that the order in which the shifts occur establish a priority of the interrupts within the device. Using the program as shown above, Timer 1 will have the highest priority, then Timer 2, etc. The user might want to asign different priorities to the interrupts by testing the bits in a different order.
Last page update: October 17, 2000.