Added LoadVar support to the VM and fixed a minor mistake in the debugger output
This commit is contained in:
parent
42ab1d4c6e
commit
9f1769ab71
|
@ -165,6 +165,8 @@ proc dispatch*(self: PeonVM) =
|
|||
of OpCode.Return:
|
||||
# TODO
|
||||
return
|
||||
of OpCode.LoadVar:
|
||||
self.push(self.stack[self.readLong()])
|
||||
of NoOp:
|
||||
continue
|
||||
of Pop:
|
||||
|
|
|
@ -78,7 +78,7 @@ proc argumentDoubleInstruction(instruction: OpCode, chunk: Chunk, offset: int):
|
|||
## Debugs instructions that operate on a hardcoded value on the stack using a 16-bit operand
|
||||
var slot = [chunk.code[offset + 1], chunk.code[offset + 2]].fromDouble()
|
||||
printInstruction(instruction)
|
||||
stdout.write(&", has argument ")
|
||||
stdout.styledWrite(fgGreen, &", has argument ")
|
||||
setForegroundColor(fgYellow)
|
||||
stdout.write(&"{slot}")
|
||||
nl()
|
||||
|
|
Loading…
Reference in New Issue