gbdev / rgbds

Rednex Game Boy Development System - An assembly toolchain for the Nintendo Game Boy and Game Boy Color

Home Page:https://rgbds.gbdev.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

why can't charmaps be 16-bit

win-ini opened this issue · comments

you'd expect

charmap "你", $0000
charmap "好", $0001
charmap "!", $0002

db "你好!"

to assemble into 00 00 00 01 00 02 in the rom, but it actually assembles as 00 01 02. if you try to force 16-bit values:

charmap "你", $0100
charmap "好", $0101
charmap "!", $0102

db "你好!"

it just errors out. why?

This seems to be about the same as #97 (please see there for further details): there's no reason against them (see #265 for implementation ideas), but they would require a lot of effort to implement in the current codebase, and neither of the current maintainers are up for it.

It's probably worth mentioning that you're expecting the assembler to treat the number of digits you write as meaningful, which it never does. That's the source of your initial confusion here. $02, $0002, $00000002, and even just 2 are all the same exact value — they will not be processed any differently. charmap "!", $0002 is exactly the same as charmap "!", $02 or charmap "!", 2.

It's probably worth mentioning that you're expecting the assembler to treat the number of digits you write as meaningful, which it never does. That's the source of your initial confusion here. $02, $0002, $00000002, and even just 2 are all the same exact value — they will not be processed any differently. charmap "!", $0002 is exactly the same as charmap "!", $02 or charmap "!", 2.

well, you could always have a charmap16 or something that expects there to be a 16-bit value, and normal charmap could keep being 8-bit

for instance,

charmap16 "A", $01   ; will be treated as $0001
charmap   "a", $0002 ; will be treated as $02

charmap16 would be a restricted version of #97 and #265. And, anyway, the problem is in the complexity of implementing of emitting 16-bit charmaps, not in the directive itself.

Hi, try using a customised version of rgbds that adds support for 16-bit charmap
https://github.com/SnDream/rgbds
Currently at version 0.6.1
example: https://github.com/SnDream/pokecrystal_cn/blob/release_cn/charmap_cn.asm
There is a MACRO version of #97 without compiling custom rgbds, but it's not well suited to existing large projects.