home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / assemblr / library / lib4a86 / lib / dosio.lib < prev    next >
Text File  |  1992-02-15  |  2KB  |  195 lines

  1. #IF !LIB4A86
  2. #ELSE
  3. #IF !INTERN_LIB4A86_S
  4. INTERN_LIB4A86_S EQU 01
  5. JMP START
  6. #ENDIF
  7. #ENDIF
  8. STDIN EQU 0
  9. STDOUT EQU 1
  10. STDERR EQU 2
  11. STDAUX EQU 3
  12. STDPRINT EQU 4
  13. INPUTHANDLE DW STDIN
  14. OUTPUTHANDLE DW STDOUT
  15. DOSCHECKSTDIN:
  16. MOV BX, CS:INPUTHANDLE
  17. JMP >L1
  18. DOSCHECKSTDOUT:
  19. MOV BX,CS:OUTPUTHANDLE
  20. L1:
  21. DOSCHECKHANDLE:
  22. MOV AX,04400H
  23. INT 021H
  24. JC >L8
  25. TEST DL,080H
  26. L8:
  27. RET
  28. DOSSETHANDLEMODE:
  29. PUSH BX,CX,DX
  30. MOV CL,AL
  31. CALL DOSCHECKHANDLE
  32. JC >L8
  33. OR CL,CL
  34. JZ >L1
  35. OR DL,020H
  36. JMP >L2
  37. L1:
  38. AND DL,NOT 020H
  39. L2:
  40. XOR DH,DH
  41. MOV AX,04401H
  42. INT 021H
  43. L8:
  44. POP DX,CX,BX
  45. RET
  46. DOSCHECKOUTPUT:
  47. PUSH BX,DX
  48. MOV BX,CS:OUTPUTHANDLE
  49. MOV AX,04400H
  50. INT 021H
  51. JC >L8
  52. MOV AL,0FFH
  53. TEST DX,080H
  54. JZ >L1
  55. MOV AX,04407H
  56. INT 021H
  57. L1:
  58. OR AL,AL
  59. L8:
  60. POP DX,BX
  61. RET
  62. DOSCHECKINPUT:
  63. PUSH BX,DX,ES
  64. MOV BX,CS:INPUTHANDLE
  65. MOV AX,04406H
  66. INT 021H
  67. JC >L8
  68. OR AL,AL
  69. JNZ >L8
  70. CALL DOSCHECKHANDLE
  71. JC >L8
  72. TEST DL,080H
  73. JZ >L8
  74. TEST DL,01H
  75. JZ >L8
  76. MOV AH,052H
  77. INT 021H
  78. CMP W ES:[BX-4],0
  79. L8:
  80. POP ES,DX,BX
  81. RET
  82. DOSREADSTR:
  83. PUSH DX,BX
  84. XOR CH,CH
  85. LEA DX,[SI+1]
  86. MOV B[SI],CH
  87. JCXZ >L8
  88. MOV BX,CS:INPUTHANDLE
  89. MOV AH,03FH
  90. INT 021H
  91. JC >L8
  92. MOV BX,SI
  93. ADD BX,AX
  94. CMP B[BX],0AH
  95. IF E DEC AX
  96. CMP B[BX-1],0DH
  97. IF E DEC AX
  98. MOV B[SI],AL
  99. CMP AL,CL
  100. CLC
  101. L8:
  102. POP BX,DX
  103. RET
  104. DOSWRITELNSTR:
  105. MOV AL,01H
  106. JMP >L1
  107. DOSWRITESTR:
  108. MOV AL,0
  109. L1:
  110. PUSH DX,CX,BX,SI
  111. CLD
  112. OR AL,AL
  113. LODSB
  114. MOV AH,0
  115. MOV CX,AX
  116. IF NZ ADD CX,2
  117. OR CX,CX
  118. JZ >L8
  119. MOV DX,SI
  120. ADD SI,AX
  121. MOV AX,LF BY CR
  122. XCHG W[SI],AX
  123. PUSH AX
  124. MOV BX,CS:OUTPUTHANDLE
  125. MOV AH,040H
  126. INT 021H
  127. POP DX
  128. MOV W[SI],DX
  129. JC >L8
  130. CMP AX,CX
  131. L8:
  132. POP SI,BX,CX,DX
  133. RET
  134. DOSREADCHAR:
  135. PUSH DX
  136. MOV AL,0
  137. MOV DX,OFFSET DOSREADSTR
  138. JMP >L1
  139. DOSWRITECHAR:
  140. PUSH DX
  141. MOV DX,OFFSET DOSWRITESTR
  142. JMP >L1
  143. DOSWRITELNCHAR:
  144. PUSH DX
  145. MOV DX,OFFSET DOSWRITELNSTR
  146. L1:
  147. PUSH DS,SI,CX
  148. PUSH BP
  149. MOV BP,SP
  150. MOV AH,01
  151. XCHG AH,AL
  152. PUSH AX
  153. MOV DS,SS
  154. MOV SI,SP
  155. MOV CL,AL
  156. CALL DX
  157. JC >L8
  158. MOV AL,B[SI+1]
  159. L8:
  160. MOV SP,BP
  161. POP BP
  162. POP CX,SI,DS
  163. POP DX
  164. RET
  165. #IF !INTERN_CMARK0
  166. INTERN_CMARK0 EQU 01H
  167. INTERN_CMARK1:
  168. PUSH BP
  169. MOV BP,SP
  170. MOV BX,06H
  171. SUB CH,[BP+SI]
  172. SUB AH,[BX+SI]
  173. DEC SP
  174. DEC CX
  175. INC DX
  176. XOR AL,041H
  177. CMP B[02820H],DH
  178. INC BX
  179. SUB W[BX+SI],SP
  180. INC DX
  181. CS AND B[BP+DI+043H],DL
  182. DEC AX
  183. INC BP
  184. DEC BP
  185. DEC BP
  186. INC BP
  187. PUSH DX
  188. AND B[BP+SI],CH
  189. SUB CH,[BP+SI]
  190. POP DX
  191. MOV SP,BP
  192. POP BP
  193. RET
  194. #ENDIF
  195.