home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c065 / 1.ddi / INCLUDE.ZIP / EMUVARS.ASI < prev    next >
Encoding:
Text File  |  1990-06-07  |  5.8 KB  |  235 lines

  1. ;[]-----------------------------------------------------------------[]
  2. ;|      Turbo-C Run Time Library        version 3.0                  |
  3. ;|                                                                   |
  4. ;|      Copyright (c) 1987, 1990 by Borland International Inc.       |
  5. ;|      All Rights Reserved.                                         |
  6. ;[]-----------------------------------------------------------------[]
  7.  
  8.  
  9. ;/* MODES: TAB 8 */
  10. ;    emuVars.asi
  11.  
  12. ;    This file is designed to be included both by the start-up
  13. ;    module (C0.asm, for TC) and by the emulator.  The data is
  14. ;    actually allocated in startup, and externally referenced
  15. ;    from the emulator.
  16.  
  17. ;    4/15/88 ah:
  18. ;    Modified for Turbo Pascal using _Pascal_ conditional.
  19. ;    7/13/88 Roger:
  20. ;    Data initialization removed, moved to emualor FINIT code.
  21. ;    Added Safety Stamp so debugger can detect emulator.
  22. ;    11 Sep 88 tjb:
  23. ;    Added emws_stackStyle, emws_unsigned, indirect shortcuts-88
  24. ;    16 Sep 88 tjb:
  25. ;    Added _TestaRossa_ evaluator stack
  26. ;    03 Jan 89 tjb
  27. ;    Changed EmuAssume for TR
  28. ;    25 Mar 89 Roger
  29. ;    variables put in __emu struct
  30. ;    26 Apr 89 Roger
  31. ;    remove data declarations
  32. ;    05 May 89 Roger
  33. ;    edited ASSUME for __emu
  34. ;    21 Jun 89 Roger
  35. ;    added protected mode flag
  36.  
  37.  
  38. ; The Use of Interrupt Vectors
  39.  
  40. ;    There are 11 interrupt vectors.  The first 8 map onto the 8 floating
  41. ;    point instruction patterns:
  42.  
  43. ;        {WAIT    ESC n } -->  INT (34h + n), where n is in (0..7)
  44.  
  45. ;    No segment prefixes may apply to these patterns.
  46.  
  47. ;    The ninth interrupt provides instructions with segment prefixes:
  48.  
  49. ;        {WAIT    ES: ESC n } --> INT (3Ch), byte (C0h + n)
  50. ;        {WAIT    CS: ESC n } --> INT (3Ch), byte (80h + n)
  51. ;        {WAIT    SS: ESC n } --> INT (3Ch), byte (40h + n)
  52. ;        {WAIT    DS: ESC n } --> INT (3Ch), byte (00h + n)
  53.  
  54.  
  55. ;    The tenth interrupt corresponds to the sequence NOP, FWAIT, and
  56. ;    is a no-op for emulation purposes.
  57.  
  58. ;    The eleventh interrupt provides Borland-defined shortcuts.
  59.  
  60.  
  61.  
  62. ;    Data space is actually allocated in the stack segment by C0.asm,
  63. ;    the start-up module, and accessed by the emulator via externs.
  64. ;    It is initialized during the first emulated FINIT instruction.
  65.  
  66.  
  67. IF _TestaRossa_
  68. ;    assumes defined in eval.asm
  69. ELSE
  70.     EmuAssume@    MACRO    aSeg
  71.         ASSUME    aSeg : SEG __emu
  72.     ENDM
  73. ENDIF
  74.  
  75. EmuNothing@    MACRO    aSeg
  76.     ASSUME    aSeg : NOTHING
  77. ENDM
  78.  
  79. ; See EMUVARS.H for C equivalents of these declarations.
  80.  
  81.  
  82. ; An iNDP_image is put into memory by the FSTENV instruction.
  83.  
  84. iNDP_environ    STRUC
  85.     ndp_control    dw    ?
  86.     ndp_status    dw    ?
  87.     ndp_tags    dw    ?
  88.     ndp_ip        dw    ?
  89.     ndp_ip_opcode    dw    ?
  90.     ndp_dp        dw    ?
  91.     ndp_dptop    dw    ?
  92. iNDP_environ    ENDS
  93.  
  94.  
  95. fpu    struc
  96.  
  97. ;    The 80x87 present shortcuts use ws_status too.
  98. ws_status    dw    ?    ; result of comparisons
  99.  
  100. ; Variables used by emulator and '87 trap handler.
  101.  
  102. ; used for shadow mask if '87 present
  103. ws_control    dw    ?    ; processing options and exceptions.
  104.  
  105. ; used by trap handler if '87 present
  106. ws_adjust    dw    ?    ; adjusts TOS at exit
  107. ws_8087        db    ?    ; same as _8087
  108. ws_protected    db    ?    ; same as _protected
  109. ws_type        dw    ?    ; type of error, if fatal
  110. ws_LDT        dw    ?    ; same as _LDT
  111.  
  112. ; The stack.
  113. ws_TOS        dw    ?    ; current level of e87 register stack
  114. ws_lastSP    dw    ?    ; low end of stack
  115. ws_initSP    dw    ?    ; high end of stack
  116.  
  117. ; Variables used by '87 trap handler.
  118. environ    iNDP_environ    <>
  119. ecount1        dw    ?
  120. ecount2        dw    ?
  121. ws_status2    dw    ?
  122. fpx1        dt    ?
  123. fpsword        dw    ?
  124.  
  125. ;    The remaining data areas are not needed if an 87 chip is present.
  126.  
  127. ;ws_fixSeg    dw    ?    ; selector implied by segFix
  128. ws_BPsafe    dw    ?    ; keep BP --> userRegs here for safety.
  129. ws_stamp    dd    ?    ; after initialization, 'emu', 87h
  130. ws_version    dw    ?    ; 1 for TC2,TP5,Q2; 2 for TB2; 3 for TC3,TP6
  131. ws_stackStyle    db    ?    ; shortcuts-88 stack frame style
  132. ws_unsigned    db    ?    ; allows handling unsigned integers
  133.  
  134. IF _Strict87_
  135. ws_instrnPtr    dd    ?    ; used with error recovery
  136. ws_dataPtr    dd    ?    ; --------- " ------------
  137. ws_instruction     dw    ?    ; bytes swapped, used for error recovery
  138. ENDIF
  139.  
  140. ;    The vector save areas are overlayed by "emws_temp32" and
  141. ;    "emws_MBZ32" for shortcuts when the 80x87 is present.
  142. ;    These two MUST be contiguous.
  143.  
  144. ws_saveVector    dd    ?    ; prior contents of NMI vector
  145. ws_nmiVector    dd    ?    ; PC/AT error vector for 80x87 exceptions
  146.  
  147. ;    Indirect Shortcuts-88 entry table.  Maintain exact match to
  148. ;    the order in emuShtCt.asm and e87ShtCt.asm.
  149.  
  150. IF _shortcuts88_
  151.     __isc88table    label    DWORD
  152.     __ifp_ldxds    dd    ?
  153.     __ifp_ldxss    dd    ?
  154.     __ifp_ldxes    dd    ?
  155.     __ifp_ldxcs    dd    ?
  156.     __ifp_lddds    dd    ?
  157.     __ifp_lddes    dd    ?
  158.     __ifp_lddss    dd    ?
  159.     __ifp_ldint    dd    ?
  160.     __ifp_lduint    dd    ?
  161.     __ifp_ldlng1    dd    ?
  162.     __ifp_ldulng1    dd    ?
  163.     __ifp_lds1    dd    ?
  164.     __ifp_ldz    dd    ?
  165.     __ifp_ld1    dd    ?
  166.     __ifp_ldpi    dd    ?
  167.     __ifp_stps    dd    ?
  168.     __ifp_stplng    dd    ?
  169.     __ifp_stpuln    dd    ?
  170.     __ifp_stpuint    dd    ?
  171.     __ifp_stpint    dd    ?
  172.     __ifp_stpdes    dd    ?
  173.     __ifp_stpdds    dd    ?
  174.     __ifp_stpdss    dd    ?
  175.     __ifp_stpxes    dd    ?
  176.     __ifp_stpxds    dd    ?
  177.     __ifp_stpxss    dd    ?
  178.     __ifp_ldcw    dd    ?
  179.     __ifp_error    dd    ?
  180.     __ifp_neg    dd    ?
  181.     __ifp_divrv    dd    ?
  182.     __ifp_subrv    dd    ?
  183.     __ifp_sub    dd    ?
  184.     __ifp_mul    dd    ?
  185.     __ifp_div    dd    ?
  186.     __ifp_add    dd    ?
  187.     __ifp_sqr    dd    ?
  188.     __ifp_rndint    dd    ?
  189.     __ifp_sin    dd    ?
  190.     __ifp_cos    dd    ?
  191.     __ifp_tan    dd    ?
  192.     __ifp_atan    dd    ?
  193.     __ifp_log    dd    ?
  194.     __ifp_log2    dd    ?
  195.     __ifp_log10    dd    ?
  196.     __ifp_exp    dd    ?
  197.     __ifp_exp2    dd    ?
  198.     __ifp_exp10    dd    ?
  199.     __ifp_cmp    dd    ?
  200.     __ifp_tst    dd    ?
  201.     __ifp_push    dd    ?
  202.     __ifp_pop    dd    ?
  203.     __ifp_subds    dd    ?
  204.     __ifp_subes    dd    ?
  205.     __ifp_subss    dd    ?
  206.     __ifp_mulds    dd    ?
  207.     __ifp_mules    dd    ?
  208.     __ifp_mulss    dd    ?
  209.     __ifp_divds    dd    ?
  210.     __ifp_dives    dd    ?
  211.     __ifp_divss    dd    ?
  212.     __ifp_addds    dd    ?
  213.     __ifp_addes    dd    ?
  214.     __ifp_addss    dd    ?
  215.     __ifp_divrvds    dd    ?
  216.     __ifp_divrves    dd    ?
  217.     __ifp_divrvss    dd    ?
  218.     __ifp_subrvds    dd    ?
  219.     __ifp_subrves    dd    ?
  220.     __ifp_subrvss    dd    ?
  221.     IF _TBasic_
  222.     __ifp_ldlng2    dd    ?
  223.     __ifp_ldulng2    dd    ?
  224.     __ifp_lds2    dd    ?
  225.     ENDIF
  226. ENDIF ; _shortcuts88_
  227.  
  228. fpu    ends
  229.  
  230. ; size of emu_temp
  231. size_emu_temp    equ    12
  232.  
  233. ; The minimum size for the emulator stack.
  234. MinFpStack    equ    (17 * size_emu_temp)
  235.