A bit more clang-format

This commit is contained in:
Jasmine Iwanek
2022-11-19 08:49:04 -05:00
parent b04dd8cc8b
commit 3fe4f75108
223 changed files with 8047 additions and 7456 deletions

View File

@@ -36,12 +36,12 @@
*/
#ifndef BSWAP_H
# define BSWAP_H
#define BSWAP_H
#include <stdint.h>
#ifdef HAVE_BYTESWAP_H
#include <byteswap.h>
# include <byteswap.h>
#else
# define bswap_16(x) \
( \
@@ -81,103 +81,111 @@ static __inline uint16_t bswap16(uint16_t x)
{
return bswap_16(x);
}
#endif
# endif
#else
static __inline uint16_t bswap16(uint16_t x)
static __inline uint16_t
bswap16(uint16_t x)
{
return bswap_16(x);
}
#endif
#if __GNUC__ >= 10
#if defined __has_builtin && __has_builtin(__builtin_bswap32)
#define bswap32(x) __builtin_bswap32(x)
#else
static __inline uint32_t bswap32(uint32_t x)
#if __GNUC__ >= 10
# if defined __has_builtin && __has_builtin(__builtin_bswap32)
# define bswap32(x) __builtin_bswap32(x)
# else
static __inline uint32_t
bswap32(uint32_t x)
{
return bswap_32(x);
}
#endif
# endif
#else
static __inline uint32_t bswap32(uint32_t x)
static __inline uint32_t
bswap32(uint32_t x)
{
return bswap_32(x);
}
#endif
#if __GNUC__ >= 10
#if defined __has_builtin && __has_builtin(__builtin_bswap64)
#define bswap64(x) __builtin_bswap64(x)
#else
static __inline uint64_t bswap64(uint64_t x)
#if __GNUC__ >= 10
# if defined __has_builtin && __has_builtin(__builtin_bswap64)
# define bswap64(x) __builtin_bswap64(x)
# else
static __inline uint64_t
bswap64(uint64_t x)
{
return bswap_64(x);
}
#endif
# endif
#else
static __inline uint64_t bswap64(uint64_t x)
static __inline uint64_t
bswap64(uint64_t x)
{
return bswap_64(x);
}
#endif
static __inline void bswap16s(uint16_t *s)
static __inline void
bswap16s(uint16_t *s)
{
*s = bswap16(*s);
}
static __inline void bswap32s(uint32_t *s)
static __inline void
bswap32s(uint32_t *s)
{
*s = bswap32(*s);
}
static __inline void bswap64s(uint64_t *s)
static __inline void
bswap64s(uint64_t *s)
{
*s = bswap64(*s);
}
#if defined(WORDS_BIGENDIAN)
# define be_bswap(v, size) (v)
# define le_bswap(v, size) bswap ## size(v)
# define be_bswaps(v, size)
# define le_bswaps(p, size) *p = bswap ## size(*p);
# define be_bswap(v, size) (v)
# define le_bswap(v, size) bswap##size(v)
# define be_bswaps(v, size)
# define le_bswaps(p, size) *p = bswap##size(*p);
#else
# define le_bswap(v, size) (v)
# define be_bswap(v, size) bswap ## size(v)
# define le_bswaps(v, size)
# define be_bswaps(p, size) *p = bswap ## size(*p);
# define le_bswap(v, size) (v)
# define be_bswap(v, size) bswap##size(v)
# define le_bswaps(v, size)
# define be_bswaps(p, size) *p = bswap##size(*p);
#endif
#define CPU_CONVERT(endian, size, type)\
static __inline type endian ## size ## _to_cpu(type v)\
{\
return endian ## _bswap(v, size);\
}\
\
static __inline type cpu_to_ ## endian ## size(type v)\
{\
return endian ## _bswap(v, size);\
}\
\
static __inline void endian ## size ## _to_cpus(type *p)\
{\
endian ## _bswaps(p, size)\
}\
\
static __inline void cpu_to_ ## endian ## size ## s(type *p)\
{\
endian ## _bswaps(p, size)\
}\
\
static __inline type endian ## size ## _to_cpup(const type *p)\
{\
return endian ## size ## _to_cpu(*p);\
}\
\
static __inline void cpu_to_ ## endian ## size ## w(type *p, type v)\
{\
*p = cpu_to_ ## endian ## size(v);\
}
#define CPU_CONVERT(endian, size, type) \
static __inline type endian##size##_to_cpu(type v) \
{ \
return endian##_bswap(v, size); \
} \
\
static __inline type cpu_to_##endian##size(type v) \
{ \
return endian##_bswap(v, size); \
} \
\
static __inline void endian##size##_to_cpus(type *p) \
{ \
endian##_bswaps(p, size) \
} \
\
static __inline void cpu_to_##endian##size##s(type *p) \
{ \
endian##_bswaps(p, size) \
} \
\
static __inline type endian##size##_to_cpup(const type *p) \
{ \
return endian##size##_to_cpu(*p); \
} \
\
static __inline void cpu_to_##endian##size##w(type *p, type v) \
{ \
*p = cpu_to_##endian##size(v); \
}
CPU_CONVERT(be, 16, uint16_t)
CPU_CONVERT(be, 32, uint32_t)
@@ -191,27 +199,29 @@ CPU_CONVERT(le, 64, uint64_t)
#if defined(__i386__) || defined(__powerpc__)
#define cpu_to_le16wu(p, v) cpu_to_le16w(p, v)
#define cpu_to_le32wu(p, v) cpu_to_le32w(p, v)
#define le16_to_cpupu(p) le16_to_cpup(p)
#define le32_to_cpupu(p) le32_to_cpup(p)
# define cpu_to_le16wu(p, v) cpu_to_le16w(p, v)
# define cpu_to_le32wu(p, v) cpu_to_le32w(p, v)
# define le16_to_cpupu(p) le16_to_cpup(p)
# define le32_to_cpupu(p) le32_to_cpup(p)
#define cpu_to_be16wu(p, v) cpu_to_be16w(p, v)
#define cpu_to_be32wu(p, v) cpu_to_be32w(p, v)
# define cpu_to_be16wu(p, v) cpu_to_be16w(p, v)
# define cpu_to_be32wu(p, v) cpu_to_be32w(p, v)
#else
static __inline void cpu_to_le16wu(uint16_t *p, uint16_t v)
static __inline void
cpu_to_le16wu(uint16_t *p, uint16_t v)
{
uint8_t *p1 = (uint8_t *)p;
uint8_t *p1 = (uint8_t *) p;
p1[0] = v & 0xff;
p1[1] = v >> 8;
}
static __inline void cpu_to_le32wu(uint32_t *p, uint32_t v)
static __inline void
cpu_to_le32wu(uint32_t *p, uint32_t v)
{
uint8_t *p1 = (uint8_t *)p;
uint8_t *p1 = (uint8_t *) p;
p1[0] = v;
p1[1] = v >> 8;
@@ -219,29 +229,33 @@ static __inline void cpu_to_le32wu(uint32_t *p, uint32_t v)
p1[3] = v >> 24;
}
static __inline uint16_t le16_to_cpupu(const uint16_t *p)
static __inline uint16_t
le16_to_cpupu(const uint16_t *p)
{
const uint8_t *p1 = (const uint8_t *)p;
const uint8_t *p1 = (const uint8_t *) p;
return p1[0] | (p1[1] << 8);
}
static __inline uint32_t le32_to_cpupu(const uint32_t *p)
static __inline uint32_t
le32_to_cpupu(const uint32_t *p)
{
const uint8_t *p1 = (const uint8_t *)p;
const uint8_t *p1 = (const uint8_t *) p;
return p1[0] | (p1[1] << 8) | (p1[2] << 16) | (p1[3] << 24);
}
static __inline void cpu_to_be16wu(uint16_t *p, uint16_t v)
static __inline void
cpu_to_be16wu(uint16_t *p, uint16_t v)
{
uint8_t *p1 = (uint8_t *)p;
uint8_t *p1 = (uint8_t *) p;
p1[0] = v >> 8;
p1[1] = v & 0xff;
}
static __inline void cpu_to_be32wu(uint32_t *p, uint32_t v)
static __inline void
cpu_to_be32wu(uint32_t *p, uint32_t v)
{
uint8_t *p1 = (uint8_t *)p;
uint8_t *p1 = (uint8_t *) p;
p1[0] = v >> 24;
p1[1] = v >> 16;
@@ -252,9 +266,9 @@ static __inline void cpu_to_be32wu(uint32_t *p, uint32_t v)
#endif
#ifdef WORDS_BIGENDIAN
#define cpu_to_32wu cpu_to_be32wu
# define cpu_to_32wu cpu_to_be32wu
#else
#define cpu_to_32wu cpu_to_le32wu
# define cpu_to_32wu cpu_to_le32wu
#endif
#undef le_bswap

View File

@@ -40,18 +40,18 @@ extern int fdc_type;
#define FDC_QUATERNARY_IRQ 6
#define FDC_QUATERNARY_DMA 2
#define FDC_FLAG_PCJR 0x01 /* PCjr */
#define FDC_FLAG_DISKCHG_ACTLOW 0x02 /* Amstrad, PS/1, PS/2 ISA */
#define FDC_FLAG_AT 0x04 /* AT+, PS/x */
#define FDC_FLAG_PS1 0x08 /* PS/1, PS/2 ISA */
#define FDC_FLAG_SUPERIO 0x10 /* Super I/O chips */
#define FDC_FLAG_START_RWC_1 0x20 /* W83877F, W83977F */
#define FDC_FLAG_MORE_TRACKS 0x40 /* W83877F, W83977F, PC87306, PC87309 */
#define FDC_FLAG_NSC 0x80 /* PC87306, PC87309 */
#define FDC_FLAG_TOSHIBA 0x100 /* T1000, T1200 */
#define FDC_FLAG_AMSTRAD 0x200 /* Non-AT Amstrad machines */
#define FDC_FLAG_UMC 0x400 /* UMC UM8398 */
#define FDC_FLAG_ALI 0x800 /* ALi M512x / M1543C */
#define FDC_FLAG_PCJR 0x01 /* PCjr */
#define FDC_FLAG_DISKCHG_ACTLOW 0x02 /* Amstrad, PS/1, PS/2 ISA */
#define FDC_FLAG_AT 0x04 /* AT+, PS/x */
#define FDC_FLAG_PS1 0x08 /* PS/1, PS/2 ISA */
#define FDC_FLAG_SUPERIO 0x10 /* Super I/O chips */
#define FDC_FLAG_START_RWC_1 0x20 /* W83877F, W83977F */
#define FDC_FLAG_MORE_TRACKS 0x40 /* W83877F, W83977F, PC87306, PC87309 */
#define FDC_FLAG_NSC 0x80 /* PC87306, PC87309 */
#define FDC_FLAG_TOSHIBA 0x100 /* T1000, T1200 */
#define FDC_FLAG_AMSTRAD 0x200 /* Non-AT Amstrad machines */
#define FDC_FLAG_UMC 0x400 /* UMC UM8398 */
#define FDC_FLAG_ALI 0x800 /* ALi M512x / M1543C */
#define FDC_FLAG_SEC 0x1000 /* Is Secondary */
typedef struct {

View File

@@ -21,9 +21,9 @@
#ifndef EMU_FDD_H
#define EMU_FDD_H
#define FDD_NUM 4
#define FLOPPY_IMAGE_HISTORY 4
#define SEEK_RECALIBRATE -999
#define FDD_NUM 4
#define FLOPPY_IMAGE_HISTORY 4
#define SEEK_RECALIBRATE -999
#ifdef __cplusplus
extern "C" {
@@ -85,7 +85,7 @@ typedef struct {
extern DRIVE drives[FDD_NUM];
extern char floppyfns[FDD_NUM][512];
extern char *fdd_image_history[FDD_NUM][FLOPPY_IMAGE_HISTORY];
extern char *fdd_image_history[FDD_NUM][FLOPPY_IMAGE_HISTORY];
extern pc_timer_t fdd_poll_time[FDD_NUM];
extern int ui_writeprot[FDD_NUM];

View File

@@ -33,19 +33,19 @@
extern int hdc_current;
extern const device_t st506_xt_xebec_device; /* st506_xt_xebec */
extern const device_t st506_xt_dtc5150x_device; /* st506_xt_dtc */
extern const device_t st506_xt_st11_m_device; /* st506_xt_st11_m */
extern const device_t st506_xt_st11_r_device; /* st506_xt_st11_m */
extern const device_t st506_xt_wd1002a_wx1_device; /* st506_xt_wd1002a_wx1 */
extern const device_t st506_xt_wd1002a_wx1_nobios_device; /* st506_xt_wd1002a_wx1 */
extern const device_t st506_xt_wd1002a_27x_device; /* st506_xt_wd1002a_27x */
extern const device_t st506_at_wd1003_device; /* st506_at_wd1003 */
extern const device_t st506_xt_wd1004a_wx1_device; /* st506_xt_wd1004a_wx1 */
extern const device_t st506_xt_wd1004_27x_device; /* st506_xt_wd1004_27x */
extern const device_t st506_xt_wd1004a_27x_device; /* st506_xt_wd1004a_27x */
extern const device_t st506_xt_victor_v86p_device; /* st506_xt_victor_v86p */
extern const device_t st506_xt_toshiba_t1200_device; /* st506_xt_toshiba_t1200 */
extern const device_t st506_xt_xebec_device; /* st506_xt_xebec */
extern const device_t st506_xt_dtc5150x_device; /* st506_xt_dtc */
extern const device_t st506_xt_st11_m_device; /* st506_xt_st11_m */
extern const device_t st506_xt_st11_r_device; /* st506_xt_st11_m */
extern const device_t st506_xt_wd1002a_wx1_device; /* st506_xt_wd1002a_wx1 */
extern const device_t st506_xt_wd1002a_wx1_nobios_device; /* st506_xt_wd1002a_wx1 */
extern const device_t st506_xt_wd1002a_27x_device; /* st506_xt_wd1002a_27x */
extern const device_t st506_at_wd1003_device; /* st506_at_wd1003 */
extern const device_t st506_xt_wd1004a_wx1_device; /* st506_xt_wd1004a_wx1 */
extern const device_t st506_xt_wd1004_27x_device; /* st506_xt_wd1004_27x */
extern const device_t st506_xt_wd1004a_27x_device; /* st506_xt_wd1004a_27x */
extern const device_t st506_xt_victor_v86p_device; /* st506_xt_victor_v86p */
extern const device_t st506_xt_toshiba_t1200_device; /* st506_xt_toshiba_t1200 */
extern const device_t esdi_at_wd1007vse1_device; /* esdi_at */
extern const device_t esdi_ps2_device; /* esdi_mca */

View File

@@ -18,14 +18,14 @@
#ifndef EMU_HDD_H
#define EMU_HDD_H
#define IMG_FMT_RAW 0
#define IMG_FMT_HDI 1
#define IMG_FMT_HDX 2
#define IMG_FMT_VHD_FIXED 3
#define IMG_FMT_RAW 0
#define IMG_FMT_HDI 1
#define IMG_FMT_HDX 2
#define IMG_FMT_VHD_FIXED 3
#define IMG_FMT_VHD_DYNAMIC 4
#define IMG_FMT_VHD_DIFF 5
#define IMG_FMT_VHD_DIFF 5
#define HDD_NUM 88 /* total of 88 images supported */
#define HDD_NUM 88 /* total of 88 images supported */
/* Hard Disk bus types. */
#if 0

View File

@@ -15,32 +15,36 @@
#include <stdint.h>
typedef struct i8080
{
union {
typedef struct i8080 {
union {
uint16_t af; /* Intended in case we also go for μPD9002 emulation, which also has a Z80 emulation mode. */
struct { uint8_t a, flags; };
struct {
uint8_t a, flags;
};
};
union
{
union {
uint16_t bc;
struct { uint8_t b, c; };
struct {
uint8_t b, c;
};
};
union
{
union {
uint16_t de;
struct { uint8_t d, e; };
struct {
uint8_t d, e;
};
};
union
{
union {
uint16_t hl;
struct { uint8_t h, l; };
struct {
uint8_t h, l;
};
};
uint16_t pc, sp;
uint16_t oldpc, ei;
uint32_t pmembase, dmembase; /* Base from where i8080 starts. */
uint8_t emulated; /* 0 = not emulated, use separate registers, 1 = emulated, use x86 registers. */
uint16_t* cpu_flags;
uint16_t pc, sp;
uint16_t oldpc, ei;
uint32_t pmembase, dmembase; /* Base from where i8080 starts. */
uint8_t emulated; /* 0 = not emulated, use separate registers, 1 = emulated, use x86 registers. */
uint16_t *cpu_flags;
void (*writemembyte)(uint32_t, uint8_t);
uint8_t (*readmembyte)(uint32_t);
void (*startclock)(void);
@@ -49,8 +53,8 @@ typedef struct i8080
uint8_t (*fetchinstruction)(void *);
} i8080;
#define C_FLAG_I8080 (1 << 0)
#define P_FLAG_I8080 (1 << 2)
#define C_FLAG_I8080 (1 << 0)
#define P_FLAG_I8080 (1 << 2)
#define AC_FLAG_I8080 (1 << 4)
#define Z_FLAG_I8080 (1 << 6)
#define S_FLAG_I8080 (1 << 7)
#define Z_FLAG_I8080 (1 << 6)
#define S_FLAG_I8080 (1 << 7)

View File

@@ -22,65 +22,65 @@
#define LANG_UAGE_H
/* String IDs. */
#define IDS_STRINGS 2048 // "86Box"
#define IDS_2049 2049 // "Error"
#define IDS_2050 2050 // "Fatal error"
#define IDS_2051 2051 // " - PAUSED"
#define IDS_2052 2052 // "Press Ctrl+Alt+PgDn..."
#define IDS_2053 2053 // "Speed"
#define IDS_2054 2054 // "ZIP %i (%03i): %ls"
#define IDS_2055 2055 // "ZIP images (*.IM?)\0*.IM..."
#define IDS_2056 2056 // "No usable ROM images found!"
#define IDS_2057 2057 // "(empty)"
#define IDS_2058 2058 // "ZIP images (*.IM?)\0*.IM..."
#define IDS_2059 2059 // "(Turbo)"
#define IDS_2060 2060 // "On"
#define IDS_2061 2061 // "Off"
#define IDS_2062 2062 // "All floppy images (*.DSK..."
#define IDS_2063 2063 // "Machine ""%hs"" is not..."
#define IDS_2064 2064 // "Video card ""%hs"" is not..."
#define IDS_2065 2065 // "Machine"
#define IDS_2066 2066 // "Display"
#define IDS_2067 2067 // "Input devices"
#define IDS_2068 2068 // "Sound"
#define IDS_2069 2069 // "Network"
#define IDS_2070 2070 // "Ports (COM & LPT)"
#define IDS_2071 2071 // "Storage controllers"
#define IDS_2072 2072 // "Hard disks"
#define IDS_2073 2073 // "Floppy and CD-ROM drives"
#define IDS_2074 2074 // "Other removable devices"
#define IDS_2075 2075 // "Other peripherals"
#define IDS_2076 2076 // "Surface-based images (*.8.."
#define IDS_2077 2077 // "Click to capture mouse"
#define IDS_2078 2078 // "Press F12-F8 to release mouse"
#define IDS_2079 2079 // "Press F12-F8 or middle button.."
#define IDS_2080 2080 // "Unable to initialize Flui.."
#define IDS_2081 2081 // "Bus"
#define IDS_BUS IDS_2081 // "Bus"
#define IDS_2082 2082 // "File"
#define IDS_2083 2083 // "C"
#define IDS_2084 2084 // "H"
#define IDS_2085 2085 // "S"
#define IDS_2086 2086 // "MB"
#define IDS_MB IDS_2086 // "MB"
#define IDS_2087 2087 // "Speed"
#define IDS_STRINGS 2048 // "86Box"
#define IDS_2049 2049 // "Error"
#define IDS_2050 2050 // "Fatal error"
#define IDS_2051 2051 // " - PAUSED"
#define IDS_2052 2052 // "Press Ctrl+Alt+PgDn..."
#define IDS_2053 2053 // "Speed"
#define IDS_2054 2054 // "ZIP %i (%03i): %ls"
#define IDS_2055 2055 // "ZIP images (*.IM?)\0*.IM..."
#define IDS_2056 2056 // "No usable ROM images found!"
#define IDS_2057 2057 // "(empty)"
#define IDS_2058 2058 // "ZIP images (*.IM?)\0*.IM..."
#define IDS_2059 2059 // "(Turbo)"
#define IDS_2060 2060 // "On"
#define IDS_2061 2061 // "Off"
#define IDS_2062 2062 // "All floppy images (*.DSK..."
#define IDS_2063 2063 // "Machine ""%hs"" is not..."
#define IDS_2064 2064 // "Video card ""%hs"" is not..."
#define IDS_2065 2065 // "Machine"
#define IDS_2066 2066 // "Display"
#define IDS_2067 2067 // "Input devices"
#define IDS_2068 2068 // "Sound"
#define IDS_2069 2069 // "Network"
#define IDS_2070 2070 // "Ports (COM & LPT)"
#define IDS_2071 2071 // "Storage controllers"
#define IDS_2072 2072 // "Hard disks"
#define IDS_2073 2073 // "Floppy and CD-ROM drives"
#define IDS_2074 2074 // "Other removable devices"
#define IDS_2075 2075 // "Other peripherals"
#define IDS_2076 2076 // "Surface-based images (*.8.."
#define IDS_2077 2077 // "Click to capture mouse"
#define IDS_2078 2078 // "Press F12-F8 to release mouse"
#define IDS_2079 2079 // "Press F12-F8 or middle button.."
#define IDS_2080 2080 // "Unable to initialize Flui.."
#define IDS_2081 2081 // "Bus"
#define IDS_BUS IDS_2081 // "Bus"
#define IDS_2082 2082 // "File"
#define IDS_2083 2083 // "C"
#define IDS_2084 2084 // "H"
#define IDS_2085 2085 // "S"
#define IDS_2086 2086 // "MB"
#define IDS_MB IDS_2086 // "MB"
#define IDS_2087 2087 // "Speed"
#define IDS_2088 2088 // "Check BPB"
#define IDS_BPB IDS_2088 // "Check BPB"
#define IDS_2088 2088 // "Check BPB"
#define IDS_BPB IDS_2088 // "Check BPB"
#define IDS_2089 2089 // "KB"
#define IDS_KB IDS_2089 // "KB"
#define IDS_2089 2089 // "KB"
#define IDS_KB IDS_2089 // "KB"
#define IDS_2090 2090 // "Could not initialize the video..."
#define IDS_2090 2090 // "Could not initialize the video..."
#define IDS_2091 2091 // "Default"
#define IDS_DEFAULT IDS_2091 // "Default"
#define IDS_2091 2091 // "Default"
#define IDS_DEFAULT IDS_2091 // "Default"
#define IDS_2092 2092 // "%i Wait state(s)"
#define IDS_WS IDS_2092 // "%i Wait state(s)"
#define IDS_2092 2092 // "%i Wait state(s)"
#define IDS_WS IDS_2092 // "%i Wait state(s)"
#define IDS_2093 2093 // "Type"
#define IDS_TYPE IDS_2093 // "Type"
#define IDS_2093 2093 // "Type"
#define IDS_TYPE IDS_2093 // "Type"
/* TODO */
#define IDS_2094 2094 // "PCap failed to set up.."
@@ -262,14 +262,14 @@
#define STR_NUM_2048 115
// UNUSED: #define STR_NUM_3072 11
#define STR_NUM_4096 40
#define STR_NUM_4352 6
#define STR_NUM_4608 6
#define STR_NUM_5120 1
#define STR_NUM_5376 7
#define STR_NUM_5632 7
#define STR_NUM_5888 24
#define STR_NUM_6144 4
#define STR_NUM_7168 1
#define STR_NUM_4096 40
#define STR_NUM_4352 6
#define STR_NUM_4608 6
#define STR_NUM_5120 1
#define STR_NUM_5376 7
#define STR_NUM_5632 7
#define STR_NUM_5888 24
#define STR_NUM_6144 4
#define STR_NUM_7168 1
#endif /*LANG_UAGE_H*/

View File

@@ -127,7 +127,10 @@
#define IS_AT(m) (((machines[m].bus_flags & (MACHINE_BUS_ISA16 | MACHINE_BUS_EISA | MACHINE_BUS_VLB | MACHINE_BUS_MCA | MACHINE_BUS_PCI | MACHINE_BUS_PCMCIA | MACHINE_BUS_AGP | MACHINE_BUS_AC97)) && !(machines[m].bus_flags & MACHINE_PC98)) ? 1 : 0)
#define CPU_BLOCK(...) \
(const uint8_t[]) { __VA_ARGS__, 0 }
(const uint8_t[]) \
{ \
__VA_ARGS__, 0 \
}
#define MACHINE_MULTIPLIER_FIXED -1
#define CPU_BLOCK_NONE 0

View File

@@ -22,38 +22,38 @@
#ifndef EMU_PCI_H
#define EMU_PCI_H
#define PCI_REG_COMMAND 0x04
#define PCI_REG_COMMAND 0x04
#define PCI_COMMAND_IO 0x01
#define PCI_COMMAND_MEM 0x02
#define PCI_COMMAND_IO 0x01
#define PCI_COMMAND_MEM 0x02
#define PCI_NO_IRQ_STEERING 0x8000
#define PCI_CAN_SWITCH_TYPE 0x10000
#define PCI_NO_BRIDGES 0x20000
#define PCI_ALWAYS_EXPOSE_DEV0 0x40000
#define PCI_NO_IRQ_STEERING 0x8000
#define PCI_CAN_SWITCH_TYPE 0x10000
#define PCI_NO_BRIDGES 0x20000
#define PCI_ALWAYS_EXPOSE_DEV0 0x40000
#define PCI_CONFIG_TYPE_1 1
#define PCI_CONFIG_TYPE_2 2
#define PCI_CONFIG_TYPE_1 1
#define PCI_CONFIG_TYPE_2 2
#define PCI_CONFIG_TYPE_MASK 0x7fff
#define PCI_CONFIG_TYPE_MASK 0x7fff
#define PCI_INTA 1
#define PCI_INTB 2
#define PCI_INTC 3
#define PCI_INTD 4
#define PCI_INTA 1
#define PCI_INTB 2
#define PCI_INTC 3
#define PCI_INTD 4
#define PCI_MIRQ0 0
#define PCI_MIRQ1 1
#define PCI_MIRQ2 2
#define PCI_MIRQ3 3
#define PCI_MIRQ4 4
#define PCI_MIRQ5 5
#define PCI_MIRQ6 6
#define PCI_MIRQ7 7
#define PCI_MIRQ0 0
#define PCI_MIRQ1 1
#define PCI_MIRQ2 2
#define PCI_MIRQ3 3
#define PCI_MIRQ4 4
#define PCI_MIRQ5 5
#define PCI_MIRQ6 6
#define PCI_MIRQ7 7
#define PCI_IRQ_DISABLED -1
#define PCI_IRQ_DISABLED -1
#define PCI_ADD_STRICT 0x80
#define PCI_ADD_STRICT 0x80
enum {
PCI_CARD_NORTHBRIDGE = 0,

View File

@@ -49,7 +49,7 @@ extern int strnicmp(const char *s1, const char *s2, size_t n);
# define ftello64 ftello
# define off64_t off_t
#elif defined(_MSC_VER)
//# define fopen64 fopen
// # define fopen64 fopen
# define fseeko64 _fseeki64
# define ftello64 _ftelli64
# define off64_t off_t

View File

@@ -19,24 +19,24 @@
/* Windows needs the POSIX re-implementations */
#if defined(_WIN32)
#ifdef _MAX_FNAME
# define MAXNAMLEN _MAX_FNAME
#else
# define MAXNAMLEN 15
#endif
#define MAXDIRLEN 127
# ifdef _MAX_FNAME
# define MAXNAMLEN _MAX_FNAME
# else
# define MAXNAMLEN 15
# endif
# define MAXDIRLEN 127
struct dirent {
long d_ino;
unsigned short d_reclen;
unsigned short d_off;
#ifdef UNICODE
# ifdef UNICODE
wchar_t d_name[MAXNAMLEN + 1];
#else
# else
char d_name[MAXNAMLEN + 1];
#endif
# endif
};
#define d_namlen d_reclen
# define d_namlen d_reclen
typedef struct {
short flags; /* internal flags */
@@ -44,18 +44,18 @@ typedef struct {
long handle; /* open handle to Win32 system */
short sts; /* last known status code */
char *dta; /* internal work data */
#ifdef UNICODE
# ifdef UNICODE
wchar_t dir[MAXDIRLEN + 1]; /* open dir */
#else
# else
char dir[MAXDIRLEN + 1]; /* open dir */
#endif
# endif
struct dirent dent; /* actual directory entry */
} DIR;
/* Directory routine flags. */
#define DIR_F_LOWER 0x0001 /* force to lowercase */
#define DIR_F_SANE 0x0002 /* force this to sane path */
#define DIR_F_ISROOT 0x0010 /* this is the root directory */
# define DIR_F_LOWER 0x0001 /* force to lowercase */
# define DIR_F_SANE 0x0002 /* force this to sane path */
# define DIR_F_ISROOT 0x0010 /* this is the root directory */
/* Function prototypes. */
extern DIR *opendir(const char *);
@@ -64,11 +64,10 @@ extern long telldir(DIR *);
extern void seekdir(DIR *, long);
extern int closedir(DIR *);
#define rewinddir(dirp) seekdir(dirp, 0L)
# define rewinddir(dirp) seekdir(dirp, 0L)
#else
/* On linux and macOS, use the standard functions and types */
#include <sys/dir.h>
# include <sys/dir.h>
#endif
#endif /*PLAT_DIR_H*/

View File

@@ -137,11 +137,11 @@
#define IDT_CD_SPEED 1761 /* Speed: */
/* DLG_CFG_OTHER_REMOVABLE_DEVICES */
#define IDT_MO_DRIVES 1762 /* MO drives: */
#define IDT_MO_BUS 1763 /* Bus: */
#define IDT_MO_ID 1764 /* ID: */
#define IDT_MO_CHANNEL 1765 /* Channel */
#define IDT_MO_TYPE 1766 /* Type: */
#define IDT_MO_DRIVES 1762 /* MO drives: */
#define IDT_MO_BUS 1763 /* Bus: */
#define IDT_MO_ID 1764 /* ID: */
#define IDT_MO_CHANNEL 1765 /* Channel */
#define IDT_MO_TYPE 1766 /* Type: */
#define IDT_ZIP_DRIVES 1767 /* ZIP drives: */
#define IDT_ZIP_BUS 1768 /* Bus: */

View File

@@ -68,8 +68,8 @@ void cga_poll(void *p);
#ifdef EMU_DEVICE_H
extern const device_config_t cga_config[];
extern const device_t cga_device;
extern const device_t cga_pravetz_device;
extern const device_t cga_device;
extern const device_t cga_pravetz_device;
#endif
#endif /*VIDEO_CGA_H*/

View File

@@ -23,7 +23,7 @@
#define Bit8u uint8_t
#define Bit32u uint32_t
#define Bitu unsigned int
#define bool uint8_t
#define bool uint8_t
void update_cga16_color(uint8_t cgamode);
void cga_comp_init(int revision);

View File

@@ -2075,12 +2075,12 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params,
addbyte(0x05);
addlong((uint32_t) &xmm_ff_b);
}
//#if 0
// addbyte(0x66); /*MOVD state->out[EDI], XMM0*/
// addbyte(0x0f);
// addbyte(0x7e);
// addbyte(0x87);
// addlong(offsetof(voodoo_state_t, out));
// #if 0
// addbyte(0x66); /*MOVD state->out[EDI], XMM0*/
// addbyte(0x0f);
// addbyte(0x7e);
// addbyte(0x87);
// addlong(offsetof(voodoo_state_t, out));
if (params->fogMode & FOG_ENABLE) {
if (params->fogMode & FOG_CONSTANT) {
addbyte(0x66); /*MOVD XMM3, params->fogColor[ESI]*/
@@ -2695,7 +2695,7 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params,
addbyte(0x67);
addbyte(0xc0);
}
//#endif
// #endif
// addbyte(0x8b); /*MOV EDX, x (ESP+12)*/
// addbyte(0x54);

View File

@@ -33,10 +33,10 @@
#define TEX_CACHE_MAX 64
#ifdef __cplusplus
#include <atomic>
# include <atomic>
using atomic_int = std::atomic<int>;
#else
#include <stdatomic.h>
# include <stdatomic.h>
#endif
enum {
@@ -320,7 +320,7 @@ typedef struct voodoo_t {
uint32_t cmdfifo_amin, cmdfifo_amax;
int cmdfifo_holecount;
atomic_uint cmd_status;
atomic_uint cmd_status;
uint32_t sSetupMode;
vert_t verts[4];

View File

@@ -17,7 +17,7 @@
*/
#ifndef VIDEO_VOODOO_DITHER_H
# define VIDEO_VOODOO_DITHER_H
#define VIDEO_VOODOO_DITHER_H
static const uint8_t dither_rb[256][4][4] =
{

View File

@@ -21,7 +21,7 @@
#ifndef __FDI2RAW_H
#define __FDI2RAW_H
#define uae_u8 uint8_t
#define uae_u8 uint8_t
#define uae_u16 uint16_t
#define uae_u32 uint32_t
@@ -32,20 +32,20 @@ typedef struct fdi FDI;
extern "C" {
#endif
extern int fdi2raw_loadtrack (FDI*, uae_u16 *mfmbuf, uae_u16 *tracktiming, int track, int *tracklength, int *indexoffset, int *multirev, int mfm);
extern int fdi2raw_loadtrack(FDI *, uae_u16 *mfmbuf, uae_u16 *tracktiming, int track, int *tracklength, int *indexoffset, int *multirev, int mfm);
extern int fdi2raw_loadrevolution (FDI*, uae_u16 *mfmbuf, uae_u16 *tracktiming, int track, int *tracklength, int mfm);
extern int fdi2raw_loadrevolution(FDI *, uae_u16 *mfmbuf, uae_u16 *tracktiming, int track, int *tracklength, int mfm);
extern FDI *fdi2raw_header(FILE *f);
extern void fdi2raw_header_free (FDI *);
extern int fdi2raw_get_last_track(FDI *);
extern int fdi2raw_get_num_sector (FDI *);
extern int fdi2raw_get_last_head(FDI *);
extern int fdi2raw_get_type (FDI *);
extern int fdi2raw_get_bit_rate (FDI *);
extern int fdi2raw_get_rotation (FDI *);
extern int fdi2raw_get_write_protect (FDI *);
extern int fdi2raw_get_tpi (FDI *);
extern void fdi2raw_header_free(FDI *);
extern int fdi2raw_get_last_track(FDI *);
extern int fdi2raw_get_num_sector(FDI *);
extern int fdi2raw_get_last_head(FDI *);
extern int fdi2raw_get_type(FDI *);
extern int fdi2raw_get_bit_rate(FDI *);
extern int fdi2raw_get_rotation(FDI *);
extern int fdi2raw_get_write_protect(FDI *);
extern int fdi2raw_get_tpi(FDI *);
#ifdef __cplusplus
}

View File

@@ -15,101 +15,99 @@
* Copyright 2020 RichardG.
*/
#ifndef TINYGLIB_H
# define TINYGLIB_H
#define TINYGLIB_H
/* Define this to bypass TinyGLib and use full GLib instead. */
#ifdef TINYGLIB_USE_GLIB
#include <glib.h>
# include <glib.h>
#else
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#define HAVE_STDARG_H
#include <86box/86box.h>
# include <stdarg.h>
# include <stdint.h>
# include <stdio.h>
# include <stdlib.h>
# define HAVE_STDARG_H
# include <86box/86box.h>
/* Definitions */
#define G_LITTLE_ENDIAN 1234
#define G_BIG_ENDIAN 4321
#define G_PDP_ENDIAN 3412
#ifdef __BYTE_ORDER__
# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
# define G_BYTE_ORDER G_LITTLE_ENDIAN
# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
# define G_BYTE_ORDER G_BIG_ENDIAN
# elif __BYTE_ORDER__ == __ORDER_PDP_ENDIAN__
# define G_BYTE_ORDER G_PDP_ENDIAN
# endif
#endif
#ifndef G_BYTE_ORDER
# define G_LITTLE_ENDIAN 1234
# define G_BIG_ENDIAN 4321
# define G_PDP_ENDIAN 3412
# ifdef __BYTE_ORDER__
# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
# define G_BYTE_ORDER G_LITTLE_ENDIAN
# elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
# define G_BYTE_ORDER G_BIG_ENDIAN
# elif __BYTE_ORDER__ == __ORDER_PDP_ENDIAN__
# define G_BYTE_ORDER G_PDP_ENDIAN
# endif
# endif
# ifndef G_BYTE_ORDER
/* Safe to assume LE for MSVC, as Windows is LE on all architectures. */
# define G_BYTE_ORDER G_LITTLE_ENDIAN
#endif
# define G_BYTE_ORDER G_LITTLE_ENDIAN
# endif
#ifdef _WIN32
# define G_OS_WIN32 1
#else
# define G_OS_UNIX 1
#endif
# ifdef _WIN32
# define G_OS_WIN32 1
# else
# define G_OS_UNIX 1
# endif
#define G_SPAWN_SEARCH_PATH 0
#if defined(__LP64__) || defined(__LLP64__) || defined(_WIN64)
# define GLIB_SIZEOF_VOID_P 8
# if defined(__LLP64__) || defined(_WIN64)
# define GLIB_SIZEOF_LONG 4
# else
# define GLIB_SIZEOF_LONG 8
# endif
# define GLIB_SIZEOF_SIZE_T 8
# define GLIB_SIZEOF_SSIZE_T 8
#else
# define GLIB_SIZEOF_VOID_P 4
# define GLIB_SIZEOF_LONG 4
# define GLIB_SIZEOF_SIZE_T 4
# define GLIB_SIZEOF_SSIZE_T 4
#endif
# define G_SPAWN_SEARCH_PATH 0
# if defined(__LP64__) || defined(__LLP64__) || defined(_WIN64)
# define GLIB_SIZEOF_VOID_P 8
# if defined(__LLP64__) || defined(_WIN64)
# define GLIB_SIZEOF_LONG 4
# else
# define GLIB_SIZEOF_LONG 8
# endif
# define GLIB_SIZEOF_SIZE_T 8
# define GLIB_SIZEOF_SSIZE_T 8
# else
# define GLIB_SIZEOF_VOID_P 4
# define GLIB_SIZEOF_LONG 4
# define GLIB_SIZEOF_SIZE_T 4
# define GLIB_SIZEOF_SSIZE_T 4
# endif
/* Types */
/* Windows does not define ssize_t, so we need to define it here. */
#ifndef _SSIZE_T_DEFINED
# define _SSIZE_T_DEFINED
# undef ssize_t
# ifdef _WIN64
# define ssize_t int64_t
# else
# define ssize_t int32_t
# endif
#endif
# ifndef _SSIZE_T_DEFINED
# define _SSIZE_T_DEFINED
# undef ssize_t
# ifdef _WIN64
# define ssize_t int64_t
# else
# define ssize_t int32_t
# endif
# endif
#define gboolean int
#define gchar char
#define gint int
#define gint16 int16_t
#define gint32 int32_t
#define gint64 int64_t
#define glong long
#define GPid void *
#define gpointer void *
#define gsize size_t
#define GSpawnFlags void *
#define GSpawnChildSetupFunc void *
#define gssize ssize_t
#define GString char
#define GStrv char **
#define guint unsigned int
#define guint16 uint16_t
#define guint32 uint32_t
#define guint64 uint64_t
# define gboolean int
# define gchar char
# define gint int
# define gint16 int16_t
# define gint32 int32_t
# define gint64 int64_t
# define glong long
# define GPid void *
# define gpointer void *
# define gsize size_t
# define GSpawnFlags void *
# define GSpawnChildSetupFunc void *
# define gssize ssize_t
# define GString char
# define GStrv char **
# define guint unsigned int
# define guint16 uint16_t
# define guint32 uint32_t
# define guint64 uint64_t
typedef struct _GDebugKey {
char key[32];
int val;
int val;
} GDebugKey;
typedef struct _GError {
@@ -120,80 +118,86 @@ typedef struct _GRand {
uint8_t dummy;
} GRand;
/* Functions */
extern gboolean g_spawn_async_with_fds(const gchar *working_directory, gchar **argv,
extern gboolean g_spawn_async_with_fds(const gchar *working_directory, gchar **argv,
gchar **envp, GSpawnFlags flags,
GSpawnChildSetupFunc child_setup,
gpointer user_data, GPid *child_pid, gint stdin_fd,
gint stdout_fd, gint stderr_fd, GError **error);
extern GString *g_string_new(gchar *base);
extern gchar *g_string_free(GString *string, gboolean free_segment);
extern gchar *g_strstr_len(const gchar *haystack, gssize haystack_len, const gchar *needle);
extern guint g_strv_length(gchar **str_array);
extern GString *g_string_new(gchar *base);
extern gchar *g_string_free(GString *string, gboolean free_segment);
extern gchar *g_strstr_len(const gchar *haystack, gssize haystack_len, const gchar *needle);
extern guint g_strv_length(gchar **str_array);
/* Macros */
#define tinyglib_pclog(f, s, ...) pclog("TinyGLib " f "(): " s "\n", ##__VA_ARGS__)
# define tinyglib_pclog(f, s, ...) pclog("TinyGLib " f "(): " s "\n", ##__VA_ARGS__)
#define GLIB_CHECK_VERSION(a, b, c) 1
#ifdef __GNUC__
# define G_GNUC_PRINTF(format_idx, arg_idx) __attribute__((__format__ (__printf__, format_idx, arg_idx)))
#else
# define G_GNUC_PRINTF(format_idx, arg_idx)
#endif
#define G_N_ELEMENTS(arr) (sizeof(arr) / sizeof((arr)[0]))
#define G_STATIC_ASSERT(e) /* this should probably do something */
#define G_UNLIKELY(e) (e)
#define g_assert(e) do { if (!(e)) fatal("TinyGLib g_assert(" #e ")\n"); } while (0)
#ifdef __GNUC__
# define g_assert_not_reached __builtin_unreachable
#else
# ifdef _MSC_VER
# define g_assert_not_reached() __assume(0)
# else
# define g_assert_not_reached()
# endif
#endif
#define g_critical(s, ...) fatal("TinyGLib g_critical(): " s "\n", ##__VA_ARGS__)
#ifdef TINYGLIB_DEBUG
# define g_debug(s, ...) tinyglib_pclog("g_debug", s, ##__VA_ARGS__)
#else
# define g_debug(s, ...)
#endif
#define g_error(s, ...) tinyglib_pclog("g_error", s, ##__VA_ARGS__)
#define g_error_free(err)
#define g_malloc0(s) calloc(1, s)
#define g_new(t, n) (t *) malloc(sizeof(t) * n)
#define g_new0(t, n) (t *) calloc(n, sizeof(t))
#ifdef TINYGLIB_DEBUG
# define g_parse_debug_string(s, k, n) ((!!sizeof(k)) * -1) /* unimplemented; always enables all debug flags */
#else
# define g_parse_debug_string(s, k, n) (!sizeof(k))
#endif
#define g_rand_int_range(r, min, max) (rand() % (max + 1 - min) + min)
#define g_rand_new() calloc(1, sizeof(GRand))
#define g_return_val_if_fail(e, v) if (!(e)) return (v)
#define g_shell_parse_argv(a, b, c, d) !!(sizeof(b)) /* unimplemented */
#define g_strdup(str) ((str) ? strdup(str) : NULL)
#define g_warn_if_fail(e) do { if (!(e)) pclog("TinyGLib g_warn_if_fail(" #e ")\n"); } while (0)
#define g_warn_if_reached() pclog("TinyGLib g_warn_if_reached()\n")
#define g_warning(s, ...) tinyglib_pclog("g_warning", s, ##__VA_ARGS__)
# define GLIB_CHECK_VERSION(a, b, c) 1
# ifdef __GNUC__
# define G_GNUC_PRINTF(format_idx, arg_idx) __attribute__((__format__(__printf__, format_idx, arg_idx)))
# else
# define G_GNUC_PRINTF(format_idx, arg_idx)
# endif
# define G_N_ELEMENTS(arr) (sizeof(arr) / sizeof((arr)[0]))
# define G_STATIC_ASSERT(e) /* this should probably do something */
# define G_UNLIKELY(e) (e)
# define g_assert(e) \
do { \
if (!(e)) \
fatal("TinyGLib g_assert(" #e ")\n"); \
} while (0)
# ifdef __GNUC__
# define g_assert_not_reached __builtin_unreachable
# else
# ifdef _MSC_VER
# define g_assert_not_reached() __assume(0)
# else
# define g_assert_not_reached()
# endif
# endif
# define g_critical(s, ...) fatal("TinyGLib g_critical(): " s "\n", ##__VA_ARGS__)
# ifdef TINYGLIB_DEBUG
# define g_debug(s, ...) tinyglib_pclog("g_debug", s, ##__VA_ARGS__)
# else
# define g_debug(s, ...)
# endif
# define g_error(s, ...) tinyglib_pclog("g_error", s, ##__VA_ARGS__)
# define g_error_free(err)
# define g_malloc0(s) calloc(1, s)
# define g_new(t, n) (t *) malloc(sizeof(t) * n)
# define g_new0(t, n) (t *) calloc(n, sizeof(t))
# ifdef TINYGLIB_DEBUG
# define g_parse_debug_string(s, k, n) ((!!sizeof(k)) * -1) /* unimplemented; always enables all debug flags */
# else
# define g_parse_debug_string(s, k, n) (!sizeof(k))
# endif
# define g_rand_int_range(r, min, max) (rand() % (max + 1 - min) + min)
# define g_rand_new() calloc(1, sizeof(GRand))
# define g_return_val_if_fail(e, v) \
if (!(e)) \
return (v)
# define g_shell_parse_argv(a, b, c, d) !!(sizeof(b)) /* unimplemented */
# define g_strdup(str) ((str) ? strdup(str) : NULL)
# define g_warn_if_fail(e) \
do { \
if (!(e)) \
pclog("TinyGLib g_warn_if_fail(" #e ")\n"); \
} while (0)
# define g_warn_if_reached() pclog("TinyGLib g_warn_if_reached()\n")
# define g_warning(s, ...) tinyglib_pclog("g_warning", s, ##__VA_ARGS__)
/* Remapped functions */
#define g_free free
#define g_getenv getenv
#define g_malloc malloc
#define g_rand_free free
#define g_realloc realloc
#define g_snprintf snprintf
#define g_strerror strerror
#define g_strfreev free
#define g_string_append_printf sprintf /* unimplemented */
#define g_vsnprintf vsnprintf
# define g_free free
# define g_getenv getenv
# define g_malloc malloc
# define g_rand_free free
# define g_realloc realloc
# define g_snprintf snprintf
# define g_strerror strerror
# define g_strfreev free
# define g_string_append_printf sprintf /* unimplemented */
# define g_vsnprintf vsnprintf
#endif