Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

183 lines
3.2 KiB

  1. page ,132
  2. subttl emlstmp.asm - Load/Store Temp Real Numbers
  3. ;***
  4. ;emlstmp.asm - Load/Store Temp Real Numbers
  5. ;
  6. ; Copyright (c) 1986-89, Microsoft Corporation
  7. ;
  8. ;Purpose:
  9. ; Load/Store Temp Real Numbers
  10. ;
  11. ; This Module contains Proprietary Information of Microsoft
  12. ; Corporation and should be treated as Confidential.
  13. ;
  14. ;Revision History:
  15. ; See emulator.hst
  16. ;
  17. ;*******************************************************************************
  18. ProfBegin LSTMP
  19. ;*********************************************************************;
  20. ; ;
  21. ; Load 80 Bit Temp Real ;
  22. ; ;
  23. ;*********************************************************************;
  24. ;
  25. ; ES:SI: memory address of 80 bit tempreal
  26. pub eFLDtemp
  27. MOV edi,esi ; Get a new stack element and leave
  28. PUSHST
  29. XCHG edi,esi
  30. mov ax,es
  31. mov dx,ds
  32. mov es,dx
  33. mov ds,ax
  34. MVUS2DI ; Move 8 bytes of mantissa to TOS
  35. MVUS2DI
  36. MVUS2DI
  37. MVUS2DI
  38. mov ax,es
  39. mov dx,ds
  40. mov es,dx
  41. mov ds,ax
  42. LDUS2AX ; Fetch exponent
  43. SUB edi,8 ; Reset pointer to TOS
  44. XCHG esi,edi ; Now DS:SI points to TOS
  45. MOV DH,AH ; Exponent and Sign to DX
  46. AND DH,Sign ; Mask to Sign only
  47. MOV Flag[esi],DH
  48. AND AH,7FH ; Mask out sign
  49. XOR DH,DH ; Set Tag to valid non-zero
  50. CMP AX,IexpMax
  51. JE short TNANorInf
  52. CMP AX,IexpMin
  53. JE short TZeroOrDenorm
  54. SUB AX,IexpBias
  55. pub TStoreExpnTag
  56. MOV Expon[esi],AX
  57. MOV Tag[esi],DH
  58. RET
  59. pub TNANorInf
  60. MOV AX,IexpMax - IexpBias
  61. MOV DH,Special
  62. CMP MB6[esi],8000H ; Test for Infinity
  63. JNE short TStoreExpnTag
  64. MOV BP,MB4[esi]
  65. OR BP,MB2[esi]
  66. OR BP,MB0[esi]
  67. JNZ TStoreExpnTag
  68. OR DH,ZROorINF
  69. JMP TStoreExpnTag
  70. pub TZeroOrDenorm
  71. MOV BP,MB6[esi]
  72. OR BP,MB4[esi]
  73. OR BP,MB2[esi]
  74. OR BP,MB0[esi]
  75. JNZ short TDenormal
  76. pub TZero
  77. MOV AX,IexpMin - IexpBias
  78. MOV DH,ZROorINF
  79. JMP TStoreExpnTag
  80. pub TDenormal
  81. OR [CURerr],Underflow+Precision ; Say it underflowed - set it to 0
  82. XOR BP,BP
  83. MOV MB0[esi],BP
  84. MOV MB2[esi],BP
  85. MOV MB4[esi],BP
  86. MOV MB6[esi],BP
  87. JMP TZero
  88. PAGE
  89. ;*********************************************************************;
  90. ; ;
  91. ; Store 80 Bit Temp Real (& POP since only FSTP supported for temp) ;
  92. ; ;
  93. ;*********************************************************************;
  94. ;
  95. ; ES:SI: memory address of 80 bit tempreal
  96. pub TNANorINFST
  97. TEST BH,ZROorINF
  98. JNZ short TInfST
  99. pub TNANST
  100. MVSI2US ; copy mantissa
  101. MVSI2US
  102. MVSI2US
  103. MVSI2US
  104. MOV AX,IexpMax ; Set maximum mantissa
  105. OR AH,DH ; Overstore proper sign
  106. STAX2US
  107. POPST
  108. RET
  109. pub TInfST
  110. XOR AX,AX
  111. STAX2US
  112. STAX2US
  113. STAX2US
  114. MOV AX,8000H
  115. STAX2US
  116. MOV AX,IexpMax ; Set maximum mantissa
  117. OR AH,DH ; Overstore proper sign
  118. STAX2US
  119. POPST
  120. RET
  121. pub TSpecialST
  122. TEST BH,Special
  123. JNZ TNANorINFST
  124. pub TzeroST
  125. XOR AX,AX
  126. STAX2US
  127. STAX2US
  128. STAX2US
  129. STAX2US
  130. STAX2US
  131. POPST
  132. RET
  133. pub eFSTtemp
  134. MOV edi,esi
  135. MOV esi,[CURstk]
  136. MOV AX,Expon[esi] ; Adjust exponent of TOS
  137. ADD AX,IexpBias
  138. MOV DH,Flag[esi]
  139. if fastSP
  140. TEST DH,Single
  141. JZ TD1
  142. MOV word ptr MB0[esi],0
  143. MOV word ptr MB2[esi],0
  144. MOV byte ptr MB4[esi],0
  145. TD1:
  146. endif
  147. AND DH,Sign ; Mask to sign only
  148. OR AH,DH
  149. MOV BH,Tag[esi] ; See if it is a special case
  150. OR BH,BH
  151. JNZ TSpecialST
  152. MVSI2US ; Move Mantissa
  153. MVSI2US
  154. MVSI2US
  155. MVSI2US
  156. STAX2US ; Move Exponent & Sign
  157. SUB esi,8 ; Reset pointer to TOS
  158. POPSTsi
  159. RET
  160. ProfEnd LSTMP