APPENDIX A
REFERENCE DESIGN TEST PROGRAM
Example A-1 is a listing of the software used to test this design. This design was tested on a modified 80C186XL/EA
Evaluation Board. Any initialization code not shown was performed by the RISM firmware on the evaluation board.
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 A-1. Reference Design Test Program Listing (Sheet 1 of 7) $MOD186 NAME _82C59_INTERFACE 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 INT0_TYPE EQU MASTER_TYPE + 0 INT1_TYPE EQU MASTER_TYPE + 1 INT2_TYPE EQU MASTER_TYPE + 2 INT3_TYPE EQU MASTER_TYPE + 3 INT4_TYPE EQU MASTER_TYPE + 4 INT5_TYPE EQU MASTER_TYPE + 5 INT6_TYPE EQU MASTER_TYPE + 6 INT7_TYPE EQU MASTER_TYPE + 7 ;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 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 $ ;WAIT FOR INTERRUPT TO OCCUR ;******************************************************************************** ;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, INT0_TYPE*4 ;MOVE INTERRUPT VECTOR LOC INTO DI MOV WORD PTR DS:[DI], OFFSET ISR0 ;POINTER TO THE CS LOCATION IN THE TABLE MOV WORD PTR DS:[DI+2], SEG ISR0 ;POINTER TO THE IP LOCATION IN THE TABLE MOV DI, INT1_TYPE*4 ;MOVE INTERRUPT VECTOR LOC INTO DI MOV WORD PTR DS:[DI], OFFSET ISR1 ;POINTER TO THE CS LOCATION IN THE TABLE MOV WORD PTR DS:[DI+2], SEG ISR1 ;POINTER TO THE IP LOCATION IN THE TABLE MOV DI, INT2_TYPE*4 ;MOVE INTERRUPT VECTOR LOC INTO DI MOV WORD PTR DS:[DI], OFFSET ISR2 ;POINTER TO THE CS LOCATION IN THE TABLE MOV WORD PTR DS:[DI+2], SEG ISR2 ;POINTER TO THE IP LOCATION IN THE TABLE MOV DI, INT3_TYPE*4 ;MOVE INTERRUPT VECTOR LOC INTO DI MOV WORD PTR DS:[DI], OFFSET ISR3 ;POINTER TO THE CS LOCATION IN THE TABLE MOV WORD PTR DS:[DI+2], SEG ISR3 ;POINTER TO THE IP LOCATION IN THE TABLE MOV DI, INT4_TYPE*4 ;MOVE INTERRUPT VECTOR LOC INTO DI MOV WORD PTR DS:[DI], OFFSET ISR4 ;POINTER TO THE CS LOCATION IN THE TABLE MOV WORD PTR DS:[DI+2], SEG ISR4 ;POINTER TO THE IP LOCATION IN THE TABLE MOV DI, INT5_TYPE*4 ;MOVE INTERRUPT VECTOR LOC INTO DI MOV WORD PTR DS:[DI], OFFSET ISR5 ;POINTER TO THE CS LOCATION IN THE TABLE MOV WORD PTR DS:[DI+2], SEG ISR5 ;POINTER TO THE IP LOCATION IN THE TABLE MOV DI, INT6_TYPE*4 ;MOVE INTERRUPT VECTOR LOC INTO DI MOV WORD PTR DS:[DI], OFFSET ISR6 ;POINTER TO THE CS LOCATION IN THE TABLE MOV WORD PTR DS:[DI+2], SEG ISR6 ;POINTER TO THE IP LOCATION IN THE TABLE MOV DI, INT7_TYPE*4 ;MOVE INTERRUPT VECTOR LOC INTO DI MOV WORD PTR DS:[DI], OFFSET ISR7 ;POINTER TO THE CS LOCATION IN THE TABLE MOV WORD PTR DS:[DI+2], SEG ISR7 ;POINTER TO THE IP LOCATION IN THE TABLE RET INITVECT 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, 7FH 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, 0030H ;SET CASCADE BIT, MAKE INT0 THE HIGHEST 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 ;SET UP THE MASTER BASE TYPE --------------- 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
Legal Stuff © 1997 Intel Corporation