source: buchla-68k/orig/GEMDOS/DUMPBPB.C@ 0170798

Last change on this file since 0170798 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Imported original source code.

  • Property mode set to 100755
File size: 2.5 KB
RevLine 
[3ae31e9]1/*
2 =============================================================================
3 dumpbpb.c -- dump a standard GEMDOS BPB in readable form
4 Version 2 -- 1988-09-23 -- D.N. Lynx Crowe
5 =============================================================================
6*/
7
8#include "stddefs.h"
9
10#define TESTER 1 /* to get an Atari test program */
11
12struct bpb { /* BIOS parameter block returned by GetBPB() */
13
14 unsigned short recsiz; /* physical sector size in bytes */
15 unsigned short clsiz; /* cluster size in sectors */
16 unsigned short clsizb; /* cluster size in bytes */
17 unsigned short rdlen; /* root directory length in sectors */
18 unsigned short fsiz; /* FAT size in sectors */
19 unsigned short fatrec; /* sector number of 1st sector of 2nd FAT */
20 unsigned short datrec; /* sector number of 1st data sector */
21 unsigned short numcl; /* number of data clusters on disk */
22 unsigned short bflags; /* flags */
23};
24
25/*
26
27*/
28
29/*
30 =============================================================================
31 DumpBPB() -- dump a standard BPB in readable form for the Atari
32 =============================================================================
33*/
34
35struct bpb *
36DumpBPB(bpp)
37struct bpb *bpp; /* pointer to the BPB */
38{
39 printf("Sector length: %u bytes\n", bpp->recsiz);
40 printf("Cluster size: %u sectors\n", bpp->clsiz);
41 printf(" %u bytes\n", bpp->clsizb);
42 printf("Root directory size: %u sectors\n", bpp->rdlen);
43 printf("FAT size: %u sectors\n", bpp->fsiz);
44 printf("First sector of 2nd FAT: %u\n", bpp->fatrec);
45 printf("First sector of data: %u\n", bpp->datrec);
46 printf("Data area size: %u clusters\n", bpp->numcl);
47 printf("FAT entry size: %u bits\n", bpp->bflags & 0x0001 ? 16 : 12);
48 printf("\n");
49
50 return(bpp);
51}
52
53/*
54
55*/
56
57#if TESTER
58
59extern long bios();
60
61#define GetBPB(x) (struct bpb *)bios(7,x)
62
63/*
64 =============================================================================
65 simple test program for the Atari (Beware: no error checking is done)
66 =============================================================================
67*/
68
69main(argc, argv)
70int argc;
71char *argv[];
72{
73 short d;
74 char c;
75 struct bpb *bp;
76
77 while (--argc) {
78
79 c = **++argv;
80
81 if (c GE 'A'AND c LE 'Z')
82 d = c - 'A';
83 else if (c GE 'a' AND c LE 'z')
84 d = c - 'a';
85 else
86 continue;
87
88 if (bp = GetBPB(d)) {
89
90 printf("BPB for drive %c:\n\n", d + 'A');
91 DumpBPB(bp);
92 }
93 }
94
95 exit(0);
96}
97
98#endif
Note: See TracBrowser for help on using the repository browser.