- Add failing tests for most failure cases
- Assert `.section` in full test
- Add `.bank.` directive allowing users to set the current bank number (ulas.bank) which can be used for symbol files.
-- Add scoped labels in macros
+- Allow nested begin and end scope calls
rc = ulas_asmdirbank(dst, src, &line, n, &rc);
break;
case ULAS_ASMDIR_BEGIN_SCOPE:
- ulas.scope++;
+ if (ulas.prev_scope != 0) {
+ ULASPANIC("nested .beginscope detected\n");
+ }
+ ulas.prev_scope = ulas.scope;
+ ulas.scope = -1 - ulas_icntr();
break;
case ULAS_ASMDIR_END_SCOPE:
- ulas.scope--;
+ if (ulas.prev_scope == 0) {
+ ULASPANIC("calling .endscope without starting a scope\n");
+ }
+ ulas.scope = ulas.prev_scope;
+ ulas.prev_scope = 0;
break;
case ULAS_ASMDIR_PAD:
// TODO: pad is the same as .fill n, $ - n
// current scope index
// each global-label increments the scope
int scope;
+ // temporary storage for .beginscope
+ // and .endscope
+ int prev_scope;
// internal counter
// used whenever a new unique number might be needed