X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=16%2Ftweak16%2FNAMEDREG.CPP;fp=16%2Ftweak16%2FNAMEDREG.CPP;h=ed10527bc63042780491c00623e1d16998aa93b8;hb=2b78082f0e0c4dae86463aed269aa121fdd2d449;hp=0000000000000000000000000000000000000000;hpb=3e4e5b099fc885a8a483d8afebb558d6479346c7;p=16.git diff --git a/16/tweak16/NAMEDREG.CPP b/16/tweak16/NAMEDREG.CPP new file mode 100755 index 00000000..ed10527b --- /dev/null +++ b/16/tweak16/NAMEDREG.CPP @@ -0,0 +1,52 @@ +/* + NamedReg.CPP version 1.0 + by Robert Schmidt of Ztiff Zox Softwear 1993 + + Defines the member functions of the NamedRegister class declared in + Register.hpp. + Defines the stream operator >> to read named register info from + an istream. (Text mode) +*/ + +#include +#include +#include +#include "Screen.hpp" +#include "Register.hpp" + + +// NamedRegister::printCon() prints the register state to the console. +// If enableFlag is zero, the value is omitted from the display, and +// its place is filled with spaces. + +void NamedRegister::printCon() + { + textattr(enableFlag?REGENABLE_COLOR:REGDISABLE_COLOR); + cprintf("%03hx (%02hx) %24s : %02hx", getPort(), getIndex(), + name, getValue()); + } + +/* + This operator reads the register port number, index and name from the + input stream. (*Not* the value!) Used for initializing each element + in the register table used by TWEAK. +*/ + +istream& operator>> (istream &in, NamedRegister &r) + { + int i; + char *n = new char[128]; + + in >> hex >> i; + r.setPort(i); + in >> i >> ws; + r.setIndex((unsigned char)(i)); + in.getline(n, 128); + n[in.gcount()-1] = '\0'; + r.name = new char[strlen(n)+1]; + strcpy(r.name, n); + delete[] n; + + return in; + } +