Reorganized file structure
This commit is contained in:
parent
8b595ef3ce
commit
722d07c321
57 changed files with 431 additions and 614 deletions
19
src/build/asm/Instruction.go
Normal file
19
src/build/asm/Instruction.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
package asm
|
||||
|
||||
import "fmt"
|
||||
|
||||
// Instruction represents a single instruction which can be converted to machine code.
|
||||
type Instruction struct {
|
||||
Mnemonic Mnemonic
|
||||
Data interface{}
|
||||
}
|
||||
|
||||
// String returns a human readable version.
|
||||
func (x *Instruction) String() string {
|
||||
switch data := x.Data.(type) {
|
||||
case RegisterNumber:
|
||||
return fmt.Sprintf("%s %s, %x", x.Mnemonic, data.Register, data.Number)
|
||||
default:
|
||||
return x.Mnemonic.String()
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue