global Virtual Machine headers (ANSI C'89 code shared between byte compiler & embedded)
More...
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
Go to the source code of this file.
|
#define | VM_TRACELOG |
| print trace log while program excutes in VM emulator
|
|
#define | Msz 0x10000 |
| main memory size (bytes)
|
|
#define | Rsz 0x1000 |
| return stack size (cells)
|
|
#define | Dsz 0x10 |
| data stack size (cells)
|
|
#define | BYTE uint8_t |
| byte
|
|
#define | CELL uint32_t |
| machine word (cell)
|
|
#define | CELLsz (sizeof(CELL)) |
| machine word size in bytes
|
|
#define | op_NOP 0x00 |
|
#define | op_BYE 0xFF |
|
#define | op_JMP 0x01 |
|
#define | op_qJMP 0x02 |
|
#define | op_CALL 0x03 |
|
#define | op_RET 0x04 |
|
#define | op_QUEST 0xD1 |
|
#define | op_DUMP 0xD1 |
|
|
void | save (char *filename) |
| save compiled vocabular memory to file More...
|
|
CELL | fetch (CELL addr) |
| fetch VM machine word from M address
|
|
void | Bstore (CELL addr, BYTE byte) |
| store byte at M address
|
|
void | store (CELL addr, CELL cell) |
| store VM machine word at M address
|
|
void | Bcompile (BYTE byte) |
| B, ( byte -- ) compile byte
|
|
void | compile (CELL cell) |
| , ( cell -- ) compile cell
|
|
void | NOP () |
| NOP ( -- ) no operation
|
|
void | BYE () |
| BYE ( -- ) stop system
|
|
void | JMP () |
| jmp addr ( -- ) unconditional jump
|
|
void | CALL () |
| call addr ( -- ) (R: -- addr) nested call
|
|
void | RET () |
| ret ( -- ) (R: addr -- ) return from nested call
|
|
void | DUMP () |
| dump ( -- ) dump M bytecode until Cp
|
|
void | VM () |
| bytecode interpreter
|
|
global Virtual Machine headers (ANSI C'89 code shared between byte compiler & embedded)
void save |
( |
char * |
filename | ) |
|
save compiled vocabular memory to file
- Parameters
-
[in] | filename | filename (ignored in embedded without file system support) |