V
Vasil Vangelovski
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.
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.