Files
subcoding/gen/instruction.go

16 lines
287 B
Go
Raw Normal View History

2021-11-20 17:59:22 -10:00
package gen
import "github.com/firestuff/subcoding/vm"
func RandInstruction(prog *vm.Program) *vm.Instruction {
2021-11-20 17:59:22 -10:00
instr := &vm.Instruction{
OpCode: RandOpCode(),
2021-11-20 17:59:22 -10:00
}
for i, t := range vm.OperandsByOpCode[instr.OpCode] {
instr.Operands[i] = RandOperand(prog, t)
2021-11-20 17:59:22 -10:00
}
return instr
}