Simplified file structure
This commit is contained in:
21
src/asm/Label.go
Normal file
21
src/asm/Label.go
Normal file
@ -0,0 +1,21 @@
|
||||
package asm
|
||||
|
||||
// Label represents a jump label.
|
||||
type Label struct {
|
||||
Name string
|
||||
}
|
||||
|
||||
// String returns a human readable version.
|
||||
func (data *Label) String() string {
|
||||
return data.Name
|
||||
}
|
||||
|
||||
// Label adds an instruction using a label.
|
||||
func (a *Assembler) Label(mnemonic Mnemonic, name string) {
|
||||
a.Instructions = append(a.Instructions, Instruction{
|
||||
Mnemonic: mnemonic,
|
||||
Data: &Label{
|
||||
Name: name,
|
||||
},
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user