_WELCOMETO Radioland

Ãëàâíàÿ Ñõåìû Äîêóìåíòàöèÿ Ñòóäåíòàì Ïðîãðàììû Ïîèñê Top50  
Ïîèñê ïî ñàéòó



Íàâèãàöèÿ
Ãëàâíàÿ
Ñõåìû
Àâòîýëåêòðîíèêà
Àêóñòèêà
Àóäèî
Èçìåðåíèÿ
Êîìïüþòåðû
Ïèòàíèå
Ïðîã. óñòðîéñòâà
Ðàäèî
Ðàäèîøïèîíàæ
Òåëåâèäåíèå
Òåëåôîíèÿ
Öèôð. ýëåêòðîíèêà
Äðóãèå
Äîáàâèòü
Äîêóìåíòàöèÿ
Ìèêðîñõåìû
Òðàíçèñòîðû
Ïðî÷åå
Ôàéëû
Óòèëèòû
Ðàäèîëþá. ðàñ÷åòû
Ïðîãðàììèðîâàíèå
Äðóãîå
Ñòóäåíòàì
Ðåôåðàòû
Êóðñîâûå
Äèïëîìû
Èíôîðìàöèÿ
Ïîèñê ïî ñàéòó
Ñàìîå ïîïóëÿðíîå
Êàðòà ñàéòà
Îáðàòíàÿ ñâÿçü

Ñòóäåíòàì


Ñòóäåíòàì > Êóðñîâûå > Äðàéâåð æåñòêîãî äèñêà

Äðàéâåð æåñòêîãî äèñêà

Ñòðàíèöà: 6/6

 

         mov     dx, offset initm       ; àäpåñ ñîîáùåíèÿ îá óñòàíîâêå

         mov     ah, 9           ; âûâîä ñòpîêè

         int     21h            

 

         mov     word ptr es:[di+end_adr], offset diskdrv ; Óñòàíàâëèâàåì êîíå÷íûé àäðåñ äðàéâåðà

         mov     ax, cs

         mov     es:[di+end_adr+2], ax 

         mov     byte ptr es:[di+num_dev], 1   ; ïîääåpæèâàåòñÿ 1 óñòpîéñòâî

         mov     word ptr es:[di+bpb_adr], offset bpb_ptr ; àäpåñ óêàçàòåëÿ      

         mov     es:[di+bpb_adr+2], ds                    ; íà BPB

         mov     bpb_ptr+2, ds   ; ñåãìåíòíûé àäpåñ BPB â óêàçàòåëå íà BPB

 

         xor     ax, ax          ; âñå îòëè÷íî                  

         ret                     ; âîçâpàò â âûçûâàþùóþ ïpîãpàììó

 

init     endp

         ; -----------------------------------------------------------------

dummy    proc    near            ; New generation choose Pepsi

         xor     ax, ax          ; î÷èñòèòü áèò çàíÿòîñòè

         ret                     ; âîçâpàò â âûçûâàþùóþ ïîäïpîãpàììó

dummy    endp        

         ; -----------------------------------------------------------------

med_test proc    near

         mov     byte ptr es:[di+changed], 1

         xor     ax, ax          ; î÷èñòèòü áèò çàíÿòîñòè

         ret                     ; âîçâpàò â âûçûâàþùóþ ïîäïpîãpàììó

med_test endp        

         ; -----------------------------------------------------------------

get_bpb  proc    near            ; ïåpåäàòü DOS àäpåñ BPB

         mov     word ptr es:[di+bpb_adr], offset bpb

         mov     word ptr es:[di+bpb_adr+2], ds

         xor     ax, ax          ; î÷èñòèòü áèò çàíÿòîñòè

         ret                     ; âîçâpàò â âûçûâàþùóþ ïîäïpîãpàììó

get_bpb  endp

         ; -----------------------------------------------------------------

no_rem   proc    near            ; íîñèòåëü äèñêà ÿâëÿåòñÿ íåñìåíÿåìûì

         mov     ax, 20          ; óñòàíîâèòü áèò çàíÿòîñòè

         ret                     ; âîçâpàò â âûçûâàþùóþ ïîäïpîãpàììó

no_rem   endp

         ; -----------------------------------------------------------------

write    proc    near

         mov     bp, 30h          ; ïåpåñûëêà èç DOS â äèñê

         jmp     short   move    ; êîïèpîâàòü äàííûå

write    endp

 

read     proc    near

         mov     bp, 20h           ; ïåpåñûëêà èç äèñêà â DOS

read     endp

 

move     proc    near

         mov     bx, es:[di+num_rqst]     ; êîëè÷åñòâî ïpî÷èòàííûõ ñåêòîpîâ

         fild dword ptr es:[di+sector]  ; íîìåp ïåpâîãî ñåêòîpà

         fld1

         faddp st(1), st(0)                    ;sect+1

         fistp fsec

 

         les     di, es:[di+b_adr]      ; àäpåñ áóôåpà çàíåñòè â ES:DI

 

move_1:             ;âû÷èñëÿåì ôèç. ñåêòîð

   fild fsec ;load the number of the first sector to st(0)

         fild n63   ;load count of the phisycal sectors to st(0)

         fxch       ;you understand what I mean, that’s right?

         Fprem             ;st(0) mod st(1)

         fxch

         fcomp

         fistp n           ;save number of the phisycal sector

         mov al, byte ptr n

         mov sect, al

 

         fild fsec         ;âû÷èñëÿåì ãîëîâêó

         fisub n

         fidiv n63

         fist temp

         fild n255

         fxch

         fprem

         fxch

         fcomp

         fistp n           ;save number of head

         mov al, byte ptr n

         mov head, al

 

         fild temp  ; âû÷èñëÿåì öèëèíäð

         fisub n

         fidiv n255

 

         fistp n

         mov ax, word ptr n

         dec ax                  

         mov cyl, ax

                 

h_ok:    mov dx, 3f6h             ; Turn off IRQ14

         xor al, al

         out dx, al

        

         call waithd       ; sit back and relax…

         mov dx, 1f6h             ;SDH Register

         mov al, 0a0h

         out dx, al

        

         mov dx, 1f2h             ;Sector count

         mov al, 1

         out dx, al

        

         mov dx, 1f3h             ;Sector number

         mov al, sect;1

         out dx, al

         

         mov dx, 1f4h             ;Cyl. low

         mov al, byte ptr cyl;0

         out dx, al

         mov dx, 1f5h             ;Cyl. high

         mov al, byte ptr cyl+1;0

         out dx, al

        

         mov dx, 1f6h             ;SDH register

         mov al, head             ;1

         out dx, al

        

         mov dx, 1f7h             ;Status(command) register

         mov ax, bp        ;20h

         out dx, al

        

mword:   mov dx, 1f7h             ;wait for data

         in al, dx

         test al, 8        ; 8th bit=1 - óñòð-âî çàíÿòî âûï-ì êîìàíäû

         jz mword

        

         mov cx, 256

         mov dx, 1f0h

mloop:   cmp bp, 20h       ;Read or Write?

         jne wr

         in ax, dx

         mov es:[di], ax

 

         jmp short nx

wr:      mov ax,es:[di]

         out dx, ax

 

nx:      add di, 2

         loop mloop

        

         call waithd       ;æäåì-ñ

        

         mov dx, 3f6h      ;Turn on IRQ14

         mov al, 2

         out dx, al

 

         dec bx

         cmp bx, 0  ; êîëè÷åñòâî ïpî÷èòàííûõ ñåêòîpîâ = 0 ?

         je move_e  ;if equal, goto end

         fild fsec

         fld1

         faddp st(1), st(0)

         fistp fsec

         jmp move_1        

 

move_e:  xor     ax, ax          ; âñå îòëè÷íî                  

         mov di, si

         ret                     ; âîçâpàò â âûçûâàþùóþ ïpîãpàììó

 

move     endp

 

;------------Wait till not busy---------------

waithd:  mov dx, 1f7h

         in al, dx

         test al, 128      ;128=01000000b, it means that device is ready for R/W

         jnz waithd

         ret

 

diskdrv  equ     $

 

initm    db      "Your disk installed and ready to use"

im_ger   db      "?"

         db      ": $", 13, 10, 10

         ; -----------------------------------------------------------------

code     ends

         end

Ìèíèñòåðñòâî Îáðàçîâàíèÿ è Êóëüòóðû Êûðãûçñêîé Ðåñïóáëèêè

 

 

Êûðãûçñêèé Òåõíè÷åñêèé Óíèâåðñèòåò èì. È. Ðàççàêîâà.

 

 

Êàôåäðà Èíôîðìàòèêè è Âû÷èñëèòåëüíîé Òåõíèêè

 

 

Êóðñîâîé Ïðîåêò

 

 

ïî Îðãàíèçàöèè âû÷èñëèòåëüíûõ ïðîöåññîâ

 

íà òåìó: Ðàçðàáîòêà äðàéâåðà æåñòêîãî äèñêà

 

Âûïîëíèë:    ñò. ãð. ÝÂÌ-1-99 

     Ûéñàåâ Ó.Á.

Ïðèíÿëà:       äîö. Òîêìåðãåíîâà À.Ç.

 

 

Áèøêåê 2003.



Copyright © Radioland. Âñå ïðàâà çàùèùåíû.
Äàòà ïóáëèêàöèè: 2004-09-01 (514 Ïðî÷òåíî)