Leaked source code of windows server 2003
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.

170 lines
3.8 KiB

  1. ;/*
  2. ; * Microsoft Confidential
  3. ; * Copyright (C) Microsoft Corporation 1988 - 1991
  4. ; * All Rights Reserved.
  5. ; */
  6. page 60,132
  7. name _parse
  8. title C to PARSER interface
  9. ;-------------------------------------------------------------------
  10. ;
  11. ; MODULE: _parse
  12. ;
  13. ; PURPOSE: Supplies an interface between C programs and
  14. ; the DOS 3.3 parser
  15. ;
  16. ; CALLING FORMAT:
  17. ; parse(&inregs,&outregs);
  18. ;
  19. ; DATE: 5-21-87
  20. ;
  21. ;-------------------------------------------------------------------
  22. ; extrn sysparse:far
  23. public _parse
  24. ;-------------------------------------------------------------------
  25. ;FarSW equ 0 ; make sysparse be a NEAR proc
  26. ;TimeSW equ 0 ; Check time format
  27. ;FileSW equ 0 ; Check file specification
  28. ;CAPSW equ 0 ; Perform CAPS if specified
  29. ;CmpxSW equ 0 ; Check complex list
  30. ;NumSW equ 1 ; Check numeric value
  31. ;KeySW equ 0 ; Support keywords
  32. ;SwSW equ 1 ; Support switches
  33. ;Val1SW equ 1 ; Support value definition 1
  34. ;Val2SW equ 1 ; Support value definition 2
  35. ;Val3SW equ 0 ; Support value definition 3
  36. ;DrvSW equ 0 ; Support drive only format
  37. ;QusSW equ 0 ; Support quoted string format
  38. ;-------------------------------------------------------------------
  39. _TEXT SEGMENT BYTE PUBLIC 'CODE'
  40. _TEXT ENDS
  41. _DATA SEGMENT WORD PUBLIC 'DATA'
  42. _DATA ENDS
  43. CONST SEGMENT WORD PUBLIC 'CONST'
  44. CONST ENDS
  45. _BSS SEGMENT WORD PUBLIC 'BSS'
  46. _BSS ENDS
  47. DGROUP GROUP CONST, _BSS, _DATA
  48. _DATA segment word public 'DATA'
  49. assume cs:DGROUP
  50. assume ss:dgroup
  51. public SysParse
  52. ;-------------------------------------------------------------------
  53. .xlist
  54. include version.inc
  55. include parse.asm ; include the parser
  56. .list
  57. ;-------------------------------------------------------------------
  58. public CallParser
  59. CallParser proc far
  60. push ds
  61. PUSH ES
  62. push cs
  63. pop ds
  64. assume ds:DGROUP
  65. push cs
  66. pop es
  67. assume es:DGROUP
  68. nop
  69. call SysParse
  70. POP ES
  71. pop ds
  72. ret
  73. CallParser endp
  74. _DATA ends
  75. _TEXT segment byte public 'CODE'
  76. ASSUME CS:_TEXT
  77. ASSUME DS:DGROUP
  78. ASSUME ES:NOTHING
  79. ASSUME SS:DGROUP
  80. _parse proc near
  81. push bp ; save user's base pointer
  82. mov bp,sp ; set bp to current sp
  83. push di ; save some registers
  84. push si
  85. ; copy C inregs into proper registers
  86. mov di,[bp+4] ; fix di (arg 0)
  87. ;-------------------------------------------------------------------
  88. mov ax,[di+0ah] ; load di
  89. push ax ; the di value from inregs is now on stack
  90. mov ax,[di+00] ; get inregs.x.ax
  91. mov bx,[di+02] ; get inregs.x.bx
  92. mov cx,[di+04] ; get inregs.x.cx
  93. mov dx,[di+06] ; get inregs.x.dx
  94. mov si,[di+08] ; get inregs.x.si
  95. pop di ; get inregs.x.di from stack
  96. push bp ; save base pointer
  97. ;-------------------------------------------------------------------
  98. ;-------------------------------------------------------------------
  99. call CallParser ; call the parser
  100. ;-------------------------------------------------------------------
  101. ;-------------------------------------------------------------------
  102. pop bp ; restore base pointer
  103. push di ; the di value from call is now on stack
  104. mov di,[bp+6] ; fix di (arg 1)
  105. mov [di+00],ax ; load outregs.x.ax
  106. mov [di+02],bx ; load outregs.x.bx
  107. mov [di+04],cx ; load outregs.x.cx
  108. mov [di+06],dx ; load outregs.x.dx
  109. mov [di+08],si ; load outregs.x.si
  110. xor ax,ax ; clear ax
  111. lahf ; get flags into ax
  112. mov [di+0ch],ax ; load outregs.x.cflag
  113. pop ax ; get di from stack
  114. mov [di+0ah],ax ; load outregs.x.di
  115. ;-------------------------------------------------------------------
  116. pop si ; restore registers
  117. pop di
  118. mov sp,bp ; restore sp
  119. pop bp ; restore user's bp
  120. ret
  121. _parse endp
  122. _TEXT ends ; end code segment
  123. end
  124.