delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/11/10/18:31:10

From: "Ben Davis" <ben AT vjpoole DOT freeserve DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Mixing BIOS and DOS disk functions
Date: Wed, 10 Nov 1999 22:12:49 -0000
Organization: Customer of Planet Online
Lines: 49
Message-ID: <80cuqf$3k0$1@news5.svr.pol.co.uk>
NNTP-Posting-Host: modem-53.sustiva.dialup.pol.co.uk
X-Trace: news5.svr.pol.co.uk 942276239 3712 62.136.87.53 (10 Nov 1999 23:23:59 GMT)
NNTP-Posting-Date: 10 Nov 1999 23:23:59 GMT
X-Complaints-To: abuse AT theplanet DOT net
Keywords: disk,bios,dos,disc,diskette,install,installation,floppy,fdd,biosdisk
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I've written an installation program for a game, which is placed on the
first floppy disk of three. The rest of that disk, and the two other disks,
are filled with data which is decompressed on to the hard disk when the game
is installed. I am using standard ANSI / Allegro file functions for this,
i.e. fread(), fwrite(), and the equivalent pack_*() functions in Allegro.
These go through the DOS file system.
For various reasons, I also need to use biosdisk(_DISK_READ, ...). This is
called once, as the first access to each disk (i.e. it is called once for
the first disk, once for the second disk and once for the third disk). I am
using this call to detect whether the correct disk is in the drive.

Here's the problem:

If I run the installation program straight off the first floppy disk, and
leave the disk in until it starts to load the compressed data from that
disk, then there is no problem.
If I run the installation program off the hard disk, making sure the floppy
disk is in the drive before it needs it, it does the following every time:
1. It calls biosdisk() to find out if the right disk is in (supposedly).
2. It doesn't detect the disk, and it asks for Disk 1.
3. Next time it calls biosdisk(), it detects the disk properly and
continues.

It is then that the rest of the disk is read using DOS functions.

When the program needs the second disk, it assumes that the user won't have
had time to change it already :-) so it asks for the second disk straight
away. Then it waits for a key.
I put the second disk in, and press a key. It checks the disk, and thinks it
is the wrong one.
I press a key again. It checks the disk and continues properly.

The same thing happens with the third disk, and it happens exactly the same
every time.

I have a feeling that this problem is something to do with mixing the BIOS
and DOS functions. Is there some sort of flush or reset that I need to do
somewhere? (DJGPP function name?)
I tried calling biosdisk(_DISK_RESET, ...), and it just made DOS forget that
the disk had been changed. The next biosdisk(_DISK_READ) confirmed that the
new disk was there, and then the DOS functions (including DIR once the
program had exited) started pretending that the first disk was still there.

Any help would be appreciated. Please reply quickly, as I have a short
deadline to provide this game as a finished product.

Ben Davis


- Raw text -


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