diff options
author | camthesaxman <cameronghall@cox.net> | 2017-09-26 14:09:41 -0500 |
---|---|---|
committer | camthesaxman <cameronghall@cox.net> | 2017-09-26 14:09:41 -0500 |
commit | 9458b3fad18eea3fbd9168a88dd33e8aa10abcda (patch) | |
tree | 62ed1ef9bd55dd482ed888793233f36d10a43294 /asm/macros | |
parent | 598756eaa47b523bd557a619e05cb23399ac02e5 (diff) |
single compare macro
Diffstat (limited to 'asm/macros')
-rw-r--r-- | asm/macros/event.inc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/asm/macros/event.inc b/asm/macros/event.inc index c29d886ec..d2164c72f 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -226,6 +226,21 @@ .2byte \var2 .endm + @ Generic compare macro which attempts to deduce argument types based on their values + @ Any negative values are considered local variable indentifiers + @ Any values between 0x4000 to 0x4FFF and 0x8000 to 0x8FFF are considered event variable identifiers + .macro compare arg1, arg2 + .if (\arg1 < 0) && (\arg2 >= 0 && \arg2 < 0xFF) + compare_local_to_imm -\arg1, \arg2 + .elseif ((\arg1 >> 12) == 4 || (\arg1 >> 12) == 8) && ((\arg2 >> 12) == 4 || (\arg2 >> 12) == 8) + compare_var_to_var \arg1, \arg2 + .elseif ((\arg1 >> 12) == 4 || (\arg1 >> 12) == 8) && (\arg2 >= 0 && \arg2 <= 0xFFFF) + compare_var_to_imm \arg1, \arg2 + .else + .error "Invalid arguments for 'compare'" + .endif + .endm + @ Calls the native C function stored at `func`. .macro callnative func .byte 0x23 |