flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Hard disk driver problem

Author
Thread Post new topic Reply to topic
Octavio



Joined: 21 Jun 2003
Posts: 366
Location: Spain
Octavio 27 Oct 2004, 16:47
Hello .i wrote a hd driver using pio mode without interrupts. and i have been using this on my OS without problems but recently i put this hard disk with my OS on a new computer and the disk is detected but read operations fails, i suspect that it must be a problem related to delay routines betwen port r/w because i don´t use any delay but in menuetos driver i have seen some writes to a dummy port for delay. I,m searching
for accurate information on how to write a efficient drive that will work on any computer. thanks.
Post 27 Oct 2004, 16:47
View user's profile Send private message Visit poster's website Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4 27 Oct 2004, 18:11
I have not done a hdd driver, but i have done a cd/dvd which are very simular, i have lots of test pc's and there were big diffeancs between all the drives in the delay that was needed, in the end i used the biggist delay, also on some pc they would not work on first read, need to do 2 read attemps, with a small delay in between.

Here is some hdd code i found, may help?.

\\\\||////
(@@)
ASHLEY4.


Last edited by ASHLEY4 on 27 Oct 2004, 22:52; edited 1 time in total
Post 27 Oct 2004, 18:11
View user's profile Send private message Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc 27 Oct 2004, 18:59
Try performing the read and write operations more than once -- PIO is nice, but very hard to deal with on faster computers. I can share my HDD driver if you want, but it has some strange calling conventions... It does work on every system I've tried it on though.
Post 27 Oct 2004, 18:59
View user's profile Send private message Visit poster's website Reply with quote
Octavio



Joined: 21 Jun 2003
Posts: 366
Location: Spain
Octavio 27 Oct 2004, 22:37
crc wrote:
Try performing the read and write operations more than once -- PIO is nice, but very hard to deal with on faster computers. I can share my HDD driver if you want, but it has some strange calling conventions... It does work on every system I've tried it on though.

read two times is normal on removable devices just after the disk has changed but i think that on a hard disk any error is not normal.
also sometimes, specially with older disk they become busy forever and don´t respond even for the reset command.
And yes i would like to see your hdd driver if it works on many computers
also if you want to see my code (asm but not fasm)i can share it.
what is strange calling conventions in assembly language?
and even if it is unreadable (optimized) i don´t care. what i don´t like is when people write a lot of lines of code for doing simple things (like linux).

Just now i only have one computer, i have destroy the other Sad i have 2 adapters for removable hd but they are imcompatible ("pc compatible" sounds strange today) , and when placing the disc on the wrong adapter it burns the two ide controllers and the other
hard disk, but i have luck, one of the disk has survived. Now i´m thinking
wich computer to buy.
Post 27 Oct 2004, 22:37
View user's profile Send private message Visit poster's website Reply with quote
Gomer73



Joined: 29 Nov 2003
Posts: 151
Gomer73 28 Oct 2004, 21:10
Check out Hale's site:
http://www.ata-atapi.com/

I converted his code to assembler for my OS and it works great.

You can also check out the UDMA driver for FreeDOS
Post 28 Oct 2004, 21:10
View user's profile Send private message Reply with quote
Octavio



Joined: 21 Jun 2003
Posts: 366
Location: Spain
Octavio 29 Oct 2004, 00:45
well, i found the problem , i was using something like this:
mov dx,1f4h
out dx,eax

instead it should be:
mov dx,1f4h
out dx,al
inc dx
mov al,ah
out dx,al
inc dx...........

some ports registers must be writen one byte at a time.
Post 29 Oct 2004, 00:45
View user's profile Send private message Visit poster's website Reply with quote
ASHLEY4



Joined: 28 Apr 2004
Posts: 376
Location: UK
ASHLEY4 29 Oct 2004, 01:40
You might be better off with this:
Code:
        mov   dx,4                                              add   dx,word [port]          ; Add the base        out   dx,al      

for pc with more than 1 hdd

\\\\||////
(@@)
ASHLEY4.
Post 29 Oct 2004, 01:40
View user's profile Send private message Reply with quote
Octavio



Joined: 21 Jun 2003
Posts: 366
Location: Spain
Octavio 29 Oct 2004, 16:28
ASHLEY4 wrote:
You might be better off with this:
Code:
        mov   dx,4                                      
        add   dx,word [port]          ; Add the base
        out   dx,al      

for pc with more than 1 hdd

\\\\||////
(@@)
ASHLEY4.

it was just a example, my driver supports 4 hd in chs or lba mode and can support even more with a small modification on the code.
OT: Now i have a PIII 930Mhz and after test my programs it seems that is
a bit faster than the other computer amd xp1800 !
Post 29 Oct 2004, 16:28
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.