|
eForth1
v2.6
|
eForth assembler module header More...
#include "eforth_config.h"

Go to the source code of this file.
Macros | |
| #define | ASM_TRACE 0 /** create assembler trace */ |
| #define | CASE_SENSITIVE 0 /** enable case sensitive */ |
| #define | ENABLE_SEE 1 /** add SEE, +280 bytes */ |
| #define | fCMPL 0x40 |
| #define | fIMMD 0x80 |
| #define | OP(name) op##name |
| #define | DEBUG(s, v) |
| #define | SHOWOP(op) |
| #define | _ARG_N( _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, N, ...) N |
| #define | _NUM_N() |
| #define | _NARG0(...) _ARG_N(__VA_ARGS__) |
| #define | _NARG(...) _NARG0(_, ##__VA_ARGS__, _NUM_N()) |
| #define | CELLCPY(n) |
| #define | MEMCPY(len, seq) |
| #define | OPSTR(ip, seq) |
Vargs Header (calculate number of parameters by compiler) | |
| #define | _CODE(seg, ...) _code(seg, _NARG(__VA_ARGS__), __VA_ARGS__) |
| #define | _PRIM(seg, x) (_CODE(seg, op##x, opEXIT), op##x) |
| #define | _COLON(seg, ...) _colon(seg, _NARG(__VA_ARGS__), __VA_ARGS__) |
| #define | _IMMED(seg, ...) _immed(seg, _NARG(__VA_ARGS__), __VA_ARGS__) |
| #define | _LABEL(...) _label(_NARG(__VA_ARGS__), __VA_ARGS__) |
Vargs Branching | |
| #define | _BEGIN(...) _begin(_NARG(__VA_ARGS__), __VA_ARGS__) |
| #define | _AGAIN(...) _again(_NARG(__VA_ARGS__), __VA_ARGS__) |
| #define | _UNTIL(...) _until(_NARG(__VA_ARGS__), __VA_ARGS__) |
| #define | _WHILE(...) _while(_NARG(__VA_ARGS__), __VA_ARGS__) |
| #define | _REPEAT(...) _repeat(_NARG(__VA_ARGS__), __VA_ARGS__) |
| #define | _IF(...) _if(_NARG(__VA_ARGS__), __VA_ARGS__) |
| #define | _ELSE(...) _else(_NARG(__VA_ARGS__), __VA_ARGS__) |
| #define | _THEN(...) _then(_NARG(__VA_ARGS__), __VA_ARGS__) |
| #define | _FOR(...) _for(_NARG(__VA_ARGS__), __VA_ARGS__) |
| #define | _NEXT(...) _nxt(_NARG(__VA_ARGS__), __VA_ARGS__) |
| #define | _AFT(...) _aft(_NARG(__VA_ARGS__), __VA_ARGS__) |
Vargs IO | |
| #define | _DOTQ(str) _dotq(str) |
Memory Access and Stack Op | |
| #define | BSET(d, c) (_byte[d]=(U8)(c)) |
| #define | BGET(d) (_byte[d]) |
| #define | SET(d, v) do { U16 a=(d); U16 x=(v); BSET(a,(x)>>8); BSET((a)+1,(x)&0xff); } while (0) |
| #define | GET(d) ({ U16 a=(d); ((U16)BGET(a)<<8) | BGET((a)+1); }) |
| #define | STORE(v) do { SET(PC,(v)); PC+=CELLSZ; } while(0) |
| #define | RPUSH(a) SET(FORTH_ROM_SZ - (++R)*CELLSZ, (a)) /** tail section of memory block */ |
| #define | RPOP() ((U16)GET(FORTH_ROM_SZ - (R ? R-- : R)*CELLSZ)) |
| #define | VL(a, i) (((U16)(a)+CELLSZ*(i))&0xff) |
| #define | VH(a, i) (((U16)(a)+CELLSZ*(i))>>8) |
| #define | VAL(a, i) opDOLIT,VH(a,i),VL(a,i),opEXIT |
Enumerations | |
| enum | { opNOP = 0, OPCODES } |
Functions | |
| void | _dump (int b, int u) |
| void | _rdump () |
More... | |
| void | _header (int lex, const char *seq) |
| int | _code (const char *seg, int len,...) |
| int | _colon (const char *seg, int len,...) |
| int | _immed (const char *seg, int len,...) |
| int | _label (int len,...) |
| void | _begin (int len,...) |
| void | _while (int len,...) |
| void | _repeat (int len,...) |
| void | _until (int len,...) |
| void | _again (int len,...) |
| void | _for (int len,...) |
| void | _aft (int len,...) |
| void | _nxt (int len,...) |
More... | |
| void | _if (int len,...) |
| void | _else (int len,...) |
| void | _then (int len,...) |
| void | _dotq (const char *seq) |
Variables | |
| IU | PC |
| assembler program counter More... | |
| U8 | R |
| assembler return stack index More... | |
| IU | _link |
| link to previous word More... | |
| U8 * | _byte |
| assembler byte array (heap) More... | |
| IU | DOTQP |
| addr of output ops, used by _dotq, _strq, _abortq More... | |
eForth assembler module header
Usage of VA_ARGS variable argument for assembler parameter counting
| #define ASM_TRACE 0 /** create assembler trace */ |
| #define CASE_SENSITIVE 0 /** enable case sensitive */ |
| #define ENABLE_SEE 1 /** add SEE, +280 bytes */ |
| #define fCMPL 0x40 |
Name field +-------—+----------—+ | len byte | name string | +-------—+----------—+ Forth name len max 31 the following flags are used to flag word attributes compile only flag
| #define fIMMD 0x80 |
immediate flag
| #define OP | ( | name | ) | op##name |
define opcode enums Note: in sync with VM's vtable
| #define DEBUG | ( | s, | |
| v | |||
| ) |
| #define SHOWOP | ( | op | ) |
| #define _ARG_N | ( | _1, | |
| _2, | |||
| _3, | |||
| _4, | |||
| _5, | |||
| _6, | |||
| _7, | |||
| _8, | |||
| _9, | |||
| _10, | |||
| _11, | |||
| _12, | |||
| _13, | |||
| _14, | |||
| _15, | |||
| _16, | |||
| _17, | |||
| _18, | |||
| _19, | |||
| _20, | |||
| _21, | |||
| _22, | |||
| _23, | |||
| _24, | |||
| _25, | |||
| _26, | |||
| _27, | |||
| _28, | |||
| _29, | |||
| _30, | |||
| _31, | |||
| _32, | |||
| _33, | |||
| _34, | |||
| _35, | |||
| _36, | |||
| _37, | |||
| _38, | |||
| _39, | |||
| _40, | |||
| _41, | |||
| _42, | |||
| _43, | |||
| _44, | |||
| _45, | |||
| _46, | |||
| _47, | |||
| _48, | |||
| _49, | |||
| _50, | |||
| _51, | |||
| _52, | |||
| _53, | |||
| _54, | |||
| _55, | |||
| _56, | |||
| _57, | |||
| _58, | |||
| _59, | |||
| _60, | |||
| _61, | |||
| _62, | |||
| _63, | |||
| N, | |||
| ... | |||
| ) | N |
variable length parameter handler macros
| #define _NUM_N | ( | ) |
| #define _NARG0 | ( | ... | ) | _ARG_N(__VA_ARGS__) |
| #define _PRIM | ( | seg, | |
| x | |||
| ) | (_CODE(seg, op##x, opEXIT), op##x) |
| #define _DOTQ | ( | str | ) | _dotq(str) |
| #define BGET | ( | d | ) | (_byte[d]) |
| #define RPUSH | ( | a | ) | SET(FORTH_ROM_SZ - (++R)*CELLSZ, (a)) /** tail section of memory block */ |