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.

164 lines
3.7 KiB

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;
  3. ; COMM.ASM
  4. ;
  5. ; Copyright (c) Microsoft Corporation 1990. All rights reserved.
  6. ;
  7. ; This module contains code to write a string to the COM port
  8. ;
  9. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  10. ?PLM=1 ; pascal call convention
  11. ?WIN=0 ; Windows prolog/epilog code
  12. .286
  13. .xlist
  14. include cmacros.inc
  15. ; include windows.inc
  16. .list
  17. WF_CPU286 equ 0002h
  18. ifdef DEBUG
  19. DEBUG_RETAIL equ 1
  20. endif
  21. ; externA __0040h ; in KERNEL
  22. ; externA __B000h ; in KERNEL
  23. externFP OutputDebugString ; in KERNEL
  24. externFP wvsprintf ; in USER
  25. SCREENWIDTH equ 80
  26. SCREENHEIGHT equ 25
  27. SCREENBYTES equ (SCREENWIDTH*2)
  28. DEFATTR equ 07
  29. LASTLINE equ ((SCREENHEIGHT-1)*SCREENBYTES)
  30. BUFFER_SIZE = 256
  31. ;******************************************************************************
  32. ;
  33. ; SEGMENTS
  34. ;
  35. ;******************************************************************************
  36. createSeg _TEXT, CodeRes, word, public, CODE
  37. createSeg FIX, CodeFix, word, public, CODE
  38. createSeg INTDS, DataFix, byte, public, DATA
  39. ;******************************************************************************
  40. ;
  41. ; FIXED DATA
  42. ;
  43. ;******************************************************************************
  44. ifdef DEBUG_RETAIL
  45. sBegin DataFix
  46. globalW fDebugOutput, 0
  47. sEnd DataFix
  48. endif
  49. ;******************************************************************************
  50. ;
  51. ; NON FIXED DATA
  52. ;
  53. ;******************************************************************************
  54. ifdef DEBUG
  55. sBegin Data
  56. globalW _fDebug, 0
  57. sEnd Data
  58. endif
  59. ifdef DEBUG
  60. sBegin CodeRes
  61. assumes cs,CodeRes
  62. assumes ds,nothing
  63. assumes es,nothing
  64. ;******************************************************************************
  65. ;
  66. ; dprintf - output a MMSYSTEM debug string with formatting
  67. ;
  68. ; if the mmsystem global fDebug==0, no ouput will be sent
  69. ;
  70. ;==============================================================================
  71. assumes ds,Data
  72. assumes es,nothing
  73. ?PLM=0
  74. cProc dprintf, <FAR, C, PUBLIC>, <>
  75. ParmD szFormat
  76. ParmW Args
  77. LocalV szBuffer, BUFFER_SIZE
  78. cBegin
  79. cmp [_fDebug],0
  80. jz dprintf_exit
  81. lea ax,szBuffer
  82. lea bx,Args
  83. cCall wvsprintf, <ss,ax, szFormat, ss,bx>
  84. lea ax,szBuffer
  85. push ss
  86. push ax
  87. call far ptr OutputDebugStr
  88. dprintf_exit:
  89. cEnd
  90. ?PLM=1
  91. sEnd
  92. endif
  93. ;******************************************************************************
  94. ;
  95. ;******************************************************************************
  96. sBegin CodeFix
  97. assumes cs,CodeFix
  98. assumes ds,nothing
  99. assumes es,nothing
  100. externW CodeFixDS ; in STACK.ASM
  101. externW CodeFixWinFlags
  102. ifdef DEBUG
  103. ;******************************************************************************
  104. ;
  105. ; dout - output a MMSYSTEM debug string
  106. ;
  107. ; if the mmsystem global fDebug==0, no ouput will be sent
  108. ;
  109. ;==============================================================================
  110. assumes ds,Data
  111. assumes es,nothing
  112. public dout
  113. dout proc far
  114. cmp [_fDebug],0
  115. jnz OutputDebugStr
  116. retf 4
  117. dout endp
  118. endif; DEBUG
  119. ;
  120. ; in the retail version stub out the OutputDebugStr function
  121. ;
  122. cProc OutputDebugStr, <FAR, PASCAL, PUBLIC>, <>
  123. ParmD szString
  124. cBegin
  125. cCall OutputDebugString, <szString>
  126. cEnd
  127. sEnd
  128. end