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}) }