WIP: rep directive
authorLukas Krickl <lukas@krickl.dev>
Sun, 24 Dec 2023 15:22:16 +0000 (16:22 +0100)
committerLukas Krickl <lukas@krickl.dev>
Sun, 24 Dec 2023 15:22:16 +0000 (16:22 +0100)
include/ulas.h
src/ulas.c

index 747ddb662076c81fd6197bf337393031a8ad0037..c05bfbf426587acb2a1805cf42de92248f0553a5 100644 (file)
@@ -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 <n>, <step>, <line>
+  // repeats a line n times 
+  ULAS_ASMDIR_REP,
 };
 
 // amount of registers
index 5b48393e79850121402df5d17b42a5eaec0d8f4d..67c43854eec604f4b6507e7293e6c690c9a637fc 100644 (file)
@@ -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: