From 13f5a2794fa02d84b732b59005c64c2dc2d328eb Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Fri, 9 Sep 2022 02:28:51 +0600 Subject: [PATCH] Prepare the structure for upcoming actual i8080 emulation (#16) --- src/cpu/8080.c | 20 ++++++++++++++++++++ src/cpu/CMakeLists.txt | 2 +- src/include/86box/i8080.h | 40 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 src/cpu/8080.c create mode 100644 src/include/86box/i8080.h diff --git a/src/cpu/8080.c b/src/cpu/8080.c new file mode 100644 index 000000000..28af66974 --- /dev/null +++ b/src/cpu/8080.c @@ -0,0 +1,20 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * 8080 CPU emulation. + * + * Authors: Cacodemon345 + * + * Copyright 2022 Cacodemon345 + */ + + +#include +#include <86box/i8080.h> + +/* Actually implement i8080 emulation. */ diff --git a/src/cpu/CMakeLists.txt b/src/cpu/CMakeLists.txt index 20452bf88..c91bcbe78 100644 --- a/src/cpu/CMakeLists.txt +++ b/src/cpu/CMakeLists.txt @@ -14,7 +14,7 @@ # add_library(cpu OBJECT cpu.c cpu_table.c fpu.c x86.c 808x.c 386.c 386_common.c - 386_dynarec.c x86seg.c x87.c x87_timings.c) + 386_dynarec.c x86seg.c x87.c x87_timings.c 8080.c) if(AMD_K5) target_compile_definitions(cpu PRIVATE USE_AMD_K5) diff --git a/src/include/86box/i8080.h b/src/include/86box/i8080.h new file mode 100644 index 000000000..a7adae201 --- /dev/null +++ b/src/include/86box/i8080.h @@ -0,0 +1,40 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * 8080 CPU emulation (header). + * + * Authors: Cacodemon345 + * + * Copyright 2022 Cacodemon345 + */ + +#include + +typedef struct i8080 +{ + union { + uint16_t af; /* Intended in case we also go for μPD9002 emulation, which also has a Z80 emulation mode. */ + uint8_t a, flags; + }; + union + { + uint16_t bc; + uint8_t b, c; + }; + union + { + uint16_t de; + uint8_t d, e; + }; + union + { + uint16_t hl; + uint8_t h, l; + }; + uint16_t pc, sp; +} i8080; \ No newline at end of file