symbols: Added bank variable and TODO for new .bank command
authorLukas Krickl <lukas@krickl.dev>
Sun, 2 Mar 2025 05:22:24 +0000 (06:22 +0100)
committerLukas Krickl <lukas@krickl.dev>
Sun, 2 Mar 2025 05:22:24 +0000 (06:22 +0100)
TODO.md
src/ulas.c
src/ulas.h

diff --git a/TODO.md b/TODO.md
index 0d6c2cd5b119b3b93f0f3406f0f3c35f69f6eae2..341b382a0cd77ad32acc2ba04b539c27cb35892e 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -6,3 +6,4 @@
 - Add `.error` and `.warning` directives 
 - 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.
index 98588f36d9bcb4eb31ee5983e12f9929f9b0a9ff..673ee02e2d5e1e4bc506ccb8d9152dca8717c511 100644 (file)
@@ -441,7 +441,7 @@ int ulas_symbolout(FILE *dst, struct ulas_sym *s) {
     fprintf(dst, "\n");
     break;
   case ULAS_SYM_FMT_SYM:
-    fprintf(dst, "00:");
+    fprintf(dst, "%02d:", ulas.bank);
     
     switch (s->tok.type) {
     case ULAS_INT:
index 9f62e74f71e4652bc1e2f2f0de33044b3ab40113..129b068575af7d9de061f05df146cca416fb7630 100644 (file)
@@ -320,8 +320,11 @@ struct ulas {
   char charcodemap[ULAS_CHARCODEMAPLEN];
   char section[ULAS_SECTIONMAX];
   // where was the section defined?
-  unsigned int section_address; 
-    
+  unsigned int section_address;
+
+  // active bank
+  unsigned int bank; 
+
   struct ulas_arch arch;
 };