.model tiny .code org 100h sta: call pre and al,0efh ;primar out dx,al mov dx,1f7h mov al,0ech out dx,al call wat call pot call pre or al,10h ;sekundar out dx,al mov dx,1f7h mov al,0ech ;a1 out dx,al call wat call pot call pre and al,0efh ;primar out dx,al mov dx,1f7h mov al,0a1h out dx,al call wat call pot call pre or al,10h ;sekundar out dx,al mov dx,1f7h mov al,0a1h ;a1 out dx,al call wat call pot ret pre: mov dx,01f6h in al,dx mov byte ptr[offset olm],al ret pot: mov dx,01f6h mov al,byte ptr[offset olm] out dx,al ret wat: xor cx,cx way: in al,dx ;---reader test al,80h loopnz way maz: mov dx,1f0h ;--- reading & analysing mov cx,256 mov bx,offset buf fax: in ax,dx mov word ptr[bx],ax inc bx inc bx loop fax mov bx,offset reb call sch mov bx,offset buf mov cx,512 call hex mov bx,offset gec call sch mov ch,byte ptr[offset buf] mov cl,8 mov bx,offset gen call ana mov ch,byte ptr[offset buf + 1] mov cl,7 call ana mov bx,offset nlc call sch mov ch,2 mov bx,offset buf + 2 call con mov bx,offset nlh call sch mov ch,2 mov bx,offset buf + 6 call con mov bx,offset nls call sch mov ch,2 mov bx,offset buf + 0ch call con mov bx,offset snm call sch mov bx,offset buf + 14h mov cx,10 call pbp mov bx,offset fmw call sch mov bx,offset buf + 2Eh mov cx,4 call pbp mov bx,offset mnm call sch mov bx,offset buf + 36h mov cx,20 call pbp mov bx,offset bsi call sch mov bx,offset buf + 2ah mov ch,2 call con mov bx,offset get mov ch,byte ptr[offset buf + 63h] mov cl,5 shl ch,1 shl ch,1 call ana mov bx,offset ccp call sch mov bx,offset buf + 72h mov ch,4 call con mov bx,offset lba call sch mov bx,offset buf + 78h mov ch,4 call con ret ;---------------------------------- ana: call eol call sch ;CH byte 4 examine CL how many cmp byte ptr[bx],'@' jz sww shl ch,1 jc mst call sch call skp jmp qaz mst: call skp call sch jmp qaz sww: shl ch,1 push bx mov bx,offset yes jc sye mov bx,offset no sye: call sch pop bx inc bx qaz: dec cl jnz ana ret sch: mov ah,02h mov dl,byte ptr[bx] inc bx cmp dl,'%' jz chw int 21h jmp sch chw: ret skp: mov dl,byte ptr[bx] inc bx cmp dl,'%' jnz skp ret ccp: db 0ah,0dh,'Current capacity in sectors (LBA): %' lba: db 'Total number of user addressable sectors (LBA mode): %' bsi: db 'Controller buffer size (in 512 byte sectors): %' mnm: db 'Manufacturer and model: %' fmw: db 'Firmware revision: %' snm: db 'Serial number: %' nlc: db 0ah,0dh,'Number of logical cylinders: %' nlh: db 'Number of logical heads: %' nls: db 'Number of logical sectors %' reb: db 'Disk identification sector dump:',0ah,0dh,0ah,0dh,'%' gec: db 0ah,0dh,'General configuration of disk:',0ah,0dh,'%' yes: db 'Yes',09h,'%' no: db 'No',09h,'%' gen: db 'Device class: %ATA%ATAPI%Requires format' db ' speed tolerance gap: %@Supports track offset' db 'option: %@Supports data strobe offset: %@' db 'Disk rotation speed tolerance more than 0.005: %@' db 'Transfer rates:',0ah,0dh,'0 .. 5 Mbps:',09h,'%@' db '5 .. 10 Mbps:',09h,'%@10 .. ? Mbps:',09h,'%@' db 'Removable medium: %@Fixed medium: %@Synchronized drive' db ' motor option: %@Head switching slower than 15 ms: %@' db 'Encoding: %MFM%non MFM%Soft sectored: %@Hard sectored: %@' get: db 'Standby timer according to ATA standart: %@IORDY support: %@' db 'Device can disable use of IORDY: %@LBA mode supported: %@' db 'DMA supported: %@' ;---------------------------------- con: mov ax,3013h mov si,offset cl0 cll: mov byte ptr[si],ah inc si dec al jnz cll mov byte ptr[si],'1' dos: mov cl,8 mov ah,byte ptr[bx] doi: mov si,offset cl1 + 9 mov di,offset cl0 + 9 push si push si shr ah,1 jnc anc call tad anc: pop si pop di call tad dec cl jnz doi inc bx dec ch jnz dos mov di,offset cl0 mov dh,9 aty: cmp byte ptr[di],'0' jnz fnh inc di dec dh jnz aty fnh: inc dh call ass call eol ret tad: push cx mov cx,0a00h tlp: mov al,byte ptr[si] add al,byte ptr[di] add al,cl xor cl,cl sub al,30h cmp al,3ah jc tgd sub al,0ah mov cl,1 tgd: mov byte ptr[di],al dec si dec di dec ch jnz tlp pop cx ret pbp: mov ah,02h pax: mov dh,byte ptr[bx] inc bx mov dl,byte ptr[bx] inc bx int 21h mov dl,dh int 21h loop pax jmp eol hex: mov ax,3004h mov di,offset dln prs: mov byte ptr[di],ah inc di dec al jnz prs dmp: mov ax,2046h mov di,offset dln+76 cln: dec di mov byte ptr[di],ah dec al jnz cln mov dx,0 lpp: push cx mov al,byte ptr[bx] mov ah,al test ah,80h jnz spo cmp ah,20h jnc npo spo: mov ah,'.' npo: mov di,60 add di,dx mov byte ptr [offset dln + di],ah push dx mov cx,204h mov di,7 add di,dx add di,dx add di,dx shr dl,1 shr dl,1 add di,dx pop dx wrc: mov ah,0fh rol al,cl and ah,al cmp ah,10 jc god add ah,7 god: add ah,48 mov byte ptr [offset dln + di],ah inc di dec ch jnz wrc pop cx loop qwe tln: call tlq eol: mov dl,0ah int 21h mov dl,0dh int 21h ret tlq: mov dh,76 mov di,offset dln ass: mov dl,byte ptr[di] inc di mov ah,02h int 21h dec dh jnz ass ret qwe: inc bx inc dl cmp dl,16 jc lpp call tln mov di,offset dln+2 kox: cmp byte ptr[di],'F' jc ync mov byte ptr[di],'0' dec di jmp kox ync: inc byte ptr[di] cmp byte ptr[di],3ah jnz daj add byte ptr[di],7 daj: jmp dmp ;----------------------------------------------------------- dln: db 4 dup(?),': ',70 dup(?) cl0: db 10 dup(?) cl1: db 10 dup(?) buf: db 512 dup(?) olm: db ? end sta