Implemented simple expressions
This commit is contained in:
parent
c437b1d0f8
commit
37e222e022
12 changed files with 232 additions and 52 deletions
|
@ -13,6 +13,17 @@ func (a *Assembler) RegisterNumber(mnemonic Mnemonic, reg cpu.Register, number i
|
|||
})
|
||||
}
|
||||
|
||||
// RegisterRegister adds an instruction using two registers.
|
||||
func (a *Assembler) RegisterRegister(mnemonic Mnemonic, left cpu.Register, right cpu.Register) {
|
||||
a.Instructions = append(a.Instructions, Instruction{
|
||||
Mnemonic: mnemonic,
|
||||
Data: &RegisterRegister{
|
||||
Destination: left,
|
||||
Source: 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{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue