home *** CD-ROM | disk | FTP | other *** search
- ; INTERRUPT.ASM The assembler source listing of the INTERRUPT and
- ; INTERRUPTX routines.
- ;
- ; NOTE:
- ; THIS PROGRAM, ITS USE, OPERATION AND SUPPORT IS PROVIDED "AS
- ; IS," WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
- ; INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- ; MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
- ; ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THIS PROGRAM
- ; IS WITH THE USER. IN NO EVENT SHALL MICROSOFT BE LIABLE FOR ANY
- ; DAMAGES INCLUDING, WITHOUT LIMITATION, ANY LOST PROFITS, LOST
- ; SAVINGS OR OTHER INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
- ; FROM THE USE OR INABILITY TO USE SUCH PROGRAM, EVEN IF
- ; MICROSOFT HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
- ; OR FOR ANY CLAIM BY ANY OTHER PARTY.
- ;
- ; 15 october 1990
- ; Program written by Thom Bierenbroodspot
- ; Microsoft B.V.
- ; The Netherlands
-
- .model large,fortran
-
- .code
-
- INTERRUPT proc far
- push bp ;Save necessary registers that
- mov bp,sp ;will be altered
- push di
- push si
- push es
-
- mov bx,[bp+0ch] ;Get segment of inregs
- mov es,bx ;move segment in es
- mov si,[bp+0ah] ;Get offset of inregs
- mov cx,07h ;Number of registers to load
- mov bx,02h ;Replacement of offset index
-
- getregs:
- mov ax,es:[si] ;get value of ax from inregs and save
- push ax ;continue with bx,cx..flags
- add si,bx ;Adjust offset with replacement
- loop getregs
-
- ;get far address interrupt from vectortable
-
- ;get interrupt number
- mov bx,[bp+10h] ;Get segment of intnum
- mov es,bx ;move segment in es
- mov si,[bp+0eh] ;get offset of intnum
- mov bx,es:[si] ;get value of intnum
-
- ;adjust to offset in vectortable
- sal bx,1 ;ShiftL*2 for for 4 byte replacement in
- sal bx,1 ;vector table
-
- mov si,bx ;save in si
- xor bx,bx ;zero bx
- mov es,bx ;load 0 segment in es
- mov bx,es:[si] ;load offset of interrupt from table
- mov ax,bx ;save offset in ax
- mov bx,es:[si+2] ;load segment of interrupt from table
-
- ;and save far address on stack
- mov [bp+0eh],ax ;save offset on stack for use with call
- mov [bp+10h],bx ;save segment on stack for use with call
-
- popf ;load flags and registers
- pop di
- pop si
- pop dx
- pop cx
- pop bx
- pop ax
- pushf ;do the actual int x
- call dword ptr [bp+0eh]
-
- endprocint:
- pushf
- push di
- push si
- push dx
- push cx
- push bx
- push ax
- mov bx,[bp+08h] ;Get segment of outregs
- mov es,bx ;move segment in es
- mov si,[bp+06h] ;Get offset of outregs
-
- mov cx,07h ;Number of registers to save
- mov bx,02h ;Replacement for offset index
-
- saveregs:
- pop ax ;get value of ax and store it in outregs
- mov es:[si],ax ;continue with bx,cx..flags
- add si,bx ;Adjust offset with replacement
- loop saveregs
-
- pop es
- pop si ;restore values of saved registers
- pop di ;before returning from the procedure
- pop bp
- ret 12 ;and finish procedure
-
- INTERRUPT endp
-
- INTERRUPTX proc far
- push bp ;Save necessary registers that
- mov bp,sp ;will be altered
- push di
- push si
- push es
- push ds
-
- mov bx,[bp+0ch] ;Get segment of inregs
- mov es,bx ;move segment in es
- mov si,[bp+0ah] ;Get offset of inregs
- mov cx,09h ;Number of registers to load
- mov bx,02h ;Replacement of offset index
-
- getregsX:
- mov ax,es:[si] ;get value of ax from inregs and save
- push ax ;continue with bx,cx..flags
- add si,bx ;Adjust offset with replacement
- loop getregsX
-
- ;get far address interrupt from vectortable
-
- ;get interrupt number
- mov bx,[bp+10h] ;Get segment of intnum
- mov es,bx ;move segment in es
- mov si,[bp+0eh] ;get offset of intnum
- mov bx,es:[si] ;get value of intnum
-
- ;adjust to offset in vectortable
- sal bx,1 ;ShiftL*2 for for 4 byte replacement in
- sal bx,1 ;vector table
-
- mov si,bx ;save in si
- xor bx,bx ;zero bx
- mov es,bx ;load 0 segment in es
- mov bx,es:[si] ;load offset of interrupt from table
- mov ax,bx ;save offset in ax
- mov bx,es:[si+2] ;load segment of interrupt from table
-
- ;and save far address on stack
- mov [bp+0eh],ax ;save offset on stack for use with call
- mov [bp+10h],bx ;save segment on stack for use with call
-
- popf ;load flags and registers
- pop ds
- pop es
- pop di
- pop si
- pop dx
- pop cx
- pop bx
- pop ax
- pushf ;do the actual int x
- call dword ptr [bp+0eh]
-
- ;end procedure
- pushf
- push ds
- push es
- push di
- push si
- push dx
- push cx
- push bx
- push ax
- mov bx,[bp+08h] ;Get segment of outregs
- mov es,bx ;move segment in es
- mov si,[bp+06h] ;Get offset of outregs
-
- mov cx,09h ;Number of registers to save
- mov bx,02h ;Replacement for offset index
-
- saveregsX:
- pop ax ;get value of ax and store it in outregs
- mov es:[si],ax ;continue with bx,cx..flags
- add si,bx ;Adjust offset with replacement
- loop saveregsX
-
- pop ds
- pop es
- pop si ;restore values of saved registers
- pop di ;before returning from the procedure
- pop bp
- ret 12 ;and finish procedure
-
- INTERRUPTX endp
-
- end
-