summaryrefslogtreecommitdiff
path: root/asmmon.h
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2020-05-18 13:14:08 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2020-05-18 13:14:08 -0400
commit5dd788d5a1acc7f23835882420d50e9f020728ac (patch)
tree2b9226863fc44e5bce88eb85be1f0ee97ede1922 /asmmon.h
parent545bb8591e8003912b6c6b494acefd74e6b3abfd (diff)
Did alot of stuff while I was up at the family trailer.
- Moved the large enums, and large tables into separate header files. - Added enums for implementing the base extension - Fixed a bug in the assembler. - Worked more on SuBAsm.
Diffstat (limited to 'asmmon.h')
-rw-r--r--asmmon.h99
1 files changed, 53 insertions, 46 deletions
diff --git a/asmmon.h b/asmmon.h
index 58b4918..032830c 100644
--- a/asmmon.h
+++ b/asmmon.h
@@ -2,8 +2,55 @@
#include <ctype.h>
#include <string.h>
-char lexeme[0x1000];
-uint8_t lex_type;
+#define MAX_TOK 0x1000
+
+struct line {
+ uint8_t stab;
+ uint8_t sspace;
+ uint8_t dir;
+ uint8_t mne;
+ uint8_t rs;
+ uint8_t opbase;
+ uint8_t aopbase;
+ uint8_t am;
+ uint8_t cm;
+ uint8_t etab;
+ uint8_t espace;
+ uint8_t islabel;
+ uint8_t issym;
+ uint16_t sym;
+ uint16_t com;
+ uint16_t str;
+ uint16_t incl;
+ uint16_t linenum;
+ uint64_t op;
+ uint64_t aop;
+ uint64_t addr;
+};
+
+struct fixup {
+ struct symbol *s;
+ uint16_t ln;
+ uint64_t adr;
+};
+
+struct symbol {
+ uint64_t val;
+ uint8_t def;
+ char name[128];
+ uint16_t id;
+};
+
+extern char lexeme[];
+extern char *string[];
+extern char *comment[];
+extern uint16_t incl[];
+extern struct line tokline[];
+extern struct line tln[];
+extern struct symbol *symbols[];
+extern struct fixup *fixups[];
+
+extern uint8_t lex_type;
enum {
DIR_ORG,
@@ -383,57 +430,17 @@ static const uint8_t amp[8] = {
[7] = 0x0F
};
-struct line {
- uint8_t stab;
- uint8_t sspace;
- uint8_t dir;
- uint8_t mne;
- uint8_t rs;
- uint8_t opbase;
- uint8_t aopbase;
- uint8_t am;
- uint8_t cm;
- uint8_t etab;
- uint8_t espace;
- uint8_t islabel;
- uint8_t issym;
- uint16_t sym;
- uint16_t com;
- uint16_t str;
- uint16_t incl;
- uint16_t linenum;
- uint64_t op;
- uint64_t aop;
- uint64_t addr;
-};
extern uint16_t linenum;
extern uint16_t lineidx;
extern uint16_t stridx;
extern uint16_t comidx;
-char *string[0x1000];
-char *comment[0x1000];
-uint16_t incl[0x1000];
-
-struct line tokline[0x1000];
-struct line tln[0x1000];
-
-struct fixup {
- struct symbol *s;
- uint16_t ln;
- uint64_t adr;
-};
-
-struct symbol {
- uint64_t val;
- uint8_t def;
- char name[128];
- uint16_t id;
-};
+typedef struct {
+ uint64_t progsize;
+ uint64_t datasize;
+} bytecount;
-struct symbol *symbols[0x1000];
-struct fixup *fixups[0x1000];
extern uint8_t defined;
extern uint8_t isfixup;