Implemented subtraction
This commit is contained in:
@ -118,7 +118,13 @@ func (f *Function) CompileInstruction(line token.List) error {
|
||||
case "+=":
|
||||
name := expr.Children[0].Token.Text()
|
||||
number, _ := strconv.Atoi(expr.Children[1].Token.Text())
|
||||
f.Assembler.AddRegisterNumber(f.Variables[name].Register, uint64(number))
|
||||
f.Assembler.AddRegisterNumber(f.Variables[name].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)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@ -158,7 +164,7 @@ func (f *Function) TokenToRegister(t token.Token, register cpu.Register) error {
|
||||
return err
|
||||
}
|
||||
|
||||
f.Assembler.MoveRegisterNumber(register, uint64(n))
|
||||
f.Assembler.MoveRegisterNumber(register, n)
|
||||
return nil
|
||||
|
||||
case token.String:
|
||||
|
Reference in New Issue
Block a user