From fc5079a13ba8e1a8785c4af234fa456975f775c9 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Thu, 21 Dec 2023 04:56:24 +0100 Subject: [PATCH] Fixed comments not working after .db --- src/ulas.c | 5 +++++ tests/t0.bin | Bin 174 -> 175 bytes tests/t0.s | 1 + 3 files changed, 6 insertions(+) diff --git a/src/ulas.c b/src/ulas.c index e7dd2c4..a47d74c 100644 --- a/src/ulas.c +++ b/src/ulas.c @@ -2280,6 +2280,11 @@ int ulas_asmdirbyte(FILE *dst, const char **line, unsigned long n, int *rc) { break; } } while (*rc != -1 && t.type == ','); + + // go back one byte if the token was a comment + if (t.type == ULAS_TOK_COMMENT) { + *line = *line - strlen(ulas.tok.buf); + } return written; } diff --git a/tests/t0.bin b/tests/t0.bin index bc8c7f24292210a595b2d5a46404dc6d7cb9e57b..8d8083db9bcd0df9cc6868bf2f46e30bcc3ac8d7 100644 GIT binary patch delta 8 PcmZ3-xSnysIz~nS4eJ7+ delta 6 NcmZ3_xQ=ncIsgc+0-gW> diff --git a/tests/t0.s b/tests/t0.s index 03fd48e..fcfc303 100644 --- a/tests/t0.s +++ b/tests/t0.s @@ -123,3 +123,4 @@ l3: .db 1 jp hl ld a, 4/2 +.db 1 ; comment -- 2.30.2