shithub: pokecrystal

Download patch

ref: 6c20ff9e200499f7c245653a9e5aa269649c8639
parent: bdd3a55333d0acd1d764327dcebb4a14d9586f05
author: Remy Oukaour <remy.oukaour@gmail.com>
date: Sun Jan 7 08:11:29 EST 2018

Reorganize some macros
* tileset data macros go atop their related files, like all the ones in data/
* charmaps are not macros

--- /dev/null
+++ b/charmap.asm
@@ -1,0 +1,372 @@
+; Control characters
+	charmap "<START>",   $00
+	charmap "<PLAY_G>",  $14 ; gendered PlayerName; same as "<PLAYER>" in English
+	charmap "<DAY>",     $15
+	charmap "¯",         $1f ; soft linebreak
+	charmap "<LNBRK>",   $22
+	charmap "<KOUGEKI>", $23 ; "こうげき"
+	charmap "<POKE>",    $24 ; "<PO><KE>"
+	charmap "%",         $25
+	charmap "<RED>",     $38 ; RedsName
+	charmap "<GREEN>",   $39 ; GreensName
+	charmap "<ENEMY>",   $3f
+	charmap "<MOM>",     $49 ; MomsName
+	charmap "<PKMN>",    $4a ; "<PK><MN>"
+	charmap "<NEXT>",    $4e
+	charmap "<LINE>",    $4f
+
+	charmap "@",         $50 ; string terminator
+	charmap "<PARA>",    $51
+	charmap "<PLAYER>",  $52 ; PlayerName
+	charmap "<RIVAL>",   $53
+	charmap "#",         $54 ; "POKé"
+	charmap "<CONT>",    $55
+	charmap "<......>",  $56 ; "……"
+	charmap "<DONE>",    $57
+	charmap "<PROMPT>",  $58
+	charmap "<TARGET>",  $59
+	charmap "<USER>",    $5a
+	charmap "<PC>",      $5b ; "PC"
+	charmap "<TM>",      $5c ; "TM"
+	charmap "<TRNER>",   $5d ; "TRAINER"
+	charmap "<ROCKET>",  $5e ; "ROCKET"
+	charmap "<DEXEND>",  $5f
+
+; Actual characters (from gfx/font/font_extra.png)
+
+	charmap "<BOLD_A>",  $60 ; unused
+	charmap "<BOLD_B>",  $61 ; unused
+	charmap "<BOLD_C>",  $62 ; unused
+	charmap "<BOLD_D>",  $63 ; unused
+	charmap "<BOLD_E>",  $64 ; unused
+	charmap "<BOLD_F>",  $65 ; unused
+	charmap "<BOLD_G>",  $66 ; unused
+	charmap "<BOLD_H>",  $67 ; unused
+	charmap "<BOLD_I>",  $68 ; unused
+	charmap "<BOLD_V>",  $69
+	charmap "<BOLD_S>",  $6a
+	charmap "<BOLD_L>",  $6b ; unused
+	charmap "<BOLD_M>",  $6c ; unused
+	charmap "<COLON>",   $6d ; colon with tinier dots than ":"
+	charmap "ぃ",         $6e ; hiragana small i, unused
+	charmap "ぅ",         $6f ; hiragana small u, unused
+	charmap "<PO>",      $70
+	charmap "<KE>",      $71
+	charmap "<``>",      $72 ; opening quote
+	charmap "<''>",      $73 ; closing quote
+	charmap "·",         $74 ; middle dot, unused
+	charmap "…",         $75 ; ellipsis
+	charmap "ぁ",         $76 ; hiragana small a, unused
+	charmap "ぇ",         $77 ; hiragana small e, unused
+	charmap "ぉ",         $78 ; hiragana small o, unused
+
+	charmap "┌",         $79
+	charmap "─",         $7a
+	charmap "┐",         $7b
+	charmap "│",         $7c
+	charmap "└",         $7d
+	charmap "┘",         $7e
+	charmap " ",         $7f
+
+; Actual characters (from gfx/font/font_battle_extra.png)
+
+	charmap "<LV>",      $6e
+
+	charmap "<ど>",       $70 ; hiragana small do, unused
+	charmap "◀",         $71
+	charmap "『",         $72 ; Japanese opening quote, unused
+	charmap "<ID>",      $73
+	charmap "№",         $74
+
+; Actual characters (from other graphics files)
+
+	charmap "|",         $31 ; from gfx/stats/stats_tiles
+
+	charmap "<SHINY>",   $3f ; gfx/stats/shiny
+
+	charmap "<BLACK>",   $60 ; from gfx/mobile/phone_tiles.2bpp
+	charmap "▲",         $61 ; gfx/font/up_arrow.png
+	charmap "<PHONE>",   $62 ; gfx/font/overworld_phone_icon.2bpp
+	charmap "_",         $62 ; from gfx/battle/hp_exp_bar_border.1bpp
+
+	charmap "′",         $6e ; gfx/font/feet_inches.png
+	charmap "″",         $6f ; gfx/font/feet_inches.png
+
+; Actual characters (from gfx/font/font.png)
+
+	charmap "A",         $80
+	charmap "B",         $81
+	charmap "C",         $82
+	charmap "D",         $83
+	charmap "E",         $84
+	charmap "F",         $85
+	charmap "G",         $86
+	charmap "H",         $87
+	charmap "I",         $88
+	charmap "J",         $89
+	charmap "K",         $8a
+	charmap "L",         $8b
+	charmap "M",         $8c
+	charmap "N",         $8d
+	charmap "O",         $8e
+	charmap "P",         $8f
+	charmap "Q",         $90
+	charmap "R",         $91
+	charmap "S",         $92
+	charmap "T",         $93
+	charmap "U",         $94
+	charmap "V",         $95
+	charmap "W",         $96
+	charmap "X",         $97
+	charmap "Y",         $98
+	charmap "Z",         $99
+
+	charmap "(",         $9a
+	charmap ")",         $9b
+	charmap ":",         $9c
+	charmap ";",         $9d
+	charmap "[",         $9e
+	charmap "]",         $9f
+
+	charmap "a",         $a0
+	charmap "b",         $a1
+	charmap "c",         $a2
+	charmap "d",         $a3
+	charmap "e",         $a4
+	charmap "f",         $a5
+	charmap "g",         $a6
+	charmap "h",         $a7
+	charmap "i",         $a8
+	charmap "j",         $a9
+	charmap "k",         $aa
+	charmap "l",         $ab
+	charmap "m",         $ac
+	charmap "n",         $ad
+	charmap "o",         $ae
+	charmap "p",         $af
+	charmap "q",         $b0
+	charmap "r",         $b1
+	charmap "s",         $b2
+	charmap "t",         $b3
+	charmap "u",         $b4
+	charmap "v",         $b5
+	charmap "w",         $b6
+	charmap "x",         $b7
+	charmap "y",         $b8
+	charmap "z",         $b9
+
+	charmap "Ä",         $c0
+	charmap "Ö",         $c1
+	charmap "Ü",         $c2
+	charmap "ä",         $c3
+	charmap "ö",         $c4
+	charmap "ü",         $c5
+
+	charmap "'d",        $d0
+	charmap "'l",        $d1
+	charmap "'m",        $d2
+	charmap "'r",        $d3
+	charmap "'s",        $d4
+	charmap "'t",        $d5
+	charmap "'v",        $d6
+
+	charmap "←",         $df
+	charmap "'",         $e0
+	charmap "<PK>",      $e1
+	charmap "<MN>",      $e2
+	charmap "-",         $e3
+
+	charmap "?",         $e6
+	charmap "!",         $e7
+	charmap ".",         $e8
+	charmap "&",         $e9
+
+	charmap "é",         $ea
+	charmap "→",         $eb
+	charmap "▷",         $ec
+	charmap "▶",         $ed
+	charmap "▼",         $ee
+	charmap "♂",         $ef
+	charmap "¥",         $f0
+	charmap "×",         $f1
+	charmap "<DOT>",     $f2 ; same as "." in English
+	charmap "/",         $f3
+	charmap ",",         $f4
+	charmap "♀",         $f5
+
+	charmap "0",         $f6
+	charmap "1",         $f7
+	charmap "2",         $f8
+	charmap "3",         $f9
+	charmap "4",         $fa
+	charmap "5",         $fb
+	charmap "6",         $fc
+	charmap "7",         $fd
+	charmap "8",         $fe
+	charmap "9",         $ff
+
+; Japanese kana, for those bits of text that were not translated to English
+
+	charmap "ガ", $5
+	charmap "ギ", $6
+	charmap "グ", $7
+	charmap "ゲ", $8
+	charmap "ゴ", $9
+	charmap "ザ", $a
+	charmap "ジ", $b
+	charmap "ズ", $c
+	charmap "ゼ", $d
+	charmap "ゾ", $e
+	charmap "ダ", $f
+	charmap "ヂ", $10
+	charmap "ヅ", $11
+	charmap "デ", $12
+	charmap "ド", $13
+
+	charmap "バ", $19
+	charmap "ビ", $1a
+	charmap "ブ", $1b
+	charmap "ボ", $1c
+;	charmap "ベ", $1d
+
+	charmap "が", $26
+	charmap "ぎ", $27
+	charmap "ぐ", $28
+	charmap "げ", $29
+	charmap "ご", $2a
+	charmap "ざ", $2b
+	charmap "じ", $2c
+	charmap "ず", $2d
+	charmap "ぜ", $2e
+	charmap "ぞ", $2f
+	charmap "だ", $30
+	charmap "ぢ", $31
+	charmap "づ", $32
+	charmap "で", $33
+	charmap "ど", $34
+
+	charmap "ば", $3a
+	charmap "び", $3b
+	charmap "ぶ", $3c
+	charmap "べ", $3d
+	charmap "ぼ", $3e
+
+	charmap "パ", $40
+	charmap "ピ", $41
+	charmap "プ", $42
+	charmap "ポ", $43
+	charmap "ぱ", $44
+	charmap "ぴ", $45
+	charmap "ぷ", $46
+	charmap "ぺ", $47
+	charmap "ぽ", $48
+
+	charmap "ア", $80
+	charmap "イ", $81
+	charmap "ウ", $82
+	charmap "エ", $83
+	charmap "ォ", $84
+	charmap "カ", $85
+	charmap "キ", $86
+	charmap "ク", $87
+	charmap "ケ", $88
+	charmap "コ", $89
+	charmap "サ", $8a
+	charmap "シ", $8b
+	charmap "ス", $8c
+	charmap "セ", $8d
+	charmap "ソ", $8e
+	charmap "タ", $8f
+	charmap "チ", $90
+	charmap "ツ", $91
+	charmap "テ", $92
+	charmap "ト", $93
+	charmap "ナ", $94
+	charmap "ニ", $95
+	charmap "ヌ", $96
+	charmap "ネ", $97
+	charmap "ノ", $98
+	charmap "ハ", $99
+	charmap "ヒ", $9a
+	charmap "フ", $9b
+	charmap "ホ", $9c
+	charmap "マ", $9d
+	charmap "ミ", $9e
+	charmap "ム", $9f
+	charmap "メ", $a0
+	charmap "モ", $a1
+	charmap "ヤ", $a2
+	charmap "ユ", $a3
+	charmap "ヨ", $a4
+	charmap "ラ", $a5
+	charmap "ル", $a6
+	charmap "レ", $a7
+	charmap "ロ", $a8
+	charmap "ワ", $a9
+	charmap "ヲ", $aa
+	charmap "ン", $ab
+	charmap "ッ", $ac
+	charmap "ャ", $ad
+	charmap "ュ", $ae
+	charmap "ョ", $af
+	charmap "ィ", $b0
+
+	charmap "あ", $b1
+	charmap "い", $b2
+	charmap "う", $b3
+	charmap "え", $b4
+	charmap "お", $b5
+
+	charmap "か", $b6
+	charmap "き", $b7
+	charmap "く", $b8
+	charmap "け", $b9
+	charmap "こ", $ba
+	charmap "さ", $bb
+	charmap "し", $bc
+	charmap "す", $bd
+	charmap "せ", $be
+	charmap "そ", $bf
+	charmap "た", $c0
+	charmap "ち", $c1
+	charmap "つ", $c2
+	charmap "て", $c3
+	charmap "と", $c4
+	charmap "な", $c5
+	charmap "に", $c6
+	charmap "ぬ", $c7
+	charmap "ね", $c8
+	charmap "の", $c9
+	charmap "は", $ca
+	charmap "ひ", $cb
+	charmap "ふ", $cc
+	charmap "へ", $cd
+	charmap "ほ", $ce
+
+	charmap "ま", $cf
+	charmap "み", $d0
+	charmap "む", $d1
+	charmap "め", $d2
+	charmap "も", $d3
+	charmap "や", $d4
+	charmap "ゆ", $d5
+	charmap "よ", $d6
+	charmap "ら", $d7
+	charmap "り", $d8
+	charmap "る", $d9
+	charmap "れ", $da
+	charmap "ろ", $db
+	charmap "わ", $dc
+	charmap "を", $dd
+	charmap "ん", $de
+	charmap "っ", $df
+	charmap "ゃ", $e0
+	charmap "ゅ", $e1
+	charmap "ょ", $e2
+
+	charmap "ー", $e3
+
+	charmap "゚", $e4
+	charmap "゙", $e5
+
+	charmap "ァ", $e9
--- a/constants.asm
+++ b/constants.asm
@@ -1,3 +1,5 @@
+INCLUDE "charmap.asm"
+
 INCLUDE "macros.asm"
 
 INCLUDE "hram.asm"
--- a/macros.asm
+++ b/macros.asm
@@ -1,5 +1,4 @@
 INCLUDE "macros/enum.asm"
-INCLUDE "macros/charmap.asm"
 INCLUDE "macros/predef.asm"
 INCLUDE "macros/rst.asm"
 INCLUDE "macros/data.asm"
@@ -6,8 +5,7 @@
 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"
--- a/macros/base_stats.asm
+++ /dev/null
@@ -1,67 +1,0 @@
-; Used in data/pokemon/base_stats/*.asm
-
-define: MACRO
-if !DEF(\1)
-\1 EQUS \2
-endc
-ENDM
-
-const_value = 0
-
-add_tm: MACRO
-if !DEF(TM01)
-TM01 = const_value
-	enum_start 1
-endc
-	define _\@_1, "TM_\1"
-	const _\@_1
-	enum \1_TMNUM
-ENDM
-
-add_hm: MACRO
-if !DEF(HM01)
-HM01 = const_value
-endc
-	define _\@_1, "HM_\1"
-	const _\@_1
-	enum \1_TMNUM
-ENDM
-
-add_mt: MACRO
-	enum \1_TMNUM
-ENDM
-
-; 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
-tms1 = 0
-tms2 = 0
-tms3 = 0
-rept _NARG
-	if DEF(\1_TMNUM)
-	if \1_TMNUM < 24 + 1
-tms1 = tms1 | (1 << ((\1_TMNUM) - 1))
-	elif \1_TMNUM < 48 + 1
-tms2 = tms2 | (1 << ((\1_TMNUM) - 1 - 24))
-	else
-tms3 = tms3 | (1 << ((\1_TMNUM) - 1 - 48))
-	endc
-	else
-		fail "\1 is not a TM, HM, or move tutor move"
-	endc
-	shift
-endr
-
-rept 3
-	db tms1 & $ff
-tms1 = tms1 >> 8
-endr
-rept 3
-	db tms2 & $ff
-tms2 = tms2 >> 8
-endr
-rept 2
-	db tms3 & $ff
-tms3 = tms3 >> 8
-endr
-ENDM
--- a/macros/charmap.asm
+++ /dev/null
@@ -1,372 +1,0 @@
-; Control characters
-	charmap "<START>",   $00
-	charmap "<PLAY_G>",  $14 ; gendered PlayerName; same as "<PLAYER>" in English
-	charmap "<DAY>",     $15
-	charmap "¯",         $1f ; soft linebreak
-	charmap "<LNBRK>",   $22
-	charmap "<KOUGEKI>", $23 ; "こうげき"
-	charmap "<POKE>",    $24 ; "<PO><KE>"
-	charmap "%",         $25
-	charmap "<RED>",     $38 ; RedsName
-	charmap "<GREEN>",   $39 ; GreensName
-	charmap "<ENEMY>",   $3f
-	charmap "<MOM>",     $49 ; MomsName
-	charmap "<PKMN>",    $4a ; "<PK><MN>"
-	charmap "<NEXT>",    $4e
-	charmap "<LINE>",    $4f
-
-	charmap "@",         $50 ; string terminator
-	charmap "<PARA>",    $51
-	charmap "<PLAYER>",  $52 ; PlayerName
-	charmap "<RIVAL>",   $53
-	charmap "#",         $54 ; "POKé"
-	charmap "<CONT>",    $55
-	charmap "<......>",  $56 ; "……"
-	charmap "<DONE>",    $57
-	charmap "<PROMPT>",  $58
-	charmap "<TARGET>",  $59
-	charmap "<USER>",    $5a
-	charmap "<PC>",      $5b ; "PC"
-	charmap "<TM>",      $5c ; "TM"
-	charmap "<TRNER>",   $5d ; "TRAINER"
-	charmap "<ROCKET>",  $5e ; "ROCKET"
-	charmap "<DEXEND>",  $5f
-
-; Actual characters (from gfx/font/font_extra.png)
-
-	charmap "<BOLD_A>",  $60 ; unused
-	charmap "<BOLD_B>",  $61 ; unused
-	charmap "<BOLD_C>",  $62 ; unused
-	charmap "<BOLD_D>",  $63 ; unused
-	charmap "<BOLD_E>",  $64 ; unused
-	charmap "<BOLD_F>",  $65 ; unused
-	charmap "<BOLD_G>",  $66 ; unused
-	charmap "<BOLD_H>",  $67 ; unused
-	charmap "<BOLD_I>",  $68 ; unused
-	charmap "<BOLD_V>",  $69
-	charmap "<BOLD_S>",  $6a
-	charmap "<BOLD_L>",  $6b ; unused
-	charmap "<BOLD_M>",  $6c ; unused
-	charmap "<COLON>",   $6d ; colon with tinier dots than ":"
-	charmap "ぃ",         $6e ; hiragana small i, unused
-	charmap "ぅ",         $6f ; hiragana small u, unused
-	charmap "<PO>",      $70
-	charmap "<KE>",      $71
-	charmap "<``>",      $72 ; opening quote
-	charmap "<''>",      $73 ; closing quote
-	charmap "·",         $74 ; middle dot, unused
-	charmap "…",         $75 ; ellipsis
-	charmap "ぁ",         $76 ; hiragana small a, unused
-	charmap "ぇ",         $77 ; hiragana small e, unused
-	charmap "ぉ",         $78 ; hiragana small o, unused
-
-	charmap "┌",         $79
-	charmap "─",         $7a
-	charmap "┐",         $7b
-	charmap "│",         $7c
-	charmap "└",         $7d
-	charmap "┘",         $7e
-	charmap " ",         $7f
-
-; Actual characters (from gfx/font/font_battle_extra.png)
-
-	charmap "<LV>",      $6e
-
-	charmap "<ど>",       $70 ; hiragana small do, unused
-	charmap "◀",         $71
-	charmap "『",         $72 ; Japanese opening quote, unused
-	charmap "<ID>",      $73
-	charmap "№",         $74
-
-; Actual characters (from other graphics files)
-
-	charmap "|",         $31 ; from gfx/stats/stats_tiles
-
-	charmap "<SHINY>",   $3f ; gfx/stats/shiny
-
-	charmap "<BLACK>",   $60 ; from gfx/mobile/phone_tiles.2bpp
-	charmap "▲",         $61 ; gfx/font/up_arrow.png
-	charmap "<PHONE>",   $62 ; gfx/font/overworld_phone_icon.2bpp
-	charmap "_",         $62 ; from gfx/battle/hp_exp_bar_border.1bpp
-
-	charmap "′",         $6e ; gfx/font/feet_inches.png
-	charmap "″",         $6f ; gfx/font/feet_inches.png
-
-; Actual characters (from gfx/font/font.png)
-
-	charmap "A",         $80
-	charmap "B",         $81
-	charmap "C",         $82
-	charmap "D",         $83
-	charmap "E",         $84
-	charmap "F",         $85
-	charmap "G",         $86
-	charmap "H",         $87
-	charmap "I",         $88
-	charmap "J",         $89
-	charmap "K",         $8a
-	charmap "L",         $8b
-	charmap "M",         $8c
-	charmap "N",         $8d
-	charmap "O",         $8e
-	charmap "P",         $8f
-	charmap "Q",         $90
-	charmap "R",         $91
-	charmap "S",         $92
-	charmap "T",         $93
-	charmap "U",         $94
-	charmap "V",         $95
-	charmap "W",         $96
-	charmap "X",         $97
-	charmap "Y",         $98
-	charmap "Z",         $99
-
-	charmap "(",         $9a
-	charmap ")",         $9b
-	charmap ":",         $9c
-	charmap ";",         $9d
-	charmap "[",         $9e
-	charmap "]",         $9f
-
-	charmap "a",         $a0
-	charmap "b",         $a1
-	charmap "c",         $a2
-	charmap "d",         $a3
-	charmap "e",         $a4
-	charmap "f",         $a5
-	charmap "g",         $a6
-	charmap "h",         $a7
-	charmap "i",         $a8
-	charmap "j",         $a9
-	charmap "k",         $aa
-	charmap "l",         $ab
-	charmap "m",         $ac
-	charmap "n",         $ad
-	charmap "o",         $ae
-	charmap "p",         $af
-	charmap "q",         $b0
-	charmap "r",         $b1
-	charmap "s",         $b2
-	charmap "t",         $b3
-	charmap "u",         $b4
-	charmap "v",         $b5
-	charmap "w",         $b6
-	charmap "x",         $b7
-	charmap "y",         $b8
-	charmap "z",         $b9
-
-	charmap "Ä",         $c0
-	charmap "Ö",         $c1
-	charmap "Ü",         $c2
-	charmap "ä",         $c3
-	charmap "ö",         $c4
-	charmap "ü",         $c5
-
-	charmap "'d",        $d0
-	charmap "'l",        $d1
-	charmap "'m",        $d2
-	charmap "'r",        $d3
-	charmap "'s",        $d4
-	charmap "'t",        $d5
-	charmap "'v",        $d6
-
-	charmap "←",         $df
-	charmap "'",         $e0
-	charmap "<PK>",      $e1
-	charmap "<MN>",      $e2
-	charmap "-",         $e3
-
-	charmap "?",         $e6
-	charmap "!",         $e7
-	charmap ".",         $e8
-	charmap "&",         $e9
-
-	charmap "é",         $ea
-	charmap "→",         $eb
-	charmap "▷",         $ec
-	charmap "▶",         $ed
-	charmap "▼",         $ee
-	charmap "♂",         $ef
-	charmap "¥",         $f0
-	charmap "×",         $f1
-	charmap "<DOT>",     $f2 ; same as "." in English
-	charmap "/",         $f3
-	charmap ",",         $f4
-	charmap "♀",         $f5
-
-	charmap "0",         $f6
-	charmap "1",         $f7
-	charmap "2",         $f8
-	charmap "3",         $f9
-	charmap "4",         $fa
-	charmap "5",         $fb
-	charmap "6",         $fc
-	charmap "7",         $fd
-	charmap "8",         $fe
-	charmap "9",         $ff
-
-; Japanese kana, for those bits of text that were not translated to English
-
-	charmap "ガ", $5
-	charmap "ギ", $6
-	charmap "グ", $7
-	charmap "ゲ", $8
-	charmap "ゴ", $9
-	charmap "ザ", $a
-	charmap "ジ", $b
-	charmap "ズ", $c
-	charmap "ゼ", $d
-	charmap "ゾ", $e
-	charmap "ダ", $f
-	charmap "ヂ", $10
-	charmap "ヅ", $11
-	charmap "デ", $12
-	charmap "ド", $13
-
-	charmap "バ", $19
-	charmap "ビ", $1a
-	charmap "ブ", $1b
-	charmap "ボ", $1c
-;	charmap "ベ", $1d
-
-	charmap "が", $26
-	charmap "ぎ", $27
-	charmap "ぐ", $28
-	charmap "げ", $29
-	charmap "ご", $2a
-	charmap "ざ", $2b
-	charmap "じ", $2c
-	charmap "ず", $2d
-	charmap "ぜ", $2e
-	charmap "ぞ", $2f
-	charmap "だ", $30
-	charmap "ぢ", $31
-	charmap "づ", $32
-	charmap "で", $33
-	charmap "ど", $34
-
-	charmap "ば", $3a
-	charmap "び", $3b
-	charmap "ぶ", $3c
-	charmap "べ", $3d
-	charmap "ぼ", $3e
-
-	charmap "パ", $40
-	charmap "ピ", $41
-	charmap "プ", $42
-	charmap "ポ", $43
-	charmap "ぱ", $44
-	charmap "ぴ", $45
-	charmap "ぷ", $46
-	charmap "ぺ", $47
-	charmap "ぽ", $48
-
-	charmap "ア", $80
-	charmap "イ", $81
-	charmap "ウ", $82
-	charmap "エ", $83
-	charmap "ォ", $84
-	charmap "カ", $85
-	charmap "キ", $86
-	charmap "ク", $87
-	charmap "ケ", $88
-	charmap "コ", $89
-	charmap "サ", $8a
-	charmap "シ", $8b
-	charmap "ス", $8c
-	charmap "セ", $8d
-	charmap "ソ", $8e
-	charmap "タ", $8f
-	charmap "チ", $90
-	charmap "ツ", $91
-	charmap "テ", $92
-	charmap "ト", $93
-	charmap "ナ", $94
-	charmap "ニ", $95
-	charmap "ヌ", $96
-	charmap "ネ", $97
-	charmap "ノ", $98
-	charmap "ハ", $99
-	charmap "ヒ", $9a
-	charmap "フ", $9b
-	charmap "ホ", $9c
-	charmap "マ", $9d
-	charmap "ミ", $9e
-	charmap "ム", $9f
-	charmap "メ", $a0
-	charmap "モ", $a1
-	charmap "ヤ", $a2
-	charmap "ユ", $a3
-	charmap "ヨ", $a4
-	charmap "ラ", $a5
-	charmap "ル", $a6
-	charmap "レ", $a7
-	charmap "ロ", $a8
-	charmap "ワ", $a9
-	charmap "ヲ", $aa
-	charmap "ン", $ab
-	charmap "ッ", $ac
-	charmap "ャ", $ad
-	charmap "ュ", $ae
-	charmap "ョ", $af
-	charmap "ィ", $b0
-
-	charmap "あ", $b1
-	charmap "い", $b2
-	charmap "う", $b3
-	charmap "え", $b4
-	charmap "お", $b5
-
-	charmap "か", $b6
-	charmap "き", $b7
-	charmap "く", $b8
-	charmap "け", $b9
-	charmap "こ", $ba
-	charmap "さ", $bb
-	charmap "し", $bc
-	charmap "す", $bd
-	charmap "せ", $be
-	charmap "そ", $bf
-	charmap "た", $c0
-	charmap "ち", $c1
-	charmap "つ", $c2
-	charmap "て", $c3
-	charmap "と", $c4
-	charmap "な", $c5
-	charmap "に", $c6
-	charmap "ぬ", $c7
-	charmap "ね", $c8
-	charmap "の", $c9
-	charmap "は", $ca
-	charmap "ひ", $cb
-	charmap "ふ", $cc
-	charmap "へ", $cd
-	charmap "ほ", $ce
-
-	charmap "ま", $cf
-	charmap "み", $d0
-	charmap "む", $d1
-	charmap "め", $d2
-	charmap "も", $d3
-	charmap "や", $d4
-	charmap "ゆ", $d5
-	charmap "よ", $d6
-	charmap "ら", $d7
-	charmap "り", $d8
-	charmap "る", $d9
-	charmap "れ", $da
-	charmap "ろ", $db
-	charmap "わ", $dc
-	charmap "を", $dd
-	charmap "ん", $de
-	charmap "っ", $df
-	charmap "ゃ", $e0
-	charmap "ゅ", $e1
-	charmap "ょ", $e2
-
-	charmap "ー", $e3
-
-	charmap "゚", $e4
-	charmap "゙", $e5
-
-	charmap "ァ", $e9
--- a/macros/color.asm
+++ b/macros/color.asm
@@ -1,6 +1,6 @@
 RGB: MACRO
 rept _NARG / 3
-	dw ((\3) << 10) + ((\2) << 5) + (\1)
+	dw palred (\1) + palgreen (\2) + palblue (\3)
 	shift
 	shift
 	shift
@@ -7,9 +7,9 @@
 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 *"
--- a/macros/tilesets.asm
+++ /dev/null
@@ -1,15 +1,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
--- /dev/null
+++ b/macros/tmhm.asm
@@ -1,0 +1,71 @@
+define: MACRO
+if !DEF(\1)
+\1 EQUS \2
+endc
+ENDM
+
+
+; Used in constants/item_constants.asm
+
+const_value = 0
+
+add_tm: MACRO
+if !DEF(TM01)
+TM01 = const_value
+	enum_start 1
+endc
+	define _\@_1, "TM_\1"
+	const _\@_1
+	enum \1_TMNUM
+ENDM
+
+add_hm: MACRO
+if !DEF(HM01)
+HM01 = const_value
+endc
+	define _\@_1, "HM_\1"
+	const _\@_1
+	enum \1_TMNUM
+ENDM
+
+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
+tms1 = 0
+tms2 = 0
+tms3 = 0
+rept _NARG
+	if DEF(\1_TMNUM)
+	if \1_TMNUM < 24 + 1
+tms1 = tms1 | (1 << ((\1_TMNUM) - 1))
+	elif \1_TMNUM < 48 + 1
+tms2 = tms2 | (1 << ((\1_TMNUM) - 1 - 24))
+	else
+tms3 = tms3 | (1 << ((\1_TMNUM) - 1 - 48))
+	endc
+	else
+		fail "\1 is not a TM, HM, or move tutor move"
+	endc
+	shift
+endr
+
+rept 3
+	db tms1 & $ff
+tms1 = tms1 >> 8
+endr
+rept 3
+	db tms2 & $ff
+tms2 = tms2 >> 8
+endr
+rept 2
+	db tms3 & $ff
+tms3 = tms3 >> 8
+endr
+ENDM
--- 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
--- 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