home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <errno.h>
- char *logo = "\
- /*************************************************************************\n\
- ** **\n\
- ** vampire - sucks the BIOS rom contents out of the PC on which **\n\
- ** it is executed. The rom contents are placed into **\n\
- ** binary files named 'BIOS.ROM' and OTHER.ROM **\n\
- ** The contents of those files can then be HEX'd with **\n\
- ** ZAPLOAD by T. Jennings, HEX86 by Manx, or **\n\
- ** BIN2HEX by Robert Pasky **\n\
- ** **\n\
- ** ARGUMENTS: none **\n\
- ** **\n\
- ** AUTHOR: **\n\
- ** Edward I. Comer 1986 **\n\
- ** 404+296-1403 **\n\
- ** **\n\
- **************************************************************************\n\
- */\n";
- #define SEGMENT 0xf000
-
- main(argc,argv)
- int argc;
- char *argv[];
- {
- static char Sccsid[] = "@(#)vampire.c 1.2 - Edward Comer, 1986";
- unsigned char file[16];
-
- if(argc > 1)
- {
- printf("%s",logo);
- exit(0);
- }
- /*
- ** initialize
- */
- printf("ROM contents are being copied to files BIOS.ROM,OTHER.ROM\n");
-
- /*
- ** extract bios rom contents starting at 'offset'
- */
- strcpy(file,"BIOS.ROM");
- rom2file(file,0x2000,0xe000); /* where IBM-PC BIOS resides */
- strcpy(file,"OTHER.ROM");
- rom2file(file,0x8000,0x6000); /* where basic is (if present) */
- }
- /*
- ** create a file containing the contents of the specified memory
- */
- rom2file(fname,siz,off)
- unsigned char *fname;
- unsigned int off,siz;
- {
- register unsigned int size, offset;
- FILE *ofd;
-
- if((ofd = fopen(fname,"w")) == NULL)
- {
- printf("cannot create output file %s\n,fname");
- exit(errno);
- }
-
- size = siz;
- offset = off;
-
- printf("FILE <%s> contains %u bytes from %04x:%04x to %04x:%04x\n",
- fname,size,SEGMENT,offset,SEGMENT,offset+(size-1));
- for(;size;size--)
- {
- putc(peekb(offset++,SEGMENT),ofd);
- }
- fclose(ofd);
- }