Improved formatting of load and store commands
This commit is contained in:
@ -1,10 +1,5 @@
|
||||
package asm
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
)
|
||||
|
||||
// MemoryLabel operates with a memory address and a number.
|
||||
type MemoryLabel struct {
|
||||
Label string
|
||||
@ -13,11 +8,7 @@ type MemoryLabel struct {
|
||||
|
||||
// String returns a human readable version.
|
||||
func (data *MemoryLabel) String() string {
|
||||
if data.Address.OffsetRegister == math.MaxUint8 {
|
||||
return fmt.Sprintf("%dB [%s+%d], %s", data.Address.Length, data.Address.Base, data.Address.Offset, data.Label)
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%dB [%s+%s+%d], %s", data.Address.Length, data.Address.Base, data.Address.OffsetRegister, data.Address.Offset, data.Label)
|
||||
return data.Address.Format(data.Label)
|
||||
}
|
||||
|
||||
// MemoryLabel adds an instruction with a memory address and a label.
|
||||
|
Reference in New Issue
Block a user