From: Lukas Krickl Date: Tue, 5 Dec 2023 13:29:19 +0000 (+0100) Subject: WIP: .def str directive X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=2dbe3f87c51ba66c4d3b0bfae26ea1ecee0a5e85;p=ulas%2F.git WIP: .def str directive --- diff --git a/src/ulas.c b/src/ulas.c index b2464c5..6848ae2 100644 --- a/src/ulas.c +++ b/src/ulas.c @@ -2128,7 +2128,11 @@ int ulas_asmdirset(const char **line, unsigned long n, enum ulas_type t) { } break; case ULAS_STR: - // TODO: implement str expressions + val.strv = strdup(ulas_strexpr(line, n, &rc)); + if (rc == -1) { + goto fail; + } + break; default: ULASERR("Unexpected type\n"); return -1; @@ -2173,7 +2177,7 @@ int ulas_asmdirdef(const char **line, unsigned long n) { enum ulas_type t = ULAS_INT; if (strncmp(ulas.tok.buf, "int", ulas.tok.maxlen) == 0) { t = ULAS_INT; - } else if (strncmp(ulas.tok.buf, "char", ulas.tok.maxlen) == 0) { + } else if (strncmp(ulas.tok.buf, "str", ulas.tok.maxlen) == 0) { t = ULAS_STR; } else { ULASERR("Type (str,int) expected. Got '%s'\n", ulas.tok.buf); diff --git a/tests/t0.s b/tests/t0.s index 4ad1bab..0faea94 100644 --- a/tests/t0.s +++ b/tests/t0.s @@ -90,3 +90,4 @@ l2: .fill 1, 3 .fill 1, 0x180-$ ; fill until 0x180 nop +.def str s2 = "Hello"