Reorganized file structure
This commit is contained in:
32
src/build/asm/Instructions.go
Normal file
32
src/build/asm/Instructions.go
Normal file
@ -0,0 +1,32 @@
|
||||
package asm
|
||||
|
||||
import "git.akyoto.dev/cli/q/src/build/cpu"
|
||||
|
||||
// MoveRegisterNumber moves a number into the given register.
|
||||
func (a *Assembler) MoveRegisterNumber(reg cpu.Register, number uint64) {
|
||||
a.Instructions = append(a.Instructions, Instruction{
|
||||
Mnemonic: MOVE,
|
||||
Data: RegisterNumber{
|
||||
Register: reg,
|
||||
Number: number,
|
||||
IsPointer: false,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// MoveRegisterAddress moves an address into the given register.
|
||||
func (a *Assembler) MoveRegisterAddress(reg cpu.Register, address Address) {
|
||||
a.Instructions = append(a.Instructions, Instruction{
|
||||
Mnemonic: MOVE,
|
||||
Data: RegisterNumber{
|
||||
Register: reg,
|
||||
Number: uint64(address),
|
||||
IsPointer: true,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// Syscall executes a kernel function.
|
||||
func (a *Assembler) Syscall() {
|
||||
a.Instructions = append(a.Instructions, Instruction{Mnemonic: SYSCALL})
|
||||
}
|
Reference in New Issue
Block a user