mastoo
18-09-2006, 20:17
Ho scritto un semplicissimo programma in assembly che viene caricato dal boot sector del floppy.
Con qemu faccio partire la macchina virtuale con creato un hd di 2megabyte circa.
Vorrei conoscere i parametri di questo disco (hd)
Ho pensato di utilizzare l'interrupt INT 13h AH=08h: che dovrebbe leggerli
/--------da wikipedia-----------------------------------------/
INT 13h AH=08h: Read Drive Parameters
Parameters:
Registers
AH 08h = function number for read_drive_parameters
DL drive index (e.g. 1st HDD = 80h)
Results:
CF Set On Error, Clear If No Error
AH Return Code
DL number of hard disk drives
DH logical last index of heads = number_of - 1 (because index starts with 0)
CX logical last index of cylinders = number_of - 1 (because index starts with 0)
logical last index of sectors per track = number_of (because index starts with 1)
Remarks:
Logical values of function 08h may/should differ from physical CHS values of function 48h.
Result register CX contains both cylinders and sector/track values, see remark of function 02h.
/----------------------------
uno spezzone del mio codice
mov ah,08h
mov dl,80h
int 13h
mov al,dh
mov si, dato
call byte2ascii ;converte il byte al in cifre ascii e salva all'indirizzo ds:si
call print ;stampa il numero
mov dx,cx
and cx,0000000000111111b
mov al,cl
mov si, dato
call byte2ascii
call print
and dx,1111111111000000b
mov al,dh
mov si, dato
call byte2ascii
call print
fin qui dovrebbe essere tutto giusto (almeno spero)
ma i parametri del disco che leggo mi lasciano un po :confused:
numero di head 21
numero di settori 7
numero di cilindri 24
ora volevo sapere se il disco puo essere realmente cosi ho c'è un errore
sepero di essere stato chiaro
grazie
Con qemu faccio partire la macchina virtuale con creato un hd di 2megabyte circa.
Vorrei conoscere i parametri di questo disco (hd)
Ho pensato di utilizzare l'interrupt INT 13h AH=08h: che dovrebbe leggerli
/--------da wikipedia-----------------------------------------/
INT 13h AH=08h: Read Drive Parameters
Parameters:
Registers
AH 08h = function number for read_drive_parameters
DL drive index (e.g. 1st HDD = 80h)
Results:
CF Set On Error, Clear If No Error
AH Return Code
DL number of hard disk drives
DH logical last index of heads = number_of - 1 (because index starts with 0)
CX logical last index of cylinders = number_of - 1 (because index starts with 0)
logical last index of sectors per track = number_of (because index starts with 1)
Remarks:
Logical values of function 08h may/should differ from physical CHS values of function 48h.
Result register CX contains both cylinders and sector/track values, see remark of function 02h.
/----------------------------
uno spezzone del mio codice
mov ah,08h
mov dl,80h
int 13h
mov al,dh
mov si, dato
call byte2ascii ;converte il byte al in cifre ascii e salva all'indirizzo ds:si
call print ;stampa il numero
mov dx,cx
and cx,0000000000111111b
mov al,cl
mov si, dato
call byte2ascii
call print
and dx,1111111111000000b
mov al,dh
mov si, dato
call byte2ascii
call print
fin qui dovrebbe essere tutto giusto (almeno spero)
ma i parametri del disco che leggo mi lasciano un po :confused:
numero di head 21
numero di settori 7
numero di cilindri 24
ora volevo sapere se il disco puo essere realmente cosi ho c'è un errore
sepero di essere stato chiaro
grazie