(uxnasm) Starting to merge buffers

This commit is contained in:
Devine Lu Linvega 2024-03-27 09:21:34 -07:00
parent c5a5eaff0e
commit 18f545f3c9
1 changed files with 14 additions and 2 deletions

View File

@ -24,7 +24,7 @@ typedef struct {
} Macro; } Macro;
typedef struct { typedef struct {
char name[0x40]; char *name;
Uint16 addr, refs; Uint16 addr, refs;
} Label; } Label;
@ -73,6 +73,18 @@ static char *scat(char *dst, char *src) { char *ptr = dst + slen(dst); while(*sr
/* clang-format on */ /* clang-format on */
char storage[0x10000], *storenext = storage;
static char *
store(char *s)
{
char *ptr = storenext;
while((*storenext++ = *s++))
;
*storenext++ = 0;
return ptr;
}
static int parse(char *w, FILE *f); static int parse(char *w, FILE *f);
static char *makesublabel(char *src, char *name); static char *makesublabel(char *src, char *name);
@ -180,7 +192,7 @@ makelabel(char *name, int setscope)
l = &p.labels[p.label_len++]; l = &p.labels[p.label_len++];
l->addr = p.ptr; l->addr = p.ptr;
l->refs = 0; l->refs = 0;
scpy(name, l->name, 0x40); l->name = store(name);
if(setscope) { if(setscope) {
int i = 0; int i = 0;
while(name[i] != '/' && i < 0x3e && (scope[i] = name[i])) i++; while(name[i] != '/' && i < 0x3e && (scope[i] = name[i])) i++;