diff options
author | Rangi <35663410+Rangi42@users.noreply.github.com> | 2020-07-04 16:19:15 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-04 16:19:15 -0400 |
commit | 2718c36065e7eb201a149938bcdd51987c4e56b6 (patch) | |
tree | 4a1c0294193a497e15ec8e6be59390eb1f84b5d3 /macros/enum.asm | |
parent | c85050497c1bd062e9cd40bf5b32fa3beca366cc (diff) | |
parent | 36f8cd1477b8ebe0537e99abd3ba53471a2e16c4 (diff) |
Merge pull request #257 from Rangi42/master
More reorganization
Diffstat (limited to 'macros/enum.asm')
-rw-r--r-- | macros/enum.asm | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/macros/enum.asm b/macros/enum.asm new file mode 100644 index 00000000..8fe5b534 --- /dev/null +++ b/macros/enum.asm @@ -0,0 +1,43 @@ +; Enumerate variables + +enum_start: MACRO +if _NARG >= 1 +__enum__ = \1 +else +__enum__ = 0 +endc +if _NARG >= 2 +__enumdir__ = \2 +else +__enumdir__ = 1 +endc +ENDM + +enum: MACRO +\1 EQU __enum__ +__enum__ = __enum__ + __enumdir__ +ENDM + +enum_set: MACRO +__enum__ = \1 +ENDM + +; Enumerate constants + +const_def: MACRO +if _NARG >= 1 +const_value = \1 +else +const_value = 0 +endc +ENDM + +const: MACRO +\1 EQU const_value +const_value = const_value + 1 +ENDM + +shift_const: MACRO +\1 EQU (1 << const_value) +const_value = const_value + 1 +ENDM |