summaryrefslogtreecommitdiff
path: root/Expand-tilesets-from-192-to-255-tiles.md
blob: ded253ed5878f4d8b9fdd59ba35a715eb2e786aa (plain)
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
By default, tilesets in Gen 2 are limited to 192 tiles. But we can see with [BGB](http://bgb.bircd.org/)'s VRAM viewer that there's room for more:

![Screenshot](screenshots/192-tiles-vram.png)

VRAM is divided into six areas, each 128 tiles large. The bottom-left and bottom-right areas are mostly for map tiles: $00–$5F on the left, $80–$DF on the right. The middle-left area ($80–$FF), and the bottom two rows of the bottom-left area ($60–$7F), are for text character tiles. The bottom two rows of the bottom-right area ($E0–$FF) are unused. Furthermore, many of the text tiles are unused as well, including the ümläuted letters, most of the **b**old letters, etc.

It's fairly simple to use $E0–$FF for 32 more map tiles. We can also use $60–$7E by moving its necessary text tiles into the main font area, leaving only $7F for the space character and allowing 255 map tiles.

(The code for this feature was adapted from [Pokémon Polished Crystal](https://github.com/Rangi42/polishedcrystal/).)


## Contents

1. [Move necessary text tiles to the main font graphics](#1-move-necessary-text-tiles-to-the-main-font-graphics)
2. [Update the character set](#2-update-the-character-set)
3. [Load the updated font graphics](#3-load-the-updated-font-graphics)
4. [Delete the unused font graphics](#4-delete-the-unused-font-graphics)
5. [Load tile graphics into $60–$7F and $E0–$FF](#5-load-tile-graphics-into-607f-and-e0ff)
6. [Update the tilesets' graphics to not skip $60–$7F](#6-update-the-tilesets-graphics-to-not-skip-607f)
7. [Update the tilesets' palette maps to not skip $60–$7F](#7-update-the-tilesets-palette-maps-to-not-skip-607f)
8. [Don't hide sprites behind $60–$7E or $E0–$FE](#8-dont-hide-sprites-behind-607e-or-e0fe)
9. [Change some hard-coded tile placements](#9-change-some-hard-coded-tile-placements)
10. [Correct other implicit assumptions about tiles](#10-correct-other-implicit-assumptions-about-tiles)


## 1. Move necessary text tiles to the main font graphics

Of the 32 tiles in the $60–$7F range, only 18 are actually used:

- The black square in [gfx/font/black.png](../blob/master/gfx/font/black.png)
- The up arrow in [gfx/font/up_arrow.png](../blob/master/gfx/font/up_arrow.png)
- The telephone in [gfx/font/phone_icon.png](../blob/master/gfx/font/phone_icon.png)
- The bold **V**, bold **S**, and small colon in the top row of [gfx/font/font_extra.png](../blob/master/gfx/font/font_extra.png)
- The "PO", "Ké", “curly quotes”, and ellipsis in the bottom row of [gfx/font/font_extra.png](../blob/master/gfx/font/font_extra.png)
- The six textbox frame characters and space character in the bottom row of [gfx/font/font_extra.png](../blob/master/gfx/font/font_extra.png) (actually loaded from [gfx/frames/\*.png](../tree/master/gfx/frames/))

The prime marks in [gfx/font/feet_inches.png](../blob/master/gfx/font/feet_inches.png) are also used. Meanwhile, the six ümläuted letters in [gfx/font/font.png](../blob/master/gfx/font/font.png) are unused, and the decimal point character is identical to the period. So replace them like this:

![gfx/font/font.png](screenshots/255-tiles_gfx-font-font.png)

Do the same for [gfx/font/font_inversed.png](../blob/master/gfx/font/font_inversed.png):

![gfx/font/font_inversed.png](screenshots/255-tiles_gfx-font-font_inversed.png)

And [gfx/font/overworld.png](../blob/master/gfx/font/overworld.png):

![gfx/font/overworld.png](screenshots/255-tiles_gfx-font-overworld.png)

Note that the textbox frames aren't present in these graphics. That's because they would be overwritten by whichever frame is actually chosen, so it would waste space to replicate them here.


## 2. Update the character set

Edit [charmap.asm](../blob/master/charmap.asm):

```diff
-; 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 other graphics files)

-	; needed for _LoadFontsExtra1 (see engine/load_font.asm)
-	charmap "■",         $60 ; gfx/font/black.2bpp
-	charmap "▲",         $61 ; gfx/font/up_arrow.png
-	charmap "☎",         $62 ; gfx/font/phone_icon.2bpp
-
-	; needed for MagikarpHouseSign (see engine/events/magikarp.asm)
-	charmap "′",         $6e ; gfx/font/feet_inches.png
-	charmap "″",         $6f ; gfx/font/feet_inches.png
+	charmap " ",         $7f ; gfx/frames/space.png

 	; needed for StatsScreen_PlaceShinyIcon and PrintPartyMonPage1
 	charmap "⁂",         $3f ; gfx/stats/stats_tiles.png, tile 14

 ...

-	charmap "Ä",         $c0
-	charmap "Ö",         $c1
-	charmap "Ü",         $c2
-	charmap "ä",         $c3
-	charmap "ö",         $c4
-	charmap "ü",         $c5
+	charmap "┌",         $ba
+	charmap "─",         $bb
+	charmap "┐",         $bc
+	charmap "│",         $bd
+	charmap "└",         $be
+	charmap "┘",         $bf
+
+	charmap "′",         $ce
+	charmap "″",         $cf

	charmap "'d",        $d0
	charmap "'l",        $d1
	charmap "'m",        $d2
	charmap "'r",        $d3
	charmap "'s",        $d4
	charmap "'t",        $d5
	charmap "'v",        $d6
+
+	charmap "■",         $d7
+	charmap "▲",         $d8
+	charmap "☎",         $d9
+	charmap "<BOLD_V>",  $da
+	charmap "<BOLD_S>",  $db
+	charmap "<COLON>",   $dc ; colon with tinier dots than ":"
+	charmap "“",         $dd ; opening quote
+	charmap "”",         $de ; closing quote

 	charmap "←",         $df
 	charmap "'",         $e0
 	charmap "<PK>",      $e1
 	charmap "<MN>",      $e2
 	charmap "-",         $e3
+
+	charmap "<PO>",      $e4
+	charmap "<KE>",      $e5

 	charmap "?",         $e6
 	charmap "!",         $e7
 	charmap ".",         $e8
+	charmap "<DOT>",     $e8 ; decimal point; same as "."
 	charmap "&",         $e9

 	charmap "é",         $ea
 	charmap "→",         $eb
 	charmap "▷",         $ec
 	charmap "▶",         $ed
 	charmap "▼",         $ee
 	charmap "♂",         $ef
 	charmap "¥",         $f0
 	charmap "×",         $f1
-	charmap "<DOT>",     $f2 ; decimal point; same as "." in English
+	charmap "…",         $f2 ; ellipsis
 	charmap "/",         $f3
 	charmap ",",         $f4
 	charmap "♀",         $f5
```


## 3. Load the updated font graphics

Edit [engine/gfx/load_font.asm](../blob/master/engine/gfx/load_font.asm):

```diff
 _LoadStandardFont::
-	ld de, Font
-	ld hl, vTiles1
-	lb bc, BANK(Font), 128 ; "A" to "9"
-	ldh a, [rLCDC]
-	bit rLCDC_ENABLE, a
-	jp z, Copy1bpp
-
 	ld de, Font
 	ld hl, vTiles1
 	lb bc, BANK(Font), 32 ; "A" to "]"
 	call Get1bpp_2
 	ld de, Font + 32 * LEN_1BPP_TILE
 	ld hl, vTiles1 tile $20
-	lb bc, BANK(Font), 32 ; "a" to $bf
+	lb bc, BANK(Font), 26 ; "a" to "z" (skip "┌" to "┘")
 	call Get1bpp_2
 	ld de, Font + 64 * LEN_1BPP_TILE
 	ld hl, vTiles1 tile $40
-	lb bc, BANK(Font), 32 ; "Ä" to "←"
+	lb bc, BANK(Font), 32 ; $c0 to "←"
 	call Get1bpp_2
 	ld de, Font + 96 * LEN_1BPP_TILE
 	ld hl, vTiles1 tile $60
 	lb bc, BANK(Font), 32 ; "'" to "9"
 	call Get1bpp_2
 	ret

 _LoadFontsExtra1::
-	ld de, FontsExtra_SolidBlackGFX
-	ld hl, vTiles2 tile "■" ; $60
-	lb bc, BANK(FontsExtra_SolidBlackGFX), 1
-	call Get1bpp_2
-	ld de, PokegearPhoneIconGFX
-	ld hl, vTiles2 tile "☎" ; $62
-	lb bc, BANK(PokegearPhoneIconGFX), 1
-	call Get2bpp_2
-	ld de, FontExtra + 3 tiles ; "<BOLD_D>"
-	ld hl, vTiles2 tile "<BOLD_D>"
-	lb bc, BANK(FontExtra), 22 ; "<BOLD_D>" to "ぉ"
-	call Get2bpp_2
 	jr LoadFrame

 _LoadFontsExtra2::
-	ld de, FontsExtra2_UpArrowGFX
-	ld hl, vTiles2 tile "▲" ; $61
-	ld b, BANK(FontsExtra2_UpArrowGFX)
-	ld c, 1
-	call Get2bpp_2
 	ret
```

And edit [mobile/mobile_41.asm](../blob/master/mobile/mobile_41.asm):

```diff
 Function106464::
-	ld de, FontsExtra_SolidBlackGFX
-	ld hl, vTiles2 tile "■" ; $60
-	lb bc, BANK(FontsExtra_SolidBlackGFX), 1
-	call Get2bpp
-	ld de, FontsExtra2_UpArrowGFX
-	ld hl, vTiles2 tile "▲" ; $61
-	lb bc, BANK(FontsExtra2_UpArrowGFX), 1
-	call Get2bpp
 	ld de, GFX_106514
-	ld hl, vTiles2 tile "☎" ; $62
+	ld hl, vTiles2 tile $62
 	ld c, 9
 	ld b, BANK(GFX_106514)
 	call Get2bpp
 	ld de, $40b0
 	ld hl, vTiles2 tile $6b
 	ld b, $f ; XXX no graphics at 0f:40b0
 	call Get2bpp
 	farcall LoadFrame
 	ret
```


## 4. Delete the unused font graphics

Delete [gfx/font/font_extra.png](../blob/master/gfx/font/font_extra.png), [gfx/font/phone_icon.png](../blob/master/gfx/font/phone_icon.png), [gfx/font/black.png](../blob/master/gfx/font/black.png), [gfx/font/up_arrow.png](../blob/master/gfx/font/up_arrow.png), and [gfx/font/feet_inches.png](../blob/master/gfx/font/feet_inches.png).

Edit [gfx/font.asm](../blob/master/gfx/font.asm):

```diff
-FontExtra:
-INCBIN "gfx/font/font_extra.2bpp"

 ...

-PokegearPhoneIconGFX:
-INCBIN "gfx/font/phone_icon.2bpp"

 ...

-FontsExtra_SolidBlackGFX:
-INCBIN "gfx/font/black.1bpp"

 ...

-FontsExtra2_UpArrowGFX:
-INCBIN "gfx/font/up_arrow.2bpp"
```

Edit [engine/events/magikarp.asm](../blob/master/engine/events/magikarp.asm):

```diff
-Magikarp_LoadFeetInchesChars:
-	ld hl, vTiles2 tile "′" ; $6e
-	ld de, .feetinchchars
-	lb bc, BANK(.feetinchchars), 2
-	call Request2bpp
-	ret
-
-.feetinchchars
-INCBIN "gfx/font/feet_inches.2bpp"
-
 PrintMagikarpLength:
-	call Magikarp_LoadFeetInchesChars
 	ld hl, wStringBuffer1
 	ld de, wMagikarpLength
 	lb bc, PRINTNUM_RIGHTALIGN | 1, 2
 	call PrintNum
 	ld [hl], "′"
 	inc hl
 	ld de, wMagikarpLength + 1
 	lb bc, PRINTNUM_RIGHTALIGN | 1, 2
 	call PrintNum
 	ld [hl], "″"
 	inc hl
 	ld [hl], "@"
 	ret
```


## 5. Load tile graphics into $60–$7F and $E0–$FF

Edit [home/map.asm](../blob/master/home/map.asm).

```diff
 LoadTilesetGFX::
 	...

 	ld a, e
 	ld de, wDecompressScratch
 	call FarDecompress

 	ld hl, wDecompressScratch
 	ld de, vTiles2
-	ld bc, $60 tiles
+	ld bc, $7f tiles
 	call CopyBytes

 	ldh a, [rVBK]
 	push af
 	ld a, $1
 	ldh [rVBK], a

 ...

 	ldh a, [rVBK]
 	push af
 	ld a, $1
 	ldh [rVBK], a

-	ld hl, wDecompressScratch + $60 tiles
+	ld hl, wDecompressScratch + $80 tiles
 	ld de, vTiles2
-	ld bc, $60 tiles
+	ld bc, $80 tiles
 	call CopyBytes

 	pop af
 	ldh [rVBK], a
```

Now instead of loading tileset graphics into tiles $00–$5F and $80–$DF, they'll be loaded into $00–$7E and $80–$FF. That's nearly four more rows, or 63 more tiles, usable for maps. (Note that only the first $7F tiles are loaded instead of the full $80; tile $7F, is not loaded because the space character goes there.)


## 6. Update the tilesets' graphics to not skip $60–$7F

Edit all the [gfx/tilesets/\*.png](../tree/master/gfx/tilesets/) files with more than six rows of tiles. In each case, we need to add two rows of blank tiles for the $60–$7F range (that is, the seventh and eighth rows). Here's one example, [gfx/tilesets/johto_modern.png](../blob/master/gfx/tilesets/johto_modern.png):

![gfx/tilesets/johto_modern.png](screenshots/255-tiles_gfx-tilesets-johto_modern.png)

You can also copy the modified tilesets from [here](https://github.com/Rangi42/pokecrystal/tree/255-tiles/gfx/tilesets).


## 7. Update the tilesets' palette maps to not skip $60–$7F

Edit all 37 [gfx/tilesets/\*_palette_map.asm](../tree/master/gfx/tilesets/) files. In each case, we need to replace the 16 `$ff` bytes that were placeholders for $60–$7F to be four `tilepal` lines.

Here's one example, [gfx/tilesets/johto_modern_palette_map.asm](../blob/master/gfx/tilesets/johto_modern_palette_map.asm):

```diff
	tilepal 0, GRAY, BROWN, BROWN, RED, GREEN, GREEN, GRAY, ROOF
	tilepal 0, RED, RED, ROOF, ROOF, ROOF, ROOF, ROOF, ROOF
	tilepal 0, ROOF, ROOF, ROOF, GREEN, WATER, GREEN, BROWN, BROWN
	tilepal 0, RED, RED, BROWN, BROWN, BROWN, GRAY, GREEN, GREEN
	tilepal 0, GRAY, GRAY, BROWN, RED, RED, GRAY, YELLOW, BROWN
	tilepal 0, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN, GRAY, RED
	tilepal 0, GRAY, BROWN, BROWN, GRAY, BROWN, GRAY, GRAY, YELLOW
	tilepal 0, YELLOW, BROWN, BROWN, BROWN, BROWN, BROWN, GREEN, GREEN
	tilepal 0, RED, BROWN, GRAY, GRAY, BROWN, BROWN, BROWN, BROWN
	tilepal 0, BROWN, WATER, GRAY, BROWN, BROWN, BROWN, GRAY, GRAY
	tilepal 0, GRAY, BROWN, BROWN, GRAY, BROWN, GRAY, GRAY, GRAY
	tilepal 0, WATER, GRAY, GRAY, GRAY, BROWN, BROWN, GRAY, GRAY
-
-rept 16
-	db $ff
-endr
-
+	tilepal 0, ROOF, ROOF, ROOF, ROOF, ROOF, ROOF, ROOF, ROOF
+	tilepal 0, ROOF, ROOF, ROOF, ROOF, ROOF, ROOF, ROOF, ROOF
+	tilepal 0, ROOF, ROOF, ROOF, ROOF, ROOF, ROOF, ROOF, ROOF
+	tilepal 0, ROOF, ROOF, ROOF, ROOF, ROOF, ROOF, ROOF, TEXT
	tilepal 1, GRAY, BROWN, BROWN, RED, GREEN, GREEN, GRAY, ROOF
	tilepal 1, RED, RED, ROOF, ROOF, ROOF, ROOF, ROOF, ROOF
	tilepal 1, ROOF, ROOF, ROOF, GREEN, WATER, GREEN, BROWN, ROOF
	tilepal 1, ROOF, ROOF, ROOF, BROWN, BROWN, GRAY, GREEN, GREEN
	tilepal 1, GRAY, GRAY, BROWN, RED, RED, GRAY, YELLOW, BROWN
	tilepal 1, BROWN, BROWN, BROWN, BROWN, BROWN, BROWN, GRAY, RED
	tilepal 1, GRAY, BROWN, BROWN, GRAY, BROWN, GRAY, GRAY, YELLOW
	tilepal 1, YELLOW, BROWN, BROWN, BROWN, BROWN, BROWN, GREEN, GREEN
	tilepal 1, RED, BROWN, GRAY, GRAY, BROWN, BROWN, BROWN, BROWN
	tilepal 1, BROWN, WATER, GRAY, BROWN, BROWN, BROWN, GRAY, GRAY
	tilepal 1, GRAY, BROWN, BROWN, GRAY, RED, RED, GREEN, GREEN
	tilepal 1, YELLOW, ROOF, ROOF, ROOF, ROOF, ROOF, RED, ROOF
```

The `ROOF` values are for tiles $60–$7E, which can be used for maps, and the `TEXT` value is for $7F, the space character.


## 8. Don't hide sprites behind $60–$7E or $E0–$FE

By default, sprites will disappear when they're behind (on top of) tiles $60–$6F or $D0–$FF, as well as the regular font tiles. This is so they won't appear on top of textboxes. This is caused by [engine/overworld/map_objects.asm](../blob/master/engine/overworld/map_objects.asm):

```asm
Function56cd:
	...
	ld c, a
	push bc
	call Coord2Tile
	pop bc
; NPCs disappear if standing on tile $60-$7f (or $e0-$ff),
; since those IDs are for text characters and textbox frames.
	ld a, [hl]
	cp FIRST_REGULAR_TEXT_CHAR
	jr nc, .nope
.ok8
	dec d
	jr nz, .next
.ok9
	dec e
	jr nz, .loop
	and a
	ret
```

Edit [constants/text_constants.asm](../blob/master/constants/text_constants.asm):

```diff
-FIRST_REGULAR_TEXT_CHAR EQU $60
+FIRST_REGULAR_TEXT_CHAR EQU $7f
```

Now tiles $60–$7E and $E0–$FE can safely have NPCs on top of them, but tiles $7F and $FF cannot. Tile $7F is the space character, so that's appropriate, but you'll have to remember not to place any sprites on tile $FF either.

(Until September 23, 2018, this step recommended that you edit `Function56cd` to call `Coord2Attr` instead of `Coord2Tile`, and check for the `PAL_BG_TEXT` color attribute instead of the `FIRST_REGULAR_TEXT_CHAR` tile ID. However, as ShinyDragonHunter noticed, this failed under certain circumstances involving the popup map name signs and automatic cutscenes—such as the Tin Tower scene where you battle Suicune.)


## 9. Change some hard-coded tile placements

Some parts of the code use "<code>vTiles2 tile <i>N</i></code>" to hard-code the data for a tile from $00 to $7F. When such a tile is moved to the range $80–$FF, the offset is invalid, so it has to become "<code>vTiles0 tile <i>N</i></code>".

Edit [engine/gfx/load_font.asm](../blob/master/engine/gfx/load_font.asm) again:

```diff
 LoadFrame:
 	ld a, [wTextboxFrame]
 	maskbits NUM_FRAMES
 	ld bc, 6 * LEN_1BPP_TILE
 	ld hl, Frames
 	call AddNTimes
 	ld d, h
 	ld e, l
-	ld hl, vTiles2 tile "┌" ; $79
+	ld hl, vTiles0 tile "┌" ; $ba
 	lb bc, BANK(Frames), 6 ; "┌" to "┘"
 	call Get1bpp_2
 	ld hl, vTiles2 tile " " ; $7f
 	ld de, TextboxSpaceGFX
 	lb bc, BANK(TextboxSpaceGFX), 1
 	call Get1bpp_2
 	ret
```

Edit [mobile/mobile_41.asm](../blob/master/mobile/mobile_41.asm) again:

```diff
 Function10649b:
 	ld a, [wTextboxFrame]
 	maskbits NUM_FRAMES
 	ld bc, 6 * LEN_1BPP_TILE
 	ld hl, Frames
 	call AddNTimes
 	ld d, h
 	ld e, l
-	ld hl, vTiles2 tile "┌" ; $79
+	ld hl, vTiles0 tile "┌" ; $ba
 	ld c, 6 ; "┌" to "┘"
 	ld b, BANK(Frames)
 	call Function1064c3
 	ld hl, vTiles2 tile " " ; $7f
 	ld de, TextboxSpaceGFX
 	ld c, 1
 	ld b, BANK(TextboxSpaceGFX)
 	call Function1064c3
 	ret
```

Edit [engine/menus/naming_screen.asm](../blob/master/engine/menus/naming_screen.asm):

```diff
-NAMINGSCREEN_BORDER     EQU "■" ; $60
+NAMINGSCREEN_BORDER     EQU "■" ; $d7
 NAMINGSCREEN_MIDDLELINE EQU "→" ; $eb
-NAMINGSCREEN_UNDERLINE  EQU "<DOT>" ; $f2
+NAMINGSCREEN_UNDERLINE  EQU "☎" ; $d9

 LoadNamingScreenGFX:
 	...

-	ld de, vTiles2 tile NAMINGSCREEN_BORDER
+	ld de, vTiles0 tile NAMINGSCREEN_BORDER
 	ld hl, NamingScreenGFX_Border
 	ld bc, 1 tiles
 	ld a, BANK(NamingScreenGFX_Border)
 	call FarCopyBytes
```

(Older versions of pokecrystal before rgbds 0.3.8 can't understand constants like `X_VALUE EQU "X"`, so they have to use `X_VALUE EQUS "\"X\""` instead.)

Edit [engine/events/map_name_sign.asm](../blob/master/engine/events/map_name_sign.asm):

```diff
-MAP_NAME_SIGN_START EQU $60
+MAP_NAME_SIGN_START EQU $c0

 ...

 LoadMapNameSignGFX:
 	ld de, MapEntryFrameGFX
-	ld hl, vTiles2 tile MAP_NAME_SIGN_START
+	ld hl, vTiles0 tile MAP_NAME_SIGN_START
 	lb bc, BANK(MapEntryFrameGFX), 14
 	call Get2bpp
 	ret
```

Edit [engine/events/halloffame.asm](../blob/master/engine/events/halloffame.asm):

```diff
-HALLOFFAME_COLON EQU $63

 ...

 HOF_AnimatePlayerPic:
 	call ClearBGPalettes
-	ld hl, vTiles2 tile HALLOFFAME_COLON
-	ld de, FontExtra + 13 tiles ; "<COLON>"
-	lb bc, BANK(FontExtra), 1
-	call Request2bpp
 	hlcoord 0, 0
 	ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
 	ld a, " "
 	call ByteFill
 	...
-	ld [hl], HALLOFFAME_COLON
+	ld [hl], "<COLON>"
 	...
```

(If it's unclear to you why we have to do this, take a look at the VRAM screenshot again, noting that `vTiles0` is the top-left sixth, `vTiles1` is the middle-left, and `vTiles2` is the bottom-left, with all three being sequential in memory.)


## 10. Correct other implicit assumptions about tiles

Edit [engine/pokemon/correct_nick_errors.asm](../blob/master/engine/pokemon/correct_nick_errors.asm):

```diff
 .textcommands
 ; table defining which characters are actually text commands
 ; format:
 	;      ≥           <
 	db "<NULL>",   "ガ"
 	db "<PLAY_G>", "<JP_18>" + 1
 	db "<NI>",     "<NO>"    + 1
 	db "<ROUTE>",  "<GREEN>" + 1
 	db "<ENEMY>",  "<ENEMY>" + 1
 	db "<MOM>",    "<TM>"    + 1
-	db "<ROCKET>", "┘"       + 1
+	db "<ROCKET>", " "
 	db -1 ; end
```

The next two changes were already made to pokecrystal by pull requests [#530](../pull/530) and [#534](../pull/534) before July 2018, so if your copy is newer than that you can skip the rest of this step.

Edit [engine/pokegear/pokegear.asm](../blob/master/engine/pokegear/pokegear.asm):

```diff
 .jump_return
 	push de
 	hlcoord 0, 12
 	lb bc, 4, 18
 	call Textbox
 	hlcoord 1, 14
-	ld [hl], $72
+	ld [hl], "“"
 	pop de
 	hlcoord 2, 14
 	call PlaceString
 	ld h, b
 	ld l, c
-	ld [hl], $73
+	ld [hl], "”"
 	call WaitBGMap
 	ret
```

And edit [engine/link/link_2.asm](../blob/master/engine/link/link_2.asm):

```diff
 LinkTextbox2:
 	...
 
 .PlaceBorder:
 	push hl
 	ld a, $76
 	ld [hli], a
 	inc a
 	call .PlaceRow
 	inc a
 	ld [hl], a
 	pop hl
 	ld de, SCREEN_WIDTH
 	add hl, de
 .loop
 	push hl
-	ld a, "┌"
+	ld a, $79
 	ld [hli], a
 	ld a, " "
 	call .PlaceRow
-	ld [hl], "─"
+	ld [hl], $7a
 	pop hl
 	ld de, SCREEN_WIDTH
 	add hl, de
 	dec b
 	jr nz, .loop
 
-	ld a, "┐"
+	ld a, $7b
 	ld [hli], a
-	ld a, "│"
+	ld a, $7c
 	call .PlaceRow
-	ld [hl], "└"
+	ld [hl], $7d
 	ret
 
 .PlaceRow:
 	ld d, c
 .row_loop
 	ld [hli], a
 	dec d
 	jr nz, .row_loop
 	ret
```

Now the game will work just like before:

![Screenshot](screenshots/255-tiles-overworld.png)

…except the VRAM now looks something like this, with 63 more tiles available to use for maps:

![Screenshot](screenshots/255-tiles-vram.png)

Furthermore, [Polished Map](https://github.com/Rangi42/polished-map) (with the **256 Tiles** option checked) will correctly load, edit, and save the enlarged tilesets:

![Screenshot](screenshots/255-tiles-polished-map.png)

Remember, tile $7F is reserved for the space character, so don't use it for a map tile.

This entire change is compatible with [adding `PRIORITY` colors so NPCs can walk behind tiles](Allow-map-tiles-to-appear-above-sprites-\(so-NPCs-can-walk-behind-tiles\)-with-PRIORITY-colors); in [step 7](#7-update-the-tilesets-palette-maps-to-not-skip-607f), you'll just be removing a `rept 32` instead of a `rept 16`.

Note that tiles $C0–$CD are blank in the font graphics, but get overwritten by the popup map name sign tiles. It's still okay to use them for your own text characters ("É", "¿", "♪", "♥", etc), just don't use those tiles in any map names.

You can also easily get rid of some rarely-used characters if you need more font space:

- The semicolon ";" and \[brackets] are only used for nicknames (see [data/text/name_input_chars.asm](../blob/master/data/text/name_input_chars.asm) and [data/text/mail_input_chars.asm](../blob/master/data/text/mail_input_chars.asm))
- The “curly quotes” are only used for nicknames and overworld radios (see [engine/pokegear/pokegear.asm](../blob/master/engine/pokegear/pokegear.asm))
- "`<BOLD_V>`" and "`<BOLD_S>`" are only used for announcing link battles (see [engine/battle/trainer_huds.asm](../blob/master/engine/battle/trainer_huds.asm)), which could instead use plain "V" and "S"
- "`<COLON>`" is only used twice (see [engine/menus/intro_menu.asm](../blob/master/engine/menus/intro_menu.asm) and [engine/events/halloffame.asm](../blob/master/engine/events/halloffame.asm)), which could instead use plain ":"
- The arrows "←" and "→" are only used for the Unown printer (see [engine/events/print_unown.asm](../blob/master/engine/events/print_unown.asm))
- The phone icon "☎" is only used for the Pokégear phone alert (see [engine/phone/phone.asm](../blob/master/engine/phone/phone.asm))
- The prime marks "′" and "″" are only used for the Magikarp length record (see [engine/events/magikarp.asm](../blob/master/engine/events/magikarp.asm)).
- "`<PO>`" and "`<KE>`" are only used for mail input (see [data/text/mail_input_chars.asm](../blob/master/data/text/mail_input_chars.asm)) and to define "`<POKE>`", which is itself only used for the Pokégear name (see [engine/menus/start_menu.asm](../blob/master/engine/menus/start_menu.asm))