]> wirehaze git hosting - MS-DOS.git/blob - v2.0/source/DISKMES.ASM

wirehaze git hosting

README.md in Portuguese (Portugal)
[MS-DOS.git] / v2.0 / source / DISKMES.ASM
1 TITLE DISKCOPY Messages
2
3 FALSE EQU 0
4 TRUE EQU NOT FALSE
5
6
7 .xlist
8 .xcref
9 INCLUDE DOSSYM.ASM
10 .cref
11 .list
12
13 ;
14 bdos equ 21h
15 boot equ 20h
16 aread equ 25h
17 awrite equ 26h
18
19 cr equ 0dh
20 lf equ 0ah
21 ;
22
23 CODE SEGMENT PUBLIC BYTE
24 CODE ENDS
25
26 CONST SEGMENT PUBLIC BYTE
27 CONST ENDS
28
29 DATA SEGMENT PUBLIC BYTE
30 DATA ENDS
31
32 DG GROUP CODE,CONST,DATA
33
34 CODE SEGMENT PUBLIC BYTE
35 assume cs:DG,ds:DG,es:DG,ss:DG
36
37 EXTRN PRINT:NEAR,PCRLF:NEAR,ASKANOTHER:NEAR,sec64k:WORD,secsiz:WORD
38 PUBLIC dskrd,dskwrt,promptyn
39
40 promptyn:
41 ;Prompt message in DX
42 ;Prompt user for Y or N answer. Zero set if Y
43 CALL PRINT
44 PAGAIN:
45 MOV DX,OFFSET DG:YES_NO
46 CALL PRINT
47 MOV AX,(STD_CON_INPUT_FLUSH SHL 8)+STD_CON_INPUT
48 INT 21H
49 PUSH AX
50 CALL PCRLF
51 POP AX
52 OR AL,20H ;Convert to lower case
53 CMP AL,'y'
54 JZ GOTANS
55 CMP AL,'n'
56 JZ GOTNANS
57 JMP PAGAIN
58 GOTNANS:
59 OR AL,AL ;Reset zero
60 GOTANS:
61 RET
62
63 hecode db 0
64 tcount dw ?
65
66 dskrd:
67 mov byte ptr cs:[drvlet],"A"
68 add cs:[drvlet],al
69 mov cs:[tcount],cx
70 push ds
71 push cx
72 push dx
73 nxtrd:
74 push ax
75 push bx
76 push dx
77 mov cx,cs:[sec64k]
78 cmp cx,cs:[tcount]
79 jbe gotrcnt
80 mov cx,cs:[tcount]
81 gotrcnt:
82 push cx
83 int aread
84 mov cs:[hecode],al
85 inc sp
86 inc sp ;clean up stack
87 pop cx
88 pop dx
89 pop bx
90 pop ax
91 jnc rdok
92 mov si,OFFSET DG: reading
93 call dskerr
94 jz nxtrd ;Repeat this 64K read
95 rdok:
96 sub cs:[tcount],cx
97 jbe dskret
98 add dx,cx
99 push dx
100 push ax
101 mov ax,cs:[secsiz]
102 mul cx ;ax byte count of transfer (know transfer <= 64K)
103 or dl,dl
104 jnz exact64
105 push ax
106 mov cl,4
107 shr ax,cl
108 mov cx,ds
109 add cx,ax
110 mov ds,cx
111 pop cx
112 and cx,0FH
113 add bx,cx
114 jnc popgo
115 exact64:
116 mov cx,ds
117 add cx,1000H
118 mov ds,cx
119 popgo:
120 pop ax
121 pop dx
122 jmp nxtrd
123
124 dskret:
125 pop dx
126 pop cx
127 pop ds
128 clc
129 ret
130
131
132 dskwrt:
133 mov byte ptr cs:[drvlet],"A"
134 add cs:[drvlet],al
135 mov cs:[tcount],cx
136 push ds
137 push cx
138 push dx
139 nxtwrt:
140 push ax
141 push bx
142 push dx
143 mov cx,cs:[sec64k]
144 cmp cx,cs:[tcount]
145 jbe gotwcnt
146 mov cx,cs:[tcount]
147 gotwcnt:
148 push cx
149 int awrite
150 mov cs:[hecode],al
151 inc sp
152 inc sp ;clean up stack
153 pop cx
154 pop dx
155 pop bx
156 pop ax
157 jnc wrtok
158 mov si,OFFSET DG: writing
159 call dskerr
160 jz nxtwrt ;Repeat this 64K write
161 wrtok:
162 sub cs:[tcount],cx
163 jbe dskret
164 add dx,cx
165 push dx
166 push ax
167 mov ax,cs:[secsiz]
168 mul cx ;ax byte count of transfer (know transfer <= 64K)
169 or dl,dl
170 jnz exact64w
171 push ax
172 mov cl,4
173 shr ax,cl
174 mov cx,ds
175 add cx,ax
176 mov ds,cx
177 pop cx
178 and cx,0FH
179 add bx,cx
180 jnc popgow
181 exact64w:
182 mov cx,ds
183 add cx,1000H
184 mov ds,cx
185 popgow:
186 pop ax
187 pop dx
188 jmp nxtwrt
189
190
191 DSKERR:
192 PUSH DS
193 PUSH CS
194 POP DS
195 PUSH AX
196 PUSH BX
197 PUSH CX
198 PUSH DX
199 PUSH DI
200 PUSH ES
201 CALL PCRLF
202 CALL PCRLF
203 MOV AL,[HECODE]
204 CMP AL,12
205 JBE HAVCOD
206 MOV AL,12
207 HAVCOD:
208 XOR AH,AH
209 MOV DI,AX
210 SHL DI,1
211 MOV DX,WORD PTR [DI+MESBAS] ; Get pointer to error message
212 CALL PRINT ; Print error type
213 MOV DX,OFFSET DG: ERRMES
214 CALL PRINT
215 MOV DX,SI
216 CALL PRINT
217 MOV DX,OFFSET DG: DRVMES
218 CALL PRINT
219 ASK:
220 MOV DX,OFFSET DG: REQUEST
221 CALL PRINT
222 MOV AX,(STD_CON_INPUT_FLUSH SHL 8)+STD_CON_INPUT
223 INT 21H ; Get response
224 OR AL,20H ; Convert to lower case
225 PUSH AX
226 CALL PCRLF
227 CALL PCRLF
228 POP AX
229 CMP AL,"i" ; Ignore?
230 JZ EEXITNZ
231 CMP AL,"r" ; Retry?
232 JZ EEXIT
233 CMP AL,"a" ; Abort?
234 JNZ ASK
235 MOV AX,CS
236 MOV DS,AX
237 MOV ES,AX
238 CLI
239 mov ss,ax
240 mov sp,100h ; Reset stack
241 STI
242 MOV DX,OFFSET DG:ABMES
243 JMP ASKANOTHER
244
245 EEXITNZ:
246 OR AL,AL ; Resets zero flag
247 EEXIT:
248 POP ES
249 POP DI
250 POP DX
251 POP CX
252 POP BX
253 POP AX
254 POP DS
255 RET
256
257
258 CODE ENDS
259
260 CONST SEGMENT PUBLIC BYTE
261
262 PUBLIC cpymsg,good1,goodmsg,srcmsg,srclet,dstmsg,dstlet
263 PUBLIC keymsg,drverr1,drverr3,crlf,fdstmsg,fdstlet,anoprompt
264
265 MESBAS DW OFFSET DG: ERR0
266 DW OFFSET DG: ERR1
267 DW OFFSET DG: ERR2
268 DW OFFSET DG: ERR3
269 DW OFFSET DG: ERR4
270 DW OFFSET DG: ERR5
271 DW OFFSET DG: ERR6
272 DW OFFSET DG: ERR7
273 DW OFFSET DG: ERR8
274 DW OFFSET DG: ERR9
275 DW OFFSET DG: ERR10
276 DW OFFSET DG: ERR11
277 DW OFFSET DG: ERR12
278
279 READING DB "read$"
280 WRITING DB "writ$"
281 ERRMES DB " error $"
282 DRVMES DB "ing drive "
283 DRVLET DB "A$"
284 REQUEST DB 13,10,"Abort, Retry, Ignore? $"
285
286 ERR0 DB "Write protect$"
287 ERR1 DB "Bad unit$"
288 ERR2 DB "Not ready$"
289 ERR3 DB "Bad command$"
290 ERR4 DB "Data$"
291 ERR5 DB "Bad call format$"
292 ERR6 DB "Seek$"
293 ERR7 DB "Non-DOS disk$"
294 ERR8 DB "Sector not found$"
295 ERR9 DB "No paper$"
296 ERR10 DB "Write fault$"
297 ERR11 DB "Read fault$"
298 ERR12 DB "Disk$"
299
300 YES_NO DB "(Y/N)? $"
301 anoprompt db cr,lf,'Copy another $'
302 cpymsg db cr,lf,cr,lf,'Copying...$'
303 good1 db cr,lf,cr,lf
304 goodmsg db 'Copy complete',cr,lf,'$'
305 ABMES db 'Copy not completed',cr,lf,'$'
306 srcmsg db cr,lf,cr,lf,'Insert source diskette in drive '
307 srclet db 'A:$'
308 fdstmsg db cr,lf,'Insert formatted target diskette in drive '
309 fdstlet db 'A:$'
310 dstmsg db cr,lf,'Insert target diskette in drive '
311 dstlet db 'A:$'
312 keymsg db cr,lf,'Strike any key when ready $'
313 drverr1 db cr,lf,'Invalid drive specification',cr,lf,'$'
314 drverr3 db cr,lf,cr,lf,'Source and target disks are not the'
315 db cr,lf,' same format. Cannot do the copy.'
316 crlf db cr,lf,'$'
317
318 CONST ENDS
319 END
320