To demonstrate how to program an 8279, let us assume that the device is connected to a keyboard and multiple-digit display as shown in Fig.9-35, the 8279's addresses are FFE8 and FFE9, and the interrupt request pin IRQ is not used.
First, the device must be initialized by sending a mode set command to the control register.The following instructions set the keyboard/display controller to its encoded keyboard scan mode, with two-key lockout, and its left entry eight 8-bit displays mode:

                     MOV   DX,0FFE9H
                     MOV   AL,0
                     OUT   DX,AL
Then, characters generated by the depressed keys can be read through the FIFO memory.A program segment that uses programmed I/O to input eight keywords and store them in an 8-byte array KEYS with the first byte at the highest address is:
                     MOV   SI,8
                     MOV   DX,0FFE9H
                     MOV   AL,01000000B
                     OUT   DX,AL
            NEXT:    MOV   DX,0FFE9H
            IDLE:    IN    AL,DX
                     TEST  AL,0FH
                     JZ    IDLE
                     MOV   DX,0FFE8H
                     IN    AL,DX
                     MOV   KEYS[SI-1],AL
                     DEC   SI
                     JNZ   NEXT            

To display characters, the CPU must first give a write display memory command and then output to the display memory.The following instruction sequence displays eight seven-segment digits which are stored beginning at DIGITS with the least significant digit being stored at the low address:
                     MOV   SI,8
                     MOV   DX,0FFE9H
                     MOV   AL,10010000B
                     OUT   DX,AL
                     MOV   DX,0FFE8H
           AGAIN:    MOV   AL,DIGITS[SI-1]
                     OUT   DX,AL
                     DEC   SI
                     JNZ   AGAIN

PRETHODNA FOLIJA SADRZAJ SLEDECA FOLIJA