ref: 3cdfac7994f501cb1d8fbcdf9c64e9ce258afe30
parent: 0ee9d7a48baed7e9388e7e377b5eab5b4f795688
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Sat Apr 4 11:19:43 EDT 2020
Move, comment, and simplify some macro definitions
--- a/constants/item_constants.asm
+++ b/constants/item_constants.asm
@@ -202,8 +202,7 @@
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 @@
if !DEF(HM01)
HM01 EQU const_value
endc
- define _\@_1, "HM_\1"
- const _\@_1
+ const HM_\1
enum \1_TMNUM
ENDM
--- a/macros/code.asm
+++ b/macros/code.asm
@@ -8,17 +8,6 @@
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
--- a/macros/coords.asm
+++ b/macros/coords.asm
@@ -49,3 +49,9 @@
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
--- a/macros/data.asm
+++ b/macros/data.asm
@@ -82,27 +82,6 @@
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
--- a/macros/enum.asm
+++ b/macros/enum.asm
@@ -41,11 +41,3 @@
\1 EQU (1 << const_value)
const_value = const_value + 1
ENDM
-
-; Enumerate strings
-
-define: MACRO
-if !DEF(\1)
-\1 EQUS \2
-endc
-ENDM
--- a/macros/gfx.asm
+++ b/macros/gfx.asm
@@ -20,3 +20,31 @@
; 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