On 8/17/07, Vasil Vangelovski <vvangelovski / gmail.com> wrote:
> I'm thinking of writing a simulator for the intel 8086 processor in
> ruby. At first I'm interested in implementing basic instruction
> execution and memory access, no interrupts. The interface may later be
> implemented with Tk maybe even as an ajax application on rails. My buest
> guess is using metaprogramming for interpreting the  assembly
> instructions. I'm not wery experienced with design patterns, so I need
> some ideas on the levels of abstraction (the classes) i need to start
> with this. Any ideas?

Check out rubinius at http://rubini.us for a Ruby implementation
written (mostly) in Ruby and (mostly) test-first. It may help you
think of some ideas.

What you are describing is basically just a virtual machine that you
happen to already know the V-ISA for. You can definitely do this in
Ruby, though simulating a real CPU is never going to be easy.