Improved x64 encoder
This commit is contained in:
@ -114,17 +114,17 @@ func (f *Function) CompileInstruction(line token.List) error {
|
||||
}
|
||||
|
||||
if expr.Token.Kind == token.Operator {
|
||||
name := expr.Children[0].Token.Text()
|
||||
number, _ := strconv.Atoi(expr.Children[1].Token.Text())
|
||||
register := f.Variables[name].Register
|
||||
|
||||
switch expr.Token.Text() {
|
||||
case "+=":
|
||||
name := expr.Children[0].Token.Text()
|
||||
number, _ := strconv.Atoi(expr.Children[1].Token.Text())
|
||||
f.Assembler.AddRegisterNumber(f.Variables[name].Register, number)
|
||||
f.Assembler.AddRegisterNumber(register, number)
|
||||
return nil
|
||||
|
||||
case "-=":
|
||||
name := expr.Children[0].Token.Text()
|
||||
number, _ := strconv.Atoi(expr.Children[1].Token.Text())
|
||||
f.Assembler.SubRegisterNumber(f.Variables[name].Register, number)
|
||||
f.Assembler.SubRegisterNumber(register, number)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user