aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAstatin <[email protected]>2025-06-18 16:44:10 +0200
committerAstatin <[email protected]>2025-06-18 16:44:10 +0200
commit14b1fc9b3ea5520a3e9c5a7a457a7a03660bc910 (patch)
treede1945a351ccbe14b6512dbcca8bd800576352f2
parent501b255423d9a08ab5d9765c3feb5bf3a6b7b0af (diff)
Fix .PADTO in macro & allow to use current_address in .DEFINE
-rw-r--r--instructions.go9
-rw-r--r--macros.go10
2 files changed, 14 insertions, 5 deletions
diff --git a/instructions.go b/instructions.go
index ff87e44..c852ec4 100644
--- a/instructions.go
+++ b/instructions.go
@@ -563,7 +563,14 @@ instruction_param_loop:
}
if instrParam.MacroForbidden && isMacro {
- return nil, fmt.Errorf("This instruction cannot be used with this set of params inside of a macro")
+ rejectedError := fmt.Errorf("\t[Rejected] Param Type %v: This instruction cannot be used with this set of params inside of a macro\n", paramType, err)
+ if rejectedErrors == nil {
+ rejectedErrors = rejectedError
+ } else {
+ rejectedErrors = fmt.Errorf("%w%w", rejectedErrors, rejectedError)
+ }
+ continue
+ // return nil, fmt.Errorf("")
}
return instrParam.Assembler(currentAddress, parsed_params)
diff --git a/macros.go b/macros.go
index 44b72a2..a923082 100644
--- a/macros.go
+++ b/macros.go
@@ -176,14 +176,16 @@ func MacroParse(
return fmt.Errorf("Defined variable \"%s\" is also valid hexadecimal", name)
}
+ current_address := uint32(uint(len(*result)) + offset)
+
var definedValue any
- if v, err := Raw8Indirect(&state.Labels, LastAbsoluteLabel, &state.Defs, 0xffffffff, words[2]); err == nil {
+ if v, err := Raw8Indirect(&state.Labels, LastAbsoluteLabel, &state.Defs, current_address, words[2]); err == nil {
definedValue = Indirect8b(v)
- } else if v, err := Raw16Indirect(&state.Labels, LastAbsoluteLabel, &state.Defs, 0xffffffff, words[2]); err == nil {
+ } else if v, err := Raw16Indirect(&state.Labels, LastAbsoluteLabel, &state.Defs, current_address, words[2]); err == nil {
definedValue = Indirect16b(v)
- } else if v, err := Raw8(&state.Labels, LastAbsoluteLabel, &state.Defs, 0xffffffff, words[2]); err == nil {
+ } else if v, err := Raw8(&state.Labels, LastAbsoluteLabel, &state.Defs, current_address, words[2]); err == nil {
definedValue = Raw8b(v)
- } else if v, err := Raw16(&state.Labels, LastAbsoluteLabel, &state.Defs, 0xffffffff, words[2]); err == nil {
+ } else if v, err := Raw16(&state.Labels, LastAbsoluteLabel, &state.Defs, current_address, words[2]); err == nil {
definedValue = Raw16b(v)
} else {
return fmt.Errorf("\"%s\" could not be parsed as a .DEFINE argument", words[2])