home *** CD-ROM | disk | FTP | other *** search
- ; PARnet interrupt handler
- ; 03-JUN-93 <S.A.Pechler@bdk.tue.nl>
-
- .MODEL MEMMOD,C
- %MACS
-
- if @Datasize NE 0
- extrn parint:far
- else
- extrn parint:near
- endif
-
- .DATA
- extrn Isat:word
- Spsave dw ? ; Save location for SP during interrupts
- Sssave dw ? ; Save location for SS during interrupts
- Intstk dw 512 dup(?) ; Interrupt working stack
- Stktop equ $ ; SP set here when entering interrupt
-
-
- .CODE
- dbase dw @Data
-
- ; parvec - parnet interrupt handler
- public parvec
- if @Datasize NE 0
- label parvec far
- else
- label parvec near
- endif
-
- push ds ; save on user stack
- mov ds,cs:dbase ; establish interrupt data segment
-
- mov Sssave,ss ; stash user stack context
- mov Spsave,sp
-
- mov ss,cs:dbase
- lea sp,Stktop
-
- push ax ; save user regs on interrupt stack
- push bx
- push cx
- push dx
- push bp
- push si
- push di
- push es
-
- ; Re-arm 8259 interrupt controller(s)
- ; Should be called just after taking an interrupt, instead of just
- ; before returning. This is because the 8259 inputs are edge triggered, and
- ; new interrupts arriving during an interrupt service routine might be missed.
-
- cmp Isat,1
- jne @@1 ; Only one 8259, so skip this stuff
- mov al,0bh ; read in-service register from
- out 0a0h,al ; secondary 8259
- nop ; settling delay
- nop
- nop
- in al,0a0h ; get it
- or al,al ; Any bits set?
- jz @@1 ; nope, not a secondary interrupt
- mov al,20h ; Get EOI instruction
- out 0a0h,al ; Secondary 8259 (PC/AT only)
- @@1: mov al,20h ; 8259 end-of-interrupt command
- out 20h,al ; Primary 8259
-
- ; call user interrupt routine
-
- call parint ; user interrupt routine
-
- pop es
- pop di
- pop si
- pop bp
- pop dx
- pop cx
- pop bx
- pop ax
- mov ss,Sssave
- mov sp,Spsave ; restore original stack context
- pop ds
- iret
-
- end
-