aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRangi <35663410+Rangi42@users.noreply.github.com>2025-11-23 22:19:21 -0500
committerGitHub <noreply@github.com>2025-11-23 21:19:21 -0600
commit308189b638d3dbed2283e041221b8db7d6063094 (patch)
treea588912a560ed276dd39654e90d4b2d5cd5c3534
parentUse more hardware and graphics constants (#532) (diff)
downloadpokeyellow-308189b638d3dbed2283e041221b8db7d6063094.tar.gz
pokeyellow-308189b638d3dbed2283e041221b8db7d6063094.tar.xz
pokeyellow-308189b638d3dbed2283e041221b8db7d6063094.zip
Use `ld_hli_a_string` macro to make byte-by-byte strings more obvious (#540)
-rw-r--r--engine/battle/core.asm12
-rw-r--r--engine/battle/link_battle_versus_text.asm4
-rw-r--r--engine/pokemon/status_ailments.asm30
-rw-r--r--home/pokemon.asm6
-rw-r--r--macros/code.asm8
5 files changed, 16 insertions, 44 deletions
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index 0916176c..672bd416 100644
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -6841,17 +6841,7 @@ InitWildBattle:
ld [hli], a ; write front sprite pointer
ld [hl], b
ld hl, wEnemyMonNick ; set name to "GHOST"
- ld a, 'G'
- ld [hli], a
- ld a, 'H'
- ld [hli], a
- ld a, 'O'
- ld [hli], a
- ld a, 'S'
- ld [hli], a
- ld a, 'T'
- ld [hli], a
- ld [hl], '@'
+ ld_hli_a_string "GHOST@"
ld a, [wCurPartySpecies]
push af
ld a, MON_GHOST
diff --git a/engine/battle/link_battle_versus_text.asm b/engine/battle/link_battle_versus_text.asm
index d37d40c7..89201f4a 100644
--- a/engine/battle/link_battle_versus_text.asm
+++ b/engine/battle/link_battle_versus_text.asm
@@ -13,9 +13,7 @@ DisplayLinkBattleVersusTextBox:
call PlaceString
; place bold "VS" tiles between the names
hlcoord 9, 8
- ld a, '<BOLD_V>'
- ld [hli], a
- ld [hl], '<BOLD_S>'
+ ld_hli_a_string "<BOLD_V><BOLD_S>"
xor a
ld [wUpdateSpritesEnabled], a
callfar SetupPlayerAndEnemyPokeballs
diff --git a/engine/pokemon/status_ailments.asm b/engine/pokemon/status_ailments.asm
index 2c5b3bcd..3cc2d490 100644
--- a/engine/pokemon/status_ailments.asm
+++ b/engine/pokemon/status_ailments.asm
@@ -10,37 +10,17 @@ PrintStatusAilment::
jr nz, .par
and SLP_MASK
ret z
- ld a, 'S'
- ld [hli], a
- ld a, 'L'
- ld [hli], a
- ld [hl], 'P'
+ ld_hli_a_string "SLP"
ret
.psn
- ld a, 'P'
- ld [hli], a
- ld a, 'S'
- ld [hli], a
- ld [hl], 'N'
+ ld_hli_a_string "PSN"
ret
.brn
- ld a, 'B'
- ld [hli], a
- ld a, 'R'
- ld [hli], a
- ld [hl], 'N'
+ ld_hli_a_string "BRN"
ret
.frz
- ld a, 'F'
- ld [hli], a
- ld a, 'R'
- ld [hli], a
- ld [hl], 'Z'
+ ld_hli_a_string "FRZ"
ret
.par
- ld a, 'P'
- ld [hli], a
- ld a, 'A'
- ld [hli], a
- ld [hl], 'R'
+ ld_hli_a_string "PAR"
ret
diff --git a/home/pokemon.asm b/home/pokemon.asm
index d720a642..df984d00 100644
--- a/home/pokemon.asm
+++ b/home/pokemon.asm
@@ -320,11 +320,7 @@ PrintStatusCondition::
pop de
jr nz, PrintStatusConditionNotFainted
; if the pokemon's HP is 0, print "FNT"
- ld a, 'F'
- ld [hli], a
- ld a, 'N'
- ld [hli], a
- ld [hl], 'T'
+ ld_hli_a_string "FNT"
and a
ret
diff --git a/macros/code.asm b/macros/code.asm
index c972f97e..70ff4249 100644
--- a/macros/code.asm
+++ b/macros/code.asm
@@ -10,6 +10,14 @@ ENDM
; Design patterns
+MACRO ld_hli_a_string
+ FOR n, CHARLEN(\1) - 1
+ ld a, CHARVAL(STRCHAR(\1, n))
+ ld [hli], a
+ ENDR
+ ld [hl], CHARVAL(STRCHAR(\1, CHARLEN(\1) - 1))
+ENDM
+
MACRO dict
IF \1 == 0
and a