From 8576e575b3d4e154650a6b4dc3343b7f7c711dcc Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Sun, 24 Dec 2023 16:22:16 +0100 Subject: [PATCH] WIP: rep directive --- include/ulas.h | 6 +++++- src/ulas.c | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/include/ulas.h b/include/ulas.h index 747ddb6..c05bfbf 100644 --- a/include/ulas.h +++ b/include/ulas.h @@ -52,6 +52,7 @@ #define ULAS_ASMSTR_DEFINE_ENUM ".de" #define ULAS_ASMSTR_SETCHRCODE ".scc" #define ULAS_ASMSTR_CHR ".chr" +#define ULAS_ASMSTR_REP ".rep" // configurable tokens #define ULAS_TOK_COMMENT ';' @@ -403,12 +404,15 @@ enum ulas_asmdir { // when using .str ULAS_ASMDIR_SETCHRCODE, - // .chr 0, 1, 2, 3, 0, 1, 2, 3 + // .chr 01230123 // allows defining // chr (tile) data from 0-3 // for each possible color // it requires up to 8 integer expressions between 0 and 3 ULAS_ASMDIR_CHR, + // .rep , , + // repeats a line n times + ULAS_ASMDIR_REP, }; // amount of registers diff --git a/src/ulas.c b/src/ulas.c index 5b48393..67c4385 100644 --- a/src/ulas.c +++ b/src/ulas.c @@ -2632,6 +2632,7 @@ int ulas_asmline(FILE *dst, FILE *src, const char *line, unsigned long n) { ULAS_ASMSTR_DEFINE_ENUM, ULAS_ASMSTR_SETCHRCODE, ULAS_ASMSTR_CHR, + ULAS_ASMSTR_REP, NULL}; enum ulas_asmdir dirs[] = { ULAS_ASMDIR_ORG, ULAS_ASMDIR_SET, @@ -2640,7 +2641,7 @@ int ulas_asmline(FILE *dst, FILE *src, const char *line, unsigned long n) { ULAS_ASMDIR_INCBIN, ULAS_ASMDIR_DEF, ULAS_ASMDIR_CHKSM, ULAS_ASMDIR_ADV, ULAS_ASMDIR_SET_ENUM_DEF, ULAS_ASMDIR_DEFINE_ENUM, - ULAS_ASMDIR_SETCHRCODE, ULAS_ASMDIR_CHR}; + ULAS_ASMDIR_SETCHRCODE, ULAS_ASMDIR_CHR, ULAS_ASMDIR_REP}; enum ulas_asmdir dir = ULAS_ASMDIR_NONE; @@ -2701,6 +2702,8 @@ int ulas_asmline(FILE *dst, FILE *src, const char *line, unsigned long n) { case ULAS_ASMDIR_CHR: other_writes += ulas_asmdirchr(dst, &line, n, &rc); break; + case ULAS_ASMDIR_REP: + break; case ULAS_ASMDIR_PAD: // TODO: pad is the same as .fill n, $ - n case ULAS_ASMDIR_NONE: -- 2.30.2