www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/06/12/13:12:00

X-Originating-IP: [200.34.143.5]
From: "J. L." <jlsgarrido AT hotmail DOT com>
To: <djgpp AT delorie DOT com>
References: <eGkN8.90451$6v2 DOT 3674113 AT twister DOT southeast DOT rr DOT com> <OE62WSGmHP7DBdmkTXd00012964 AT hotmail DOT com> <uZwN8.91726$6v2 DOT 3769476 AT twister DOT southeast DOT rr DOT com>
Subject: Re: bit and bytes ... help [ biosdisk ]
Date: Wed, 12 Jun 2002 12:08:33 -0500
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700
Message-ID: <OE24XKGEJ0wckvJD1PI00013696@hotmail.com>
X-OriginalArrivalTime: 12 Jun 2002 17:08:25.0582 (UTC) FILETIME=[C3B498E0:01C21233]
Reply-To: djgpp AT delorie DOT com

----- Original Message -----
From: "Frank Troy Cook Jr." <fcook1 AT carolina DOT rr DOT com>
Newsgroups: comp.os.msdos.djgpp
To: <djgpp AT delorie DOT com>
Sent: Tuesday, June 11, 2002 7:54 PM
Subject: Re: bit and bytes ... help [ biosdisk ]


> wonderful help guys. thx
>
> now tell me one more thing, where can i find 9on the web, a tutorial or
> article on such a subject
>

Search on Google or another engine, some like "tutorial and C",... and be
patient. So much links points to outdated info.

P. S. I had an error in code posted. Sorry :(

J. L.

> "J. L." <jlsgarrido AT hotmail DOT com> wrote in message
> news:OE62WSGmHP7DBdmkTXd00012964 AT hotmail DOT com...
> >
> > ----- Original Message -----
> > From: "Frank Troy Cook Jr." <fcook1 AT carolina DOT rr DOT com>
> > Newsgroups: comp.os.msdos.djgpp
> > To: <djgpp AT delorie DOT com>
> > Sent: Tuesday, June 11, 2002 5:55 AM
> > Subject: bit and bytes ... help [ biosdisk ]
> >
> >
> > > i need to extract drive information returned from a biosdisk call. for
> > > example:
> > >
> > > main()
> > > {
> > >         int count;
> > >         char buffer[512];
> > >         biosdisk(8, 0x80, 0, 0, 0, 1, buffer);
> > >         for(count=0; count < 4; count++)
> > >         {
> > >                 printf("%u ", buffer[count]);
> > >         }
> > >         printf("\n");
> > > }
> > >
> > > i understandfrom the djgpp site that the first 4 bytes return:
> > > byte 0 = sectors per track (bits 0..5) and top two bits of cylinder
(in
> > bits
> > > 6..7)
> > > byte 1 = cyliders (bits 0..7)
> > > byte 2 = number of drives
> > > byte 3 = number of heads
> > > how do i convert this to integer numbers correctly?
> > >
> > If I understand the info of libgc... 8)
> >
> > You must mask, shift and reorder the byte 0 to 3.
> >
> > #include <stdio.h>
> > #include <bios.h>
> >
> > int main(void){
> >          int dummy;
> >          int sect_per_trac, cylinders, num_drives, num_heads;
> >          char buffer[512];
> >
> >          biosdisk(8, 0x80, 0, 0, 0, 1, buffer);
> >
> >         sec_per_tracks=buffer[0]&0x3C;
> >         dummy=(buffer[0]&0xC0 >> 5) << 8;

oops :)
               dummy=(buffer[0]&0xC0 >> 6) << 8;
or
               dummy=buffer[0]&0xC0 << 2;

> >         cylinders=buffer[1]&0xFF + dummy;
> >         num_drives=buffer[2]&0xFF;
> >         num_heads=buffer[3]&0xFF;
> >         /* anything else ...
> >         */
> >         return 0;
> > }
> >
> > > please respond to fcook1SPAMBLOCK AT carolina DOT rr DOT com
> > >
>

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019