Using Z80 Interupt Mode 2 ========================= The Z80 has three maskable interupt modes, 0, 1 and 2. When an interupt occurs in Interupt Mode 2 the CPU jumps via a vector in memory found by using the I register and the value on the databus at I*256+databus. On some platforms the databuse value is forced to a specific value so the interupt jumps via a known vector. However, on many platforms the database value floats when an interupt occurs, so the vector could be anywhere from I*256+0 to I*256+255. The workaround for this is to have a whole page full of identical bytes with the address of the interupt routine. It has to be 257 bytes as if the databus is &FF the the interupt will read from nnFF and mm00 from the next page. A typical arrangement is this: FDFD C3 01 FF JP &FF01 FE00 FD FD FD FD FILL 257,&FD etc FF00 FD FF01 IRQ code With I set to &FE then an interupt will read a vector from &FE00+n and &FE01+n, all the bytes are set to &FD, so regardless of the databus value the interupt will vector to &FDFD. There are three bytes there, just enough space for a jump to the actual interupt handler code. I typically put it straight after the jump table. Of course, you could put any other value in the table with a resultant different destination address, but it has to be an address where the high byte and the low byte are the same. If you fill the table with 257 x &FC bytes then it will jump to &FCFC. On the system I usually write code for, the "real" interupt vector is at &FFFE, so my hardware interupt handler is: FDFD C3 01 FF JP &FF01 FE00 FD FD FD FD FILL 257,&FD etc FF00 FD FF01 E5 PUSH HL ; Save HL FF02 2A FE FF LD HL,(&FFFE) ; Get IRQV FF05 E3 EX (SP),HL ; Restore HL, stack IRQV FF06 C9 RET ; Jump through IRQV or similarly: FAFA E5 PUSH HL ; Save HL FAFB 2A FE FF LD HL,(&FFFE) ; Get IRQV FAFE E3 EX (SP),HL ; Restore HL, stack IRQV FAFF C9 RET ; Jump through IRQV FB00 FA FA FA FA FILL 257,&FA etc FC00 FA See also: http://mdfs.net/Docs/Comp/Z80/IntMode2