Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
I have found tutorials on how to read from a hard drive. My code does read something (not sure if that is what it should read) but I wanted to ask about one parameter sent to port 0x1F6. For giving a request I have this code:
I am not sure what should be passed on instead of DRIVE. All I know is that it is called 'drive indicator'. What does that mean?
Also, what data types should be used for each variable? sectors, DRIVE and block_addr.
Thanks![/i]
Technical Information on the ports:
Port Read/Write Misc
------ ------------ -------------------------------------------------
1f0 r/w data register, the bytes are written/read here
1f1 r error register (look these values up yourself)
1f2 r/w sector count, how many sectors to read/write
1f3 r/w sector number, the actual sector wanted
1f4 r/w cylinder low, cylinders is 0-1024
1f5 r/w cylinder high, this makes up the rest of the 1024
1f6 r/w drive/head
bit 7 = 1
bit 6 = 0
bit 5 = 1
bit 4 = 0 drive 0 select
= 1 drive 1 select
bit 3-0 head select bits
1f7 r status register
bit 7 = 1 controller is executing a command
bit 6 = 1 drive is ready
bit 5 = 1 write fault
bit 4 = 1 seek complete
bit 3 = 1 sector buffer requires servicing
bit 2 = 1 disk data read corrected
bit 1 = 1 index - set to 1 each revolution
bit 0 = 1 previous command ended in an error
1f7 w command register
commands:
50h format track
20h read sectors with retry
21h read sectors without retry
22h read long with retry
23h read long without retry
30h write sectors with retry
31h write sectors without retry
32h write long with retry
33h write long without retry
Yes, I've seen that myself, and wondered the same thing. If you puzzle through Dex's info, you will see that DRIVE is just a bit, with a value of 0 (master) or 1 (slave).