From 5dd788d5a1acc7f23835882420d50e9f020728ac Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Mon, 18 May 2020 13:14:08 -0400 Subject: 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. --- asmmon.h | 99 ++++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 53 insertions(+), 46 deletions(-) (limited to 'asmmon.h') diff --git a/asmmon.h b/asmmon.h index 58b4918..032830c 100644 --- a/asmmon.h +++ b/asmmon.h @@ -2,8 +2,55 @@ #include #include -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; -- cgit v1.2.3-13-gbd6f