Simplified file structure

This commit is contained in:
Eduard Urbach 2024-08-07 19:39:10 +02:00
parent cacee7260a
commit a466281307
Signed by: eduard
GPG key ID: 49226B848C78F6C8
219 changed files with 453 additions and 457 deletions

View file

@ -1,39 +0,0 @@
package asm
// Comment adds a comment at the current position.
func (a *Assembler) Comment(text string) {
a.Instructions = append(a.Instructions, Instruction{
Mnemonic: COMMENT,
Data: &Label{
Name: text,
},
})
}
// Call calls a function whose position is identified by a label.
func (a *Assembler) Call(name string) {
a.Instructions = append(a.Instructions, Instruction{
Mnemonic: CALL,
Data: &Label{
Name: name,
},
})
}
// Return returns back to the caller.
func (a *Assembler) Return() {
if len(a.Instructions) > 0 {
lastMnemonic := a.Instructions[len(a.Instructions)-1].Mnemonic
if lastMnemonic == RETURN || lastMnemonic == JUMP {
return
}
}
a.Instructions = append(a.Instructions, Instruction{Mnemonic: RETURN})
}
// Syscall executes a kernel function.
func (a *Assembler) Syscall() {
a.Instructions = append(a.Instructions, Instruction{Mnemonic: SYSCALL})
}