Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.msdos.programmer > #778

Re: Anyone seen int 21/36 produce invalid results?

From "Rod Pemberton" <do_not_have@notemailnotz.cnm>
Newsgroups comp.os.msdos.programmer
Subject Re: Anyone seen int 21/36 produce invalid results?
Date 2012-10-19 19:44 -0400
Organization Aioe.org NNTP Server
Message-ID <k5soej$76t$1@speranza.aioe.org> (permalink)
References <93a63172-c998-4200-b7e7-8a3b62a3740e@c17g2000yqe.googlegroups.com>

Show all headers | View raw


"Jim Leonard" <mobygamer@gmail.com> wrote in message
news:93a63172-c998-4200-b7e7-8a3b62a3740e@c17g2000yqe.googlegroups.com...
> Posting to this group in 2012 is akin to shouting into the wind, but
> what the heck, I'll give it a shot anyway.  I'm working on a hobby
> program for DOS that reads FAT12/FAT16 directly, and I've noticed that
> sometimes DOS returns incorrect information in int 21 subfunc 36h
> which is "get free disk space".  For reference:
>
> AH = 36h
> DL = drive number (00h = default, 01h = A:, etc)
>
> Return:
> AX = FFFFh if invalid drive
> else
> AX = sectors per cluster
> BX = number of free clusters
> CX = bytes per sector
> DX = total clusters on drive
>
> I have used this function to get BX (number of free clusters), then
> read the FAT12 or FAT16 directly myself with my own routines and found
> that DOS sometimes reports 1 or 2 more free clusters than are actually
> marked as such in the FAT.  I've gone over a FAT16 hex dump with my
> own eyes, cluster by cluster, to make sure my routines are working
> properly -- they are.  So DOS (in my case, IBM PC DOS 2000 which is PC
> DOS 7.03 IIRC) is wrong in this case.
>
> Has anyone else seen this and/or might know what is causing it?

Sorry, no.

I've not called it directly from assembly.  It's very possible I called it
indirectly via a DJGPP C function.

I can make some basic (or wild) guesses, that you could probably make too.

Here are my basic guesses.  I doubt they'll help all that much:

1) one of the other four issues listed in RBIL's description
2) allocation not flushed to disk
3) bug in your math calculations
4) bug in your version of DOS

The first two of the four RBIL issues seem plausible that they could cause
your issue.


The last RBIL issue mentions FAT32.  The issue seems unrelated, but it makes
me wonder if your filesystem is actually FAT16.  Could it be FAT32?  From
Wikipedia's FAT page, there are a large number of variations: FAT16B,
FAT16+, FATX16, FAT32, FAT32X, FAT32+, FATX32, exFAT.


For possible math bugs, I'm thinking something like:

adc instead of add, CF is set or not cleared via CLC
sbb instead of sub, CF is set or not cleared via CLC
dx is not cleared for 16/32-bit div or mul or imul


Rod Pemberton


Back to comp.os.msdos.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Anyone seen int 21/36 produce invalid results? Jim Leonard <mobygamer@gmail.com> - 2012-10-17 13:58 -0700
  Re: Anyone seen int 21/36 produce invalid results? Dr J R Stockton <reply1242@merlyn.demon.co.uk.invalid> - 2012-10-18 19:32 +0100
    Re: Anyone seen int 21/36 produce invalid results? Jim Leonard <mobygamer@gmail.com> - 2012-10-19 07:50 -0700
      Re: Anyone seen int 21/36 produce invalid results? NimbUs <nimbus@XXX.invalid> - 2012-10-23 16:32 +0000
        Re: Anyone seen int 21/36 produce invalid results? Jim Leonard <mobygamer@gmail.com> - 2012-10-24 20:13 -0700
          Re: Anyone seen int 21/36 produce invalid results? NimbUs <nimbus@XXX.invalid> - 2012-10-27 12:19 +0000
            Re: Anyone seen int 21/36 produce invalid results? NimbUs <nimbus@XXX.invalid> - 2012-10-27 12:23 +0000
  Re: Anyone seen int 21/36 produce invalid results? JJ <jaejunks_at@_googlemail_dot._com> - 2012-10-19 15:39 +0000
    Re: Anyone seen int 21/36 produce invalid results? Jim Leonard <mobygamer@gmail.com> - 2012-10-19 12:45 -0700
      Re: Anyone seen int 21/36 produce invalid results? JJ <jaejunks_at@_googlemail_dot._com> - 2012-10-21 07:19 +0000
  Re: Anyone seen int 21/36 produce invalid results? "Rod Pemberton" <do_not_have@notemailnotz.cnm> - 2012-10-19 19:44 -0400
    Re: Anyone seen int 21/36 produce invalid results? Jim Leonard <mobygamer@gmail.com> - 2012-10-24 20:19 -0700

csiph-web