Fixed incorrect register move

This commit is contained in:
2024-08-02 12:55:25 +02:00
parent 34d865986a
commit b1f0d20394
12 changed files with 38 additions and 31 deletions

View File

@ -20,6 +20,7 @@ func (f *Function) TokenToRegister(t token.Token, register cpu.Register) error {
}
f.UseVariable(variable)
f.SaveRegister(register)
f.RegisterRegister(asm.MOVE, register, variable.Register)
return nil
@ -30,6 +31,7 @@ func (f *Function) TokenToRegister(t token.Token, register cpu.Register) error {
return err
}
f.SaveRegister(register)
f.RegisterNumber(asm.MOVE, register, number)
return nil
@ -37,6 +39,7 @@ func (f *Function) TokenToRegister(t token.Token, register cpu.Register) error {
data := t.Bytes(f.File.Bytes)
data = String(data)
label := f.AddBytes(data)
f.SaveRegister(register)
f.RegisterLabel(asm.MOVE, register, label)
return nil