1 // Rolling Thunder hacker
3 // Just a simple test...
14 // Get a word from the current input stream
16 unsigned int GetWord(ifstream &fstr)
18 unsigned int word = 0;
21 fstr.get(ch); word = int(ch) << 8;
22 fstr.get(ch); word |= (int)ch;
27 // Get a double word from the current input stream
29 unsigned long int GetDWord(ifstream &fstr)
31 unsigned long int dword = 0;
34 for(int i=0; i<4; i++)
36 fstr.get(ch); dword <<= 8; dword |= (int)ch;
41 void plot(int x, int y, int c)
43 extern char far * screen;
45 screen[x + y*320] = c;
48 void main(int argc, char *argv[])
50 char pal[768], file[120];
53 ifstream ff; // Creates an IFSTREAM but without any file hooks
55 strcpy(file, "c:\\games\\romhac~1\\");
59 strcat(file, argv[1]);
66 ff.open(file, ios::binary); // Open as a binary file
68 if (!ff) { cerr << "Could not open the file! (Maybe it doesn't exist...)";
71 SetMode(0x13); // Set up screen...
73 pal[0] = 0x3F; pal[1] = 0x00; pal[2] = 0x00; // Red
74 pal[3] = 0x30; pal[4] = 0x00; pal[5] = 0x00; // Darker Red
75 pal[6] = 0x28; pal[7] = 0x00; pal[8] = 0x00; // Darkest Red
76 pal[9] = 0x2f; pal[10] = 0x2f; pal[11] = 0x2F; // Light Grey
77 pal[12] = 0x1F; pal[13] = 0x1f; pal[14] = 0x1f; // Med Grey
78 pal[15] = 0x0F; pal[16] = 0x0f; pal[17] = 0x0f; // Dark Grey
79 pal[18] = 0x3F; pal[19] = 0x30; pal[20] = 0x20; // Peach?
80 pal[21] = 0x20; pal[22] = 0x20; pal[23] = 0x00;
81 pal[24] = 0x08; pal[25] = 0x3f; pal[26] = 0x10;
82 pal[27] = 0x06; pal[28] = 0x06; pal[29] = 0x06; // Dk Dk Dk Grey
83 pal[30] = 0x08; pal[31] = 0x08; pal[32] = 0x10; // Dk Dk Grey
84 pal[33] = 0x00; pal[34] = 0x3f; pal[35] = 0x00;
86 pal[45] = 0x00; pal[46] = 0x00; pal[47] = 0x00;
88 outp(0x03C8, 0); // Tell VGA palette data is coming...
89 for(int i=0; i<48; i++)
91 outp(0x03C9, pal[i]); // Send it...
97 for(int x=0; x<320; x+=32)
99 for(int y=0; y<192; y+=16)
105 ff.get(ch); int lo = ch & 0x0f; int hi = ch / 16;
106 plot(x+i, y+j, hi); plot(x+i+1, y+j, lo);
111 for(i=16; i<32; i+=2)
113 ff.get(ch); int lo = ch & 0x0f; int hi = ch / 16;
114 plot(x+i, y+j, hi); plot(x+i+1, y+j, lo);
119 i = getch(); // Get keyboard char
120 if (i == 27) break; // ESC aborts...
122 SetMode(0x03); // Reset text mode