INCHARMAP doesn't always produce correct output
dannye opened this issue · 1 comments
dannye commented
DEF TX_KATAKANA EQU $0f
MACRO fwcharmap
charmap STRCAT("FW{x:\1}_", \2), \3
ENDM
fwcharmap TX_KATAKANA, "デ", $4b
This creates the charmap entry "FWf_デ"
with the byte value $4b.
Therefore, both CHARLEN("FWf_デ")
and INCHARMAP("FWf_デ")
should return 1
.
However, this debugging code:
PRINTLN "=== CHARMAP ENTRY: FWf_デ ==="
PRINTLN "CHARLEN?"
PRINTLN CHARLEN("FWf_デ")
PRINTLN "INCHARMAP?"
PRINTLN INCHARMAP("FWf_デ")
Produces this output:
=== CHARMAP ENTRY: FWf_デ ===
CHARLEN?
$1
INCHARMAP?
$0
with rgbds v0.7.0.
CHARLEN("FWf_デ")
does return 1, rather than returning 5 or something larger, showing that "FWf_デ" is recognized as a single char charmap entry. But INCHARMAP("FWf_デ")
returns 0.
This was discovered here: https://github.com/pret/poketcg2
but if I have time, I'll try to see if I can produce a minimalist example.
Rangi42 commented
Thanks for reporting this!
Here's a minimal example that outright segfaults:
charmap "デ", 1
println incharmap("デ")
Using ASCII characters works though.