uxnasm errors-out if too many labels
This commit is contained in:
parent
a3ee7ab982
commit
a373939544
|
@ -14,6 +14,8 @@ WITH REGARD TO THIS SOFTWARE.
|
||||||
#define TRIM 0x0100
|
#define TRIM 0x0100
|
||||||
#define LENGTH 0x10000
|
#define LENGTH 0x10000
|
||||||
|
|
||||||
|
#define LABELS 512
|
||||||
|
|
||||||
typedef unsigned char Uint8;
|
typedef unsigned char Uint8;
|
||||||
typedef signed char Sint8;
|
typedef signed char Sint8;
|
||||||
typedef unsigned short Uint16;
|
typedef unsigned short Uint16;
|
||||||
|
@ -31,7 +33,7 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Uint8 data[LENGTH], mlen;
|
Uint8 data[LENGTH], mlen;
|
||||||
Uint16 ptr, length, llen;
|
Uint16 ptr, length, llen;
|
||||||
Label labels[512];
|
Label labels[LABELS];
|
||||||
Macro macros[256];
|
Macro macros[256];
|
||||||
} Program;
|
} Program;
|
||||||
|
|
||||||
|
@ -178,6 +180,8 @@ makelabel(char *name)
|
||||||
return error("Label name is hex number", name);
|
return error("Label name is hex number", name);
|
||||||
if(findopcode(name) || scmp(name, "BRK", 4) || !slen(name))
|
if(findopcode(name) || scmp(name, "BRK", 4) || !slen(name))
|
||||||
return error("Label name is invalid", name);
|
return error("Label name is invalid", name);
|
||||||
|
if(p.llen == LABELS)
|
||||||
|
return error("Too many labels", name);
|
||||||
l = &p.labels[p.llen++];
|
l = &p.labels[p.llen++];
|
||||||
l->addr = addr;
|
l->addr = addr;
|
||||||
l->refs = 0;
|
l->refs = 0;
|
||||||
|
|
Loading…
Reference in New Issue