Topics

UTTORI ASM ยท IN DEVELOPMENT

Binary data and character tables

Emit bytes and words, translate character tables, and inspect data limits.

On this page

SNES behavior

Data Directives

Directive Width Aliases
db 1 byte dc.b
dw 2 bytes, little-endian dc.w
dl 3 bytes, little-endian dc.l
dd 4 bytes, little-endian none
db $12, $34
dw $1234          ; 34 12
dl $123456        ; 56 34 12
dd $12345678      ; 78 56 34 12
db "SUPER FAMICOM"

Values are truncated to the selected width. Strings emit one mapped value per Unicode character, truncated to the directive width. Defines may expand to whole lists:

!Palette = $001F,$03E0,$7C00
dw !Palette

Character Tables

Assign one character directly:

"A" = $40
db "A"

Load an Asar-style table file:

table "font.tbl",ltr
db "READY"
cleartable

LTR lines use character=hex. RTL lines use hex=character. A leading space can be the mapped character, so table lines are not casually trimmed. Loading a table replaces the active mapping. Unmapped characters fall back to their code point.

pushtable saves a copy, pulltable restores it, and cleartable restores identity fallback. Pulling an empty table stack is an error. See data/table.asm and misc.ts.

6502 family behavior

Native Data Directives

Directive Width Aliases
db 1 byte dc.b
dw 2 bytes, little-endian dc.w
dl 3 bytes, little-endian dc.l
dd 4 bytes, little-endian none

ca65 Data Directives

Directive Width Notes
.byte, .byt 1 byte Same emission as db
.addr, .word 2 bytes, little-endian Same emission as dw
.dbyt 2 bytes, big-endian High byte first
.faraddr 3 bytes, little-endian
.dword 4 bytes, little-endian
.lobytes 1 byte per expr Low byte of each expression
.hibytes 1 byte per expr High byte of each expression
.addr Target          ; 34 12
.dbyt Target          ; 12 34
.lobytes Target       ; 34
.hibytes Target       ; 12
.dword $12345678      ; 78 56 34 12
.faraddr $123456      ; 56 34 12

Character Tables

Native table, cleartable, pushtable, pulltable, and "A" = $40 character assignment are core features on 65xx.raw. See the SNES character-table section. ca65 .charmap / .wchar are not implemented.