shithub: pokecrystal

Download patch

ref: 73db02d3cdaf81a214ec6faa5462195618a80a48
parent: ec8c9688ce970b9c3b63a5b287a99542f0bc9984
parent: 29b41068cb0644956494dd2b7b75331a336b8d26
author: yenatch <yenatch@gmail.com>
date: Mon Dec 25 14:01:36 EST 2017

Merge pull request #433 from roukaour/master

More code cleanup

--- a/audio/engine.asm
+++ b/audio/engine.asm
@@ -539,7 +539,7 @@
 	ld a, [Danger]
 	bit DANGER_ON_F, a
 	ret z
-	and $ff - (1 << DANGER_ON_F)
+	and $ff ^ (1 << DANGER_ON_F)
 	ld d, a
 	call _CheckSFX
 	jr c, .asm_e8335
@@ -2297,9 +2297,9 @@
 	add hl, bc
 	ld a, [hl]
 	; multiply NoteLength by delay units
-	ld l, 0; just multiply
+	ld l, 0 ; just multiply
 	call .Multiply
-	ld a, l ; % $100
+	ld a, l ; low
 	; store Tempo in de
 	ld hl, Channel1Tempo - Channel1
 	add hl, bc
@@ -2310,7 +2310,7 @@
 	ld hl, Channel1Field0x16 - Channel1
 	add hl, bc
 	ld l, [hl]
-	; multiply Tempo by last result (NoteLength * delay % $100)
+	; multiply Tempo by last result (NoteLength * LOW(delay))
 	call .Multiply
 	; copy result to de
 	ld e, l
--- a/battle/ai/scoring.asm
+++ b/battle/ai/scoring.asm
@@ -141,7 +141,7 @@
 
 .discourage
 	call Random
-	cp 30
+	cp 12 percent
 	jr c, .checkmove
 	inc [hl]
 	inc [hl]
@@ -453,7 +453,7 @@
 
 .asm_38815
 	call Random
-	cp 100
+	cp 39 percent + 1
 	ret c
 
 	inc [hl]
@@ -594,7 +594,7 @@
 ; If enemy's HP is between 25% and 50%,
 ; over 90% chance to greatly discourage this move.
 	call Random
-	cp 20
+	cp 9 percent - 2
 	ret c
 
 .asm_388c6
@@ -610,7 +610,7 @@
 ; The AI_Basic layer will make sure that
 ; Dream Eater is only used against sleeping targets.
 	call Random
-	cp 25
+	cp 10 percent
 	ret c
 	dec [hl]
 	dec [hl]
@@ -637,7 +637,7 @@
 
 ; ...70% chance to greatly encourage this move if player is not badly poisoned.
 	call Random
-	cp $b2
+	cp 70 percent
 	jr nc, .asm_38911
 
 .asm_388ef
@@ -653,7 +653,7 @@
 
 ; If enemy's HP is above 25% but not full, 4% chance to greatly encourage this move.
 	call Random
-	cp $a
+	cp 4 percent
 	jr c, .asm_388ef
 
 ; If enemy's HP is between 25% and 50%,...
@@ -710,11 +710,11 @@
 	ret
 
 ; Player is badly poisoned.
-; 80% chance to greatly encourage this move.
+; 70% chance to greatly encourage this move.
 ; This would counter any previous discouragement.
 .asm_38938
 	call Random
-	cp $50
+	cp 31 percent + 1
 	ret c
 	dec [hl]
 	dec [hl]
@@ -791,7 +791,7 @@
 	ret nc
 
 	call Random
-	cp $19
+	cp 10 percent
 	ret c
 
 	dec [hl]
@@ -816,7 +816,7 @@
 
 ; ...70% chance to greatly encourage this move if player is not badly poisoned.
 	call Random
-	cp $b2
+	cp 70 percent
 	jr nc, .asm_389bf
 
 .asm_3899d
@@ -832,7 +832,7 @@
 
 ; If player's HP is above 25% but not full, 4% chance to greatly encourage this move.
 	call Random
-	cp $a
+	cp 4 percent
 	jr c, .asm_3899d
 
 ; If player's HP is between 25% and 50%,...
@@ -884,11 +884,11 @@
 	ret
 
 ; Player is badly poisoned.
-; 80% chance to greatly encourage this move.
+; 70% chance to greatly encourage this move.
 ; This would counter any previous discouragement.
 .asm_389e6
 	call Random
-	cp $50
+	cp 31 percent + 1
 	ret c
 	dec [hl]
 	dec [hl]
@@ -934,7 +934,7 @@
 .asm_38a12
 	pop hl
 	call Random
-	cp $28
+	cp 16 percent
 	ret c
 	dec [hl]
 	ret
@@ -955,7 +955,7 @@
 	call AICheckEnemyMaxHP
 	ret c
 	call Random
-	cp $19
+	cp 10 percent
 	ret c
 	inc [hl]
 	ret
@@ -997,7 +997,7 @@
 
 .asm_38a45
 	call Random
-	cp $19
+	cp 10 percent
 	ret c
 	dec [hl]
 	dec [hl]
@@ -1023,7 +1023,7 @@
 	call AICheckEnemyMaxHP
 	ret c
 	call Random
-	cp $14
+	cp 8 percent
 	ret c
 	inc [hl]
 	ret
@@ -1126,7 +1126,7 @@
 
 .asm_38acd
 	call Random
-	cp $c8
+	cp 79 percent - 1
 	ret c
 
 .asm_38ad3
@@ -1148,7 +1148,7 @@
 	call AICheckPlayerHalfHP
 	ret c
 	call Random
-	cp $19
+	cp 10 percent
 	jr c, .asm_38ae7
 	inc [hl]
 
@@ -1272,7 +1272,7 @@
 	call AICompareSpeed
 	ret c
 	call Random
-	cp 30
+	cp 12 percent
 	ret c
 	dec [hl]
 	dec [hl]
@@ -1304,7 +1304,7 @@
 .asm_38b72
 ; If enemy's HP is above 50%, discourage this move at random
 	call Random
-	cp 40
+	cp 16 percent
 	ret c
 	inc [hl]
 	call AI_50_50
@@ -1457,7 +1457,7 @@
 
 .asm_38c30
 	call Random
-	cp $64
+	cp 39 percent + 1
 	jr c, .asm_38c38
 
 	dec [hl]
@@ -1510,7 +1510,7 @@
 
 .asm_38c78
 	call Random
-	cp $46
+	cp 28 percent - 1
 	ret c
 	dec [hl]
 	dec [hl]
@@ -1657,7 +1657,7 @@
 	jr nc, .asm_38d0b
 
 	call Random
-	cp $64
+	cp 39 percent + 1
 	ret nc
 
 .asm_38d0b
@@ -1666,7 +1666,7 @@
 
 .asm_38d0d
 	call Random
-	cp $64
+	cp 39 percent + 1
 	ret c
 	dec [hl]
 	dec [hl]
@@ -1827,7 +1827,7 @@
 
 .asm_38dc9
 	call Random
-	cp 25
+	cp 10 percent
 	ret c
 	inc [hl]
 	ret
@@ -1848,7 +1848,7 @@
 	jr nc, .asm_38dee
 
 	call Random
-	cp 100
+	cp 39 percent + 1
 	ret c
 	dec [hl]
 	ret
@@ -1860,7 +1860,7 @@
 
 .asm_38df3
 	call Random
-	cp 20
+	cp 8 percent
 	ret c
 	inc [hl]
 	ret
@@ -2096,7 +2096,7 @@
 
 .asm_38f14
 	call Random
-	cp 20
+	cp 8 percent
 	ret c
 	inc [hl]
 	inc [hl]
@@ -2120,7 +2120,7 @@
 	jr z, .asm_38f41
 
 	call Random
-	cp 20
+	cp 8 percent
 	ret c
 	inc [hl]
 	ret
@@ -2127,7 +2127,7 @@
 
 .asm_38f41
 	call Random
-	cp 100
+	cp 39 percent + 1
 	ret c
 	dec [hl]
 	dec [hl]
@@ -2317,7 +2317,7 @@
 
 ; Otherwise, 80% chance to greatly encourage this move.
 	call Random
-	cp 200
+	cp 79 percent - 1
 	ret nc
 	dec [hl]
 	dec [hl]
@@ -2347,7 +2347,7 @@
 
 .first_turn
 	call Random
-	cp 200
+	cp 79 percent - 1
 	ret nc
 	dec [hl]
 	ret
@@ -2850,7 +2850,7 @@
 	ret nz
 
 	call Random
-	cp 25 ; 1/10
+	cp 10 percent
 	ret c
 
 	inc [hl]
@@ -2875,7 +2875,7 @@
 	ret nz
 
 	call Random
-	cp 25 ; 1/10
+	cp 10 percent
 	ret c
 
 	inc [hl]
@@ -3387,7 +3387,7 @@
 	jr nc, .asm_39425
 
 	call Random
-	cp 230
+	cp 90 percent + 1
 	ret nc
 
 	inc [hl]
@@ -3513,7 +3513,7 @@
 
 ; Else, 80% chance to exclude them.
 	call Random
-	cp 200 ; 1/5
+	cp 79 percent - 1
 	jr c, .nextmove
 
 .checkko
@@ -3586,7 +3586,7 @@
 
 AI_80_20: ; 39521
 	call Random
-	cp 50 ; 1/5
+	cp 20 percent - 1
 	ret
 ; 39527
 
@@ -3593,6 +3593,6 @@
 
 AI_50_50: ; 39527
 	call Random
-	cp $80 ; 1/2
+	cp 50 percent + 1
 	ret
 ; 3952d
--- a/battle/anim_commands.asm
+++ b/battle/anim_commands.asm
@@ -237,16 +237,16 @@
 ; Appears to be unused.
 	xor a
 	ld [hBGMapMode], a
-	ld a, (VBGMap0 tile $28) % $100
+	ld a, LOW(VBGMap0 tile $28)
 	ld [hBGMapAddress], a
-	ld a, (VBGMap0 tile $28) / $100
+	ld a, HIGH(VBGMap0 tile $28)
 	ld [hBGMapAddress + 1], a
 	call WaitBGMap2
 	ld a, $60
 	ld [hWY], a
-	xor a
+	xor a ; LOW(VBGMap0)
 	ld [hBGMapAddress], a
-	ld a, VBGMap0 / $100
+	ld a, HIGH(VBGMap0)
 	ld [hBGMapAddress + 1], a
 	call BattleAnimDelayFrame
 	ret
@@ -1501,10 +1501,10 @@
 	jr nz, .loop
 	ld a, [wBattleAnimOAMPointerLo]
 	ld l, a
-	ld h, Sprites / $100
+	ld h, HIGH(Sprites)
 .loop2
 	ld a, l
-	cp SpritesEnd % $100
+	cp LOW(SpritesEnd)
 	jr nc, .done
 	xor a
 	ld [hli], a
--- a/battle/bg_effects.asm
+++ b/battle/bg_effects.asm
@@ -1223,7 +1223,7 @@
 	xor $ff
 	inc a
 	ld d, a
-	ld h, LYOverridesBackup / $100
+	ld h, HIGH(LYOverridesBackup)
 	ld a, [hLYOverrideStart]
 	ld l, a
 	ld a, [hLYOverrideEnd]
@@ -1264,7 +1264,7 @@
 	ld e, [hl]
 	ld d, 2
 	call Functionc8f2e
-	ld h, LYOverridesBackup / $100
+	ld h, HIGH(LYOverridesBackup)
 	ld a, [hLYOverrideEnd]
 	ld l, a
 	ld [hl], $0
@@ -1275,7 +1275,7 @@
 .one
 	ld a, [hLYOverrideEnd]
 	ld l, a
-	ld h, LYOverridesBackup / $100
+	ld h, HIGH(LYOverridesBackup)
 	ld e, l
 	ld d, h
 	dec de
@@ -1554,7 +1554,7 @@
 	ld a, [hLYOverrideEnd]
 	sub d
 	ld d, a
-	ld h, LYOverridesBackup / $100
+	ld h, HIGH(LYOverridesBackup)
 	ld a, [hSCY]
 	or a
 	jr nz, .skip1
@@ -1846,7 +1846,7 @@
 	ld [hLYOverrideEnd], a
 	ld a, [hLYOverrideStart]
 	ld l, a
-	ld h, LYOverridesBackup / $100
+	ld h, HIGH(LYOverridesBackup)
 .loop
 	ld a, [hLYOverrideEnd]
 	cp l
@@ -1900,7 +1900,7 @@
 	ld a, [hLYOverrideEnd]
 	sub l
 	srl a
-	ld h, LYOverridesBackup / $100
+	ld h, HIGH(LYOverridesBackup)
 .loop2
 	ld [hl], e
 	inc hl
@@ -2851,7 +2851,7 @@
 	ld l, a
 	inc a
 	ld e, a
-	ld h, LYOverridesBackup / $100
+	ld h, HIGH(LYOverridesBackup)
 	ld d, h
 	ld a, [hLYOverrideEnd]
 	sub l
@@ -2874,7 +2874,7 @@
 
 BGEffect_FillLYOverridesBackup: ; c900b (32:500b)
 	push af
-	ld h, LYOverridesBackup / $100
+	ld h, HIGH(LYOverridesBackup)
 	ld a, [hLYOverrideStart]
 	ld l, a
 	ld a, [hLYOverrideEnd]
@@ -2897,7 +2897,7 @@
 	sub l
 	sub e
 	ld d, a
-	ld h, LYOverridesBackup / $100
+	ld h, HIGH(LYOverridesBackup)
 	ld a, [hLYOverrideStart]
 	ld l, a
 	ld a, $90
--- a/battle/core.asm
+++ b/battle/core.asm
@@ -2573,11 +2573,11 @@
 .CheckMaxedOutMomMoney: ; 3d0b1
 	ld hl, wMomsMoney + 2
 	ld a, [hld]
-	cp MAX_MONEY % $100
+	cp LOW(MAX_MONEY)
 	ld a, [hld]
-	sbc MAX_MONEY / $100 % $100
+	sbc HIGH(MAX_MONEY) ; mid
 	ld a, [hl]
-	sbc MAX_MONEY / $10000 % $100
+	sbc HIGH(MAX_MONEY >> 8)
 	ret
 ; 3d0be
 
@@ -2602,17 +2602,17 @@
 	jr nz, .loop
 	pop hl
 	ld a, [hld]
-	cp MAX_MONEY % $100
+	cp LOW(MAX_MONEY)
 	ld a, [hld]
-	sbc MAX_MONEY / $100 % $100
+	sbc HIGH(MAX_MONEY) ; mid
 	ld a, [hl]
-	sbc MAX_MONEY / $10000 % $100
+	sbc HIGH(MAX_MONEY >> 8)
 	ret c
-	ld [hl], MAX_MONEY / $10000 % $100
+	ld [hl], HIGH(MAX_MONEY >> 8)
 	inc hl
-	ld [hl], MAX_MONEY / $100 % $100
+	ld [hl], HIGH(MAX_MONEY) ; mid
 	inc hl
-	ld [hl], MAX_MONEY % $100
+	ld [hl], LOW(MAX_MONEY)
 	ret
 ; 3d0ea
 
@@ -6384,25 +6384,25 @@
 
 ; We're clear if the length is < 1536
 	ld a, [wMagikarpLength]
-	cp $06 ; $600 = 1536
+	cp HIGH(1536)
 	jr nz, .CheckMagikarpArea
 
-; 5% chance of skipping size checks
+; 5% chance of skipping both size checks
 	call Random
-	cp $0c ; / $100
+	cp 5 percent
 	jr c, .CheckMagikarpArea
 ; Try again if > 1614
 	ld a, [wMagikarpLength + 1]
-	cp $50
+	cp LOW(1614) + 2
 	jr nc, .GenerateDVs
 
 ; 20% chance of skipping this check
 	call Random
-	cp $32 ; / $100
+	cp 20 percent - 1
 	jr c, .CheckMagikarpArea
 ; Try again if > 1598
 	ld a, [wMagikarpLength + 1]
-	cp $40
+	cp LOW(1598) + 2
 	jr nc, .GenerateDVs
 
 .CheckMagikarpArea:
@@ -6423,11 +6423,11 @@
 	jr z, .Happiness
 ; 40% chance of not flooring
 	call Random
-	cp $64 ; / $100
+	cp 40 percent - 2
 	jr c, .Happiness
 ; Floor at length 1024
 	ld a, [wMagikarpLength]
-	cp 1024 >> 8
+	cp HIGH(1024)
 	jr c, .GenerateDVs ; try again
 
 ; Finally done with DVs
@@ -6462,7 +6462,7 @@
 .TreeMon:
 ; If we're headbutting trees, some monsters enter battle asleep
 	call CheckSleepingTreeMon
-	ld a, SLP ; Asleep for 7 turns
+	ld a, TREEMON_SLEEP_TURNS
 	jr c, .UpdateStatus
 ; Otherwise, no status
 	xor a
@@ -7009,14 +7009,14 @@
 
 ; Cap at 999.
 	ld a, [hQuotient + 2]
-	sub MAX_STAT_VALUE % $100
+	sub LOW(MAX_STAT_VALUE)
 	ld a, [hQuotient + 1]
-	sbc MAX_STAT_VALUE / $100
+	sbc HIGH(MAX_STAT_VALUE)
 	jp c, .okay3
 
-	ld a, MAX_STAT_VALUE / $100
+	ld a, HIGH(MAX_STAT_VALUE)
 	ld [hQuotient + 1], a
-	ld a, MAX_STAT_VALUE % $100
+	ld a, LOW(MAX_STAT_VALUE)
 	ld [hQuotient + 2], a
 
 .okay3
@@ -7132,13 +7132,13 @@
 
 ; Cap at 999.
 	ld a, [hld]
-	sub MAX_STAT_VALUE % $100
+	sub LOW(MAX_STAT_VALUE)
 	ld a, [hl]
-	sbc MAX_STAT_VALUE / $100
+	sbc HIGH(MAX_STAT_VALUE)
 	ret c
-	ld a, MAX_STAT_VALUE / $100
+	ld a, HIGH(MAX_STAT_VALUE)
 	ld [hli], a
-	ld a, MAX_STAT_VALUE % $100
+	ld a, LOW(MAX_STAT_VALUE)
 	ld [hld], a
 	ret
 ; 3ed9f
@@ -7217,7 +7217,7 @@
 	ld b, 10 ; number of seeds
 
 ; Generate next number in the sequence for each seed
-; The algorithm takes the form *5 + 1 % 256
+; a[n+1] = (a[n] * 5 + 1) % 256
 .loop
 	; get last #
 	ld a, [hl]
@@ -9135,10 +9135,10 @@
 	dec hl
 	ld a, [hl]
 	inc hl
-	cp MAX_LINK_RECORD / $100
+	cp HIGH(MAX_LINK_RECORD)
 	ret c
 	ld a, [hl]
-	cp MAX_LINK_RECORD % $100
+	cp LOW(MAX_LINK_RECORD)
 	ret
 ; 3fac8
 
--- a/battle/effect_commands.asm
+++ b/battle/effect_commands.asm
@@ -3576,14 +3576,14 @@
 	jr nz, .Cap
 
 	ld a, [hProduct + 2]
-	cp 998 / $100
+	cp HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1)
 	jr c, .dont_cap_2
 
-	cp 998 / $100 + 1
+	cp HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1) + 1
 	jr nc, .Cap
 
 	ld a, [hProduct + 3]
-	cp 998 % $100
+	cp LOW(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1)
 	jr nc, .Cap
 
 .dont_cap_2
@@ -3601,21 +3601,21 @@
 	jr c, .Cap
 
 	ld a, [hl]
-	cp 998 / $100
+	cp HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1)
 	jr c, .dont_cap_3
 
-	cp 998 / $100 + 1
+	cp HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1) + 1
 	jr nc, .Cap
 
 	inc hl
 	ld a, [hld]
-	cp 998 % $100
+	cp LOW(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE + 1)
 	jr c, .dont_cap_3
 
 .Cap:
-	ld a, 997 / $100
+	ld a, HIGH(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE)
 	ld [hli], a
-	ld a, 997 % $100
+	ld a, LOW(MAX_STAT_VALUE - MIN_NEUTRAL_DAMAGE)
 	ld [hld], a
 
 
@@ -3623,7 +3623,7 @@
 ; Minimum neutral damage is 2 (bringing the cap to 999).
 	inc hl
 	ld a, [hl]
-	add 2
+	add MIN_NEUTRAL_DAMAGE
 	ld [hld], a
 	jr nc, .dont_floor
 	inc [hl]
@@ -5651,10 +5651,10 @@
 .no_carry
 	pop bc
 	ld a, [hld]
-	sub MAX_STAT_VALUE % $100
+	sub LOW(MAX_STAT_VALUE)
 	jr nz, .not_already_max
 	ld a, [hl]
-	sbc MAX_STAT_VALUE / $100
+	sbc HIGH(MAX_STAT_VALUE)
 	jp z, .stats_already_max
 .not_already_max
 	ld a, [hBattleTurn]
@@ -6417,14 +6417,14 @@
 
 .check_maxed_out
 	ld a, [hQuotient + 2]
-	cp MAX_STAT_VALUE % $100
+	cp LOW(MAX_STAT_VALUE)
 	ld a, b
-	sbc MAX_STAT_VALUE / $100
+	sbc HIGH(MAX_STAT_VALUE)
 	jr c, .not_maxed_out
 
-	ld a, MAX_STAT_VALUE % $100
+	ld a, LOW(MAX_STAT_VALUE)
 	ld [hQuotient + 2], a
-	ld a, MAX_STAT_VALUE / $100
+	ld a, HIGH(MAX_STAT_VALUE)
 	ld [hQuotient + 1], a
 
 .not_maxed_out
@@ -8367,7 +8367,7 @@
 	call GetBattleVarAddr
 	ld a, [hl]
 	and a
-	ld [hl], REST_TURNS + 1
+	ld [hl], REST_SLEEP_TURNS + 1
 	ld hl, WentToSleepText
 	jr z, .no_status_to_heal
 	ld hl, RestedText
--- a/battle/objects/engine.asm
+++ b/battle/objects/engine.asm
@@ -106,7 +106,7 @@
 	ld l, a
 	ld a, [wBattleAnimOAMPointerLo]
 	ld e, a
-	ld d, Sprites / $100
+	ld d, HIGH(Sprites)
 .loop
 	ld a, [wBattleAnimTempYCoord]
 	ld b, a
--- a/constants/battle_constants.asm
+++ b/constants/battle_constants.asm
@@ -10,8 +10,12 @@
 BASE_STAT_LEVEL EQU 7
 MAX_STAT_LEVEL EQU 13
 
-; turns that Rest sleep lasts
-REST_TURNS EQU 2
+; minimum damage before type effectiveness
+MIN_NEUTRAL_DAMAGE EQU 2
+
+; turns that sleep lasts
+REST_SLEEP_TURNS EQU 2
+TREEMON_SLEEP_TURNS EQU 7
 
 ; PlayerStatLevels and EnemyStatLevels indexes
 ; used for GetStatName
--- a/constants/misc_constants.asm
+++ b/constants/misc_constants.asm
@@ -120,3 +120,5 @@
 	const HAPPINESS_REVIVALHERB       ; 11
 	const HAPPINESS_MASSAGE           ; 12
 	const HAPPINESS_GAINLEVELATHOME   ; 13
+
+MAX_DAY_CARE_EXP EQU $500000
--- /dev/null
+++ b/data/maps/environment_colors.asm
@@ -1,0 +1,35 @@
+EnvironmentColorsPointers:
+; entries correspond to environment constants (see constants/map_constants.asm)
+	dw .OutdoorColors ; unused
+	dw .OutdoorColors ; TOWN
+	dw .OutdoorColors ; ROUTE
+	dw .IndoorColors  ; INDOOR
+	dw .DungeonColors ; CAVE
+	dw .Env5Colors    ; ENVIRONMENT_5
+	dw .IndoorColors  ; GATE
+	dw .DungeonColors ; DUNGEON
+
+; Valid indices: $00 - $29
+.OutdoorColors:
+	db $00, $01, $02, $28, $04, $05, $06, $07 ; morn
+	db $08, $09, $0a, $28, $0c, $0d, $0e, $0f ; day
+	db $10, $11, $12, $29, $14, $15, $16, $17 ; nite
+	db $18, $19, $1a, $1b, $1c, $1d, $1e, $1f ; dark
+
+.IndoorColors:
+	db $20, $21, $22, $23, $24, $25, $26, $07 ; morn
+	db $20, $21, $22, $23, $24, $25, $26, $07 ; day
+	db $10, $11, $12, $13, $14, $15, $16, $07 ; nite
+	db $18, $19, $1a, $1b, $1c, $1d, $1e, $07 ; dark
+
+.DungeonColors:
+	db $00, $01, $02, $03, $04, $05, $06, $07 ; morn
+	db $08, $09, $0a, $0b, $0c, $0d, $0e, $0f ; day
+	db $10, $11, $12, $13, $14, $15, $16, $17 ; nite
+	db $18, $19, $1a, $1b, $1c, $1d, $1e, $1f ; dark
+
+.Env5Colors:
+	db $00, $01, $02, $03, $04, $05, $06, $07 ; morn
+	db $08, $09, $0a, $0b, $0c, $0d, $0e, $0f ; day
+	db $10, $11, $12, $13, $14, $15, $16, $17 ; nite
+	db $18, $19, $1a, $1b, $1c, $1d, $1e, $1f ; dark
--- a/data/maps/mapgroup_roofs.asm
+++ b/data/maps/mapgroup_roofs.asm
@@ -1,6 +1,5 @@
-; valid roofs: 0, 1, 2, 3, 4, or -1 for none
-
 MapGroupRoofs: ; 1c021i
+; entries correspond to Roofs (see below)
 	db -1 ; group 0 (unused)
 	db  3 ; group 1 (Olivine)
 	db  2 ; group 2 (Mahogany)
@@ -29,3 +28,11 @@
 	db -1 ; group 25
 	db  0 ; group 26 (Cherrygrove)
 ; 1c03c
+
+Roofs: ; 1c03c
+INCBIN "gfx/tilesets/roofs/0.2bpp"
+INCBIN "gfx/tilesets/roofs/1.2bpp"
+INCBIN "gfx/tilesets/roofs/2.2bpp"
+INCBIN "gfx/tilesets/roofs/3.2bpp"
+INCBIN "gfx/tilesets/roofs/4.2bpp"
+; 1c30c
--- a/data/palettes/49757.pal
+++ /dev/null
@@ -1,39 +1,0 @@
-	RGB 31, 31, 63
-	RGB 00, 00, 00
-	RGB 00, 00, 00
-	RGB 00, 00, 00
-
-	RGB 31, 31, 63
-	RGB 00, 00, 00
-	RGB 00, 00, 00
-	RGB 00, 00, 00
-
-	RGB 04, 02, 15
-	RGB 21, 00, 21
-	RGB 31, 00, 00
-	RGB 31, 31, 31
-
-	RGB 04, 02, 15
-	RGB 21, 00, 21
-	RGB 30, 16, 26
-	RGB 31, 31, 31
-
-	RGB 04, 02, 15
-	RGB 21, 00, 21
-	RGB 16, 16, 16
-	RGB 31, 31, 31
-
-	RGB 04, 02, 15
-	RGB 21, 00, 21
-	RGB 31, 12, 12
-	RGB 31, 31, 31
-
-	RGB 04, 02, 15
-	RGB 21, 00, 21
-	RGB 07, 08, 31
-	RGB 31, 31, 31
-
-	RGB 04, 02, 15
-	RGB 21, 00, 21
-	RGB 29, 28, 09
-	RGB 31, 31, 31
--- a/data/palettes/979c.pal
+++ /dev/null
@@ -1,29 +1,0 @@
-	RGB 31, 31, 31
-	RGB 25, 25, 25
-	RGB 13, 13, 13
-	RGB 00, 00, 00
-
-	RGB 31, 31, 31
-	RGB 31, 31, 07
-	RGB 31, 16, 01
-	RGB 00, 00, 00
-
-	RGB 31, 31, 31
-	RGB 31, 19, 24
-	RGB 30, 10, 06
-	RGB 00, 00, 00
-
-	RGB 31, 31, 31
-	RGB 12, 25, 01
-	RGB 05, 14, 00
-	RGB 00, 00, 00
-
-	RGB 31, 31, 31
-	RGB 08, 12, 31
-	RGB 01, 04, 31
-	RGB 00, 00, 00
-
-	RGB 31, 31, 31
-	RGB 24, 18, 07
-	RGB 20, 15, 03
-	RGB 00, 00, 00
--- a/data/palettes/b6f1.pal
+++ /dev/null
@@ -1,24 +1,0 @@
-	RGB 31, 31, 31
-	RGB 18, 23, 31
-	RGB 15, 20, 31
-	RGB 00, 00, 00
-
-	RGB 31, 31, 31
-	RGB 22, 00, 31
-	RGB 15, 20, 31
-	RGB 00, 00, 00
-
-	RGB 31, 31, 31
-	RGB 31, 00, 00
-	RGB 15, 20, 31
-	RGB 00, 00, 00
-
-	RGB 31, 31, 31
-	RGB 25, 22, 00
-	RGB 15, 20, 31
-	RGB 00, 00, 00
-
-	RGB 31, 31, 31
-	RGB 23, 26, 31
-	RGB 18, 23, 31
-	RGB 00, 00, 00
--- a/data/palettes/b719.pal
+++ /dev/null
@@ -1,9 +1,0 @@
-	RGB 31, 31, 31
-	RGB 07, 06, 03
-	RGB 07, 06, 03
-	RGB 07, 06, 03
-
-	RGB 31, 31, 31
-	RGB 31, 31, 00
-	RGB 26, 22, 00
-	RGB 00, 00, 00
--- a/data/palettes/b789.pal
+++ /dev/null
@@ -1,19 +1,0 @@
-	RGB 31, 31, 31
-	RGB 30, 22, 24
-	RGB 18, 18, 18
-	RGB 00, 00, 00
-
-	RGB 31, 31, 31
-	RGB 10, 11, 31
-	RGB 18, 18, 18
-	RGB 00, 00, 00
-
-	RGB 31, 31, 31
-	RGB 12, 31, 11
-	RGB 18, 18, 18
-	RGB 00, 00, 00
-
-	RGB 31, 31, 31
-	RGB 29, 26, 05
-	RGB 18, 18, 18
-	RGB 00, 00, 00
--- /dev/null
+++ b/data/palettes/battle_objects.pal
@@ -1,0 +1,30 @@
+; gray
+	RGB 31, 31, 31
+	RGB 25, 25, 25
+	RGB 13, 13, 13
+	RGB 00, 00, 00
+; yellow
+	RGB 31, 31, 31
+	RGB 31, 31, 07
+	RGB 31, 16, 01
+	RGB 00, 00, 00
+; red
+	RGB 31, 31, 31
+	RGB 31, 19, 24
+	RGB 30, 10, 06
+	RGB 00, 00, 00
+; green
+	RGB 31, 31, 31
+	RGB 12, 25, 01
+	RGB 05, 14, 00
+	RGB 00, 00, 00
+; blue
+	RGB 31, 31, 31
+	RGB 08, 12, 31
+	RGB 01, 04, 31
+	RGB 00, 00, 00
+; brown
+	RGB 31, 31, 31
+	RGB 24, 18, 07
+	RGB 20, 15, 03
+	RGB 00, 00, 00
--- /dev/null
+++ b/data/palettes/blk_packets.asm
@@ -1,0 +1,40 @@
+BlkPacket_9a86:
+	db $21, $01, $03, $00, $00, $00, $13, $11, $00, $00, $00, $00, $00, $00, $00, $00
+
+BlkPacket_9a96:
+	db $21, $01, $07, $05, $00, $0a, $13, $0d, $00, $00, $00, $00, $00, $00, $00, $00
+
+BlkPacket_9aa6:
+	db $22, $05, $07, $0a, $00, $0c, $13, $11, $03, $05, $01, $00, $0a, $03, $03, $00
+	db $0a, $08, $13, $0a, $03, $0a, $00, $04, $08, $0b, $03, $0f, $0b, $00, $13, $07
+
+BlkPacket_9ac6:
+	db $21, $01, $07, $05, $00, $01, $07, $07, $00, $00, $00, $00, $00, $00, $00, $00
+
+BlkPacket_9ad6:
+	db $21, $01, $07, $05, $0b, $01, $13, $02, $00, $00, $00, $00, $00, $00, $00, $00
+
+BlkPacket_9ae6:
+	db $21, $01, $07, $05, $01, $01, $08, $08, $00, $00, $00, $00, $00, $00, $00, $00
+
+BlkPacket_9af6:
+	db $21, $01, $07, $05, $07, $05, $0d, $0b, $00, $00, $00, $00, $00, $00, $00, $00
+
+BlkPacket_9b06:
+	db $22, $05, $03, $05, $00, $00, $13, $0b, $03, $0a, $00, $04, $13, $09, $02, $0f
+	db $00, $06, $13, $07, $03, $00, $04, $04, $0f, $09, $03, $00, $00, $0c, $13, $11
+
+BlkPacket_9b26:
+	db $23, $07, $07, $10, $00, $00, $02, $0c, $02, $00, $0c, $00, $12, $01, $02, $00
+	db $0c, $02, $12, $03, $02, $00, $0c, $04, $12, $05, $02, $00, $0c, $06, $12, $07
+	db $02, $00, $0c, $08, $12, $09, $02, $00, $0c, $0a, $12, $0b, $00, $00, $00, $00
+
+BlkPacket_9b56:
+	db $22, $03, $07, $20, $00, $00, $13, $04, $03, $0f, $00, $06, $13, $11, $03, $05
+	db $0f, $01, $12, $04, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+BlkPacket_9b76:
+	db $21, $01, $07, $10, $00, $00, $13, $05, $00, $00, $00, $00, $00, $00, $00, $00
+
+BlkPacket_9b86:
+	db $21, $02, $07, $0a, $00, $04, $13, $0d, $03, $05, $00, $06, $13, $0b, $00, $00
--- /dev/null
+++ b/data/palettes/exp_bar.pal
@@ -1,0 +1,3 @@
+; blue
+	RGB 30, 26, 15
+	RGB 04, 17, 31
--- /dev/null
+++ b/data/palettes/hp_bar.pal
@@ -1,0 +1,9 @@
+; green
+	RGB 30, 26, 15
+	RGB 00, 23, 00
+; yellow
+	RGB 30, 26, 15
+	RGB 31, 21, 00
+; red
+	RGB 30, 26, 15
+	RGB 31, 00, 00
--- a/data/palettes/map_objects.pal
+++ /dev/null
@@ -1,39 +1,0 @@
-	; morn
-	RGB 28,31,16, 31,19,10, 31,07,01, 00,00,00 ; red
-	RGB 28,31,16, 31,19,10, 10,09,31, 00,00,00 ; blue
-	RGB 28,31,16, 31,19,10, 07,23,03, 00,00,00 ; green
-	RGB 28,31,16, 31,19,10, 15,10,03, 00,00,00 ; brown
-	RGB 28,31,16, 31,19,10, 30,10,06, 00,00,00 ; pink
-	RGB 31,31,31, 31,31,31, 13,13,13, 00,00,00 ; silver
-	RGB 22,31,10, 12,25,01, 05,14,00, 07,07,07 ; tree
-	RGB 28,31,16, 24,18,07, 20,15,03, 07,07,07 ; rock
-
-	; day
-	RGB 27,31,27, 31,19,10, 31,07,01, 00,00,00 ; red
-	RGB 27,31,27, 31,19,10, 10,09,31, 00,00,00 ; blue
-	RGB 27,31,27, 31,19,10, 07,23,03, 00,00,00 ; green
-	RGB 27,31,27, 31,19,10, 15,10,03, 00,00,00 ; brown
-	RGB 27,31,27, 31,19,10, 30,10,06, 00,00,00 ; pink
-	RGB 31,31,31, 31,31,31, 13,13,13, 00,00,00 ; silver
-	RGB 22,31,10, 12,25,01, 05,14,00, 07,07,07 ; tree
-	RGB 27,31,27, 24,18,07, 20,15,03, 07,07,07 ; rock
-
-	; nite
-	RGB 15,14,24, 31,19,10, 31,07,01, 00,00,00 ; red
-	RGB 15,14,24, 31,19,10, 10,09,31, 00,00,00 ; blue
-	RGB 15,14,24, 31,19,10, 07,23,03, 00,00,00 ; green
-	RGB 15,14,24, 31,19,10, 15,10,03, 00,00,00 ; brown
-	RGB 15,14,24, 31,19,10, 30,10,06, 00,00,00 ; pink
-	RGB 31,31,31, 31,31,31, 13,13,13, 00,00,00 ; silver
-	RGB 15,14,24, 08,13,19, 00,11,13, 00,00,00 ; tree
-	RGB 15,14,24, 12,09,15, 08,04,05, 00,00,00 ; rock
-
-	; dark
-	RGB 01,01,02, 31,19,10, 31,07,01, 00,00,00 ; red
-	RGB 01,01,02, 31,19,10, 10,09,31, 00,00,00 ; blue
-	RGB 01,01,02, 31,19,10, 07,23,03, 00,00,00 ; green
-	RGB 01,01,02, 31,19,10, 15,10,03, 00,00,00 ; brown
-	RGB 01,01,02, 31,19,10, 30,10,06, 00,00,00 ; pink
-	RGB 31,31,31, 31,31,31, 13,13,13, 00,00,00 ; silver
-	RGB 01,01,02, 00,00,00, 00,00,00, 00,00,00 ; tree
-	RGB 01,01,02, 00,00,00, 00,00,00, 00,00,00 ; rock
--- /dev/null
+++ b/data/palettes/overworld/bg_text.pal
@@ -1,0 +1,4 @@
+	RGB 31, 31, 31
+	RGB 08, 19, 28
+	RGB 05, 05, 16
+	RGB 00, 00, 00
--- /dev/null
+++ b/data/palettes/overworld/map_objects.pal
@@ -1,0 +1,39 @@
+; morn
+	RGB 28,31,16, 31,19,10, 31,07,01, 00,00,00 ; red
+	RGB 28,31,16, 31,19,10, 10,09,31, 00,00,00 ; blue
+	RGB 28,31,16, 31,19,10, 07,23,03, 00,00,00 ; green
+	RGB 28,31,16, 31,19,10, 15,10,03, 00,00,00 ; brown
+	RGB 28,31,16, 31,19,10, 30,10,06, 00,00,00 ; pink
+	RGB 31,31,31, 31,31,31, 13,13,13, 00,00,00 ; silver
+	RGB 22,31,10, 12,25,01, 05,14,00, 07,07,07 ; tree
+	RGB 28,31,16, 24,18,07, 20,15,03, 07,07,07 ; rock
+
+; day
+	RGB 27,31,27, 31,19,10, 31,07,01, 00,00,00 ; red
+	RGB 27,31,27, 31,19,10, 10,09,31, 00,00,00 ; blue
+	RGB 27,31,27, 31,19,10, 07,23,03, 00,00,00 ; green
+	RGB 27,31,27, 31,19,10, 15,10,03, 00,00,00 ; brown
+	RGB 27,31,27, 31,19,10, 30,10,06, 00,00,00 ; pink
+	RGB 31,31,31, 31,31,31, 13,13,13, 00,00,00 ; silver
+	RGB 22,31,10, 12,25,01, 05,14,00, 07,07,07 ; tree
+	RGB 27,31,27, 24,18,07, 20,15,03, 07,07,07 ; rock
+
+; nite
+	RGB 15,14,24, 31,19,10, 31,07,01, 00,00,00 ; red
+	RGB 15,14,24, 31,19,10, 10,09,31, 00,00,00 ; blue
+	RGB 15,14,24, 31,19,10, 07,23,03, 00,00,00 ; green
+	RGB 15,14,24, 31,19,10, 15,10,03, 00,00,00 ; brown
+	RGB 15,14,24, 31,19,10, 30,10,06, 00,00,00 ; pink
+	RGB 31,31,31, 31,31,31, 13,13,13, 00,00,00 ; silver
+	RGB 15,14,24, 08,13,19, 00,11,13, 00,00,00 ; tree
+	RGB 15,14,24, 12,09,15, 08,04,05, 00,00,00 ; rock
+
+; dark
+	RGB 01,01,02, 31,19,10, 31,07,01, 00,00,00 ; red
+	RGB 01,01,02, 31,19,10, 10,09,31, 00,00,00 ; blue
+	RGB 01,01,02, 31,19,10, 07,23,03, 00,00,00 ; green
+	RGB 01,01,02, 31,19,10, 15,10,03, 00,00,00 ; brown
+	RGB 01,01,02, 31,19,10, 30,10,06, 00,00,00 ; pink
+	RGB 31,31,31, 31,31,31, 13,13,13, 00,00,00 ; silver
+	RGB 01,01,02, 00,00,00, 00,00,00, 00,00,00 ; tree
+	RGB 01,01,02, 00,00,00, 00,00,00, 00,00,00 ; rock
--- /dev/null
+++ b/data/palettes/overworld/roofs.pal
@@ -1,0 +1,161 @@
+; group 0 (unused)
+	RGB 21, 21, 21
+	RGB 11, 11, 11
+	RGB 21, 21, 21
+	RGB 11, 11, 11
+
+; group 1 (Olivine)
+	RGB 14, 17, 31
+	RGB 07, 11, 15
+	RGB 09, 09, 17
+	RGB 05, 07, 13
+
+; group 2 (Mahogany)
+	RGB 12, 19, 00
+	RGB 06, 10, 00
+	RGB 06, 09, 07
+	RGB 04, 05, 06
+
+; group 3
+	RGB 21, 21, 21
+	RGB 11, 11, 11
+	RGB 21, 21, 21
+	RGB 17, 08, 07
+
+; group 4 (Ecruteak)
+	RGB 31, 19, 00
+	RGB 27, 10, 05
+	RGB 15, 07, 02
+	RGB 11, 04, 02
+
+; group 5 (Blackthorn)
+	RGB 11, 10, 16
+	RGB 05, 06, 07
+	RGB 03, 04, 08
+	RGB 00, 00, 00
+
+; group 6 (Cinnabar)
+	RGB 31, 10, 00
+	RGB 18, 06, 00
+	RGB 18, 05, 09
+	RGB 17, 08, 07
+
+; group 7 (Cerulean)
+	RGB 17, 27, 31
+	RGB 05, 15, 31
+	RGB 07, 08, 22
+	RGB 07, 07, 16
+
+; group 8 (Azalea)
+	RGB 22, 20, 10
+	RGB 17, 14, 03
+	RGB 11, 11, 05
+	RGB 10, 09, 07
+
+; group 9 (Lake of Rage)
+	RGB 31, 08, 04
+	RGB 09, 09, 08
+	RGB 18, 05, 09
+	RGB 09, 09, 08
+
+; group 10 (Violet)
+	RGB 24, 14, 31
+	RGB 13, 07, 21
+	RGB 12, 03, 18
+	RGB 09, 03, 15
+
+; group 11 (Goldenrod)
+	RGB 25, 25, 00
+	RGB 20, 17, 08
+	RGB 12, 12, 00
+	RGB 10, 09, 05
+
+; group 12 (Vermilion)
+	RGB 27, 23, 01
+	RGB 23, 11, 00
+	RGB 15, 11, 01
+	RGB 11, 10, 01
+
+; group 13 (Pallet)
+	RGB 27, 28, 31
+	RGB 17, 19, 22
+	RGB 14, 14, 18
+	RGB 10, 09, 13
+
+; group 14 (Pewter)
+	RGB 19, 19, 16
+	RGB 10, 12, 15
+	RGB 09, 09, 11
+	RGB 04, 05, 07
+
+; group 15 (Mount Moon Square)
+	RGB 14, 17, 31
+	RGB 07, 11, 15
+	RGB 09, 13, 19
+	RGB 07, 07, 16
+
+; group 16 (Route 23)
+	RGB 21, 21, 21
+	RGB 13, 13, 13
+	RGB 11, 11, 19
+	RGB 07, 07, 12
+
+; group 17 (Fuchsia)
+	RGB 31, 18, 29
+	RGB 17, 13, 20
+	RGB 14, 06, 12
+	RGB 11, 03, 10
+
+; group 18 (Lavender)
+	RGB 23, 15, 31
+	RGB 16, 05, 31
+	RGB 12, 07, 17
+	RGB 08, 06, 10
+
+; group 19 (Route 28)
+	RGB 21, 21, 25
+	RGB 16, 16, 16
+	RGB 13, 13, 13
+	RGB 07, 07, 07
+
+; group 20
+	RGB 21, 21, 21
+	RGB 11, 11, 11
+	RGB 21, 21, 21
+	RGB 11, 11, 11
+
+; group 21 (Celadon)
+	RGB 19, 31, 15
+	RGB 31, 22, 02
+	RGB 12, 13, 09
+	RGB 09, 12, 03
+
+; group 22 (Cianwood)
+	RGB 15, 10, 31
+	RGB 07, 05, 15
+	RGB 06, 05, 17
+	RGB 02, 02, 08
+
+; group 23 (Viridian)
+	RGB 21, 31, 07
+	RGB 13, 25, 04
+	RGB 09, 14, 08
+	RGB 06, 10, 04
+
+; group 24 (New Bark)
+	RGB 20, 31, 14
+	RGB 11, 23, 05
+	RGB 09, 13, 08
+	RGB 06, 09, 04
+
+; group 25 (Saffron)
+	RGB 31, 26, 00
+	RGB 31, 15, 00
+	RGB 13, 13, 01
+	RGB 08, 08, 01
+
+; group 26 (Cherrygrove)
+	RGB 31, 14, 28
+	RGB 31, 05, 21
+	RGB 14, 07, 17
+	RGB 13, 00, 08
--- /dev/null
+++ b/data/palettes/overworld/tileset_bg.pal
@@ -1,0 +1,61 @@
+; morn
+	RGB 28,31,16, 21,21,21, 13,13,13, 07,07,07 ; gray
+	RGB 28,31,16, 31,19,24, 30,10,06, 07,07,07 ; red
+	RGB 22,31,10, 12,25,01, 05,14,00, 07,07,07 ; green
+	RGB 31,31,31, 08,12,31, 01,04,31, 07,07,07 ; water
+	RGB 28,31,16, 31,31,07, 31,16,01, 07,07,07 ; yellow
+	RGB 28,31,16, 24,18,07, 20,15,03, 07,07,07 ; brown
+	RGB 28,31,16, 15,31,31, 05,17,31, 07,07,07 ; roof
+	RGB 31,31,16, 31,31,16, 14,09,00, 00,00,00 ; text
+
+; day
+	RGB 27,31,27, 21,21,21, 13,13,13, 07,07,07 ; gray
+	RGB 27,31,27, 31,19,24, 30,10,06, 07,07,07 ; red
+	RGB 22,31,10, 12,25,01, 05,14,00, 07,07,07 ; green
+	RGB 31,31,31, 08,12,31, 01,04,31, 07,07,07 ; water
+	RGB 27,31,27, 31,31,07, 31,16,01, 07,07,07 ; yellow
+	RGB 27,31,27, 24,18,07, 20,15,03, 07,07,07 ; brown
+	RGB 27,31,27, 15,31,31, 05,17,31, 07,07,07 ; roof
+	RGB 31,31,16, 31,31,16, 14,09,00, 00,00,00 ; text
+
+; nite
+	RGB 15,14,24, 11,11,19, 07,07,12, 00,00,00 ; gray
+	RGB 15,14,24, 14,07,17, 13,00,08, 00,00,00 ; red
+	RGB 15,14,24, 08,13,19, 00,11,13, 00,00,00 ; green
+	RGB 15,14,24, 05,05,17, 03,03,10, 00,00,00 ; water
+	RGB 30,30,11, 16,14,18, 16,14,10, 00,00,00 ; yellow
+	RGB 15,14,24, 12,09,15, 08,04,05, 00,00,00 ; brown
+	RGB 15,14,24, 13,12,23, 11,09,20, 00,00,00 ; roof
+	RGB 31,31,16, 31,31,16, 14,09,00, 00,00,00 ; text
+
+; dark
+	RGB 01,01,02, 00,00,00, 00,00,00, 00,00,00 ; gray
+	RGB 01,01,02, 00,00,00, 00,00,00, 00,00,00 ; red
+	RGB 01,01,02, 00,00,00, 00,00,00, 00,00,00 ; green
+	RGB 01,01,02, 00,00,00, 00,00,00, 00,00,00 ; water
+	RGB 30,30,11, 00,00,00, 00,00,00, 00,00,00 ; yellow
+	RGB 01,01,02, 00,00,00, 00,00,00, 00,00,00 ; brown
+	RGB 01,01,02, 00,00,00, 00,00,00, 00,00,00 ; roof
+	RGB 31,31,16, 31,31,16, 14,09,00, 00,00,00 ; text
+
+; indoor
+	RGB 30,28,26, 19,19,19, 13,13,13, 07,07,07 ; gray
+	RGB 30,28,26, 31,19,24, 30,10,06, 07,07,07 ; red
+	RGB 18,24,09, 15,20,01, 09,13,00, 07,07,07 ; green
+	RGB 30,28,26, 15,16,31, 09,09,31, 07,07,07 ; water
+	RGB 30,28,26, 31,31,07, 31,16,01, 07,07,07 ; yellow
+	RGB 26,24,17, 21,17,07, 16,13,03, 07,07,07 ; brown
+	RGB 30,28,26, 17,19,31, 14,16,31, 07,07,07 ; roof
+	RGB 31,31,16, 31,31,16, 14,09,00, 00,00,00 ; text
+
+; overworld water
+; morn/day
+	RGB 23, 23, 31
+	RGB 18, 19, 31
+	RGB 13, 12, 31
+	RGB 07, 07, 07
+; nite
+	RGB 15, 13, 27
+	RGB 10, 09, 20
+	RGB 04, 03, 18
+	RGB 00, 00, 00
\ No newline at end of file
--- /dev/null
+++ b/data/palettes/pal_packets.asm
@@ -1,0 +1,113 @@
+PalPacket_9b96:
+	db $51, $48, $00, $49, $00, $4a, $00, $4b, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9ba6:
+	db $51, $2b, $00, $24, $00, $20, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9bb6:
+	db $51, $41, $00, $42, $00, $43, $00, $44, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9bc6:
+	db $51, $4c, $00, $4c, $00, $4c, $00, $4c, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9bd6:
+	db $51, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9be6:
+	db $51, $36, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9bf6:
+	db $51, $37, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9c06:
+	db $51, $38, $00, $39, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9c16:
+	db $51, $3a, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9c26:
+	db $51, $3b, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9c36:
+	db $51, $3c, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9c46:
+	db $51, $39, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9c56:
+	db $51, $2e, $00, $2f, $00, $30, $00, $31, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9c66:
+	db $51, $1a, $00, $1a, $00, $1a, $00, $1a, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9c76:
+	db $51, $32, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9c86:
+	db $51, $3c, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9c96:
+	db $51, $3d, $00, $3e, $00, $3f, $00, $40, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9ca6:
+	db $51, $33, $00, $34, $00, $1b, $00, $1f, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9cb6:
+	db $51, $1b, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9cc6:
+	db $51, $1c, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9cd6:
+	db $51, $35, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9ce6:
+	db $01, $ff, $7f, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9cf6:
+	db $09, $ff, $7f, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9d06:
+	db $59, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9d16:
+	db $89, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9d26:
+	db $89, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9d36:
+	db $99, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9d46:
+	db $a1, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9d56:
+	db $b9, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9d66:
+	db $b9, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9d76:
+	db $79, $5d, $08, $00, $0b, $8c, $d0, $f4, $60, $00, $00, $00, $00, $00, $00, $00
+
+PalPacket_9d86:
+	db $79, $52, $08, $00, $0b, $a9, $e7, $9f, $01, $c0, $7e, $e8, $e8, $e8, $e8, $e0
+
+PalPacket_9d96:
+	db $79, $47, $08, $00, $0b, $c4, $d0, $16, $a5, $cb, $c9, $05, $d0, $10, $a2, $28
+
+PalPacket_9da6:
+	db $79, $3c, $08, $00, $0b, $f0, $12, $a5, $c9, $c9, $c8, $d0, $1c, $a5, $ca, $c9
+
+PalPacket_9db6:
+	db $79, $31, $08, $00, $0b, $0c, $a5, $ca, $c9, $7e, $d0, $06, $a5, $cb, $c9, $7e
+
+PalPacket_9dc6:
+	db $79, $26, $08, $00, $0b, $39, $cd, $48, $0c, $d0, $34, $a5, $c9, $c9, $80, $d0
+
+PalPacket_9dd6:
+	db $79, $1b, $08, $00, $0b, $ea, $ea, $ea, $ea, $ea, $a9, $01, $cd, $4f, $0c, $d0
+
+PalPacket_9de6:
+	db $79, $10, $08, $00, $0b, $4c, $20, $08, $ea, $ea, $ea, $ea, $ea, $60, $ea, $ea
--- a/data/palettes/predef.pal
+++ b/data/palettes/predef.pal
@@ -1,393 +1,394 @@
+; $00
 	RGB 31, 31, 31
 	RGB 22, 25, 19
 	RGB 16, 21, 30
 	RGB 00, 00, 00
-
+; $01
 	RGB 31, 31, 31
 	RGB 27, 28, 31
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $02
 	RGB 31, 31, 31
 	RGB 24, 28, 19
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $03
 	RGB 31, 31, 31
 	RGB 24, 24, 24
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $04
 	RGB 31, 31, 31
 	RGB 21, 23, 31
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $05
 	RGB 31, 31, 31
 	RGB 24, 21, 27
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $06
 	RGB 31, 31, 31
 	RGB 31, 24, 16
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $07
 	RGB 31, 31, 31
 	RGB 25, 30, 26
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $08
 	RGB 31, 31, 31
 	RGB 31, 25, 31
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $09
 	RGB 31, 31, 31
 	RGB 31, 20, 19
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $0a
 	RGB 31, 31, 31
 	RGB 31, 26, 19
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $0b
 	RGB 31, 31, 31
 	RGB 27, 28, 27
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $0c
 	RGB 31, 31, 31
 	RGB 24, 30, 23
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $0d
 	RGB 31, 31, 31
 	RGB 29, 24, 29
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $0e
 	RGB 31, 31, 31
 	RGB 26, 23, 29
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $0f
 	RGB 31, 31, 31
 	RGB 25, 23, 20
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $10
 	RGB 31, 31, 31
 	RGB 29, 26, 18
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $11
 	RGB 31, 31, 31
 	RGB 31, 21, 18
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $12
 	RGB 31, 31, 31
 	RGB 26, 25, 31
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $13
 	RGB 31, 31, 31
 	RGB 22, 21, 31
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $14
 	RGB 31, 31, 31
 	RGB 22, 25, 21
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $15
 	RGB 31, 31, 31
 	RGB 21, 21, 22
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $16
 	RGB 31, 31, 31
 	RGB 31, 20, 20
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $17
 	RGB 31, 31, 31
 	RGB 26, 26, 26
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $18
 	RGB 31, 31, 31
 	RGB 21, 14, 09
 	RGB 15, 20, 20
 	RGB 00, 00, 00
-
+; $19
 	RGB 31, 31, 31
 	RGB 12, 28, 22
 	RGB 15, 20, 20
 	RGB 00, 00, 00
-
+; $1a
 	RGB 31, 31, 31
 	RGB 07, 07, 07
 	RGB 02, 03, 03
 	RGB 00, 00, 00
-
+; $1b
 	RGB 31, 31, 31
 	RGB 30, 22, 17
 	RGB 16, 14, 19
 	RGB 00, 00, 00
-
+; $1c
 	RGB 31, 31, 31
 	RGB 18, 20, 27
 	RGB 11, 15, 23
 	RGB 00, 00, 00
-
+; $1d
 	RGB 31, 31, 31
 	RGB 31, 20, 10
 	RGB 26, 10, 06
 	RGB 00, 00, 00
-
+; $1e
 	RGB 31, 31, 31
 	RGB 21, 25, 29
 	RGB 14, 19, 25
 	RGB 00, 00, 00
-
+; $1f
 	RGB 31, 31, 31
 	RGB 27, 22, 24
 	RGB 21, 15, 23
 	RGB 00, 00, 00
-
+; $20
 	RGB 31, 31, 31
 	RGB 28, 20, 15
 	RGB 21, 14, 09
 	RGB 00, 00, 00
-
+; $21
 	RGB 31, 31, 31
 	RGB 20, 26, 16
 	RGB 09, 20, 11
 	RGB 00, 00, 00
-
+; $22
 	RGB 31, 31, 31
 	RGB 30, 22, 24
 	RGB 28, 15, 21
 	RGB 00, 00, 00
-
+; $23
 	RGB 31, 31, 31
 	RGB 31, 28, 14
 	RGB 26, 20, 00
 	RGB 00, 00, 00
-
+; $24
 	RGB 31, 31, 31
 	RGB 26, 21, 22
 	RGB 15, 15, 18
 	RGB 00, 00, 00
-
+; $25
 	RGB 31, 31, 31
 	RGB 23, 19, 13
 	RGB 14, 12, 17
 	RGB 00, 00, 00
-
+; $26
 	RGB 31, 31, 31
 	RGB 16, 18, 21
 	RGB 10, 12, 18
 	RGB 00, 00, 00
-
+; $27
 	RGB 31, 31, 31
 	RGB 22, 15, 16
 	RGB 17, 02, 05
 	RGB 00, 00, 00
-
+; $28
 	RGB 31, 31, 31
 	RGB 15, 20, 20
 	RGB 05, 16, 16
 	RGB 00, 00, 00
-
+; $29
 	RGB 31, 31, 31
 	RGB 23, 15, 19
 	RGB 14, 04, 12
 	RGB 00, 00, 00
-
+; $2a
 	RGB 31, 31, 31
 	RGB 20, 17, 18
 	RGB 18, 13, 11
 	RGB 00, 00, 00
-
+; $2b
 	RGB 31, 31, 31
 	RGB 23, 21, 16
 	RGB 12, 12, 10
 	RGB 00, 00, 00
-
+; $2c
 	RGB 31, 31, 31
 	RGB 21, 25, 29
 	RGB 30, 22, 24
 	RGB 00, 00, 00
-
+; $2d
 	RGB 31, 31, 31
 	RGB 26, 23, 16
 	RGB 29, 14, 09
 	RGB 00, 00, 00
-
+; $2e
 	RGB 31, 31, 31
 	RGB 18, 18, 18
 	RGB 10, 10, 10
 	RGB 00, 00, 00
-
+; $2f
 	RGB 31, 31, 31
 	RGB 30, 26, 15
 	RGB 00, 23, 00
 	RGB 00, 00, 00
-
+; $30
 	RGB 31, 31, 31
 	RGB 30, 26, 15
 	RGB 31, 23, 00
 	RGB 00, 00, 00
-
+; $31
 	RGB 31, 31, 31
 	RGB 30, 26, 15
 	RGB 31, 00, 00
 	RGB 00, 00, 00
-
+; $32
 	RGB 31, 31, 31
 	RGB 29, 26, 19
 	RGB 27, 20, 14
 	RGB 00, 00, 00
-
+; $33
 	RGB 31, 31, 31
 	RGB 24, 20, 10
 	RGB 21, 00, 04
 	RGB 00, 00, 00
-
+; $34
 	RGB 31, 31, 31
 	RGB 31, 20, 10
 	RGB 21, 00, 04
 	RGB 00, 00, 00
-
+; $35
 	RGB 31, 31, 31
 	RGB 30, 26, 16
 	RGB 16, 12, 09
 	RGB 00, 00, 00
-
+; $36
 	RGB 31, 31, 31
 	RGB 15, 28, 26
 	RGB 12, 22, 26
 	RGB 03, 16, 14
-
+; $37
 	RGB 31, 31, 31
 	RGB 15, 28, 26
 	RGB 23, 24, 24
 	RGB 00, 00, 00
-
+; $38
 	RGB 31, 31, 24
 	RGB 07, 27, 19
 	RGB 26, 20, 10
 	RGB 19, 12, 08
-
+; $39
 	RGB 31, 31, 31
 	RGB 31, 28, 14
 	RGB 31, 13, 31
 	RGB 00, 00, 00
-
+; $3a
 	RGB 31, 31, 31
 	RGB 16, 18, 21
 	RGB 10, 12, 18
 	RGB 00, 00, 00
-
+; $3b
 	RGB 31, 31, 31
 	RGB 23, 21, 16
 	RGB 12, 12, 10
 	RGB 00, 00, 00
-
+; $3c
 	RGB 31, 31, 31
 	RGB 31, 14, 00
 	RGB 07, 11, 15
 	RGB 00, 00, 00
-
+; $3d
 	RGB 31, 31, 31
 	RGB 26, 21, 22
 	RGB 26, 10, 06
 	RGB 00, 00, 00
-
+; $3e
 	RGB 31, 31, 31
 	RGB 30, 27, 04
 	RGB 24, 20, 11
 	RGB 00, 00, 00
-
+; $3f
 	RGB 31, 31, 31
 	RGB 31, 13, 25
 	RGB 24, 20, 11
 	RGB 00, 00, 00
-
+; $40
 	RGB 31, 31, 31
 	RGB 16, 19, 29
 	RGB 24, 20, 11
 	RGB 00, 00, 00
-
+; $41
 	RGB 31, 31, 31
 	RGB 30, 22, 24
 	RGB 18, 18, 18
 	RGB 16, 10, 07
-
+; $42
 	RGB 31, 31, 31
 	RGB 21, 25, 29
 	RGB 18, 18, 18
 	RGB 16, 10, 07
-
+; $43
 	RGB 31, 31, 31
 	RGB 20, 26, 16
 	RGB 18, 18, 18
 	RGB 16, 10, 07
-
+; $44
 	RGB 31, 31, 31
 	RGB 31, 28, 14
 	RGB 18, 18, 18
 	RGB 16, 10, 07
-
+; $45
 	RGB 31, 31, 31
 	RGB 18, 18, 18
 	RGB 26, 10, 06
 	RGB 00, 00, 00
-
+; $46
 	RGB 31, 31, 31
 	RGB 30, 22, 24
 	RGB 28, 15, 21
 	RGB 00, 00, 00
-
+; $47
 	RGB 31, 31, 31
 	RGB 26, 20, 00
 	RGB 16, 19, 29
 	RGB 00, 00, 00
-
+; $48
 	RGB 31, 31, 31
 	RGB 16, 02, 30
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $49
 	RGB 31, 31, 31
 	RGB 16, 13, 04
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $4a
 	RGB 31, 31, 31
 	RGB 28, 04, 02
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $4b
 	RGB 31, 31, 31
 	RGB 18, 23, 31
 	RGB 15, 20, 31
 	RGB 00, 00, 00
-
+; $4c
 	RGB 31, 31, 31
 	RGB 24, 20, 11
 	RGB 18, 13, 11
 	RGB 00, 00, 00
-
+; $4d
 	RGB 31, 31, 31
 	RGB 31, 31, 31
 	RGB 25, 30, 00
 	RGB 25, 30, 00
-
+; $4e
 	RGB 00, 00, 00
 	RGB 08, 11, 11
 	RGB 21, 21, 21
--- a/data/palettes/roofs.pal
+++ /dev/null
@@ -1,161 +1,0 @@
-; group 0 (unused)
-	RGB 21, 21, 21
-	RGB 11, 11, 11
-	RGB 21, 21, 21
-	RGB 11, 11, 11
-
-; group 1 (Olivine)
-	RGB 14, 17, 31
-	RGB 07, 11, 15
-	RGB 09, 09, 17
-	RGB 05, 07, 13
-
-; group 2 (Mahogany)
-	RGB 12, 19, 00
-	RGB 06, 10, 00
-	RGB 06, 09, 07
-	RGB 04, 05, 06
-
-; group 3
-	RGB 21, 21, 21
-	RGB 11, 11, 11
-	RGB 21, 21, 21
-	RGB 17, 08, 07
-
-; group 4 (Ecruteak)
-	RGB 31, 19, 00
-	RGB 27, 10, 05
-	RGB 15, 07, 02
-	RGB 11, 04, 02
-
-; group 5 (Blackthorn)
-	RGB 11, 10, 16
-	RGB 05, 06, 07
-	RGB 03, 04, 08
-	RGB 00, 00, 00
-
-; group 6 (Cinnabar)
-	RGB 31, 10, 00
-	RGB 18, 06, 00
-	RGB 18, 05, 09
-	RGB 17, 08, 07
-
-; group 7 (Cerulean)
-	RGB 17, 27, 31
-	RGB 05, 15, 31
-	RGB 07, 08, 22
-	RGB 07, 07, 16
-
-; group 8 (Azalea)
-	RGB 22, 20, 10
-	RGB 17, 14, 03
-	RGB 11, 11, 05
-	RGB 10, 09, 07
-
-; group 9 (Lake of Rage)
-	RGB 31, 08, 04
-	RGB 09, 09, 08
-	RGB 18, 05, 09
-	RGB 09, 09, 08
-
-; group 10 (Violet)
-	RGB 24, 14, 31
-	RGB 13, 07, 21
-	RGB 12, 03, 18
-	RGB 09, 03, 15
-
-; group 11 (Goldenrod)
-	RGB 25, 25, 00
-	RGB 20, 17, 08
-	RGB 12, 12, 00
-	RGB 10, 09, 05
-
-; group 12 (Vermilion)
-	RGB 27, 23, 01
-	RGB 23, 11, 00
-	RGB 15, 11, 01
-	RGB 11, 10, 01
-
-; group 13 (Pallet)
-	RGB 27, 28, 31
-	RGB 17, 19, 22
-	RGB 14, 14, 18
-	RGB 10, 09, 13
-
-; group 14 (Pewter)
-	RGB 19, 19, 16
-	RGB 10, 12, 15
-	RGB 09, 09, 11
-	RGB 04, 05, 07
-
-; group 15 (Mount Moon Square)
-	RGB 14, 17, 31
-	RGB 07, 11, 15
-	RGB 09, 13, 19
-	RGB 07, 07, 16
-
-; group 16 (Route 23)
-	RGB 21, 21, 21
-	RGB 13, 13, 13
-	RGB 11, 11, 19
-	RGB 07, 07, 12
-
-; group 17 (Fuchsia)
-	RGB 31, 18, 29
-	RGB 17, 13, 20
-	RGB 14, 06, 12
-	RGB 11, 03, 10
-
-; group 18 (Lavender)
-	RGB 23, 15, 31
-	RGB 16, 05, 31
-	RGB 12, 07, 17
-	RGB 08, 06, 10
-
-; group 19 (Route 28)
-	RGB 21, 21, 25
-	RGB 16, 16, 16
-	RGB 13, 13, 13
-	RGB 07, 07, 07
-
-; group 20
-	RGB 21, 21, 21
-	RGB 11, 11, 11
-	RGB 21, 21, 21
-	RGB 11, 11, 11
-
-; group 21 (Celadon)
-	RGB 19, 31, 15
-	RGB 31, 22, 02
-	RGB 12, 13, 09
-	RGB 09, 12, 03
-
-; group 22 (Cianwood)
-	RGB 15, 10, 31
-	RGB 07, 05, 15
-	RGB 06, 05, 17
-	RGB 02, 02, 08
-
-; group 23 (Viridian)
-	RGB 21, 31, 07
-	RGB 13, 25, 04
-	RGB 09, 14, 08
-	RGB 06, 10, 04
-
-; group 24 (New Bark)
-	RGB 20, 31, 14
-	RGB 11, 23, 05
-	RGB 09, 13, 08
-	RGB 06, 09, 04
-
-; group 25 (Saffron)
-	RGB 31, 26, 00
-	RGB 31, 15, 00
-	RGB 13, 13, 01
-	RGB 08, 08, 01
-
-; group 26 (Cherrygrove)
-	RGB 31, 14, 28
-	RGB 31, 05, 21
-	RGB 14, 07, 17
-	RGB 13, 00, 08
--- a/data/palettes/tileset_bg.pal
+++ /dev/null
@@ -1,227 +1,0 @@
-; morn
-
-; gray
-	RGB 28, 31, 16
-	RGB 21, 21, 21
-	RGB 13, 13, 13
-	RGB 07, 07, 07
-; red
-	RGB 28, 31, 16
-	RGB 31, 19, 24
-	RGB 30, 10, 06
-	RGB 07, 07, 07
-; green
-	RGB 22, 31, 10
-	RGB 12, 25, 01
-	RGB 05, 14, 00
-	RGB 07, 07, 07
-; water
-	RGB 31, 31, 31
-	RGB 08, 12, 31
-	RGB 01, 04, 31
-	RGB 07, 07, 07
-; yellow
-	RGB 28, 31, 16
-	RGB 31, 31, 07
-	RGB 31, 16, 01
-	RGB 07, 07, 07
-; brown
-	RGB 28, 31, 16
-	RGB 24, 18, 07
-	RGB 20, 15, 03
-	RGB 07, 07, 07
-; roof
-	RGB 28, 31, 16
-	RGB 15, 31, 31
-	RGB 05, 17, 31
-	RGB 07, 07, 07
-; text
-	RGB 31, 31, 16
-	RGB 31, 31, 16
-	RGB 14, 09, 00
-	RGB 00, 00, 00
-
-; day
-
-; gray
-	RGB 27, 31, 27
-	RGB 21, 21, 21
-	RGB 13, 13, 13
-	RGB 07, 07, 07
-; red
-	RGB 27, 31, 27
-	RGB 31, 19, 24
-	RGB 30, 10, 06
-	RGB 07, 07, 07
-; green
-	RGB 22, 31, 10
-	RGB 12, 25, 01
-	RGB 05, 14, 00
-	RGB 07, 07, 07
-; water
-	RGB 31, 31, 31
-	RGB 08, 12, 31
-	RGB 01, 04, 31
-	RGB 07, 07, 07
-; yellow
-	RGB 27, 31, 27
-	RGB 31, 31, 07
-	RGB 31, 16, 01
-	RGB 07, 07, 07
-; brown
-	RGB 27, 31, 27
-	RGB 24, 18, 07
-	RGB 20, 15, 03
-	RGB 07, 07, 07
-; roof
-	RGB 27, 31, 27
-	RGB 15, 31, 31
-	RGB 05, 17, 31
-	RGB 07, 07, 07
-; text
-	RGB 31, 31, 16
-	RGB 31, 31, 16
-	RGB 14, 09, 00
-	RGB 00, 00, 00
-
-; nite
-
-; gray
-	RGB 15, 14, 24
-	RGB 11, 11, 19
-	RGB 07, 07, 12
-	RGB 00, 00, 00
-; red
-	RGB 15, 14, 24
-	RGB 14, 07, 17
-	RGB 13, 00, 08
-	RGB 00, 00, 00
-; green
-	RGB 15, 14, 24
-	RGB 08, 13, 19
-	RGB 00, 11, 13
-	RGB 00, 00, 00
-; water
-	RGB 15, 14, 24
-	RGB 05, 05, 17
-	RGB 03, 03, 10
-	RGB 00, 00, 00
-; yellow
-	RGB 30, 30, 11
-	RGB 16, 14, 18
-	RGB 16, 14, 10
-	RGB 00, 00, 00
-; brown
-	RGB 15, 14, 24
-	RGB 12, 09, 15
-	RGB 08, 04, 05
-	RGB 00, 00, 00
-; roof
-	RGB 15, 14, 24
-	RGB 13, 12, 23
-	RGB 11, 09, 20
-	RGB 00, 00, 00
-; text
-	RGB 31, 31, 16
-	RGB 31, 31, 16
-	RGB 14, 09, 00
-	RGB 00, 00, 00
-
-; dark
-
-; gray
-	RGB 01, 01, 02
-	RGB 00, 00, 00
-	RGB 00, 00, 00
-	RGB 00, 00, 00
-; red
-	RGB 01, 01, 02
-	RGB 00, 00, 00
-	RGB 00, 00, 00
-	RGB 00, 00, 00
-; green
-	RGB 01, 01, 02
-	RGB 00, 00, 00
-	RGB 00, 00, 00
-	RGB 00, 00, 00
-; water
-	RGB 01, 01, 02
-	RGB 00, 00, 00
-	RGB 00, 00, 00
-	RGB 00, 00, 00
-; yellow
-	RGB 30, 30, 11
-	RGB 00, 00, 00
-	RGB 00, 00, 00
-	RGB 00, 00, 00
-; brown
-	RGB 01, 01, 02
-	RGB 00, 00, 00
-	RGB 00, 00, 00
-	RGB 00, 00, 00
-; roof
-	RGB 01, 01, 02
-	RGB 00, 00, 00
-	RGB 00, 00, 00
-	RGB 00, 00, 00
-; text
-	RGB 31, 31, 16
-	RGB 31, 31, 16
-	RGB 14, 09, 00
-	RGB 00, 00, 00
-
-; indoor
-
-; gray
-	RGB 30, 28, 26
-	RGB 19, 19, 19
-	RGB 13, 13, 13
-	RGB 07, 07, 07
-; red
-	RGB 30, 28, 26
-	RGB 31, 19, 24
-	RGB 30, 10, 06
-	RGB 07, 07, 07
-; green
-	RGB 18, 24, 09
-	RGB 15, 20, 01
-	RGB 09, 13, 00
-	RGB 07, 07, 07
-; water
-	RGB 30, 28, 26
-	RGB 15, 16, 31
-	RGB 09, 09, 31
-	RGB 07, 07, 07
-; yellow
-	RGB 30, 28, 26
-	RGB 31, 31, 07
-	RGB 31, 16, 01
-	RGB 07, 07, 07
-; brown
-	RGB 26, 24, 17
-	RGB 21, 17, 07
-	RGB 16, 13, 03
-	RGB 07, 07, 07
-; roof
-	RGB 30, 28, 26
-	RGB 17, 19, 31
-	RGB 14, 16, 31
-	RGB 07, 07, 07
-; text
-	RGB 31, 31, 16
-	RGB 31, 31, 16
-	RGB 14, 09, 00
-	RGB 00, 00, 00
-
-; overworld water
-
-; morn/day
-	RGB 23, 23, 31
-	RGB 18, 19, 31
-	RGB 13, 12, 31
-	RGB 07, 07, 07
-; nite
-	RGB 15, 13, 27
-	RGB 10, 09, 20
-	RGB 04, 03, 18
-	RGB 00, 00, 00
--- /dev/null
+++ b/data/palettes/unknown/49757.pal
@@ -1,0 +1,39 @@
+	RGB 31, 31, 63
+	RGB 00, 00, 00
+	RGB 00, 00, 00
+	RGB 00, 00, 00
+
+	RGB 31, 31, 63
+	RGB 00, 00, 00
+	RGB 00, 00, 00
+	RGB 00, 00, 00
+
+	RGB 04, 02, 15
+	RGB 21, 00, 21
+	RGB 31, 00, 00
+	RGB 31, 31, 31
+
+	RGB 04, 02, 15
+	RGB 21, 00, 21
+	RGB 30, 16, 26
+	RGB 31, 31, 31
+
+	RGB 04, 02, 15
+	RGB 21, 00, 21
+	RGB 16, 16, 16
+	RGB 31, 31, 31
+
+	RGB 04, 02, 15
+	RGB 21, 00, 21
+	RGB 31, 12, 12
+	RGB 31, 31, 31
+
+	RGB 04, 02, 15
+	RGB 21, 00, 21
+	RGB 07, 08, 31
+	RGB 31, 31, 31
+
+	RGB 04, 02, 15
+	RGB 21, 00, 21
+	RGB 29, 28, 09
+	RGB 31, 31, 31
--- /dev/null
+++ b/data/palettes/unknown/4985a.asm
@@ -1,0 +1,15 @@
+	db $ab, $03, $57, $24, $ac, $0e, $13, $32
+
+	db $be, $30, $5b, $4c, $47, $60, $ed, $f2
+
+	db $ab, $03, $55, $26, $aa, $0a, $13, $3a
+
+	db $be, $28, $33, $24, $6e, $71, $df, $b0
+
+	db $a8, $00, $e5, $e0, $9a, $fc, $f4, $2c
+
+	db $fe, $4c, $a3, $5e, $c6, $3a, $ab, $4d
+
+	db $a8, $00, $b5, $b0, $de, $e8, $fc, $1c
+
+	db $ba, $66, $f7, $0e, $ba, $5e, $43, $bd
--- /dev/null
+++ b/data/palettes/unknown/b6f1.pal
@@ -1,0 +1,24 @@
+	RGB 31, 31, 31
+	RGB 18, 23, 31
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 22, 00, 31
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 31, 00, 00
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 25, 22, 00
+	RGB 15, 20, 31
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 23, 26, 31
+	RGB 18, 23, 31
+	RGB 00, 00, 00
--- /dev/null
+++ b/data/palettes/unknown/b719.pal
@@ -1,0 +1,9 @@
+	RGB 31, 31, 31
+	RGB 07, 06, 03
+	RGB 07, 06, 03
+	RGB 07, 06, 03
+
+	RGB 31, 31, 31
+	RGB 31, 31, 00
+	RGB 26, 22, 00
+	RGB 00, 00, 00
--- /dev/null
+++ b/data/palettes/unknown/b789.pal
@@ -1,0 +1,19 @@
+	RGB 31, 31, 31
+	RGB 30, 22, 24
+	RGB 18, 18, 18
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 10, 11, 31
+	RGB 18, 18, 18
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 12, 31, 11
+	RGB 18, 18, 18
+	RGB 00, 00, 00
+
+	RGB 31, 31, 31
+	RGB 29, 26, 05
+	RGB 18, 18, 18
+	RGB 00, 00, 00
--- a/data/sgb_border_map.asm
+++ b/data/sgb_border_map.asm
@@ -1,4 +1,4 @@
-
+SGBBorderMap:
 	db $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $14, $14, $15, $14, $16, $14, $17, $14, $17, $54, $16, $54, $15, $54, $14, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14
 	db $01, $14, $02, $14, $03, $14, $03, $54, $02, $54, $01, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $24, $14, $25, $14, $26, $14, $07, $14, $07, $54, $26, $54, $25, $54, $24, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $54, $01, $14, $02, $14, $03, $14, $03, $54, $02, $54, $01, $54
 	db $11, $14, $12, $14, $13, $14, $13, $54, $12, $54, $11, $54, $10, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $24, $14, $34, $14, $35, $14, $35, $54, $34, $54, $33, $54, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $07, $14, $10, $14, $11, $14, $12, $14, $13, $14, $13, $54, $12, $54, $11, $54
--- a/data/unown_words.asm
+++ b/data/unown_words.asm
@@ -38,15 +38,15 @@
 	dw UnownWord26
 ; fba90
 
-UnownWord1:	 unownword "ANGRY"
-UnownWord2:	 unownword "BEAR"
-UnownWord3:	 unownword "CHASE"
-UnownWord4:	 unownword "DIRECT"
-UnownWord5:	 unownword "ENGAGE"
-UnownWord6:	 unownword "FIND"
-UnownWord7:	 unownword "GIVE"
-UnownWord8:	 unownword "HELP"
-UnownWord9:	 unownword "INCREASE"
+UnownWord1:  unownword "ANGRY"
+UnownWord2:  unownword "BEAR"
+UnownWord3:  unownword "CHASE"
+UnownWord4:  unownword "DIRECT"
+UnownWord5:  unownword "ENGAGE"
+UnownWord6:  unownword "FIND"
+UnownWord7:  unownword "GIVE"
+UnownWord8:  unownword "HELP"
+UnownWord9:  unownword "INCREASE"
 UnownWord10: unownword "JOIN"
 UnownWord11: unownword "KEEP"
 UnownWord12: unownword "LAUGH"
--- a/docs/assembly_programming.md
+++ b/docs/assembly_programming.md
@@ -1,13 +1,19 @@
 # Assembly Programming
 
 - [**RGBDS documentation**][rgbds-doc]: Includes information on the RGBDS tools and the assembly language syntax.
+   - [**GBZ80 instructions**][gbz80-instructions]: List of CPU instructions and their effects.
+   - [**RGBASM features**][rgbasm-features]: How to use the assembler features: constants, labels, sections, macros, etc.
+   - [**RGBLINK features**][rgblink-features]: How to use the linker, including the [pokecrystal.link](/pokecrystal.link) linkerscript.
 - [**Pan Docs**][pan-docs]: Everything You Always Wanted To Know About GAMEBOY (but were afraid to ask).
-- [**GameBoy Programming Manual][gb-manual]: The official GameBoy programming and hardware manual by Nintendo.
+- [**GameBoy Programming Manual**][gb-manual]: The official GameBoy programming and hardware manual by Nintendo.
 - [**GameBoy Opcode Summary**][gb-opcodes]: Describes the opcodes of GameBoy assembly language.
 - [**GameBoy Memory Map**][gb-memory-map]: Describes the GameBoy Color address space.
 - [**awesome-gbdev**][awesome-gbdev]: A curated list of Game Boy development resources such as tools, docs, emulators, related projects and open-source ROMs.
 
 [rgbds-doc]: https://rednex.github.io/
+[rgbasm-features]: https://rednex.github.io/rgbds/rgbasm.5.html
+[rgblink-features]: https://rednex.github.io/rgbds/rgblink.5.html
+[gbz80-instructions]: https://rednex.github.io/rgbds/gbz80.7.html
 [pan-docs]: http://bgb.bircd.org/pandocs.htm
 [gb-manual]: https://ia801906.us.archive.org/19/items/GameBoyProgManVer1.1/GameBoyProgManVer1.1.pdf
 [gb-opcodes]: http://www.devrs.com/gb/files/opcodes.html
--- a/docs/bugs_and_glitches.md
+++ b/docs/bugs_and_glitches.md
@@ -72,16 +72,16 @@
 	sla l
 	rl h
 
-	ld a, 999 / $100
+	ld a, HIGH(MAX_STAT_VALUE)
 	cp h
 	jr c, .cap
-	ld a, 999 % $100
+	ld a, LOW(MAX_STAT_VALUE)
 	cp l
 	ret nc
 
 .cap
-	ld h, 999 / $100
-	ld l, 999 % $100
+	ld h, HIGH(MAX_STAT_VALUE)
+	ld l, LOW(MAX_STAT_VALUE)
 	ret
 ```
 
@@ -128,16 +128,16 @@
 	scf
 	rr c
 
-	ld a, 999 / $100
+	ld a, HIGH(MAX_STAT_VALUE)
 	cp b
 	jr c, .cap
-	ld a, 999 % $100
+	ld a, LOW(MAX_STAT_VALUE)
 	cp c
 	ret nc
 
 .cap
-	ld b, 999 / $100
-	ld c, 999 % $100
+	ld b, HIGH(MAX_STAT_VALUE)
+	ld c, LOW(MAX_STAT_VALUE)
 	ret
 ```
 
@@ -1398,7 +1398,7 @@
 	push af
 	ld [rSVBK], a
 	xor a
-	ld hl, $d000
+	ld hl, wRAM1Start
 	ld bc, $1000
 	call ByteFill
 	pop af
--- a/docs/move_anim_commands.md
+++ b/docs/move_anim_commands.md
@@ -5,7 +5,26 @@
 
 ## `$00`−`$EF`: `anim_wait` *length*
 
-## `$D0`: `anim_obj` *object*, *x*, *y*, *param*
+## `$D0`: `anim_obj` *object*, *x1*, *x2*, *y1*, *y2*, *param*
+
+The *x1*/*x2* and *y1*/*y2* pairs specify the position on screen of the animation object.
+*x1*/*y1* specify a tile position, and *x2*/*y2* specify a pixel offset from that tile. 
+
+Values for *x2*/*y2* are in the 0-7 range, since 8 pixels make a tile.
+
+Values for *x1* are between -16 to 31. In practice *x1* starts between 0 to 15, then between -16 to -10. Negative values are relative to the opponent, while positive values are relative to the player. Useful values are between 14 to -10 (for the opponent) and between 0 to 13 (for the player).
+
+Some sample values are:
+
+- 0: player left border
+- 6: player center
+- -15: enemy center
+- -10: enemy right border
+
+Values for *y1* are also between -16 to 31; the useful range is between 2 to 14.
+Values between 2 to 8 will be in the opponent's area (2 being the top border and 8 being the
+bottom border), and values between 8 to 14 will be in the player's area (again, 8 being the top border and 14 being the bottom border).
+The center of the body is often 2 to 4 tiles away from the border (i.e., 5-6 for the opponent or 10-11 for the player).
 
 ## `$D1`: `anim_1gfx` *gfx*
 
--- a/docs/music_commands.md
+++ b/docs/music_commands.md
@@ -2,99 +2,131 @@
 
 Defined in [macros/scripts/audio.asm](/macros/scripts/audio.asm) and [audio/engine.asm:MusicCommands](/audio/engine.asm).
 
+See also: [Sound Engine Commands](https://github.com/pret/pokecrystal/wiki/Sound-Engine-Commands)
 
+
 ## `musicheader` *n*, *index*, *address*
 
 ## `cry_header` *n*, *index*, *address*
 
 ## `note` *pitch*, *length*
-	(Used on all channels)
-	The high nibble is the note to play, 0 is rest, 1 is C_ 2 is C# ...etc... $C is B_
-	The low nibble is the length of the note. 1 gets added to this, so 0 still has a length.
 
+(Used on all channels)
+
+The high nibble is the note to play. 0 is rest, 1 is `C_`, 2 is `C#`, etc; `$C` is `B_`.
+The low nibble is the length of the note. 1 gets added to this, so 0 still has a length.
+
 ## `sound` *pitch*, *octave*, *intensity*, *frequency*
 
 ## `noise` *pitch*, *duration*, *intensity*, *frequency*
 
 ## `$D0`−`$D7`: `octave` *n*
-	(Used in channels 1-3)
-	Sets the octave for the notes played on the channel.
-	$D7 is the lowest octave, where as $D0 is the highest.
 
+(Used in channels 1-3)
+
+Sets the octave for the notes played on the channel.
+`$D7` is the lowest octave, whereas `$D0` is the highest.
+
 ## `$D8`: `notetype` *length*[, *intensity*]
-	(Used in channels 1-4)(When using in channel 4, the intensity byte is not needed)
-	Sets the length multiplier of notes on the channel, and the envelope for channels 1-3 (see "intensity")
-	The first byte only reads the lower 4-bits, and multiplies it to the note length. A larger number means slower playback/longer notes. $C is commonly used for a normal timeframe.
-	The second byte is identical to the first byte in the intensity command.
 
+(Used in channels 1-4) (When using in channel 4, the *intensity* byte is not needed)
+
+Sets the length multiplier of notes on the channel, and the envelope for channels 1-3 (see `intensity`).
+The first byte only reads the lower 4 bits, and multiplies it by the note length. A larger number means slower playback/longer notes. `$C` is commonly used for a normal timeframe.
+
+The second byte is identical to the first byte in the `intensity` command.
+
 ## `$D9`: `pitchoffset` *octave*, *key*
-	(Used in channels 1-3)
-	Transposes all notes played on the channel by a value.
-	The high nibble determins how many octaves to subtract, while the low nibble is how many note values to add.
-	Ex: Setting a value of $13 would make a C_4 play as a D#3
 
+(Used in channels 1-3)
+
+Transposes all notes played on the channel by a value.
+The high nibble determins how many octaves to subtract, while the low nibble is how many note values to add.
+Ex: Setting a value of `$13` would make a `C_`4 play as a `D#`3.
+
 ## `$DA`: `tempo` *tempo*
-	Sets the tempo for all playing channels. This should only be called on channel 1.
-	The formula to convert from this tempo to BPM is: BPM = 19200 / Tempo
-	This formula also works backwards to convert BPM to tempo: Tempo = 19200 / BPM
-	Only set or change this value when all playing channels are triggering a note or rest at the same time, otherwise desyncs may happen.
 
+(Used in channel 1)
+
+Sets the tempo for all playing channels. This should only be called on channel 1.
+
+The formula to convert from this tempo to BPM is: BPM = 19200 / Tempo
+This formula also works backwards to convert BPM to tempo: Tempo = 19200 / BPM
+
+Only set or change this value when all playing channels are triggering a note or rest at the same time, otherwise desyncs may happen.
+
 ## `$DB`: `dutycycle` *duty_cycle*
-	(Used on channels 1&2)
-	Sets the square duty (sound) for the current channel. To change the sound for channel 3, use intensity. Only accepted values are 0-3.
-	0=12.5% waveform _______-
-	1=25% waveform   ______--
-	2=50% waveform   ____----
-	3=75% waveform   __------ (Sounds the same as 25%)
 
+(Used on channels 1&2)
+
+Sets the square duty (sound) for the current channel. To change the sound for channel 3, use intensity. The only accepted values are 0-3.
+
+- 0 = 12.5% waveform: `_______¯`
+- 1 = 25% waveform: `______¯¯`
+- 2 = 50% waveform: `____¯¯¯¯`
+- 3 = 75% waveform: `__¯¯¯¯¯¯` (sounds the same as 25%)
+
 ## `$DC`: `intensity` *intensity*
-	(Used on channels 1-3)(Used to set instrument on channel 3)
-	For channels 1&2:
-		This sets the volume and fade of the notes. The high nibble is the starting volume, 0 is mute, $F is max. Bit 3 determines the fade direction (0=Fade to silence, 1=Fade to max volume). The last 3 bits is how fast the fade happens. 0 is no fade, 1 is fastest fade, 7 is slowest fade.
-	For channel 3:
-		The high nibble sets the volume of channel 3. Only 4 values are accepted (0=Mute, 1=100% volume, 2=50% volume, 3=25% volume). The low nibble sets the instrument/waveform for channel 3 to play. Crystal natively has 10 instruments, values 0-9.
 
+(Used on channels 1-3) (Used to set instrument on channel 3)
+
+For channels 1&2:
+This sets the volume and fade of the notes. The high nibble is the starting volume, 0 is mute, $F is max. Bit 3 determines the fade direction (0=Fade to silence, 1=Fade to max volume). The last 3 bits is how fast the fade happens. 0 is no fade, 1 is fastest fade, 7 is slowest fade.
+
+For channel 3:
+The high nibble sets the volume of channel 3. Only 4 values are accepted (0=Mute, 1=100% volume, 2=50% volume, 3=25% volume). The low nibble sets the instrument/waveform for channel 3 to play. Crystal natively has 10 instruments, values 0-9.
+
 ## `$DD`: `soundinput` *input*
 
 ## `$DE`: `sound_duty` *a*, *b*, *c*, *d*
-	(Used on channels 1&2)
-	This cycles the channel through 4 duty definitions, one per frame.
-	Each pair of bits defines a duty, same as the dutycycle command.
-	This is mostly only used in cries, sfx, and Jigglypuff's song in RBY.
 
+(Used on channels 1&2)
+
+This cycles the channel through 4 duty definitions, one per frame.
+Each pair of bits defines a duty, same as the `dutycycle` command.
+This is mostly only used in cries, SFX, and Jigglypuff's song in RBY.
+
 ## `$DF`: `togglesfx`
 
 ## `$E0`: `slidepitchto` *duration*, *octave*, *pitch*
-	(Used on channel 1)
-	This bends the pitch of the note played next, and only that note.
-	The first byte tells how many frames to play the destination note for, before the length of the note is up.
-	The high nibble of the second byte is the octave of the destination note.
-	The low nibble of the second byte is the destination note. If rest is used as the destination note, then the whole destination pitch becomes $0000 (the lowest pitch).
 
+(Used on channel 1)
+
+This bends the pitch of the note played next, and only that note.
+The first byte tells how many frames to play the destination note for, before the length of the note is up.
+The high nibble of the second byte is the octave of the destination note.
+The low nibble of the second byte is the destination note. If rest is used as the destination note, then the whole destination pitch becomes `$0000` (the lowest pitch).
+
 ## `$E1`: `vibrato` *delay*, *extent*
-	(Used on channels 1-3)
-	Modifies pitch after the timer runs out, making notes sound less "flat"
-	First byte will set the delay, decrementing by one each frame. When it tries subtracting from 0, it starts decrementing from the speed timer.
-	Second byte, high nibble is the speed timer. It will decrement by one each frame, when it tries decrementing from 0, it mods the frequencey by half of pitch depth, and resets itself to it's initial value.
-	Second byte, low nibble is the pitch depth. Half of this value will alternate between adding to the pitch, and subtracting from the pitch each time speed timer resets. When this is an odd number, the value added to the pitch will be greater than the value subtracted from the pitch.
-	EX. normal pitch of 405, if pitch depth=3, it will alternate between 407 and 404. Speed timer does NOT reset when a new note is played. only when the song stops or changes. (also, because a timer counts 0, a timer of 5 will take 6 frames to change)
 
+(Used on channels 1-3)
+
+Modifies pitch after the timer runs out, making notes sound less "flat".
+First byte will set the delay, decrementing by one each frame. When it tries subtracting from 0, it starts decrementing from the speed timer.
+Second byte, high nibble is the speed timer. It will decrement by one each frame, when it tries decrementing from 0, it mods the frequencey by half of pitch depth, and resets itself to it's initial value.
+Second byte, low nibble is the pitch depth. Half of this value will alternate between adding to the pitch, and subtracting from the pitch each time speed timer resets. When this is an odd number, the value added to the pitch will be greater than the value subtracted from the pitch.
+Ex: normal pitch of 405, if pitch depth = 3, it will alternate between 407 and 404. Speed timer does NOT reset when a new note is played. only when the song stops or changes. (Also, because a timer counts 0, a timer of 5 will take 6 frames to change.)
+
 ## `$E2`: `unknownmusic0xe2` *unknown*
 
 ## `$E3`: `togglenoise` *id*
-	(Used on channel 4)
-	Sets the "drum kit" to be used. This needs to be called before channel 4 can make any noise.
-	Calling it more than once in a song will mute the channel. (Keep it out of loops!)
 
+(Used on channel 4)
+
+Sets the "drum kit" to be used. This needs to be called before channel 4 can make any noise.
+Calling it more than once in a song will mute the channel. (Keep it out of loops!)
+
 ## `$E4`: `panning` *tracks*
 
 ## `$E5`: `volume` *volume*
 
 ## `$E6`: `tone` *tone*
-	(Used on channel 1-3)
-	This modifies the pitch of the notes (fine tuning).
-	It makes notes sound better if multiple channels play the same note simultaniously.
-	A lot of GSC songs set the main melody channel with a value of 1, and the secondary channel (not bass) as 2.
+
+(Used on channel 1-3)
+
+This modifies the pitch of the notes (fine tuning).
+It makes notes sound better if multiple channels play the same note simultaneously.
+A lot of GSC songs set the main melody channel with a value of 1, and the secondary channel (not bass) as 2.
 
 ## `$E7`: `unknownmusic0xe7` *unknown*
 
--- a/engine/breeding.asm
+++ b/engine/breeding.asm
@@ -719,7 +719,7 @@
 	call PlayMusic
 	call EnableLCD
 	hlcoord 7, 4
-	ld b, VBGMap0 / $100
+	ld b, HIGH(VBGMap0)
 	ld c, $31 ; Egg tiles start here
 	ld a, EGG
 	call Hatch_UpdateFrontpicBGMapCenter
@@ -768,7 +768,7 @@
 	call ClearSprites
 	call Hatch_InitShellFragments
 	hlcoord 6, 3
-	ld b, VBGMap0 / $100
+	ld b, HIGH(VBGMap0)
 	ld c, $00 ; Hatchling tiles start here
 	ld a, [wJumptableIndex]
 	call Hatch_UpdateFrontpicBGMapCenter
--- a/engine/card_flip.asm
+++ b/engine/card_flip.asm
@@ -644,10 +644,10 @@
 	ld a, e
 	and $1c ; get level
 	srl a
-	add .Jumptable % $100
+	add LOW(.Jumptable)
 	ld l, a
 	ld a, 0
-	adc .Jumptable / $100
+	adc HIGH(.Jumptable)
 	ld h, a
 	ld a, [hli]
 	ld h, [hl]
@@ -1185,7 +1185,7 @@
 
 .IsCoinCaseFull: ; e0833
 	ld a, [Coins]
-	cp MAX_COINS / $100
+	cp HIGH(MAX_COINS)
 	jr c, .less
 	jr z, .check_low
 	jr .more
@@ -1192,7 +1192,7 @@
 
 .check_low
 	ld a, [Coins + 1]
-	cp MAX_COINS % $100
+	cp LOW(MAX_COINS)
 	jr c, .less
 
 .more
--- a/engine/cgb_layouts.asm
+++ b/engine/cgb_layouts.asm
@@ -145,7 +145,7 @@
 	ld bc, 6 * SCREEN_WIDTH
 	ld a, PAL_BATTLE_BG_TEXT
 	call ByteFill
-	ld hl, Palettes_979c
+	ld hl, BattleObjectPals
 	ld de, UnknOBPals palette PAL_BATTLE_OB_GRAY
 	ld bc, 6 palettes
 	ld a, BANK(UnknOBPals)
@@ -621,8 +621,8 @@
 	ld a, [PlayerHPPal]
 	call GetPlayerOrMonPalettePointer
 	call LoadPalette_White_Col1_Col2_Black
-	ld hl, Palettes_979c
-	ld de, UnknOBPals palette 2
+	ld hl, BattleObjectPals
+	ld de, UnknOBPals palette PAL_BATTLE_OB_GRAY
 	ld bc, 6 palettes
 	ld a, BANK(UnknOBPals)
 	call FarCopyWRAM
--- a/engine/color.asm
+++ b/engine/color.asm
@@ -43,6 +43,7 @@
 	and a
 	ret
 
+; unreferenced
 CheckContestMon:
 ; Check a mon's DVs at hl in the bug catching contest.
 ; Return carry if its DVs are good enough to place in the contest.
@@ -108,7 +109,8 @@
 	call WipeAttrMap
 	ret
 
-SGB_ApplyPartyMenuHPPals: ; 8ade SGB layout $fc
+; SGB layout for SCGB_PARTY_MENU_HP_PALS
+SGB_ApplyPartyMenuHPPals: ; 8ade
 	ld hl, wHPPals
 	ld a, [wSGBPals]
 	ld e, a
@@ -343,11 +345,11 @@
 	ret
 
 .Enemy:
-	ld de, BGPals + 2 palettes + 2
+	ld de, BGPals palette PAL_BATTLE_BG_ENEMY_HP + 2
 	jr .okay
 
 .Player:
-	ld de, BGPals + 3 palettes + 2
+	ld de, BGPals palette PAL_BATTLE_BG_PLAYER_HP + 2
 
 .okay
 	ld l, c
@@ -395,11 +397,11 @@
 	ld a, $5
 	ld [rSVBK], a
 	ld a, [hli]
-	ld [UnknBGPals], a
-	ld [UnknBGPals + 8 * 2], a
+	ld [UnknBGPals palette 0], a
+	ld [UnknBGPals palette 2], a
 	ld a, [hl]
-	ld [UnknBGPals + 1], a
-	ld [UnknBGPals + 8 * 2 + 1], a
+	ld [UnknBGPals palette 0 + 1], a
+	ld [UnknBGPals palette 2 + 1], a
 	pop af
 	ld [rSVBK], a
 	call ApplyPals
@@ -457,7 +459,7 @@
 ; XXX
 	ld hl, .Palette
 	ld de, UnknBGPals
-	ld bc, 8
+	ld bc, 1 palettes
 	ld a, $5
 	call FarCopyWRAM
 	call ApplyPals
@@ -521,10 +523,10 @@
 	ld a, $5
 	ld [rSVBK], a
 
-	ld a, $7fff % $100
+	ld a, LOW(palred 31 + palgreen 31 + palblue 31)
 	ld [de], a
 	inc de
-	ld a, $7fff / $100
+	ld a, HIGH(palred 31 + palgreen 31 + palblue 31)
 	ld [de], a
 	inc de
 
@@ -574,7 +576,7 @@
 	ld [rSVBK], a
 
 	ld hl, UnknBGPals
-	ld c, 8
+	ld c, 1 palettes
 .loop
 	ld a, $ff
 	ld [hli], a
@@ -655,7 +657,8 @@
 	ld [rVBK], a
 	ret
 
-CGB_ApplyPartyMenuHPPals: ; 96f3 CGB layout $fc
+; CGB layout for SCGB_PARTY_MENU_HP_PALS
+CGB_ApplyPartyMenuHPPals: ; 96f3
 	ld hl, wHPPals
 	ld a, [wSGBPals]
 	ld e, a
@@ -746,7 +749,7 @@
 Function9779: mobile
 	call CheckCGB
 	ret z
-	ld hl, Palettes_979c
+	ld hl, BattleObjectPals
 	ld a, $90
 	ld [rOBPI], a
 	ld c, 6 palettes
@@ -755,7 +758,7 @@
 	ld [rOBPD], a
 	dec c
 	jr nz, .loop
-	ld hl, Palettes_979c
+	ld hl, BattleObjectPals
 	ld de, UnknOBPals palette 2
 	ld bc, 2 palettes
 	ld a, $5
@@ -762,8 +765,8 @@
 	call FarCopyWRAM
 	ret
 
-Palettes_979c:
-INCLUDE "data/palettes/979c.pal"
+BattleObjectPals:
+INCLUDE "data/palettes/battle_objects.pal"
 
 Function97cc:
 ; XXX
@@ -909,9 +912,9 @@
 	ld [rBGPI], a
 	ld c, 4 * 8
 .bgpals_loop
-	ld a, $7fff % $100
+	ld a, LOW(palred 31 + palgreen 31 + palblue 31)
 	ld [rBGPD], a
-	ld a, $7fff / $100
+	ld a, HIGH(palred 31 + palgreen 31 + palblue 31)
 	ld [rBGPD], a
 	dec c
 	jr nz, .bgpals_loop
@@ -919,9 +922,9 @@
 	ld [rOBPI], a
 	ld c, 4 * 8
 .obpals_loop
-	ld a, $7fff % $100
+	ld a, LOW(palred 31 + palgreen 31 + palblue 31)
 	ld [rOBPD], a
-	ld a, $7fff / $100
+	ld a, HIGH(palred 31 + palgreen 31 + palblue 31)
 	ld [rOBPD], a
 	dec c
 	jr nz, .obpals_loop
@@ -940,9 +943,9 @@
 .LoadWhitePals:
 	ld c, 4 * 16
 .loop
-	ld a, $7fff % $100
+	ld a, LOW(palred 31 + palgreen 31 + palblue 31)
 	ld [hli], a
-	ld a, $7fff / $100
+	ld a, HIGH(palred 31 + palgreen 31 + palblue 31)
 	ld [hli], a
 	dec c
 	jr nz, .loop
@@ -1006,7 +1009,7 @@
 
 SGB_ClearVRAM:
 	ld hl, VTiles0
-	ld bc, $2000
+	ld bc, VRAM_End - VTiles0
 	xor a
 	call ByteFill
 	ret
@@ -1067,7 +1070,7 @@
 	ld [rBGP], a
 	ld hl, PredefPals
 	ld de, VTiles1
-	ld bc, $1000
+	ld bc, $100 tiles
 	call CopyData
 	call DrawDefaultTiles
 	ld a, $e3
@@ -1194,90 +1197,13 @@
 	jr nz, .wait
 	ret
 
-BlkPacket_9a86:
-	db $21, $01, $03, $00, $00, $00, $13, $11, $00, $00, $00, $00, $00, $00, $00, $00
+INCLUDE "data/palettes/blk_packets.asm"
 
-BlkPacket_9a96:
-	db $21, $01, $07, $05, $00, $0a, $13, $0d, $00, $00, $00, $00, $00, $00, $00, $00
+INCLUDE "data/palettes/pal_packets.asm"
 
-BlkPacket_9aa6:
-	db $22, $05, $07, $0a, $00, $0c, $13, $11, $03, $05, $01, $00, $0a, $03, $03, $00
-	db $0a, $08, $13, $0a, $03, $0a, $00, $04, $08, $0b, $03, $0f, $0b, $00, $13, $07
-
-BlkPacket_9ac6:
-	db $21, $01, $07, $05, $00, $01, $07, $07, $00, $00, $00, $00, $00, $00, $00, $00
-
-BlkPacket_9ad6:
-	db $21, $01, $07, $05, $0b, $01, $13, $02, $00, $00, $00, $00, $00, $00, $00, $00
-
-BlkPacket_9ae6:
-	db $21, $01, $07, $05, $01, $01, $08, $08, $00, $00, $00, $00, $00, $00, $00, $00
-
-BlkPacket_9af6:
-	db $21, $01, $07, $05, $07, $05, $0d, $0b, $00, $00, $00, $00, $00, $00, $00, $00
-
-BlkPacket_9b06:
-	db $22, $05, $03, $05, $00, $00, $13, $0b, $03, $0a, $00, $04, $13, $09, $02, $0f
-	db $00, $06, $13, $07, $03, $00, $04, $04, $0f, $09, $03, $00, $00, $0c, $13, $11
-
-BlkPacket_9b26:
-	db $23, $07, $07, $10, $00, $00, $02, $0c, $02, $00, $0c, $00, $12, $01, $02, $00
-	db $0c, $02, $12, $03, $02, $00, $0c, $04, $12, $05, $02, $00, $0c, $06, $12, $07
-	db $02, $00, $0c, $08, $12, $09, $02, $00, $0c, $0a, $12, $0b, $00, $00, $00, $00
-
-BlkPacket_9b56:
-	db $22, $03, $07, $20, $00, $00, $13, $04, $03, $0f, $00, $06, $13, $11, $03, $05
-	db $0f, $01, $12, $04, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-
-BlkPacket_9b76:
-	db $21, $01, $07, $10, $00, $00, $13, $05, $00, $00, $00, $00, $00, $00, $00, $00
-
-BlkPacket_9b86:
-	db $21, $02, $07, $0a, $00, $04, $13, $0d, $03, $05, $00, $06, $13, $0b, $00, $00
-
-PalPacket_9b96:	db $51, $48, $00, $49, $00, $4a, $00, $4b, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9ba6:	db $51, $2b, $00, $24, $00, $20, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9bb6:	db $51, $41, $00, $42, $00, $43, $00, $44, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9bc6:	db $51, $4c, $00, $4c, $00, $4c, $00, $4c, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9bd6:	db $51, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9be6:	db $51, $36, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9bf6:	db $51, $37, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9c06:	db $51, $38, $00, $39, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9c16:	db $51, $3a, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9c26:	db $51, $3b, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9c36:	db $51, $3c, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9c46:	db $51, $39, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9c56:	db $51, $2e, $00, $2f, $00, $30, $00, $31, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9c66:	db $51, $1a, $00, $1a, $00, $1a, $00, $1a, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9c76:	db $51, $32, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9c86:	db $51, $3c, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9c96:	db $51, $3d, $00, $3e, $00, $3f, $00, $40, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9ca6:	db $51, $33, $00, $34, $00, $1b, $00, $1f, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9cb6:	db $51, $1b, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9cc6:	db $51, $1c, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9cd6:	db $51, $35, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9ce6:	db $01, $ff, $7f, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9cf6:	db $09, $ff, $7f, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9d06:	db $59, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9d16:	db $89, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9d26:	db $89, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9d36:	db $99, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9d46:	db $a1, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9d56:	db $b9, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9d66:	db $b9, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9d76:	db $79, $5d, $08, $00, $0b, $8c, $d0, $f4, $60, $00, $00, $00, $00, $00, $00, $00
-PalPacket_9d86:	db $79, $52, $08, $00, $0b, $a9, $e7, $9f, $01, $c0, $7e, $e8, $e8, $e8, $e8, $e0
-PalPacket_9d96:	db $79, $47, $08, $00, $0b, $c4, $d0, $16, $a5, $cb, $c9, $05, $d0, $10, $a2, $28
-PalPacket_9da6:	db $79, $3c, $08, $00, $0b, $f0, $12, $a5, $c9, $c9, $c8, $d0, $1c, $a5, $ca, $c9
-PalPacket_9db6:	db $79, $31, $08, $00, $0b, $0c, $a5, $ca, $c9, $7e, $d0, $06, $a5, $cb, $c9, $7e
-PalPacket_9dc6:	db $79, $26, $08, $00, $0b, $39, $cd, $48, $0c, $d0, $34, $a5, $c9, $c9, $80, $d0
-PalPacket_9dd6:	db $79, $1b, $08, $00, $0b, $ea, $ea, $ea, $ea, $ea, $a9, $01, $cd, $4f, $0c, $d0
-PalPacket_9de6:	db $79, $10, $08, $00, $0b, $4c, $20, $08, $ea, $ea, $ea, $ea, $ea, $60, $ea, $ea
-
 PredefPals:
 INCLUDE "data/palettes/predef.pal"
 
-SGBBorderMap:
 INCLUDE "data/sgb_border_map.asm"
 
 SGBBorderPalettes:
@@ -1287,20 +1213,10 @@
 INCBIN "gfx/sgb/sgb_border.2bpp"
 
 HPBarPals:
-; green
-	RGB 30, 26, 15
-	RGB 00, 23, 00
-; yellow
-	RGB 30, 26, 15
-	RGB 31, 21, 00
-; red
-	RGB 30, 26, 15
-	RGB 31, 00, 00
+INCLUDE "data/palettes/hp_bar.pal"
 
 ExpBarPalette:
-; blue
-	RGB 30, 26, 15
-	RGB 04, 17, 31
+INCLUDE "data/palettes/exp_bar.pal"
 
 INCLUDE "gfx/pics/palette_pointers.asm"
 INCLUDE "gfx/trainer_palettes.asm"
@@ -1314,7 +1230,7 @@
 	and 7
 	ld e, a
 	ld d, 0
-	ld hl, .TilesetColorsPointers
+	ld hl, EnvironmentColorsPointers
 	add hl, de
 	add hl, de
 	ld a, [hli]
@@ -1405,41 +1321,8 @@
 	call FarCopyWRAM
 	ret
 
-.TilesetColorsPointers:
-	dw .OutdoorColors ; unused
-	dw .OutdoorColors ; TOWN
-	dw .OutdoorColors ; ROUTE
-	dw .IndoorColors  ; INDOOR
-	dw .DungeonColors ; CAVE
-	dw .Perm5Colors   ; ENVIRONMENT_5
-	dw .IndoorColors  ; GATE
-	dw .DungeonColors ; DUNGEON
+INCLUDE "data/maps/environment_colors.asm"
 
-; Valid indices: $00 - $29
-.OutdoorColors:
-	db $00, $01, $02, $28, $04, $05, $06, $07 ; morn
-	db $08, $09, $0a, $28, $0c, $0d, $0e, $0f ; day
-	db $10, $11, $12, $29, $14, $15, $16, $17 ; nite
-	db $18, $19, $1a, $1b, $1c, $1d, $1e, $1f ; dark
-
-.IndoorColors:
-	db $20, $21, $22, $23, $24, $25, $26, $07 ; morn
-	db $20, $21, $22, $23, $24, $25, $26, $07 ; day
-	db $10, $11, $12, $13, $14, $15, $16, $07 ; nite
-	db $18, $19, $1a, $1b, $1c, $1d, $1e, $07 ; dark
-
-.DungeonColors:
-	db $00, $01, $02, $03, $04, $05, $06, $07 ; morn
-	db $08, $09, $0a, $0b, $0c, $0d, $0e, $0f ; day
-	db $10, $11, $12, $13, $14, $15, $16, $17 ; nite
-	db $18, $19, $1a, $1b, $1c, $1d, $1e, $1f ; dark
-
-.Perm5Colors:
-	db $00, $01, $02, $03, $04, $05, $06, $07 ; morn
-	db $08, $09, $0a, $0b, $0c, $0d, $0e, $0f ; day
-	db $10, $11, $12, $13, $14, $15, $16, $17 ; nite
-	db $18, $19, $1a, $1b, $1c, $1d, $1e, $1f ; dark
-
 Palette_b309: ; b309 mobile
 	RGB 31, 31, 31
 	RGB 31, 19, 24
@@ -1453,13 +1336,13 @@
 	RGB 00, 00, 00
 
 TilesetBGPalette:
-INCLUDE "data/palettes/tileset_bg.pal"
+INCLUDE "data/palettes/overworld/tileset_bg.pal"
 
 MapObjectPals::
-INCLUDE "data/palettes/map_objects.pal"
+INCLUDE "data/palettes/overworld/map_objects.pal"
 
 RoofPals:
-INCLUDE "data/palettes/roofs.pal"
+INCLUDE "data/palettes/overworld/roofs.pal"
 
 DiplomaPalettes:
 INCLUDE "data/palettes/diploma.pal"
@@ -1468,10 +1351,10 @@
 INCLUDE "data/palettes/party_menu.pal"
 
 Palettes_b6f1:
-INCLUDE "data/palettes/b6f1.pal"
+INCLUDE "data/palettes/unknown/b6f1.pal"
 
 Palettes_b719:
-INCLUDE "data/palettes/b719.pal"
+INCLUDE "data/palettes/unknown/b719.pal"
 
 MalePokegearPals:
 INCLUDE "data/palettes/pokegear.pal"
@@ -1480,7 +1363,7 @@
 INCLUDE "data/palettes/pokegear_f.pal"
 
 Palettes_b789:
-INCLUDE "data/palettes/b789.pal"
+INCLUDE "data/palettes/unknown/b789.pal"
 
 SlotMachinePals:
 INCLUDE "data/palettes/slot_machine.pal"
--- a/engine/credits.asm
+++ b/engine/credits.asm
@@ -193,9 +193,9 @@
 	ld [Requested2bppSource], a
 	ld a, h
 	ld [Requested2bppSource + 1], a
-	ld a, VTiles2 % $100
+	ld a, LOW(VTiles2)
 	ld [Requested2bppDest], a
-	ld a, VTiles2 / $100
+	ld a, HIGH(VTiles2)
 	ld [Requested2bppDest + 1], a
 	jr Credits_RequestGFX
 
@@ -374,9 +374,9 @@
 	set 7, [hl]
 	ld a, 32
 	ld [MusicFade], a
-	ld a, MUSIC_POST_CREDITS % $100
+	ld a, LOW(MUSIC_POST_CREDITS)
 	ld [MusicFadeID], a
-	ld a, MUSIC_POST_CREDITS / $100
+	ld a, HIGH(MUSIC_POST_CREDITS)
 	ld [MusicFadeID + 1], a
 	ret
 
@@ -523,10 +523,10 @@
 ; Update the first three colors in both palette buffers.
 	push af
 	push hl
-	add UnknBGPals % $100
+	add LOW(UnknBGPals)
 	ld e, a
 	ld a, 0
-	adc UnknBGPals / $100
+	adc HIGH(UnknBGPals)
 	ld d, a
 	ld bc, 24
 	call CopyBytes
@@ -533,10 +533,10 @@
 
 	pop hl
 	pop af
-	add BGPals % $100
+	add LOW(BGPals)
 	ld e, a
 	ld a, 0
-	adc BGPals / $100
+	adc HIGH(BGPals)
 	ld d, a
 	ld bc, 24
 	call CopyBytes
--- a/engine/crystal_colors.asm
+++ b/engine/crystal_colors.asm
@@ -126,10 +126,7 @@
 ; 49418
 
 Palette_TextBG7: ; 49418
-	RGB 31, 31, 31
-	RGB 08, 19, 28
-	RGB 05, 05, 16
-	RGB 00, 00, 00
+INCLUDE "data/palettes/overworld/bg_text.pal"
 ; 49420
 
 Function49420:: ; 49420 (12:5420)
@@ -144,7 +141,7 @@
 MG_Mobile_Layout01: ; 4942f
 	call MG_Mobile_Layout_LoadPals
 	ld de, UnknBGPals palette PAL_BG_TEXT
-	ld hl, Palette_49478
+	ld hl, .Palette_49478
 	ld bc, 1 palettes
 	ld a, BANK(UnknBGPals)
 	call FarCopyWRAM
@@ -174,7 +171,7 @@
 	ret
 ; 49478
 
-Palette_49478: ; 49478
+.Palette_49478: ; 49478
 	RGB 31, 31, 31
 	RGB 26, 31, 00
 	RGB 20, 16, 03
@@ -210,7 +207,7 @@
 INCLUDE "tilesets/special_palettes.asm"
 
 MG_Mobile_Layout02: ; 49706
-	ld hl, Palette_49732
+	ld hl, .Palette_49732
 	ld de, UnknBGPals
 	ld bc, 1 palettes
 	ld a, BANK(UnknBGPals)
@@ -218,7 +215,7 @@
 	farcall ApplyPals
 	call MG_Mobile_Layout_WipeAttrMap
 	farcall ApplyAttrMap
-	ld hl, Palette_4973a
+	ld hl, .Palette_4973a
 	ld de, UnknOBPals
 	ld bc, 1 palettes
 	ld a, BANK(UnknOBPals)
@@ -226,7 +223,7 @@
 	ret
 ; 49732
 
-Palette_49732: ; 49732
+.Palette_49732: ; 49732
 	RGB 31, 31, 31
 	RGB 23, 16, 07
 	RGB 23, 07, 07
@@ -233,7 +230,7 @@
 	RGB 03, 07, 20
 ; 4973a
 
-Palette_4973a: ; 4973a
+.Palette_4973a: ; 4973a
 	RGB 00, 00, 00
 	RGB 07, 05, 31
 	RGB 14, 18, 31
@@ -241,9 +238,9 @@
 ; 49742
 
 Function49742: ; 49742
-	ld hl, Palette_49757
+	ld hl, .Palette_49757
 	ld de, UnknBGPals
-	ld bc, $40
+	ld bc, 8 palettes
 	ld a, $5
 	call FarCopyWRAM
 	farcall ApplyPals
@@ -250,8 +247,8 @@
 	ret
 ; 49757
 
-Palette_49757: ; 49757
-INCLUDE "data/palettes/49757.pal"
+.Palette_49757: ; 49757
+INCLUDE "data/palettes/unknown/49757.pal"
 ; 49797
 
 _InitMG_Mobile_LinkTradePalMap: ; 49797
@@ -326,11 +323,4 @@
 ; 4985a
 
 Unknown_4985a: ; unreferenced
-	db $ab, $03, $57, $24, $ac, $0e, $13, $32
-	db $be, $30, $5b, $4c, $47, $60, $ed, $f2
-	db $ab, $03, $55, $26, $aa, $0a, $13, $3a
-	db $be, $28, $33, $24, $6e, $71, $df, $b0
-	db $a8, $00, $e5, $e0, $9a, $fc, $f4, $2c
-	db $fe, $4c, $a3, $5e, $c6, $3a, $ab, $4d
-	db $a8, $00, $b5, $b0, $de, $e8, $fc, $1c
-	db $ba, $66, $f7, $0e, $ba, $5e, $43, $bd
+INCLUDE "data/palettes/unknown/4985a.asm"
--- a/engine/crystal_intro.asm
+++ b/engine/crystal_intro.asm
@@ -3,9 +3,9 @@
 	call PlayMusic
 	call ClearBGPalettes
 	call ClearTileMap
-	ld a, VBGMap0 / $100
+	ld a, HIGH(VBGMap0)
 	ld [hBGMapAddress + 1], a
-	xor a
+	xor a ; LOW(VBGMap0)
 	ld [hBGMapAddress], a
 	ld [hJoyDown], a
 	ld [hSCX], a
@@ -1922,9 +1922,9 @@
 	ld [Requested2bppSource], a
 	ld a, [hli]
 	ld [Requested2bppSource + 1], a
-	ld a, (VTiles2 tile $09) % $100
+	ld a, LOW(VTiles2 tile $09)
 	ld [Requested2bppDest], a
-	ld a, (VTiles2 tile $09) / $100
+	ld a, HIGH(VTiles2 tile $09)
 	ld [Requested2bppDest + 1], a
 	ld a, 4
 	ld [Requested2bppSize], a
--- a/engine/debug.asm
+++ b/engine/debug.asm
@@ -1069,7 +1069,7 @@
 	ld hl, VTiles1
 	lb bc, BANK(DebugColorTestGFX), 1
 	call Request2bpp
-	ld a, VBGMap1 / $100
+	ld a, HIGH(VBGMap1)
 	ld [hBGMapAddress + 1], a
 	hlcoord 0, 0
 	ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
--- a/engine/events_2.asm
+++ b/engine/events_2.asm
@@ -300,7 +300,7 @@
 	; If we've taken at least 1024 steps, have the bike
 	;  shop owner try to call us.
 	ld a, d
-	cp 1024 >> 8
+	cp HIGH(1024)
 	jr c, .NoCall
 
 	; If a call has already been queued, don't overwrite
--- a/engine/experience.asm
+++ b/engine/experience.asm
@@ -6,7 +6,7 @@
 .next_level
 	inc d
 	ld a, d
-	cp (MAX_LEVEL + 1) % $100
+	cp LOW(MAX_LEVEL + 1)
 	jr z, .got_level
 	call CalcExpAtLevel
 	push hl
--- a/engine/init_hof_credits.asm
+++ b/engine/init_hof_credits.asm
@@ -46,9 +46,9 @@
 	ld hl, UnknBGPals
 	ld c, 4 tiles
 .load_white_palettes
-	ld a, (palred 31 + palgreen 31 + palblue 31) % $100
+	ld a, LOW(palred 31 + palgreen 31 + palblue 31)
 	ld [hli], a
-	ld a, (palred 31 + palgreen 31 + palblue 31) / $100
+	ld a, HIGH(palred 31 + palgreen 31 + palblue 31)
 	ld [hli], a
 	dec c
 	jr nz, .load_white_palettes
--- a/engine/init_map.asm
+++ b/engine/init_map.asm
@@ -27,7 +27,7 @@
 	ld a, $90
 	ld [hWY], a
 	call OverworldTextModeSwitch
-	ld a, VBGMap1 / $100
+	ld a, HIGH(VBGMap1)
 	call .LoadBGMapAddrIntoHRAM
 	call _OpenAndCloseMenu_HDMATransferTileMapAndAttrMap
 	farcall LoadOW_BGPal7
@@ -38,11 +38,11 @@
 	ld [hBGMapMode], a
 	ld [hWY], a
 	farcall HDMATransfer_FillBGMap0WithBlack ; no need to farcall
-	ld a, VBGMap0 / $100
+	ld a, HIGH(VBGMap0)
 	call .LoadBGMapAddrIntoHRAM
-	xor a
+	xor a ; LOW(VBGMap0)
 	ld [wBGMapAnchor], a
-	ld a, VBGMap0 / $100
+	ld a, HIGH(VBGMap0)
 	ld [wBGMapAnchor + 1], a
 	xor a
 	ld [hSCX], a
@@ -86,13 +86,13 @@
 	ld hl, wDecompressScratch
 	ld bc, wScratchAttrMap - wDecompressScratch
 	call ByteFill
-	ld a, wDecompressScratch / $100
+	ld a, HIGH(wDecompressScratch)
 	ld [rHDMA1], a
-	ld a, wDecompressScratch % $100
+	ld a, LOW(wDecompressScratch)
 	ld [rHDMA2], a
-	ld a, (VBGMap0 % $8000) / $100
+	ld a, HIGH(VBGMap0 % $8000)
 	ld [rHDMA3], a
-	ld a, (VBGMap0 % $8000) % $100
+	ld a, LOW(VBGMap0 % $8000)
 	ld [rHDMA4], a
 	ld a, $3f
 	ld [hDMATransfer], a
--- a/engine/intro_menu.asm
+++ b/engine/intro_menu.asm
@@ -199,13 +199,13 @@
 	ld [Coins], a
 	ld [Coins + 1], a
 
-IF START_MONEY / $10000
-	ld a, START_MONEY / $10000
+IF START_MONEY >= $10000
+	ld a, HIGH(START_MONEY >> 8)
 ENDC
 	ld [Money], a
-	ld a, START_MONEY / $100 % $100
+	ld a, HIGH(START_MONEY) ; mid
 	ld [Money + 1], a
-	ld a, START_MONEY % $100
+	ld a, LOW(START_MONEY)
 	ld [Money + 2], a
 
 	xor a
@@ -212,11 +212,11 @@
 	ld [wWhichMomItem], a
 
 	ld hl, MomItemTriggerBalance
-	ld [hl], MOM_MONEY / $10000
+	ld [hl], HIGH(MOM_MONEY >> 8)
 	inc hl
-	ld [hl], MOM_MONEY / $100 % $100
+	ld [hl], HIGH(MOM_MONEY) ; mid
 	inc hl
-	ld [hl], MOM_MONEY % $100
+	ld [hl], LOW(MOM_MONEY)
 
 	call InitializeNPCNames
 
@@ -372,9 +372,9 @@
 .Check2Pass:
 	ld a, $8
 	ld [MusicFade], a
-	ld a, MUSIC_NONE % $100
+	ld a, LOW(MUSIC_NONE)
 	ld [MusicFadeID], a
-	ld a, MUSIC_NONE / $100
+	ld a, HIGH(MUSIC_NONE)
 	ld [MusicFadeID + 1], a
 	call ClearBGPalettes
 	call Continue_MobileAdapterMenu
@@ -426,9 +426,9 @@
 	ret nz
 	ld a, 5
 	ld [MusicFade], a
-	ld a, MUSIC_MOBILE_ADAPTER_MENU % $100
+	ld a, LOW(MUSIC_MOBILE_ADAPTER_MENU)
 	ld [MusicFadeID], a
-	ld a, MUSIC_MOBILE_ADAPTER_MENU / $100
+	ld a, HIGH(MUSIC_MOBILE_ADAPTER_MENU)
 	ld [MusicFadeID + 1], a
 	ld c, 20
 	call DelayFrames
@@ -437,9 +437,9 @@
 	farcall _SaveData
 	ld a, 8
 	ld [MusicFade], a
-	ld a, MUSIC_NONE % $100
+	ld a, LOW(MUSIC_NONE)
 	ld [MusicFadeID], a
-	ld a, MUSIC_NONE / $100
+	ld a, HIGH(MUSIC_NONE)
 	ld [MusicFadeID + 1], a
 	ld c, 35
 	call DelayFrames
@@ -1405,9 +1405,9 @@
 	call ClearWindowData
 	call ClearBGPalettes
 	call ClearTileMap
-	ld a, VBGMap0 / $100
+	ld a, HIGH(VBGMap0)
 	ld [hBGMapAddress + 1], a
-	xor a
+	xor a ; LOW(VBGMap0)
 	ld [hBGMapAddress], a
 	ld [hJoyDown], a
 	ld [hSCX], a
--- a/engine/item_effects.asm
+++ b/engine/item_effects.asm
@@ -861,7 +861,7 @@
 
 .compare
 	ld c, a
-	cp 1024 >> 8 ; 102.4 kg
+	cp HIGH(1024) ; 102.4 kg
 	jr c, .lightmon
 
 	ld hl, .WeightsTable
@@ -892,10 +892,10 @@
 
 .WeightsTable:
 ; weight factor, boost
-	db 2048 >> 8, 0
-	db 3072 >> 8, 20
-	db 4096 >> 8, 30
-	db 65280 >> 8, 40
+	db HIGH(2048),   0
+	db HIGH(3072),  20
+	db HIGH(4096),  30
+	db HIGH(65280), 40
 
 LureBallMultiplier:
 ; multiply catch rate by 3 if this is a fishing rod battle
--- a/engine/items.asm
+++ b/engine/items.asm
@@ -124,28 +124,28 @@
 
 DoesHLEqualNumItems: ; d27b
 	ld a, l
-	cp NumItems % $100
+	cp LOW(NumItems)
 	ret nz
 	ld a, h
-	cp NumItems / $100
+	cp HIGH(NumItems)
 	ret
 
 GetPocketCapacity: ; d283
 	ld c, MAX_ITEMS
 	ld a, e
-	cp NumItems % $100
+	cp LOW(NumItems)
 	jr nz, .not_bag
 	ld a, d
-	cp NumItems / $100
+	cp HIGH(NumItems)
 	ret z
 
 .not_bag
 	ld c, MAX_PC_ITEMS
 	ld a, e
-	cp PCItems % $100
+	cp LOW(PCItems)
 	jr nz, .not_pc
 	ld a, d
-	cp PCItems / $100
+	cp HIGH(PCItems)
 	ret z
 
 .not_pc
--- a/engine/link.asm
+++ b/engine/link.asm
@@ -162,9 +162,9 @@
 	ld [de], a
 	ld hl, wTimeCapsulePartyMon1Species
 	call Function2868a
-	ld a, OTPartyMonOT % $100
+	ld a, LOW(OTPartyMonOT)
 	ld [wUnusedD102], a
-	ld a, OTPartyMonOT / $100
+	ld a, HIGH(OTPartyMonOT)
 	ld [wUnusedD102 + 1], a
 	ld de, MUSIC_NONE
 	call PlayMusic
@@ -333,10 +333,10 @@
 	push bc
 	ld bc, MAIL_MSG_LENGTH + 1
 	call CopyBytes
-	ld a, (MAIL_STRUCT_LENGTH - (MAIL_MSG_LENGTH + 1)) % $100
+	ld a, LOW(MAIL_STRUCT_LENGTH - (MAIL_MSG_LENGTH + 1))
 	add e
 	ld e, a
-	ld a, (MAIL_STRUCT_LENGTH - (MAIL_MSG_LENGTH + 1)) / $100
+	ld a, HIGH(MAIL_STRUCT_LENGTH - (MAIL_MSG_LENGTH + 1))
 	adc d
 	ld d, a
 	pop bc
@@ -346,10 +346,10 @@
 	ld b, PARTY_LENGTH
 .copy_author_loop
 	push bc
-	ld a, (MAIL_MSG_LENGTH + 1) % $100
+	ld a, LOW(MAIL_MSG_LENGTH + 1)
 	add e
 	ld e, a
-	ld a, (MAIL_MSG_LENGTH + 1) / $100
+	ld a, HIGH(MAIL_MSG_LENGTH + 1)
 	adc d
 	ld d, a
 	ld bc, MAIL_STRUCT_LENGTH - (MAIL_MSG_LENGTH + 1)
@@ -403,9 +403,9 @@
 	ld de, OTPartyMons
 	ld bc, OTPartyDataEnd - OTPartyMons
 	call CopyBytes
-	ld a, OTPartyMonOT % $100
+	ld a, LOW(OTPartyMonOT)
 	ld [wUnusedD102], a
-	ld a, OTPartyMonOT / $100
+	ld a, HIGH(OTPartyMonOT)
 	ld [wUnusedD102 + 1], a
 	ld de, MUSIC_NONE
 	call PlayMusic
--- a/engine/map_objects.asm
+++ b/engine/map_objects.asm
@@ -2812,7 +2812,7 @@
 .fill
 	ld a, [VramState]
 	bit 1, a
-	ld b, SpritesEnd % $100
+	ld b, LOW(SpritesEnd)
 	jr z, .ok
 	ld b, 28 * 4
 .ok
@@ -2820,7 +2820,7 @@
 	cp b
 	ret nc
 	ld l, a
-	ld h, Sprites / $100
+	ld h, HIGH(Sprites)
 	ld de, 4
 	ld a, b
 	ld c, SCREEN_HEIGHT_PX + 16
@@ -3032,11 +3032,11 @@
 	ld l, a
 	ld a, [hUsedSpriteIndex]
 	ld c, a
-	ld b, Sprites / $100
+	ld b, HIGH(Sprites)
 	ld a, [hli]
 	ld [hUsedSpriteTile], a
 	add c
-	cp SpritesEnd % $100
+	cp LOW(SpritesEnd)
 	jr nc, .full
 .addsprite
 	ld a, [hFFC0]
--- a/engine/move_mon.asm
+++ b/engine/move_mon.asm
@@ -1570,18 +1570,18 @@
 
 .no_overflow_4
 	ld a, [hQuotient + 1]
-	cp (1000 / $100) + 1
+	cp HIGH(MAX_STAT_VALUE + 1) + 1
 	jr nc, .max_stat
-	cp 1000 / $100
+	cp HIGH(MAX_STAT_VALUE + 1)
 	jr c, .stat_value_okay
 	ld a, [hQuotient + 2]
-	cp 1000 % $100
+	cp LOW(MAX_STAT_VALUE + 1)
 	jr c, .stat_value_okay
 
 .max_stat
-	ld a, MAX_STAT_VALUE / $100
+	ld a, HIGH(MAX_STAT_VALUE)
 	ld [hMultiplicand + 1], a
-	ld a, MAX_STAT_VALUE % $100
+	ld a, LOW(MAX_STAT_VALUE)
 	ld [hMultiplicand + 2], a
 
 .stat_value_okay
@@ -1702,9 +1702,9 @@
 	ld hl, PartyMon1ID
 	ld bc, PARTYMON_STRUCT_LENGTH
 	call AddNTimes
-	ld a, 01001 / $100
+	ld a, HIGH(01001)
 	ld [hli], a
-	ld [hl], 01001 % $100
+	ld [hl], LOW(01001)
 	pop bc
 	farcall SetGiftPartyMonCaughtData
 	jr .skip_nickname
--- a/engine/mystery_gift.asm
+++ b/engine/mystery_gift.asm
@@ -264,7 +264,7 @@
 	ld a, [rLY]
 	cp $90
 	jr c, .ly_loop
-	ld c, rRP % $100
+	ld c, LOW(rRP)
 	ld a, $c0
 	ld [$ff00+c], a
 	ld b, 240 ; This might have been intended as a 4-second timeout buffer.
@@ -274,7 +274,7 @@
 	call MysteryGift_ReadJoypad
 
 	ld b, $2
-	ld c, rRP % $100
+	ld c, LOW(rRP)
 	; Delay frame
 .ly_loop2
 	ld a, [$ff00+c]
@@ -715,7 +715,7 @@
 .loop
 	call MysteryGift_ReadJoypad
 	ld b, $2
-	ld c, rRP % $100
+	ld c, LOW(rRP)
 	ld a, [hMGJoypadReleased]
 	bit B_BUTTON_F, a
 	jr z, .next
@@ -731,7 +731,7 @@
 	jr nz, .loop
 
 Function104dfe: ; 104dfe (41:4dfe)
-	ld c, rRP % $100
+	ld c, LOW(rRP)
 	ld d, $0
 	ld e, d
 	call Function104db7
@@ -771,7 +771,7 @@
 Function104e46: ; 104e46 (41:4e46)
 	ld a, $2
 	ld [hPrintNum9], a
-	ld c, rRP % $100
+	ld c, LOW(rRP)
 	ld d, $0
 	ld e, d
 	ld d, $3d
@@ -812,7 +812,7 @@
 	ld [hPrintNum6], a
 	push hl
 	push bc
-	ld c, rRP % $100
+	ld c, LOW(rRP)
 	ld d, $3d
 	call Function104dd1
 	ld hl, hPrintNum2
@@ -844,7 +844,7 @@
 	ret
 
 Function104ed6: ; 104ed6 (41:4ed6)
-	ld c, rRP % $100
+	ld c, LOW(rRP)
 	ld d, $5
 	call Function104dd1
 	ld d, $5
@@ -981,7 +981,7 @@
 	ret
 
 Function104faf: ; 104faf (41:4faf)
-	ld c, rRP % $100
+	ld c, LOW(rRP)
 	ld d, $0
 	call Function104db7
 	jp z, Function104f42
--- a/engine/namingscreen.asm
+++ b/engine/namingscreen.asm
@@ -235,10 +235,10 @@
 	pop de
 	ld b, SPRITE_ANIM_INDEX_RED_WALK
 	ld a, d
-	cp KrisSpriteGFX / $100
+	cp HIGH(KrisSpriteGFX)
 	jr nz, .not_kris
 	ld a, e
-	cp KrisSpriteGFX % $100
+	cp LOW(KrisSpriteGFX)
 	jr nz, .not_kris
 	ld b, SPRITE_ANIM_INDEX_BLUE_WALK
 .not_kris
--- a/engine/odd_eggs.asm
+++ b/engine/odd_eggs.asm
@@ -15,10 +15,10 @@
 
 	; Break on $ffff.
 	ld a, d
-	cp $ffff / $100
+	cp HIGH($ffff)
 	jr nz, .not_done
 	ld a, e
-	cp $ffff % $100
+	cp LOW($ffff)
 	jr z, .done
 .not_done
 
@@ -60,14 +60,14 @@
 	ld [wMobileMonSpeciesBuffer], a
 
 	; load pointer to (wMobileMonSpeciesBuffer - 1) in wMobileMonSpeciesPointerBuffer
-	ld a, (wMobileMonSpeciesBuffer - 1) % $100
+	ld a, LOW(wMobileMonSpeciesBuffer - 1)
 	ld [wMobileMonSpeciesPointerBuffer], a
-	ld a, (wMobileMonSpeciesBuffer - 1) / $100
+	ld a, HIGH(wMobileMonSpeciesBuffer - 1)
 	ld [wMobileMonSpeciesPointerBuffer + 1], a
 	; load pointer to OddEggSpecies in wMobileMonStructurePointerBuffer
-	ld a, OddEggSpecies % $100
+	ld a, LOW(OddEggSpecies)
 	ld [wMobileMonStructurePointerBuffer], a
-	ld a, OddEggSpecies / $100
+	ld a, HIGH(OddEggSpecies)
 	ld [wMobileMonStructurePointerBuffer + 1], a
 
 	; load Odd Egg Name in wTempOddEggNickname
@@ -77,14 +77,14 @@
 	call CopyBytes
 
 	; load pointer to wTempOddEggNickname in wMobileMonOTNamePointerBuffer
-	ld a, wTempOddEggNickname % $100
+	ld a, LOW(wTempOddEggNickname)
 	ld [wMobileMonOTNamePointerBuffer], a
-	ld a, wTempOddEggNickname / $100
+	ld a, HIGH(wTempOddEggNickname)
 	ld [wMobileMonOTNamePointerBuffer + 1], a
 	; load pointer to wOddEggName in wMobileMonNicknamePointerBuffer
-	ld a, wOddEggName % $100
+	ld a, LOW(wOddEggName)
 	ld [wMobileMonNicknamePointerBuffer], a
-	ld a, wOddEggName / $100
+	ld a, HIGH(wOddEggName)
 	ld [wMobileMonNicknamePointerBuffer + 1], a
 	farcall AddMobileMonToParty
 	ret
--- a/engine/overworld.asm
+++ b/engine/overworld.asm
@@ -663,10 +663,10 @@
 	add hl, hl
 endr
 	ld a, l
-	add VTiles0 % $100
+	add LOW(VTiles0)
 	ld l, a
 	ld a, h
-	adc VTiles0 / $100
+	adc HIGH(VTiles0)
 	ld h, a
 	ret
 ; 14418
--- a/engine/party_menu.asm
+++ b/engine/party_menu.asm
@@ -587,10 +587,10 @@
 
 
 PartyMenuCheckEgg: ; 50389
-	ld a, PartySpecies % $100
+	ld a, LOW(PartySpecies)
 	add b
 	ld e, a
-	ld a, PartySpecies / $100
+	ld a, HIGH(PartySpecies)
 	adc 0
 	ld d, a
 	ld a, [de]
--- a/engine/player_step.asm
+++ b/engine/player_step.asm
@@ -156,7 +156,7 @@
 	ld a, [wBGMapAnchor + 1]
 	inc a
 	and $3
-	or VBGMap0 / $100
+	or HIGH(VBGMap0)
 	ld [wBGMapAnchor + 1], a
 .not_overflowed
 	ld hl, wMetatileStandingY
@@ -187,7 +187,7 @@
 	ld a, [wBGMapAnchor + 1]
 	dec a
 	and $3
-	or VBGMap0 / $100
+	or HIGH(VBGMap0)
 	ld [wBGMapAnchor + 1], a
 .not_underflowed
 	ld hl, wMetatileStandingY
--- a/engine/pokegear.asm
+++ b/engine/pokegear.asm
@@ -35,9 +35,9 @@
 	pop af
 	ld [Options], a
 	call ClearBGPalettes
-	xor a
+	xor a ; LOW(VBGMap0)
 	ld [hBGMapAddress], a
-	ld a, VBGMap0 / $100
+	ld a, HIGH(VBGMap0)
 	ld [hBGMapAddress + 1], a
 	ld a, $90
 	ld [hWY], a
@@ -243,9 +243,9 @@
 	ld a, [wcf65]
 	and a
 	jr nz, .kanto_0
-	xor a
+	xor a ; LOW(VBGMap0)
 	ld [hBGMapAddress], a
-	ld a, VBGMap0 / $100
+	ld a, HIGH(VBGMap0)
 	ld [hBGMapAddress + 1], a
 	call .UpdateBGMap
 	ld a, $90
@@ -252,9 +252,9 @@
 	jr .finish
 
 .kanto_0
-	xor a
+	xor a ; LOW(VBGMap1)
 	ld [hBGMapAddress], a
-	ld a, VBGMap1 / $100
+	ld a, HIGH(VBGMap1)
 	ld [hBGMapAddress + 1], a
 	call .UpdateBGMap
 	xor a
@@ -2161,9 +2161,9 @@
 	call ClearBGPalettes
 	ld a, $90
 	ld [hWY], a
-	xor a
+	xor a ; LOW(VBGMap0)
 	ld [hBGMapAddress], a
-	ld a, VBGMap0 / $100
+	ld a, HIGH(VBGMap0)
 	ld [hBGMapAddress + 1], a
 	ld a, [wTownMapPlayerIconLandmark]
 	ld e, a
@@ -3003,9 +3003,9 @@
 	call ClearBGPalettes
 	ld a, $90
 	ld [hWY], a
-	xor a
+	xor a ; LOW(VBGMap0)
 	ld [hBGMapAddress], a
-	ld a, VBGMap0 / $100
+	ld a, HIGH(VBGMap0)
 	ld [hBGMapAddress + 1], a
 	ld a, [wTownMapPlayerIconLandmark]
 	ld e, a
--- a/engine/printer_serial.asm
+++ b/engine/printer_serial.asm
@@ -109,9 +109,9 @@
 	call Printer_CopyPacket
 	; prepare to send 40 tiles
 	call Printer_Convert2RowsTo2bpp
-	ld a, (40 tiles) % $100
+	ld a, LOW(40 tiles)
 	ld [wPrinterSendByteCounter], a
-	ld a, (40 tiles) / $100
+	ld a, HIGH(40 tiles)
 	ld [wPrinterSendByteCounter + 1], a
 	; compute the checksum
 	call Printer_ComputeChecksum
@@ -142,9 +142,9 @@
 	call Printer_CopyPacket
 	; prepare to send 1 tile
 	call Printer_StageHeaderForSend
-	ld a, 4 % $100
+	ld a, LOW(4)
 	ld [wPrinterSendByteCounter], a
-	ld a, 4 / $100
+	ld a, HIGH(4)
 	ld [wPrinterSendByteCounter + 1], a
 	; compute the checksum
 	call Printer_ComputeChecksum
--- a/engine/printnum.asm
+++ b/engine/printnum.asm
@@ -80,51 +80,51 @@
 	jr z, .six
 
 .seven
-	ld a, 1000000 / $10000 % $100
+	ld a, HIGH(1000000 >> 8)
 	ld [hPrintNum5], a
-	ld a, 1000000 / $100 % $100
+	ld a, HIGH(1000000) ; mid
 	ld [hPrintNum6], a
-	ld a, 1000000 % $100
+	ld a, LOW(1000000)
 	ld [hPrintNum7], a
 	call .PrintDigit
 	call .AdvancePointer
 
 .six
-	ld a, 100000 / $10000 % $100
+	ld a, HIGH(100000 >> 8)
 	ld [hPrintNum5], a
-	ld a, 100000 / $100 % $100
+	ld a, HIGH(100000) ; mid
 	ld [hPrintNum6], a
-	ld a, 100000 % $100
+	ld a, LOW(100000)
 	ld [hPrintNum7], a
 	call .PrintDigit
 	call .AdvancePointer
 
 .five
-	xor a
+	xor a ; HIGH(10000 >> 8)
 	ld [hPrintNum5], a
-	ld a, 10000 / $100
+	ld a, HIGH(10000) ; mid
 	ld [hPrintNum6], a
-	ld a, 10000 % $100
+	ld a, LOW(10000)
 	ld [hPrintNum7], a
 	call .PrintDigit
 	call .AdvancePointer
 
 .four
-	xor a
+	xor a ; HIGH(1000 >> 8)
 	ld [hPrintNum5], a
-	ld a, 1000 / $100
+	ld a, HIGH(1000) ; mid
 	ld [hPrintNum6], a
-	ld a, 1000 % $100
+	ld a, LOW(1000)
 	ld [hPrintNum7], a
 	call .PrintDigit
 	call .AdvancePointer
 
 .three
-	xor a
+	xor a ; HIGH(100 >> 8)
 	ld [hPrintNum5], a
-	xor a
+	xor a ; HIGH(100) ; mid
 	ld [hPrintNum6], a
-	ld a, 100
+	ld a, LOW(100)
 	ld [hPrintNum7], a
 	call .PrintDigit
 	call .AdvancePointer
--- a/engine/routines/loadpushoam.asm
+++ b/engine/routines/loadpushoam.asm
@@ -11,7 +11,7 @@
 	ret
 
 .PushOAM: ; 403f
-	ld a, Sprites / $100
+	ld a, HIGH(Sprites)
 	ld [rDMA], a
 	ld a, (SpritesEnd - Sprites) / 4 ; 40
 .pushoam_loop
--- a/engine/routines/phonering_copytilemapatonce.asm
+++ b/engine/routines/phonering_copytilemapatonce.asm
@@ -50,7 +50,7 @@
 	ld a, SCREEN_HEIGHT
 	ld [hTilesPerCycle], a
 	ld b, 1 << 1 ; not in v/hblank
-	ld c, rSTAT % $100
+	ld c, LOW(rSTAT)
 
 .loop
 rept SCREEN_WIDTH / 2
--- a/engine/routines/savemenu_copytilemapatonce.asm
+++ b/engine/routines/savemenu_copytilemapatonce.asm
@@ -47,7 +47,7 @@
 	ld a, SCREEN_HEIGHT
 	ld [hTilesPerCycle], a
 	ld b, 1 << 1
-	ld c, rSTAT % $100
+	ld c, LOW(rSTAT)
 
 .loop
 rept SCREEN_WIDTH / 2
--- a/engine/slot_machine.asm
+++ b/engine/slot_machine.asm
@@ -471,10 +471,10 @@
 
 Slot_CheckCoinCaseFull: ; 92a04 (24:6a04)
 	ld a, d
-	cp MAX_COINS / $100
+	cp HIGH(MAX_COINS)
 	jr c, .not_full
 	ld a, e
-	cp MAX_COINS % $100
+	cp LOW(MAX_COINS)
 	jr c, .not_full
 	scf
 	ret
@@ -771,10 +771,10 @@
 	push hl
 	srl a
 	srl a
-	add .Unknown_92bce % $100
+	add LOW(.Unknown_92bce)
 	ld l, a
 	ld a, 0
-	adc .Unknown_92bce / $100
+	adc HIGH(.Unknown_92bce)
 	ld h, a
 	ld a, [hl]
 	pop hl
--- a/engine/specials.asm
+++ b/engine/specials.asm
@@ -617,9 +617,9 @@
 
 
 Special_FadeOutMusic: ; c48f
-	ld a, MUSIC_NONE % $100
+	ld a, LOW(MUSIC_NONE)
 	ld [MusicFadeID], a
-	ld a, MUSIC_NONE / $100
+	ld a, HIGH(MUSIC_NONE)
 	ld [MusicFadeID + 1], a
 	ld a, $2
 	ld [MusicFade], a
--- a/engine/sprites.asm
+++ b/engine/sprites.asm
@@ -23,7 +23,7 @@
 	push bc
 	push af
 
-	ld a, Sprites % $100
+	ld a, LOW(Sprites)
 	ld [wCurrSpriteOAMAddr], a
 	call DoNextFrameForAllSprites
 
@@ -60,11 +60,11 @@
 
 	ld a, [wCurrSpriteOAMAddr]
 	ld l, a
-	ld h, Sprites / $100
+	ld h, HIGH(Sprites)
 
 .loop2 ; Clear (Sprites + [wCurrSpriteOAMAddr] --> SpritesEnd)
 	ld a, l
-	cp SpritesEnd % $100
+	cp LOW(SpritesEnd)
 	jr nc, .done
 	xor a
 	ld [hli], a
@@ -100,11 +100,11 @@
 
 	ld a, [wCurrSpriteOAMAddr]
 	ld l, a
-	ld h, (Sprites + $40) / $100
+	ld h, HIGH(Sprites + 16 * 4)
 
 .loop2 ; Clear (Sprites + [wCurrSpriteOAMAddr] --> Sprites + $40)
 	ld a, l
-	cp (Sprites + 16 * 4) % $100
+	cp LOW(Sprites + 16 * 4)
 	jr nc, .done
 	xor a
 	ld [hli], a
@@ -253,7 +253,7 @@
 	push bc
 	ld a, [wCurrSpriteOAMAddr]
 	ld e, a
-	ld d, Sprites / $100
+	ld d, HIGH(Sprites)
 	ld a, [hli]
 	ld c, a ; number of objects
 .loop
@@ -302,7 +302,7 @@
 	inc de
 	ld a, e
 	ld [wCurrSpriteOAMAddr], a
-	cp SpritesEnd % $100
+	cp LOW(SpritesEnd)
 	jr nc, .reached_the_end
 	dec c
 	jr nz, .loop
--- a/engine/start_battle.asm
+++ b/engine/start_battle.asm
@@ -191,7 +191,7 @@
 	call ClearWindowData
 
 	ld hl, hBGMapAddress
-	xor a
+	xor a ; LOW(VBGMap0)
 	ld [hli], a
-	ld [hl], VBGMap0 / $100
+	ld [hl], HIGH(VBGMap0)
 	ret
--- a/engine/timeset.asm
+++ b/engine/timeset.asm
@@ -9,9 +9,9 @@
 	ld [wSpriteUpdatesEnabled], a
 	ld a, $10
 	ld [MusicFade], a
-	ld a, MUSIC_NONE % $100
+	ld a, LOW(MUSIC_NONE)
 	ld [MusicFadeID], a
-	ld a, MUSIC_NONE / $100
+	ld a, HIGH(MUSIC_NONE)
 	ld [MusicFadeID + 1], a
 	ld c, 8
 	call DelayFrames
--- a/engine/trade_animation.asm
+++ b/engine/trade_animation.asm
@@ -627,7 +627,7 @@
 	push af
 	call ClearBGPalettes
 	call WaitTop
-	ld a, VBGMap1 / $100
+	ld a, HIGH(VBGMap1)
 	ld [hBGMapAddress + 1], a
 	call ClearTileMap
 	hlcoord 0, 0
@@ -657,7 +657,7 @@
 	call ByteFill
 	call WaitBGMap
 	call WaitTop
-	ld a, VBGMap0 / $100
+	ld a, HIGH(VBGMap0)
 	ld [hBGMapAddress + 1], a
 	call ClearTileMap
 	ret
@@ -776,7 +776,7 @@
 
 TradeAnim_ScrollOutRight: ; 293ea
 	call WaitTop
-	ld a, VBGMap1 / $100
+	ld a, HIGH(VBGMap1)
 	ld [hBGMapAddress + 1], a
 	call WaitBGMap
 	ld a, $7
@@ -785,7 +785,7 @@
 	ld [hWY], a
 	call DelayFrame
 	call WaitTop
-	ld a, VBGMap0 / $100
+	ld a, HIGH(VBGMap0)
 	ld [hBGMapAddress + 1], a
 	call ClearTileMap
 	call TradeAnim_IncrementJumptableIndex
@@ -802,7 +802,7 @@
 	ret
 
 .done
-	ld a, VBGMap1 / $100
+	ld a, HIGH(VBGMap1)
 	ld [hBGMapAddress + 1], a
 	call WaitBGMap
 	ld a, $7
@@ -809,7 +809,7 @@
 	ld [hWX], a
 	ld a, $90
 	ld [hWY], a
-	ld a, VBGMap0 / $100
+	ld a, HIGH(VBGMap0)
 	ld [hBGMapAddress + 1], a
 	call TradeAnim_AdvanceScriptPointer
 	ret
@@ -1009,7 +1009,7 @@
 TrademonStats_MonTemplate: ; 29573
 	call WaitTop
 	call TradeAnim_BlankTileMap
-	ld a, VBGMap1 / $100
+	ld a, HIGH(VBGMap1)
 	ld [hBGMapAddress + 1], a
 	hlcoord 3, 0
 	ld b, $6
@@ -1032,7 +1032,7 @@
 TrademonStats_Egg: ; 295a1
 	call WaitTop
 	call TradeAnim_BlankTileMap
-	ld a, VBGMap1 / $100
+	ld a, HIGH(VBGMap1)
 	ld [hBGMapAddress + 1], a
 	hlcoord 3, 0
 	ld b, 6
@@ -1055,7 +1055,7 @@
 TrademonStats_WaitBGMap: ; 295d8
 	call WaitBGMap
 	call WaitTop
-	ld a, VBGMap0 / $100
+	ld a, HIGH(VBGMap0)
 	ld [hBGMapAddress + 1], a
 	ret
 
--- a/engine/warp_connection.asm
+++ b/engine/warp_connection.asm
@@ -233,9 +233,9 @@
 	ret
 
 .ClearBGMap: ; 104770 (41:4770)
-	ld a, VBGMap0 / $100
+	ld a, HIGH(VBGMap0)
 	ld [wBGMapAnchor + 1], a
-	xor a
+	xor a ; LOW(VBGMap0)
 	ld [wBGMapAnchor], a
 	ld [hSCY], a
 	ld [hSCX], a
--- a/event/halloffame.asm
+++ b/event/halloffame.asm
@@ -36,9 +36,9 @@
 ; 0x86455
 
 RedCredits:: ; 86455
-	ld a, MUSIC_NONE % $100
+	ld a, LOW(MUSIC_NONE)
 	ld [MusicFadeID], a
-	ld a, MUSIC_NONE / $100
+	ld a, HIGH(MUSIC_NONE)
 	ld [MusicFadeID + 1], a
 	ld a, 10
 	ld [MusicFade], a
@@ -59,9 +59,9 @@
 ; 8648e
 
 HallOfFame_FadeOutMusic: ; 8648e
-	ld a, MUSIC_NONE % $100
+	ld a, LOW(MUSIC_NONE)
 	ld [MusicFadeID], a
-	ld a, MUSIC_NONE / $100
+	ld a, HIGH(MUSIC_NONE)
 	ld [MusicFadeID + 1], a
 	ld a, 10
 	ld [MusicFade], a
--- a/event/happiness_egg.asm
+++ b/event/happiness_egg.asm
@@ -159,9 +159,9 @@
 	dec hl
 	inc [hl]
 	ld a, [hl]
-	cp 5242880 / $10000
+	cp HIGH(MAX_DAY_CARE_EXP >> 8)
 	jr c, .day_care_lady
-	ld a, 5242880 / $10000
+	ld a, HIGH(MAX_DAY_CARE_EXP >> 8)
 	ld [hl], a
 
 .day_care_lady
@@ -181,9 +181,9 @@
 	dec hl
 	inc [hl]
 	ld a, [hl]
-	cp 5242880 / $10000
+	cp HIGH(MAX_DAY_CARE_EXP >> 8)
 	jr c, .check_egg
-	ld a, 5242880 / $10000
+	ld a, HIGH(MAX_DAY_CARE_EXP >> 8)
 	ld [hl], a
 
 .check_egg
@@ -199,7 +199,7 @@
 	callfar CheckBreedmonCompatibility
 	ld a, [wd265]
 	cp 230
-	ld b, -1 + 32 percent
+	ld b, 32 percent - 1
 	jr nc, .okay
 	ld a, [wd265]
 	cp 170
--- a/event/magikarp.asm
+++ b/event/magikarp.asm
@@ -127,7 +127,7 @@
 
 ; if bc < 10:    [wMagikarpLength] = c + 190
 ; if bc ≥ $ff00: [wMagikarpLength] = c + 1370
-; else:          [wMagikarpLength] = z × 100 + (bc − x) / y
+; else:          [wMagikarpLength] = z * 100 + (bc - x) / y
 
 ; X, Y, and Z depend on the value of b as follows:
 
--- a/event/mom_phone.asm
+++ b/event/mom_phone.asm
@@ -83,11 +83,11 @@
 
 .check_have_2300
 	ld hl, hMoneyTemp
-	ld [hl], MOM_MONEY / $10000
+	ld [hl], HIGH(MOM_MONEY >> 8)
 	inc hl
-	ld [hl], MOM_MONEY / $100 % $100
+	ld [hl], HIGH(MOM_MONEY) ; mid
 	inc hl
-	ld [hl], MOM_MONEY % $100
+	ld [hl], LOW(MOM_MONEY)
 .loop
 	ld de, MomItemTriggerBalance
 	ld bc, wMomsMoney
--- a/event/poisonstep_pals.asm
+++ b/event/poisonstep_pals.asm
@@ -32,9 +32,9 @@
 	ld c, $20
 .loop
 ; RGB 28, 21, 31
-	ld a, (palred 28 + palgreen 21 + palblue 31) % $100
+	ld a, LOW(palred 28 + palgreen 21 + palblue 31)
 	ld [hli], a
-	ld a, (palred 28 + palgreen 21 + palblue 31) / $100
+	ld a, HIGH(palred 28 + palgreen 21 + palblue 31)
 	ld [hli], a
 	dec c
 	jr nz, .loop
--- a/event/special.asm
+++ b/event/special.asm
@@ -85,10 +85,10 @@
 
 ; OT ID
 	ld a, [hli]
-	cp 00518 / $100
+	cp HIGH(00518)
 	jr nz, .DontReturn
 	ld a, [hl]
-	cp 00518 % $100
+	cp LOW(00518)
 	jr nz, .DontReturn
 
 ; OT
--- a/event/unown.asm
+++ b/event/unown.asm
@@ -59,10 +59,10 @@
 
 	call GetSecondaryMapHeaderPointer
 	ld a, h
-	cp RuinsOfAlphAerodactylChamber_SecondMapHeader / $100
+	cp HIGH(RuinsOfAlphAerodactylChamber_SecondMapHeader)
 	jr nz, .nope
 	ld a, l
-	cp RuinsOfAlphAerodactylChamber_SecondMapHeader % $100
+	cp LOW(RuinsOfAlphAerodactylChamber_SecondMapHeader)
 	jr nz, .nope
 
 	ld de, EVENT_WALL_OPENED_IN_AERODACTYL_CHAMBER
@@ -87,10 +87,10 @@
 
 	call GetSecondaryMapHeaderPointer
 	ld a, h
-	cp RuinsOfAlphKabutoChamber_SecondMapHeader / $100
+	cp HIGH(RuinsOfAlphKabutoChamber_SecondMapHeader)
 	jr nz, .done
 	ld a, l
-	cp RuinsOfAlphKabutoChamber_SecondMapHeader % $100
+	cp LOW(RuinsOfAlphKabutoChamber_SecondMapHeader)
 	jr nz, .done
 
 	ld de, EVENT_WALL_OPENED_IN_KABUTO_CHAMBER
--- a/home.asm
+++ b/home.asm
@@ -606,7 +606,7 @@
 	ld a, SCREEN_HEIGHT
 	ld [hTilesPerCycle], a
 	ld b, 1 << 1 ; not in v/hblank
-	ld c, rSTAT % $100
+	ld c, LOW(rSTAT)
 
 .loop
 rept SCREEN_WIDTH / 2
@@ -1350,14 +1350,14 @@
 	and a
 	ret z
 
-	ld a, LYOverridesBackup % $100
+	ld a, LOW(LYOverridesBackup)
 	ld [Requested2bppSource], a
-	ld a, LYOverridesBackup / $100
+	ld a, HIGH(LYOverridesBackup)
 	ld [Requested2bppSource + 1], a
 
-	ld a, LYOverrides % $100
+	ld a, LOW(LYOverrides)
 	ld [Requested2bppDest], a
-	ld a, LYOverrides / $100
+	ld a, HIGH(LYOverrides)
 	ld [Requested2bppDest + 1], a
 
 	ld a, (LYOverridesEnd - LYOverrides) / 16
--- a/home/copy.asm
+++ b/home/copy.asm
@@ -72,16 +72,16 @@
 	call DelayFrame
 ; add $100 to hl and de
 	ld a, l
-	add $100 % $100
+	add LOW($100)
 	ld l, a
 	ld a, h
-	adc $100 / $100
+	adc HIGH($100)
 	ld h, a
 	ld a, e
-	add $100 % $100
+	add LOW($100)
 	ld e, a
 	ld a, d
-	adc $100 / $100
+	adc HIGH($100)
 	ld d, a
 	jr .loop
 
--- a/home/game_time.asm
+++ b/home/game_time.asm
@@ -106,11 +106,11 @@
 
 ; Cap the timer after 1000 hours.
 	ld a, h
-	cp 1000 / $100
+	cp HIGH(1000)
 	jr c, .ok
 
 	ld a, l
-	cp 1000 % $100
+	cp LOW(1000)
 	jr c, .ok
 
 	ld hl, GameTimeCap
--- a/home/init.asm
+++ b/home/init.asm
@@ -141,9 +141,9 @@
 
 	farcall InitCGBPals
 
-	ld a, VBGMap1 / $100
+	ld a, HIGH(VBGMap1)
 	ld [hBGMapAddress + 1], a
-	xor a ; VBGMap1 % $100
+	xor a ; LOW(VBGMap1)
 	ld [hBGMapAddress], a
 
 	farcall StartClock
@@ -201,7 +201,7 @@
 	push af
 	ld [rSVBK], a
 	xor a
-	ld hl, $d000
+	ld hl, wRAM1Start
 	ld bc, $1000
 	call ByteFill
 	pop af
--- a/home/lcd.asm
+++ b/home/lcd.asm
@@ -23,7 +23,7 @@
 	push bc
 	ld a, [rLY]
 	ld c, a
-	ld b, LYOverrides >> 8
+	ld b, HIGH(LYOverrides)
 	ld a, [bc]
 	ld b, a
 	ld a, [hLCDCPointer]
--- a/home/map.asm
+++ b/home/map.asm
@@ -1241,10 +1241,10 @@
 	ld h, a
 	ld bc, $0200
 	add hl, bc
-; cap d at VBGMap1 / $100
+; cap d at HIGH(VBGMap0)
 	ld a, h
 	and %00000011
-	or VBGMap0 / $100
+	or HIGH(VBGMap0)
 	ld e, l
 	ld d, a
 	call UpdateBGMapRow
@@ -1369,10 +1369,10 @@
 	ld e, a
 	jr nc, .skip
 	inc d
-; cap d at VBGMap1 / $100
+; cap d at HIGH(VBGMap0)
 	ld a, d
 	and $3
-	or VBGMap0 / $100
+	or HIGH(VBGMap0)
 	ld d, a
 
 .skip
--- a/home/movement.asm
+++ b/home/movement.asm
@@ -4,9 +4,9 @@
 	ld [wMovementBufferCount], a
 	ld a, $0 ; useless
 	ld [wUnusedMovementBufferBank], a
-	ld a, MovementBuffer % $100
+	ld a, LOW(MovementBuffer)
 	ld [wUnusedMovementBufferPointer], a
-	ld a, MovementBuffer / $100
+	ld a, HIGH(MovementBuffer)
 	ld [wUnusedMovementBufferPointer + 1], a
 	ret
 ; 1b35
--- a/home/palettes.asm
+++ b/home/palettes.asm
@@ -24,18 +24,18 @@
 
 	ld a, [rSVBK]
 	push af
-	ld a, 5 ; BANK(BGPals)
+	ld a, BANK(BGPals)
 	ld [rSVBK], a
 
-	ld hl, BGPals ; 5:d080
+	ld hl, BGPals
 
 ; copy 8 pals to bgpd
 	ld a, %10000000 ; auto increment, index 0
 	ld [rBGPI], a
-	ld c, rBGPD % $100
-	ld b, 4 ; NUM_PALS / 2
+	ld c, LOW(rBGPD)
+	ld b, 8 / 2
 .bgp
-rept 2 palettes
+rept (1 palettes) * 2
 	ld a, [hli]
 	ld [$ff00+c], a
 endr
@@ -43,15 +43,15 @@
 	dec b
 	jr nz, .bgp
 
-; hl is now 5:d0c0 OBPals
+; hl is now OBPals
 
 ; copy 8 pals to obpd
 	ld a, %10000000 ; auto increment, index 0
 	ld [rOBPI], a
-	ld c, rOBPD % $100
-	ld b, 4 ; NUM_PALS / 2
+	ld c, LOW(rOBPD)
+	ld b, 8 / 2
 .obp
-rept 2 palettes
+rept (1 palettes) * 2
 	ld a, [hli]
 	ld [$ff00+c], a
 endr
@@ -90,7 +90,7 @@
 	ld a, [rSVBK]
 	push af
 
-	ld a, 5 ; gfx
+	ld a, BANK(BGPals)
 	ld [rSVBK], a
 
 ; copy & reorder bg pal buffer
@@ -138,7 +138,7 @@
 	ld a, [rSVBK]
 	push af
 
-	ld a, 5
+	ld a, BANK(OBPals)
 	ld [rSVBK], a
 
 ; copy & reorder obj pal buffer
@@ -178,11 +178,11 @@
 
 	ld a, [rSVBK]
 	push af
-	ld a, 5 ; gfx
+	ld a, BANK(OBPals)
 	ld [rSVBK], a
 
-	ld hl, OBPals
-	ld de, UnknOBPals
+	ld hl, OBPals palette 0
+	ld de, UnknOBPals palette 0
 	ld a, [rOBP0]
 	ld b, a
 	ld c, 1
@@ -216,11 +216,11 @@
 
 	ld a, [rSVBK]
 	push af
-	ld a, 5 ; gfx
+	ld a, BANK(OBPals)
 	ld [rSVBK], a
 
-	ld hl, OBPals + 1 palettes
-	ld de, UnknOBPals + 1 palettes
+	ld hl, OBPals palette 1
+	ld de, UnknOBPals palette 1
 	ld a, [rOBP1]
 	ld b, a
 	ld c, 1
@@ -325,10 +325,10 @@
 	ret z
 	ld a, [rSVBK]
 	push af
-	ld a, 5 ; BANK(BGPals)
+	ld a, BANK(BGPals)
 	ld [rSVBK], a
 	ld hl, BGPals
-	ld bc, $40 + $10
+	ld bc, (8 palettes) + (2 palettes)
 	xor a
 	call ByteFill
 	pop af
--- a/home/video.asm
+++ b/home/video.asm
@@ -143,9 +143,9 @@
 	ld h, a
 	push hl
 
-	xor a
+	xor a ; LOW(VBGMap1)
 	ld [hBGMapAddress], a
-	ld a, VBGMap1 >> 8
+	ld a, HIGH(VBGMap1)
 	ld [hBGMapAddress + 1], a
 
 	ld a, [hBGMapMode]
--- a/lib/mobile/main.asm
+++ b/lib/mobile/main.asm
@@ -108,10 +108,10 @@
 	ld a, [$c988]
 	ld l, a
 	push hl
-	ld a, Function110236 % $100
+	ld a, LOW(Function110236)
 	cp l
 	jr nz, .okay
-	ld a, Function110236 / $100
+	ld a, HIGH(Function110236)
 	cp h
 .okay
 	call nz, Function1100b4
@@ -615,7 +615,7 @@
 ; 110393
 
 Function110393: ; 110393
-	ld c, rIE % $100
+	ld c, LOW(rIE)
 	ld a, [$ff00+c]
 	or $c
 	ld [$ff00+c], a
@@ -1969,11 +1969,11 @@
 	push de
 	ld b, 0
 .check_under_10k
-	ld a, 10000 / $100
+	ld a, HIGH(10000)
 	cp h
 	jr c, .subtract_10k
 	jr nz, .done_10k
-	ld a, 10000 % $100
+	ld a, LOW(10000)
 	cp l
 	jr z, .subtract_10k
 	jr nc, .done_10k
@@ -1993,11 +1993,11 @@
 	inc de
 	ld b, 0
 .check_under_1k
-	ld a, 1000 / $100
+	ld a, HIGH(1000)
 	cp h
 	jr c, .subtract_1k
 	jr nz, .done_1k
-	ld a, 1000 % $100
+	ld a, LOW(1000)
 	cp l
 	jr z, .subtract_1k
 	jr nc, .done_1k
@@ -2017,10 +2017,10 @@
 	inc de
 	ld b, 0
 .check_under_100
-	ld a, 100 / $100
+	ld a, HIGH(100)
 	cp h
 	jr nz, .subtract_100
-	ld a, 100 % $100
+	ld a, LOW(100)
 	cp l
 	jr z, .subtract_100
 	jr nc, .check_under_10
@@ -8521,14 +8521,14 @@
 
 .asm_113734
 	ld hl, $cc0c
-	ld a, Unknown_113b8e % $100
+	ld a, LOW(Unknown_113b8e)
 	ld [hli], a
-	ld a, Unknown_113b8e / $100
+	ld a, HIGH(Unknown_113b8e)
 	ld [hl], a
 	ld hl, $cc0e
-	ld a, Unknown_113a70 % $100
+	ld a, LOW(Unknown_113a70)
 	ld [hli], a
-	ld a, Unknown_113a70 / $100
+	ld a, HIGH(Unknown_113a70)
 	ld [hl], a
 	ld hl, $cbe7
 	ld de, $cc18
@@ -8610,7 +8610,7 @@
 	ld [$cc0d], a
 	ld a, l
 	ld [$cc0c], a
-	cp $8e ; XXX (Unknown_113b8e + $100) % $100 ???
+	cp $8e ; XXX ; LOW(Unknown_113b8e + $100) ???
 	jp nz, .asm_113751
 	ld de, $cc18
 	ld hl, $cbe7
--- a/macros.asm
+++ b/macros.asm
@@ -19,7 +19,6 @@
 INCLUDE "macros/scripts/trade_anim.asm"
 INCLUDE "macros/scripts/gfx_anim.asm"
 
-
 percent EQUS "* $ff / 100"
 
 tiles EQUS "* LEN_2BPP_TILE"
--- a/macros/data.asm
+++ b/macros/data.asm
@@ -95,7 +95,7 @@
 ; conditional segment is there because not every instance of
 ; this macro is directly OAM
 if _NARG >= 7 ; y tile, y pxl, x tile, x pxl, vtile offset, flags, palette
-	db (\1 * 8) % $100 + \2, (\3 * 8) % $100 + \4, \5, (\6 << 3) + (\7 & 7)
+	db (\1 * 8) % $100 + \2, (\3 * 8) % $100 + \4, \5, (\6 << 3) + (\7 & PALETTE_MASK)
 else
 	db (\1 * 8) % $100 + \2, (\3 * 8) % $100 + \4, \5, \6
 endc
--- a/main.asm
+++ b/main.asm
@@ -85,7 +85,14 @@
 INCLUDE "event/print_unown.asm"
 INCLUDE "event/print_photo.asm"
 INCLUDE "engine/breeding.asm"
+
+
 INCLUDE "tilesets/data.asm"
+
+
+SECTION "Roofs", ROMX
+
+INCLUDE "tilesets/roofs.asm"
 
 
 SECTION "Clock Reset", ROMX
--- a/mobile/battle_tower_5c.asm
+++ b/mobile/battle_tower_5c.asm
@@ -116,13 +116,13 @@
 	ld a, c
 	ld [de], a
 	inc de
-	ld a, PartyMons % $100
+	ld a, LOW(PartyMons)
 	ld [wcd49], a
-	ld a, PartyMons / $100
+	ld a, HIGH(PartyMons)
 	ld [wcd4a], a
-	ld a, PartyMonNicknames % $100
+	ld a, LOW(PartyMonNicknames)
 	ld [wcd4b], a
-	ld a, PartyMonNicknames / $100
+	ld a, HIGH(PartyMonNicknames)
 	ld [wcd4c], a
 	ld a, 3
 .CopyLoop:
@@ -355,9 +355,9 @@
 	ld hl, wBT_OTTempTrainerClass
 	ld a, [hli]
 	ld [OtherTrainerClass], a
-	ld a, OTPartyMonNicknames % $100
+	ld a, LOW(OTPartyMonNicknames)
 	ld [BGMapBuffer], a
-	ld a, OTPartyMonNicknames / $100
+	ld a, HIGH(OTPartyMonNicknames)
 	ld [BGMapBuffer + 1], a
 
 	; Copy Pkmn into Memory from the address in hl
--- a/mobile/fixed_words.asm
+++ b/mobile/fixed_words.asm
@@ -3015,26 +3015,26 @@
 	ld a, [rSVBK]
 	push af
 	ld hl, $c648
-	ld a, w5_d800 % $100
+	ld a, LOW(w5_d800)
 	ld [wcd2d], a
 	ld [hli], a
-	ld a, w5_d800 / $100
+	ld a, HIGH(w5_d800)
 	ld [wcd2e], a
 	ld [hl], a
 
-	ld a, SortedPokemon % $100
+	ld a, LOW(SortedPokemon)
 	ld [wcd2f], a
-	ld a, SortedPokemon / $100
+	ld a, HIGH(SortedPokemon)
 	ld [wcd30], a
 
-	ld a, $c6a8 % $100
+	ld a, LOW($c6a8)
 	ld [wcd31], a
-	ld a, $c6a8 / $100
+	ld a, HIGH($c6a8)
 	ld [wcd32], a
 
-	ld a, $c64a % $100
+	ld a, LOW($c64a)
 	ld [wcd33], a
-	ld a, $c64a / $100
+	ld a, HIGH($c64a)
 	ld [wcd34], a
 
 	ld hl, EZChat_SortedWords
--- a/mobile/mobile_12.asm
+++ b/mobile/mobile_12.asm
@@ -39,9 +39,9 @@
 .asm_4808a
 	ld a, $5
 	ld [MusicFade], a
-	ld a, MUSIC_MOBILE_ADAPTER_MENU % $100
+	ld a, LOW(MUSIC_MOBILE_ADAPTER_MENU)
 	ld [MusicFadeID], a
-	ld a, MUSIC_MOBILE_ADAPTER_MENU / $100
+	ld a, HIGH(MUSIC_MOBILE_ADAPTER_MENU)
 	ld [MusicFadeID + 1], a
 	ld c, 20
 	call DelayFrames
--- a/mobile/mobile_40.asm
+++ b/mobile/mobile_40.asm
@@ -2736,9 +2736,9 @@
 
 .ContinueCopy:
 	; Copy, via wc608...
-	ld a, wc608 % $100
+	ld a, LOW(wc608)
 	ld [StringBuffer2], a
-	ld a, wc608 / $100
+	ld a, HIGH(wc608)
 	ld [StringBuffer2 + 1], a
 	; ... bc bytes...
 	ld a, c
@@ -7237,9 +7237,9 @@
 	add a
 	add a
 
-	add Unknown_10327a % $100
+	add LOW(Unknown_10327a)
 	ld l, a
-	ld a, Unknown_10327a / $100
+	ld a, HIGH(Unknown_10327a)
 	adc 0
 	ld h, a
 
--- a/mobile/mobile_42.asm
+++ b/mobile/mobile_42.asm
@@ -1297,7 +1297,7 @@
 MobileTradeAnim_DisplayEggData
 	call WaitTop
 	call MobileTradeAnim_ClearTilemap
-	ld a, VBGMap1 / $100
+	ld a, HIGH(VBGMap1)
 	ld [hBGMapAddress + 1], a
 	hlcoord 5, 0
 	ld b, 6
@@ -1320,7 +1320,7 @@
 Function108a33: ; 108a33
 	call WaitTop
 	call MobileTradeAnim_ClearTilemap
-	ld a, VBGMap1 / $100
+	ld a, HIGH(VBGMap1)
 	ld [hBGMapAddress + 1], a
 	hlcoord 5, 0
 	ld b, 6
@@ -1340,7 +1340,7 @@
 MobileTradeAnim_LoadMonTemplate: ; 108a5b
 	call WaitTop
 	call MobileTradeAnim_ClearTilemap
-	ld a, VBGMap1 / $100
+	ld a, HIGH(VBGMap1)
 	ld [hBGMapAddress + 1], a
 	hlcoord 4, 0
 	ld b,  6
@@ -1363,7 +1363,7 @@
 MobileTradeAnim_MonDisplay_UpdateBGMap: ; 108a87
 	call WaitBGMap
 	call WaitTop
-	ld a, VBGMap0 / $100
+	ld a, HIGH(VBGMap0)
 	ld [hBGMapAddress + 1], a
 	ret
 ; 108a92
--- a/mobile/mobile_45.asm
+++ b/mobile/mobile_45.asm
@@ -1,4 +1,3 @@
-
 SECTION "bank45", ROMX
 
 	charmap " ", $20 ; revert to ascii
@@ -7613,9 +7612,9 @@
 	ld c, 8
 .loop
 	push hl
-	ld a, $7fff % $100
+	ld a, LOW(palred 31 + palgreen 31 + palblue 31)
 	ld [hli], a
-	ld a, $7fff / $100
+	ld a, HIGH(palred 31 + palgreen 31 + palblue 31)
 	ld [hl], a
 	pop hl
 	add hl, de
--- a/mobile/mobile_46.asm
+++ b/mobile/mobile_46.asm
@@ -1901,17 +1901,17 @@
 	and a
 	jr z, .asm_118fba
 	ld hl, $c346
-	ld a, $c608 % $100
+	ld a, LOW($c608)
 	ld [hli], a
-	ld a, $c608 / $100
+	ld a, HIGH($c608)
 	ld [hli], a
 	ld a, [wcd4b]
 	ld [hli], a
 	ld a, [wcd4c]
 	ld [hli], a
-	ld a, $c708 % $100
+	ld a, LOW($c708)
 	ld [hli], a
-	ld a, $c708 / $100
+	ld a, HIGH($c708)
 	ld [hli], a
 	ld a, $60
 	ld [hli], a
@@ -2530,17 +2530,17 @@
 	ld [wcd3c], a
 	call BattleTowerRoomMenu2
 	ld hl, $c346
-	ld a, wd000 % $100
+	ld a, LOW(wd000)
 	ld [hli], a
-	ld a, wd000 / $100
+	ld a, HIGH(wd000)
 	ld [hli], a
 	ld a, [wcd3b]
 	ld [hli], a
 	xor a
 	ld [hli], a
-	ld a, $c708 % $100
+	ld a, LOW($c708)
 	ld [hli], a
-	ld a, $c708 / $100
+	ld a, HIGH($c708)
 	ld [hli], a
 	ld a, $60
 	ld [hli], a
@@ -3358,17 +3358,17 @@
 	ld hl, $c608 + 2
 	call Function119940
 	ld hl, w3_d800
-	ld a, $c608 % $100
+	ld a, LOW($c608)
 	ld [hli], a
-	ld a, $c608 / $100
+	ld a, HIGH($c608)
 	ld [hli], a
 	ld a, $f6
 	ld [hli], a
 	xor a
 	ld [hli], a
-	ld a, $c708 % $100
+	ld a, LOW($c708)
 	ld [hli], a
-	ld a, $c708 / $100
+	ld a, HIGH($c708)
 	ld [hli], a
 	ld a, [wcd51]
 	ld [hli], a
@@ -3794,10 +3794,10 @@
 	cp $d
 	jr nz, .asm_119b93
 	ld a, l
-	cp (w3_d869) % $100
+	cp LOW(w3_d869)
 	jr nz, .asm_119be3
 	ld a, h
-	cp (w3_d869) / $100
+	cp HIGH(w3_d869)
 	jr nz, .asm_119be3
 	ld a, $5
 	call GetSRAMBank
@@ -5497,9 +5497,9 @@
 .asm_11a94f
 	xor a
 	ld [$c31f], a
-	ld a, $c320 % $100
+	ld a, LOW($c320)
 	ld [$c31b], a
-	ld a, $c320 / $100
+	ld a, HIGH($c320)
 	ld [$c31c], a
 	hlcoord 1, 14
 	ld a, l
@@ -7456,29 +7456,29 @@
 	ld a, [wcd31]
 	ld [$c709], a
 
-	ld a, $c708 % $100
+	ld a, LOW($c708) ; Species
 	ld [wMobileMonSpeciesPointerBuffer], a
-	ld a, $c708 / $100
+	ld a, HIGH($c708)
 	ld [wMobileMonSpeciesPointerBuffer + 1], a
 
-	ld a, $c60d % $100 ; Partymon Struct
+	ld a, LOW($c60d) ; Partymon Struct
 	ld [wMobileMonStructurePointerBuffer], a
-	ld a, $c60d / $100
+	ld a, HIGH($c60d)
 	ld [wMobileMonStructurePointerBuffer + 1], a
 
-	ld a, $c63d % $100 ; OT
+	ld a, LOW($c63d) ; OT
 	ld [wMobileMonOTNamePointerBuffer], a
-	ld a, $c63d / $100
+	ld a, HIGH($c63d)
 	ld [wMobileMonOTNamePointerBuffer + 1], a
 
-	ld a, $c642 % $100 ; Nickname
+	ld a, LOW($c642) ; Nickname
 	ld [wMobileMonNicknamePointerBuffer], a
-	ld a, $c642 / $100
+	ld a, HIGH($c642)
 	ld [wMobileMonNicknamePointerBuffer + 1], a
 
-	ld a, $c647 % $100 ; ???
+	ld a, LOW($c647) ; Mail
 	ld [wMobileMonMailPointerBuffer], a
-	ld a, $c647 / $100
+	ld a, HIGH($c647)
 	ld [wMobileMonMailPointerBuffer + 1], a
 
 	ld a, $46
@@ -7762,29 +7762,29 @@
 	call CopyBytes
 	call CloseSRAM
 
-	ld a, $c608 % $100
+	ld a, LOW($c608)
 	ld [wMobileMonSpeciesPointerBuffer], a
-	ld a, $c608 / $100
+	ld a, HIGH($c608)
 	ld [wMobileMonSpeciesPointerBuffer + 1], a
 
-	ld a, $c611 % $100
+	ld a, LOW($c611)
 	ld [wMobileMonStructurePointerBuffer], a
-	ld a, $c611 / $100
+	ld a, HIGH($c611)
 	ld [wMobileMonStructurePointerBuffer + 1], a
 
-	ld a, $c641 % $100
+	ld a, LOW($c641)
 	ld [wMobileMonOTNamePointerBuffer], a
-	ld a, $c641 / $100
+	ld a, HIGH($c641)
 	ld [wMobileMonOTNamePointerBuffer + 1], a
 
-	ld a, $c646 % $100
+	ld a, LOW($c646)
 	ld [wMobileMonNicknamePointerBuffer], a
-	ld a, $c646 / $100
+	ld a, HIGH($c646)
 	ld [wMobileMonNicknamePointerBuffer + 1], a
 
-	ld a, $c64b % $100
+	ld a, LOW($c64b)
 	ld [wMobileMonMailPointerBuffer], a
-	ld a, $c64b / $100
+	ld a, HIGH($c64b)
 	ld [wMobileMonMailPointerBuffer + 1], a
 	call AddMobileMonToParty
 	farcall SaveAfterLinkTrade
--- a/tilesets/animations.asm
+++ b/tilesets/animations.asm
@@ -1,4 +1,3 @@
-
 _AnimateTileset:: ; fc000
 ; Iterate over a given pointer array of
 ; animation functions (one per frame).
@@ -476,10 +475,10 @@
 	add a
 	add a
 
-	add WaterTileFrames % $100
+	add LOW(WaterTileFrames)
 	ld l, a
 	ld a, 0
-	adc WaterTileFrames / $100
+	adc HIGH(WaterTileFrames)
 	ld h, a
 
 ; Stack now points to the start of the tile for this frame.
@@ -514,10 +513,10 @@
 	add a
 	add a
 	add a
-	add ForestTreeLeftFrames % $100
+	add LOW(ForestTreeLeftFrames)
 	ld l, a
 	ld a, 0
-	adc ForestTreeLeftFrames / $100
+	adc HIGH(ForestTreeLeftFrames)
 	ld h, a
 
 .asm_fc47d
@@ -556,10 +555,10 @@
 	add a
 	add a
 	add a
-	add ForestTreeLeftFrames % $100
+	add LOW(ForestTreeLeftFrames)
 	ld l, a
 	ld a, 0
-	adc ForestTreeLeftFrames / $100
+	adc HIGH(ForestTreeLeftFrames)
 	ld h, a
 	push bc
 	ld bc, ForestTreeRightFrames - ForestTreeLeftFrames
@@ -592,10 +591,10 @@
 	add a
 	add a
 	add a
-	add ForestTreeLeftFrames % $100
+	add LOW(ForestTreeLeftFrames)
 	ld l, a
 	ld a, 0
-	adc ForestTreeLeftFrames / $100
+	adc HIGH(ForestTreeLeftFrames)
 	ld h, a
 
 .asm_fc515
@@ -624,10 +623,10 @@
 	add a
 	add a
 	add a
-	add ForestTreeLeftFrames % $100
+	add LOW(ForestTreeLeftFrames)
 	ld l, a
 	ld a, 0
-	adc ForestTreeLeftFrames / $100
+	adc HIGH(ForestTreeLeftFrames)
 	ld h, a
 	push bc
 	ld bc, ForestTreeRightFrames - ForestTreeLeftFrames
--- a/tilesets/battle_tower.pal
+++ /dev/null
@@ -1,40 +1,0 @@
-; gray
-	RGB 30, 28, 26
-	RGB 19, 19, 19
-	RGB 13, 13, 13
-	RGB 07, 07, 07
-; red
-	RGB 30, 28, 26
-	RGB 31, 19, 24
-	RGB 30, 10, 06
-	RGB 07, 07, 07
-; green
-	RGB 18, 24, 09
-	RGB 15, 20, 01
-	RGB 09, 13, 00
-	RGB 07, 07, 07
-; water (blue)
-	RGB 30, 28, 26
-	RGB 15, 16, 31
-	RGB 09, 09, 31
-	RGB 07, 07, 07
-; yellow
-	RGB 30, 28, 26
-	RGB 31, 31, 07
-	RGB 31, 16, 01
-	RGB 07, 07, 07
-; brown
-	RGB 26, 24, 17
-	RGB 21, 17, 07
-	RGB 16, 13, 03
-	RGB 07, 07, 07
-; roof
-	RGB 05, 05, 16
-	RGB 08, 19, 28
-	RGB 00, 00, 00
-	RGB 31, 31, 31
-; text
-	RGB 31, 31, 16
-	RGB 31, 31, 16
-	RGB 14, 09, 00
-	RGB 00, 00, 00
--- a/tilesets/data.asm
+++ b/tilesets/data.asm
@@ -1,8 +1,3 @@
-SECTION "Roofs", ROMX
-
-INCLUDE "tilesets/roofs.asm"
-
-
 SECTION "Tileset Data 1", ROMX
 
 TilesetKantoGFX: ; 0x18000
--- a/tilesets/house_1.pal
+++ /dev/null
@@ -1,40 +1,0 @@
-; gray
-	RGB 30, 28, 26
-	RGB 19, 19, 19
-	RGB 13, 13, 13
-	RGB 07, 07, 07
-; red
-	RGB 30, 28, 26
-	RGB 31, 19, 24
-	RGB 30, 10, 06
-	RGB 07, 07, 07
-; green
-	RGB 30, 28, 26
-	RGB 15, 20, 01
-	RGB 09, 13, 00
-	RGB 07, 07, 07
-; water (blue)
-	RGB 30, 28, 26
-	RGB 15, 16, 31
-	RGB 09, 09, 31
-	RGB 07, 07, 07
-; yellow
-	RGB 30, 28, 26
-	RGB 31, 31, 07
-	RGB 31, 16, 01
-	RGB 07, 07, 07
-; brown
-	RGB 26, 24, 17
-	RGB 21, 17, 07
-	RGB 16, 13, 03
-	RGB 07, 07, 07
-; roof (glass)
-	RGB 30, 28, 26
-	RGB 31, 19, 24
-	RGB 16, 13, 03
-	RGB 07, 07, 07
-; text
-	RGB 31, 31, 16
-	RGB 31, 31, 16
-	RGB 14, 09, 00
-	RGB 00, 00, 00
--- a/tilesets/ice_path.pal
+++ /dev/null
@@ -1,40 +1,0 @@
-; gray
-	RGB 15, 14, 24
-	RGB 11, 11, 19
-	RGB 07, 07, 12
-	RGB 00, 00, 00
-; red
-	RGB 15, 14, 24
-	RGB 14, 07, 17
-	RGB 13, 00, 08
-	RGB 00, 00, 00
-; green (ice)
-	RGB 22, 29, 31
-	RGB 10, 27, 31
-	RGB 31, 31, 31
-	RGB 05, 00, 09
-; water
-	RGB 15, 14, 24
-	RGB 05, 05, 17
-	RGB 03, 03, 10
-	RGB 00, 00, 00
-; yellow
-	RGB 30, 30, 11
-	RGB 16, 14, 18
-	RGB 16, 14, 10
-	RGB 00, 00, 00
-; brown
-	RGB 15, 14, 24
-	RGB 12, 09, 15
-	RGB 08, 04, 05
-	RGB 00, 00, 00
-; roof (snow)
-	RGB 25, 31, 31
-	RGB 09, 28, 31
-	RGB 16, 11, 31
-	RGB 05, 00, 09
-; text
-	RGB 31, 31, 16
-	RGB 31, 31, 16
-	RGB 14, 09, 00
-	RGB 00, 00, 00
--- /dev/null
+++ b/tilesets/palettes/battle_tower.pal
@@ -1,0 +1,40 @@
+; gray
+	RGB 30, 28, 26
+	RGB 19, 19, 19
+	RGB 13, 13, 13
+	RGB 07, 07, 07
+; red
+	RGB 30, 28, 26
+	RGB 31, 19, 24
+	RGB 30, 10, 06
+	RGB 07, 07, 07
+; green
+	RGB 18, 24, 09
+	RGB 15, 20, 01
+	RGB 09, 13, 00
+	RGB 07, 07, 07
+; water (blue)
+	RGB 30, 28, 26
+	RGB 15, 16, 31
+	RGB 09, 09, 31
+	RGB 07, 07, 07
+; yellow
+	RGB 30, 28, 26
+	RGB 31, 31, 07
+	RGB 31, 16, 01
+	RGB 07, 07, 07
+; brown
+	RGB 26, 24, 17
+	RGB 21, 17, 07
+	RGB 16, 13, 03
+	RGB 07, 07, 07
+; roof
+	RGB 05, 05, 16
+	RGB 08, 19, 28
+	RGB 00, 00, 00
+	RGB 31, 31, 31
+; text
+	RGB 31, 31, 16
+	RGB 31, 31, 16
+	RGB 14, 09, 00
+	RGB 00, 00, 00
--- /dev/null
+++ b/tilesets/palettes/house_1.pal
@@ -1,0 +1,40 @@
+; gray
+	RGB 30, 28, 26
+	RGB 19, 19, 19
+	RGB 13, 13, 13
+	RGB 07, 07, 07
+; red
+	RGB 30, 28, 26
+	RGB 31, 19, 24
+	RGB 30, 10, 06
+	RGB 07, 07, 07
+; green
+	RGB 30, 28, 26
+	RGB 15, 20, 01
+	RGB 09, 13, 00
+	RGB 07, 07, 07
+; water (blue)
+	RGB 30, 28, 26
+	RGB 15, 16, 31
+	RGB 09, 09, 31
+	RGB 07, 07, 07
+; yellow
+	RGB 30, 28, 26
+	RGB 31, 31, 07
+	RGB 31, 16, 01
+	RGB 07, 07, 07
+; brown
+	RGB 26, 24, 17
+	RGB 21, 17, 07
+	RGB 16, 13, 03
+	RGB 07, 07, 07
+; roof (glass)
+	RGB 30, 28, 26
+	RGB 31, 19, 24
+	RGB 16, 13, 03
+	RGB 07, 07, 07
+; text
+	RGB 31, 31, 16
+	RGB 31, 31, 16
+	RGB 14, 09, 00
+	RGB 00, 00, 00
--- /dev/null
+++ b/tilesets/palettes/ice_path.pal
@@ -1,0 +1,40 @@
+; gray
+	RGB 15, 14, 24
+	RGB 11, 11, 19
+	RGB 07, 07, 12
+	RGB 00, 00, 00
+; red
+	RGB 15, 14, 24
+	RGB 14, 07, 17
+	RGB 13, 00, 08
+	RGB 00, 00, 00
+; green (ice)
+	RGB 22, 29, 31
+	RGB 10, 27, 31
+	RGB 31, 31, 31
+	RGB 05, 00, 09
+; water
+	RGB 15, 14, 24
+	RGB 05, 05, 17
+	RGB 03, 03, 10
+	RGB 00, 00, 00
+; yellow
+	RGB 30, 30, 11
+	RGB 16, 14, 18
+	RGB 16, 14, 10
+	RGB 00, 00, 00
+; brown
+	RGB 15, 14, 24
+	RGB 12, 09, 15
+	RGB 08, 04, 05
+	RGB 00, 00, 00
+; roof (snow)
+	RGB 25, 31, 31
+	RGB 09, 28, 31
+	RGB 16, 11, 31
+	RGB 05, 00, 09
+; text
+	RGB 31, 31, 16
+	RGB 31, 31, 16
+	RGB 14, 09, 00
+	RGB 00, 00, 00
--- /dev/null
+++ b/tilesets/palettes/pokecom_center.pal
@@ -1,0 +1,40 @@
+; gray
+	RGB 30, 28, 26
+	RGB 19, 19, 19
+	RGB 13, 13, 13
+	RGB 07, 07, 07
+; red
+	RGB 30, 28, 26
+	RGB 31, 19, 24
+	RGB 30, 10, 06
+	RGB 07, 07, 07
+; green
+	RGB 18, 24, 09
+	RGB 15, 20, 01
+	RGB 09, 13, 00
+	RGB 07, 07, 07
+; water (blue)
+	RGB 30, 28, 26
+	RGB 17, 19, 31
+	RGB 14, 16, 31
+	RGB 07, 07, 07
+; yellow
+	RGB 31, 26, 21
+	RGB 31, 20, 01
+	RGB 14, 16, 31
+	RGB 07, 07, 07
+; brown
+	RGB 21, 17, 07
+	RGB 17, 19, 31
+	RGB 16, 13, 03
+	RGB 07, 07, 07
+; roof
+	RGB 05, 05, 16
+	RGB 08, 19, 28
+	RGB 00, 00, 00
+	RGB 31, 31, 31
+; text
+	RGB 31, 31, 16
+	RGB 31, 31, 16
+	RGB 14, 09, 00
+	RGB 00, 00, 00
--- /dev/null
+++ b/tilesets/palettes/radio_tower.pal
@@ -1,0 +1,39 @@
+	RGB 27, 31, 27
+	RGB 21, 21, 21
+	RGB 13, 13, 13
+	RGB 07, 07, 07
+
+	RGB 27, 31, 27
+	RGB 31, 19, 24
+	RGB 30, 10, 06
+	RGB 07, 07, 07
+
+	RGB 08, 12, 31
+	RGB 12, 25, 01
+	RGB 05, 14, 00
+	RGB 07, 07, 07
+
+	RGB 31, 31, 31
+	RGB 08, 12, 31
+	RGB 01, 04, 31
+	RGB 07, 07, 07
+
+	RGB 27, 31, 27
+	RGB 12, 25, 01
+	RGB 05, 14, 00
+	RGB 07, 07, 07
+
+	RGB 27, 31, 27
+	RGB 24, 18, 07
+	RGB 20, 15, 03
+	RGB 07, 07, 07
+
+	RGB 27, 31, 27
+	RGB 15, 31, 31
+	RGB 05, 17, 31
+	RGB 07, 07, 07
+
+	RGB 31, 31, 16
+	RGB 31, 31, 16
+	RGB 14, 09, 00
+	RGB 00, 00, 00
--- a/tilesets/pokecom_center.pal
+++ /dev/null
@@ -1,40 +1,0 @@
-; gray
-	RGB 30, 28, 26
-	RGB 19, 19, 19
-	RGB 13, 13, 13
-	RGB 07, 07, 07
-; red
-	RGB 30, 28, 26
-	RGB 31, 19, 24
-	RGB 30, 10, 06
-	RGB 07, 07, 07
-; green
-	RGB 18, 24, 09
-	RGB 15, 20, 01
-	RGB 09, 13, 00
-	RGB 07, 07, 07
-; water (blue)
-	RGB 30, 28, 26
-	RGB 17, 19, 31
-	RGB 14, 16, 31
-	RGB 07, 07, 07
-; yellow
-	RGB 31, 26, 21
-	RGB 31, 20, 01
-	RGB 14, 16, 31
-	RGB 07, 07, 07
-; brown
-	RGB 21, 17, 07
-	RGB 17, 19, 31
-	RGB 16, 13, 03
-	RGB 07, 07, 07
-; roof
-	RGB 05, 05, 16
-	RGB 08, 19, 28
-	RGB 00, 00, 00
-	RGB 31, 31, 31
-; text
-	RGB 31, 31, 16
-	RGB 31, 31, 16
-	RGB 14, 09, 00
-	RGB 00, 00, 00
--- a/tilesets/radio_tower.pal
+++ /dev/null
@@ -1,39 +1,0 @@
-	RGB 27, 31, 27
-	RGB 21, 21, 21
-	RGB 13, 13, 13
-	RGB 07, 07, 07
-
-	RGB 27, 31, 27
-	RGB 31, 19, 24
-	RGB 30, 10, 06
-	RGB 07, 07, 07
-
-	RGB 08, 12, 31
-	RGB 12, 25, 01
-	RGB 05, 14, 00
-	RGB 07, 07, 07
-
-	RGB 31, 31, 31
-	RGB 08, 12, 31
-	RGB 01, 04, 31
-	RGB 07, 07, 07
-
-	RGB 27, 31, 27
-	RGB 12, 25, 01
-	RGB 05, 14, 00
-	RGB 07, 07, 07
-
-	RGB 27, 31, 27
-	RGB 24, 18, 07
-	RGB 20, 15, 03
-	RGB 07, 07, 07
-
-	RGB 27, 31, 27
-	RGB 15, 31, 31
-	RGB 05, 17, 31
-	RGB 07, 07, 07
-
-	RGB 31, 31, 16
-	RGB 31, 31, 16
-	RGB 14, 09, 00
-	RGB 00, 00, 00
--- a/tilesets/roofs.asm
+++ b/tilesets/roofs.asm
@@ -18,12 +18,3 @@
 
 
 INCLUDE "data/maps/mapgroup_roofs.asm"
-
-
-Roofs: ; 1c03c
-INCBIN "gfx/tilesets/roofs/0.2bpp"
-INCBIN "gfx/tilesets/roofs/1.2bpp"
-INCBIN "gfx/tilesets/roofs/2.2bpp"
-INCBIN "gfx/tilesets/roofs/3.2bpp"
-INCBIN "gfx/tilesets/roofs/4.2bpp"
-; 1c30c
--- a/tilesets/special_palettes.asm
+++ b/tilesets/special_palettes.asm
@@ -63,7 +63,7 @@
 ; 49501
 
 PokeComPalette: ; 49501
-INCLUDE "tilesets/pokecom_center.pal"
+INCLUDE "tilesets/palettes/pokecom_center.pal"
 ; 49541
 
 LoadBattleTowerPalette: ; 49541
@@ -76,7 +76,7 @@
 ; 49550
 
 BattleTowerPalette: ; 49550
-INCLUDE "tilesets/battle_tower.pal"
+INCLUDE "tilesets/palettes/battle_tower.pal"
 ; 49590
 
 LoadIcePathPalette: ; 49590
@@ -89,7 +89,7 @@
 ; 4959f
 
 IcePathPalette: ; 4959f
-INCLUDE "tilesets/ice_path.pal"
+INCLUDE "tilesets/palettes/ice_path.pal"
 ; 495df
 
 LoadHousePalette: ; 495df
@@ -102,7 +102,7 @@
 ; 495ee
 
 HousePalette: ; 495ee
-INCLUDE "tilesets/house_1.pal"
+INCLUDE "tilesets/palettes/house_1.pal"
 ; 4962e
 
 LoadRadioTowerPalette: ; 4962e
@@ -115,7 +115,7 @@
 ; 4963d
 
 RadioTowerPalette: ; 4963d
-INCLUDE "tilesets/radio_tower.pal"
+INCLUDE "tilesets/palettes/radio_tower.pal"
 ; 4967d
 
 MansionPalette1: ; 4967d