delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/12/01/13:21:30

From: "Clive Minnican" <clive_minnican AT hotmail DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Reading Disk Sectors
Lines: 32
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
Message-ID: <ULRV5.4269$0z.62544@news2-win.server.ntlworld.com>
Date: Fri, 1 Dec 2000 18:07:10 -0000
NNTP-Posting-Host: 213.105.124.115
X-Complaints-To: abuse AT ntlworld DOT com
X-Trace: news2-win.server.ntlworld.com 975693940 213.105.124.115 (Fri, 01 Dec 2000 18:05:40 GMT)
NNTP-Posting-Date: Fri, 01 Dec 2000 18:05:40 GMT
Organization: ntl Cablemodem News Service
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi,

I am trying to figure out how to use DJGPP to read sectors from a floppy
disk. I have tried using the _bios_disk() function from bios.h with the code
fragment below:

char buffer[512];

 struct diskinfo_t di;
  di.drive = 0;
  di.head = 0;
  di.track = 0;
  di.sector = 0;
  di.nsectors = 1;
  di.buffer = &buffer;

_bios_disk(_DISK_RESET, &di);
  error = _bios_disk(_DISK_READ, &di);
  if (error) {
    printf("Disk Error: %x\n",error);
    exit(0);
  }

but every time it comes out with an error of 0xa00 (Bad sector flag
detected). Have I used the function correctly? If you know any other ways of
achieving the same thing please let me know. Basically I want to write a
function that reads a specified sector from the disk into a buffer.

Cheers,
Clive.


- Raw text -


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