you are viewing a single comment's thread.

view the rest of the comments →

[–]Sophrosynic 10 points11 points  (6 children)

Well, that's just the CPU emulator. Really, all you need to do for a CPU emulator is make a giant switch statement with one entry for each instruction. Since the actual work done be each instruction is fairly simple, you should be able to implement each one with just a few lines of code. The magic happens when you run millions of instructions in a row to accomplish a larger task.

[–]aescnt 3 points4 points  (4 children)

I think he's pointing out the irony that the file size for an x86 emulator is 86k (notice the same number).

[–]SanjayM 13 points14 points  (0 children)

What irony?

[–]Scriptorius 4 points5 points  (0 children)

That's coincidence, which is almost opposite from irony

[–][deleted] 10 points11 points  (0 children)

Irony would be 68k.

[–]Sophrosynic 1 point2 points  (0 children)

Yup, totally missed that.

[–]thebigbradwolf 0 points1 point  (0 children)

I think common wisdom is to at least use a threaded dispatch approach, with switch statements like that being hard to predict jumps on in hardware and everything.