From 1c622005c289ef1cd9feea277bd0ff46b19d15f0 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Sun, 3 May 2020 15:51:57 -0400 Subject: Put the instruction, and I/O routines into separate functions. I did this to make it more readable, while still making it fast, due to inlining it. --- opcode.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 opcode.c (limited to 'opcode.c') diff --git a/opcode.c b/opcode.c new file mode 100644 index 0000000..423da28 --- /dev/null +++ b/opcode.c @@ -0,0 +1,25 @@ +#include "sux.h" + +static inline uint64_t get_addr(struct sux *cpu, uint64_t *tmpaddr, uint8_t opcode, uint8_t prefix, uint8_t thread); +extern inline void adc(struct sux *cpu, uint64_t value, uint8_t thread); +extern inline void sbc(struct sux *cpu, uint64_t value, uint8_t thread); +extern inline void transfer(struct sux *cpu, uint64_t value, uint8_t opcode, uint8_t prefix, uint8_t thread); +extern inline void push(struct sux *cpu, uint64_t value, uint8_t opcode, uint8_t thread); +extern inline void pull(struct sux *cpu, uint64_t value, uint8_t opcode, uint8_t thread); +extern inline void and(struct sux *cpu, uint64_t value, uint8_t thread); +extern inline void or(struct sux *cpu, uint64_t value, uint8_t thread); +extern inline void xor(struct sux *cpu, uint64_t value, uint8_t thread); +extern inline void lsl(struct sux *cpu, uint64_t value, uint8_t thread); +extern inline void lsr(struct sux *cpu, uint64_t value, uint8_t thread); +extern inline void asr(struct sux *cpu, uint64_t value, uint8_t thread); +extern inline void rol(struct sux *cpu, uint64_t value, uint8_t thread); +extern inline void ror(struct sux *cpu, uint64_t value, uint8_t thread); +extern inline void mul(struct sux *cpu, uint64_t value, uint8_t thread); +extern inline void divd(struct sux *cpu, uint64_t value, uint8_t opcode, uint8_t thread); +extern inline void cmp(struct sux *cpu, uint64_t value, uint8_t opcode, uint8_t thread); +extern inline void incr(struct sux *cpu, uint64_t value, uint8_t opcode, uint8_t thread); +extern inline void decr(struct sux *cpu, uint64_t value, uint8_t opcode, uint8_t thread); +extern inline void incm(struct sux *cpu, uint64_t address, uint8_t thread); +extern inline void decm(struct sux *cpu, uint64_t address, uint8_t thread); +extern inline void load(struct sux *cpu, uint64_t address, uint8_t *esc, uint8_t opcode, uint8_t prefix, uint8_t thread); +extern inline void store(struct sux *cpu, uint64_t address, uint8_t *esc, uint8_t opcode, uint8_t prefix, uint8_t thread); -- cgit v1.2.3-13-gbd6f