WIP: assembly directives
authorLukas Krickl <lukas@krickl.dev>
Mon, 13 Nov 2023 19:15:35 +0000 (20:15 +0100)
committerLukas Krickl <lukas@krickl.dev>
Mon, 13 Nov 2023 19:15:35 +0000 (20:15 +0100)
include/ulas.h

index 501a191e7ad27431278e4121314bfd353c7d579f..beccd40176cd25ec2541c0c50570385e4e220e97 100644 (file)
@@ -100,6 +100,8 @@ struct ulas {
   // holds the current token
   struct ulas_str tok;
 
+  unsigned int address;
+
   // internal counter
   // used whenever a new unique number might be needed
   int icntr;
@@ -115,12 +117,21 @@ int ulas_icntr(void);
 
 enum ulas_ppdirs {
   ULAS_PPDIR_NONE = 1,
+  // #define name value
   ULAS_PPDIR_DEF,
+  // #undefine name
   ULAS_PPDIR_UNDEF,
+  // #macro name
+  // value
+  // value
   ULAS_PPDIR_MACRO,
+  // #endmacro
   ULAS_PPDIR_ENDMACRO,
+  // ifdef name
   ULAS_PPDIR_IFDEF,
+  // ifndef name
   ULAS_PPDIR_IFNDEF,
+  // endif
   ULAS_PPDIR_ENDIF
 };
 
@@ -222,6 +233,26 @@ struct ulas_expr {
   union ulas_expdat dat;
 };
 
+/**
+ * asm
+ */
+enum ulas_asmdir {
+  // .org <address>
+  ULAS_ASMDIR_ORG,
+  // .set name = <expr>
+  ULAS_ASMDIR_SET,
+  // .byte <expr>, <expr>, <expr>, ...
+  ULAS_ASMDIR_BYTE,
+  // .str "String value"
+  ULAS_ASMDIR_STR,
+  // .fill <expr>, n
+  ULAS_ASMDIR_FILL,
+  // .pad <expr>, <addr>
+  ULAS_ASMDIR_PAD,
+  // .incbin <filename>
+  ULAS_ASMDIR_INCBIN,
+};
+
 extern struct ulas_config ulascfg;
 
 struct ulas_config ulas_cfg_from_env(void);