Files
86Box/src/include/86box/i8080.h

70 lines
1.7 KiB
C
Raw Normal View History

/*
2023-01-06 15:36:05 -05:00
* 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.
*
2023-01-06 15:36:05 -05:00
* This file is part of the 86Box distribution.
*
2023-01-06 15:36:05 -05:00
* 8080 CPU emulation (header).
*
*
2023-01-06 15:36:05 -05:00
*
* Authors: Cacodemon345
*
* Copyright 2022 Cacodemon345
*/
#include <stdint.h>
2022-11-19 08:49:04 -05:00
typedef struct i8080 {
union {
uint16_t af; /* Intended in case we also go for μPD9002 emulation, which also has a Z80 emulation mode. */
2022-11-19 08:49:04 -05:00
struct {
2023-05-11 03:02:36 -04:00
uint8_t a;
uint8_t flags;
2022-11-19 08:49:04 -05:00
};
};
2022-11-19 08:49:04 -05:00
union {
uint16_t bc;
2022-11-19 08:49:04 -05:00
struct {
2023-05-11 03:02:36 -04:00
uint8_t b;
uint8_t c;
2022-11-19 08:49:04 -05:00
};
};
2022-11-19 08:49:04 -05:00
union {
uint16_t de;
2022-11-19 08:49:04 -05:00
struct {
2023-05-11 03:02:36 -04:00
uint8_t d;
uint8_t e;
2022-11-19 08:49:04 -05:00
};
};
2022-11-19 08:49:04 -05:00
union {
uint16_t hl;
2022-11-19 08:49:04 -05:00
struct {
2023-05-11 03:02:36 -04:00
uint8_t h;
uint8_t l;
2022-11-19 08:49:04 -05:00
};
};
2023-05-11 03:02:36 -04:00
uint16_t pc;
uint16_t sp;
uint16_t oldpc;
uint16_t ei;
uint32_t pmembase;
2023-08-21 20:26:11 -04:00
uint32_t dmembase; /* Base from where i8080 starts. */
2023-05-11 03:02:36 -04:00
uint8_t emulated; /* 0 = not emulated, use separate registers, 1 = emulated, use x86 registers. */
2022-11-19 08:49:04 -05:00
uint16_t *cpu_flags;
2023-08-21 20:26:11 -04:00
void (*writemembyte)(uint32_t, uint8_t);
2022-09-11 11:47:13 +06:00
uint8_t (*readmembyte)(uint32_t);
2023-08-21 20:26:11 -04:00
void (*startclock)(void);
void (*endclock)(void);
void (*checkinterrupts)(void);
uint8_t (*fetchinstruction)(void *);
} i8080;
2022-11-19 08:49:04 -05:00
#define C_FLAG_I8080 (1 << 0)
#define P_FLAG_I8080 (1 << 2)
#define AC_FLAG_I8080 (1 << 4)
2022-11-19 08:49:04 -05:00
#define Z_FLAG_I8080 (1 << 6)
#define S_FLAG_I8080 (1 << 7)