Make memory sizes parameters

This commit is contained in:
Ian Gulliver
2021-11-20 18:27:06 -10:00
parent bd84a5b969
commit 5af90aa6ff
15 changed files with 127 additions and 28 deletions

View File

@@ -2,13 +2,13 @@ package gen
import "github.com/firestuff/subcoding/vm"
func randInstruction() *vm.Instruction {
func randInstruction(prog *vm.Program) *vm.Instruction {
instr := &vm.Instruction{
OpCode: randOpCode(),
}
for i, t := range vm.OperandsByOpCode[instr.OpCode] {
instr.Operands[i] = randOperand(t)
instr.Operands[i] = randOperand(prog, t)
}
return instr