home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c221 / 5.ddi / MWHC.005 / S2 < prev    next >
Encoding:
Text File  |  1992-12-09  |  3.0 KB  |  108 lines

  1. small_m = 1
  2. mach386 = 1
  3. GOC = 0
  4.     include model
  5.     cseg    callint_
  6. ; {*********************************************************************
  7. ; (C) Copyright   1986-1992;  Franklin L. DeRemer,   Thomas J. Pennello,
  8. ;               MetaWare Incorporated;  Santa Cruz, CA 95060.
  9. ; This program is the unpublished property and trade secret of the above
  10. ; three.  It is to be utilized solely under license from MetaWare and it
  11. ; is to be maintained on a confidential basis for internal  company  use
  12. ; only.  The  security    and  protection  of  the program is paramount to
  13. ; maintenance of the trade secret status.  It is to  be  protected  from
  14. ; disclosure  to  unauthorized parties, both within the Licensee company
  15. ; and outside, in a manner not less stringent than that utilized for Li-
  16. ; censee's own proprietary  internal  information.   No  copies  of  the
  17. ; Source or Object Code are to leave the premises of Licensee's business
  18. ; except  in  strict accordance with the license agreement signed by Li-
  19. ; censee with MetaWare.
  20. ; *********************************************************************}
  21. ;
  22. ;  MetaWare Pascal Runtime Support: DOS Interface.
  23. ;
  24. _MWDOSREGS    segment dword common 'DATA'
  25. Rax        dd    0
  26. Rbx        dd    0
  27. Rcx        dd    0
  28. Rdx        dd    0
  29. Rsi        dd    0
  30. Rdi        dd    0
  31. Rds        dd    0
  32. Res        dd    0
  33. Flags        dw    0
  34. _MWDOSREGS    ends
  35.  
  36. DGROUP    group    _MWDOSREGS
  37.  
  38. ; This is almost identical to DOS.ASM.
  39.  
  40. CALLINT        proc    far    ; Call an arbitrary interrupt.
  41. ; Callint(n) constructs an "int n" instruction and executes it, after
  42. ; loading the registers from the global register record.
  43. ; THIS WILL NOT WORK on a 286 in virtual mode.
  44. ; We couldn't fake it anyway since in the latter case INT must go
  45. ; through the 286's IDT.
  46. ; This works for the time being on a 386 in protected mode ONLY WHEN
  47. ; CS and DS point to the same area, as they do for Softguard and Phar Lap.
  48. ; What about A.I. Architects OS/386?
  49.         publab    callint
  50.         push    ebp
  51.         mov    ebp,esp
  52.         push    esi
  53.         push    edi
  54.         push    ebx
  55.         parms    <<Int_level,byte>>
  56.         mov    al,Int_level
  57.         mov    esi,offset int_number
  58.         mov    [esi],al
  59. ;           mov    cs:int_number,al
  60.         push    ds
  61.         push    es    ; Save es in case we're in small_data mode.
  62.         ASSUME    ds:DGROUP
  63.         mov    eax,Rax    ; set ax..dx, si, di.
  64.         mov    ebx,Rbx
  65.         mov    ecx,Rcx
  66.         mov    edx,Rdx
  67.         mov    esi,Rsi
  68.         mov    edi,Rdi
  69.         push    Res
  70.         pop    es    ; Set es.
  71.  
  72.         push    ds    ; Save DS before call.
  73.         push    Rds
  74.         pop    ds    ; set ds now.
  75.         clc        ; For int 21.
  76. int_number equ byte ptr $+1
  77.         int    0dh     ; call some interrupt.
  78.                         ; In case the poke fails, 0dh traps in os386.
  79.         
  80. continue:       pop    ebp    ; Old value of DS; BP IS NOW DESTROYED!!
  81.         push    ds    ; save returned DS.
  82.         mov    ds,bp    ; DS is now restored.
  83.         pop    Rds    ; pop ds.
  84.  
  85.         push    es
  86.         pop    Res
  87.         mov    Rax,eax
  88.         mov    Rbx,ebx
  89.         mov    Rcx,ecx
  90.         mov    Rdx,edx
  91.         mov    Rsi,esi
  92.         mov    Rdi,edi
  93.         pushf
  94.         pop    Flags
  95.         ; Now we've moved all results into register table.
  96.         pop    es
  97.         pop    ds
  98.         
  99.         pop    ebx
  100.         pop    edi
  101.         pop    esi
  102.         pop    ebp
  103.         
  104.         return  Word_size
  105. CALLINT     endp
  106.         endcseg callint_
  107.         end
  108.