diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2022-02-13 20:20:59 -0400 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2022-02-13 20:20:59 -0400 |
commit | f478e6c1223cc8370fa51d44b9244ec25be99788 (patch) | |
tree | 4abe8889888c0b098ea99ee020c446254822a923 /igen/igen.c | |
parent | 6833f6bc2a5730169084c74d8e8fc0b76666b2a0 (diff) |
igen: Start work on writing an instruction handler
generator.
This will make it easier in the long run to modify
instructions, add new instructions, and move the opcode
tables around.
Diffstat (limited to 'igen/igen.c')
-rw-r--r-- | igen/igen.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/igen/igen.c b/igen/igen.c new file mode 100644 index 0000000..fa9f10f --- /dev/null +++ b/igen/igen.c @@ -0,0 +1,30 @@ +#include <stdint.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "lexer.h" +#include "misc.h" + +void usage(const char *name) { + printf("Usage: %s <file>\n", name); +} + +int main(int argc, char **argv) { + char *buf; + long file_size = 0; + int dbg = 0; + int ret = 0; + if (argc < 2) { + usage(argv[0]); + ret = 1; + } + buf = read_file(argc[1], &file_size); + if (buf == NULL) { + printf("Error: read_file() returned NULL.\n"); + usage(argv[0]); + ret = 1; + } + + ret = lex(buf, dbg); + return ret; +} |