2000-05-09 01:01:16 +02:00
|
|
|
; File:
|
|
|
|
; intr.asm
|
|
|
|
; Description:
|
|
|
|
; Assembly implementation of calling an interrupt
|
|
|
|
;
|
|
|
|
; Copyright (c) 2000
|
|
|
|
; Steffen Kaiser
|
|
|
|
; All Rights Reserved
|
|
|
|
;
|
|
|
|
; This file is part of FreeDOS.
|
|
|
|
;
|
|
|
|
; FreeDOS is free software; you can redistribute it and/or
|
|
|
|
; modify it under the terms of the GNU General Public License
|
|
|
|
; as published by the Free Software Foundation; either version
|
|
|
|
; 2, or (at your option) any later version.
|
|
|
|
;
|
|
|
|
; DOS-C is distributed in the hope that it will be useful, but
|
|
|
|
; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
|
|
|
|
; the GNU General Public License for more details.
|
|
|
|
;
|
|
|
|
; You should have received a copy of the GNU General Public
|
|
|
|
; License along with DOS-C; see the file COPYING. If not,
|
|
|
|
; write to the Free Software Foundation, 675 Mass Ave,
|
|
|
|
; Cambridge, MA 02139, USA.
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
%include "segs.inc"
|
|
|
|
|
2001-03-21 03:56:26 +01:00
|
|
|
segment HMA_TEXT
|
2000-05-09 01:01:16 +02:00
|
|
|
;
|
|
|
|
; void intr(nr, rp)
|
|
|
|
; REG int nr
|
|
|
|
; REG struct REGPACK *rp
|
|
|
|
;
|
|
|
|
;
|
|
|
|
global _intr
|
|
|
|
_intr:
|
|
|
|
push bp ; Standard C entry
|
|
|
|
mov bp,sp
|
|
|
|
push si
|
|
|
|
push di
|
|
|
|
push ds
|
|
|
|
push es
|
|
|
|
|
|
|
|
mov ax, [bp+4] ; interrupt number
|
|
|
|
mov [CS:intr?1-1], al
|
|
|
|
jmp short intr?2 ; flush the instruction cache
|
|
|
|
intr?2 mov bx, [bp+6] ; regpack structure
|
|
|
|
mov ax, [bx]
|
|
|
|
mov cx, [bx+4]
|
|
|
|
mov dx, [bx+6]
|
|
|
|
mov bp, [bx+8]
|
|
|
|
mov di, [bx+10]
|
|
|
|
mov si, [bx+12]
|
|
|
|
push Word [bx+14] ; ds
|
|
|
|
mov es, [bx+16]
|
|
|
|
mov bx, [bx+2]
|
|
|
|
pop ds
|
|
|
|
|
|
|
|
int 0
|
|
|
|
intr?1:
|
|
|
|
|
|
|
|
pushf
|
|
|
|
push ds
|
|
|
|
push bx
|
|
|
|
mov bx, sp
|
|
|
|
mov ds, [SS:bx+8]
|
|
|
|
mov bx, [ss:bx+20] ; address of REGPACK
|
|
|
|
mov [bx], ax
|
|
|
|
pop ax
|
|
|
|
mov [bx+2], ax
|
|
|
|
mov [bx+4], cx
|
|
|
|
mov [bx+6], dx
|
|
|
|
mov [bx+8], bp
|
|
|
|
mov [bx+10], di
|
|
|
|
mov [bx+12], si
|
|
|
|
pop ax
|
|
|
|
mov [bx+14], ax
|
|
|
|
mov [bx+16], es
|
|
|
|
pop ax
|
|
|
|
mov [bx+18], ax
|
|
|
|
|
|
|
|
pop es
|
|
|
|
pop ds
|
|
|
|
pop di
|
|
|
|
pop si
|
|
|
|
pop bp
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
2001-03-21 03:56:26 +01:00
|
|
|
global _int3
|
|
|
|
_int3:
|
|
|
|
int 3
|
|
|
|
retf
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
segment INIT_TEXT
|
|
|
|
;
|
|
|
|
; void init_call_intr(nr, rp)
|
|
|
|
; REG int nr
|
|
|
|
; REG struct REGPACK *rp
|
|
|
|
;
|
|
|
|
; same stuff as above, but in INIT_SEGMENT
|
|
|
|
global _init_call_intr
|
|
|
|
_init_call_intr:
|
|
|
|
push bp ; Standard C entry
|
|
|
|
mov bp,sp
|
|
|
|
push si
|
|
|
|
push di
|
|
|
|
push ds
|
|
|
|
push es
|
|
|
|
|
|
|
|
mov ax, [bp+4] ; interrupt number
|
|
|
|
mov [CS:init_intr?1-1], al
|
|
|
|
jmp short init_intr?2 ; flush the instruction cache
|
|
|
|
init_intr?2 mov bx, [bp+6] ; regpack structure
|
|
|
|
mov ax, [bx]
|
|
|
|
mov cx, [bx+4]
|
|
|
|
mov dx, [bx+6]
|
|
|
|
mov bp, [bx+8]
|
|
|
|
mov di, [bx+10]
|
|
|
|
mov si, [bx+12]
|
|
|
|
push Word [bx+14] ; ds
|
|
|
|
mov es, [bx+16]
|
|
|
|
mov bx, [bx+2]
|
|
|
|
pop ds
|
|
|
|
|
|
|
|
int 0
|
|
|
|
init_intr?1:
|
|
|
|
|
|
|
|
pushf
|
|
|
|
push ds
|
|
|
|
push bx
|
|
|
|
mov bx, sp
|
|
|
|
mov ds, [SS:bx+8]
|
|
|
|
mov bx, [ss:bx+20] ; address of REGPACK
|
|
|
|
mov [bx], ax
|
|
|
|
pop ax
|
|
|
|
mov [bx+2], ax
|
|
|
|
mov [bx+4], cx
|
|
|
|
mov [bx+6], dx
|
|
|
|
mov [bx+8], bp
|
|
|
|
mov [bx+10], di
|
|
|
|
mov [bx+12], si
|
|
|
|
pop ax
|
|
|
|
mov [bx+14], ax
|
|
|
|
mov [bx+16], es
|
|
|
|
pop ax
|
|
|
|
mov [bx+18], ax
|
|
|
|
|
|
|
|
pop es
|
|
|
|
pop ds
|
|
|
|
pop di
|
|
|
|
pop si
|
|
|
|
pop bp
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;
|
|
|
|
; int init_call_XMScall( (WORD FAR * driverAddress)(), WORD AX, WORD DX)
|
|
|
|
;
|
|
|
|
; this calls HIMEM.SYS
|
|
|
|
;
|
|
|
|
global _init_call_XMScall
|
|
|
|
_init_call_XMScall:
|
|
|
|
push bp
|
|
|
|
mov bp,sp
|
|
|
|
|
|
|
|
mov ax,[bp+8]
|
|
|
|
mov dx,[bp+10]
|
|
|
|
call far [bp+4]
|
|
|
|
|
|
|
|
pop bp
|
|
|
|
ret
|
|
|
|
|
|
|
|
|