Added label type

This commit is contained in:
2025-03-13 16:57:13 +01:00
parent d96c351b4b
commit c1913d99d0
32 changed files with 102 additions and 63 deletions

View File

@ -1,8 +1,6 @@
package asmc
import (
"strings"
"git.urbach.dev/cli/q/src/asm"
"git.urbach.dev/cli/q/src/x86"
)
@ -25,13 +23,13 @@ func (c *compiler) move(x asm.Instruction) {
position := end - 4
opSize := position - start
if strings.HasPrefix(operands.Label, "data ") {
if operands.Label.Type == asm.DataLabel {
c.dataPointers = append(c.dataPointers, &pointer{
Position: position,
OpSize: uint8(opSize),
Size: uint8(4),
Resolve: func() Address {
destination, exists := c.dataLabels[operands.Label]
destination, exists := c.dataLabels[operands.Label.Name]
if !exists {
panic("unknown label")
@ -48,7 +46,7 @@ func (c *compiler) move(x asm.Instruction) {
OpSize: uint8(opSize),
Size: uint8(4),
Resolve: func() Address {
destination, exists := c.codeLabels[operands.Label]
destination, exists := c.codeLabels[operands.Label.Name]
if !exists {
panic("unknown label")