| 1 | /*
|
|---|
| 2 | =============================================================================
|
|---|
| 3 | pardump.c -- Dump GEMDOS partition information
|
|---|
| 4 | Version 1 -- 1988-09-23 -- D.N. Lynx Crowe
|
|---|
| 5 | =============================================================================
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #include "stddefs.h"
|
|---|
| 9 | #include "osbind.h"
|
|---|
| 10 | #include "stdio.h"
|
|---|
| 11 | #include "bootsec.h"
|
|---|
| 12 |
|
|---|
| 13 | #define MAXSECLN 512
|
|---|
| 14 |
|
|---|
| 15 | struct ParInfo { /* partition information structure */
|
|---|
| 16 |
|
|---|
| 17 | char p_flg; /* partition presence flag */
|
|---|
| 18 | char p_id[3]; /* partition ID */
|
|---|
| 19 | long p_st; /* partition starting sector */
|
|---|
| 20 | long p_siz; /* partition size */
|
|---|
| 21 | };
|
|---|
| 22 |
|
|---|
| 23 | short secbuf[MAXSECLN];
|
|---|
| 24 |
|
|---|
| 25 | /* |
|---|
| 26 |
|
|---|
| 27 | */
|
|---|
| 28 |
|
|---|
| 29 | /*
|
|---|
| 30 | =============================================================================
|
|---|
| 31 | main() -- dump partition data for the Atari hard disk
|
|---|
| 32 | =============================================================================
|
|---|
| 33 | */
|
|---|
| 34 |
|
|---|
| 35 | main(argc, argv)
|
|---|
| 36 | int argc;
|
|---|
| 37 | char *argv[];
|
|---|
| 38 | {
|
|---|
| 39 | register struct BootSec *bsp;
|
|---|
| 40 | register struct ParInfo *pip;
|
|---|
| 41 | register short i;
|
|---|
| 42 | register short *wp;
|
|---|
| 43 | register long *lp;
|
|---|
| 44 |
|
|---|
| 45 | if (Rwabs(2, secbuf, 1, 0, 2)) {
|
|---|
| 46 |
|
|---|
| 47 | printf("ERROR -- Sector 0 of Drive C is unreadable\n");
|
|---|
| 48 | exit(1);
|
|---|
| 49 | }
|
|---|
| 50 |
|
|---|
| 51 | bsp = (struct BootSec *)secbuf;
|
|---|
| 52 |
|
|---|
| 53 | lp = &bsp->boot[422];
|
|---|
| 54 |
|
|---|
| 55 | pip = &bsp->boot[426];
|
|---|
| 56 |
|
|---|
| 57 | printf("Hard Disk Partition Information\n\n");
|
|---|
| 58 |
|
|---|
| 59 | printf("Hard disk size: %ld sectors\n\n", *lp);
|
|---|
| 60 |
|
|---|
| 61 | for (i = 0; i < 4; i++) {
|
|---|
| 62 |
|
|---|
| 63 | if (pip->p_flg) {
|
|---|
| 64 |
|
|---|
| 65 | printf("Partition %d: \"%3.3s\" is at %ld and has %ld sectors\n",
|
|---|
| 66 | (i + 1), pip->p_id, pip->p_st, pip->p_siz);
|
|---|
| 67 | } else {
|
|---|
| 68 |
|
|---|
| 69 | printf("Partition %d: Inactive partition\n", (i + 1));
|
|---|
| 70 | }
|
|---|
| 71 |
|
|---|
| 72 | ++pip;
|
|---|
| 73 | }
|
|---|
| 74 |
|
|---|
| 75 | printf("\n");
|
|---|
| 76 |
|
|---|
| 77 | /* |
|---|
| 78 |
|
|---|
| 79 | */
|
|---|
| 80 |
|
|---|
| 81 | lp = &bsp->boot[474];
|
|---|
| 82 | wp = &bsp->boot[478];
|
|---|
| 83 |
|
|---|
| 84 | if (*lp) {
|
|---|
| 85 |
|
|---|
| 86 | printf("Bad Sector Map is at %ld, %d entries\n",
|
|---|
| 87 | *lp, *wp);
|
|---|
| 88 |
|
|---|
| 89 | } else {
|
|---|
| 90 |
|
|---|
| 91 | printf("Bad Sector Map not present\n");
|
|---|
| 92 | }
|
|---|
| 93 |
|
|---|
| 94 | exit(0);
|
|---|
| 95 | }
|
|---|