Implemented calls using memory addresses
This commit is contained in:
parent
ea233d789d
commit
08660ad845
8 changed files with 114 additions and 10 deletions
|
@ -35,9 +35,27 @@ func (mem *Memory) Format(custom string) string {
|
|||
tmp.WriteString(strconv.Itoa(int(mem.Offset)))
|
||||
}
|
||||
|
||||
tmp.WriteString("], ")
|
||||
tmp.WriteString(custom)
|
||||
tmp.WriteString("]")
|
||||
|
||||
if custom != "" {
|
||||
tmp.WriteString(", ")
|
||||
tmp.WriteString(custom)
|
||||
}
|
||||
|
||||
tmp.WriteString(", ")
|
||||
tmp.WriteString(strconv.Itoa(int(mem.Length)))
|
||||
return tmp.String()
|
||||
}
|
||||
|
||||
// String returns a human readable version.
|
||||
func (mem *Memory) String() string {
|
||||
return mem.Format("")
|
||||
}
|
||||
|
||||
// Memory adds an instruction with a memory address.
|
||||
func (a *Assembler) Memory(mnemonic Mnemonic, address Memory) {
|
||||
a.Instructions = append(a.Instructions, Instruction{
|
||||
Mnemonic: mnemonic,
|
||||
Data: &address,
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue