commit 7f5a496

zzo38  ·  2023-04-22 20:22:57 +0000 UTC
parent 72ed625
Add nonstandard [& and ]& commands into uxnasm.
2 files changed,  +4, -1
+2, -0
1@@ -138,6 +138,8 @@ The following nonstandard tokens are available:
2  ], ]. ]; ]: ]? ]! will act like a , . ; : ? ! referencing the anonymous
3  label defined by the matching [@ command.
4 
5+ [& and ]& are like [! and ]! but the opcode is JSI instead of JMI.
6+
7  ]\ acts like \: for the matching [@ command.
8 
9 For the . , : ; commands, the name can optionally start with & to mean
+2, -1
 1@@ -497,7 +497,7 @@ parse(char *w, FILE *f)
 2 	case '[':
 3 	case ']':
 4 		if(slen(w) == 1) break;
 5-		if((w[1]=='.' || w[1]==',' || w[1]==':' || w[1]==';' || w[1]=='@' || w[1]=='\\' || w[1]=='?' || w[1]=='!') && !w[2]) {
 6+		if((w[1]=='.' || w[1]==',' || w[1]==':' || w[1]==';' || w[1]=='@' || w[1]=='\\' || w[1]=='?' || w[1]=='!' || w[1]=='&') && !w[2]) {
 7 		  if(*w=='[') {
 8 		    if(bsptr==256) return error("Stack overflow",w);
 9 		    bstack[bsptr++]=i=bcnt++;
10@@ -509,6 +509,7 @@ parse(char *w, FILE *f)
11 		  switch(w[1]) {
12 		    case '@': if(!makelabel(w+2)) return error("Invalid label",w); break;
13 		    case '\\': goto spec_ref;
14+		    case '&': w[1]='!'; makereference(p.scope,w+1,p.ptr+1); return writebyte(0x60) && writeshort(0xffff, 0);
15 		    default: return parse(w+1,f);
16 		  }
17 		  break;