home *** CD-ROM | disk | FTP | other *** search
- /* RamSave.c (c) 1991 Clint Hastings */
-
- #include <exec/types.h>
- #include <exec/memory.h>
- #include <dos.h>
- #include <string.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <proto/all.h>
-
- BPTR fh;
- char *amaxbuf;
-
- main( argc, argv )
- int argc;
- char *argv[];
- {
- long amaxbuflen=0x500000, start=0x500000, xferbytes;
- char **ptr=NULL;
- int base=0;
-
- if(argc != 4) {
- printf("Usage: %s startaddr length filename\n", argv[0]);
- exit(10);
- }
-
- amaxbuf = (char *) start;
- start=strtol(argv[1], ptr, base);
- ptr = NULL;
- amaxbuflen=strtol(argv[2], ptr, base);
-
- printf("\nRAM Save v1.1\n");
- printf( "~~~~~~~~~~~~~~\n");
-
- /* Try to open the file: */
- fh = Open(argv[3], MODE_NEWFILE);
-
- if (fh) { /* file open */
- printf("File open, writing...");
- xferbytes = Write(fh, amaxbuf, amaxbuflen);
- printf("\nFile %s written, ", argv[3]);
- printf("%ld bytes.\n\n", xferbytes);
- Close(fh);
- } else {
- printf("\nCouldn't open file %s! Aborting.\n\n", argv[3]);
- }
- }
-