delorie.com/archives/browse.cgi | search |
X-Authentication-Warning: | delorie.com: mailnull set sender to djgpp-bounces using -f |
From: | "dom" <dcurran AT ti DOT com> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Can't read HDD sectors, why? |
Date: | Sat, 26 Jan 2002 18:50:49 -0600 |
Organization: | Texas Instruments |
Lines: | 58 |
Message-ID: | <a2vj7c$jje$1@tilde.csc.ti.com> |
NNTP-Posting-Host: | dvtest10.sc.ti.com |
X-Trace: | tilde.csc.ti.com 1012092972 20078 128.247.13.75 (27 Jan 2002 00:56:12 GMT) |
X-Complaints-To: | usenet AT news DOT ti DOT com |
NNTP-Posting-Date: | 27 Jan 2002 00:56:12 GMT |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Newsreader: | Microsoft Outlook Express 5.00.2919.6700 |
X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2919.6700 |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Reply-To: | djgpp AT delorie DOT com |
Hi I'm having all sorts of problems, and getting very confused. I want to read sectors from my HDD. I am using the following code (which is almost identical to the help code for _bios_disk). If I run this code from a Win98 dosbox then it returns a status of 0x50 (Data read error && Seek error). If I run this code after booting to the dos prompt using a Win98 boot disk it returns a status of 0x01 (Invalid request or a bad command). Can anyone tell me why ? And how I can solve this problem ? #include <stdio.h> #include <bios.h> int main() { char record_buffer[512]; struct diskinfo_t di; unsigned status; printf("Read sector\n"); di.drive = 0x80; di.head = 0; di.track = 0; di.sector = 0; di.nsectors = 1; di.buffer = &record_buffer; status = _bios_disk(_DISK_READ, &di); if ( status ) printf("Disk error.(%i)\n", status); else printf("OK\n"); return 0; } I have been banging my head on this problem every night this week. I thought that when booting to the DOS prompt using a Win98 boot disk, I would be in a 16-bit enviroment. Is this true ? Might this have something to do with it ? NOTE: A call to _dos_getdiskfree(..) seems to work OK. Any help much appreciated. Also I'm new to DJGPP, so please make help as verbose as possible. Thanks dom
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |