13 #define PROM1 "RT1-1.BIN"
14 #define PROM2 "RT1-2.BIN"
15 #define PROM3 "RT1-3.BIN"
16 #define PROM4 "RT1-4.BIN"
18 BYTE * grom3, * spr_rom;
20 int main(int argc, char *argv[])
29 ff1.open(PROM3, ios::binary|ios::in);
32 for(int i=0; i<256; i++) // Load pallete with PROM values
34 for(int j=0; j<8; j++)
37 ccolor[i][j] = (BYTE)ch;
42 ff1.open(PROM4, ios::binary|ios::in);
45 for(int i=0; i<128; i++) // Load pallete with PROM values
47 for(int j=0; j<16; j++)
50 scolor[i][j] = (BYTE)ch;
56 ff1.open(PROM1, ios::binary|ios::in);
57 ff2.open(PROM2, ios::binary|ios::in);
58 if (ff1) // If open was successful...
60 for(int i=0; i<768; i+=3)
63 statpal[i] = (BYTE)(ch&0x0F);
64 statpal[i+1] = (BYTE)(ch>>4);
66 statpal[i+2] = (BYTE)ch;
68 // Do palette stretching here... I.e. add 0 to hinyb 0, 1 to hinyb 1, etc
69 for(int i=0; i<768; i++)
72 if ((statpal[i]&0xF0) == 1) statpal[i]++;
73 if ((statpal[i]&0xF0) == 2) statpal[i] += 2;
74 if ((statpal[i]&0xF0) == 3) statpal[i] += 3;
76 ff1.close(); ff2.close();
79 SetModeX(); // Set up screen
80 for(int i=0; i<256; i++) // Set up RGB colors...
82 outp(0x03C8, i); // Tell VGA palette data is coming...
83 outp(0x03C9, statpal[i*3]); // Send it...
84 outp(0x03C9, statpal[i*3+1]);
85 outp(0x03C9, statpal[i*3+2]);
87 extern BYTE spr_color_index;
91 strcpy(file, "c:\\games\\romhac~1\\");
92 if (argc == 2) strcat(file, argv[1]);
93 else strcat(file, "r9");
95 ff1.open(file, ios::binary|ios::in); // Open as a binary file
97 if (!ff1) { cerr << "Could not open the file! (Maybe it doesn't exist...)";
99 for(int x=0; x<320; x+=32)
101 for(int y=0; y<224; y+=16)
103 for(int j=0; j<16; j++)
105 for(int i=0; i<16; i+=2)
107 ff1.get(ch); int lo = ch & 0x0f; int hi = ch / 16;
108 Plot(x+i, y+j, scolor[spr_color_index][hi]);
109 Plot(x+i+1, y+j, scolor[spr_color_index][lo]);
112 for(int j=0; j<16; j++)
114 for(int i=16; i<32; i+=2)
116 ff1.get(ch); int lo = ch & 0x0f; int hi = ch / 16;
117 Plot(x+i, y+j, scolor[spr_color_index][hi]);
118 Plot(x+i+1, y+j, scolor[spr_color_index][lo]);
125 if (i==27) break; // Break out on ESC
126 if (i=='[') spr_color_index--; // Decrease...
127 if (i==']') spr_color_index++; // Increase...
129 SetMode(0x03); // Reset text mode