From 9aa02bebf295ce9436451e0ce85db7717a6c9f81 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Sun, 4 Aug 2019 00:13:59 +1200 Subject: Add initial emulator implementation This emulator provides a rough way for binaries designed for this CPU to be executed in a virtual/emulated CPU for testing purposes. This patch also adds a small test setup for automated assembly, execution and checking of register postconditions for programs. --- input/input_bin.c | 1 + input/input_bin.h | 1 + 2 files changed, 2 insertions(+) (limited to 'input') diff --git a/input/input_bin.c b/input/input_bin.c index 8f4c827..eafcca1 100644 --- a/input/input_bin.c +++ b/input/input_bin.c @@ -151,6 +151,7 @@ static int disasm_file(FILE *f) /* just used up 4 bytes, and couldn't read more. break out*/ goto read_eof; } + /* FALLTHROUGH */ case 2: /* have just read 2 bytes: shift down and pack new in */ inst = extra; diff --git a/input/input_bin.h b/input/input_bin.h index 00e296c..613f280 100644 --- a/input/input_bin.h +++ b/input/input_bin.h @@ -1,6 +1,7 @@ #ifndef INPUT_BIN_H #define INPUT_BIN_H +size_t disasm_single(struct instruction *i, uint16_t pc, uint16_t inst, uint16_t extra); int input_bin(FILE *f, struct instruction **i, size_t *i_count); #endif /* INPUT_BIN_H */ -- cgit v1.1