all repos — xyw @ 3f803629c71a6e57353a27a9c5f70cf25d308563

A minimal virtual machine and assembler for terminals.

xyw.h

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
#ifndef XYW_H
#define XYW_H

#define XYW_MODE_X 0x20
#define XYW_MODE_Y 0x40
#define XYW_MODE_W 0x80
// clang-format off
#define dbg(...) do { if (xyw_debug) fprintf(stdout, __VA_ARGS__); } while(0)
// clang-format on

typedef unsigned char xyw_byte;
typedef unsigned short xyw_word;

extern const char xyw_instructions[][4];
// Number of instruction mnemonics
#define XYW_INSTRUCTION_COUNT 32
extern int xyw_debug;
int xyw_assemble(const char *input, const char *output);
int run(const char *input);

#endif // XYW_H