commit b873f0478947eb171c775db6d0f3aa0c09c6b0a8
parent b4ddde5d4e7b3253c35e3e3ff97e8940090246ef
Author: neauoire <aliceffekt@gmail.com>
Date: Fri, 26 Nov 2021 08:11:18 -0800
Added tal syntax highlight for nano
Diffstat:
3 files changed, 51 insertions(+), 2 deletions(-)
diff --git a/etc/syntax-highlight/tal.nanorc b/etc/syntax-highlight/tal.nanorc
@@ -0,0 +1,51 @@
+# include this file in your ~/.nanorc:
+# include "path/to/uxntal.nanorc"
+
+syntax "uxntal" "\.tal$"
+
+# numbers
+color lightblue "[0-9a-f]{2}(\s|$)"
+color lightblue "[0-9a-f]{4}(\s|$)"
+
+# literal hex
+color cyan "#[0-9a-f]{2}(\s|$)"
+color cyan "#[0-9a-f]{4}(\s|$)"
+
+# absolute pad
+color bold,blue "\|[0-9a-f]{2}"
+color bold,blue "\|[0-9a-f]{4}"
+
+# labels
+# label define
+color green "@\S+"
+# sub-label define
+color green "&\S+"
+# literal addr absolute
+color magenta ";\S+"
+# literal addr relative
+color magenta ",\S+"
+# literal addr zero page
+color lightmagenta "\.\S+"
+
+# raw
+# character
+color lightred "'\S"
+# string
+color lightred ""\S+"
+# addr
+color lightyellow ":\S+"
+
+# include
+color lightcyan "~\S+"
+
+# macros definition
+color yellow "\%\S+"
+color yellow "[{}]"
+
+# instructions
+color bold,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]{,3}(\s|$)"
+
+# comments
+comment "( | )"
+color blue start="\(" end="\)"
+
diff --git a/etc/tal.sublime-syntax b/etc/syntax-highlight/tal.sublime-syntax
diff --git a/src/uxnasm.c b/src/uxnasm.c
@@ -282,8 +282,6 @@ parsetoken(char *w)
pushbyte((Uint8)w[1], 0);
return 1;
} else if(w[0] == '#') { /* immediate */
- if(slen(w + 1) == 1)
- pushbyte((Uint8)w[1], 1);
if(sihx(w + 1) && slen(w + 1) == 2)
pushbyte(shex(w + 1), 1);
else if(sihx(w + 1) && slen(w + 1) == 4)