Mercurial > mplayer.hg
annotate TOOLS/bios2dump.c @ 15721:eec6ace22741
small change to field-matching metrics which hopefully makes a big
improvement to results. inter-field comparison is now counterbalanced
with intra-field total (vertical) variation. this means that areas of
extreme high frequency content, which become aliased within individual
fields, will not interfere with field matching. examples: white noise
effects, small kanji, very small latin text, ...
may still need tweaking. please report regressions. this change will
likely be made optional in the future (right now it's enclosed in
"if (1)"...
author | rfelker |
---|---|
date | Tue, 14 Jun 2005 05:33:34 +0000 |
parents | 51276a7f4ea1 |
children |
rev | line source |
---|---|
2355 | 1 /* |
2 bios2dump.c - Was designed to extract BIOS of your PC and save it to file. | |
3 Usage: as argument requires DOS interrupt number in hexadecimal form. | |
4 as output - will write 64KB file which will named: SSSS_OOOO.intXX | |
5 where: SSSS - segment of BIOS interrupt handler | |
6 OOOO - offset of BIOS interrupt handler | |
7 XX - interrupt number which was passed as argument | |
8 Licence: GNU GPL v2 | |
9 Copyright: Nick Kurshev <nickols_k@mail.ru> | |
10 */ | |
11 #include <stdio.h> | |
12 #include <stdlib.h> | |
13 | |
14 int main( int argc, char *argv[]) | |
15 { | |
16 FILE * fd_mem, *fd_out; | |
17 unsigned short int_seg,int_off; | |
18 unsigned long bios_off; | |
19 int int_no; | |
20 size_t i; | |
21 char outname[80]; | |
22 unsigned char ch; | |
23 if(argc < 2) | |
24 { | |
25 printf("Usage: %s int_no(in hex)\n",argv[0]); | |
26 return EXIT_FAILURE; | |
27 } | |
28 int_no = strtol(argv[1],NULL,16); | |
29 if(!(fd_mem = fopen("/dev/mem","rb"))) | |
30 { | |
31 perror("Can't open file - /dev/mem"); | |
32 return EXIT_FAILURE; | |
33 } | |
34 fseek(fd_mem,int_no*4,SEEK_SET); | |
35 fread(&int_off,sizeof(unsigned short),1,fd_mem); | |
36 fread(&int_seg,sizeof(unsigned short),1,fd_mem); | |
37 sprintf(outname,"%04X_%04X.int%02X",int_seg,int_off,int_no); | |
38 if(!(fd_out = fopen(outname,"wb"))) | |
39 { | |
2357 | 40 perror("Can't open output file"); |
2355 | 41 fclose(fd_mem); |
42 return EXIT_FAILURE; | |
43 } | |
44 bios_off = (int_seg << 4) + int_off; | |
45 bios_off &= 0xf0000; | |
46 fseek(fd_mem,bios_off,SEEK_SET); | |
47 for(i=0;i<0x10000;i++) | |
48 { | |
49 fread(&ch,1,1,fd_mem); | |
50 fwrite(&ch,1,1,fd_out); | |
51 } | |
52 fclose(fd_out); | |
53 fclose(fd_mem); | |
54 return EXIT_SUCCESS; | |
12923
51276a7f4ea1
cosmetic warning fix (missing newline at end of file)
diego
parents:
2357
diff
changeset
|
55 } |