home *** CD-ROM | disk | FTP | other *** search
- /*
- Test program to print out registers.
- */
-
- #include <stdio.h>
-
- int ax = 0;
- int bx = 0;
- int cx = 0;
- int dx = 0;
- int sp = 0;
- int bp = 0;
- int si = 0;
- int di = 0;
- int ds = 0;
- int cs = 0;
- int ss = 0;
- int es = 0;
- int ip = 0;
- int flags = 0;
-
- main(argc, argv)
- int argc;
- char **argv;
- {
- sl_regs();
- printf("\n\ndump of registers\n\n");
- phex("ax", ax);
- phex("bx", bx);
- phex("cx", cx);
- phex("dx", dx);
- phex("sp", sp);
- phex("bp", bp);
- phex("si", si);
- phex("di", di);
- printf("\n");
-
- phex("ds", ds);
- phex("es", es);
- phex("ss", ss);
- phex("cs", cs);
- phex("ip", ip);
-
- /* Overflow */ printf("%s ", (flags & (1 << 11)) ? "OV" : "NV");
- /* Direction */ printf("%s ", (flags & (1 << 10)) ? "DN" : "UP");
- /* Interrupts */ printf("%s ", (flags & (1 << 9)) ? "EI" : "DI");
- /* Traps */ printf("%s ", (flags & (1 << 8)) ? "TF" : "NT");
- /* Sign */ printf("%s ", (flags & (1 << 7)) ? "MI" : "PL");
- /* Zero */ printf("%s ", (flags & (1 << 6)) ? " Z" : "NZ");
- /* Aux Carry */ printf("%s ", (flags & (1 << 4)) ? "AC" : "NA");
- /* Parity */ printf("%s ", (flags & (1 << 2)) ? "PE" : "PO");
- /* Carry */ printf("%s", (flags & 1 ) ? " C" : "NC");
-
- printf("\n\n");
- }
-
- phex(s, n)
- char *s;
- int n;
- {
- printf("%s=", s);
- printf("%x", (n & 0xf000) >> 12);
- printf("%x", (n & 0x0f00) >> 8);
- printf("%x", (n & 0x00f0) >> 4);
- printf("%x", (n & 0x000f));
- printf(" ");
- }
-