Topics

UTTORI ASM ยท IN DEVELOPMENT

Source syntax

Write numbers, labels, comments, and instructions in Uttori ASM source.

On this page

SNES behavior

Encoding & Case

Source files are read as UTF-8. Mnemonics and directive keywords are case-insensitive. Symbol spelling is preserved and should be treated as intentional. The fixtures favor lowercase directives and uppercase hardware mnemonics, which is pleasantly readable but not mandatory.

Numbers

Form Example Meaning
Hexadecimal $80FF, 0x80FF Base 16
Binary %10110000 Base 2
Decimal 33023, 10.5 Base 10. Expressions may be fractional
Immediate #$20 Architecture syntax. # is removed before numeric evaluation

Negative and unary-plus values are accepted. ~value and Asar-style !value perform bitwise NOT when ! cannot begin a define name. <:value shifts a value right by 16 bits. It is retained for compatibility with sources that use the form.

The 65C816 encoder also recognizes bank shorthand such as $12:3456. See the Asar example bank_shorthand.asm:

org $008000
	main:
		lda #<:main
		lda #<:test_label
		lda #bank(other_test)

base $038000
	test_label:

base $028000
	other_test:

Comments, Continuation, & Inline Commands

A semicolon begins a comment unless it appears inside a double-quoted string:

lda #$0F ; this vanishes before parsing
db "semicolon; retained"

End a line with \ or , to continue the command on the next physical line:

db $01, $02,
   $03, $04

function scale(value) = value * \
  4

Whitespace-surrounded colons split multiple statements on one line:

fillbyte $FF : fill $20

Colons inside quoted strings are safe. A label colon directly attached to a name remains a label colon.

Quotes & Directive Prefixes

Single and double quotes are accepted in several tokenized contexts. String data and expression string arguments should normally use double quotes. @ may prefix a recognized directive, so @org $008000 routes to org. It does not create a second directive family.

Braces { and } are accepted compatibility no-ops. They can make nested namespace source easier on human retinas, but they do not create block scope by themselves:

namespace Graphics
{
  Upload:
    rtl
}
namespace off

6502 family behavior

The plugin owns two dialects. 65xx.raw uses the core native profile. 65xx.ca65-raw and 65xx.nes use the ca65 profile.

Behavior Native (65xx.raw) ca65 (65xx.ca65-raw, 65xx.nes)
Directive prefix none. org $8000 . . .org $8000
Cheap locals no @name attached to the current global
File-local symbols no non-exported labels are per include file
Macro call %Name(args) bare Name args after .macro
Macro parameter <arg> \parameter
Assignment Name = value Name := value also accepted
Unnamed labels +: / -: and bne + :, :+, :++, :-, :--
Octal no @17 (ca65)
Address-size prefix .b / .w on the mnemonic z:, a:, f: on the operand
Statement chaining no : split no : split

Encoding & Case

Source files are read as UTF-8. Mnemonics and directive keywords are case-insensitive. Symbol spelling is preserved and should be treated as intentional. The fixtures favor lowercase directives and lowercase or mixed-case mnemonics. Either works.

Numbers

Form Example Meaning
Hexadecimal $80FF, 0x80FF Base 16
Binary %10110000 Base 2
Decimal 33023, 10.5 Base 10. Expressions may be fractional
Octal @17 ca65 only. Rewritten to decimal 15
Immediate #$20 Architecture syntax. # is removed before numeric evaluation

Negative and unary-plus values are accepted. Immediate #-1 is legal for an 8-bit immediate (signed). Addresses stay unsigned.

ca65 unary byte extracts are <value, >value, and ^value for low, high, and bank bytes. Native sources that want the same thing use lobyte() / hibyte() on a ca65 target, or & $FF / >> 8 anywhere.

Comments, Continuation, & Quotes

A semicolon begins a comment unless it appears inside a double-quoted string:

lda #$0F ; this vanishes before parsing
.byte "semicolon; retained"

End a line with \ or , to continue the command on the next physical line. String data and expression string arguments should normally use double quotes.