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.

118 lines
2.1 KiB

  1. code SEGMENT Public byte 'CODE'
  2. ASSUME Cs:code, Ds:code
  3. buffer DB 6 DUP (?)
  4. _DebugChar PROC Near
  5. ;
  6. ; AL < Character To Be Shown
  7. ;
  8. push ax
  9. push dx
  10. mov ah, 1
  11. mov dx, 0
  12. int 14h
  13. pop dx
  14. pop ax
  15. ret
  16. _DebugChar ENDP
  17. _DebugString PROC Near
  18. ;
  19. ; BX < Offset of String To Be Shown (Null Terminate)
  20. ;
  21. push ax
  22. push bx
  23. push ds
  24. mov ax, cs
  25. mov ds, ax
  26. @@:
  27. mov al, [bx]
  28. inc bx
  29. or al, al
  30. jz @f
  31. call _DebugChar
  32. jmp @b
  33. @@:
  34. pop ds
  35. pop bx
  36. pop ax
  37. ret
  38. _DebugString ENDP
  39. NumHex PROC Near
  40. ;
  41. ; AL(0..3) < Hex Value
  42. ; AL > ASCII Code
  43. ;
  44. and al, 0Fh
  45. cmp al, 0Ah
  46. jb @f
  47. add al, 'A'-'0'-10
  48. @@:
  49. add al, '0'
  50. ret
  51. NumHex ENDP
  52. NumByte PROC Near
  53. ;
  54. ; AL < Byte Value
  55. ; AX > Two ASCII Codes for Byte Value
  56. ;
  57. push dx
  58. mov dl, al
  59. call NumHex
  60. mov dh, al
  61. mov al, dl
  62. shr al, 1
  63. shr al, 1
  64. shr al, 1
  65. shr al, 1
  66. call NumHex
  67. mov dl, al
  68. mov ax, dx
  69. pop dx
  70. ret
  71. NumByte ENDP
  72. _DebugNumber PROC Near
  73. ;
  74. ; AX < Word Value To Be Shown
  75. ;
  76. push ax
  77. push bx
  78. push dx
  79. push bp
  80. push ds
  81. mov bx, cs
  82. mov ds, bx
  83. lea bx, buffer
  84. mov Byte Ptr [bx], 32
  85. mov dx, ax
  86. mov al, dh
  87. call NumByte
  88. mov [bx+1], ax
  89. mov al, dl
  90. call NumByte
  91. mov [bx+3], ax
  92. lea bx, buffer
  93. call _DebugString
  94. pop ds
  95. pop bp
  96. pop dx
  97. pop bx
  98. pop ax
  99. ret
  100. _DebugNumber ENDP
  101. PUBLIC _DebugChar, _DebugString, _DebugNumber
  102. code ENDS
  103. END