Implemented addition

This commit is contained in:
Eduard Urbach 2024-06-24 14:14:07 +02:00
parent b6722c5482
commit 0657b88945
Signed by: eduard
GPG key ID: 49226B848C78F6C8
6 changed files with 78 additions and 23 deletions

View file

@ -2,6 +2,17 @@ package asm
import "git.akyoto.dev/cli/q/src/build/cpu"
// AddRegisterNumber adds a number to the given register.
func (a *Assembler) AddRegisterNumber(reg cpu.Register, number uint64) {
a.Instructions = append(a.Instructions, Instruction{
Mnemonic: ADD,
Data: &RegisterNumber{
Register: reg,
Number: number,
},
})
}
// MoveRegisterNumber moves a number into the given register.
func (a *Assembler) MoveRegisterNumber(reg cpu.Register, number uint64) {
a.Instructions = append(a.Instructions, Instruction{