diff options
author | Astatin <[email protected]> | 2025-01-07 17:24:46 +0900 |
---|---|---|
committer | Astatin <[email protected]> | 2025-01-07 17:24:46 +0900 |
commit | c2fb41b27cb4294520cd73aa3d81d51d0f969bf8 (patch) | |
tree | 187caf2f08e3e9625daa18146c0798ea491f84ac /instructions.go | |
parent | b5b9637ff2d222841632b8644b94835ec1c93359 (diff) |
Add support for relative labels in parameters
Diffstat (limited to 'instructions.go')
-rw-r--r-- | instructions.go | 5 |
1 files changed, 3 insertions, 2 deletions
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 } |