]> 4ch.mooo.com Git - 16.git/blob - 16/tweak16/NAMEDREG.CPP
fixed the issue with compiling in dos in 1.9 and 2.0. only 1.9 linux fails for some...
[16.git] / 16 / tweak16 / NAMEDREG.CPP
1 /*\r
2         NamedReg.CPP version 1.0\r
3         by Robert Schmidt of Ztiff Zox Softwear 1993\r
4 \r
5         Defines the member functions of the NamedRegister class declared in\r
6                 Register.hpp.\r
7         Defines the stream operator >> to read named register info from\r
8                 an istream.  (Text mode)\r
9 */\r
10 \r
11 #include <conio.h>\r
12 #include <iostream.h>\r
13 #include <string.h>\r
14 #include "Screen.hpp"\r
15 #include "Register.hpp"\r
16 \r
17 \r
18 // NamedRegister::printCon() prints the register state to the console.\r
19 //      If enableFlag is zero, the value is omitted from the display, and\r
20 //      its place is filled with spaces.\r
21 \r
22 void NamedRegister::printCon()\r
23         {\r
24         textattr(enableFlag?REGENABLE_COLOR:REGDISABLE_COLOR);\r
25         cprintf("%03hx (%02hx) %24s : %02hx", getPort(), getIndex(),\r
26                 name, getValue());\r
27         }\r
28 \r
29 /*\r
30         This operator reads the register port number, index and name from the\r
31         input stream.  (*Not* the value!)  Used for initializing each element\r
32         in the register table used by TWEAK.\r
33 */\r
34 \r
35 istream& operator>> (istream &in, NamedRegister &r)\r
36         {\r
37         int i;\r
38         char *n = new char[128];\r
39 \r
40         in >> hex >> i;\r
41         r.setPort(i);\r
42         in >> i >> ws;\r
43         r.setIndex((unsigned char)(i));\r
44         in.getline(n, 128);\r
45         n[in.gcount()-1] = '\0';\r
46         r.name = new char[strlen(n)+1];\r
47         strcpy(r.name, n);\r
48         delete[] n;\r
49 \r
50         return in;\r
51         }\r
52 \r