summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile28
-rw-r--r--data/charmap.txt258
-rw-r--r--data/data.mk10
-rw-r--r--data/messages.txt172
-rw-r--r--gfx/gfx.mk18
-rw-r--r--include/charmap.inc246
-rw-r--r--shim.sym39
-rw-r--r--source/bank_02.asm4
-rw-r--r--source/bank_05.asm156
-rwxr-xr-xtools/charmap.py31
-rwxr-xr-xtools/dump_string.py35
-rwxr-xr-xtools/messages.py97
13 files changed, 708 insertions, 387 deletions
diff --git a/.gitignore b/.gitignore
index 1dca924..31ccee4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
/DMGAKVJ0.1
/disassembly
/build
+__pycache__
*.sav
*.gbc
*.map
diff --git a/Makefile b/Makefile
index 81977e7..7c6b74e 100644
--- a/Makefile
+++ b/Makefile
@@ -18,10 +18,6 @@ objects := $(patsubst %.asm, $(dir_build)/%.o, \
$(call rwildcard, source data, *.asm))
objects += $(dir_build)/shim.o
-gfx := $(patsubst %.png, $(dir_build)/%.bin, \
- $(call rwildcard, gfx, *.png))
-
-.PRECIOUS: $(gfx)
.SECONDEXPANSION:
.PHONY: all
@@ -32,6 +28,10 @@ all: $(name).gbc
clean:
rm -rf $(name).gbc $(name).sym $(name).map $(dir_build)
+include data/data.mk
+include gfx/gfx.mk
+.PRECIOUS: $(gfx) $(data)
+
$(name).gbc: layout.link $(objects) | $(baserom)
$(RGBLINK) $(RGBLINKFLAGS) -O $(baserom) -l $< -n $(@:.gbc=.sym) -m $(@:.gbc=.map) -o $@ $(filter-out $<, $^)
$(RGBFIX) $(RGBFIXFLAGS) -v $@
@@ -39,27 +39,11 @@ $(name).gbc: layout.link $(objects) | $(baserom)
$(dir_build)/shim.asm: shim.sym | $$(dir $$@)
tools/makeshim.py $< > $@
-$(dir_build)/%.o: $(dir_build)/%.asm | $(gfx) $$(dir $$@)
+$(dir_build)/%.o: $(dir_build)/%.asm | $(gfx) $(data) $$(dir $$@)
$(RGBASM) $(RGBASMFLAGS) -i $(dir_build)/ -i include/ -M $(@:.o=.d) -o $@ $<
-$(dir_build)/%.o: %.asm | $(gfx) $$(dir $$@)
+$(dir_build)/%.o: %.asm | $(gfx) $(data) $$(dir $$@)
$(RGBASM) $(RGBASMFLAGS) -i $(dir_build)/ -i include/ -M $(@:.o=.d) -o $@ $<
-RGBGFXFLAGS :=
-$(dir_build)/%.bin: %.png | $$(dir $$@)
- $(RGBGFX) $(RGBGFXFLAGS) -o $@ $<
-
-$(dir_build)/gfx/pikachu_walk.bin: RGBGFXFLAGS = -h
-$(dir_build)/gfx/bulbasaur_walk.bin: RGBGFXFLAGS = -h
-$(dir_build)/gfx/charmander_walk.bin: RGBGFXFLAGS = -h
-$(dir_build)/gfx/squirtle_walk.bin: RGBGFXFLAGS = -h
-$(dir_build)/gfx/clefairy_walk.bin: RGBGFXFLAGS = -h
-$(dir_build)/gfx/jigglypuff_walk.bin: RGBGFXFLAGS = -h
-$(dir_build)/gfx/misty_walk.bin: RGBGFXFLAGS = -h
-$(dir_build)/gfx/mew_walk.bin: RGBGFXFLAGS = -h
-$(dir_build)/gfx/mew_silhouette_walk.bin: RGBGFXFLAGS = -h
-$(dir_build)/gfx/psyduck_walk.bin: RGBGFXFLAGS = -h
-$(dir_build)/gfx/bill_walk.bin: RGBGFXFLAGS = -h
-
.PRECIOUS: %/
%/:
mkdir -p $@
diff --git a/data/charmap.txt b/data/charmap.txt
new file mode 100644
index 0000000..9114bc6
--- /dev/null
+++ b/data/charmap.txt
@@ -0,0 +1,258 @@
+'あ' = 0
+'い' = 1
+'う' = 2
+'え' = 3
+'お' = 4
+'か' = 5
+'き' = 6
+'く' = 7
+'け' = 8
+'こ' = 9
+'さ' = 10
+'し' = 11
+'す' = 12
+'せ' = 13
+'そ' = 14
+'た' = 15
+'ち' = 16
+'つ' = 17
+'て' = 18
+'と' = 19
+'な' = 20
+'に' = 21
+'ぬ' = 22
+'ね' = 23
+'の' = 24
+'は' = 25
+'ひ' = 26
+'ふ' = 27
+'へ' = 28
+'ほ' = 29
+'ま' = 30
+'み' = 31
+'む' = 32
+'め' = 33
+'も' = 34
+'や' = 35
+'ゆ' = 36
+'よ' = 37
+'ら' = 38
+'り' = 39
+'る' = 40
+'れ' = 41
+'ろ' = 42
+'わ' = 43
+'を' = 44
+'ん' = 45
+'っ' = 46
+'ゃ' = 47
+'ゅ' = 48
+'ょ' = 49
+'が' = 50
+'ぎ' = 51
+'ぐ' = 52
+'げ' = 53
+'ご' = 54
+'ざ' = 55
+'じ' = 56
+'ず' = 57
+'ぜ' = 58
+'ぞ' = 59
+'だ' = 60
+'ぢ' = 61
+'づ' = 62
+'で' = 63
+'ど' = 64
+'ば' = 65
+'び' = 66
+'ぶ' = 67
+'べ' = 68
+'ぼ' = 69
+'ぱ' = 70
+'ぴ' = 71
+'ぷ' = 72
+'ぺ' = 73
+'ぽ' = 74
+'ぁ' = 75
+'ぃ' = 76
+'ぅ' = 77
+'ぇ' = 78
+'ぉ' = 79
+'ア' = 80
+'イ' = 81
+'ウ' = 82
+'エ' = 83
+'オ' = 84
+'カ' = 85
+'キ' = 86
+'ク' = 87
+'ケ' = 88
+'コ' = 89
+'サ' = 90
+'シ' = 91
+'ス' = 92
+'セ' = 93
+'ソ' = 94
+'タ' = 95
+'チ' = 96
+'ツ' = 97
+'テ' = 98
+'ト' = 99
+'ナ' = 100
+'ニ' = 101
+'ヌ' = 102
+'ネ' = 103
+'ノ' = 104
+'ハ' = 105
+'ヒ' = 106
+'フ' = 107
+'ヘ' = 108
+'ホ' = 109
+'マ' = 110
+'ミ' = 111
+'ム' = 112
+'メ' = 113
+'モ' = 114
+'ヤ' = 115
+'ユ' = 116
+'ヨ' = 117
+'ラ' = 118
+'リ' = 119
+'ル' = 120
+'レ' = 121
+'ロ' = 122
+'ワ' = 123
+'ヲ' = 124
+'ン' = 125
+'ッ' = 126
+'ャ' = 127
+'ュ' = 128
+'ョ' = 129
+'ガ' = 130
+'ギ' = 131
+'グ' = 132
+'ゲ' = 133
+'ゴ' = 134
+'ザ' = 135
+'ジ' = 136
+'ズ' = 137
+'ゼ' = 138
+'ゾ' = 139
+'ダ' = 140
+'ヂ' = 141
+'ヅ' = 142
+'デ' = 143
+'ド' = 144
+'バ' = 145
+'ビ' = 146
+'ブ' = 147
+'ベ' = 148
+'ボ' = 149
+'パ' = 150
+'ピ' = 151
+'プ' = 152
+'ペ' = 153
+'ポ' = 154
+'ァ' = 155
+'ィ' = 156
+'ゥ' = 157
+'ェ' = 158
+'ォ' = 159
+'0' = 160
+'1' = 161
+'2' = 162
+'3' = 163
+'4' = 164
+'5' = 165
+'6' = 166
+'7' = 167
+'8' = 168
+'9' = 169
+'ー' = 170
+'0' = 160
+'1' = 161
+'2' = 162
+'3' = 163
+'4' = 164
+'5' = 165
+'6' = 166
+'7' = 167
+'8' = 168
+'9' = 169
+'-' = 170
+'A' = 171
+'B' = 172
+'C' = 173
+'D' = 174
+'E' = 175
+'F' = 176
+'G' = 177
+'H' = 178
+'I' = 179
+'J' = 180
+'K' = 181
+'L' = 182
+'M' = 183
+'N' = 184
+'O' = 185
+'P' = 186
+'Q' = 187
+'R' = 188
+'S' = 189
+'T' = 190
+'U' = 191
+'V' = 192
+'W' = 193
+'X' = 194
+'Y' = 195
+'Z' = 196
+'a' = 197
+'b' = 198
+'c' = 199
+'d' = 200
+'e' = 201
+'f' = 202
+'g' = 203
+'h' = 204
+'i' = 205
+'j' = 206
+'k' = 207
+'l' = 208
+'m' = 209
+'n' = 210
+'o' = 211
+'p' = 212
+'q' = 213
+'r' = 214
+'s' = 215
+'t' = 216
+'u' = 217
+'v' = 218
+'w' = 219
+'x' = 220
+'y' = 221
+'z' = 222
+' ' = 223 # full-width space
+' ' = 223 # regular space
+'、' = 224
+'。' = 225
+'『' = 226
+'』' = 227
+'×' = 228
+'“' = 229
+'”' = 230
+'!' = 231
+'?' = 232
+':' = 233
+';' = 234
+',' = 235
+'.' = 236
+'·' = 237
+'(' = 238
+')' = 239
+'~' = 240
+'♂' = 241
+'♀' = 242
+
+TX_LF = -2 # Line feed
+TX_END = -1 # End of message
diff --git a/data/data.mk b/data/data.mk
new file mode 100644
index 0000000..a756981
--- /dev/null
+++ b/data/data.mk
@@ -0,0 +1,10 @@
+data :=
+
+data += $(dir_build)/charmap.inc
+$(dir_build)/charmap.inc: data/charmap.txt
+ ./tools/charmap.py $< > $@
+
+data += $(dir_build)/data/messages.asm
+objects += $(dir_build)/data/messages.o
+$(dir_build)/data/messages.asm: data/charmap.txt data/messages.txt | $$(dir $$@)
+ ./tools/messages.py $^ > $@
diff --git a/data/messages.txt b/data/messages.txt
new file mode 100644
index 0000000..643d1da
--- /dev/null
+++ b/data/messages.txt
@@ -0,0 +1,172 @@
+.org 02:6880
+
+[tutorial_message_00]
+それじゃ さっそく
+『ポケモンピクロス』の
+あそびかたを おしえてやろう
+
+[tutorial_message_01]
+うえにある すうじ と
+
+[tutorial_message_02]
+{TX_LF}ひだりにある すうじ を
+
+[tutorial_message_03]
+ ヒント
+にして フィールドにあるマスを
+けずっていくんじゃ{TX_END}
+
+[tutorial_message_04]
+ただしくけずることが できたら{TX_LF}
+
+[tutorial_message_05]
+ポケモンの ちょうこくが
+かんせいするんじゃ!!!
+(“モンスターボ-ル”)
+
+[tutorial_message_06]
+では 『ポケモンピクロス』の
+ルールを せつめいするぞ
+
+[tutorial_message_07]
+うえにある すうじの れつ は
+
+[tutorial_message_08]
+{TX_LF}フィールドを たてに けずる
+かずを あらわしておるんじゃ
+
+[tutorial_message_09]
+たとえば この『5』は 
+
+[tutorial_message_10]
+{TX_LF}たてに れんぞくして 5マス
+けずることを あらわして
+おるんじゃ
+
+[tutorial_message_11]
+ひだりにある すうじのれつ は
+
+[tutorial_message_12]
+{TX_LF}フィールドを よこに けずる
+かずを あらわしておる
+
+[tutorial_message_13]
+たとえば この『3』と『1』は
+
+[tutorial_message_14]
+{TX_LF}ひだりから3マスけずり さらに 
+はなれた ところを1マスけずる
+ことを あらわして おるぞ!
+
+[tutorial_message_15]
+しかし もんだいには
+せいげんじかんが あるので
+それまでに とけなければ
+
+[tutorial_message_16]
+{TX_LF}ポケモンはにげてしまう
+
+[tutorial_message_17]
+じゃが あせってまちがったマスを
+けずってしまうと
+
+[tutorial_message_18]
+{TX_LF}のこりじかんが へってしまうから
+いそいでばかりでもいかんぞ
+
+[tutorial_message_19]
+けずってはいけないマスが
+わかったら『×』のしるしを
+つけておくと わかりやすくて
+べんりじゃ!
+
+[tutorial_message_20]
+『ヒントをつかう?』で はい
+を せんたくすると ヒントの
+ルーレットが まわるから
+
+[tutorial_message_21]
+タイミングよく Aボタンを
+おすんじゃ!
+さいしょは うえのカーソル
+
+[message_02_6d56]
+{TX_LF}さいしょは うえのカーソル
+
+[tutorial_message_22]
+{TX_LF}つぎに ひだりのカーソル
+
+[tutorial_message_23]
+すると とまったところの
+たてとよこのマスの
+こたえが すべてわかるのじゃ!
+
+[tutorial_message_24]
+はしでルーレットをとめると
+そのもんだいは
+ときやすくなるぞ!
+
+[tutorial_message_25]
+あと もんだいを
+といているときに
+
+[tutorial_message_26]
+{TX_LF}SELECTボタンをおすと
+
+[tutorial_message_27]
+SELECTボタンを おしている
+あいだだけ このように
+どんなもんだいを といているか
+わかりやすくなるぞ!
+
+[tutorial_message_28]
+ためしてみるといい
+
+[tutorial_message_29]
+おっと! いかん いかん
+『はやとき』を せつめいするの
+をわすれておった!
+
+[tutorial_message_30]
+『はやとき』とは
+もんだいに きめられている
+はやときの じかんないに
+もんだいを とくことじゃ!
+
+[tutorial_message_31]
+まだ 『はやとき』が できるか
+どうかは のこりタイムをみれば
+わかるぞ!
+
+[tutorial_message_32]
+『はやとき』の じかんない
+であれば このようにしろく
+ひょうじされるが
+
+[tutorial_message_33]
+『はやとき』の じかんが
+すぎてしまった ばあいは
+このように くろく
+ひょうじされるのじゃ!
+
+[tutorial_message_34]
+なお 『はやとき』の じかんは
+はやときタイムとして
+
+[tutorial_message_35]
+とくもんだいを えらんだあとに
+がめんの ちゅうおうに
+ひょうじされるぞ!
+
+[tutorial_message_36]
+むりして もんだいを はやくとく
+ひつようはないが
+
+[tutorial_message_37]
+すべてのポケモンの ちょうこくを
+かんせい させるためには
+あるていど もんだいを はやく
+とくことも ひつようなのじゃ!
+
+[tutorial_message_38]
+では がんばるのじゃ!
diff --git a/gfx/gfx.mk b/gfx/gfx.mk
new file mode 100644
index 0000000..baaea6e
--- /dev/null
+++ b/gfx/gfx.mk
@@ -0,0 +1,18 @@
+gfx := $(patsubst %.png, $(dir_build)/%.bin, \
+ $(call rwildcard, gfx, *.png))
+
+RGBGFXFLAGS :=
+$(dir_build)/%.bin: %.png | $$(dir $$@)
+ $(RGBGFX) $(RGBGFXFLAGS) -o $@ $<
+
+$(dir_build)/gfx/pikachu_walk.bin: RGBGFXFLAGS = -h
+$(dir_build)/gfx/bulbasaur_walk.bin: RGBGFXFLAGS = -h
+$(dir_build)/gfx/charmander_walk.bin: RGBGFXFLAGS = -h
+$(dir_build)/gfx/squirtle_walk.bin: RGBGFXFLAGS = -h
+$(dir_build)/gfx/clefairy_walk.bin: RGBGFXFLAGS = -h
+$(dir_build)/gfx/jigglypuff_walk.bin: RGBGFXFLAGS = -h
+$(dir_build)/gfx/misty_walk.bin: RGBGFXFLAGS = -h
+$(dir_build)/gfx/mew_walk.bin: RGBGFXFLAGS = -h
+$(dir_build)/gfx/mew_silhouette_walk.bin: RGBGFXFLAGS = -h
+$(dir_build)/gfx/psyduck_walk.bin: RGBGFXFLAGS = -h
+$(dir_build)/gfx/bill_walk.bin: RGBGFXFLAGS = -h
diff --git a/include/charmap.inc b/include/charmap.inc
deleted file mode 100644
index f955952..0000000
--- a/include/charmap.inc
+++ /dev/null
@@ -1,246 +0,0 @@
-charmap "あ", 0
-charmap "い", 1
-charmap "う", 2
-charmap "え", 3
-charmap "お", 4
-charmap "か", 5
-charmap "き", 6
-charmap "く", 7
-charmap "け", 8
-charmap "こ", 9
-charmap "さ", 10
-charmap "し", 11
-charmap "す", 12
-charmap "せ", 13
-charmap "そ", 14
-charmap "た", 15
-charmap "ち", 16
-charmap "つ", 17
-charmap "て", 18
-charmap "と", 19
-charmap "な", 20
-charmap "に", 21
-charmap "ぬ", 22
-charmap "ね", 23
-charmap "の", 24
-charmap "は", 25
-charmap "ひ", 26
-charmap "ふ", 27
-charmap "へ", 28
-charmap "ほ", 29
-charmap "ま", 30
-charmap "み", 31
-charmap "む", 32
-charmap "め", 33
-charmap "も", 34
-charmap "や", 35
-charmap "ゆ", 36
-charmap "よ", 37
-charmap "ら", 38
-charmap "り", 39
-charmap "る", 40
-charmap "れ", 41
-charmap "ろ", 42
-charmap "わ", 43
-charmap "を", 44
-charmap "ん", 45
-charmap "っ", 46
-charmap "ゃ", 47
-charmap "ゅ", 48
-charmap "ょ", 49
-charmap "が", 50
-charmap "ぎ", 51
-charmap "ぐ", 52
-charmap "げ", 53
-charmap "ご", 54
-charmap "ざ", 55
-charmap "じ", 56
-charmap "ず", 57
-charmap "ぜ", 58
-charmap "ぞ", 59
-charmap "だ", 60
-charmap "ぢ", 61
-charmap "づ", 62
-charmap "で", 63
-charmap "ど", 64
-charmap "ば", 65
-charmap "び", 66
-charmap "ぶ", 67
-charmap "べ", 68
-charmap "ぼ", 69
-charmap "ぱ", 70
-charmap "ぴ", 71
-charmap "ぷ", 72
-charmap "ぺ", 73
-charmap "ぽ", 74
-charmap "ぁ", 75
-charmap "ぃ", 76
-charmap "ぅ", 77
-charmap "ぇ", 78
-charmap "ぉ", 79
-charmap "ア", 80
-charmap "イ", 81
-charmap "ウ", 82
-charmap "エ", 83
-charmap "オ", 84
-charmap "カ", 85
-charmap "キ", 86
-charmap "ク", 87
-charmap "ケ", 88
-charmap "コ", 89
-charmap "サ", 90
-charmap "シ", 91
-charmap "ス", 92
-charmap "セ", 93
-charmap "ソ", 94
-charmap "タ", 95
-charmap "チ", 96
-charmap "ツ", 97
-charmap "テ", 98
-charmap "ト", 99
-charmap "ナ", 100
-charmap "ニ", 101
-charmap "ヌ", 102
-charmap "ネ", 103
-charmap "ノ", 104
-charmap "ハ", 105
-charmap "ヒ", 106
-charmap "フ", 107
-charmap "ヘ", 108
-charmap "ホ", 109
-charmap "マ", 110
-charmap "ミ", 111
-charmap "ム", 112
-charmap "メ", 113
-charmap "モ", 114
-charmap "ヤ", 115
-charmap "ユ", 116
-charmap "ヨ", 117
-charmap "ラ", 118
-charmap "リ", 119
-charmap "ル", 120
-charmap "レ", 121
-charmap "ロ", 122
-charmap "ワ", 123
-charmap "ヲ", 124
-charmap "ン", 125
-charmap "ッ", 126
-charmap "ャ", 127
-charmap "ュ", 128
-charmap "ョ", 129
-charmap "ガ", 130
-charmap "ギ", 131
-charmap "グ", 132
-charmap "ゲ", 133
-charmap "ゴ", 134
-charmap "ザ", 135
-charmap "ジ", 136
-charmap "ズ", 137
-charmap "ゼ", 138
-charmap "ゾ", 139
-charmap "ダ", 140
-charmap "ヂ", 141
-charmap "ヅ", 142
-charmap "デ", 143
-charmap "ド", 144
-charmap "バ", 145
-charmap "ビ", 146
-charmap "ブ", 147
-charmap "ベ", 148
-charmap "ボ", 149
-charmap "パ", 150
-charmap "ピ", 151
-charmap "プ", 152
-charmap "ペ", 153
-charmap "ポ", 154
-charmap "ァ", 155
-charmap "ィ", 156
-charmap "ゥ", 157
-charmap "ェ", 158
-charmap "ォ", 159
-charmap "0", 160
-charmap "1", 161
-charmap "2", 162
-charmap "3", 163
-charmap "4", 164
-charmap "5", 165
-charmap "6", 166
-charmap "7", 167
-charmap "8", 168
-charmap "9", 169
-charmap "-", 170
-charmap "A", 171
-charmap "B", 172
-charmap "C", 173
-charmap "D", 174
-charmap "E", 175
-charmap "F", 176
-charmap "G", 177
-charmap "H", 178
-charmap "I", 179
-charmap "J", 180
-charmap "K", 181
-charmap "L", 182
-charmap "M", 183
-charmap "N", 184
-charmap "O", 185
-charmap "P", 186
-charmap "Q", 187
-charmap "R", 188
-charmap "S", 189
-charmap "T", 190
-charmap "U", 191
-charmap "V", 192
-charmap "W", 193
-charmap "X", 194
-charmap "Y", 195
-charmap "Z", 196
-charmap "a", 197
-charmap "b", 198
-charmap "c", 199
-charmap "d", 200
-charmap "e", 201
-charmap "f", 202
-charmap "g", 203
-charmap "h", 204
-charmap "i", 205
-charmap "j", 206
-charmap "k", 207
-charmap "l", 208
-charmap "m", 209
-charmap "n", 210
-charmap "o", 211
-charmap "p", 212
-charmap "q", 213
-charmap "r", 214
-charmap "s", 215
-charmap "t", 216
-charmap "u", 217
-charmap "v", 218
-charmap "w", 219
-charmap "x", 220
-charmap "y", 221
-charmap "z", 222
-charmap "_", 223
-charmap "、", 224
-charmap "。", 225
-charmap "『", 226
-charmap "』", 227
-charmap "×", 228
-charmap "“", 229
-charmap "”", 230
-charmap "!", 231
-charmap "?", 232
-charmap ":", 233
-charmap ";", 234
-charmap ",", 235
-charmap ".", 236
-charmap "·", 237
-charmap "(", 238
-charmap ")", 239
-charmap "~", 240
-charmap "♂", 241
-charmap "♀", 242
-
-TX_LF EQU -2 ; Line feed
-TX_EOM EQU -1 ; End of message
diff --git a/shim.sym b/shim.sym
index 7bca47f..a47d473 100644
--- a/shim.sym
+++ b/shim.sym
@@ -31,45 +31,6 @@
02:5b67 function_02_5b67
02:5b77 function_02_5b77
02:5b98 function_02_5b98
-02:6880 string_02_6880
-02:68ca string_02_68ca
-02:68e2 string_02_68e2
-02:68fe string_02_68fe
-02:693e string_02_693e
-02:6960 string_02_6960
-02:69ae string_02_69ae
-02:69e6 string_02_69e6
-02:6a06 string_02_6a06
-02:6a44 string_02_6a44
-02:6a5e string_02_6a5e
-02:6aa4 string_02_6aa4
-02:6ac4 string_02_6ac4
-02:6afc string_02_6afc
-02:6b1c string_02_6b1c
-02:6b7e string_02_6b7e
-02:6bca string_02_6bca
-02:6be4 string_02_6be4
-02:6c18 string_02_6c18
-02:6c58 string_02_6c58
-02:6cba string_02_6cba
-02:6d10 string_02_6d10
-02:6d74 string_02_6d74
-02:6d90 string_02_6d90
-02:6dde string_02_6dde
-02:6e1e string_02_6e1e
-02:6e42 string_02_6e42
-02:6e60 string_02_6e60
-02:6ed0 string_02_6ed0
-02:6ee4 string_02_6ee4
-02:6f32 string_02_6f32
-02:6f96 string_02_6f96
-02:6fe2 string_02_6fe2
-02:702c string_02_702c
-02:708c string_02_708c
-02:70c2 string_02_70c2
-02:710e string_02_710e
-02:7142 string_02_7142
-02:71be string_02_71be
03:48cc data_00_48cc
diff --git a/source/bank_02.asm b/source/bank_02.asm
index 1e5d8d3..41844ab 100644
--- a/source/bank_02.asm
+++ b/source/bank_02.asm
@@ -28,7 +28,7 @@ text_char_print::
; Check if we've reached the end of the string
ld d, a
and e
- cp TX_EOM
+ cp TX_END
jp z, farcall_ret
push hl
@@ -80,7 +80,7 @@ text_char_print::
; Check if the next character is a terminator
ld a, [hl+]
and [hl]
- cp TX_EOM
+ cp TX_END
jp farcall_ret
; Returns:
diff --git a/source/bank_05.asm b/source/bank_05.asm
index 237eb88..15a7de6 100644
--- a/source/bank_05.asm
+++ b/source/bank_05.asm
@@ -52,9 +52,9 @@ function_05_4028:
ld [w_textbox_width], a
ld a, 141
ld [w_textbox_height], a
- ld a, LOW(string_02_6880)
+ ld a, LOW(tutorial_message_00)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6880)
+ ld a, HIGH(tutorial_message_00)
ld [w_text_cur_string + 1], a
ld a, $01
ld [w_d6ca], a
@@ -230,9 +230,9 @@ tutorial_scene_01:
call function_00_1085
farcall function_02_5b98
- ld a, LOW(string_02_68ca)
+ ld a, LOW(tutorial_message_01)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_68ca)
+ ld a, HIGH(tutorial_message_01)
ld [w_text_cur_string + 1], a
xor a
@@ -278,9 +278,9 @@ tutorial_scene_03:
farcall text_delay
jp nz, farcall_ret
- ld a, LOW(string_02_68e2)
+ ld a, LOW(tutorial_message_02)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_68e2)
+ ld a, HIGH(tutorial_message_02)
ld [w_text_cur_string + 1], a
xor a
@@ -323,9 +323,9 @@ tutorial_scene_05:
farcall text_delay
jp nz, farcall_ret
- ld a, LOW(string_02_68fe)
+ ld a, LOW(tutorial_message_03)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_68fe)
+ ld a, HIGH(tutorial_message_03)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
@@ -345,9 +345,9 @@ tutorial_scene_06:
call function_00_1085
farcall function_02_5b98
- ld a, LOW(string_02_693e)
+ ld a, LOW(tutorial_message_04)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_693e)
+ ld a, HIGH(tutorial_message_04)
ld [w_text_cur_string + 1], a
ld a, 10
ld [w_text_delay_timer], a
@@ -413,9 +413,9 @@ tutorial_scene_10:
ld [w_text_delay_timer], a
farcall function_02_5b67
- ld a, LOW(string_02_6960)
+ ld a, LOW(tutorial_message_05)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6960)
+ ld a, HIGH(tutorial_message_05)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
@@ -437,9 +437,9 @@ tutorial_scene_11:
farcall function_06_4964
farcall function_02_5b98
- ld a, LOW(string_02_69ae)
+ ld a, LOW(tutorial_message_06)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_69ae)
+ ld a, HIGH(tutorial_message_06)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
@@ -462,9 +462,9 @@ tutorial_scene_12:
farcall function_02_5560
farcall function_02_5a82
- ld a, LOW(string_02_69e6)
+ ld a, LOW(tutorial_message_07)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_69e6)
+ ld a, HIGH(tutorial_message_07)
ld [w_text_cur_string + 1], a
xor a
@@ -507,9 +507,9 @@ tutorial_scene_14:
farcall text_delay
jp nz, farcall_ret
- ld a, LOW(string_02_6a06)
+ ld a, LOW(tutorial_message_08)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6a06)
+ ld a, HIGH(tutorial_message_08)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
@@ -529,9 +529,9 @@ tutorial_scene_15:
call function_00_1085
farcall function_02_5b98
- ld a, LOW(string_02_6a44)
+ ld a, LOW(tutorial_message_09)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6a44)
+ ld a, HIGH(tutorial_message_09)
ld [w_text_cur_string + 1], a
xor a
@@ -577,9 +577,9 @@ tutorial_scene_17:
farcall text_delay
jp nz, farcall_ret
- ld a, LOW(string_02_6a5e)
+ ld a, LOW(tutorial_message_10)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6a5e)
+ ld a, HIGH(tutorial_message_10)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
@@ -646,9 +646,9 @@ tutorial_scene_19:
ld a, 60
ld [w_text_delay_timer], a
- ld a, LOW(string_02_6aa4)
+ ld a, LOW(tutorial_message_11)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6aa4)
+ ld a, HIGH(tutorial_message_11)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
@@ -674,9 +674,9 @@ tutorial_scene_21:
farcall text_delay
jp nz, farcall_ret
- ld a, LOW(string_02_6ac4)
+ ld a, LOW(tutorial_message_12)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6ac4)
+ ld a, HIGH(tutorial_message_12)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
@@ -693,9 +693,9 @@ tutorial_scene_22:
ld hl, function_02_5b77
farcall wait_press_a_blink
- ld a, LOW(string_02_6afc)
+ ld a, LOW(tutorial_message_13)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6afc)
+ ld a, HIGH(tutorial_message_13)
ld [w_text_cur_string + 1], a
call function_00_1085
@@ -743,9 +743,9 @@ tutorial_scene_24:
farcall text_delay
jp nz, farcall_ret
- ld a, LOW(string_02_6b1c)
+ ld a, LOW(tutorial_message_14)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6b1c)
+ ld a, HIGH(tutorial_message_14)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
@@ -796,9 +796,9 @@ tutorial_scene_26:
ld hl, w_tutorial_scene
inc [hl]
- ld a, LOW(string_02_6b7e)
+ ld a, LOW(tutorial_message_15)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6b7e)
+ ld a, HIGH(tutorial_message_15)
ld [w_text_cur_string + 1], a
call function_00_1085
@@ -835,9 +835,9 @@ tutorial_scene_28:
ld [w_ce00], a
farcall function_3c_4377
- ld a, LOW(string_02_6bca)
+ ld a, LOW(tutorial_message_16)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6bca)
+ ld a, HIGH(tutorial_message_16)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
@@ -857,9 +857,9 @@ tutorial_scene_29:
ld hl, w_tutorial_scene
inc [hl]
- ld a, LOW(string_02_6be4)
+ ld a, LOW(tutorial_message_17)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6be4)
+ ld a, HIGH(tutorial_message_17)
ld [w_text_cur_string + 1], a
call function_00_1085
@@ -915,9 +915,9 @@ tutorial_scene_32:
call function_00_1085
- ld a, LOW(string_02_6c18)
+ ld a, LOW(tutorial_message_18)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6c18)
+ ld a, HIGH(tutorial_message_18)
ld [w_text_cur_string + 1], a
ld a, $01
@@ -940,9 +940,9 @@ tutorial_scene_33:
ld hl, w_tutorial_scene
inc [hl]
- ld a, LOW(string_02_6c58)
+ ld a, LOW(tutorial_message_19)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6c58)
+ ld a, HIGH(tutorial_message_19)
ld [w_text_cur_string + 1], a
call function_00_1085
@@ -998,9 +998,9 @@ tutorial_scene_35:
farcall function_02_5a82
farcall function_29_7421
- ld a, LOW(string_02_6cba)
+ ld a, LOW(tutorial_message_20)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6cba)
+ ld a, HIGH(tutorial_message_20)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
@@ -1056,9 +1056,9 @@ tutorial_scene_37:
call function_00_1085
farcall function_02_5b98
- ld a, LOW(string_02_6d10)
+ ld a, LOW(tutorial_message_21)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6d10)
+ ld a, HIGH(tutorial_message_21)
ld [w_text_cur_string + 1], a
ld a, $01
@@ -1097,9 +1097,9 @@ tutorial_scene_39:
cp $3f
jp c, farcall_ret
- ld a, LOW(string_02_6d74)
+ ld a, LOW(tutorial_message_22)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6d74)
+ ld a, HIGH(tutorial_message_22)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
@@ -1134,9 +1134,9 @@ tutorial_scene_41:
cp $3f
jp c, farcall_ret
- ld a, LOW(string_02_6d90)
+ ld a, LOW(tutorial_message_23)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6d90)
+ ld a, HIGH(tutorial_message_23)
ld [w_text_cur_string + 1], a
call function_00_1085
@@ -1162,9 +1162,9 @@ tutorial_scene_42:
call function_00_1085
farcall function_02_5b98
- ld a, LOW(string_02_6dde)
+ ld a, LOW(tutorial_message_24)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6dde)
+ ld a, HIGH(tutorial_message_24)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
@@ -1185,9 +1185,9 @@ tutorial_scene_43:
farcall function_02_5b98
farcall function_02_5a82
- ld a, LOW(string_02_6e1e)
+ ld a, LOW(tutorial_message_25)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6e1e)
+ ld a, HIGH(tutorial_message_25)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
@@ -1232,9 +1232,9 @@ tutorial_scene_45:
ld hl, function_02_5b77
farcall wait_press_a_blink
- ld a, LOW(string_02_6e42)
+ ld a, LOW(tutorial_message_26)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6e42)
+ ld a, HIGH(tutorial_message_26)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
@@ -1259,9 +1259,9 @@ tutorial_scene_46:
call function_00_1085
farcall function_02_5b98
- ld a, LOW(string_02_6e60)
+ ld a, LOW(tutorial_message_27)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6e60)
+ ld a, HIGH(tutorial_message_27)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
@@ -1281,9 +1281,9 @@ tutorial_scene_47:
call function_00_1085
farcall function_02_5b98
- ld a, LOW(string_02_6ed0)
+ ld a, LOW(tutorial_message_28)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6ed0)
+ ld a, HIGH(tutorial_message_28)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
@@ -1317,9 +1317,9 @@ tutorial_scene_48:
farcall function_02_5b98
farcall function_02_5a82
- ld a, LOW(string_02_6ee4)
+ ld a, LOW(tutorial_message_29)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6ee4)
+ ld a, HIGH(tutorial_message_29)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
@@ -1339,9 +1339,9 @@ tutorial_scene_49:
call function_00_1085
farcall function_02_5b98
- ld a, LOW(string_02_6f32)
+ ld a, LOW(tutorial_message_30)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6f32)
+ ld a, HIGH(tutorial_message_30)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
@@ -1361,9 +1361,9 @@ tutorial_scene_50:
call function_00_1085
farcall function_02_5b98
- ld a, LOW(string_02_6f96)
+ ld a, LOW(tutorial_message_31)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6f96)
+ ld a, HIGH(tutorial_message_31)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
@@ -1383,9 +1383,9 @@ tutorial_scene_51:
call function_00_1085
farcall function_02_5b98
- ld a, LOW(string_02_6fe2)
+ ld a, LOW(tutorial_message_32)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_6fe2)
+ ld a, HIGH(tutorial_message_32)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
@@ -1435,9 +1435,9 @@ tutorial_scene_53:
call function_00_1085
farcall function_02_5b98
- ld a, LOW(string_02_702c)
+ ld a, LOW(tutorial_message_33)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_702c)
+ ld a, HIGH(tutorial_message_33)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
@@ -1490,9 +1490,9 @@ tutorial_scene_55:
call function_00_1085
farcall function_02_5b98
- ld a, LOW(string_02_708c)
+ ld a, LOW(tutorial_message_34)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_708c)
+ ld a, HIGH(tutorial_message_34)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
@@ -1512,9 +1512,9 @@ tutorial_scene_56:
call function_00_1085
farcall function_02_5b98
- ld a, LOW(string_02_70c2)
+ ld a, LOW(tutorial_message_35)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_70c2)
+ ld a, HIGH(tutorial_message_35)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
@@ -1534,9 +1534,9 @@ tutorial_scene_57:
call function_00_1085
farcall function_02_5b98
- ld a, LOW(string_02_710e)
+ ld a, LOW(tutorial_message_36)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_710e)
+ ld a, HIGH(tutorial_message_36)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
@@ -1556,9 +1556,9 @@ tutorial_scene_58:
call function_00_1085
farcall function_02_5b98
- ld a, LOW(string_02_7142)
+ ld a, LOW(tutorial_message_37)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_7142)
+ ld a, HIGH(tutorial_message_37)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
@@ -1578,9 +1578,9 @@ tutorial_scene_59:
call function_00_1085
farcall function_02_5b98
- ld a, LOW(string_02_71be)
+ ld a, LOW(tutorial_message_38)
ld [w_text_cur_string + 0], a
- ld a, HIGH(string_02_71be)
+ ld a, HIGH(tutorial_message_38)
ld [w_text_cur_string + 1], a
ld hl, w_tutorial_scene
diff --git a/tools/charmap.py b/tools/charmap.py
new file mode 100755
index 0000000..d318a61
--- /dev/null
+++ b/tools/charmap.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python3
+
+from sys import argv
+
+def parse_charmap(file):
+ charmap = {}
+ constants = {}
+ for line in open(file):
+ split = line.split("#")[0].split("=")
+ if len(split) != 2:
+ continue
+
+ char = "=".join(split[0:-1]).strip()
+ value = int(split[-1].strip(), 0) & 0xFFFF
+
+ if char.startswith("'") and char.endswith("'"):
+ charmap[char[1:-1]] = value
+ else:
+ constants[char] = value
+ return charmap, constants
+
+if __name__ == "__main__":
+ charmap, constants = parse_charmap(argv[1])
+
+ for char in charmap:
+ value = charmap[char]
+ print("charmap \"%s\", %d" % (char, value))
+
+ for constant in constants:
+ value = constants[constant]
+ print("%s EQU %d" % (constant, value))
diff --git a/tools/dump_string.py b/tools/dump_string.py
new file mode 100755
index 0000000..42fd347
--- /dev/null
+++ b/tools/dump_string.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python3
+
+from sys import argv
+from charmap import parse_charmap
+
+file = open("DMGAKVJ0.1", "rb").read()
+
+bank = int(argv[1], 16)
+addr = int(argv[2], 16)
+
+offset = addr
+if bank > 0:
+ offset += 0x4000 * (bank - 1)
+
+o_charmap, constants = parse_charmap("data/charmap.txt")
+charmap = {}
+for char in o_charmap:
+ if o_charmap[char] not in charmap:
+ charmap[o_charmap[char]] = char
+
+while True:
+ value = file[offset] | (file[offset + 1] << 8)
+ offset += 2
+
+ if value == 0xffff:
+ print()
+ break
+ elif value == 0xfffe:
+ print()
+ continue
+
+ if value in charmap:
+ print(charmap[value], end="")
+ else:
+ print("<%02x>" % value, end="")
diff --git a/tools/messages.py b/tools/messages.py
new file mode 100755
index 0000000..a8a1431
--- /dev/null
+++ b/tools/messages.py
@@ -0,0 +1,97 @@
+#!/usr/bin/env python3
+
+from sys import argv, stderr, exit
+from charmap import parse_charmap
+
+def err(s):
+ print("ERROR:", s.rstrip(), file=stderr)
+ exit(1)
+
+charmap, constants = parse_charmap(argv[1])
+
+filename = argv[2]
+
+def convert_message(message):
+ while True:
+ if message.endswith("\r\n"):
+ message = message[:-2]
+ continue
+ if message.endswith("\n"):
+ message = message[:-1]
+ continue
+ break
+
+ values = []
+ in_braces = False
+ constant = ""
+ for char in message:
+ if char == "{" and not in_braces:
+ in_braces = True
+ constant = ""
+ continue
+ if char == "}" and in_braces:
+ in_braces = False
+ if constant in constants:
+ values.append(constants[constant])
+ elif constant in charmap:
+ values.append(charmap[constant])
+ else:
+ err("%s: Unrecognized constant %s" % (filename, constant))
+ continue
+
+ if in_braces:
+ constant += char
+ continue
+
+ if char == "\r":
+ continue
+ if char == "\n":
+ values.append(0xfffe)
+ continue
+
+ if char in charmap:
+ values.append(charmap[char])
+ else:
+ err("%s: Unrecognized character '%s'" % (filename, char))
+
+ values.append(0xffff)
+ return " dw" + ", ".join(["$%04x" % val for val in values])
+
+name = None
+message = None
+for i, line in enumerate(open(filename)):
+ if i == 0 and not line.startswith(".org"):
+ print("SECTION \"%s\", ROMX" % filename)
+
+ if line.startswith("#"):
+ continue
+
+ if line.startswith("[") and line.endswith("]\n"):
+ if name is not None or message is not None:
+ print("\n%s::" % name)
+ print(convert_message(message))
+ message = ""
+ name = line[1:-2]
+ continue
+
+ if line.startswith(".org "):
+ split = line.split(" ", 1)
+ if len(split) < 2:
+ continue
+ split = split[1].strip().split(":")
+ if len(split) != 2:
+ continue
+ bank = split[0]
+ addr = split[1]
+ if i != 0:
+ print()
+ print("SECTION \"%s %s:%s\", ROMX[$%s], BANK[$%s]" %
+ (filename, bank, addr, addr, bank))
+ continue
+
+ if message is not None:
+ message += line
+
+if name is not None and message is not None:
+ print("\n%s::" % name)
+ print(convert_message(message))