Implemented array storage
This commit is contained in:
27
src/build/asm/MemoryNumber.go
Normal file
27
src/build/asm/MemoryNumber.go
Normal file
@ -0,0 +1,27 @@
|
||||
package asm
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// MemoryNumber operates with a memory address and a number.
|
||||
type MemoryNumber struct {
|
||||
Address Memory
|
||||
Number int
|
||||
}
|
||||
|
||||
// String returns a human readable version.
|
||||
func (data *MemoryNumber) String() string {
|
||||
return fmt.Sprintf("%dB [%s+%d], %d", data.Address.Length, data.Address.Base, data.Address.Offset, data.Number)
|
||||
}
|
||||
|
||||
// MemoryNumber adds an instruction with a memory address and a number.
|
||||
func (a *Assembler) MemoryNumber(mnemonic Mnemonic, address Memory, number int) {
|
||||
a.Instructions = append(a.Instructions, Instruction{
|
||||
Mnemonic: mnemonic,
|
||||
Data: &MemoryNumber{
|
||||
Address: address,
|
||||
Number: number,
|
||||
},
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user