comparison lwasm/lwasm.h @ 399:6153cb49403c

Initial commit of pragma newsource pragma newsource enables a source code variant as follows: 1. no line numbers 2. no implied comments at the end of lines 3. all comments must be introduced by a comment character 4. spaces are allowed in operands (4) is not quite complete. This commit handles "operandless" instructions (anything where the parser calls skip_operand()) and expression parsing.
author William Astle <lost@l-w.ca>
date Tue, 13 Oct 2015 23:38:02 -0600
parents 1ebb5a0b2874
children 4411a6123716
comparison
equal deleted inserted replaced
398:4cf907aa634c 399:6153cb49403c
100 PRAGMA_CC = 1 << 19, // clear cycle count running total 100 PRAGMA_CC = 1 << 19, // clear cycle count running total
101 PRAGMA_QRTS = 1 << 20, // enable BRA ?RTS support 101 PRAGMA_QRTS = 1 << 20, // enable BRA ?RTS support
102 PRAGMA_M80EXT = 1 << 21, // enable Macro-80C assembler extensions 102 PRAGMA_M80EXT = 1 << 21, // enable Macro-80C assembler extensions
103 PRAGMA_6809CONV = 1 << 22, // enable 6809 convenience ops 103 PRAGMA_6809CONV = 1 << 22, // enable 6809 convenience ops
104 PRAGMA_6309CONV = 1 << 23, // enable 6309 convenience ops 104 PRAGMA_6309CONV = 1 << 23, // enable 6309 convenience ops
105 PRAGMA_NEWSOURCE = 1 << 24, // don't use compatibility source format
105 PRAGMA_CLEARBIT = 1 << 31 // reserved to indicate negated pragma flag status 106 PRAGMA_CLEARBIT = 1 << 31 // reserved to indicate negated pragma flag status
106 }; 107 };
107 108
108 enum 109 enum
109 { 110 {
442 void lwasm_save_expr(line_t *cl, int id, lw_expr_t expr); 443 void lwasm_save_expr(line_t *cl, int id, lw_expr_t expr);
443 lw_expr_t lwasm_fetch_expr(line_t *cl, int id); 444 lw_expr_t lwasm_fetch_expr(line_t *cl, int id);
444 lw_expr_t lwasm_parse_expr(asmstate_t *as, char **p); 445 lw_expr_t lwasm_parse_expr(asmstate_t *as, char **p);
445 int lwasm_emitexpr(line_t *cl, lw_expr_t expr, int s); 446 int lwasm_emitexpr(line_t *cl, lw_expr_t expr, int s);
446 447
447 void skip_operand(char **p); 448 void skip_operand_real(line_t *l, char **p);
449 /* this macro can only be used where "l" is the current line pointer */
450 #define skip_operand(p) skip_operand_real(l, p)
448 451
449 int lwasm_lookupreg2(const char *rlist, char **p); 452 int lwasm_lookupreg2(const char *rlist, char **p);
450 int lwasm_lookupreg3(const char *rlist, char **p); 453 int lwasm_lookupreg3(const char *rlist, char **p);
451 454
452 void lwasm_show_errors(asmstate_t *as); 455 void lwasm_show_errors(asmstate_t *as);
470 #endif 473 #endif
471 474
472 #define OPLEN(op) (((op)>0xFF)?2:1) 475 #define OPLEN(op) (((op)>0xFF)?2:1)
473 #define CURPRAGMA(l,p) (((l) && ((l)->pragmas & (p))) ? 1 : 0) 476 #define CURPRAGMA(l,p) (((l) && ((l)->pragmas & (p))) ? 1 : 0)
474 477
478 /* some functions for parsing */
479 /* skip to the start of the next token if the current parsing mode allows it */
480 void lwasm_skip_to_next_token(line_t *cl, char **p);
481
475 #endif /* ___lwasm_h_seen___ */ 482 #endif /* ___lwasm_h_seen___ */