🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc
Article #8883

Re: int 13h vs. int 21h disk I/O confusion

#8883
From: Stephen M. Dunn
Date: Fri, 19 Jan 1990 06:09
41 lines
2690 bytes
In article <26038@cup.portal.com> cliffhanger@cup.portal.com (Cliff C Heyer) writes:
$Books explain int 21h calls as being more 
$functional and portable than int 13h calls.
$But I'm wondering if there other important
$benefits of one method vs. the other.

   Well, int 21h is an MS-DOS call; int 13h is an IBM PC call.  int 21h works
with files; int 13h works with individual tracks and sectors.  int 21h works
with all kinds of disks; int 13h works with floppies only.

$is used(?) Also 21h gives more than one
$way of doing disk I/O (FCBs, Fcn. 44 &
$_dos_ interface calls). Do you use switches
$to control which is used in some languages?

   These days, I don't think any compilers would generate FCB calls for
any function that can be done using handles.  Handle calls are available
in DOS 2.00 and up, and since virtually nobody uses DOS 1.xx anymore, it
makes no sense to have to put up with the restrictions of FCBs (such as
not being able to use pathnames).  I've only been using assorted compilers
on PCs for about three years, but the ones I've used (Turbo Pascal 3 and +,
Lattice C 3.10, Turbo C 2.0, Clipper, a couple of others) all require DOS
2 or higher and use handles, and I've never seen one that allows you to
force it to use FCBs.  One big reason for this would be that this change
would not be in the code generated for the compiler, but would actually
require a whole new disk I/O library to be created for each memory model.
Also, there's the lack of flexibility in FCB calls ...

[questions about hard disks and stuff]

   I've never tried using int 13h, but I would imagine it would return an
error code if you tried it on a hard disk (but then again, we're discussing
IBM here ...)  If you want a method that works on all MS-DOS machines and
will use hard or floppy disks, but you don't want to use file I/O calls,
you might want to check out int 25h (absolute disk read) and 26h (absolute
disk write).
-- 
Stephen M. Dunn                               cs4g6ag@maccs.dcss.mcmaster.ca
          <std_disclaimer.h> = "\nI'm only an undergraduate!!!\n";
****************************************************************************
       "I want to look at life - In the available light" - Neil Peart
Technical Details
Message-ID: <25B6AEFC.2492@maccs.dcss.mcmaster.ca>
Path: arc1-ca.pugleaf.net!utzoo!attcan!lsuc!maccs!cs4g6ag
References: <26038@cup.portal.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!lsuc!maccs!cs4g6ag
From: cs4g6ag@maccs.dcss.mcmaster.ca (Stephen M. Dunn)
Newsgroups: comp.sys.ibm.pc
Subject: Re: int 13h vs. int 21h disk I/O confusion
Message-ID: <25B6AEFC.2492@maccs.dcss.mcmaster.ca>
Date: 19 Jan 90 06:09:00 GMT
References: <26038@cup.portal.com>
Reply-To: cs4g6ag@maccs.dcss.mcmaster.ca (Stephen M. Dunn)
Organization: McMaster University, Hamilton, Ontario
Lines: 41