TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: All
from: Frank Adam
date: 1996-10-26 14:38:12
subject: fatread.c 1/6

>>> Part 1 of 6...

Anyone knows if "stdprn" can be ported in some way ?

Post release note: If getkey() doesn't work, change ax=0x10 to ax = 0x00;
0x10 is only supported with an enhanced K/board installed.

Before you know it, it'll play the theme to Twighlight Zone on error.:-)
Hm, that would be nicer in stereo actually..:)
If anyone tries this i'd love to hear success/fail reports..
I'm also not sure if it will compile on anything but Turbo/Borland 
compilers, but i think the only hangup will be the stream to STDPRN.
                              
/*
** Fatread.c  Ver1.1 ..by Frank Adam.
** Released to the Public Domain on the 18th October 1996.
** It now works on older compilers as well, but still requires
** DOS 3.31 or higher.
** Should now compile in small too, but as of now, i have not tested that.
** What it does ?
** Reads the fat and writes it formatted to screen/file/printer.
** Or just reads and dumps it into a file, for later restore.
** Usage: fatread S|P|R drvletter. The switches can be reversed.
** S = Save, P = Print. Save dumps the file to boot%c.dat and fat%c.dat
** %c = drive of course and either creates or appends or overwrites 
** fatbak.dat, which is the control file. 
** 'R' (restore) is not yet implemented.           
** If your parameter is P it'll give you 3 options to print to.
** if you select file then you will be prompted for a filename.
** There is no error checking for the printer, so it'd better be on.:-)
** Neither is there error checking for the drive, but the Dpb routine
** at the start should have a hernia anyway and the program will abort.
** Anyway, why am i explaining this to programmers ?? :-)
** While it has been tested thoroughly on my PC and 3 drives i can not
** guarantee that the code will work on all systems, thus i will not take
** any responsibility for loss of data or damage caused by the use and
** or misuse of this code.
** There, you have been warned, but it's quite safe. Trust me ! :-)
*/

#if !defined (__LARGE__)
 #error Compile me in large model for now please.
#endif

#if defined (__BORLANDC__)  || defined (__TURBOC__)
 #define FAR far
#endif

#ifndef __TURBOC__
 #if (defined(_MSC_VER) && (_MSC_VER >= 700)) || (defined(__SC__))
  /* Make FP_xxx macros lvalues as in older versions */
  #undef FP_SEG
  #undef FP_OFF
  #define FP_SEG(fp)    ((unsigned)((unsigned long)(fp) >> 16))
  #define FP_OFF(fp)    ((unsigned)(fp && 0xffff))
 #endif
#ifndef MK_FP
 #define MK_FP(seg,off) ((void FAR *)(((long)(seg) << 16)|(unsigned)(off)))
#endif
#endif

#include 
#include   /* for memcpy */
#include    /* for toupper */
#include 
#include 

#define BYTE char
#define WORD unsigned int
#define DWORD unsigned long
#define UCHAR unsigned char

#define FATSHOW 0
#define FATSAVE 1
#define RESTORE 2


struct DriveParamBlock  /* from Ralph Brown's excellent Interrupt List */
{
 BYTE Driveno;  /*  drive number (00h = A:, 01h = B:, etc) */
 BYTE DevUnit;  /*  unit number within device driver */
 WORD Bpersec;  /*  bytes per sector */
 BYTE Hysect ;  /*  highest sector number within a cluster */
 BYTE Shft   ;  /*  shift count to convert clusters into sectors */
 WORD ResSecs;  /*  number of reserved sectors at beginning of drive */
 BYTE NumFats;  /*  number of FATs */
 WORD NumRoot;  /*  number of root directory entries */
 WORD UserFsc;  /*  number of first sector containing user data */
 WORD MaxClust; /*  highest cluster number (number of data clusters + 1) */
  /*  16-bit FAT if greater than 0FF6h, else 12-bit FAT */
 WORD SecPerFat;/*  number of sectors per FAT */
 WORD DirStart; /*  sector number of first directory sector */
 DWORD DevHead; /* address of device driver header */
 BYTE  MediaId; /*  media ID byte (see #0669) */

 >>> Continued to next message...

___ Blue Wave/DOS v2.21

---
* Origin: Melbourne PC User Group BBS (3:632/309)
SEEN-BY: 633/267 270
@PATH: 632/309 107 635/503 50/99 635/728 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.