Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

hard disk in real mode
Hello everyone.

Programming in real mode, how can I determinate how many harddisks are
present in my pc ? and how they are numbered ?

And to use these function (and other):
Int 13/AH=03h - DISK - WRITE DISK SECTOR(S)
Int 13/AH=02h - DISK - READ SECTOR(S) INTO MEMORY

how can i know what is the maximum number of cylinder, head and sector per
each hardDisk ?
and what exactly does this mean ?
"DL = drive number (bit 7 set for hard disk)"
I have to set DL to my driver number and OR it with 0x40 ?

Thanks in advance
Cya
Matic



Report this thread to moderator Post Follow-up to this message
Old Post
Matic
03-31-04 10:33 PM


Re: hard disk in real mode
On Wed, 31 Mar 2004 21:47:00 +0000 (UTC), Matic <matic999@hotmail.com>
wrote:

>Hello everyone.
>
>Programming in real mode, how can I determinate how many harddisks are
>present in my pc ? and how they are numbered ?
>
>And to use these function (and other):
>Int 13/AH=03h - DISK - WRITE DISK SECTOR(S)
>Int 13/AH=02h - DISK - READ SECTOR(S) INTO MEMORY
>
>how can i know what is the maximum number of cylinder, head and sector per
>each hardDisk ?

>and what exactly does this mean ?
>"DL = drive number (bit 7 set for hard disk)"
>I have to set DL to my driver number and OR it with 0x40 ?
>
>Thanks in advance
>Cya
>Matic
>

You will find a lot of info in Ralf Brown's Interrupt List.

Note that if you expect to run on anything over 4 GB
you should probably forget about the CHS system
and go to LBA (Logical Block Addressing).

As for the DOS drive numbering, bit 7 is 80h, so the
first (0th) hard drive is 80h, which is almost always
called drive C, 81h would be D, and so on.

Hope this helps!


Bob Masta
dqatechATdaqartaDOTcom

D A Q A R T A
Data AcQuisition And Real-Time Analysis
www.daqarta.com



Report this thread to moderator Post Follow-up to this message
Old Post
Bob Masta
04-01-04 01:30 PM


Re: hard disk in real mode
Matic <matic999@hotmail.com> wrote:

>Programming in real mode, how can I determinate how many harddisks are
>present in my pc ?

The byte at linear address 0x475 contains the number of hard drives
known to the BIOS. In Turbo C:
unsigned num_hds = pb(0x40, 0x75);

>and how they are numbered ?

I don't think there's a standard for this; it depends on the OS,
how the hard drives are partitioned, and (for DOS and Windows)
the filesystem type for each partition.

>And to use these function (and other):
>Int 13/AH=03h - DISK - WRITE DISK SECTOR(S)
>Int 13/AH=02h - DISK - READ SECTOR(S) INTO MEMORY

These are fairly simple; see Ralf Brown's famous Interrupt List
(search for it).

>how can i know what is the maximum number of cylinder, head and sector per
>each hardDisk ?

Use INT 13h AH=08h to retrieve the hard disk geometry information.
Large (new!) hard drives may not have a valid CHS geometry,
so you should also look at using the LBA disk functions in the
BIOS: INT 13h AH=41h/AH=42h/AH=43h

>and what exactly does this mean ?
>"DL = drive number (bit 7 set for hard disk)"
>I have to set DL to my driver number and OR it with 0x40 ?

0x80 is the INT 13h number of the first hard drive,
0x81 is the second hard drive, etc.



Report this thread to moderator Post Follow-up to this message
Old Post
Chris Giese
04-02-04 03:30 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

A86 Assembler archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:28 AM.

 

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.