commit c298c6f
Devine Lu Linvega
·
2024-04-04 02:46:26 +0000 UTC
parent 0df50c4
(uxnasm) No context for findopcode
1 files changed,
+8,
-8
+8,
-8
1@@ -45,7 +45,7 @@ static char *save(char *s, char c) { char *o = dictnext; while((*dictnext++ = *s
2 static char *join(char *a, char j, char *b) { char *res = dictnext; save(a, j), save(b, 0); return res; } /* join two str */
3
4 #define ishex(x) (shex(x) >= 0)
5-#define isopc(x) (findopcode(x, ctx) || scmp(x, "BRK", 4))
6+#define isopc(x) (findopcode(x) || scmp(x, "BRK", 4))
7 #define isinvalid(x) (!x[0] || ishex(x) || isopc(x) || find(runes, x[0]) >= 0)
8 #define writeshort(x) (writebyte(x >> 8, ctx) && writebyte(x & 0xff, ctx))
9 #define findlabel(x) finditem(x, labels, labels_len)
10@@ -82,7 +82,7 @@ finditem(char *name, Item *list, int len)
11 }
12
13 static Uint8
14-findopcode(char *s, Context *ctx)
15+findopcode(char *s)
16 {
17 int i;
18 for(i = 0; i < 0x20; i++) {
19@@ -97,7 +97,7 @@ findopcode(char *s, Context *ctx)
20 else if(s[m] == 'k')
21 i |= (1 << 7);
22 else
23- return error_asm("Opcode mode unknown");
24+ return 0;
25 m++;
26 }
27 return i;
28@@ -261,7 +261,7 @@ static int
29 writehex(char *w, Context *ctx)
30 {
31 if(*w == '#')
32- writebyte(findopcode("LIT", ctx) | !!(++w)[2] << 5, ctx);
33+ writebyte(findopcode("LIT") | !!(++w)[2] << 5, ctx);
34 if(w[1] && !w[2])
35 return writebyte(shex(w), ctx);
36 else if(w[3] && !w[4])
37@@ -307,12 +307,12 @@ parse(char *w, FILE *f, Context *ctx)
38 case '}': return makelabel(makelambda(lambda_stack[--lambda_ptr]), 0, ctx);
39 case '#': return writehex(w, ctx);
40 case '_': return makeref(w + 1, w[0], ptr) && writebyte(0xff, ctx);
41- case ',': return makeref(w + 1, w[0], ptr + 1) && writebyte(findopcode("LIT", ctx), ctx) && writebyte(0xff, ctx);
42+ case ',': return makeref(w + 1, w[0], ptr + 1) && writebyte(findopcode("LIT"), ctx) && writebyte(0xff, ctx);
43 case '-': return makeref(w + 1, w[0], ptr) && writebyte(0xff, ctx);
44- case '.': return makeref(w + 1, w[0], ptr + 1) && writebyte(findopcode("LIT", ctx), ctx) && writebyte(0xff, ctx);
45+ case '.': return makeref(w + 1, w[0], ptr + 1) && writebyte(findopcode("LIT"), ctx) && writebyte(0xff, ctx);
46 case ':': printf("Deprecated rune %s, use =%s\n", w, w + 1); /* fall-through */
47 case '=': return makeref(w + 1, w[0], ptr) && writeshort(0xffff);
48- case ';': return makeref(w + 1, w[0], ptr + 1) && writebyte(findopcode("LIT2", ctx), ctx) && writeshort(0xffff);
49+ case ';': return makeref(w + 1, w[0], ptr + 1) && writebyte(findopcode("LIT2"), ctx) && writeshort(0xffff);
50 case '?': return makeref(w + 1, w[0], ptr + 1) && writebyte(0x20, ctx) && writeshort(0xffff);
51 case '!': return makeref(w + 1, w[0], ptr + 1) && writebyte(0x40, ctx) && writeshort(0xffff);
52 case '"': return writestring(w + 1, ctx);
53@@ -323,7 +323,7 @@ parse(char *w, FILE *f, Context *ctx)
54 case ']': return 1;
55 }
56 if(ishex(w)) return writehex(w, ctx);
57- if(isopc(w)) return writebyte(findopcode(w, ctx), ctx);
58+ if(isopc(w)) return writebyte(findopcode(w), ctx);
59 if((m = findmacro(w))) return walkmacro(m, ctx);
60 return makeref(w, ' ', ptr + 1) && writebyte(0x60, ctx) && writeshort(0xffff);
61 }