Improved formatting of load and store commands
This commit is contained in:
@ -2,7 +2,6 @@ package asm
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
|
||||
"git.akyoto.dev/cli/q/src/cpu"
|
||||
)
|
||||
@ -15,11 +14,7 @@ type MemoryRegister struct {
|
||||
|
||||
// String returns a human readable version.
|
||||
func (data *MemoryRegister) 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.Register)
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%dB [%s+%s+%d], %s", data.Address.Length, data.Address.Base, data.Address.OffsetRegister, data.Address.Offset, data.Register)
|
||||
return data.Address.Format(fmt.Sprint(data.Register))
|
||||
}
|
||||
|
||||
// MemoryRegister adds an instruction with a memory address and a number.
|
||||
|
Reference in New Issue
Block a user