Implemented structs

This commit is contained in:
2025-02-04 18:16:31 +01:00
parent 4609a814df
commit 03a3bd8f02
32 changed files with 267 additions and 63 deletions

View File

@ -2,6 +2,7 @@ package asm
import (
"fmt"
"math"
"git.akyoto.dev/cli/q/src/cpu"
)
@ -14,6 +15,10 @@ 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)
}