home *** CD-ROM | disk | FTP | other *** search
- /* alldir.c - dump all CP/M directory entries */
- /* Version 1.2 1982/12/18 19:56 */
- /*
- Inspired by the assembly language routine ALLDIR in
- David E. Cortesi's INSIDE CP/M: A Guide for Users and Programmers,
- Holt, Rinehart and Winston, New York 1982, p. 228-229.
-
- C version:
-
- Copyright 1982 William G. Hutchison, Jr.
- P.O. Box 278
- Exton, PA 19341-0278
- U.S.A.
-
- CompuServe 70665,1307
-
-
-
-
- This program may be used freely for any non-commercial
- purpose, provided that the user does not remove or alter
- this notice or the copyright statement.
- Those who wish to sell or lease this program, or to
- incorporate it into a product for sale or lease, should
- apply to the author (above) for licensing information.
- This program is not covered by a warranty, either
- express or implied. The author shall not be responsible for
- any damages (including consequential) caused by reliance on
- the materials presented, including but not limited to
- typographical errors or arithmetic errors.
-
- This version is for C/80 Version 2 from Software Toolworks.
-
-
- */
-
- #include "c80def.h"
- #include "printf.c"
-
- #include "dir.h"
- #include "fcb.h"
- static struct fcb *cpmfcb= 0x5C;
- static struct dir *cpmbuff=0x80;
-
- #include "bdos.c"
- #define DEFAULT_DRIVE 25
- #define SELECT_DRIVE 14
- #define SRCH_FIRST 17
- #define SRCH_NEXT 18
-
- /* define the number of Bytes Per Line to be dumped: */
- #define BPL 16
- #include "davcor.c"
-
- main()
- {
- int drive, place;
- struct fcb *locfcb;
- static char Version[]= "Version 1.2 1982/12/18 19:56";
- static char Notice[]= "Copyright 1982 William G. Hutchison, Jr.";
-
- printf("%s\n%s\n", Version, Notice);
-
- if ((drive= cpmfcb->drv) == 0)
- drive= bdos(DEFAULT_DRIVE, 0);
- else
- drive-- /* 1..26 => 0..25 */;
-
- init_fcb(locfcb= alloc(FCB_SIZE), '?', "????????", "???", '?');
-
- printf("All directory entries, drive %c.\n", 'A'+drive);
- bdos(SELECT_DRIVE, drive);
-
- place= bdos(SRCH_FIRST, locfcb) & 0xFF;
- while (place != 0xFF) {
- printf("\n");
- hex_dump(cpmbuff + place, DIR_SIZE);
- place= bdos(SRCH_NEXT, locfcb) & 0xFF;
- }
- } /* end of main */