Add conditional call instructions
This commit is contained in:
@@ -5,8 +5,6 @@ import "github.com/firestuff/subcoding/vm"
|
||||
var opCodeByName = map[string]vm.OpCodeType{
|
||||
"noop": vm.OpNoOp,
|
||||
"nop": vm.OpNop,
|
||||
"call": vm.OpCall,
|
||||
"cal": vm.OpCal,
|
||||
"return": vm.OpReturn,
|
||||
"ret": vm.OpRet,
|
||||
|
||||
@@ -48,6 +46,13 @@ var opCodeByName = map[string]vm.OpCodeType{
|
||||
"jmpt": vm.OpJmpT,
|
||||
"jumpiffalse": vm.OpJumpIfFalse,
|
||||
"jmpf": vm.OpJmpF,
|
||||
|
||||
"call": vm.OpCall,
|
||||
"cal": vm.OpCal,
|
||||
"calliftrue": vm.OpCallIfTrue,
|
||||
"calt": vm.OpCalT,
|
||||
"calliffalse": vm.OpCallIfFalse,
|
||||
"calf": vm.OpCalF,
|
||||
}
|
||||
|
||||
type operandType int
|
||||
@@ -61,7 +66,6 @@ const (
|
||||
|
||||
var operandsByOpCode = map[vm.OpCodeType][]operandType{
|
||||
vm.OpNop: []operandType{},
|
||||
vm.OpCal: []operandType{s},
|
||||
vm.OpRet: []operandType{},
|
||||
|
||||
vm.OpMov: []operandType{r, us},
|
||||
@@ -84,4 +88,8 @@ var operandsByOpCode = map[vm.OpCodeType][]operandType{
|
||||
vm.OpJmp: []operandType{s},
|
||||
vm.OpJmpT: []operandType{s},
|
||||
vm.OpJmpF: []operandType{s},
|
||||
|
||||
vm.OpCal: []operandType{s},
|
||||
vm.OpCalT: []operandType{s},
|
||||
vm.OpCalF: []operandType{s},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user