Advertisement
captmicro

Untitled

Apr 24th, 2011
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. typedef unsigned char BYTE;
  2. typedef unsigned short WORD;
  3. #define MEM_SZ 1024 //PC is WORD
  4. int main(char *argv[], int argc)
  5. {
  6.     BYTE mem[MEM_SZ];
  7.     *(mem + MEM_SZ - 3) = 0x00;
  8.     *(mem + MEM_SZ - 4) = 0x01;
  9.     WORD *pc = (mem + MEM_SZ-2);
  10.     BYTE a = 0, b = 0; char c = 0;
  11.     while (*pc < MEM_SZ-4)
  12.     {
  13.         a = mem[*pc];
  14.         b = mem[*pc+1];
  15.         c = (char)mem[*pc+2];
  16.         mem[a] = mem[b] - mem[a];
  17.         if (mem[b] == 0) *pc += c;
  18.         else *pc += 3;
  19.     }
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement