blob: 140fa7cc24ee3c219c3456438395cb4b1ded4ad2 (
plain)
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
64
65
66
67
|
// file : arch/null/arch_inst.c
// project : Salis-VM
// author : Paul Oliver <contact@pauloliver.dev>
// index:
// [section] includes
// [section] macros
// [section] globals
// [section] definitions
// ----------------------------------------------------------------------------
// [section] includes
// ----------------------------------------------------------------------------
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "arch_inst.h"
// ----------------------------------------------------------------------------
// [section] macros
// ----------------------------------------------------------------------------
#define INST_LOOP \
INST(00) INST(01) INST(02) INST(03) INST(04) INST(05) INST(06) INST(07) INST(08) INST(09) INST(0a) INST(0b) INST(0c) INST(0d) INST(0e) INST(0f) \
INST(10) INST(11) INST(12) INST(13) INST(14) INST(15) INST(16) INST(17) INST(18) INST(19) INST(1a) INST(1b) INST(1c) INST(1d) INST(1e) INST(1f) \
INST(20) INST(21) INST(22) INST(23) INST(24) INST(25) INST(26) INST(27) INST(28) INST(29) INST(2a) INST(2b) INST(2c) INST(2d) INST(2e) INST(2f) \
INST(30) INST(31) INST(32) INST(33) INST(34) INST(35) INST(36) INST(37) INST(38) INST(39) INST(3a) INST(3b) INST(3c) INST(3d) INST(3e) INST(3f) \
INST(40) INST(41) INST(42) INST(43) INST(44) INST(45) INST(46) INST(47) INST(48) INST(49) INST(4a) INST(4b) INST(4c) INST(4d) INST(4e) INST(4f) \
INST(50) INST(51) INST(52) INST(53) INST(54) INST(55) INST(56) INST(57) INST(58) INST(59) INST(5a) INST(5b) INST(5c) INST(5d) INST(5e) INST(5f) \
INST(60) INST(61) INST(62) INST(63) INST(64) INST(65) INST(66) INST(67) INST(68) INST(69) INST(6a) INST(6b) INST(6c) INST(6d) INST(6e) INST(6f) \
INST(70) INST(71) INST(72) INST(73) INST(74) INST(75) INST(76) INST(77) INST(78) INST(79) INST(7a) INST(7b) INST(7c) INST(7d) INST(7e) INST(7f)
// ----------------------------------------------------------------------------
// [section] globals
// ----------------------------------------------------------------------------
static const wchar_t *g_arch_inst_symbols = (
L"⠀⠁⠂⠃⠄⠅⠆⠇⡀⡁⡂⡃⡄⡅⡆⡇⠈⠉⠊⠋⠌⠍⠎⠏⡈⡉⡊⡋⡌⡍⡎⡏⠐⠑⠒⠓⠔⠕⠖⠗⡐⡑⡒⡓⡔⡕⡖⡗⠘⠙⠚⠛⠜⠝⠞⠟⡘⡙⡚⡛⡜⡝⡞⡟"
L"⠠⠡⠢⠣⠤⠥⠦⠧⡠⡡⡢⡣⡤⡥⡦⡧⠨⠩⠪⠫⠬⠭⠮⠯⡨⡩⡪⡫⡬⡭⡮⡯⠰⠱⠲⠳⠴⠵⠶⠷⡰⡱⡲⡳⡴⡵⡶⡷⠸⠹⠺⠻⠼⠽⠾⠿⡸⡹⡺⡻⡼⡽⡾⡿"
L"⢀⢁⢂⢃⢄⢅⢆⢇⣀⣁⣂⣃⣄⣅⣆⣇⢈⢉⢊⢋⢌⢍⢎⢏⣈⣉⣊⣋⣌⣍⣎⣏⢐⢑⢒⢓⢔⢕⢖⢗⣐⣑⣒⣓⣔⣕⣖⣗⢘⢙⢚⢛⢜⢝⢞⢟⣘⣙⣚⣛⣜⣝⣞⣟"
L"⢠⢡⢢⢣⢤⢥⢦⢧⣠⣡⣢⣣⣤⣥⣦⣧⢨⢩⢪⢫⢬⢭⢮⢯⣨⣩⣪⣫⣬⣭⣮⣯⢰⢱⢲⢳⢴⢵⢶⢷⣰⣱⣲⣳⣴⣵⣶⣷⢸⢹⢺⢻⢼⢽⢾⢿⣸⣹⣺⣻⣼⣽⣾⣿"
);
// ----------------------------------------------------------------------------
// [section] definitions
// ----------------------------------------------------------------------------
int arch_inst_cap(void) {
return ARCH_INST_CAP;
}
wchar_t arch_inst_symbol(uint8_t inst) {
assert(inst < ARCH_INST_CAP);
return g_arch_inst_symbols[inst];
}
const char *arch_inst_mnemonic(uint8_t inst) {
assert(inst < ARCH_INST_CAP);
switch (inst) {
#define INST(code) case 0x##code: return "null " #code;
INST_LOOP
#undef INST
}
assert(false);
return NULL;
}
|