2 09TO10 1.0 - convert TWEAK 0.9 files to TWEAK 1.0 files
\r
4 by Robert Schmidt of Ztiff Zox Softwear, 1992-93
\r
6 For documentation, see TWEAK.DOC.
\r
8 Most of the starting definitions was taken from the TWEAK095.CPP
\r
9 file included elsewhere, so comments are removed.
\r
13 # ifndef __COMPACT__
\r
15 # error A large data model is required!
\r
24 #include <fstream.h>
\r
27 #include "Register.hpp"
\r
30 struct vgaRegisterInfo
\r
34 unsigned char index;
\r
37 vgaRegisterInfo table[] =
\r
39 {"Misc. output", 0x3c2, 0x00},
\r
41 {"Horizontal total", 0x3d4, 0x00},
\r
42 {"Horizontal disp. enable", 0x3d4, 0x01},
\r
43 {"Horizontal blank start", 0x3d4, 0x02},
\r
44 {"Horizontal blank end", 0x3d4, 0x03},
\r
45 {"Horizontal retrace start",0x3d4, 0x04},
\r
46 {"Horizontal retrace end", 0x3d4, 0x05},
\r
47 {"Vertical total", 0x3d4, 0x06},
\r
48 {"Overflow register", 0x3d4, 0x07},
\r
49 {"Preset row scan", 0x3d4, 0x08},
\r
50 {"Max scan line/char ht.", 0x3d4, 0x09},
\r
52 {"Vertical retrace start", 0x3d4, 0x10},
\r
53 {"Vertical retrace end", 0x3d4, 0x11},
\r
54 {"Vert. disp. enable end", 0x3d4, 0x12},
\r
55 {"Offset/Logical width", 0x3d4, 0x13},
\r
56 {"Underline location", 0x3d4, 0x14},
\r
57 {"Vertical blank start", 0x3d4, 0x15},
\r
58 {"Vertical blank end", 0x3d4, 0x16},
\r
59 {"Mode control", 0x3d4, 0x17},
\r
61 {"Clock mode register", 0x3c4, 0x01},
\r
62 {"Color plane write enable",0x3c4, 0x02},
\r
63 {"Character gen. select", 0x3c4, 0x03},
\r
64 {"Memory mode register", 0x3c4, 0x04},
\r
66 {"Set/reset register", 0x3ce, 0x00},
\r
67 {"Set/reset enable", 0x3ce, 0x01},
\r
68 {"Color compare", 0x3ce, 0x02},
\r
69 {"Data rotate & function", 0x3ce, 0x03},
\r
70 {"Mode register", 0x3ce, 0x05},
\r
71 {"Miscellaneous register", 0x3ce, 0x06},
\r
72 {"Color don't care", 0x3ce, 0x07},
\r
73 {"Bit mask register", 0x3ce, 0x08},
\r
75 {"Mode control", 0x3c0, 0x10},
\r
76 {"Screen border colour", 0x3c0, 0x11},
\r
77 {"Color plane enable", 0x3c0, 0x12},
\r
78 {"Horizontal panning", 0x3c0, 0x13},
\r
79 {"Color select", 0x3c0, 0x14}
\r
82 const registers = sizeof (table) / sizeof (vgaRegisterInfo);
\r
87 unsigned char value[registers];
\r
88 unsigned char selectedReg;
\r
92 void print(unsigned char selected);
\r
93 void printOne(unsigned char r, int isSelected);
\r
94 unsigned char& operator [] (unsigned char n)
\r
95 { return value[n]; }
\r
99 // The main program starts here.
\r
101 main(int argc, char **argv)
\r
105 printf("09TO10 version 1.0\n\r"
\r
106 "by Robert Schmidt of Ztiff Zox Softwear 1993\n\r"
\r
108 "Converts TWEAK version 0.9 files to TWEAK version 1.0 files.\n\r"
\r
110 "Syntax: 09TO10 <oldfile> <newfile>\n\r"
\r
117 char *fname = argv[1];
\r
121 // Open file in selected mode.
\r
122 if (!(f=fopen(fname,"rb")))
\r
128 for (r=0; r<registers; r++)
\r
129 if (fread(&(rtab[r]),1,1,f) == 0)
\r
136 ofstream out(argv[2], ios::trunc|ios::binary|ios::out);
\r
138 for (r=0; r<registers; r++)
\r
140 reg.setPort(table[r].port);
\r
141 reg.setIndex(table[r].index);
\r
142 reg.setValue(rtab[r]);
\r