Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1186 | savelij | 1 | ;****************************************************************************** |
2 | ;* * |
||
3 | ;* Includedatei fuer SECMAIN.ASM * |
||
4 | ;* liefert low-level-Routinen fuer SecMain * |
||
5 | ;* Version hier fuer WD1002XT-kompatible Kontroller: * |
||
6 | ;* MFM, RLL (?) * |
||
7 | ;* * |
||
8 | ;* Historie: 28.12.1994 * |
||
9 | ;* 26. 3.1994 Formatierroutinen * |
||
10 | ;* 8. 4.1994 defekte Spuren markieren * |
||
11 | ;* * |
||
12 | ;****************************************************************************** |
||
13 | |||
14 | section wd1002xt |
||
15 | |||
16 | ;------------------------------------------------------------------------------ |
||
17 | ; Portadressen |
||
18 | |||
19 | Port_Base equ 320h ; primaere Basisadresse |
||
20 | Port_Data equ Port_Base+0 ; Datenregister (R+W) |
||
21 | Port_Status equ Port_Base+1 ; Statusregister (R) |
||
22 | Port_Reset equ Port_Base+1 ; Reset ausloesen (W) |
||
23 | Port_Config equ Port_Base+2 ; Jumper auslesen (R) |
||
24 | Port_Select equ Port_Base+2 ; Kontroller selektieren (W) |
||
25 | Port_IRQDRQ equ Port_Base+3 ; IRQ/DRQ-Leitungen freigeben (W) |
||
26 | |||
27 | ;------------------------------------------------------------------------------ |
||
28 | ; Kommandocodes |
||
29 | |||
30 | Cmd_Diagnose equ 0e4h ; Kommando: Kontroller-Selbsttest |
||
31 | Cmd_GetStatus equ 003h ; Status letzter Operation lesen |
||
32 | Cmd_TestReady equ 000h ; Test, ob Laufwerk bereit |
||
33 | Cmd_Restore equ 001h ; Laufwerk rekalibrieren |
||
34 | Cmd_SetParams equ 00ch ; Laufwerksparameter setzen |
||
35 | Cmd_Seek equ 00bh ; Spur anfahren |
||
36 | Cmd_Read equ 008h ; Sektoren lesen |
||
37 | Cmd_Write equ 00ah ; Sektoren schreiben |
||
38 | Cmd_Verify equ 005h ; Sektoren auf Lesbarkeit pruefen |
||
39 | Cmd_WriteBuffer equ 00fh ; Sektorpuffer beschreiben |
||
40 | Cmd_FormatDisk equ 004h ; Laufwerk formatieren |
||
41 | Cmd_FormatTrack equ 006h ; Spur formatieren |
||
42 | Cmd_FormatBad equ 007h ; Spur als defekt markieren |
||
43 | |||
44 | ;------------------------------------------------------------------------------ |
||
45 | ; I/O-Bremse |
||
46 | |||
47 | IODelay macro |
||
48 | jmp $+2 |
||
49 | endm |
||
50 | |||
51 | ;------------------------------------------------------------------------------ |
||
52 | ; Puffer |
||
53 | |||
54 | CmdBufSize equ 6 ; enthaelt Kommandoblock fuer WD1002 |
||
55 | CmdBuf db CmdBufSize dup (0) |
||
56 | |||
57 | StatBufSize equ 4 ; enthaelt Statusinfo vom WD1002 |
||
58 | StatBuf db StatBufSize dup (0) |
||
59 | |||
60 | GeomBufSize equ 8 ; enthaelt Parametertabelle fuer Laufwerk |
||
61 | GeomBuf db GeomBufSize dup (0) |
||
62 | |||
63 | ;****************************************************************************** |
||
64 | ;* Kommandopuffer initialisieren * |
||
65 | ;****************************************************************************** |
||
66 | |||
67 | proc InitCmdBuf |
||
68 | |||
69 | push ax ; Register retten |
||
70 | |||
71 | sub ax,ax ; mit Nullen initialisieren |
||
72 | mov word ptr[CmdBuf],ax |
||
73 | mov word ptr[CmdBuf+2],ax |
||
74 | mov ah,45h ; Retry on, 70us Steprate |
||
75 | mov word ptr[CmdBuf+4],ax |
||
76 | |||
77 | pop ax ; Register zurueck |
||
78 | |||
79 | ret |
||
80 | |||
81 | endp |
||
82 | |||
83 | ;****************************************************************************** |
||
84 | ;* einen Datenblock an den Kontroller schicken * |
||
85 | ;* In : ES:SI = Datenblock * |
||
86 | ;* CX = Anzahl Bytes * |
||
87 | ;* Out : C=1 bei Protokollfehler * |
||
88 | ;****************************************************************************** |
||
89 | |||
90 | proc SendBlock |
||
91 | |||
92 | push ax ; Register retten |
||
93 | push cx |
||
94 | push dx |
||
95 | push si |
||
96 | |||
97 | mov dx,Port_Status |
||
98 | jcxz ZeroLoop ; Nullschleife abfangen |
||
99 | cld ; !!! |
||
100 | OutLoop: in al,dx ; Status lesen |
||
101 | btst al,0 ; warten, bis REQ-Bit auf 1 |
||
102 | jz OutLoop |
||
103 | btst al,1 ; IO-Bit muss 0 sein |
||
104 | stc |
||
105 | jnz ErrEnd |
||
106 | mov dl,Lo(Port_Data); ein Byte auf Datenport ausgeben |
||
107 | seges |
||
108 | outsb |
||
109 | mov dl,Lo(Port_Status) ; zurueck fuer naechsten Durchlauf |
||
110 | loop OutLoop |
||
111 | ZeroLoop: clc ; Ende ohne Fehler |
||
112 | ErrEnd: |
||
113 | pop si ; Register zurueck |
||
114 | pop dx |
||
115 | pop cx |
||
116 | pop ax |
||
117 | |||
118 | ret |
||
119 | |||
120 | endp |
||
121 | |||
122 | ;****************************************************************************** |
||
123 | ;* einen Datenblock vom Kontroller lesen * |
||
124 | ;* In : ES:DI = Datenblock * |
||
125 | ;* CX = Anzahl Bytes * |
||
126 | ;* Out : C=1 bei Protokollfehler * |
||
127 | ;****************************************************************************** |
||
128 | |||
129 | proc RecvBlock |
||
130 | |||
131 | push ax ; Register retten |
||
132 | push cx |
||
133 | push dx |
||
134 | push di |
||
135 | |||
136 | mov dx,Port_Status |
||
137 | jcxz ZeroLoop ; Nullschleife abfangen |
||
138 | cld ; !!! |
||
139 | InLoop: in al,dx ; Status lesen |
||
140 | btst al,0 ; warten, bis REQ-Bit auf 1 |
||
141 | jz InLoop |
||
142 | btst al,1 ; IO-Bit muss 1 sein |
||
143 | stc |
||
144 | jz ErrEnd |
||
145 | mov dl,Lo(Port_Data); ein Byte von Datenport einlesen |
||
146 | insb |
||
147 | mov dl,Lo(Port_Status) ; zurueck fuer naechsten Durchlauf |
||
148 | loop InLoop |
||
149 | ZeroLoop: clc ; Ende ohne Fehler |
||
150 | ErrEnd: |
||
151 | pop di ; Register zurueck |
||
152 | pop dx |
||
153 | pop cx |
||
154 | pop ax |
||
155 | |||
156 | ret |
||
157 | |||
158 | endp |
||
159 | |||
160 | ;****************************************************************************** |
||
161 | ;* Status bilden * |
||
162 | ;* Out : C+AX = Status * |
||
163 | ;****************************************************************************** |
||
164 | |||
165 | proc BuildStatus |
||
166 | |||
167 | push dx ; Register retten |
||
168 | |||
169 | mov dx,Port_Status ; auf Datum warten |
||
170 | Loop: in al,dx |
||
171 | btst al,0 ; bis REQ=1 |
||
172 | jz Loop |
||
173 | btst al,1 ; und IO=1 |
||
174 | jz Loop |
||
175 | mov dl,Lo(Port_Data); CCB auslesen |
||
176 | in al,dx |
||
177 | mov ah,al ; retten fuer Fehlerabfrage |
||
178 | and al,2 ; Bit 1 ausmaskieren |
||
179 | clc |
||
180 | ljz End ; wenn = 0, kein Fehler und AL=0 |
||
181 | |||
182 | push cx ; zusaetzliche Register retten |
||
183 | push si |
||
184 | push di |
||
185 | push es |
||
186 | |||
187 | call InitCmdBuf ; ansonsten Kommando absetzen, um |
||
188 | mov [CmdBuf],Cmd_GetStatus ; Status zu lesen |
||
189 | and ah,20h ; Status fuer korr. Laufwerk abfragen |
||
190 | mov [CmdBuf+1],ah |
||
191 | mov dx,Port_Status |
||
192 | WaitNBusy: in al,dx |
||
193 | btst al,3 |
||
194 | jnz WaitNBusy |
||
195 | mov ax,ds ; NICHT ExecCmd benutzen, da sonst |
||
196 | mov es,ax ; Rekursion ! |
||
197 | lea si,[CmdBuf] |
||
198 | mov cx,CmdBufSize |
||
199 | mov dl,Lo(Port_Select) |
||
200 | out dx,al |
||
201 | call SendBlock |
||
202 | lea di,[StatBuf] ; 4 Statusbytes auslesen |
||
203 | mov cx,StatBufSize |
||
204 | call RecvBlock |
||
205 | mov dl,Lo(Port_Status); CCB nicht vergessen!! |
||
206 | Loop2: in al,dx |
||
207 | btst al,0 ; bis REQ=1 |
||
208 | jz Loop2 |
||
209 | btst al,1 ; und IO=1 |
||
210 | jz Loop2 |
||
211 | mov dl,Lo(Port_Data) |
||
212 | in al,dx |
||
213 | mov al,[StatBuf] ; Fehlercode = 1.Byte, |
||
214 | and al,7fh ; Bit 0..6 |
||
215 | stc ; Carry signalisiert Fehler |
||
216 | pop es ; zusaetzliche Register zurueck |
||
217 | pop di |
||
218 | pop si |
||
219 | pop cx |
||
220 | |||
221 | End: mov ah,0 ; MSB ohne Bedeutung |
||
222 | pop dx ; Register zurueck |
||
223 | ret |
||
224 | |||
225 | endp |
||
226 | |||
227 | ;****************************************************************************** |
||
228 | ;* XT- in AT-Fehlerkode umsetzen * |
||
229 | ;* Eingabe: AL = XT-Fehlerkode * |
||
230 | ;* Ausgabe: C+AX = AT-Fehlerstatus * |
||
231 | ;****************************************************************************** |
||
232 | |||
233 | proc TranslateStatus |
||
234 | |||
235 | push bx |
||
236 | push si |
||
237 | |||
238 | mov bl,al ; alten Status sichern |
||
239 | mov bh,-1 |
||
240 | lea si,[TransTable] |
||
241 | cld |
||
242 | TransLoop: lodsw ; einen Eintrag laden |
||
243 | cmp al,bh ; Tabellenende? |
||
244 | je TransEnd |
||
245 | cmp al,bl ; Treffer? |
||
246 | jne TransLoop ; nein, weitersuchen |
||
247 | mov al,ah ; uebersetzten Code laden |
||
248 | cmp al,0 ; Code fuer kein Fehler? |
||
249 | clc |
||
250 | je Ende ; ja, C=0 |
||
251 | jmp TransErr ; ansonsten C=1 |
||
252 | TransEnd: mov al,04h ; Aborted Command annehmen |
||
253 | TransErr: stc ; Fehlerflag setzen |
||
254 | |||
255 | Ende: pop si ; Register zurueck |
||
256 | pop bx |
||
257 | |||
258 | ret |
||
259 | |||
260 | TransTable: db 00h,00h ; kein Fehler |
||
261 | db 02h,02h ; kein Seek Complete-Signal |
||
262 | db 03h,04h ; Write Fault |
||
263 | db 04h,04h ; Laufwerk nicht bereit |
||
264 | db 06h,02h ; Spur 0 nicht gefunden |
||
265 | db 08h,02h ; Laufwerk positioniert noch |
||
266 | db 11h,40h ; unkorrigierbarer Datenfehler |
||
267 | db 12h,01h ; Adreсmarke nicht gefunden |
||
268 | db 15h,10h ; Positionierfehler |
||
269 | db 18h,00h ; korrigierbarer Fehler (ignoriert) |
||
270 | db 19h,80h ; Spur als defekt markiert |
||
271 | db -1,-1 ; Tabellenende |
||
272 | |||
273 | endp |
||
274 | |||
275 | ;****************************************************************************** |
||
276 | ;* ein Kommando ausfБhren * |
||
277 | ;* In : AL = Kommando * |
||
278 | ;****************************************************************************** |
||
279 | |||
280 | proc ExecCmd |
||
281 | |||
282 | push cx ; Register retten |
||
283 | push ax |
||
284 | push dx |
||
285 | push si |
||
286 | push es |
||
287 | |||
288 | mov [CmdBuf],al ; Kommandokode in Datenblock einschreiben |
||
289 | mov dx,Port_Status ; warten, bis Kontroller frei |
||
290 | WaitNBusy: in al,dx |
||
291 | btst al,3 |
||
292 | jnz WaitNBusy |
||
293 | mov dx,Port_Select ; Kontroller selektieren |
||
294 | out dx,al |
||
295 | mov ax,ds ; Adresse Kommandoblock |
||
296 | mov es,ax |
||
297 | lea si,[CmdBuf] |
||
298 | mov cx,CmdBufSize ; Laenge Kommandoblock |
||
299 | call SendBlock ; Kommandoblock abschicken |
||
300 | |||
301 | pop es ; Register zurueck |
||
302 | pop si |
||
303 | pop dx |
||
304 | pop ax |
||
305 | pop cx |
||
306 | |||
307 | ret |
||
308 | |||
309 | endp |
||
310 | |||
311 | ;****************************************************************************** |
||
312 | ;* Laufwerk und Sonderwerte in Kommandoblock einprogrammieren * |
||
313 | ;* In : AL = Laufwerk * |
||
314 | ;* AH = Kopf * |
||
315 | ;****************************************************************************** |
||
316 | |||
317 | proc SetDriveEnv |
||
318 | |||
319 | push ax ; Register retten |
||
320 | |||
321 | |||
322 | shl al,5 ; Laufwerksbit an Stelle 5 |
||
323 | or al,ah |
||
324 | mov [CmdBuf+1],al ; als 2. Byte im Kommandopuffer schreiben |
||
325 | |||
326 | pop ax ; Register zurueck |
||
327 | |||
328 | ret |
||
329 | |||
330 | endp |
||
331 | |||
332 | ;****************************************************************************** |
||
333 | ;* Zylinder- und Sektorparameter an Kontroller ausgeben * |
||
334 | ;* In : BX = Startzylinder * |
||
335 | ;* CL = Sektorzahl/Interleave * |
||
336 | ;* CH = Startsektor * |
||
337 | ;****************************************************************************** |
||
338 | |||
339 | proc SetTransParams |
||
340 | |||
341 | push ax ; Register retten |
||
342 | |||
343 | mov [CmdBuf+3],bl ; LSB Startzylinder |
||
344 | mov al,bh ; MSB Startzylinder |
||
345 | shl al,6 ; in Bit 6..7 schieben |
||
346 | add al,ch ; Sektor dazu |
||
347 | dec al ; !!! Sektoren ab 0 |
||
348 | mov [CmdBuf+2],al |
||
349 | mov [CmdBuf+4],cl ; Sektorzahl |
||
350 | |||
351 | pop ax ; Register zurueck |
||
352 | ret |
||
353 | |||
354 | endp |
||
355 | |||
356 | ;****************************************************************************** |
||
357 | ;* BegrБсungsmeldung ausgeben: * |
||
358 | ;****************************************************************************** |
||
359 | |||
360 | globproc LowLevelIdent |
||
361 | |||
362 | push ax ; Register retten |
||
363 | |||
364 | PrMsg IdentMsg |
||
365 | |||
366 | pop ax |
||
367 | |||
368 | ret |
||
369 | |||
370 | IdentMsg db "Low-Level-Routinen f",UUML,"r WD1002S-WX2 und kompatible Controller",CR,LF,'$' |
||
371 | |||
372 | endp |
||
373 | |||
374 | ;****************************************************************************** |
||
375 | ;* Controller-Diagnose: * |
||
376 | ;* Out : AL = Diagnosecode * |
||
377 | ;****************************************************************************** |
||
378 | |||
379 | globproc ContDiag |
||
380 | |||
381 | push cx ; Register retten |
||
382 | push bx |
||
383 | push dx |
||
384 | |||
385 | sub cx,cx |
||
386 | mov dx,Port_Status ; auf Status |
||
387 | BWait: in al,dx |
||
388 | btst al,3 ; auf NOT BUSY warten |
||
389 | loopnz BWait ; oder bis 64K Durchlaeufe durch |
||
390 | or cx,cx ; Timeout ? |
||
391 | jne NTOut |
||
392 | mov al,Diag_Timeout ; ja: Fehlercode setzen... |
||
393 | jmp End ; ...und Feierabend |
||
394 | |||
395 | NTOut: call InitCmdBuf ; Kommando Selbsttest ausfuehren |
||
396 | mov al,Cmd_Diagnose |
||
397 | call ExecCmd |
||
398 | call BuildStatus ; Status holen |
||
399 | |||
400 | cmp al,5 ; WD1002 definiert nur Code 0..5 |
||
401 | jb DoTrans |
||
402 | mov al,7 ; "undefinierter Code" |
||
403 | jmp End |
||
404 | DoTrans: lea bx,[TransTbl] ; ansonsten umsetzen |
||
405 | xlat |
||
406 | |||
407 | End: pop dx ; Register zurueck |
||
408 | pop bx |
||
409 | pop cx |
||
410 | ret |
||
411 | |||
412 | TransTbl: db Diag_NoError ; Code 0: kein Fehler |
||
413 | db Diag_ContError ; Code 1: WD1010 fehlerhaft |
||
414 | db Diag_ECCError ; Code 2: WD11C00 fehlerhaft |
||
415 | db Diag_SBufError ; Code 3: Sektorpuffer defekt |
||
416 | db Diag_ProcError ; Code 4: WD1015 RAM defekt |
||
417 | db Diag_ProcError ; Code 5: WD1015 ROM defekt |
||
418 | |||
419 | |||
420 | endp |
||
421 | |||
422 | ;****************************************************************************** |
||
423 | ;* Laufwerk rekalibrieren, gleichzeitig Test, ob vorhanden * |
||
424 | ;* In : AL = Laufwerk * |
||
425 | ;* Out : C + AX = Status * |
||
426 | ;****************************************************************************** |
||
427 | |||
428 | |||
429 | globproc Recalibrate |
||
430 | |||
431 | push ax ; Register retten |
||
432 | push cx |
||
433 | |||
434 | call InitCmdBuf ; testen, ob Laufwerk bereit |
||
435 | mov ah,0 ; Kopf dafuer unwichtig |
||
436 | call SetDriveEnv |
||
437 | mov dl,al ; Laufwerksnummer retten, gleichzeitig |
||
438 | mov dh,0 ; Kopf auf 0 setzen |
||
439 | mov al,Cmd_TestReady |
||
440 | call ExecCmd |
||
441 | call BuildStatus |
||
442 | jc TotEnde ; C=1 --> Ende mit Fehler |
||
443 | |||
444 | call InitCmdBuf ; sanfte Tour: Spur 0 mit Seek anfahren |
||
445 | mov ax,dx |
||
446 | call SetDriveEnv |
||
447 | mov al,0 ; Zylinder lo=0 |
||
448 | mov [CmdBuf+3],al |
||
449 | inc al ; Zylinder Hi=0, Startsektor=1 |
||
450 | mov [CmdBuf+2],al |
||
451 | mov al,Cmd_Seek |
||
452 | call ExecCmd |
||
453 | call BuildStatus |
||
454 | jnc TotEnde ; kein Fehler, alles in Butter |
||
455 | |||
456 | call InitCmdBuf ; ansonsten echtes Restore versuchen |
||
457 | mov ax,dx |
||
458 | call SetDriveEnv |
||
459 | mov al,Cmd_Restore |
||
460 | call ExecCmd |
||
461 | call BuildStatus |
||
462 | call TranslateStatus |
||
463 | |||
464 | TotEnde: pop dx ; Register zurueck |
||
465 | pop ax |
||
466 | |||
467 | ret |
||
468 | |||
469 | endp |
||
470 | |||
471 | ;****************************************************************************** |
||
472 | ;* Dem Kontroller die Laufwerksgeometrie mitteilen * |
||
473 | ;* In : AL = Laufwerk * |
||
474 | ;* Out : C = 1-->Fehler * |
||
475 | ;****************************************************************************** |
||
476 | |||
477 | globproc SetDriveParams |
||
478 | |||
479 | push cx ; Register retten |
||
480 | push si |
||
481 | push es |
||
482 | |||
483 | call GetPTabAdr ; Adresse Parametertabelle holen |
||
484 | call InitCmdBuf ; Kommando anstoсen |
||
485 | call SetDriveEnv |
||
486 | mov al,Cmd_SetParams |
||
487 | call ExecCmd |
||
488 | |||
489 | |||
490 | mov ax,[di+DrPar_Cyls] ; Parametertabelle aufbauen |
||
491 | xchg ah,al |
||
492 | mov word ptr [GeomBuf],ax |
||
493 | mov al,[di+DrPar_Heads] |
||
494 | mov byte ptr[GeomBuf+2],al |
||
495 | mov ax,[di+DrPar_RedWr] |
||
496 | xchg ah,al |
||
497 | mov word ptr[GeomBuf+3],ax |
||
498 | mov ax,[di+DrPar_PrComp] |
||
499 | xchg ah,al |
||
500 | mov word ptr[GeomBuf+5],ax |
||
501 | mov al,[di+DrPar_ECCLen] |
||
502 | mov byte ptr[GeomBuf+7],al |
||
503 | lea si,[GeomBuf] ; Block abschicken |
||
504 | mov cx,GeomBufSize |
||
505 | mov ax,ds |
||
506 | mov es,ax |
||
507 | call SendBlock |
||
508 | call BuildStatus |
||
509 | call TranslateStatus |
||
510 | |||
511 | pop es ; Register zurueck |
||
512 | pop si |
||
513 | pop cx |
||
514 | |||
515 | ret |
||
516 | |||
517 | endp |
||
518 | |||
519 | ;****************************************************************************** |
||
520 | ;* Sektor(en) lesen * |
||
521 | ;* In : AL = Laufwerk * |
||
522 | ;* AH = Startkopf * |
||
523 | ;* BX = Startzylinder * |
||
524 | ;* CL = Sektorzahl * |
||
525 | ;* CH = Startsektor * |
||
526 | ;* ES:DI = Zeiger auf Datenpuffer * |
||
527 | ;* Out : C+AX = Fehlerstatus * |
||
528 | ;****************************************************************************** |
||
529 | |||
530 | globproc ReadSectors |
||
531 | |||
532 | push bx ; Register retten |
||
533 | push cx |
||
534 | push dx |
||
535 | push di |
||
536 | push es |
||
537 | |||
538 | call InitCmdBuf ; Puffer initialisieren |
||
539 | call SetDriveEnv |
||
540 | call SetTransParams |
||
541 | mov al,Cmd_Read ; Lesen triggern |
||
542 | PrChar '1' |
||
543 | call ExecCmd |
||
544 | PrChar '2' |
||
545 | |||
546 | SecLoop: mov dx,Port_Status ; warten, bis Request-Bit gesetzt |
||
547 | RLoop: in al,dx |
||
548 | btst al,0 |
||
549 | jz RLoop |
||
550 | btst al,2 ; Daten oder Status ? |
||
551 | jnz ErrEnd ; wenn jetzt Status, ist etwas schief gelaufen |
||
552 | push cx ; ansonsten Sektor auslesen |
||
553 | mov cx,SecSize |
||
554 | PrChar '3' |
||
555 | call RecvBlock |
||
556 | PrChar '4' |
||
557 | pop cx |
||
558 | dec cl |
||
559 | add di,SecSize |
||
560 | jnz RLoop ; und naechsten Sektor verarbeiten |
||
561 | |||
562 | ErrEnd: PrChar '5' |
||
563 | call BuildStatus |
||
564 | PrChar '6' |
||
565 | call TranslateStatus |
||
566 | |||
567 | pop es ; Register zurueck |
||
568 | pop di |
||
569 | pop dx |
||
570 | pop cx |
||
571 | pop bx |
||
572 | |||
573 | ret |
||
574 | |||
575 | endp |
||
576 | |||
577 | ;****************************************************************************** |
||
578 | ;* Sektor(en) verifizieren * |
||
579 | ;* In : AL = Laufwerk * |
||
580 | ;* AH = Startkopf * |
||
581 | ;* BX = Startzylinder * |
||
582 | ;* CL = Sektorzahl * |
||
583 | ;* CH = Startsektor * |
||
584 | ;* Out : C+AX = Fehlerstatus * |
||
585 | ;****************************************************************************** |
||
586 | |||
587 | globproc VeriSectors |
||
588 | |||
589 | push bx ; Register retten |
||
590 | push cx |
||
591 | push dx |
||
592 | |||
593 | call InitCmdBuf ; Puffer initialisieren |
||
594 | call SetDriveEnv |
||
595 | call SetTransParams |
||
596 | mov al,Cmd_Verify ; Verifikation triggern |
||
597 | call ExecCmd |
||
598 | |||
599 | call BuildStatus |
||
600 | call TranslateStatus |
||
601 | |||
602 | pop dx ; Register zurueck |
||
603 | pop cx |
||
604 | pop bx |
||
605 | |||
606 | ret |
||
607 | |||
608 | endp |
||
609 | |||
610 | ;****************************************************************************** |
||
611 | ;* Sektor(en) schreiben * |
||
612 | ;* In : AL = Laufwerk * |
||
613 | ;* AH = Startkopf * |
||
614 | ;* BX = Startzylinder * |
||
615 | ;* CL = Sektorzahl * |
||
616 | ;* CH = Startsektor * |
||
617 | ;* ES:SI = Zeiger auf Datenpuffer * |
||
618 | ;* Out : C+AX = Fehlerstatus * |
||
619 | ;****************************************************************************** |
||
620 | |||
621 | globproc WriteSectors |
||
622 | |||
623 | push bx ; Register retten |
||
624 | push cx |
||
625 | push dx |
||
626 | push si |
||
627 | push es |
||
628 | |||
629 | |||
630 | call InitCmdBuf ; Puffer initialisieren |
||
631 | call SetDriveEnv |
||
632 | call SetTransParams |
||
633 | mov al,Cmd_Write ; Lesen triggern |
||
634 | call ExecCmd |
||
635 | |||
636 | SecLoop: mov dx,Port_Status ; warten, bis Request-Bit gesetzt |
||
637 | WLoop: in al,dx |
||
638 | btst al,0 |
||
639 | jz WLoop |
||
640 | btst al,2 ; Daten oder Status ? |
||
641 | jnz ErrEnd ; wenn jetzt Status, ist etwas schief gelaufen |
||
642 | push cx ; ansonsten Sektor auslesen |
||
643 | mov cx,SecSize |
||
644 | call SendBlock |
||
645 | pop cx |
||
646 | dec cl |
||
647 | add si,SecSize |
||
648 | jnz WLoop ; und naechsten Sektor verarbeiten |
||
649 | |||
650 | ErrEnd: call BuildStatus |
||
651 | call TranslateStatus |
||
652 | |||
653 | pop es ; Register zurueck |
||
654 | pop si |
||
655 | pop dx |
||
656 | pop cx |
||
657 | pop bx |
||
658 | |||
659 | ret |
||
660 | |||
661 | endp |
||
662 | |||
663 | ;****************************************************************************** |
||
664 | ;* Laufwerk formatieren * |
||
665 | ;* In : AL = Laufwerk * |
||
666 | ;* AH = Interleave * |
||
667 | ;* Out : C+AX = Fehlerstatus * |
||
668 | ;****************************************************************************** |
||
669 | |||
670 | globproc FormatUnit |
||
671 | |||
672 | push bx ; Register retten |
||
673 | push cx |
||
674 | push dx |
||
675 | push si |
||
676 | push di |
||
677 | push es |
||
678 | |||
679 | mov bx,ax ; Interleave & Laufwerk retten |
||
680 | |||
681 | mov ax,ds ; vorher noch den Sektorpuffer im |
||
682 | mov es,ax ; Controller ausnullen |
||
683 | lea di,[SectorBuffer] |
||
684 | mov cx,SecSize/2 |
||
685 | sub ax,ax |
||
686 | rep stosw |
||
687 | call InitCmdBuf |
||
688 | mov al,Cmd_WriteBuffer |
||
689 | call ExecCmd |
||
690 | lea si,[SectorBuffer] |
||
691 | mov cx,SecSize |
||
692 | call SendBlock |
||
693 | call BuildStatus |
||
694 | jc End ; unwahrscheinlich, aber... |
||
695 | |||
696 | call InitCmdBuf ; Puffer initialisieren |
||
697 | mov al,bl ; Laufwerk wieder zurueck |
||
698 | mov ah,0 ; Startkopf ist 0 |
||
699 | call SetDriveEnv |
||
700 | mov [CmdBuf+4],bh ; Interleave einschreiben |
||
701 | mov al,Cmd_FormatDisk ; Formatieren triggern |
||
702 | call ExecCmd |
||
703 | |||
704 | ErrEnd: call BuildStatus |
||
705 | End: call TranslateStatus |
||
706 | |||
707 | pop es ; Register zurueck |
||
708 | pop di |
||
709 | pop si |
||
710 | pop dx |
||
711 | pop cx |
||
712 | pop bx |
||
713 | |||
714 | ret |
||
715 | |||
716 | endp |
||
717 | |||
718 | ;****************************************************************************** |
||
719 | ;* Spur formatieren * |
||
720 | ;* In : AL = Laufwerk * |
||
721 | ;* AH = Kopf * |
||
722 | ;* BX = Zylinder * |
||
723 | ;* CL = Interleave * |
||
724 | ;* Out : C+AX = Fehlerstatus * |
||
725 | ;****************************************************************************** |
||
726 | |||
727 | globproc FormatTrack |
||
728 | |||
729 | push bx |
||
730 | push cx |
||
731 | |||
732 | call InitCmdBuf ; Parameter einschreiben |
||
733 | call SetDriveEnv |
||
734 | mov ch,1 ; Sektorinformation muss nur gueltig sein |
||
735 | call SetTransParams |
||
736 | mov al,Cmd_FormatTrack |
||
737 | call ExecCmd |
||
738 | call BuildStatus |
||
739 | |||
740 | pop cx |
||
741 | pop bx |
||
742 | ret |
||
743 | |||
744 | endp |
||
745 | |||
746 | ;****************************************************************************** |
||
747 | ;* Spur als defekt markieren * |
||
748 | ;* In : AL = Laufwerk * |
||
749 | ;* AH = Kopf * |
||
750 | ;* BX = Zylinder * |
||
751 | ;* Out : C+AX = Fehlerstatus * |
||
752 | ;****************************************************************************** |
||
753 | |||
754 | globproc MarkBad |
||
755 | |||
756 | push bx |
||
757 | push cx |
||
758 | |||
759 | call InitCmdBuf ; Parameter einschreiben |
||
760 | call SetDriveEnv |
||
761 | mov cx,0103h ; Sektorinformation muss nur gueltig sein |
||
762 | call SetTransParams |
||
763 | mov al,Cmd_FormatBad |
||
764 | call ExecCmd |
||
765 | call BuildStatus |
||
766 | |||
767 | pop cx |
||
768 | pop bx |
||
769 | ret |
||
770 | |||
771 | endp |
||
772 | |||
773 | endsection |