Implemented multiplication
This commit is contained in:
@ -120,11 +120,15 @@ func (f *Function) CompileInstruction(line token.List) error {
|
||||
|
||||
switch expr.Token.Text() {
|
||||
case "+=":
|
||||
f.Assembler.AddRegisterNumber(register, number)
|
||||
f.Assembler.RegisterNumber(asm.ADD, register, number)
|
||||
return nil
|
||||
|
||||
case "-=":
|
||||
f.Assembler.SubRegisterNumber(register, number)
|
||||
f.Assembler.RegisterNumber(asm.SUB, register, number)
|
||||
return nil
|
||||
|
||||
case "*=":
|
||||
f.Assembler.RegisterNumber(asm.MUL, register, number)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
@ -164,7 +168,7 @@ func (f *Function) TokenToRegister(t token.Token, register cpu.Register) error {
|
||||
return err
|
||||
}
|
||||
|
||||
f.Assembler.MoveRegisterNumber(register, n)
|
||||
f.Assembler.RegisterNumber(asm.MOVE, register, n)
|
||||
return nil
|
||||
|
||||
case token.String:
|
||||
|
Reference in New Issue
Block a user