home *** CD-ROM | disk | FTP | other *** search
- small_m = 1
- mach386 = 1
- GOC = 0
- include model
- cseg callint_
- ; {*********************************************************************
- ; (C) Copyright 1986-1992; Franklin L. DeRemer, Thomas J. Pennello,
- ; MetaWare Incorporated; Santa Cruz, CA 95060.
- ; This program is the unpublished property and trade secret of the above
- ; three. It is to be utilized solely under license from MetaWare and it
- ; is to be maintained on a confidential basis for internal company use
- ; only. The security and protection of the program is paramount to
- ; maintenance of the trade secret status. It is to be protected from
- ; disclosure to unauthorized parties, both within the Licensee company
- ; and outside, in a manner not less stringent than that utilized for Li-
- ; censee's own proprietary internal information. No copies of the
- ; Source or Object Code are to leave the premises of Licensee's business
- ; except in strict accordance with the license agreement signed by Li-
- ; censee with MetaWare.
- ; *********************************************************************}
- ;
- ; MetaWare Pascal Runtime Support: DOS Interface.
- ;
- _MWDOSREGS segment dword common 'DATA'
- Rax dd 0
- Rbx dd 0
- Rcx dd 0
- Rdx dd 0
- Rsi dd 0
- Rdi dd 0
- Rds dd 0
- Res dd 0
- Flags dw 0
- _MWDOSREGS ends
-
- DGROUP group _MWDOSREGS
-
- ; This is almost identical to DOS.ASM.
-
- CALLINT proc far ; Call an arbitrary interrupt.
- ; Callint(n) constructs an "int n" instruction and executes it, after
- ; loading the registers from the global register record.
- ; THIS WILL NOT WORK on a 286 in virtual mode.
- ; We couldn't fake it anyway since in the latter case INT must go
- ; through the 286's IDT.
- ; This works for the time being on a 386 in protected mode ONLY WHEN
- ; CS and DS point to the same area, as they do for Softguard and Phar Lap.
- ; What about A.I. Architects OS/386?
- publab callint
- push ebp
- mov ebp,esp
- push esi
- push edi
- push ebx
- parms <<Int_level,byte>>
- mov al,Int_level
- mov esi,offset int_number
- mov [esi],al
- ; mov cs:int_number,al
- push ds
- push es ; Save es in case we're in small_data mode.
- ASSUME ds:DGROUP
- mov eax,Rax ; set ax..dx, si, di.
- mov ebx,Rbx
- mov ecx,Rcx
- mov edx,Rdx
- mov esi,Rsi
- mov edi,Rdi
- push Res
- pop es ; Set es.
-
- push ds ; Save DS before call.
- push Rds
- pop ds ; set ds now.
- clc ; For int 21.
- int_number equ byte ptr $+1
- int 0dh ; call some interrupt.
- ; In case the poke fails, 0dh traps in os386.
-
- continue: pop ebp ; Old value of DS; BP IS NOW DESTROYED!!
- push ds ; save returned DS.
- mov ds,bp ; DS is now restored.
- pop Rds ; pop ds.
-
- push es
- pop Res
- mov Rax,eax
- mov Rbx,ebx
- mov Rcx,ecx
- mov Rdx,edx
- mov Rsi,esi
- mov Rdi,edi
- pushf
- pop Flags
- ; Now we've moved all results into register table.
- pop es
- pop ds
-
- pop ebx
- pop edi
- pop esi
- pop ebp
-
- return Word_size
- CALLINT endp
- endcseg callint_
- end
-