DOS 3.30 source code leak
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.

141 lines
3.1 KiB

5 years ago
  1. ; SCCSID = @(#)forproc.asm 1.2 85/07/25
  2. .xlist
  3. .xcref
  4. BREAK MACRO subtitle
  5. SUBTTL subtitle
  6. PAGE
  7. ENDM
  8. INCLUDE SYSCALL.INC
  9. .cref
  10. .list
  11. data segment public 'DATA'
  12. data ends
  13. code segment public 'CODE'
  14. assume cs:code,ds:data
  15. PUBLIC FormatAnother?,Yes?,REPORT,USER_STRING
  16. public fdsksiz,badsiz,syssiz,datasiz,biosiz
  17. extrn std_printf:near,crlf:near,PrintString:near
  18. data segment
  19. extrn driveLetter:byte
  20. ; In formes.asm
  21. extrn msgInsertDisk:byte
  22. extrn msgFormatAnother?:byte
  23. extrn msgTotalDiskSpace:byte
  24. extrn msgSystemSpace:byte
  25. extrn msgBadSpace:byte
  26. extrn msgDataSpace:byte
  27. extrn yes_byte:byte
  28. extrn no_byte:byte
  29. extrn inbuff:byte
  30. ptr_msgTotalDiskSpace dw offset msgTotalDiskSpace
  31. fdsksiz dd 0
  32. ptr_msgSystemSpace dw offset msgSystemSpace
  33. syssiz dd 0
  34. biosiz dd 0
  35. ptr_msgBadSpace dw offset msgBadSpace
  36. badsiz dd 0
  37. ptr_msgDataSpace dw offset msgDataSpace
  38. datasiz dd 0
  39. ptr_msgInsertDisk dw offset msgInsertDisk
  40. dw offset driveLetter
  41. data ends
  42. FormatAnother? proc near
  43. ; Wait for key. If yes return carry clear, else no. Insures
  44. ; explicit Y or N answer.
  45. lea dx, msgFormatAnother?
  46. call PrintString
  47. CALL Yes?
  48. JNC WAIT20
  49. JZ WAIT20
  50. CALL CRLF
  51. JMP SHORT FormatAnother?
  52. FormatAnother? endp
  53. Yes? proc near
  54. ; Wait for key. If YES return carry clear,else carry set.
  55. ; If carry is set, Z is set if explicit NO, else key was not Yes or No.
  56. CALL USER_STRING
  57. JNZ GETBYT
  58. XOR AL,AL ; So that CMP with [NO_BYTE] is NZ
  59. JMP SHORT CHECK_NO
  60. GETBYT:
  61. MOV AL,BYTE PTR [INBUFF+2]
  62. OR AL,20H ; Convert to lower case
  63. CMP AL,[YES_BYTE]
  64. JZ WAIT20 ; Carry clear if jump
  65. CHECK_NO:
  66. CMP AL,[NO_BYTE]
  67. STC ; Set carry (wasn't Yes)
  68. WAIT20: RET
  69. Yes? endp
  70. USER_STRING:
  71. ; Get a string from user. Z is set if user typed no chars (imm CR)
  72. ; We need to flush a second time to get rid of incoming Kanji characters also.
  73. MOV AX,(STD_CON_INPUT_FLUSH SHL 8) + 0 ; Clean out input
  74. INT 21H
  75. MOV DX,OFFSET INBUFF
  76. MOV AH,STD_CON_STRING_INPUT
  77. INT 21H
  78. MOV AX,(STD_CON_INPUT_FLUSH SHL 8) + 0 ; Clean out input
  79. INT 21H
  80. CMP BYTE PTR [INBUFF+1],0
  81. RET
  82. ;*********************************************
  83. ; Make a status report including the following information:
  84. ; Total disk capacity
  85. ; Total system area used
  86. ; Total bad space allocated
  87. ; Total data space available
  88. REPORT:
  89. lea dx, ptr_msgTotalDiskSpace
  90. call std_printf
  91. cmp WORD PTR SYSSIZ,0
  92. JNZ SHOWSYS
  93. cmp WORD PTR SYSSIZ+2,0
  94. JZ CHKBAD
  95. SHOWSYS:
  96. MOV dx,OFFSET ptr_msgSystemSpace
  97. CALL std_printf ;Report space used by system
  98. CHKBAD:
  99. cmp WORD PTR BADSIZ,0
  100. JNZ SHOWBAD
  101. cmp WORD PTR BADSIZ+2,0
  102. JZ SHOWDATA
  103. SHOWBAD:
  104. lea dx, ptr_msgBadSpace
  105. call std_printf
  106. SHOWDATA:
  107. MOV CX,WORD PTR FDSKSIZ
  108. MOV BX,WORD PTR FDSKSIZ+2
  109. SUB CX,WORD PTR BADSIZ
  110. SBB BX,WORD PTR BADSIZ+2
  111. SUB CX,WORD PTR SYSSIZ
  112. SBB BX,WORD PTR SYSSIZ+2
  113. MOV word ptr datasiz,CX
  114. MOV word ptr datasiz+2,BX
  115. lea dx, ptr_msgDataSpace
  116. call std_printf
  117. call crlf
  118. RET
  119. code ends
  120. end