26 lines
528 B
Go
26 lines
528 B
Go
package asm
|
|
|
|
import (
|
|
"git.akyoto.dev/cli/q/src/cpu"
|
|
)
|
|
|
|
// Register operates with a single register.
|
|
type Register struct {
|
|
Register cpu.Register
|
|
}
|
|
|
|
// String returns a human readable version.
|
|
func (data *Register) String() string {
|
|
return data.Register.String()
|
|
}
|
|
|
|
// Register adds an instruction using a single register.
|
|
func (a *Assembler) Register(mnemonic Mnemonic, register cpu.Register) {
|
|
a.Instructions = append(a.Instructions, Instruction{
|
|
Mnemonic: mnemonic,
|
|
Data: &Register{
|
|
Register: register,
|
|
},
|
|
})
|
|
}
|