nxu/tal.nanorc

53 lines
1.2 KiB
Plaintext

# basic syntax for the uxntal assembly language
#
# mostly sticks to ANSI colors with a few exceptions
#
# comments are known to not handle nesting correctly.
# it's not possible to express nested comments using
# just start and end regexes.
# use this syntax for .tal files
syntax tal ".*\.tal"
# characters to insert when comments requested
comment "( | )"
# raw values
color green "\B\"\S+"
color green "\<[0-9a-f]{2}{1,2}\>"
color green "\<_\S+"
color green "\B-\S+"
color green "\B=\S+"
# literals
color bold,green "\B#[0-9a-f]{2}{1,2}\>"
# addresses (absolute, relative, zero-page)
color yellow "\B;\S+"
color yellow "\B,\S+"
color yellow "\B\.\S+"
# relative pads
color yellow "\B\$[0-9a-f]{1,4}\>\>"
# instructions
color cyan "\<(BRK|LIT|INC|POP|DUP|NIP|SWP|OVR|ROT|EQU|NEQ|GTH|LTH|JMP|JCN|JSR|STH|LDZ|STZ|LDR|STR|LDA|STA|DEI|DEO|ADD|SUB|MUL|DIV|AND|ORA|EOR|SFT)[2kr]*\>"
# label definitions
color bold,blue "(^|\s)(@|&)\S+"
# macros
color bold,magenta "\B%\S+"
# absolute pads
color yellow "\B\|[0-9a-f]{1,4}\>"
# immediate syntax
color bold,yellow "\?\S+"
color bold,yellow "!\S+"
color bold,yellow "\B\{\B"
color bold,yellow "\B\}\B"
# comments
color red start="\B\(\s" end="\s\)\B"