Interrupts and Peripheral Chips: the 8085 and 8086 Interrupts, 8259A, 8255, 8254 and 8251
Tap your card on an automatic fare gate at a metro rail station in Dhaka and watch what happens. The gate reads the card, checks the balance, deducts the fare, counts one more passenger, beeps and swings the flap open, all before you've finished your step. Behind that flap there is one small computer. It isn't doing these jobs in a fixed order, because it has no idea when the next passenger will tap. It is running a program, and the world keeps tapping it on the shoulder.
Three questions come out of this picture, and this chapter answers all three. How does a processor notice the tap, find the right routine in memory and then go back exactly to what it was doing? That's the first half: the interrupts of the 8085 and the 8086, and the 8259A chip that squeezes many requests into one. How does it read thirty switches and drive thirty lamps with so few wires? That's the 8255. And how does it count seconds, or send a byte down a long line to the control room, without the program counting and sending bit by bit? That's the 8254 timer and the 8251 serial chip.
By the end you'll be able to take the vector address of any 8085 or 8086 interrupt, build the SIM byte that opens only the interrupts you want, and follow the 8086 as it pushes three words and jumps through its table. You'll write the setup bytes of an 8259A and count how many chips a cascade needs. You'll work out control words for the 8255, including its handshake and bit set/reset modes, and for the 8254 timer, and you'll turn a frequency into a count. For the 8251 you'll compute the mode word, the speed of a serial line and the time one character takes.