From 6c20ff9e200499f7c245653a9e5aa269649c8639 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Sun, 7 Jan 2018 13:11:29 -0500 Subject: [PATCH] Reorganize some macros * tileset data macros go atop their related files, like all the ones in data/ * charmaps are not macros --- macros/charmap.asm => charmap.asm | 0 constants.asm | 2 ++ macros.asm | 4 +--- macros/color.asm | 10 +++++----- macros/tilesets.asm | 15 --------------- macros/{base_stats.asm => tmhm.asm} | 8 ++++++-- tilesets/data.asm | 6 ++++++ tilesets/palette_maps.asm | 11 +++++++++++ 8 files changed, 31 insertions(+), 25 deletions(-) rename macros/charmap.asm => charmap.asm (100%) delete mode 100755 macros/tilesets.asm rename macros/{base_stats.asm => tmhm.asm} (95%) diff --git a/macros/charmap.asm b/charmap.asm similarity index 100% rename from macros/charmap.asm rename to charmap.asm diff --git a/constants.asm b/constants.asm index 7de20dfe2..4e52c9e42 100644 --- a/constants.asm +++ b/constants.asm @@ -1,3 +1,5 @@ +INCLUDE "charmap.asm" + INCLUDE "macros.asm" INCLUDE "hram.asm" diff --git a/macros.asm b/macros.asm index b6598c933..692178353 100644 --- a/macros.asm +++ b/macros.asm @@ -1,13 +1,11 @@ INCLUDE "macros/enum.asm" -INCLUDE "macros/charmap.asm" INCLUDE "macros/predef.asm" INCLUDE "macros/rst.asm" INCLUDE "macros/data.asm" INCLUDE "macros/code.asm" INCLUDE "macros/coords.asm" INCLUDE "macros/color.asm" -INCLUDE "macros/base_stats.asm" -INCLUDE "macros/tilesets.asm" +INCLUDE "macros/tmhm.asm" INCLUDE "macros/scripts/audio.asm" INCLUDE "macros/scripts/maps.asm" diff --git a/macros/color.asm b/macros/color.asm index 35d69fe6f..5ebaae218 100644 --- a/macros/color.asm +++ b/macros/color.asm @@ -1,15 +1,15 @@ RGB: MACRO rept _NARG / 3 - dw ((\3) << 10) + ((\2) << 5) + (\1) + dw palred (\1) + palgreen (\2) + palblue (\3) shift shift shift endr ENDM +palred EQUS "(1 << 0) *" +palgreen EQUS "(1 << 5) *" +palblue EQUS "(1 << 10) *" + palettes EQUS "* 8" palette EQUS "+ 8 *" - -palred EQUS "$0001 *" -palgreen EQUS "$0020 *" -palblue EQUS "$0400 *" diff --git a/macros/tilesets.asm b/macros/tilesets.asm deleted file mode 100755 index 4aeb38dc5..000000000 --- a/macros/tilesets.asm +++ /dev/null @@ -1,15 +0,0 @@ -; Used in tilesets/*.asm - -tilepal: MACRO -; vram bank, pals -x = \1 << OAM_TILE_BANK -rept (_NARG +- 1) / 2 - dn (x | PAL_BG_\3), (x | PAL_BG_\2) - shift - shift -endr -ENDM - -tilecoll: MACRO - db COLL_\1, COLL_\2, COLL_\3, COLL_\4 -ENDM diff --git a/macros/base_stats.asm b/macros/tmhm.asm similarity index 95% rename from macros/base_stats.asm rename to macros/tmhm.asm index 1a2ce8529..631b07bd9 100644 --- a/macros/base_stats.asm +++ b/macros/tmhm.asm @@ -1,11 +1,12 @@ -; Used in data/pokemon/base_stats/*.asm - define: MACRO if !DEF(\1) \1 EQUS \2 endc ENDM + +; Used in constants/item_constants.asm + const_value = 0 add_tm: MACRO @@ -31,6 +32,9 @@ add_mt: MACRO enum \1_TMNUM ENDM + +; Used in data/pokemon/base_stats/*.asm + ; N TMs/HMs need (N+7)/8 bytes for their bit flags. ; The rgbasm integers tms1, tms2, tms3 each hold 3 bytes, or 24 bits. tmhm: MACRO diff --git a/tilesets/data.asm b/tilesets/data.asm index c26b7d3d1..2df9c0949 100644 --- a/tilesets/data.asm +++ b/tilesets/data.asm @@ -1,3 +1,9 @@ +tilecoll: MACRO +; used in tilesets/*_collision.asm + db COLL_\1, COLL_\2, COLL_\3, COLL_\4 +ENDM + + SECTION "Tileset Data 1", ROMX TilesetKantoGFX: ; 0x18000 diff --git a/tilesets/palette_maps.asm b/tilesets/palette_maps.asm index 55391aeac..c893c767c 100644 --- a/tilesets/palette_maps.asm +++ b/tilesets/palette_maps.asm @@ -1,3 +1,14 @@ +tilepal: MACRO +; vram bank, pals +x = \1 << OAM_TILE_BANK +rept (_NARG +- 1) / 2 + dn (x | PAL_BG_\3), (x | PAL_BG_\2) + shift + shift +endr +ENDM + + TilesetKantoPalMap: ; 0x4c075 INCLUDE "tilesets/kanto_palette_map.asm" ; 0x4c0e5