From f82a6266686b4f491eba3c152187366f46060566 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Mon, 13 Nov 2023 19:44:49 +0100 Subject: [PATCH] WIP: Assembly --- include/ulas.h | 2 +- src/ulas.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/ulas.h b/include/ulas.h index a772c9b..501a191 100644 --- a/include/ulas.h +++ b/include/ulas.h @@ -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 '#' diff --git a/src/ulas.c b/src/ulas.c index 5759a41..433a044 100644 --- a/src/ulas.c +++ b/src/ulas.c @@ -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; } -- 2.30.2