summaryrefslogtreecommitdiff
path: root/asmmon.h
diff options
context:
space:
mode:
Diffstat (limited to 'asmmon.h')
-rw-r--r--asmmon.h64
1 files changed, 53 insertions, 11 deletions
diff --git a/asmmon.h b/asmmon.h
index 8fbec35..7ed879b 100644
--- a/asmmon.h
+++ b/asmmon.h
@@ -4,17 +4,18 @@
#define MAX_TOK 0x1000
-typedef struct tok token ;
-typedef struct ln line ;
-typedef struct sym symbol ;
-typedef struct fix fixup ;
-typedef struct inst instruction;
+typedef struct tok token ;
+typedef struct ln line ;
+typedef struct sym symbol ;
+typedef struct fix fixup ;
+typedef struct inst instruction ;
struct tok {
- token *next; /* Pointer to the next token. */
- uint8_t id; /* Token ID. */
- uint8_t type; /* Token type ID. */
+ token *next; /* Pointer to the next token. */
+ uint8_t id; /* Token ID. */
+ uint8_t type; /* Token type ID. */
+ uint8_t subtype; /* Token subtype ID. */
uint8_t tab; /* Number of tabs. */
uint8_t space; /* Number of spaces. */
@@ -120,6 +121,9 @@ enum token {
TOK_EXTOP,
TOK_ORTHO,
TOK_REG,
+ TOK_MEM,
+ TOK_CC,
+ TOK_OS,
TOK_RS,
TOK_OF,
TOK_COMMENT,
@@ -130,7 +134,6 @@ enum token {
TOK_STRUCT,
TOK_UNION,
TOK_MEMBER
-
};
enum pre_token {
@@ -176,6 +179,7 @@ enum expr {
EXPR_OR,
EXPR_LSHFT,
EXPR_RSHFT,
+ EXPR_MUL,
EXPR_NONE
};
@@ -240,6 +244,30 @@ enum eind {
CPY_EIND
};
+enum baseext_ortho {
+ OP_LEA,
+ OP_PEA,
+ OP_ADD,
+ OP_SUB,
+ OP_NOT,
+ OP_CLZ,
+ OP_CLO,
+ OP_SWP,
+ OP_PCN
+};
+
+static const uint8_t ext_ortho_ops[9] = {
+ [OP_LEA] = 0x63,
+ [OP_PEA] = 0x0C,
+ [OP_ADD] = 0x03,
+ [OP_SUB] = 0x23,
+ [OP_NOT] = 0x44,
+ [OP_CLZ] = 0xC4,
+ [OP_CLO] = 0xE4,
+ [OP_SWP] = 0x2C,
+ [OP_PCN] = 0x43
+};
+
static const uint8_t ind_ops[20] = {
[CMP_IND] = CMP_IN,
[CMP_IDY] = CMP_IY,
@@ -461,6 +489,9 @@ static const char *lex_tok[] = {
[TOK_EXTOP ] = "TOK_EXTOP",
[TOK_ORTHO ] = "TOK_ORTHO",
[TOK_REG ] = "TOK_REG",
+ [TOK_MEM ] = "TOK_MEM",
+ [TOK_CC ] = "TOK_CC",
+ [TOK_OS ] = "TOK_OS",
[TOK_RS ] = "TOK_RS",
[TOK_OF ] = "TOK_OF",
[TOK_COMMENT] = "TOK_COMMENT",
@@ -646,6 +677,17 @@ static const char *ortho_mne[ORTHO_OPNUM] = {
[SET] = "SET"
};
+static const char *set_cc[8] = {
+ "NG",
+ "PO",
+ "CS",
+ "CC",
+ "EQ",
+ "NE",
+ "VS",
+ "VC"
+};
+
static const char *instdesc[OPNUM] = {
[ADC] = "ADd accumulator, with operand, Carry if needed.",
[AND] = "Bitwise AND accumulator, with operand.",
@@ -762,8 +804,8 @@ extern uint8_t isfixup;
extern line *find_line(uint32_t ln, uint8_t dbg);
extern uint64_t lex(char *str, uint64_t address, uint16_t bline, uint8_t dbg);
-extern uint64_t get_val(token *t, uint64_t addr, uint8_t size, uint8_t dbg);
-extern token *skip_expr(token *t, uint8_t dbg);
+extern uint64_t get_val(token *t, uint64_t addr, uint8_t size, uint8_t end_expr, uint8_t stop_comma, uint8_t dbg);
+extern token *skip_expr(token *t, uint8_t end_expr, uint8_t stop_comma, uint8_t dbg);
extern uint64_t parse_tokens(token *tm, line **l, bytecount *bc, uint8_t isasm, uint64_t address, uint8_t dbg);
extern token *make_token(uint8_t id, uint8_t type, uint8_t space, uint8_t tab, uint64_t value, char *str, symbol *s);
extern void assemble(line *ln, bytecount *bc, uint8_t dbg);