[INTEL NAVIGATION HEADER]

AP-730 Interfacing the 82C59A to Intel 186 Family Processors Appendix B

AP-730 Interfacing the 82C59A to Intel 186 Family Processors

APPENDIX B
DESIGN CONSIDERATION TEST PROGRAM

This program assumes an implementation of the hardware workaround discussed in "Design Considerations for Cascaded
82C59As" on page 5.

You can download a copy of this file from Intel's application BBS. Using a terminal program and a modem, call 503-264-
7999 and respond to the system prompts.

Example B-1. Design Consideration Test Program (Sheet 1 of 7)

$MOD186

NAME _82C59_INTERFACE_ERRATA

PCB_BASE EQU 0FF00H

;INTERRUPT CONTROL REGISTERS

IMASK EQU PCB_BASE + 028H

I0CON EQU PCB_BASE + 038H

MPCS EQU PCB_BASE + 0A8H

PACS EQU PCB_BASE + 0A4H

LED EQU 488H ;ADDRESS OF THE LED

EOI EQU 0FF22H

MASTER_TYPE EQU 32 ;BASE TYPE OF THE MASTER ICU

;PCS BASE ADDRESS AT 3FFH (DETERMINED BY iRISM CODE)

PCS4 EQU 600H ;LOWER BOUNDARY OF PCS4

EXT_PIC_P0 EQU PCS4 ;INTERRUPT CONTROL REGISTER

EXT_PIC_P1 EQU PCS4+2 ;INTERRUPT CONTROL REGISTER

PCSVAL_MSK EQU 03H ;CHIP SELECT VALUE WITH 3 WAIT STATES

CODE SEGMENT AT 0100H

ASSUME CS:CODE, DS:CODE

MAIN: CLI ;DISABLE INTERRUPTS

CALL INITPCS ;INITIALIZE THE PERIPHERAL CHIP SELECT

CALL INITVECT ;INITIALIZE THE INTERRUPT VECTOR TABLE

CALL INITICU ;INITIALIZE THE INTERRUPT CONTROL UNIT

STI ;ENABLE INTERRUPTS

JMP $

;********************************************************************************

;INITIALIZES THE TIMER0 INTERRUPT VECTOR LOCATION

INITVECT PROC

XOR AX, AX ;CLEARS THE ACCUMULATOR

MOV DS, AX ;CLEARS THE DATA SEGMENT

;INITIALIZE THE INTERRUPT VECTOR

MOV DI, 255*4 ;USED FOR HARDWARE WORKAROUND

;255 BECAUSE WE HAVE PULLUPS ON THE DATABUS

MOV WORD PTR DS:[DI], OFFSET E_ISR ;POINTER TO THE CS LOCATION IN THE TABLE

MOV WORD PTR DS:[DI+2], SEG E_ISR ;POINTER TO THE IP LOCATION IN THE TABLE

RET

INITVECT ENDP

;********************************************************************************

E_ISR PROC

MOV DX, EXT_PIC_P0 ;THE OPERATION COMMAND WORD 3

;(POLL SEQUENCE)

MOV AX, 000CH ;POLL=1 AND D5:4=01

OUT DX, AL ;ISSUE POLL COMMAND

NOP

NOP

NOP

IN AL, DX ;THE 82C59A-2 DEPOSITS THE POLL STATUS BYTE

AND AL, 07H

TEST AL, 00H ;SEE IF HIGHEST PRIORITY (IR0) IS PENDING

JE ISR0 ;IF TRUE JUMP TO ISR0

TEST AL, 01H ;SEE IF IR1 IS PENDING

JE ISR1 ;IF TRUE JUMP TO ISR1

TEST AL, 02H ;SEE IF IR2 IS PENDING

JE ISR2 ;IF TRUE JUMP TO ISR2

TEST AL, 03H ;SEE IF IR3 IS PENDING

JE ISR3 ;IF TRUE JUMP TO ISR3

TEST AL, 04H ;SEE IF IR4 IS PENDING

JE ISR4 ;IF TRUE JUMP TO ISR4

TEST AL, 05H ;SEE IF IR5 IS PENDING

JE ISR5 ;IF TRUE JUMP TO ISR5

TEST AL, 06H ;SEE IF IR6 IS PENDING

JE ISR6 ;IF TRUE JUMP TO ISR6

JMP ISR7 ;IR7 MUST BE PENDING -> JUMP TO ISR7

IRET ;PRECAUTIONARY IRET (SHOULD NOT BE NEEDED)

E_ISR ENDP

;********************************************************************************

ISR0 PROC

;NOTE THAT AN EOI HAS TO BE ISSUED FOR BOTH THE 82C59A-2 AND THE 80C186XL's

;INTERNAL INTERRUPT CONTROL UNIT

MOV DX, LED ;TURN ON THE LED

MOV AL, 0FEH

OUT DX, AL

MOV DX, EXT_PIC_P0 ;ISSUE NON-SPECIFIC EOI FOR 82C59A-2

MOV AL, 20H

OUT DX, AL

MOV DX, EOI ; ISSUE NON-SPECIFIC EOI FOR 80C186XL

MOV AX, 8000H

OUT DX, AX

IRET ;RETURN FROM INTERRUPT SERVICE ROUTINE

ISR0 ENDP

;********************************************************************************

ISR1 PROC

MOV DX, LED ;TURN ON THE LED

MOV AL, 0FDH

OUT DX, AL

MOV DX, EXT_PIC_P0 ;ISSUE NON-SPECIFIC EOI FOR 82C59A-2

MOV AL, 20H

OUT DX, AL

MOV DX, EOI ;ISSUE NON-SPECIFIC EOI FOR 80C186XL

MOV AX, 8000H

OUT DX, AX

IRET ;RETURN FROM INTERRUPT SERVICE ROUTINE

ISR1 ENDP

;********************************************************************************

ISR2 PROC

MOV DX, LED ;TURN ON THE LED

MOV AL, 0FBH

OUT DX, AL

MOV DX, EXT_PIC_P0 ;ISSUE NON-SPECIFIC EOI FOR 82C59A-2

MOV AL, 20H

OUT DX, AL

MOV DX, EOI ;ISSUE NON-SPECIFIC EOI FOR 80C186XL

MOV AX, 8000H

OUT DX, AX

IRET ;RETURN FROM INTERRUPT SERVICE ROUTINE

ISR2 ENDP

;********************************************************************************

ISR3 PROC

MOV DX, LED ;TURN ON THE LED

MOV AL, 0F7H

OUT DX, AL

MOV DX, EXT_PIC_P0 ;ISSUE NON-SPECIFIC EOI FOR 82C59A-2

MOV AL, 20H

OUT DX, AL

MOV DX, EOI ;ISSUE NON-SPECIFIC EOI FOR 80C186XL

MOV AX, 8000H

OUT DX, AX

IRET ;RETURN FROM INTERRUPT SERVICE ROUTINE

ISR3 ENDP

;********************************************************************************

ISR4 PROC

MOV DX, LED ;TURN ON THE LED

MOV AL, 0EFH

OUT DX, AL

MOV DX, EXT_PIC_P0 ;ISSUE NON-SPECIFIC EOI FOR 82C59A-2

MOV AL, 20H

OUT DX, AL

MOV DX, EOI ;ISSUE NON-SPECIFIC EOI FOR 80C186XL

MOV AX, 8000H

OUT DX, AX

IRET ;RETURN FROM INTERRUPT SERVICE ROUTINE

ISR4 ENDP

;********************************************************************************

ISR5 PROC

MOV DX, LED ;TURN ON THE LED

MOV AL, 0DFH

OUT DX, AL

MOV DX, EXT_PIC_P0 ;ISSUE NON-SPECIFIC EOI FOR 82C59A-2

MOV AL, 20H

OUT DX, AL

MOV DX, EOI ;ISSUE NON-SPECIFIC EOI FOR 80C186XL

MOV AX, 8000H

OUT DX, AX

IRET ;RETURN FROM INTERRUPT SERVICE ROUTINE

ISR5 ENDP

;********************************************************************************

ISR6 PROC

MOV DX, LED ;TURN ON THE LED

MOV AL, 0BFH

OUT DX, AL

MOV DX, EXT_PIC_P0 ;ISSUE NON-SPECIFIC EOI FOR 82C59A-2

MOV AL, 20H

OUT DX, AL

MOV DX, EOI ;ISSUE NON-SPECIFIC EOI FOR 80C186XL

MOV AX, 8000H

OUT DX, AX

IRET ;RETURN FROM INTERRUPT SERVICE ROUTINE

ISR6 ENDP

;********************************************************************************

ISR7 PROC

MOV DX, LED ;TURN ON THE LED

MOV AL, 07FH

OUT DX, AL

MOV DX, EXT_PIC_P0 ;ISSUE NON-SPECIFIC EOI FOR 82C59A-2

MOV AL, 20H

OUT DX, AL

MOV DX, EOI ;ISSUE NON-SPECIFIC EOI FOR 80C186XL

MOV AX, 8000H

OUT DX, AX

IRET ;RETURN FROM INTERRUPT SERVICE ROUTINE

ISR7 ENDP

;********************************************************************************

INITICU PROC

;SETTING UP INTERNAL INTERRUPT CONTROLLER REGISTER FOR CASCADE MODE

MOV DX, I0CON ;INITIALIZE INTERRUPT 0 FOR CASCADING

MOV AX, 0037H ;SET CASCADE BIT, MAKE INT0 THE LOWEST PRIORITY

OUT DX, AX ;INITIALIZE TO CASCADE MODE

;INITIALIZING THE MASTER CONTROLLER

MOV DX, EXT_PIC_P0 ;INITIALIZATION COMMAND WORD 1 FOR THE SLAVE

MOV AL, 13H ;SET BIT TO INDICATE IT IS THE ONLY 8259

;IN THE SYSTEM

OUT DX, AL ;MOVE VALUE

MOV DX, EXT_PIC_P1 ;INITIALIZATION COMMAND WORD 2 FOR THE MASTER

MOV AL, MASTER_TYPE ;CAN BE ANY VALUE IN THIS EXAMPLE

OUT DX, AL

MOV DX, EXT_PIC_P1 ;INITIALIZATION COMMAND WORD 4 FOR THE MASTER

MOV AL, 01H ;8086 MODE, NO SFNM, NO AEOI, NO BUF

OUT DX, AL

MOV DX, EXT_PIC_P1 ;SETTING THE OPERATION COMMAND WORD 1 (MASK REG)

MOV AL, 00H ;UNMASK ALL OF THE INTERRUPT ON THE EXTERNAL MASTER

OUT DX, AL ;SET THE MASK REGISTER

MOV DX, IMASK ;UNMASK ONLY INT0

MOV AX, 00EDH ;CLEAR ONLY INTERRUPT 0

OUT DX, AX ;MASK ALL INTERRUPTS BUT INT0

RET ;RETURN FROM PROCEDURE

INITICU ENDP

;********************************************************************************

INITPCS PROC

MOV DX, MPCS ;INITIALIZE THE CHIP SELECT

IN AX, DX

OR AX, PCSVAL_MSK ;CHIP SELECT VALUE WITH 3 WAIT STATES

OUT DX, AX

RET ;RETURN FROM PROCEDURE

INITPCS ENDP

;********************************************************************************

CODE ENDS

END MAIN


Free Web Hosting



Legal Stuff © 1997 Intel Corporation