Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 19.42 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. #define ax ((ah<<8)+al)
  4. #define bx ((bh<<8)+bl)
  5. #define cx ((ch<<8)+cl)
  6. #define dx ((dh<<8)+dl)
  7. #define stepip ip=(ip+1)&0xFFFF
  8.  
  9. extern struct structVGAparm {
  10.        unsigned char videomode;
  11.        int textwidth;
  12.        int textheight;
  13.        int width;
  14.        int height;
  15.        char istextmode;      
  16.        int pitch;
  17. } VGAparm;
  18.  
  19. unsigned char *RAM = NULL;
  20. unsigned char resetcode[16];
  21. extern unsigned char *VGAmemory;
  22. unsigned char al, ah, bl, bh, cl, ch, dl, dh; //general purpose registers
  23. unsigned sp, bp, si, di; //stack pointer, base pointer, index registers
  24. unsigned cs, ds, ss, es; //segment registers
  25. unsigned ip; //instruction pointer
  26. char cf, pf, af, zf, sf, tf, ifl, df, of; //flags
  27. unsigned datasize, opcode, adrmode, tempval, savecs, saveip, disp, oper1, oper2;
  28. unsigned char mod, reg, rmnum;
  29. long templong;
  30. unsigned long totalexec = 0;
  31. extern int cursorx, cursory;
  32. char useseg;
  33.  
  34. extern char running;
  35. extern const unsigned char *opdesc[256];
  36.  
  37. extern void setnewmode();
  38. extern void vgahandler();
  39. extern void bioshandler();
  40. extern void keyhandler();
  41.  
  42. FILE *binfile = NULL;
  43. extern FILE *logfile;
  44. long bytesread = 0;
  45.  
  46. unsigned read86(long addr) {
  47.          if (addr>0x9FFFF && addr<0xB0000) return VGAmemory[addr-0xa0000];
  48.          if (addr>0xFFFEF && addr<0x100000) return resetcode[addr-0xFFFF0];
  49.          if (addr>655359) return 0;
  50.          return RAM[addr];
  51. }
  52.  
  53. unsigned write86(long addr, unsigned char value) {
  54.          if (addr>0x9FFFF && addr<0xB0000) { VGAmemory[addr-0xa0000] = value; VGAupdate(); return; }
  55.          if (addr>655359) return 0;
  56.          RAM[addr] = value;
  57. }
  58.  
  59. int signextend(unsigned char value) {
  60.     if (value&0x80) templong = 0xFF00; else templong = 0;
  61.     return value+templong;
  62. }
  63.  
  64. void modifystatusflags(long value) {
  65.      if (value) zf = 0; else zf = 1;
  66.      if (value&0x8000) sf = 1; else sf =0;
  67.  
  68. }
  69.  
  70. void push16(unsigned pushval) {
  71.      sp = (sp-2)&0xFFFF;
  72.      templong = (ss<<4)+sp;
  73.      write86(templong++, pushval&0xFF);
  74.      write86(templong, pushval>>8);
  75. }
  76.  
  77. void push8(unsigned char pushval) {
  78.      sp = (sp-2)&0xFFFF;
  79.      templong = (ss<<4)+sp;
  80.      write86(templong++, pushval);
  81.      write86(templong, 0);
  82. }
  83.  
  84. unsigned pop16() {
  85.          templong = (ss<<4)+sp;
  86.          tempval = read86(templong++) + (read86(templong)<<8);
  87.          sp = (sp+2)&0xFFFF;
  88.          return tempval;
  89. }
  90.  
  91. unsigned char pop8() {
  92.          tempval = read86((ss<<4)+sp);
  93.          sp = (sp+2)&0xFFFF;
  94.          return tempval;
  95. }
  96.  
  97. void calcmodregrm() {
  98.      tempval = read86((cs<<4)+ip); stepip; disp = 0;
  99.      mod = tempval>>6; reg = (tempval>>3)&7; rmnum = tempval&7;
  100.      if (mod==1) { disp = read86((cs<<4)+ip); stepip; }
  101.        else if (mod==2) { disp = read86((cs<<4)+ip); stepip; disp += read86((cs<<4)+ip)<<8; stepip; }
  102. }
  103.  
  104. unsigned makeflagsword() {
  105.          return cf+(pf<<2)+(af<<4)+(zf<<6)+(sf<<7)+(tf<<8)+(ifl<<9)+(df<<10)+(of<<1);
  106. }
  107.  
  108. void decodeflagsword(unsigned flagsval) {
  109.      cf = flagsval&1; pf = (flagsval>>2)&1; af = (flagsval>>4)&1; zf = (flagsval>>6)&1; sf = (sf>>7)&1;
  110.      tf = (flagsval>>8)&1; ifl = (flagsval>>9)&1; df = (flagsval>>10)&1; of = (flagsval>>11)&1;
  111. }
  112.  
  113. unsigned readsreg(char regval) {
  114.      switch (regval) {
  115.            case 0: return es;
  116.            case 1: return cs;
  117.            case 2: return ss;
  118.            case 6: return ds;
  119.      }
  120. }
  121.  
  122. unsigned readreg(char regval) {
  123.      switch (regval) {
  124.            case 0: if (datasize==0) return al; else return ax;
  125.            case 1: if (datasize==0) return cl; else return cx;
  126.            case 2: if (datasize==0) return dl; else return dx;
  127.            case 3: if (datasize==0) return bl; else return bx;
  128.            case 4: if (datasize==0) return ah; else return sp;
  129.            case 5: if (datasize==0) return ch; else return bp;
  130.            case 6: if (datasize==0) return dh; else return si;
  131.            case 7: if (datasize==0) return bh; else return di;
  132.      }
  133. }
  134.  
  135. unsigned readrm(char rmval) {
  136.      if (mod==3) return readreg(rmval);
  137.             fprintf(logfile, "Use segment register %u.\n", useseg);
  138.      switch (useseg) {
  139.             case 0: templong = cs<<4; break;
  140.             case 1: templong = ds<<4; break;
  141.             case 2: templong = es<<4; break;
  142.             case 3: templong = ss<<4; break;
  143.             default: templong = 0;
  144.      }
  145.      if (mod==0) { //using R/M table 1
  146.      fprintf(logfile, "RM table 1 w/ %u w/ disp = %i\n", rmval, disp);
  147.         switch (rmval) {
  148.             case 0: templong += bx+si; break;
  149.             case 1: templong += bx+di; break;
  150.             case 2: templong += bp+si; break;
  151.             case 3: templong += bp+di; break;
  152.             case 4: templong += si; break;
  153.             case 5: templong += di; break;
  154.             case 6: templong += disp; break;
  155.             case 7: templong += bx; break;
  156.         }
  157.      } else { //using R/M table 2
  158.         switch (rmval) {
  159.             case 0: templong += bx+si; break;
  160.             case 1: templong += bx+di; break;
  161.             case 2: templong += bp+si; break;
  162.             case 3: templong += bp+di; break;
  163.             case 4: templong += si; break;
  164.             case 5: templong += di; break;
  165.             case 6: templong += bp; break;
  166.             case 7: templong += bx; break;
  167.         }
  168.         templong += disp;
  169.      }
  170.      tempval = read86(templong);
  171.      if (datasize==1) tempval += read86(templong+1)<<8;
  172.      return tempval;
  173. }
  174.  
  175. void writesreg(char regval, unsigned value) {
  176.      switch (regval) {
  177.            case 0: es = value; break;
  178.            case 1: cs = value; break;
  179.            case 2: ss = value; break;
  180.            case 3: ds = value; break;
  181.      }
  182. }
  183.  
  184. void writereg(char regval, unsigned value) {
  185.      switch (regval) {
  186.            case 0: if (datasize==0) al = value; else { al = value&0xFF; ah = value>>8; } break;
  187.            case 1: if (datasize==0) cl = value; else { cl = value&0xFF; ch = value>>8; } break;
  188.            case 2: if (datasize==0) dl = value; else { dl = value&0xFF; dh = value>>8; } break;
  189.            case 3: if (datasize==0) bl = value; else { bl = value&0xFF; bh = value>>8; } break;
  190.            case 4: if (datasize==0) ah = value; else sp = value; break;
  191.            case 5: if (datasize==0) ch = value; else bp = value; break;
  192.            case 6: if (datasize==0) dh = value; else si = value; break;
  193.            case 7: if (datasize==0) bh = value; else di = value; break;
  194.      }
  195. }
  196.  
  197. void writerm(char rmval, unsigned value) {
  198.      if (mod==3) { writereg(rmval, value); return; }
  199.      switch (useseg) {
  200.             case 0: templong = cs<<4; break;
  201.             case 1: templong = ds<<4; break;
  202.             case 2: templong = es<<4; break;
  203.             case 3: templong = ss<<4; break;
  204.      }
  205.      if (mod==0) { //using R/M table 1
  206.         switch (rmval) {
  207.             case 0: templong += bx+si; break;
  208.             case 1: templong += bx+di; break;
  209.             case 2: templong += bp+si; break;
  210.             case 3: templong += bp+di; break;
  211.             case 4: templong += si; break;
  212.             case 5: templong += di; break;
  213.             case 6: templong += disp; break;
  214.             case 7: templong += bx; break;
  215.         }
  216.      } else { //using R/M table 2
  217.         switch (rmval) {
  218.             case 0: templong += bx+si; break;
  219.             case 1: templong += bx+di; break;
  220.             case 2: templong += bp+si; break;
  221.             case 3: templong += bp+di; break;
  222.             case 4: templong += si; break;
  223.             case 5: templong += di; break;
  224.             case 6: templong += bp; break;
  225.             case 7: templong += bx; break;
  226.         }
  227.         templong += disp;
  228.      }
  229.      write86(templong, value&0xFF);
  230.      if (datasize==1) write86(templong+1, value>>8);
  231. }
  232.  
  233. void loadbin(char *filename, long loadpoint) {
  234.      long i;
  235.      binfile = fopen(filename, "rb");
  236.      if (binfile==NULL) { printf("Unable to load %s into RAM.\n", filename); running = 0; return; }
  237.      bytesread = fread(&RAM[loadpoint], 1, 512, binfile);    
  238. //     fclose(binfile);
  239.      printf("%u bytes read from %s\n", bytesread, filename);
  240. }
  241.  
  242. void reset86() {
  243.      resetcode[0] = 0xEA; resetcode[1] = 0x00; resetcode[2] = 0x7C; resetcode[3] = 0x00; resetcode[4] = 0x00;
  244.      //cs = 0xffff; ip = 0x0000;
  245.      cs = 0x0000; ip = 0x7c00;
  246.      al = 0; ah = 0; bl = 0; bh = 0; cl = 0; ch = 0; dl = 0; dh = 0;
  247.      sp = 0; bp = 0; si = 0; di = 0;
  248.      ds = 0; ss = 0; es = 0;
  249.      cf = 0; pf = 0; af = 0; zf = 0; sf = 0; tf = 0; ifl = 1; df = 0; of = 0;
  250.      cursorx = 0; cursory = 0; VGAparm.pitch = 160;
  251.      VGAparm.istextmode = 1; VGAparm.textheight = 24; VGAparm.textwidth = 79; VGAparm.videomode = 3;
  252.      for (tempval=1; tempval<4000; tempval+=2) VGAmemory[0x1800+tempval] = 7;
  253.      setnewmode();
  254.      
  255.      //RAM[(cs<<4)+ip] = 0xEA; RAM[(cs<<4)+ip+1] = 0x08; RAM[(cs<<4)+ip+2] = 0x00; RAM[(cs<<4)+ip+3] = 0x00; RAM[(cs<<4)+ip+4] = 0x00;
  256.      running = 1;
  257. }
  258.  
  259. void intcall86(unsigned char intnum) {
  260.      switch (intnum) {
  261.             case 0x10: //VGA BIOS call
  262.                  vgahandler(); return;
  263.             case 0x13: //BIOS call
  264.                  bioshandler(); return;
  265.             case 0x16: //keyboard BIOS call
  266.                  keyhandler(); return;
  267.      }
  268.      push16(makeflagsword()); push16(cs); push16(ip);
  269.      templong = intnum<<2;
  270.      cs = read86(templong++) + (read86(templong++)<<8);
  271.      ip = read86(templong++) + (read86(templong)<<8);
  272.      return;
  273.      //ip = pop16(); cs = pop16(); decodeflagsword(pop16());
  274. }
  275.  
  276. void exec86() {
  277.     char rel8; int rel16;
  278.     savecs = cs; saveip = ip; opcode = read86((cs<<4)+ip); stepip;
  279.     //printf("Exec: %s @ %x:%x\n", opdesc[opcode], savecs, saveip);
  280.     fprintf(logfile, "Exec: %s @ %x:%x\n", opdesc[opcode], savecs, saveip);
  281.      
  282.      useseg = 1; //default segment is DS
  283.      if (opcode==0x2e) { useseg = 0; savecs = cs; saveip = ip; opcode = read86((cs<<4)+ip); stepip;
  284.           fprintf(logfile, "Exec: %s @ %x:%x\n", opdesc[opcode], savecs, saveip);}
  285.         else if (opcode==0x3e) { useseg = 1; savecs = cs; saveip = ip; opcode = read86((cs<<4)+ip); stepip;
  286.           fprintf(logfile, "Exec: %s @ %x:%x\n", opdesc[opcode], savecs, saveip);}
  287.         else if (opcode==0x26) { useseg = 2; savecs = cs; saveip = ip; opcode = read86((cs<<4)+ip); stepip;
  288.           fprintf(logfile, "Exec: %s @ %x:%x\n", opdesc[opcode], savecs, saveip);}
  289.         else if (opcode==0x36) { useseg = 3; savecs = cs; saveip = ip; opcode = read86((cs<<4)+ip); stepip;
  290.           fprintf(logfile, "Exec: %s @ %x:%x\n", opdesc[opcode], savecs, saveip); }
  291.  
  292.      switch (opcode) {
  293.             case 0x06: //PUSH ES
  294.                  push16(es); break;
  295.             case 0x07: //POP ES
  296.                  es = pop16(); break;
  297.             case 0x0e: //PUSH CS                
  298.                  push16(cs); break;
  299.             case 0x16: //PUSH SS                
  300.                  push16(ss); break;
  301.             case 0x17: //POP SS
  302.                  ss = pop16(); break;
  303.             case 0x1e: //PUSH DS                
  304.                  push16(ds); break;
  305.             case 0x1f: //POP DS
  306.                  ds = pop16(); break;
  307.             case 0x33: //XOR Gv, Ev
  308.                  calcmodregrm(); writereg(reg, readrm(rmnum)^ax); break;
  309.             case 0x3b: //CMP Gv, Ev                
  310.                  calcmodregrm(); datasize = 1; oper1 = readreg(reg); oper2 = readrm(rmnum);
  311.                  modifystatusflags(oper1 - oper2); stepip;
  312.                  if (oper1<oper2) cf = 1; else cf = 0; break;
  313.             case 0x3c: //CMP AL, Ib                
  314.                  oper1 = al; oper2 = read86((cs<<4)+ip);
  315.                  modifystatusflags(oper1 - oper2); stepip;
  316.                  if (oper1<oper2) cf = 1; else cf = 0; break;
  317.             case 0x41: //INC eCX
  318.                  templong = (cx+1)&0xFFFF; break;
  319.             case 0x46: //INC eSI
  320.                  si++; break;
  321.             case 0x4a: //DEC eDX
  322.                  templong = (dx-1)&0xFFFF; dl = templong&0xFF; dh = templong>>8; break;
  323.             case 0x50: //PUSH eAX
  324.                  push16(ax); break;                
  325.             case 0x51: //PUSH eCX
  326.                  push16(cx); break;                
  327.             case 0x52: //PUSH eDX
  328.                  push16(dx); break;
  329.             case 0x53: //PUSH eBX
  330.                  push16(bx); break;
  331.             case 0x54: //PUSH eSP
  332.                  push16(sp); break;
  333.             case 0x55: //PUSH eBP
  334.                  push16(bp); break;
  335.             case 0x56: //PUSH eSI
  336.                  push16(si); break;
  337.             case 0x57: //PUSH eDI
  338.                  push16(di); break;
  339.             case 0x58: //POP eAX
  340.                  tempval = pop16(); al = tempval&0xFF; ah = tempval>>8; break;
  341.             case 0x59: //POP eCX
  342.                  tempval = pop16(); cl = tempval&0xFF; ch = tempval>>8; break;
  343.             case 0x5A: //POP eDX
  344.                  tempval = pop16(); dl = tempval&0xFF; dh = tempval>>8; break;
  345.             case 0x5B: //POP eBX
  346.                  tempval = pop16(); bl = tempval&0xFF; bh = tempval>>8; break;
  347.             case 0x5C: //POP eSP
  348.                  sp = pop16(); break;
  349.             case 0x5D: //POP eBP
  350.                  bp = pop16(); break;
  351.             case 0x5E: //POP eSI
  352.                  si = pop16(); break;
  353.             case 0x5F: //POP eDI
  354.                  di = pop16(); break;
  355.             case 0x74: //JZ Jb
  356.                  rel8 = read86((cs<<4)+ip); stepip;
  357.                  if (zf) ip = (ip+rel8)&0xFFFF; break;
  358.             case 0x75: //JNZ Jb
  359.                  rel8 = read86((cs<<4)+ip); stepip;
  360.                  if (zf==0) ip = (ip+rel8)&0xFFFF; break;
  361.             case 0x76: //JBE Jb
  362.                  rel8 = read86((cs<<4)+ip); stepip;
  363.                  if (zf  || cf) ip = (ip+rel8)&0xFFFF; break;
  364.             case 0x80: //CMP Eb, Ib                
  365.                  calcmodregrm(); datasize = 0; oper1 = readrm(rmnum); stepip; stepip;
  366.                  oper2 = read86((cs<<4)+ip); stepip; modifystatusflags(oper1 - oper2);
  367.                  if (oper2<oper1) cf = 1; else cf = 0; break;
  368.             case 0x83: //CMP Ev, Ib                
  369.                  calcmodregrm(); datasize = 1; oper1 = readrm(rmnum);
  370.                  oper2 = read86((cs<<4)+ip); stepip; modifystatusflags(oper1 - signextend(oper2)); break;
  371.                  if (oper2<signextend(oper1)) cf = 1; else cf = 0; break;
  372.             case 0x8a: //MOV Gb, Eb
  373.                  calcmodregrm(); datasize = 0; writereg(reg, readrm(rmnum)); break;
  374.             case 0x8e: //MOV Sw, Ew
  375.                  calcmodregrm(); datasize = 1; writesreg(reg, readrm(rmnum)); break;
  376.             case 0x90: //NOP
  377.                  break;
  378.             case 0xa0: //MOV AL, Ob
  379.                  al = read86((cs<<4)+read86((cs<<4)+ip)); stepip; stepip; break;
  380.             case 0xa1: //MOV AL, Ov
  381.                  al = read86((cs<<4)+read86((cs<<4)+ip)); stepip;
  382.                  ah = read86((cs<<4)+read86((cs<<4)+ip)); stepip; break;
  383.             case 0xa2: //MOV Ob, AL
  384.                  write86(read86((cs<<4)+ip), al); stepip; break;
  385.             case 0xa3: //MOV Ob, AL
  386.                  write86(read86((cs<<4)+ip), al);
  387.                  write86(read86((cs<<4)+ip)+1, ah); stepip; break;
  388.             case 0xb0: //MOV AL, Ib
  389.                  al = read86((cs<<4)+ip); stepip; break;
  390.             case 0xb1: //MOV CL, Ib
  391.                  cl = read86((cs<<4)+ip); stepip; break;
  392.             case 0xb2: //MOV DL, Ib
  393.                  dl = read86((cs<<4)+ip); stepip; break;
  394.             case 0xb3: //MOV BL, Ib
  395.                  bl = read86((cs<<4)+ip); stepip; break;
  396.             case 0xb4: //MOV AH, Ib
  397.                  ah = read86((cs<<4)+ip); stepip; break;
  398.             case 0xb5: //MOV CH, Ib
  399.                  ch = read86((cs<<4)+ip); stepip; break;
  400.             case 0xb6: //MOV DH, Ib
  401.                  dh = read86((cs<<4)+ip); stepip; break;
  402.             case 0xb7: //MOV BH, Ib
  403.                  bh = read86((cs<<4)+ip); stepip; break;
  404.             case 0xb8: //MOV AX, Iv
  405.                  al = read86((cs<<4)+ip); stepip;
  406.                  ah = read86((cs<<4)+ip); stepip; break;
  407.             case 0xb9: //MOV CX, Iv
  408.                  cl = read86((cs<<4)+ip); stepip;
  409.                  ch = read86((cs<<4)+ip); stepip; break;
  410.             case 0xba: //MOV DX, Iv
  411.                  dl = read86((cs<<4)+ip); stepip;
  412.                  dh = read86((cs<<4)+ip); stepip; break;
  413.             case 0xbb: //MOV BX, Iv
  414.                  bl = read86((cs<<4)+ip); stepip;
  415.                  bh = read86((cs<<4)+ip); stepip; break;
  416.             case 0xbc: //MOV SP, Iv
  417.                  sp = read86((cs<<4)+ip); stepip;
  418.                  sp += read86((cs<<4)+ip)<<8; stepip; break;
  419.             case 0xbd: //MOV BP, Iv
  420.                  bp = read86((cs<<4)+ip); stepip;
  421.                  bp += read86((cs<<4)+ip)<<8; stepip; break;
  422.             case 0xbe: //MOV SI, Iv
  423.                  si = read86((cs<<4)+ip); stepip;
  424.                  si += read86((cs<<4)+ip)<<8; stepip; break;
  425.             case 0xbf: //MOV DI, Iv
  426.                  di = read86((cs<<4)+ip); stepip;
  427.                  di += read86((cs<<4)+ip)<<8; stepip; break;
  428.             case 0xc3: //RET
  429.                  ip = pop16(); break;
  430.             case 0xc6: //MOV Eb, Ib
  431.                  calcmodregrm(); datasize = 0; tempval = read86((cs<<4)+ip); stepip; writerm(rmnum, tempval); break;
  432.             case 0xc7: //MOV Ev, Iv
  433.                  calcmodregrm(); datasize = 1; tempval = read86((cs<<4)+ip); stepip;
  434.                  tempval += read86((cs<<4)+ip)<<8; stepip; stepip; stepip; writerm(rmnum, tempval); break;
  435.             case 0xcd: //INT Ib
  436.                  tempval = read86((cs<<4)+ip); stepip;
  437.                  intcall86((unsigned char)tempval); break;
  438.             case 0xd2: //ROR Eb, CL
  439.                  calcmodregrm(); datasize = 0; oper1 = readrm(rmnum);
  440.                  for (tempval=0; tempval<cl; tempval++) {
  441.                      cf = oper1&1; oper1 = oper1>>1; oper1 += (cf<<7);
  442.                  } break;
  443.             case 0xe8: //CALL Jv
  444.                  push16(ip+2); rel16 = read86((cs<<4)+ip)+(read86((cs<<4)+ip+1)<<8); ip += rel16+2; break;
  445.             case 0xe9: //JMP Jv
  446.                  ip = (read86((cs<<4)+ip)+(read86((cs<<4)+ip+1)<<8)+3) % 0xFFFF; break;
  447.             case 0xea: //JMP Ap                
  448.                  templong = cs;
  449.                  cs = read86((templong<<4)+ip+2)+(read86((templong<<4)+ip+3)<<8);
  450.                  ip = read86((templong<<4)+ip)+(read86((templong<<4)+ip+1)<<8); break;
  451.             case 0xeb: //JMP Jb
  452.                  rel8 = read86((cs<<4)+ip); ip = (ip+rel8+1)&0xFFFF; break;
  453.             case 0xf4: //HLT
  454.                  running = 0; break;
  455.             case 0xfa: //CLI
  456.                  ifl = 0; break;
  457.             case 0xfc: //CLD
  458.                  df = 0; break;
  459.             case 0xfe: //INC Eb
  460.                  calcmodregrm(); tempval = (readrm(rmnum)+1)&0xFF; writerm(rmnum, tempval); break;
  461.             default:
  462.                     running = 0;
  463.                     fprintf(logfile, "UNKNOWN OPCODE EXCEPTION: %s @ %x:%x\n", opdesc[opcode], savecs, saveip);
  464.                     fprintf(logfile, "AX: %x    BX: %x    CX: %x    DX: %x\n", ax, bx, cx, dx);
  465.                     fprintf(logfile, "CS: %x    IP: %x    SS: %x    SP: %x\n", savecs, saveip, ss, sp);
  466.                     fprintf(logfile, "SI: %x    DI: %x    DS: %x    ES: %x\n", si, di, ds, es);
  467.                     fprintf(logfile, "CS: %x    DS: %x\n\n", cs, ds);
  468.                     fprintf(logfile, "Total operations executed: %u\n\n", totalexec);                    
  469.                     return;
  470.      }
  471.      totalexec++;
  472. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement