Take the 2-minute tour ×
Programming Puzzles & Code Golf Stack Exchange is a question and answer site for programming puzzle enthusiasts and code golfers. It's 100% free, no registration required.

Possible Duplicate:
Emulate an Intel 8086 CPU

I know that there already is a code golf for this, but that one didn't require much. This one, however, is for masochists only! >:) OK, you need to emulate an entire 8086, every single opcode. Not every flag needs to be computed, but every single documented opcode needs to be implemented.

However, that's just the beginning. I STRONGLY encourage you to support more than just this. NEC V20? Why not? Soviet clones? Don't mind if I do.

For some help, opcodes 0x60 - 0x6F are just aliases for opcodes 0x70 - 0x7F on the 8086 and 8088 ONLY. If you ask the guy who runs reenigne.org, he'll say the same thing, simply because it's been proven by hardware tests, on an IBM XT.

Anyways, for bonus points, emulate an entire V20, 286, or 386, no facets left unemulated.

share|improve this question

marked as duplicate by Peter Taylor, CMP, Sir_Lagsalot, grc, luser droog Jan 24 '13 at 7:01

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3  
What is the metric here? –  dmckee Jan 21 '13 at 22:10
1  
added the code-challenge tag. every puzzle needs a 'type'. –  luser droog Jan 22 '13 at 5:06
2  
The other thread you mention is Emulate an Intel 8086 CPU‌​, and I'm voting to close as a duplicate of that on the basis that any solution to this challenge is also a solution to that challenge. If you want solutions to the extended challenge to get double points, I think a better approach is to find someone willing to sponsor bounties. –  Peter Taylor Jan 22 '13 at 9:46
1  
In addition to a "type" every questions needs a way to tell who won or at least some basis for judging the entries. Without that this isn't a duplicate because it isn't a question in the mean we use here. –  dmckee Jan 22 '13 at 21:06
1  
Minority Opinion: I don't consider it a problem to have an expanded version of the same challenge. Something you can graduate towards by first solving the smaller one. But I cast the final close vote as "Not a real question" for the reason cited by dmckee. The beauty of the original question was the well-chosen subset and the well-written test program which exercised the desired subset. Where does this one end? Pentium? MMX? The fun was in the 0-60 part. That said, if this were edited to provide nicer constraints, perhaps a single output device, and a testing program, that'd be different.hth –  luser droog Jan 24 '13 at 7:09
show 1 more comment

1 Answer 1

C++ - 5084 lines

github.com/Alegend45/IBM5150/blob/master/cpu.h

This emulates the entire 8086, the 80186 instruction set, and part of the NEC V20. This took me over 3 weeks.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.