freelanceprogrammers.org Forum Index » C

Plz do debug my pro(Urgent)


View user's profile Post To page top
ar_frenz Posted: Tue Jul 29, 2003 6:00 pm


Joined: 05 Jul 2003

Posts: 8
Plz do debug my pro(Urgent)
Compiler : Turbo C++ 3.0
 
Hello friend ,             I have written a program to verify a particuler sector of hard drive and floppy drive;
i`m using interrupt no 13 & service no 4     
using int86x Function ;
now the problem is this program is working fine for hard disk
but for floppy it is always returning 0xA error code
ie. bad sector detected ; while floppy is good ; but is showing all the sector in floppy bad ;
what is the problem plz do help me ; its urgent ;
my prgram is attahed plz do have a look and try to find out what is the problem ;
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
Reply with quote
Send private message
View user's profile Post To page top
shantanu_k06 Posted: Tue Jul 29, 2003 10:25 pm


Joined: 19 Jul 2003

Posts: 29
Plz do debug my pro(Urgent)
Hi Arumita (and everybody who cares about INT 13h),

INT 13h has an interesting history which is worth
knowing in order to understand how it works.
Initially, when PCs didn`t use to have hard disks, INT
13h did floppy read/write/format kind of stuff with
the help of FDC (Floppy Disk Controller). Then came
hard disks and technical parameters (e.g. seek-time,
inter-sector gap etc.) changed for accessing them. So,
there was INT 40H for hard disks. But it would have
been difficult (if not impossible) to re-write all
existing programs with two different ways to access
floppies (using INT 13h) and hard disks (INT 40h)
respectively. That meant the BIOS manufacturers would
have to come up with a solution which didn`t hurt the
existing programs. Interesting, hmm? Read on the next
paragraph.

Historically, INT 30h used to have a FAR Jump (JMP
FAR) instruction for CP/M style calls. (Note: CP/M was
the predecessor to MS-DOS.) By the time hard disks had
arrived, CP/M support was already diminished, and BIOS
manufacturers found it feasible to re-cycle this
interrupt. So, they wrote extensions to POST (Power On
Self Test) routines which used INT 30h to re-vector
the FDC (Floppy Disk Controller, i.e. the original INT
13h), and the new INT 13h routine began working as a
smart hook to branch disk-accessing requests to INT
30h (for floppies) and INT 40h (hard disks). Did you
already guess this solution while reading at the
beginning of the paragraph? Pat yourself then.

Now, that`s enough of history. Coming to Arumita`s
case. I had similar problems accessing UNIX-formatted
floppies from MS-DOS (that clearly meant I could not
have used INT 25h/26h at all) despite following fine
reference books (like "The Programmer`s Technical
Reference" by Dave Williams, Galgotia publications and
"Undocumented PC" by Frank Van Gilluve, Adisson Wesley
publishing). With experimentation, observation and bit
of guesswork, I found that what I was failing to do
was to initialize the FDC, because the accessing
worked fine when I tried to access the floppy after
running "dir" comand on that floppy. So, what I did
was to precede every fresh-access with a call to
initialize the FDC (function 00h of INT 13h) and do
the same following every error in access (i.e.
status_byte != 0). My problem was then solved and the
program I wrote worked fine for as long as that old
UNIX server existed before being finally scrapped.

This all happened in year 1997, six years back, when
Turbo C++ 3.0 was still hot despite lacking suport for
exceptions (something that I was annoyed with Turbo
C++ 3.0 for). I hope this technique works in Arumita`s
case but I am not sure because MS-Windows has changed
much since then. In MS-DOS, this might still work, but
no guarantee yet. Well, the summary of my reply are
these suggestions:

1. Precede every fresh floppy-access call with INT 13h
function 00h.
2. Follow every floppy-access error with INT 13h
function 00h.
3. Don`t do initialize HDC while accessing hard disks.

Note to Arumita: I can see a method norton() in one of
your classes and some text-graphics stuff done there.
What are you upto? Trying to make an NDD (Norton Disk
Doctor) clone? ;-)

Regards,
Shantanu

P.S. : Wouldn`t have written this long a reply with
all history & stuff if the power supply here didn`t
trip, forcing me to write it all over again (but in
offline mode ofcourse :-).

--- Arumita De <ar_frenz@...> wrote:
> Compiler : Turbo C++ 3.0
>
> Hello friend ,
> I have written a program to verify a
> particuler sector
> of hard drive and floppy drive;
> i`m using interrupt no 13 & service no 4
> using int86x Function ;
> now the problem is this program is working fine for
> hard disk
> but for floppy it is always returning 0xA error code
>
> ie. bad sector detected ; while floppy is good ; but
> is showing all the sector in floppy bad ;
> what is the problem plz do help me ; its urgent ;
> my prgram is attahed plz do have a look and try to
> find out what is the problem ;


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
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
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help