commit f44c43b

Devine Lu Linvega  ·  2024-05-31 01:37:05 +0000 UTC
parent 4f846be
Fixed issue with invalid hexadecimal values
1 files changed,  +8, -7
+8, -7
 1@@ -266,12 +266,13 @@ writehex(char *w, Context *ctx)
 2 {
 3 	if(*w == '#')
 4 		writebyte(findopcode("LIT") | !!(++w)[2] << 5, ctx);
 5-	if(w[1] && !w[2])
 6-		return writebyte(shex(w), ctx);
 7-	else if(w[3] && !w[4])
 8-		return writeshort(shex(w));
 9-	else
10-		return error_asm("Hexadecimal invalid");
11+	if(ishex(w)) {
12+		if(w[1] && !w[2])
13+			return writebyte(shex(w), ctx);
14+		else if(w[3] && !w[4])
15+			return writeshort(shex(w));
16+	}
17+	return error_asm("Hexadecimal invalid");
18 }
19 
20 static int
21@@ -409,7 +410,7 @@ main(int argc, char *argv[])
22 {
23 	ptr = PAGE;
24 	copy("on-reset", scope, 0);
25-	if(argc == 2 && scmp(argv[1], "-v", 2)) return !printf("Uxnasm - Uxntal Assembler, 10 May 2024.\n");
26+	if(argc == 2 && scmp(argv[1], "-v", 2)) return !printf("Uxnasm - Uxntal Assembler, 30 May 2024.\n");
27 	if(argc != 3) return error_top("usage", "uxnasm [-v] input.tal output.rom");
28 	if(!assemble(argv[1])) return 1;
29 	if(!resolve(argv[2])) return 1;