Implemented infinite loops

This commit is contained in:
Eduard Urbach 2024-06-24 11:00:32 +02:00
parent 121f77fe76
commit b6722c5482
Signed by: eduard
GPG key ID: 49226B848C78F6C8
9 changed files with 198 additions and 113 deletions

View file

@ -44,6 +44,16 @@ func (a *Assembler) Call(name string) {
})
}
// Jump jumps to a position that is identified by a label.
func (a *Assembler) Jump(name string) {
a.Instructions = append(a.Instructions, Instruction{
Mnemonic: JUMP,
Data: &Label{
Name: name,
},
})
}
// Return returns back to the caller.
func (a *Assembler) Return() {
a.Instructions = append(a.Instructions, Instruction{Mnemonic: RETURN})