| ... | ... |
@@ -14,6 +14,8 @@ WITH REGARD TO THIS SOFTWARE. |
| 14 | 14 |
#define TRIM 0x0100 |
| 15 | 15 |
#define LENGTH 0x10000 |
| 16 | 16 |
|
| 17 |
+#define LABELS 512 |
|
| 18 |
+ |
|
| 17 | 19 |
typedef unsigned char Uint8; |
| 18 | 20 |
typedef signed char Sint8; |
| 19 | 21 |
typedef unsigned short Uint16; |
| ... | ... |
@@ -31,7 +33,7 @@ typedef struct {
|
| 31 | 33 |
typedef struct {
|
| 32 | 34 |
Uint8 data[LENGTH], mlen; |
| 33 | 35 |
Uint16 ptr, length, llen; |
| 34 |
- Label labels[512]; |
|
| 36 |
+ Label labels[LABELS]; |
|
| 35 | 37 |
Macro macros[256]; |
| 36 | 38 |
} Program; |
| 37 | 39 |
|
| ... | ... |
@@ -178,6 +180,8 @@ makelabel(char *name) |
| 178 | 180 |
return error("Label name is hex number", name);
|
| 179 | 181 |
if(findopcode(name) || scmp(name, "BRK", 4) || !slen(name)) |
| 180 | 182 |
return error("Label name is invalid", name);
|
| 183 |
+ if(p.llen == LABELS) |
|
| 184 |
+ return error("Too many labels", name);
|
|
| 181 | 185 |
l = &p.labels[p.llen++]; |
| 182 | 186 |
l->addr = addr; |
| 183 | 187 |
l->refs = 0; |