summaryrefslogtreecommitdiff
path: root/masm/asm.h
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2024-09-09 12:41:49 -0400
committerFreya Murphy <freya@freyacat.org>2024-09-09 12:41:49 -0400
commit2ed275821676a0d5baea6c7fd843d71c72c2342c (patch)
tree480297f28e5c42d02a47b3b94027a7abe507d010 /masm/asm.h
downloadmips-2ed275821676a0d5baea6c7fd843d71c72c2342c.tar.gz
mips-2ed275821676a0d5baea6c7fd843d71c72c2342c.tar.bz2
mips-2ed275821676a0d5baea6c7fd843d71c72c2342c.zip
initial mips32 (r2000ish mips32r6) assembler
Diffstat (limited to 'masm/asm.h')
-rw-r--r--masm/asm.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/masm/asm.h b/masm/asm.h
new file mode 100644
index 0000000..1bc7cf5
--- /dev/null
+++ b/masm/asm.h
@@ -0,0 +1,33 @@
+/* Copyright (c) 2024 Freya Murphy */
+
+#ifndef __ASM_H__
+#define __ASM_H__
+
+#include <stddef.h>
+
+struct str_table {
+ char *ptr;
+ size_t size;
+};
+
+/* initalize a string table */
+void strtbl_init(struct str_table *str_tbl);
+
+/* free a string table */
+void strtbl_free(struct str_table *str_tbl);
+
+/* get a string form the string table */
+int strtbl_get_str(struct str_table *str_tbl, const char *str, size_t *res);
+
+/* get or append a string into the string table */
+int strtbl_write_str(struct str_table *str_tbl, const char *str, size_t *res);
+
+struct assembler {
+ struct parser *parser;
+ struct str_table str_tbl;
+};
+
+/* assemble a mips32 file*/
+int assemble_file_mips32(char *path);
+
+#endif /* __ASM_H__ */