all repos — xyw @ 4165133f7914b828d62c12517d5bc0166ec488a4

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
 22
#ifndef XYW_H
#define XYW_H

#define XYW_MODE_X 0x20
#define XYW_MODE_Y 0x40
#define XYW_MODE_W 0x80
#define XYW_TOTAL_INSTRUCTIONS 0x20

// clang-format off
#define xyw_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];
extern int xyw_debug;

int xyw_assemble(const char *input, const char *output);
int run(const char *input);

#endif // XYW_H