sslit.asm
上传用户:xiaoan1112
上传日期:2013-04-11
资源大小:19621k
文件大小:3k
源码类别:

操作系统开发

开发平台:

Visual C++

  1. page ,132
  2. TITLE sslit - Scan Support for Literals
  3. ;***
  4. ;sslit - Scan Support for Literals
  5. ;
  6. ; Copyright <C> 1986, Microsoft Corporation
  7. ;
  8. ;Purpose:
  9. ;
  10. ;   Scan literal pcodes.
  11. ;   Literal scan routines mark their stack entries for two reasons:
  12. ; 1. At procedure call time literals always coerce when the definition
  13. ;    or declaration is available.  This means that users are not 
  14. ;    required to use an explicit type character when calling a declared 
  15. ;    or defined procedure.
  16. ; 2. For execution speed, I2 literals 0 through 10 are coerced to R4
  17. ;    by replacing the executor.
  18. ;
  19. ;
  20. ;****************************************************************************
  21. .xlist
  22. include version.inc
  23. IncludeOnce scanner
  24. IncludeOnce ssint
  25. IncludeOnce pcode
  26. IncludeOnce optables
  27. .list
  28. extrn exLitDI2:far
  29. assumes cs, SCAN
  30. assumes DS, DATA
  31. assumes es, NOTHING
  32. assumes ss, DATA
  33. sBegin SCAN
  34. ;***
  35. ;Ss_Lit - Scan Literals 
  36. ;
  37. ;Purpose:
  38. ;
  39. ;   Scan literal opcodes opLit...
  40. ;   Stack entries for literals indicate type and the fact that they
  41. ;   are literals.  This difference allows literals to be coerced
  42. ;   rather than typechecked in procedure invocations for procedures
  43. ;   that are declared.
  44. ;   Furthermore, opLit0 through opLit10 may be coerced from I2 to R4
  45. ;   by changing the opcode.
  46. ;
  47. ;Input:
  48. ;
  49. ;Output:
  50. ;
  51. ;************************************************************************
  52. mpLitI2OpExe label word
  53. DWEXT exLitI20
  54. I2Lit = 1 ;Next literal is one
  55. rept opLitI2Max
  56. DWEXT exLitI2%I2Lit ;;Generate table entry
  57. I2Lit = I2Lit + 1 ;;Bump literal value
  58. endm
  59. SsProc LitI2
  60. mov al,byte ptr es:[si-1] ; Get MSB of opcode
  61. and ax,HIGH (NOT OPCODE_MASK)
  62. .erre OPCODE_MASK EQ 03ffh ; Assure SHR is correct
  63. shr ax,1 ; AX = Literal value * 2
  64. xchg ax,bx ; AX = Opcode * 2, BX = Literal * 2
  65. mov bx,mpLitI2OpExe[bx] ; BX = Executor address
  66. xchg ax,bx ; AX = Executor, BX = Opcode * 2
  67. SKIP2_PSW ; Fall into scan routine below
  68. SsProc Lit
  69. ;Emit the executor
  70. call EmitExCopyOps ;Emit the executor and copy operands
  71. ;Make the stack entry
  72. push di ;FRAME: oTx of end of exp fragment
  73. mov al,mpOpRule[bx]  ;Type is in the rule table
  74. mov ah,al ;Type and flags in both bytes
  75. .errnz ST_Lit AND 0FFFh ; Assure literal flags in range
  76. .errnz ST_LitX AND 0FFFh ; Assure literal flags in range
  77. .erre ET_MAX LT 0fh ; Assure ET type in range
  78. and ax,0f00fh
  79. push ax ;FRAME: Type with literal bits
  80. ;Exit to the main loop
  81. jmp [ScanRet] ;Return to the current scan loop
  82. sEnd SCAN
  83. end