CD-ROM driver
Posted: Sat Dec 05, 2009 6:32 pm
Hi. I have this code given to me by Dex. (so, this post is most of all for Dex)
It works great with primary device (port 0x1F0).
In my VM I have two HDD's at IDE(0:0) and IDE(0:1) and one CD-ROM device at IDE(1:0). Reading HDD's gives no problems, but reading CD-ROM(port 0x170) gives it: I do not get any halt or exceptions by I get just 0xFF values at address sector should be loaded to.
Thanks for any help.
Daniel.
Code: Select all
hdbase equ 0x1f0 ; 0x1f0 for primary device
; 0x170 for secondary device
hdid equ 0x00 ; 0x00 for master hd
; 0x10 for slave hd
;---------------------------------------------------------;
; hd_read. ; eax = sector to read ;
;---------------------------------------------------------;
_HddRead:
mov eax, [_Sector]
pushad
push eax
newhdread:
mov edx,hdbase
inc edx
mov al,0
out dx,al
inc edx
mov al, 1
out dx,al
inc edx
pop ax
out dx,al
inc edx
shr ax,8
out dx,al
inc edx
pop ax
out dx,al
inc edx
shr ax,8
and al,1+2+4+8
add al,hdid
add al,128+64+32
out dx,al
inc edx
mov al,20h
out dx,al
hddwait:
in al,dx
test al,128
jnz hddwait
mov edi,[_HddBuffer]
mov ecx,256
mov edx,hdbase
cld
rep insw
popad
ret
In my VM I have two HDD's at IDE(0:0) and IDE(0:1) and one CD-ROM device at IDE(1:0). Reading HDD's gives no problems, but reading CD-ROM(port 0x170) gives it: I do not get any halt or exceptions by I get just 0xFF values at address sector should be loaded to.
Thanks for any help.
Daniel.