8086 simulator in ruby

How about this?

class CPU
def mov(dest,src)
dest = src
end
end

#asm interpreter
def interpret(line)
puts line.downcase.scan(/\w+/)
instuct = line.downcase.scan(/\w+/)[0]
op1 = line.downcase.scan(/\w+/)[1]
op2 = line.downcase.scan(/\w+/)[2]
Processor.new.method(instruct).call(op1,op2)
end

I have no idea tho as to how to implement the registers and memmory.
Simon gave some ideas.

Hi –

On Mon, 20 Aug 2007, Phlip wrote:

I mis-remembered something. Something about a method that you could create
but would have difficulty calling. No worries.

You might be thinking of:

irb(main):005:0> class C
irb(main):006:1> define_method("!@$*") { puts “hi” }
irb(main):007:1> end
=> #Proc:0x0032a410@:6(irb)

where you then have to do this to call it:

irb(main):008:0> C.new.send("!@$*")
hi

David