Implemented complex expressions

This commit is contained in:
Eduard Urbach 2024-06-26 22:51:14 +02:00
parent 03a7651cad
commit 0394d68bdf
Signed by: eduard
GPG key ID: 49226B848C78F6C8
7 changed files with 137 additions and 102 deletions

View file

@ -24,17 +24,6 @@ func (a *Assembler) RegisterRegister(mnemonic Mnemonic, left cpu.Register, right
})
}
// MoveRegisterRegister moves a register value into another register.
func (a *Assembler) MoveRegisterRegister(destination cpu.Register, source cpu.Register) {
a.Instructions = append(a.Instructions, Instruction{
Mnemonic: MOVE,
Data: &RegisterRegister{
Destination: destination,
Source: source,
},
})
}
// Label adds a label at the current position.
func (a *Assembler) Label(name string) {
a.Instructions = append(a.Instructions, Instruction{

View file

@ -14,5 +14,5 @@ type RegisterNumber struct {
// String returns a human readable version.
func (data *RegisterNumber) String() string {
return fmt.Sprintf("%s, %Xₕ", data.Register, data.Number)
return fmt.Sprintf("%s, %d", data.Register, data.Number)
}