Code: Select all
mov dx, 1f6h
mov al,10100000b
out dx,al
inc dx
mov al,11101100b
out dx,al
still: in al,dx
test al,8
jz still
mov cx,256
mov bx,0
lea si,[Buffer]
upp: mov dx,1f0h
in ax,dx
cmp al,0
jne nxxt
mov al,20
nxxt: cmp ah,0
jne nxxt1
mov ah,20
nxxt1: mov [si+bx],al
mov [si+bx+1],ah
add bx,2
loop upp
mov ax,2020
cmp word [si+36h],ax
je err0r
xor bx,bx
mov bl,Count
cont: mov ax,word [si+bx]
xchg ah,al
mov word [si+bx],ax
cmp bx,46h
je dis
inc bx
inc bx
jmp cont
dis: xor bx,bx
mov bl,14h
cot: mov ax,word [si+bx]
xchg ah,al
mov word [si+bx],ax
cmp bx,24h
je here
inc bx
inc bx
jmp cot
here: mov ah,09h
mov dx,[@Model]
int 21h
mov byte [si+46h],"$"
mov dx,[Buffer+36h]
int 21h
mov dx,[Serial]
int 21h
mov byte [si+24h],"$"
mov dx,[Buffer+14h]
int 21h
jmp exit
err0r: mov ah,09h
mov dx,[on_error]
int 21h
exit: ret
Buffer DB 512, (0)
Count db 36h
on_error db "No HDD0, or read error",13,10,"$"
@Model db "Detecting HDD0...",13,10
db "HDD0 model: ","$"
Serial db 13,10
db "HDD0 serial number: ","$"