WIP: Assembly
authorLukas Krickl <lukas@krickl.dev>
Mon, 13 Nov 2023 18:44:49 +0000 (19:44 +0100)
committerLukas Krickl <lukas@krickl.dev>
Mon, 13 Nov 2023 18:44:49 +0000 (19:44 +0100)
include/ulas.h
src/ulas.c

index a772c9b5794ccd0dc4e65afa76c4f9e1067354d1..501a191e7ad27431278e4121314bfd353c7d579f 100644 (file)
@@ -31,7 +31,7 @@
 // configurable tokens
 #define ULAS_TOK_COMMENT ';'
 // start of as directives such as .org
-#define ULAS_TOK_ASDIR_BEGIN '.'
+#define ULAS_TOK_ASMDIR_BEGIN '.'
 // start of preprocessor directives such as #define or #include
 #define ULAS_TOK_PREPROC_BEGIN '#'
 
index 5759a412f7b62f83f13074a4c973033f4aaef151..433a044799433dd3a22b1e43b557d31c125789d6 100644 (file)
@@ -701,11 +701,20 @@ int ulas_preproc(FILE *dst, FILE *src) {
  */
 
 int ulas_asmline(FILE *dst, FILE *src, const char *line, size_t n) {
+  // const char *start = line;
   int rc = 0;
 
   fprintf(dst, "%s", line);
 
   // read the first token and decide
+  ulas_tok(&ulas.tok, &line, n);
+
+  if (ulas.tok.buf[0] == ULAS_TOK_ASMDIR_BEGIN) {
+    // is directive!
+    puts("Directive");
+  } else {
+    // is regular line in form of [label:] instruction ; comment
+  }
 
   return rc;
 }