Files
subcoding/gen/instruction.go
2021-11-20 18:27:06 -10:00

16 lines
287 B
Go

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