Implemented complex expressions
This commit is contained in:
parent
03a7651cad
commit
0394d68bdf
7 changed files with 137 additions and 102 deletions
|
@ -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{
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue