From: Robert Klemme Date: 2007-08-18T06:24:58+09:00 Subject: Re: 8086 simulator in ruby On 17.08.2007 21:41, Phlip wrote: > Vasil Vangelovski 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? > > Woo-hoo! Like Larry Wall said (he'd know), Real programmers can write > assembler in any language! > > Try: > > cpu = CPU.new > cpu.push 42 > cpu.shift :b > > and away you go! I'd rather do CPU8086 do label :begin push 42 shift :b jmp :begin end I.e. create an instance behind the scenes and instance_eval the block. Kind regards robert