Added push and pop instructions

This commit is contained in:
Eduard Urbach 2024-06-27 12:59:41 +02:00
parent 0d8891d8a7
commit 8867845310
Signed by: eduard
GPG key ID: 49226B848C78F6C8
4 changed files with 45 additions and 0 deletions

View file

@ -24,6 +24,16 @@ func (a *Assembler) RegisterRegister(mnemonic Mnemonic, left cpu.Register, right
})
}
// 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,
},
})
}
// Label adds a label at the current position.
func (a *Assembler) Label(name string) {
a.Instructions = append(a.Instructions, Instruction{