summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2020-04-04 15:19:43 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2020-04-04 15:32:18 -0400
commit3cdfac7994f501cb1d8fbcdf9c64e9ce258afe30 (patch)
tree8cb55d6ab3931f449d7da3df729f4bd597ca0909
parent0ee9d7a48baed7e9388e7e377b5eab5b4f795688 (diff)
Move, comment, and simplify some macro definitions
-rw-r--r--constants/item_constants.asm6
-rw-r--r--macros/code.asm11
-rw-r--r--macros/coords.asm6
-rw-r--r--macros/data.asm21
-rw-r--r--macros/enum.asm8
-rw-r--r--macros/gfx.asm28
6 files changed, 36 insertions, 44 deletions
diff --git a/constants/item_constants.asm b/constants/item_constants.asm
index 06ad1dc14..98493a5a0 100644
--- a/constants/item_constants.asm
+++ b/constants/item_constants.asm
@@ -202,8 +202,7 @@ if !DEF(TM01)
TM01 EQU const_value
enum_start 1
endc
- define _\@_1, "TM_\1"
- const _\@_1
+ const TM_\1
enum \1_TMNUM
ENDM
@@ -266,8 +265,7 @@ add_hm: MACRO
if !DEF(HM01)
HM01 EQU const_value
endc
- define _\@_1, "HM_\1"
- const _\@_1
+ const HM_\1
enum \1_TMNUM
ENDM
diff --git a/macros/code.asm b/macros/code.asm
index 9429884ca..58d39aa00 100644
--- a/macros/code.asm
+++ b/macros/code.asm
@@ -8,17 +8,6 @@ ln: MACRO ; r, hi, lo
ld \1, ((\2) & $f) << 4 | ((\3) & $f)
ENDM
-ldpixel: MACRO
-if _NARG >= 5
- lb \1, \2 * 8 + \4, \3 * 8 + \5
-else
- lb \1, \2 * 8, \3 * 8
-endc
-ENDM
-
-depixel EQUS "ldpixel de,"
-bcpixel EQUS "ldpixel bc,"
-
; Design patterns
jumptable: MACRO
diff --git a/macros/coords.asm b/macros/coords.asm
index 3ea6e4154..5a87e1d3d 100644
--- a/macros/coords.asm
+++ b/macros/coords.asm
@@ -49,3 +49,9 @@ lda_coord: MACRO
ld a, [(\2) * SCREEN_WIDTH + (\1) + \3]
endc
ENDM
+
+menu_coords: MACRO
+; x1, y1, x2, y2
+ db \2, \1 ; start coords
+ db \4, \3 ; end coords
+ENDM
diff --git a/macros/data.asm b/macros/data.asm
index 009683213..e9052f6b2 100644
--- a/macros/data.asm
+++ b/macros/data.asm
@@ -82,27 +82,6 @@ dba_pic: MACRO ; dbw bank, address
dw \1
ENDM
-dbpixel: MACRO
-if _NARG >= 4
-; x tile, x pxl, y tile, y pxl
- db \1 * 8 + \3, \2 * 8 + \4
-else
-; x, y
- db \1 * 8, \2 * 8
-endc
-ENDM
-
-dsprite: MACRO
-; y tile, y pxl, x tile, x pxl, vtile offset, attributes
- db (\1 * 8) % $100 + \2, (\3 * 8) % $100 + \4, \5, \6
-ENDM
-
-menu_coords: MACRO
-; x1, y1, x2, y2
- db \2, \1 ; start coords
- db \4, \3 ; end coords
-ENDM
-
bcd: MACRO
rept _NARG
dn ((\1) % 100) / 10, (\1) % 10
diff --git a/macros/enum.asm b/macros/enum.asm
index 41d1da167..8fe5b5343 100644
--- a/macros/enum.asm
+++ b/macros/enum.asm
@@ -41,11 +41,3 @@ shift_const: MACRO
\1 EQU (1 << const_value)
const_value = const_value + 1
ENDM
-
-; Enumerate strings
-
-define: MACRO
-if !DEF(\1)
-\1 EQUS \2
-endc
-ENDM
diff --git a/macros/gfx.asm b/macros/gfx.asm
index 24c79e1f1..e9851501a 100644
--- a/macros/gfx.asm
+++ b/macros/gfx.asm
@@ -20,3 +20,31 @@ tile EQUS "+ LEN_2BPP_TILE *"
; example usage:
; INCBIN "foo.gbcpal", middle_colors
middle_colors EQUS "PAL_COLOR_SIZE, PAL_COLOR_SIZE * 2"
+
+dbpixel: MACRO
+if _NARG >= 4
+; x tile, y tile, x pixel, y pixel
+ db \1 * TILE_WIDTH + \3, \2 * TILE_WIDTH + \4
+else
+; x tile, y tile
+ db \1 * TILE_WIDTH, \2 * TILE_WIDTH
+endc
+ENDM
+
+ldpixel: MACRO
+if _NARG >= 5
+; register, x tile, y tile, x pixel, y pixel
+ lb \1, \2 * TILE_WIDTH + \4, \3 * TILE_WIDTH + \5
+else
+; register, x tile, y tile
+ lb \1, \2 * TILE_WIDTH, \3 * TILE_WIDTH
+endc
+ENDM
+
+depixel EQUS "ldpixel de,"
+bcpixel EQUS "ldpixel bc,"
+
+dsprite: MACRO
+; y tile, y pixel, x tile, x pixel, vtile offset, attributes
+ db (\1 * TILE_WIDTH) % $100 + \2, (\3 * TILE_WIDTH) % $100 + \4, \5, \6
+ENDM