aboutsummaryrefslogtreecommitdiff
path: root/macros.go
diff options
context:
space:
mode:
authorAstatin <[email protected]>2025-06-10 18:27:56 +0200
committerAstatin <[email protected]>2025-06-10 18:27:56 +0200
commit501b255423d9a08ab5d9765c3feb5bf3a6b7b0af (patch)
treec2f7573b409bf591dad3302ec6816878842d24d2 /macros.go
parenta7d6e62878245810323787eeb5458e418371b89f (diff)
Add ASSERT macro + fix label substractions banks + add . for current address
Diffstat (limited to 'macros.go')
-rw-r--r--macros.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/macros.go b/macros.go
index 2324a14..44b72a2 100644
--- a/macros.go
+++ b/macros.go
@@ -43,6 +43,31 @@ func NewInstructionSetMacros() InstructionSet {
},
}
+ result[".ASSERT"] = []InstructionParams{
+ {
+ Types: []ParamType{Raw8, Raw8},
+ Assembler: func(currentAddress uint32, args []uint32) ([]byte, error) {
+ if args[0] != args[1] {
+ return nil, fmt.Errorf("ASSERTION FAILED, %v != %v", args[0], args[1])
+ }
+ return []byte{}, nil
+ },
+ MacroForbidden: false,
+ SkipFirstPass: true,
+ },
+ {
+ Types: []ParamType{Raw16, Raw16},
+ Assembler: func(currentAddress uint32, args []uint32) ([]byte, error) {
+ if args[0] != args[1] {
+ return nil, fmt.Errorf("ASSERTION FAILED, %v != %v", args[0], args[1])
+ }
+ return []byte{}, nil
+ },
+ MacroForbidden: false,
+ SkipFirstPass: true,
+ },
+ }
+
result[".DB"] = []InstructionParams{
{
Types: []ParamType{Raw8},