diff options
author | Astatin <[email protected]> | 2025-01-07 16:20:52 +0900 |
---|---|---|
committer | Astatin <[email protected]> | 2025-01-07 16:20:52 +0900 |
commit | b5b9637ff2d222841632b8644b94835ec1c93359 (patch) | |
tree | e7239875fd331effe67e62c62569c0cff5b8c1d0 /instructions.go | |
parent | e4c337519fb9842de5eb12e5975f50efa02784d0 (diff) |
Add label offset + allow to use labels with .DB macro + relative labels
Diffstat (limited to 'instructions.go')
-rw-r--r-- | instructions.go | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/instructions.go b/instructions.go index 59daa3a..ddcb833 100644 --- a/instructions.go +++ b/instructions.go @@ -8,10 +8,11 @@ import ( type ParamType func(labels *Labels, defs *Definitions, param string) (uint16, error) type InstructionParams struct { - Types []ParamType - Assembler func(currentAddress uint16, args []uint16) ([]uint8, error) - Wildcard bool - MacroForbidden bool + Types []ParamType + Assembler func(currentAddress uint16, args []uint16) ([]uint8, error) + Wildcard bool + MacroForbidden bool + LabelsBeforeOnly bool } type InstructionSet map[string][]InstructionParams @@ -503,6 +504,7 @@ func (set InstructionSet) Parse( labels *Labels, defs *Definitions, isMacro bool, + isFirstPass bool, currentAddress uint16, line string, ) ([]byte, error) { @@ -534,7 +536,12 @@ instruction_param_loop: paramType = instrParam.Types[i] } - parsed, err := paramType(labels, defs, params[i]) + accessibleLabels := labels + + if isFirstPass && !instrParam.LabelsBeforeOnly { + accessibleLabels = nil + } + parsed, err := paramType(accessibleLabels, defs, params[i]) if err != nil { continue instruction_param_loop } |