Skip to content

Commit dad5240

Browse files
U-UC\harvey1U-UC\harvey1
authored andcommitted
partially done
1 parent 57af670 commit dad5240

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/label.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,15 @@ void addlabel(char *outbuf, label **labels, label **unknownlabels, unsigned long
7878
/* Assign the current location of the output buffer to as the address, because then the label will point to the next instruction or data element added, which is what we want. */
7979
/* Also add the base address, which is important. */
8080
(*labels)[(*numlabels) - 1].addr = ((bits/4) + baseaddr);
81-
/* If the label is for N_, then don't add anything to the output buffer but set N_START. */
81+
/* If the label is for N_, set N_START. */
8282
if(!(strcmp(tempstr, "N_")))
8383
{
84+
/* If we've defined it already, don't let redefinition. */
85+
if(N_START != 0xFFFF)
86+
{
87+
fprintf(stderr, "Line %llu: N_ already defined!.\n", FILELINE);
88+
exit(45);
89+
}
8490
N_START = ((bits/4) + baseaddr);
8591
}
8692
/* Now we've saved the declared label, we can check for it being used before it was declared. */
@@ -194,6 +200,7 @@ unsigned short int findlabel(label **unknownlabels, label **labels, char *labels
194200
break;
195201
}
196202
}
203+
197204
/* Search for the square brackets to determine label offset */
198205
for(i = 0; i < strlen(tempstr); i++)
199206
{

0 commit comments

Comments
 (0)