From c2fb41b27cb4294520cd73aa3d81d51d0f969bf8 Mon Sep 17 00:00:00 2001 From: Astatin Date: Tue, 7 Jan 2025 17:24:46 +0900 Subject: Add support for relative labels in parameters --- instructions.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'instructions.go') diff --git a/instructions.go b/instructions.go index ddcb833..ca3df54 100644 --- a/instructions.go +++ b/instructions.go @@ -5,7 +5,7 @@ import ( "strings" ) -type ParamType func(labels *Labels, defs *Definitions, param string) (uint16, error) +type ParamType func(labels *Labels, lastAbsoluteLabel string, defs *Definitions, param string) (uint16, error) type InstructionParams struct { Types []ParamType @@ -506,6 +506,7 @@ func (set InstructionSet) Parse( isMacro bool, isFirstPass bool, currentAddress uint16, + lastAbsoluteLabel string, line string, ) ([]byte, error) { words := strings.Fields(strings.ReplaceAll(strings.Trim(line, " \t\n"), ",", " ")) @@ -541,7 +542,7 @@ instruction_param_loop: if isFirstPass && !instrParam.LabelsBeforeOnly { accessibleLabels = nil } - parsed, err := paramType(accessibleLabels, defs, params[i]) + parsed, err := paramType(accessibleLabels, lastAbsoluteLabel, defs, params[i]) if err != nil { continue instruction_param_loop } -- cgit v1.2.3-70-g09d2