Implemented multiplication

This commit is contained in:
2024-06-24 22:43:01 +02:00
parent 625e8d5e2e
commit 34af20d7a0
11 changed files with 107 additions and 47 deletions

View File

@ -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: