From 501b255423d9a08ab5d9765c3feb5bf3a6b7b0af Mon Sep 17 00:00:00 2001 From: Astatin Date: Tue, 10 Jun 2025 18:27:56 +0200 Subject: Add ASSERT macro + fix label substractions banks + add . for current address --- macros.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'macros.go') 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}, -- cgit v1.2.3-70-g09d2