diff src/expr.c @ 47:804d7465e0f9

Implemented ORG and fixed problems with constants using $, &, or @ to specify base
author lost
date Sun, 04 Jan 2009 07:25:03 +0000
parents 2330b88f9600
children 73423b66e511
line wrap: on
line diff
--- a/src/expr.c	Sun Jan 04 07:07:00 2009 +0000
+++ b/src/expr.c	Sun Jan 04 07:25:03 2009 +0000
@@ -318,7 +318,7 @@
 		int val = 0;
 		
 		(*p)++;
-		while (strchr("0123456789", **p))
+		while (**p && strchr("0123456789", **p))
 		{
 			val = val * 10 + (**p - '0');
 			(*p)++;
@@ -350,11 +350,13 @@
 		int val = 0, val2;
 		
 		(*p)++;
-		while (strchr("0123456789ABCDEFabcdef", **p))
+		debug_message(3, "Found prefix hex constant: %s", *p);
+		while (**p && strchr("0123456789ABCDEFabcdef", **p))
 		{
 			val2 = toupper(**p) - '0';
 			if (val2 > 9)
 				val2 -= 7;
+			debug_message(3, "Got char: %c (%d)", **p, val2);
 			val = val * 16 + val2;
 			(*p)++;
 		}
@@ -371,7 +373,7 @@
 		int val = 0;
 		
 		(*p)++;
-		while (strchr("01234567", **p))
+		while (**p && strchr("01234567", **p))
 		{
 			val = val * 8 + (**p - '0');
 			(*p)++;