More reorganization and finally merged the two makefiles.
This commit is contained in:
@@ -125,8 +125,10 @@ acpi_reg_read_intel(int size, uint16_t addr, void *p)
|
||||
case 0x08: case 0x09: case 0x0a: case 0x0b:
|
||||
/* PMTMR - Power Management Timer Register (IO) */
|
||||
ret = (dev->regs.timer_val >> shift32) & 0xff;
|
||||
#ifdef USE_DYNAREC
|
||||
if (cpu_use_dynarec)
|
||||
update_tsc();
|
||||
#endif
|
||||
break;
|
||||
case 0x0c: case 0x0d:
|
||||
/* GPSTS - General Purpose Status Register (IO) */
|
||||
@@ -213,8 +215,10 @@ acpi_reg_read_via(int size, uint16_t addr, void *p)
|
||||
case 0x08: case 0x09: case 0x0a: case 0x0b:
|
||||
/* PMTMR - Power Management Timer Register (IO) */
|
||||
ret = (dev->regs.timer_val >> shift32) & 0xff;
|
||||
#ifdef USE_DYNAREC
|
||||
if (cpu_use_dynarec)
|
||||
update_tsc();
|
||||
#endif
|
||||
break;
|
||||
case 0x10: case 0x11: case 0x12: case 0x13:
|
||||
/* PCNTRL - Processor Control Register (IO) */
|
||||
|
||||
@@ -1,150 +1,150 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/timer.h>
|
||||
#include <86box/io.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/keyboard.h>
|
||||
#include <86box/mem.h>
|
||||
#include <86box/fdd.h>
|
||||
#include <86box/fdc.h>
|
||||
#include <86box/chipset.h>
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t cur_reg, tries,
|
||||
regs[258];
|
||||
} rabbit_t;
|
||||
|
||||
|
||||
static void
|
||||
rabbit_recalcmapping(rabbit_t *dev)
|
||||
{
|
||||
uint32_t shread, shwrite;
|
||||
uint32_t shflags = 0;
|
||||
|
||||
shread = !!(dev->regs[0x101] & 0x40);
|
||||
shwrite = !!(dev->regs[0x100] & 0x02);
|
||||
|
||||
shflags = shread ? MEM_READ_INTERNAL : MEM_READ_EXTANY;
|
||||
shflags |= shwrite ? MEM_WRITE_INTERNAL : MEM_WRITE_EXTANY;
|
||||
|
||||
shadowbios = !!shread;
|
||||
shadowbios_write = !!shwrite;
|
||||
|
||||
#ifdef USE_SHADOW_C0000
|
||||
mem_set_mem_state(0x000c0000, 0x00040000, MEM_READ_EXTANY | MEM_WRITE_EXTANY);
|
||||
#else
|
||||
mem_set_mem_state(0x000e0000, 0x00020000, MEM_READ_EXTANY | MEM_WRITE_EXTANY);
|
||||
#endif
|
||||
|
||||
switch (dev->regs[0x100] & 0x09) {
|
||||
case 0x01:
|
||||
/* The one BIOS we use seems to use something else to control C0000-DFFFF shadow,
|
||||
no idea what. */
|
||||
#ifdef USE_SHADOW_C0000
|
||||
/* 64K at 0C0000-0CFFFF */
|
||||
mem_set_mem_state(0x000c0000, 0x00010000, shflags);
|
||||
/* FALLTHROUGH */
|
||||
#endif
|
||||
case 0x00:
|
||||
/* 64K at 0F0000-0FFFFF */
|
||||
mem_set_mem_state(0x000f0000, 0x00010000, shflags);
|
||||
break;
|
||||
|
||||
case 0x09:
|
||||
#ifdef USE_SHADOW_C0000
|
||||
/* 128K at 0C0000-0DFFFF */
|
||||
mem_set_mem_state(0x000c0000, 0x00020000, shflags);
|
||||
/* FALLTHROUGH */
|
||||
#endif
|
||||
case 0x08:
|
||||
/* 128K at 0E0000-0FFFFF */
|
||||
mem_set_mem_state(0x000e0000, 0x00020000, shflags);
|
||||
break;
|
||||
}
|
||||
|
||||
flushmmucache();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
rabbit_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
rabbit_t *dev = (rabbit_t *) priv;
|
||||
|
||||
switch (addr) {
|
||||
case 0x22:
|
||||
dev->cur_reg = val;
|
||||
dev->tries = 0;
|
||||
break;
|
||||
case 0x23:
|
||||
if (dev->cur_reg == 0x83) {
|
||||
if (dev->tries < 0x02) {
|
||||
dev->regs[dev->tries++ | 0x100] = val;
|
||||
if (dev->tries == 0x02)
|
||||
rabbit_recalcmapping(dev);
|
||||
}
|
||||
} else
|
||||
dev->regs[dev->cur_reg] = val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
rabbit_read(uint16_t addr, void *priv)
|
||||
{
|
||||
uint8_t ret = 0xff;
|
||||
rabbit_t *dev = (rabbit_t *) priv;
|
||||
|
||||
switch (addr) {
|
||||
case 0x23:
|
||||
if (dev->cur_reg == 0x83) {
|
||||
if (dev->tries < 0x02)
|
||||
ret = dev->regs[dev->tries++ | 0x100];
|
||||
} else
|
||||
ret = dev->regs[dev->cur_reg];
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
rabbit_close(void *priv)
|
||||
{
|
||||
rabbit_t *dev = (rabbit_t *) priv;
|
||||
|
||||
free(dev);
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
rabbit_init(const device_t *info)
|
||||
{
|
||||
rabbit_t *dev = (rabbit_t *) malloc(sizeof(rabbit_t));
|
||||
memset(dev, 0, sizeof(rabbit_t));
|
||||
|
||||
io_sethandler(0x0022, 0x0002, rabbit_read, NULL, NULL, rabbit_write, NULL, NULL, dev);
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
|
||||
const device_t rabbit_device = {
|
||||
"SiS Rabbit",
|
||||
0,
|
||||
0,
|
||||
rabbit_init, rabbit_close, NULL,
|
||||
NULL, NULL, NULL,
|
||||
NULL
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/timer.h>
|
||||
#include <86box/io.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/keyboard.h>
|
||||
#include <86box/mem.h>
|
||||
#include <86box/fdd.h>
|
||||
#include <86box/fdc.h>
|
||||
#include <86box/chipset.h>
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t cur_reg, tries,
|
||||
regs[258];
|
||||
} rabbit_t;
|
||||
|
||||
|
||||
static void
|
||||
rabbit_recalcmapping(rabbit_t *dev)
|
||||
{
|
||||
uint32_t shread, shwrite;
|
||||
uint32_t shflags = 0;
|
||||
|
||||
shread = !!(dev->regs[0x101] & 0x40);
|
||||
shwrite = !!(dev->regs[0x100] & 0x02);
|
||||
|
||||
shflags = shread ? MEM_READ_INTERNAL : MEM_READ_EXTANY;
|
||||
shflags |= shwrite ? MEM_WRITE_INTERNAL : MEM_WRITE_EXTANY;
|
||||
|
||||
shadowbios = !!shread;
|
||||
shadowbios_write = !!shwrite;
|
||||
|
||||
#ifdef USE_SHADOW_C0000
|
||||
mem_set_mem_state(0x000c0000, 0x00040000, MEM_READ_EXTANY | MEM_WRITE_EXTANY);
|
||||
#else
|
||||
mem_set_mem_state(0x000e0000, 0x00020000, MEM_READ_EXTANY | MEM_WRITE_EXTANY);
|
||||
#endif
|
||||
|
||||
switch (dev->regs[0x100] & 0x09) {
|
||||
case 0x01:
|
||||
/* The one BIOS we use seems to use something else to control C0000-DFFFF shadow,
|
||||
no idea what. */
|
||||
#ifdef USE_SHADOW_C0000
|
||||
/* 64K at 0C0000-0CFFFF */
|
||||
mem_set_mem_state(0x000c0000, 0x00010000, shflags);
|
||||
/* FALLTHROUGH */
|
||||
#endif
|
||||
case 0x00:
|
||||
/* 64K at 0F0000-0FFFFF */
|
||||
mem_set_mem_state(0x000f0000, 0x00010000, shflags);
|
||||
break;
|
||||
|
||||
case 0x09:
|
||||
#ifdef USE_SHADOW_C0000
|
||||
/* 128K at 0C0000-0DFFFF */
|
||||
mem_set_mem_state(0x000c0000, 0x00020000, shflags);
|
||||
/* FALLTHROUGH */
|
||||
#endif
|
||||
case 0x08:
|
||||
/* 128K at 0E0000-0FFFFF */
|
||||
mem_set_mem_state(0x000e0000, 0x00020000, shflags);
|
||||
break;
|
||||
}
|
||||
|
||||
flushmmucache();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
rabbit_write(uint16_t addr, uint8_t val, void *priv)
|
||||
{
|
||||
rabbit_t *dev = (rabbit_t *) priv;
|
||||
|
||||
switch (addr) {
|
||||
case 0x22:
|
||||
dev->cur_reg = val;
|
||||
dev->tries = 0;
|
||||
break;
|
||||
case 0x23:
|
||||
if (dev->cur_reg == 0x83) {
|
||||
if (dev->tries < 0x02) {
|
||||
dev->regs[dev->tries++ | 0x100] = val;
|
||||
if (dev->tries == 0x02)
|
||||
rabbit_recalcmapping(dev);
|
||||
}
|
||||
} else
|
||||
dev->regs[dev->cur_reg] = val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
rabbit_read(uint16_t addr, void *priv)
|
||||
{
|
||||
uint8_t ret = 0xff;
|
||||
rabbit_t *dev = (rabbit_t *) priv;
|
||||
|
||||
switch (addr) {
|
||||
case 0x23:
|
||||
if (dev->cur_reg == 0x83) {
|
||||
if (dev->tries < 0x02)
|
||||
ret = dev->regs[dev->tries++ | 0x100];
|
||||
} else
|
||||
ret = dev->regs[dev->cur_reg];
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
rabbit_close(void *priv)
|
||||
{
|
||||
rabbit_t *dev = (rabbit_t *) priv;
|
||||
|
||||
free(dev);
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
rabbit_init(const device_t *info)
|
||||
{
|
||||
rabbit_t *dev = (rabbit_t *) malloc(sizeof(rabbit_t));
|
||||
memset(dev, 0, sizeof(rabbit_t));
|
||||
|
||||
io_sethandler(0x0022, 0x0002, rabbit_read, NULL, NULL, rabbit_write, NULL, NULL, dev);
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
|
||||
const device_t rabbit_device = {
|
||||
"SiS Rabbit",
|
||||
0,
|
||||
0,
|
||||
rabbit_init, rabbit_close, NULL,
|
||||
NULL, NULL, NULL,
|
||||
NULL
|
||||
};
|
||||
@@ -24,10 +24,13 @@
|
||||
#include "386_common.h"
|
||||
#include "x86_flags.h"
|
||||
#include "x86seg.h"
|
||||
|
||||
#ifdef USE_DYNAREC
|
||||
#include "codegen.h"
|
||||
|
||||
|
||||
#define CPU_BLOCK_END() cpu_block_end = 1
|
||||
#else
|
||||
#define CPU_BLOCK_END()
|
||||
#endif
|
||||
|
||||
|
||||
x86seg gdt, ldt, idt, tr;
|
||||
@@ -1564,7 +1567,9 @@ sysenter(uint32_t fetchdat)
|
||||
return 1;
|
||||
do_seg_load(&cpu_state.seg_ss, seg_data);
|
||||
cpu_state.seg_ss.checked = 0;
|
||||
#ifdef USE_DYNAREC
|
||||
codegen_flat_ss = 0;
|
||||
#endif
|
||||
if (cpu_state.seg_ss.base == 0 && cpu_state.seg_ss.limit_low == 0 &&
|
||||
cpu_state.seg_ss.limit_high == 0xffffffff)
|
||||
cpu_cur_status &= ~CPU_STATUS_NOTFLATSS;
|
||||
@@ -1657,7 +1662,9 @@ sysexit(uint32_t fetchdat)
|
||||
return 1;
|
||||
do_seg_load(&cpu_state.seg_ss, seg_data);
|
||||
cpu_state.seg_ss.checked = 0;
|
||||
#ifdef USE_DYNAREC
|
||||
codegen_flat_ss = 0;
|
||||
#endif
|
||||
if (cpu_state.seg_ss.base == 0 && cpu_state.seg_ss.limit_low == 0 &&
|
||||
cpu_state.seg_ss.limit_high == 0xffffffff)
|
||||
cpu_cur_status &= ~CPU_STATUS_NOTFLATSS;
|
||||
@@ -1725,7 +1732,9 @@ syscall(uint32_t fetchdat)
|
||||
return 1;
|
||||
do_seg_load(&cpu_state.seg_ss, seg_data);
|
||||
cpu_state.seg_ss.checked = 0;
|
||||
#ifdef USE_DYNAREC
|
||||
codegen_flat_ss = 0;
|
||||
#endif
|
||||
if (cpu_state.seg_ss.base == 0 && cpu_state.seg_ss.limit_low == 0 &&
|
||||
cpu_state.seg_ss.limit_high == 0xffffffff)
|
||||
cpu_cur_status &= ~CPU_STATUS_NOTFLATSS;
|
||||
@@ -1782,7 +1791,9 @@ sysret(uint32_t fetchdat)
|
||||
return 1;
|
||||
do_seg_load(&cpu_state.seg_ss, seg_data);
|
||||
cpu_state.seg_ss.checked = 0;
|
||||
#ifdef USE_DYNAREC
|
||||
codegen_flat_ss = 0;
|
||||
#endif
|
||||
if (cpu_state.seg_ss.base == 0 && cpu_state.seg_ss.limit_low == 0 &&
|
||||
cpu_state.seg_ss.limit_high == 0xffffffff)
|
||||
cpu_cur_status &= ~CPU_STATUS_NOTFLATSS;
|
||||
@@ -1797,3 +1808,13 @@ sysret(uint32_t fetchdat)
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
#ifndef USE_DYNAREC
|
||||
/* This is for compatibility with new x87 code. */
|
||||
void codegen_set_rounding_mode(int mode)
|
||||
{
|
||||
/* cpu_state.new_npxc = (cpu_state.old_npxc & ~0xc00) | (cpu_state.npxc & 0xc00); */
|
||||
cpu_state.new_npxc = (cpu_state.old_npxc & ~0xc00) | (mode << 10);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -953,7 +953,6 @@ reset_common(int hard)
|
||||
makeznptable();
|
||||
resetreadlookup();
|
||||
makemod1table();
|
||||
resetmcr();
|
||||
pfq_clear();
|
||||
cpu_set_edx();
|
||||
mmu_perm = 4;
|
||||
@@ -984,6 +983,8 @@ reset_common(int hard)
|
||||
ppi_reset();
|
||||
}
|
||||
in_sys = 0;
|
||||
|
||||
shadowbios = shadowbios_write = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1398,7 +1398,9 @@ cpu_set(void)
|
||||
cpu_features = CPU_FEATURE_RDTSC | CPU_FEATURE_MSR | CPU_FEATURE_CR4 | CPU_FEATURE_VME | CPU_FEATURE_MMX | CPU_FEATURE_3DNOW;
|
||||
msr.fcr = (1 << 8) | (1 << 9) | (1 << 12) | (1 << 16) | (1 << 19) | (1 << 21);
|
||||
cpu_CR4_mask = CR4_VME | CR4_PVI | CR4_TSD | CR4_DE | CR4_PSE | CR4_MCE;
|
||||
#ifdef USE_DYNAREC
|
||||
codegen_timing_set(&codegen_timing_k6);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case CPU_PENTIUMPRO:
|
||||
|
||||
@@ -99,7 +99,7 @@ static int opSAHF(uint32_t fetchdat)
|
||||
CLOCK_CYCLES(3);
|
||||
PREFETCH_RUN(3, 1, -1, 0,0,0,0, 0);
|
||||
|
||||
#ifdef USE_NEW_DYNAREC
|
||||
#if (defined(USE_DYNAREC) && defined(USE_NEW_DYNAREC))
|
||||
codegen_flags_changed = 0;
|
||||
#endif
|
||||
|
||||
@@ -182,7 +182,7 @@ static int opPOPF_286(uint32_t fetchdat)
|
||||
CLOCK_CYCLES(5);
|
||||
PREFETCH_RUN(5, 1, -1, 1,0,0,0, 0);
|
||||
|
||||
#ifdef USE_NEW_DYNAREC
|
||||
#if (defined(USE_DYNAREC) && defined(USE_NEW_DYNAREC))
|
||||
codegen_flags_changed = 0;
|
||||
#endif
|
||||
|
||||
@@ -242,7 +242,7 @@ static int opPOPF(uint32_t fetchdat)
|
||||
CLOCK_CYCLES(5);
|
||||
PREFETCH_RUN(5, 1, -1, 1,0,0,0, 0);
|
||||
|
||||
#ifdef USE_NEW_DYNAREC
|
||||
#if (defined(USE_DYNAREC) && defined(USE_NEW_DYNAREC))
|
||||
codegen_flags_changed = 0;
|
||||
#endif
|
||||
|
||||
@@ -276,7 +276,7 @@ static int opPOPFD(uint32_t fetchdat)
|
||||
CLOCK_CYCLES(5);
|
||||
PREFETCH_RUN(5, 1, -1, 0,1,0,0, 0);
|
||||
|
||||
#ifdef USE_NEW_DYNAREC
|
||||
#if (defined(USE_DYNAREC) && defined(USE_NEW_DYNAREC))
|
||||
codegen_flags_changed = 0;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -14,8 +14,10 @@ static int opRDTSC(uint32_t fetchdat)
|
||||
EAX = tsc & 0xffffffff;
|
||||
EDX = tsc >> 32;
|
||||
CLOCK_CYCLES(1);
|
||||
#ifdef USE_DYNAREC
|
||||
if (cpu_use_dynarec)
|
||||
update_tsc();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
6
src/io.c
6
src/io.c
@@ -332,8 +332,10 @@ outb(uint16_t port, uint8_t val)
|
||||
|
||||
if (!found) {
|
||||
sub_cycles(io_delay);
|
||||
#ifdef USE_DYNAREC
|
||||
if (cpu_use_dynarec && (port == 0xeb))
|
||||
update_tsc();
|
||||
#endif
|
||||
}
|
||||
|
||||
io_log("(%i, %i, %04i) outb(%04X, %02X)\n", in_smm, found, qfound, port, val);
|
||||
@@ -425,8 +427,10 @@ outw(uint16_t port, uint16_t val)
|
||||
|
||||
if (!found) {
|
||||
sub_cycles(io_delay);
|
||||
#ifdef USE_DYNAREC
|
||||
if (cpu_use_dynarec && (port == 0xeb))
|
||||
update_tsc();
|
||||
#endif
|
||||
}
|
||||
|
||||
io_log("(%i, %i, %04i) outw(%04X, %04X)\n", in_smm, found, qfound, port, val);
|
||||
@@ -552,8 +556,10 @@ outl(uint16_t port, uint32_t val)
|
||||
|
||||
if (!found) {
|
||||
sub_cycles(io_delay);
|
||||
#ifdef USE_DYNAREC
|
||||
if (cpu_use_dynarec && (port == 0xeb))
|
||||
update_tsc();
|
||||
#endif
|
||||
}
|
||||
|
||||
io_log("(%i, %i, %04i) outl(%04X, %08X)\n", in_smm, found, qfound, port, val);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,458 +1,458 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Implementation of an SST flash chip.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Melissa Goad, <mszoopers@protonmail.com>
|
||||
*
|
||||
* Copyright 2008-2020 Sarah Walker.
|
||||
* Copyright 2016-2020 Miran Grca.
|
||||
* Copyright 2020 Melissa Goad.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include <86box/86box.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/mem.h>
|
||||
#include <86box/machine.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/nvr.h>
|
||||
#include <86box/plat.h>
|
||||
|
||||
|
||||
typedef struct sst_t
|
||||
{
|
||||
uint8_t id, is_39, page_bytes, sdp;
|
||||
|
||||
int command_state, id_mode,
|
||||
dirty;
|
||||
|
||||
uint32_t size, mask,
|
||||
page_mask, page_base;
|
||||
|
||||
uint8_t page_buffer[128];
|
||||
uint8_t *array;
|
||||
|
||||
mem_mapping_t mapping[8], mapping_h[8];
|
||||
|
||||
pc_timer_t page_write_timer;
|
||||
} sst_t;
|
||||
|
||||
|
||||
static wchar_t flash_path[1024];
|
||||
|
||||
|
||||
#define SST_CHIP_ERASE 0x10 /* Both 29 and 39, 6th cycle */
|
||||
#define SST_SDP_DISABLE 0x20 /* Only 29, Software data protect disable and write - treat as write */
|
||||
#define SST_SECTOR_ERASE 0x30 /* Only 39, 6th cycle */
|
||||
#define SST_SET_ID_MODE_ALT 0x60 /* Only 29, 6th cycle */
|
||||
#define SST_ERASE 0x80 /* Both 29 and 39 */
|
||||
/* With data 60h on 6th cycle, it's alt. ID */
|
||||
#define SST_SET_ID_MODE 0x90 /* Both 29 and 39 */
|
||||
#define SST_BYTE_PROGRAM 0xa0 /* Both 29 and 39 */
|
||||
#define SST_CLEAR_ID_MODE 0xf0 /* Both 29 and 39 */
|
||||
/* 1st cycle variant only on 39 */
|
||||
|
||||
#define SST_ID_MANUFACTURER 0xbf /* SST Manufacturer's ID */
|
||||
#define SST_ID_SST29EE010 0x07
|
||||
#define SST_ID_SST29LE_VE010 0x08
|
||||
#define SST_ID_SST29EE020 0x10
|
||||
#define SST_ID_SST29LE_VE020 0x12
|
||||
#define SST_ID_SST39SF512 0xb4
|
||||
#define SST_ID_SST39SF010 0xb5
|
||||
#define SST_ID_SST39SF020 0xb6
|
||||
#define SST_ID_SST39SF040 0xb7
|
||||
|
||||
|
||||
static void
|
||||
sst_sector_erase(sst_t *dev, uint32_t addr)
|
||||
{
|
||||
memset(&dev->array[addr & (dev->mask & ~0xfff)], 0xff, 4096);
|
||||
dev->dirty = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sst_new_command(sst_t *dev, uint32_t addr, uint8_t val)
|
||||
{
|
||||
if (dev->command_state == 5) switch (val) {
|
||||
case SST_CHIP_ERASE:
|
||||
memset(dev->array, 0xff, 0x20000);
|
||||
dev->command_state = 0;
|
||||
break;
|
||||
|
||||
case SST_SDP_DISABLE:
|
||||
if (!dev->is_39)
|
||||
dev->sdp = 0;
|
||||
dev->command_state = 0;
|
||||
break;
|
||||
|
||||
case SST_SECTOR_ERASE:
|
||||
if (dev->is_39)
|
||||
sst_sector_erase(dev, addr);
|
||||
dev->command_state = 0;
|
||||
break;
|
||||
|
||||
case SST_SET_ID_MODE_ALT:
|
||||
dev->id_mode = 1;
|
||||
dev->command_state = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
dev->command_state = 0;
|
||||
break;
|
||||
} else switch (val) {
|
||||
case SST_ERASE:
|
||||
dev->command_state = 3;
|
||||
break;
|
||||
|
||||
case SST_SET_ID_MODE:
|
||||
dev->id_mode = 1;
|
||||
dev->command_state = 0;
|
||||
break;
|
||||
|
||||
case SST_BYTE_PROGRAM:
|
||||
if (!dev->is_39) {
|
||||
memset(dev->page_buffer, 0xff, 128);
|
||||
dev->page_bytes = 0;
|
||||
timer_on_auto(&dev->page_write_timer, 210.0);
|
||||
}
|
||||
dev->command_state = 6;
|
||||
break;
|
||||
|
||||
case SST_CLEAR_ID_MODE:
|
||||
dev->id_mode = 0;
|
||||
dev->command_state = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
dev->command_state = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sst_page_write(void *priv)
|
||||
{
|
||||
sst_t *dev = (sst_t *) priv;
|
||||
|
||||
memcpy(&(dev->array[dev->page_base]), dev->page_buffer, 128);
|
||||
dev->dirty = 1;
|
||||
dev->page_bytes = 0;
|
||||
dev->command_state = 0;
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
sst_read_id(uint32_t addr, void *p)
|
||||
{
|
||||
sst_t *dev = (sst_t *) p;
|
||||
|
||||
if ((addr & 0xffff) == 0)
|
||||
return SST_ID_MANUFACTURER; /* SST */
|
||||
else if ((addr & 0xffff) == 1)
|
||||
return dev->id;
|
||||
else
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sst_buf_write(sst_t *dev, uint32_t addr, uint8_t val)
|
||||
{
|
||||
dev->page_buffer[addr & 0x0000007f] = val;
|
||||
timer_disable(&dev->page_write_timer);
|
||||
dev->page_bytes++;
|
||||
if (dev->page_bytes >= 128)
|
||||
sst_page_write(dev);
|
||||
else
|
||||
timer_set_delay_u64(&dev->page_write_timer, 210 * TIMER_USEC);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sst_write(uint32_t addr, uint8_t val, void *p)
|
||||
{
|
||||
sst_t *dev = (sst_t *) p;
|
||||
|
||||
switch (dev->command_state) {
|
||||
case 0:
|
||||
case 3:
|
||||
/* 1st and 4th Bus Write Cycle */
|
||||
if ((val == 0xf0) && dev->is_39 && (dev->command_state == 0)) {
|
||||
if (dev->id_mode)
|
||||
dev->id_mode = 0;
|
||||
dev->command_state = 0;
|
||||
} else if (((addr & 0x7fff) == 0x5555) && (val == 0xaa))
|
||||
dev->command_state++;
|
||||
else {
|
||||
if (!dev->is_39 && !dev->sdp && (dev->command_state == 0)) {
|
||||
/* 29 series, software data protection off, start loading the page. */
|
||||
dev->page_base = addr & dev->page_mask; /* First byte, A7 onwards of its address are the page mask. */
|
||||
dev->command_state = 7;
|
||||
sst_buf_write(dev, addr, val);
|
||||
}
|
||||
dev->command_state = 0;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
case 4:
|
||||
/* 2nd and 5th Bus Write Cycle */
|
||||
if (((addr & 0x7fff) == 0x2aaa) && (val == 0x55))
|
||||
dev->command_state++;
|
||||
else
|
||||
dev->command_state = 0;
|
||||
break;
|
||||
case 2:
|
||||
case 5:
|
||||
/* 3rd and 6th Bus Write Cycle */
|
||||
if ((addr & 0x7fff) == 0x5555)
|
||||
sst_new_command(dev, addr, val);
|
||||
else
|
||||
dev->command_state = 0;
|
||||
break;
|
||||
case 6:
|
||||
/* Page Load Cycle (29) / Data Write Cycle (39SF) */
|
||||
if (dev->is_39) {
|
||||
dev->array[addr & dev->mask] = val;
|
||||
dev->command_state = 0;
|
||||
dev->dirty = 1;
|
||||
} else {
|
||||
dev->page_base = addr & dev->page_mask; /* First byte, A7 onwards of its address are the page mask. */
|
||||
dev->command_state++;
|
||||
sst_buf_write(dev, addr, val);
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
if (!dev->is_39 && ((addr & dev->page_mask) == dev->page_base))
|
||||
sst_buf_write(dev, addr, val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
sst_read(uint32_t addr, void *p)
|
||||
{
|
||||
sst_t *dev = (sst_t *) p;
|
||||
uint8_t ret = 0xff;
|
||||
|
||||
addr &= 0x000fffff;
|
||||
|
||||
if (dev->id_mode)
|
||||
ret = sst_read_id(addr, p);
|
||||
else {
|
||||
if ((addr >= biosaddr) && (addr <= (biosaddr + biosmask)))
|
||||
ret = dev->array[addr - biosaddr];
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static uint16_t
|
||||
sst_readw(uint32_t addr, void *p)
|
||||
{
|
||||
sst_t *dev = (sst_t *) p;
|
||||
uint16_t ret = 0xffff;
|
||||
|
||||
addr &= 0x000fffff;
|
||||
|
||||
if (dev->id_mode)
|
||||
ret = sst_read(addr, p) | (sst_read(addr + 1, p) << 8);
|
||||
else {
|
||||
if ((addr >= biosaddr) && (addr <= (biosaddr + biosmask)))
|
||||
ret = *(uint16_t *)&dev->array[addr - biosaddr];
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static uint32_t
|
||||
sst_readl(uint32_t addr, void *p)
|
||||
{
|
||||
sst_t *dev = (sst_t *) p;
|
||||
uint32_t ret = 0xffffffff;
|
||||
|
||||
addr &= 0x000fffff;
|
||||
|
||||
if (dev->id_mode)
|
||||
ret = sst_readw(addr, p) | (sst_readw(addr + 2, p) << 16);
|
||||
else {
|
||||
if ((addr >= biosaddr) && (addr <= (biosaddr + biosmask)))
|
||||
ret = *(uint32_t *)&dev->array[addr - biosaddr];
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sst_add_mappings(sst_t *dev)
|
||||
{
|
||||
int i = 0, count;
|
||||
uint32_t base, fbase;
|
||||
uint32_t root_base;
|
||||
|
||||
count = dev->size >> 16;
|
||||
root_base = 0x100000 - dev->size;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
base = root_base + (i << 16);
|
||||
fbase = base & biosmask;
|
||||
|
||||
memcpy(&dev->array[fbase], &rom[base & biosmask], 0x10000);
|
||||
|
||||
if (base >= 0xe0000) {
|
||||
mem_mapping_add(&(dev->mapping[i]), base, 0x10000,
|
||||
sst_read, sst_readw, sst_readl,
|
||||
sst_write, NULL, NULL,
|
||||
dev->array + fbase, MEM_MAPPING_EXTERNAL|MEM_MAPPING_ROMCS, (void *) dev);
|
||||
}
|
||||
mem_mapping_add(&(dev->mapping_h[i]), (base | 0xfff00000), 0x10000,
|
||||
sst_read, sst_readw, sst_readl,
|
||||
sst_write, NULL, NULL,
|
||||
dev->array + fbase, MEM_MAPPING_EXTERNAL|MEM_MAPPING_ROMCS, (void *) dev);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
sst_init(const device_t *info)
|
||||
{
|
||||
FILE *f;
|
||||
sst_t *dev = malloc(sizeof(sst_t));
|
||||
memset(dev, 0, sizeof(sst_t));
|
||||
|
||||
size_t l = strlen(machine_get_internal_name_ex(machine))+1;
|
||||
wchar_t *machine_name = (wchar_t *) malloc(l * sizeof(wchar_t));
|
||||
mbstowcs(machine_name, machine_get_internal_name_ex(machine), l);
|
||||
l = wcslen(machine_name)+5;
|
||||
wchar_t *flash_name = (wchar_t *)malloc(l*sizeof(wchar_t));
|
||||
swprintf(flash_name, l, L"%ls.bin", machine_name);
|
||||
|
||||
if (wcslen(flash_name) <= 1024)
|
||||
wcscpy(flash_path, flash_name);
|
||||
else
|
||||
wcsncpy(flash_path, flash_name, 1024);
|
||||
|
||||
mem_mapping_disable(&bios_mapping);
|
||||
mem_mapping_disable(&bios_high_mapping);
|
||||
|
||||
dev->array = (uint8_t *) malloc(biosmask + 1);
|
||||
memset(dev->array, 0xff, biosmask + 1);
|
||||
|
||||
dev->id = info->local;
|
||||
dev->is_39 = (dev->id >= SST_ID_SST39SF512);
|
||||
|
||||
if (dev->id == SST_ID_SST39SF512)
|
||||
dev->size = 0x10000;
|
||||
else if ((dev->id == SST_ID_SST29EE020) || (dev->id == SST_ID_SST29LE_VE020) || (dev->id == SST_ID_SST39SF020))
|
||||
dev->size = 0x40000;
|
||||
else if (dev->id == SST_ID_SST39SF040)
|
||||
dev->size = 0x80000;
|
||||
else
|
||||
dev->size = 0x20000;
|
||||
dev->mask = dev->size - 1;
|
||||
dev->page_mask = dev->mask & 0xffffff80; /* Filter out A0-A6. */
|
||||
dev->sdp = 1;
|
||||
|
||||
sst_add_mappings(dev);
|
||||
|
||||
f = nvr_fopen(flash_path, L"rb");
|
||||
if (f) {
|
||||
if (fread(&(dev->array[0x00000]), 1, dev->size, f) != dev->size)
|
||||
fatal("Less than %i bytes read from the SST Flash ROM file\n", dev->size);
|
||||
fclose(f);
|
||||
} else
|
||||
dev->dirty = 1; /* It is by definition dirty on creation. */
|
||||
|
||||
free(flash_name);
|
||||
free(machine_name);
|
||||
|
||||
if (!dev->is_39)
|
||||
timer_add(&dev->page_write_timer, sst_page_write, dev, 0);
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sst_close(void *p)
|
||||
{
|
||||
FILE *f;
|
||||
sst_t *dev = (sst_t *)p;
|
||||
|
||||
if (dev->dirty) {
|
||||
f = nvr_fopen(flash_path, L"wb");
|
||||
fwrite(&(dev->array[0x00000]), dev->size, 1, f);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
free(dev->array);
|
||||
dev->array = NULL;
|
||||
|
||||
free(dev);
|
||||
}
|
||||
|
||||
|
||||
const device_t sst_flash_29ee010_device =
|
||||
{
|
||||
"SST 29EE010 Flash BIOS",
|
||||
0,
|
||||
SST_ID_SST29EE010,
|
||||
sst_init,
|
||||
sst_close,
|
||||
NULL,
|
||||
NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
|
||||
const device_t sst_flash_29ee020_device =
|
||||
{
|
||||
"SST 29EE020 Flash BIOS",
|
||||
0,
|
||||
SST_ID_SST29EE020,
|
||||
sst_init,
|
||||
sst_close,
|
||||
NULL,
|
||||
NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
|
||||
const device_t sst_flash_39sf010_device =
|
||||
{
|
||||
"SST 39SF010 Flash BIOS",
|
||||
0,
|
||||
SST_ID_SST39SF010,
|
||||
sst_init,
|
||||
sst_close,
|
||||
NULL,
|
||||
NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
|
||||
const device_t sst_flash_39sf020_device =
|
||||
{
|
||||
"SST 39SF020 Flash BIOS",
|
||||
0,
|
||||
SST_ID_SST39SF020,
|
||||
sst_init,
|
||||
sst_close,
|
||||
NULL,
|
||||
NULL, NULL, NULL, NULL
|
||||
};
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Implementation of an SST flash chip.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||
* Miran Grca, <mgrca8@gmail.com>
|
||||
* Melissa Goad, <mszoopers@protonmail.com>
|
||||
*
|
||||
* Copyright 2008-2020 Sarah Walker.
|
||||
* Copyright 2016-2020 Miran Grca.
|
||||
* Copyright 2020 Melissa Goad.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include <86box/86box.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/mem.h>
|
||||
#include <86box/machine.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/nvr.h>
|
||||
#include <86box/plat.h>
|
||||
|
||||
|
||||
typedef struct sst_t
|
||||
{
|
||||
uint8_t id, is_39, page_bytes, sdp;
|
||||
|
||||
int command_state, id_mode,
|
||||
dirty;
|
||||
|
||||
uint32_t size, mask,
|
||||
page_mask, page_base;
|
||||
|
||||
uint8_t page_buffer[128];
|
||||
uint8_t *array;
|
||||
|
||||
mem_mapping_t mapping[8], mapping_h[8];
|
||||
|
||||
pc_timer_t page_write_timer;
|
||||
} sst_t;
|
||||
|
||||
|
||||
static wchar_t flash_path[1024];
|
||||
|
||||
|
||||
#define SST_CHIP_ERASE 0x10 /* Both 29 and 39, 6th cycle */
|
||||
#define SST_SDP_DISABLE 0x20 /* Only 29, Software data protect disable and write - treat as write */
|
||||
#define SST_SECTOR_ERASE 0x30 /* Only 39, 6th cycle */
|
||||
#define SST_SET_ID_MODE_ALT 0x60 /* Only 29, 6th cycle */
|
||||
#define SST_ERASE 0x80 /* Both 29 and 39 */
|
||||
/* With data 60h on 6th cycle, it's alt. ID */
|
||||
#define SST_SET_ID_MODE 0x90 /* Both 29 and 39 */
|
||||
#define SST_BYTE_PROGRAM 0xa0 /* Both 29 and 39 */
|
||||
#define SST_CLEAR_ID_MODE 0xf0 /* Both 29 and 39 */
|
||||
/* 1st cycle variant only on 39 */
|
||||
|
||||
#define SST_ID_MANUFACTURER 0xbf /* SST Manufacturer's ID */
|
||||
#define SST_ID_SST29EE010 0x07
|
||||
#define SST_ID_SST29LE_VE010 0x08
|
||||
#define SST_ID_SST29EE020 0x10
|
||||
#define SST_ID_SST29LE_VE020 0x12
|
||||
#define SST_ID_SST39SF512 0xb4
|
||||
#define SST_ID_SST39SF010 0xb5
|
||||
#define SST_ID_SST39SF020 0xb6
|
||||
#define SST_ID_SST39SF040 0xb7
|
||||
|
||||
|
||||
static void
|
||||
sst_sector_erase(sst_t *dev, uint32_t addr)
|
||||
{
|
||||
memset(&dev->array[addr & (dev->mask & ~0xfff)], 0xff, 4096);
|
||||
dev->dirty = 1;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sst_new_command(sst_t *dev, uint32_t addr, uint8_t val)
|
||||
{
|
||||
if (dev->command_state == 5) switch (val) {
|
||||
case SST_CHIP_ERASE:
|
||||
memset(dev->array, 0xff, 0x20000);
|
||||
dev->command_state = 0;
|
||||
break;
|
||||
|
||||
case SST_SDP_DISABLE:
|
||||
if (!dev->is_39)
|
||||
dev->sdp = 0;
|
||||
dev->command_state = 0;
|
||||
break;
|
||||
|
||||
case SST_SECTOR_ERASE:
|
||||
if (dev->is_39)
|
||||
sst_sector_erase(dev, addr);
|
||||
dev->command_state = 0;
|
||||
break;
|
||||
|
||||
case SST_SET_ID_MODE_ALT:
|
||||
dev->id_mode = 1;
|
||||
dev->command_state = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
dev->command_state = 0;
|
||||
break;
|
||||
} else switch (val) {
|
||||
case SST_ERASE:
|
||||
dev->command_state = 3;
|
||||
break;
|
||||
|
||||
case SST_SET_ID_MODE:
|
||||
dev->id_mode = 1;
|
||||
dev->command_state = 0;
|
||||
break;
|
||||
|
||||
case SST_BYTE_PROGRAM:
|
||||
if (!dev->is_39) {
|
||||
memset(dev->page_buffer, 0xff, 128);
|
||||
dev->page_bytes = 0;
|
||||
timer_on_auto(&dev->page_write_timer, 210.0);
|
||||
}
|
||||
dev->command_state = 6;
|
||||
break;
|
||||
|
||||
case SST_CLEAR_ID_MODE:
|
||||
dev->id_mode = 0;
|
||||
dev->command_state = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
dev->command_state = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sst_page_write(void *priv)
|
||||
{
|
||||
sst_t *dev = (sst_t *) priv;
|
||||
|
||||
memcpy(&(dev->array[dev->page_base]), dev->page_buffer, 128);
|
||||
dev->dirty = 1;
|
||||
dev->page_bytes = 0;
|
||||
dev->command_state = 0;
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
sst_read_id(uint32_t addr, void *p)
|
||||
{
|
||||
sst_t *dev = (sst_t *) p;
|
||||
|
||||
if ((addr & 0xffff) == 0)
|
||||
return SST_ID_MANUFACTURER; /* SST */
|
||||
else if ((addr & 0xffff) == 1)
|
||||
return dev->id;
|
||||
else
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sst_buf_write(sst_t *dev, uint32_t addr, uint8_t val)
|
||||
{
|
||||
dev->page_buffer[addr & 0x0000007f] = val;
|
||||
timer_disable(&dev->page_write_timer);
|
||||
dev->page_bytes++;
|
||||
if (dev->page_bytes >= 128)
|
||||
sst_page_write(dev);
|
||||
else
|
||||
timer_set_delay_u64(&dev->page_write_timer, 210 * TIMER_USEC);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sst_write(uint32_t addr, uint8_t val, void *p)
|
||||
{
|
||||
sst_t *dev = (sst_t *) p;
|
||||
|
||||
switch (dev->command_state) {
|
||||
case 0:
|
||||
case 3:
|
||||
/* 1st and 4th Bus Write Cycle */
|
||||
if ((val == 0xf0) && dev->is_39 && (dev->command_state == 0)) {
|
||||
if (dev->id_mode)
|
||||
dev->id_mode = 0;
|
||||
dev->command_state = 0;
|
||||
} else if (((addr & 0x7fff) == 0x5555) && (val == 0xaa))
|
||||
dev->command_state++;
|
||||
else {
|
||||
if (!dev->is_39 && !dev->sdp && (dev->command_state == 0)) {
|
||||
/* 29 series, software data protection off, start loading the page. */
|
||||
dev->page_base = addr & dev->page_mask; /* First byte, A7 onwards of its address are the page mask. */
|
||||
dev->command_state = 7;
|
||||
sst_buf_write(dev, addr, val);
|
||||
}
|
||||
dev->command_state = 0;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
case 4:
|
||||
/* 2nd and 5th Bus Write Cycle */
|
||||
if (((addr & 0x7fff) == 0x2aaa) && (val == 0x55))
|
||||
dev->command_state++;
|
||||
else
|
||||
dev->command_state = 0;
|
||||
break;
|
||||
case 2:
|
||||
case 5:
|
||||
/* 3rd and 6th Bus Write Cycle */
|
||||
if ((addr & 0x7fff) == 0x5555)
|
||||
sst_new_command(dev, addr, val);
|
||||
else
|
||||
dev->command_state = 0;
|
||||
break;
|
||||
case 6:
|
||||
/* Page Load Cycle (29) / Data Write Cycle (39SF) */
|
||||
if (dev->is_39) {
|
||||
dev->array[addr & dev->mask] = val;
|
||||
dev->command_state = 0;
|
||||
dev->dirty = 1;
|
||||
} else {
|
||||
dev->page_base = addr & dev->page_mask; /* First byte, A7 onwards of its address are the page mask. */
|
||||
dev->command_state++;
|
||||
sst_buf_write(dev, addr, val);
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
if (!dev->is_39 && ((addr & dev->page_mask) == dev->page_base))
|
||||
sst_buf_write(dev, addr, val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static uint8_t
|
||||
sst_read(uint32_t addr, void *p)
|
||||
{
|
||||
sst_t *dev = (sst_t *) p;
|
||||
uint8_t ret = 0xff;
|
||||
|
||||
addr &= 0x000fffff;
|
||||
|
||||
if (dev->id_mode)
|
||||
ret = sst_read_id(addr, p);
|
||||
else {
|
||||
if ((addr >= biosaddr) && (addr <= (biosaddr + biosmask)))
|
||||
ret = dev->array[addr - biosaddr];
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static uint16_t
|
||||
sst_readw(uint32_t addr, void *p)
|
||||
{
|
||||
sst_t *dev = (sst_t *) p;
|
||||
uint16_t ret = 0xffff;
|
||||
|
||||
addr &= 0x000fffff;
|
||||
|
||||
if (dev->id_mode)
|
||||
ret = sst_read(addr, p) | (sst_read(addr + 1, p) << 8);
|
||||
else {
|
||||
if ((addr >= biosaddr) && (addr <= (biosaddr + biosmask)))
|
||||
ret = *(uint16_t *)&dev->array[addr - biosaddr];
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static uint32_t
|
||||
sst_readl(uint32_t addr, void *p)
|
||||
{
|
||||
sst_t *dev = (sst_t *) p;
|
||||
uint32_t ret = 0xffffffff;
|
||||
|
||||
addr &= 0x000fffff;
|
||||
|
||||
if (dev->id_mode)
|
||||
ret = sst_readw(addr, p) | (sst_readw(addr + 2, p) << 16);
|
||||
else {
|
||||
if ((addr >= biosaddr) && (addr <= (biosaddr + biosmask)))
|
||||
ret = *(uint32_t *)&dev->array[addr - biosaddr];
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sst_add_mappings(sst_t *dev)
|
||||
{
|
||||
int i = 0, count;
|
||||
uint32_t base, fbase;
|
||||
uint32_t root_base;
|
||||
|
||||
count = dev->size >> 16;
|
||||
root_base = 0x100000 - dev->size;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
base = root_base + (i << 16);
|
||||
fbase = base & biosmask;
|
||||
|
||||
memcpy(&dev->array[fbase], &rom[base & biosmask], 0x10000);
|
||||
|
||||
if (base >= 0xe0000) {
|
||||
mem_mapping_add(&(dev->mapping[i]), base, 0x10000,
|
||||
sst_read, sst_readw, sst_readl,
|
||||
sst_write, NULL, NULL,
|
||||
dev->array + fbase, MEM_MAPPING_EXTERNAL|MEM_MAPPING_ROMCS, (void *) dev);
|
||||
}
|
||||
mem_mapping_add(&(dev->mapping_h[i]), (base | 0xfff00000), 0x10000,
|
||||
sst_read, sst_readw, sst_readl,
|
||||
sst_write, NULL, NULL,
|
||||
dev->array + fbase, MEM_MAPPING_EXTERNAL|MEM_MAPPING_ROMCS, (void *) dev);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
sst_init(const device_t *info)
|
||||
{
|
||||
FILE *f;
|
||||
sst_t *dev = malloc(sizeof(sst_t));
|
||||
memset(dev, 0, sizeof(sst_t));
|
||||
|
||||
size_t l = strlen(machine_get_internal_name_ex(machine))+1;
|
||||
wchar_t *machine_name = (wchar_t *) malloc(l * sizeof(wchar_t));
|
||||
mbstowcs(machine_name, machine_get_internal_name_ex(machine), l);
|
||||
l = wcslen(machine_name)+5;
|
||||
wchar_t *flash_name = (wchar_t *)malloc(l*sizeof(wchar_t));
|
||||
swprintf(flash_name, l, L"%ls.bin", machine_name);
|
||||
|
||||
if (wcslen(flash_name) <= 1024)
|
||||
wcscpy(flash_path, flash_name);
|
||||
else
|
||||
wcsncpy(flash_path, flash_name, 1024);
|
||||
|
||||
mem_mapping_disable(&bios_mapping);
|
||||
mem_mapping_disable(&bios_high_mapping);
|
||||
|
||||
dev->array = (uint8_t *) malloc(biosmask + 1);
|
||||
memset(dev->array, 0xff, biosmask + 1);
|
||||
|
||||
dev->id = info->local;
|
||||
dev->is_39 = (dev->id >= SST_ID_SST39SF512);
|
||||
|
||||
if (dev->id == SST_ID_SST39SF512)
|
||||
dev->size = 0x10000;
|
||||
else if ((dev->id == SST_ID_SST29EE020) || (dev->id == SST_ID_SST29LE_VE020) || (dev->id == SST_ID_SST39SF020))
|
||||
dev->size = 0x40000;
|
||||
else if (dev->id == SST_ID_SST39SF040)
|
||||
dev->size = 0x80000;
|
||||
else
|
||||
dev->size = 0x20000;
|
||||
dev->mask = dev->size - 1;
|
||||
dev->page_mask = dev->mask & 0xffffff80; /* Filter out A0-A6. */
|
||||
dev->sdp = 1;
|
||||
|
||||
sst_add_mappings(dev);
|
||||
|
||||
f = nvr_fopen(flash_path, L"rb");
|
||||
if (f) {
|
||||
if (fread(&(dev->array[0x00000]), 1, dev->size, f) != dev->size)
|
||||
fatal("Less than %i bytes read from the SST Flash ROM file\n", dev->size);
|
||||
fclose(f);
|
||||
} else
|
||||
dev->dirty = 1; /* It is by definition dirty on creation. */
|
||||
|
||||
free(flash_name);
|
||||
free(machine_name);
|
||||
|
||||
if (!dev->is_39)
|
||||
timer_add(&dev->page_write_timer, sst_page_write, dev, 0);
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
sst_close(void *p)
|
||||
{
|
||||
FILE *f;
|
||||
sst_t *dev = (sst_t *)p;
|
||||
|
||||
if (dev->dirty) {
|
||||
f = nvr_fopen(flash_path, L"wb");
|
||||
fwrite(&(dev->array[0x00000]), dev->size, 1, f);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
free(dev->array);
|
||||
dev->array = NULL;
|
||||
|
||||
free(dev);
|
||||
}
|
||||
|
||||
|
||||
const device_t sst_flash_29ee010_device =
|
||||
{
|
||||
"SST 29EE010 Flash BIOS",
|
||||
0,
|
||||
SST_ID_SST29EE010,
|
||||
sst_init,
|
||||
sst_close,
|
||||
NULL,
|
||||
NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
|
||||
const device_t sst_flash_29ee020_device =
|
||||
{
|
||||
"SST 29EE020 Flash BIOS",
|
||||
0,
|
||||
SST_ID_SST29EE020,
|
||||
sst_init,
|
||||
sst_close,
|
||||
NULL,
|
||||
NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
|
||||
const device_t sst_flash_39sf010_device =
|
||||
{
|
||||
"SST 39SF010 Flash BIOS",
|
||||
0,
|
||||
SST_ID_SST39SF010,
|
||||
sst_init,
|
||||
sst_close,
|
||||
NULL,
|
||||
NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
|
||||
const device_t sst_flash_39sf020_device =
|
||||
{
|
||||
"SST 39SF020 Flash BIOS",
|
||||
0,
|
||||
SST_ID_SST39SF020,
|
||||
sst_init,
|
||||
sst_close,
|
||||
NULL,
|
||||
NULL, NULL, NULL, NULL
|
||||
};
|
||||
2
src/pc.c
2
src/pc.c
@@ -838,7 +838,7 @@ pc_close(thread_t *ptr)
|
||||
plat_delay_ms(200);
|
||||
}
|
||||
|
||||
#ifdef USE_NEW_DYNAREC
|
||||
#if (defined(USE_DYNAREC) && defined(USE_NEW_DYNAREC))
|
||||
codegen_close();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2663,7 +2663,6 @@ static inline void voodoo_tmu_fetch_and_blend(voodoo_t *voodoo, voodoo_params_t
|
||||
#include <86box/vid_voodoo_codegen_x86-64.h>
|
||||
#else
|
||||
#define NO_CODEGEN
|
||||
static int voodoo_recomp = 0;
|
||||
#endif
|
||||
|
||||
static void voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *state, int ystart, int yend, int odd_even)
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
#
|
||||
# Makefile for Win32 (MinGW32) environment.
|
||||
#
|
||||
# Version: @(#)Makefile.mingw 1.0.144 2020/06/06
|
||||
#
|
||||
# Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
# Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
#
|
||||
@@ -35,6 +33,9 @@ ifeq ($(DEV_BUILD), y)
|
||||
ifndef DEV_BRANCH
|
||||
DEV_BRANCH := y
|
||||
endif
|
||||
ifndef 596B
|
||||
596B := y
|
||||
endif
|
||||
ifndef AMD_K5
|
||||
AMD_K5 := y
|
||||
endif
|
||||
@@ -63,14 +64,11 @@ ifeq ($(DEV_BUILD), y)
|
||||
VECTRA54 := y
|
||||
endif
|
||||
ifndef VPP60
|
||||
VP660 := y
|
||||
VPP60 := y
|
||||
endif
|
||||
ifndef SIEMENS
|
||||
SIEMENS := y
|
||||
endif
|
||||
ifndef 596B
|
||||
596B := y
|
||||
endif
|
||||
ifndef VGAWONDER
|
||||
VGAWONDER := y
|
||||
endif
|
||||
@@ -96,6 +94,9 @@ else
|
||||
ifndef DEV_BRANCH
|
||||
DEV_BRANCH := n
|
||||
endif
|
||||
ifndef 596B
|
||||
596B := n
|
||||
endif
|
||||
ifndef AMD_K5
|
||||
AMD_K5 := n
|
||||
endif
|
||||
@@ -124,10 +125,10 @@ else
|
||||
VECTRA54 := n
|
||||
endif
|
||||
ifndef VPP60
|
||||
VP660 := n
|
||||
VPP60 := n
|
||||
endif
|
||||
ifndef 596B
|
||||
596B := n
|
||||
ifndef SIEMENS
|
||||
SIEMENS := n
|
||||
endif
|
||||
ifndef VGAWONDER
|
||||
VGAWONDER := n
|
||||
@@ -183,13 +184,22 @@ endif
|
||||
ifndef MUNT
|
||||
MUNT := y
|
||||
endif
|
||||
ifndef NEW_DYNAREC
|
||||
NEW_DYNAREC := n
|
||||
endif
|
||||
ifndef DYNAREC
|
||||
DYNAREC := y
|
||||
endif
|
||||
ifeq ($(DYNAREC), y)
|
||||
ifeq ($(ARM), y)
|
||||
DYNAREC := n
|
||||
ifeq ($(NEW_DYNAREC), n)
|
||||
DYNAREC := n
|
||||
endif
|
||||
endif
|
||||
ifeq ($(ARM64), y)
|
||||
DYNAREC := n
|
||||
ifeq ($(NEW_DYNAREC), n)
|
||||
DYNAREC := n
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
ifndef DISCORD
|
||||
@@ -197,6 +207,14 @@ ifndef DISCORD
|
||||
endif
|
||||
|
||||
|
||||
# Path to the dynamic recompiler code.
|
||||
ifeq ($(NEW_DYNAREC), y)
|
||||
CODEGEN := codegen_new
|
||||
else
|
||||
CODEGEN := codegen
|
||||
endif
|
||||
|
||||
|
||||
# Name of the executable.
|
||||
ifndef PROG
|
||||
ifneq ($(WX), n)
|
||||
@@ -242,9 +260,9 @@ endif
|
||||
#########################################################################
|
||||
# Nothing should need changing from here on.. #
|
||||
#########################################################################
|
||||
VPATH := $(EXPATH) . codegen cpu \
|
||||
cdrom chipset disk floppy game machine \
|
||||
printer \
|
||||
VPATH := $(EXPATH) . $(CODEGEN) cpu \
|
||||
cdrom chipset device disk floppy \
|
||||
game machine mem printer \
|
||||
sio sound \
|
||||
sound/munt sound/munt/c_interface sound/munt/sha1 \
|
||||
sound/munt/srchelper sound/munt/srchelper/srctools/src \
|
||||
@@ -256,7 +274,7 @@ else
|
||||
TOOL_PREFIX := i686-w64-mingw32-
|
||||
endif
|
||||
CPP := ${TOOL_PREFIX}g++
|
||||
CC := gcc
|
||||
CC := ${TOOL_PREFIX}gcc
|
||||
WINDRES := windres
|
||||
STRIP := strip
|
||||
ifeq ($(ARM64), y)
|
||||
@@ -277,7 +295,7 @@ DEPFILE := win/.depends
|
||||
# Set up the correct toolchain flags.
|
||||
OPTS := $(EXTRAS) $(STUFF)
|
||||
OPTS += -Iinclude \
|
||||
-iquote codegen -iquote cpu
|
||||
-iquote $(CODEGEN) -iquote cpu
|
||||
ifdef EXFLAGS
|
||||
OPTS += $(EXFLAGS)
|
||||
endif
|
||||
@@ -316,7 +334,7 @@ else
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
AFLAGS := -msse2 -mfpmath=387
|
||||
AFLAGS := -msse2 -mfpmath=sse
|
||||
ifeq ($(ARM), y)
|
||||
DFLAGS := -march=armv7-a
|
||||
AOPTIM :=
|
||||
@@ -340,22 +358,54 @@ endif
|
||||
|
||||
# Optional modules.
|
||||
ifeq ($(DYNAREC), y)
|
||||
ifeq ($(X64), y)
|
||||
PLATCG := codegen_x86-64.o codegen_accumulate_x86-64.o
|
||||
else
|
||||
PLATCG := codegen_x86.o codegen_accumulate_x86.o
|
||||
endif
|
||||
|
||||
OPTS += -DUSE_DYNAREC
|
||||
RFLAGS += -DUSE_DYNAREC
|
||||
DYNARECOBJ := 386_dynarec_ops.o \
|
||||
codegen.o \
|
||||
codegen_ops.o codegen_timing_486.o \
|
||||
|
||||
ifeq ($(NEW_DYNAREC), y)
|
||||
OPTS += -DUSE_NEW_DYNAREC
|
||||
RFLAGS += -DUSE_NEW_DYNAREC
|
||||
|
||||
ifeq ($(X64), y)
|
||||
PLATCG := codegen_backend_x86-64.o codegen_backend_x86-64_ops.o codegen_backend_x86-64_ops_sse.o \
|
||||
codegen_backend_x86-64_uops.o
|
||||
else ifeq ($(ARM64), y)
|
||||
PLATCG := codegen_backend_arm64.o codegen_backend_arm64_ops.o codegen_backend_arm64_uops.o \
|
||||
codegen_backend_arm64_imm.o
|
||||
else ifeq ($(ARM), y)
|
||||
PLATCG := codegen_backend_arm.o codegen_backend_arm_ops.o codegen_backend_arm_uops.o
|
||||
else
|
||||
PLATCG := codegen_backend_x86.o codegen_backend_x86_ops.o codegen_backend_x86_ops_fpu.o \
|
||||
codegen_backend_x86_ops_sse.o codegen_backend_x86_uops.o
|
||||
endif
|
||||
|
||||
DYNARECOBJ := codegen.o codegen_accumulate.o codegen_allocator.o codegen_block.o codegen_ir.o codegen_ops.o \
|
||||
codegen_ops_3dnow.o codegen_ops_branch.o codegen_ops_arith.o codegen_ops_fpu_arith.o \
|
||||
codegen_ops_fpu_constant.o codegen_ops_fpu_loadstore.o codegen_ops_fpu_misc.o codegen_ops_helpers.o \
|
||||
codegen_ops_jump.o codegen_ops_logic.o codegen_ops_misc.o codegen_ops_mmx_arith.o codegen_ops_mmx_cmp.o \
|
||||
codegen_ops_mmx_loadstore.o codegen_ops_mmx_logic.o codegen_ops_mmx_pack.o codegen_ops_mmx_shift.o \
|
||||
codegen_ops_mov.o codegen_ops_shift.o codegen_ops_stack.o codegen_reg.o $(PLATCG)
|
||||
else
|
||||
ifeq ($(X64), y)
|
||||
PLATCG := codegen_x86-64.o codegen_accumulate_x86-64.o
|
||||
else
|
||||
PLATCG := codegen_x86.o codegen_accumulate_x86.o
|
||||
endif
|
||||
|
||||
DYNARECOBJ := codegen.o \
|
||||
codegen_ops.o $(PLATCG)
|
||||
endif
|
||||
|
||||
CGTOBJ := codegen_timing_486.o \
|
||||
codegen_timing_686.o codegen_timing_common.o codegen_timing_k6.o codegen_timing_pentium.o \
|
||||
codegen_timing_p6.o codegen_timing_winchip.o codegen_timing_winchip2.o $(PLATCG)
|
||||
codegen_timing_p6.o codegen_timing_winchip.o codegen_timing_winchip2.o
|
||||
else
|
||||
ifeq ($(NEW_DYNAREC), y)
|
||||
OPTS += -DUSE_NEW_DYNAREC
|
||||
RFLAGS += -DUSE_NEW_DYNAREC
|
||||
endif
|
||||
endif
|
||||
|
||||
ifneq ($(WX), n)
|
||||
ifeq ($(WX), y)
|
||||
OPTS += -DUSE_WX $(WX_FLAGS)
|
||||
LIBS += $(WX_LIBS)
|
||||
UIOBJ := wx_main.o wx_ui.o wx_stbar.o wx_render.o
|
||||
@@ -483,24 +533,13 @@ endif
|
||||
endif
|
||||
|
||||
|
||||
# Options for works-in-progress.
|
||||
ifndef SERIAL
|
||||
SERIAL := serial.o
|
||||
endif
|
||||
|
||||
|
||||
# Final versions of the toolchain flags.
|
||||
CFLAGS := $(WX_FLAGS) $(OPTS) $(DFLAGS) $(COPTIM) $(AOPTIM) \
|
||||
$(AFLAGS) -pipe -fomit-frame-pointer -mstackrealign -Wall \
|
||||
$(AFLAGS) -fomit-frame-pointer -mstackrealign -Wall \
|
||||
-fno-strict-aliasing
|
||||
# -funroll-loops
|
||||
|
||||
# Add freetyp2 references through pkgconfig
|
||||
ifeq ($(DEBUG), y)
|
||||
CFLAGS := $(CFLAGS) -fstack-protector-all `pkg-config --cflags freetype2`
|
||||
else
|
||||
CFLAGS := $(CFLAGS) `pkg-config --cflags freetype2`
|
||||
endif
|
||||
|
||||
CXXFLAGS := $(CFLAGS)
|
||||
|
||||
@@ -509,24 +548,22 @@ CXXFLAGS := $(CFLAGS)
|
||||
# Create the (final) list of objects to build. #
|
||||
#########################################################################
|
||||
MAINOBJ := pc.o config.o random.o timer.o io.o acpi.o apm.o dma.o ddma.o \
|
||||
nmi.o pic.o pit.o port_92.o ppi.o pci.o mca.o mcr.o mem.o rom.o \
|
||||
usb.o device.o nvr.o nvr_at.o nvr_ps2.o sst_flash.o via_vt82c586b.o \
|
||||
via_vt82c596b.o $(VNCOBJ)
|
||||
nmi.o pic.o pit.o port_92.o ppi.o pci.o mca.o \
|
||||
usb.o device.o nvr.o nvr_at.o nvr_ps2.o \
|
||||
$(VNCOBJ)
|
||||
|
||||
INTELOBJ := intel_flash.o intel_420ex.o \
|
||||
intel_sio.o intel_piix.o
|
||||
MEMOBJ := intel_flash.o mem.o rom.o spd.o sst_flash.o
|
||||
|
||||
CPUOBJ := cpu.o cpu_table.o \
|
||||
808x.o \
|
||||
386.o 386_common.o \
|
||||
386_dynarec.o \
|
||||
808x.o 386.o 386_common.o 386_dynarec.o 386_dynarec_ops.o $(CGTOBJ) \
|
||||
x86seg.o x87.o \
|
||||
$(DYNARECOBJ)
|
||||
|
||||
CHIPSETOBJ := acc2168.o acer_m3a.o cs8230.o ali1429.o headland.o \
|
||||
intel_4x0.o ioapic.o neat.o opti495.o opti5x7.o scamp.o scat.o \
|
||||
rabbit.o sis_85c471.o sis_85c496.o \
|
||||
via_apollo.o via_vpx.o wd76c10.o
|
||||
intel_420ex.o intel_4x0.o intel_sio.o intel_piix.o ioapic.o neat.o \
|
||||
opti495.o opti5x7.o scamp.o scat.o \
|
||||
sis_85c310.o sis_85c471.o sis_85c496.o \
|
||||
via_apollo.o via_vpx.o via_vt82c586b.o via_vt82c596b.o wd76c10.o
|
||||
|
||||
MCHOBJ := machine.o machine_table.o \
|
||||
m_xt.o m_xt_compaq.o \
|
||||
@@ -544,30 +581,32 @@ MCHOBJ := machine.o machine_table.o \
|
||||
m_at_socket4_5.o m_at_socket7_s7.o m_at_sockets7.o \
|
||||
m_at_socket8.o m_at_slot1.o m_at_slot2.o m_at_socket370.o
|
||||
|
||||
DEVOBJ := bugger.o hwm.o hwm_lm75.o hwm_lm78.o ibm_5161.o isamem.o isartc.o lpt.o postcard.o $(SERIAL) \
|
||||
sio_detect.o sio_acc3221.o \
|
||||
DEVOBJ := bugger.o hwm.o hwm_lm75.o hwm_lm78.o ibm_5161.o isamem.o isartc.o lpt.o postcard.o serial.o \
|
||||
smbus.o smbus_piix4.o \
|
||||
keyboard.o \
|
||||
keyboard_xt.o keyboard_at.o \
|
||||
mouse.o \
|
||||
mouse_bus.o \
|
||||
mouse_serial.o mouse_ps2.o
|
||||
|
||||
SIOOBJ := sio_acc3221.o \
|
||||
sio_f82c710.o \
|
||||
sio_fdc37c66x.o sio_fdc37c669.o \
|
||||
sio_fdc37c93x.o \
|
||||
sio_pc87306.o \
|
||||
sio_w83787f.o \
|
||||
sio_w83877f.o sio_w83977f.o \
|
||||
sio_um8669f.o \
|
||||
smbus.o smbus_piix4.o spd.o \
|
||||
keyboard.o \
|
||||
keyboard_xt.o keyboard_at.o \
|
||||
gameport.o \
|
||||
joystick_standard.o joystick_ch_flightstick_pro.o \
|
||||
joystick_sw_pad.o joystick_tm_fcs.o \
|
||||
mouse.o \
|
||||
mouse_bus.o \
|
||||
mouse_serial.o mouse_ps2.o
|
||||
sio_um8669f.o
|
||||
|
||||
FDDOBJ := fdd.o fdc.o fdi2raw.o \
|
||||
fdd_common.o fdd_86f.o \
|
||||
fdd_fdi.o fdd_imd.o fdd_img.o fdd_json.o \
|
||||
fdd_mfm.o fdd_td0.o
|
||||
|
||||
GAMEOBJ := gameport.o \
|
||||
joystick_standard.o joystick_ch_flightstick_pro.o \
|
||||
joystick_sw_pad.o joystick_tm_fcs.o
|
||||
|
||||
HDDOBJ := hdd.o \
|
||||
hdd_image.o hdd_table.o \
|
||||
hdc.o \
|
||||
@@ -674,9 +713,9 @@ else
|
||||
PLATOBJ += win_joystick_rawinput.o
|
||||
endif
|
||||
|
||||
OBJ := $(MAINOBJ) $(INTELOBJ) $(CPUOBJ) $(CHIPSETOBJ) $(MCHOBJ) \
|
||||
$(DEVOBJ) $(FDDOBJ) $(CDROMOBJ) $(ZIPOBJ) $(MOOBJ) $(HDDOBJ) \
|
||||
$(NETOBJ) $(PRINTOBJ) $(SCSIOBJ) $(SNDOBJ) $(VIDOBJ) \
|
||||
OBJ := $(MAINOBJ) $(CPUOBJ) $(CHIPSETOBJ) $(MCHOBJ) $(DEVOBJ) $(MEMOBJ) \
|
||||
$(FDDOBJ) $(GAMEOBJ) $(CDROMOBJ) $(ZIPOBJ) $(MOOBJ) $(HDDOBJ) \
|
||||
$(NETOBJ) $(PRINTOBJ) $(SCSIOBJ) $(SIOOBJ) $(SNDOBJ) $(VIDOBJ) \
|
||||
$(PLATOBJ) $(UIOBJ) $(FSYNTHOBJ) $(MUNTOBJ) $(DEVBROBJ) \
|
||||
$(DISCORDOBJ)
|
||||
ifdef EXOBJ
|
||||
@@ -685,9 +724,6 @@ endif
|
||||
|
||||
LIBS := -mwindows -lcomctl32 \
|
||||
-lopenal -lole32
|
||||
ifeq ($(DEBUG), y)
|
||||
LIBS += -lssp
|
||||
endif
|
||||
|
||||
ifeq ($(VNC), y)
|
||||
LIBS += $(VNCLIB) -lws2_32
|
||||
@@ -765,10 +801,8 @@ pcap_if.res: pcap_if.rc
|
||||
|
||||
pcap_if.exe: pcap_if.o win_dynld.o pcap_if.res
|
||||
@echo Linking pcap_if.exe ..
|
||||
ifeq ($(DEBUG), y)
|
||||
@$(CC) $(LDFLAGS) -o pcap_if.exe pcap_if.o win_dynld.o pcap_if.res -lssp
|
||||
else
|
||||
@$(CC) $(LDFLAGS) -o pcap_if.exe pcap_if.o win_dynld.o pcap_if.res
|
||||
ifneq ($(DEBUG), y)
|
||||
@$(STRIP) pcap_if.exe
|
||||
endif
|
||||
|
||||
|
||||
@@ -1,816 +0,0 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# Makefile for Win32 (MinGW32) environment.
|
||||
#
|
||||
# Version: @(#)Makefile.mingw 1.0.143 2020/06/06
|
||||
#
|
||||
# Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
# Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
#
|
||||
|
||||
# Various compile-time options.
|
||||
ifndef STUFF
|
||||
STUFF :=
|
||||
endif
|
||||
|
||||
# Add feature selections here.
|
||||
ifndef EXTRAS
|
||||
EXTRAS :=
|
||||
endif
|
||||
|
||||
ifndef DEV_BUILD
|
||||
DEV_BUILD := n
|
||||
endif
|
||||
|
||||
ifeq ($(DEV_BUILD), y)
|
||||
ifndef DEBUG
|
||||
DEBUG := y
|
||||
endif
|
||||
ifndef DEV_BRANCH
|
||||
DEV_BRANCH := y
|
||||
endif
|
||||
ifndef AMD_K5
|
||||
AMD_K5 := y
|
||||
endif
|
||||
ifndef CL5422
|
||||
CL5422 := y
|
||||
endif
|
||||
ifndef LASERXT
|
||||
LASERXT := y
|
||||
endif
|
||||
ifndef MGA
|
||||
MGA := y
|
||||
endif
|
||||
ifndef PAS16
|
||||
PAS16 := n
|
||||
endif
|
||||
ifndef PORTABLE3
|
||||
PORTABLE3 := y
|
||||
endif
|
||||
ifndef PS1M2133
|
||||
PS1M2133 := y
|
||||
endif
|
||||
ifndef PS2M70T4
|
||||
PS2M70T4 := y
|
||||
endif
|
||||
ifndef VECTRA54
|
||||
VECTRA54 := y
|
||||
endif
|
||||
ifndef VPP60
|
||||
VPP60 := y
|
||||
endif
|
||||
ifndef SIEMENS
|
||||
SIEMENS := y
|
||||
endif
|
||||
ifndef 596B
|
||||
596B := y
|
||||
endif
|
||||
ifndef VGAWONDER
|
||||
VGAWONDER := y
|
||||
endif
|
||||
ifndef VNC
|
||||
VNC := y
|
||||
endif
|
||||
ifndef WIN471
|
||||
WIN471 := y
|
||||
endif
|
||||
ifndef XL24
|
||||
XL24 := y
|
||||
endif
|
||||
ifndef NO_SIO
|
||||
NO_SIO := y
|
||||
endif
|
||||
ifndef GUSMAX
|
||||
GUSMAX := y
|
||||
endif
|
||||
else
|
||||
ifndef DEBUG
|
||||
DEBUG := n
|
||||
endif
|
||||
ifndef DEV_BRANCH
|
||||
DEV_BRANCH := n
|
||||
endif
|
||||
ifndef AMD_K5
|
||||
AMD_K5 := n
|
||||
endif
|
||||
ifndef CL5422
|
||||
CL5422 := n
|
||||
endif
|
||||
ifndef LASERXT
|
||||
LASERXT := n
|
||||
endif
|
||||
ifndef MGA
|
||||
MGA := n
|
||||
endif
|
||||
ifndef PAS16
|
||||
PAS16 := n
|
||||
endif
|
||||
ifndef PORTABLE3
|
||||
PORTABLE3 := n
|
||||
endif
|
||||
ifndef PS1M2133
|
||||
PS1M2133 := n
|
||||
endif
|
||||
ifndef PS2M70T4
|
||||
PS2M70T4 := n
|
||||
endif
|
||||
ifndef VECTRA54
|
||||
VECTRA54 := n
|
||||
endif
|
||||
ifndef VPP60
|
||||
VPP60 := n
|
||||
endif
|
||||
ifndef SIEMENS
|
||||
SIEMENS := n
|
||||
endif
|
||||
ifndef 596B
|
||||
596B := n
|
||||
endif
|
||||
ifndef VGAWONDER
|
||||
VGAWONDER := n
|
||||
endif
|
||||
ifndef VNC
|
||||
VNC := n
|
||||
endif
|
||||
ifndef WIN471
|
||||
WIN471 := n
|
||||
endif
|
||||
ifndef XL24
|
||||
XL24 := n
|
||||
endif
|
||||
ifndef NO_SIO
|
||||
NO_SIO := n
|
||||
endif
|
||||
ifndef GUSMAX
|
||||
GUSMAX := n
|
||||
endif
|
||||
endif
|
||||
|
||||
# Defaults for several build options (possibly defined in a chained file.)
|
||||
ifndef AUTODEP
|
||||
AUTODEP := n
|
||||
endif
|
||||
ifndef OPTIM
|
||||
OPTIM := n
|
||||
endif
|
||||
ifndef RELEASE
|
||||
RELEASE := n
|
||||
endif
|
||||
ifndef X64
|
||||
X64 := n
|
||||
endif
|
||||
ifndef ARM
|
||||
ARM := n
|
||||
endif
|
||||
ifndef ARM64
|
||||
ARM64 := n
|
||||
endif
|
||||
ifndef WX
|
||||
WX := n
|
||||
endif
|
||||
ifndef DINPUT
|
||||
DINPUT := y
|
||||
endif
|
||||
ifndef OPENAL
|
||||
OPENAL := y
|
||||
endif
|
||||
ifndef FLUIDSYNTH
|
||||
FLUIDSYNTH := y
|
||||
endif
|
||||
ifndef MUNT
|
||||
MUNT := y
|
||||
endif
|
||||
ifndef DYNAREC
|
||||
DYNAREC := y
|
||||
endif
|
||||
ifndef DISCORD
|
||||
DISCORD := y
|
||||
endif
|
||||
|
||||
|
||||
# Name of the executable.
|
||||
ifndef PROG
|
||||
ifneq ($(WX), n)
|
||||
PROG := Wx86Box
|
||||
else
|
||||
PROG := 86Box
|
||||
endif
|
||||
endif
|
||||
|
||||
# WxWidgets basic info. Extract using the config program.
|
||||
ifneq ($(WX), n)
|
||||
EXPATH += wx
|
||||
WX_CONFIG := wx-config.exe
|
||||
ifeq ($(WX), y)
|
||||
WX_PATH := C:/MinGW32/WxWidgets
|
||||
WX_FLAGS := -I$(WX_PATH)/lib/wx/include/msw-unicode-3.0 \
|
||||
-I$(WX_PATH)/include/wx-3.0 \
|
||||
-D__WXMSW__ -DWX_PRECOMP -D_FILE_OFFSET_BITS=64 -pthread
|
||||
# -lwx_mswu_gl-3.0 -lwxtiff-3.0 -llzma
|
||||
WX_LIBS := -mwindows -mthreads -L$(WX_PATH)/lib \
|
||||
-lwx_mswu-3.0.dll \
|
||||
-lrpcrt4 -loleaut32 -lole32 -luuid \
|
||||
-lwinspool -lwinmm -lshell32 -lcomctl32 \
|
||||
-lcomdlg32 -ladvapi32 -lwsock32 -lgdi32
|
||||
endif
|
||||
ifeq ($(WX), static)
|
||||
WX_PATH := C:/MinGW32/WxWidgets
|
||||
WX_FLAGS := -I$(WX_PATH)/lib/wx/include/msw-unicode-3.0 \
|
||||
-I$(WX_PATH)/include/wx-3.0 \
|
||||
-D__WXMSW__ -DWX_PRECOMP -D_FILE_OFFSET_BITS=64 -pthread
|
||||
# -lwx_mswu_gl-3.0 -lwxtiff-3.0 -llzma
|
||||
WX_LIBS := -mwindows -mthreads -L$(WX_PATH)/lib \
|
||||
-lwx_mswu-3.0 -lwxscintilla-3.0 \
|
||||
-lwxjpeg-3.0 -lwxpng-3.0 -lwxzlib-3.0 \
|
||||
-lwxregexu-3.0 -lwxexpat-3.0 \
|
||||
-lrpcrt4 -loleaut32 -lole32 -luuid \
|
||||
-lwinspool -lwinmm -lshell32 -lcomctl32 \
|
||||
-lcomdlg32 -ladvapi32 -lwsock32 -lgdi32
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
#########################################################################
|
||||
# Nothing should need changing from here on.. #
|
||||
#########################################################################
|
||||
VPATH := $(EXPATH) . codegen_new cpu \
|
||||
cdrom chipset disk floppy game machine \
|
||||
printer \
|
||||
sio sound \
|
||||
sound/munt sound/munt/c_interface sound/munt/sha1 \
|
||||
sound/munt/srchelper sound/munt/srchelper/srctools/src \
|
||||
sound/resid-fp \
|
||||
scsi video network network/slirp win
|
||||
ifeq ($(X64), y)
|
||||
TOOL_PREFIX := x86_64-w64-mingw32-
|
||||
else
|
||||
TOOL_PREFIX := i686-w64-mingw32-
|
||||
endif
|
||||
CPP := ${TOOL_PREFIX}g++
|
||||
CC := ${TOOL_PREFIX}gcc
|
||||
WINDRES := windres
|
||||
STRIP := strip
|
||||
ifeq ($(ARM64), y)
|
||||
CPP := aarch64-w64-mingw32-g++
|
||||
CC := aarch64-w64-mingw32-gcc
|
||||
WINDRES := aarch64-w64-mingw32-windres
|
||||
STRIP := aarch64-w64-mingw32-strip
|
||||
endif
|
||||
ifeq ($(ARM), y)
|
||||
CPP := armv7-w64-mingw32-g++
|
||||
CC := armv7-w64-mingw32-gcc
|
||||
WINDRES := armv7-w64-mingw32-windres
|
||||
STRIP := armv7-w64-mingw32-strip
|
||||
endif
|
||||
DEPS = -MMD -MF $*.d -c $<
|
||||
DEPFILE := win/.depends
|
||||
|
||||
# Set up the correct toolchain flags.
|
||||
OPTS := $(EXTRAS) $(STUFF)
|
||||
OPTS += -Iinclude \
|
||||
-iquote codegen_new -iquote cpu
|
||||
ifdef EXFLAGS
|
||||
OPTS += $(EXFLAGS)
|
||||
endif
|
||||
ifdef EXINC
|
||||
OPTS += -I$(EXINC)
|
||||
endif
|
||||
ifeq ($(X64), y)
|
||||
ifeq ($(OPTIM), y)
|
||||
DFLAGS := -march=native
|
||||
else
|
||||
DFLAGS :=
|
||||
endif
|
||||
else
|
||||
ifeq ($(OPTIM), y)
|
||||
DFLAGS := -march=native
|
||||
else
|
||||
DFLAGS := -march=i686
|
||||
endif
|
||||
endif
|
||||
ifeq ($(DEBUG), y)
|
||||
DFLAGS += -ggdb -DDEBUG
|
||||
AOPTIM :=
|
||||
ifndef COPTIM
|
||||
COPTIM := -Og
|
||||
endif
|
||||
else
|
||||
DFLAGS += -g0
|
||||
ifeq ($(OPTIM), y)
|
||||
AOPTIM := -mtune=native
|
||||
ifndef COPTIM
|
||||
COPTIM := -O3 -ffp-contract=fast -flto
|
||||
endif
|
||||
else
|
||||
ifndef COPTIM
|
||||
COPTIM := -O3
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
AFLAGS := -msse2 -mfpmath=sse
|
||||
ifeq ($(ARM), y)
|
||||
DFLAGS := -march=armv7-a
|
||||
AOPTIM :=
|
||||
AFLAGS := -mfloat-abi=hard
|
||||
endif
|
||||
ifeq ($(ARM64), y)
|
||||
DFLAGS := -march=armv8-a
|
||||
AOPTIM :=
|
||||
AFLAGS := -mfloat-abi=hard
|
||||
endif
|
||||
RFLAGS := --input-format=rc -O coff -Iinclude
|
||||
OPTS += -DUSE_NEW_DYNAREC
|
||||
ifeq ($(RELEASE), y)
|
||||
OPTS += -DRELEASE_BUILD
|
||||
RFLAGS += -DRELEASE_BUILD
|
||||
endif
|
||||
ifeq ($(VRAMDUMP), y)
|
||||
OPTS += -DENABLE_VRAM_DUMP
|
||||
RFLAGS += -DENABLE_VRAM_DUMP
|
||||
endif
|
||||
|
||||
|
||||
# Optional modules.
|
||||
ifeq ($(DYNAREC), y)
|
||||
ifeq ($(X64), y)
|
||||
PLATCG := codegen_backend_x86-64.o codegen_backend_x86-64_ops.o codegen_backend_x86-64_ops_sse.o \
|
||||
codegen_backend_x86-64_uops.o
|
||||
else ifeq ($(ARM64), y)
|
||||
PLATCG := codegen_backend_arm64.o codegen_backend_arm64_ops.o codegen_backend_arm64_uops.o \
|
||||
codegen_backend_arm64_imm.o
|
||||
else ifeq ($(ARM), y)
|
||||
PLATCG := codegen_backend_arm.o codegen_backend_arm_ops.o codegen_backend_arm_uops.o
|
||||
else
|
||||
PLATCG := codegen_backend_x86.o codegen_backend_x86_ops.o codegen_backend_x86_ops_fpu.o codegen_backend_x86_ops_sse.o \
|
||||
codegen_backend_x86_uops.o
|
||||
endif
|
||||
|
||||
OPTS += -DUSE_DYNAREC
|
||||
RFLAGS += -DUSE_DYNAREC
|
||||
DYNARECOBJ := 386_dynarec_ops.o \
|
||||
codegen.o codegen_accumulate.o codegen_allocator.o codegen_block.o codegen_ir.o codegen_ops.o \
|
||||
codegen_ops_3dnow.o codegen_ops_branch.o codegen_ops_arith.o codegen_ops_fpu_arith.o \
|
||||
codegen_ops_fpu_constant.o codegen_ops_fpu_loadstore.o codegen_ops_fpu_misc.o codegen_ops_helpers.o codegen_ops_jump.o \
|
||||
codegen_ops_logic.o codegen_ops_misc.o codegen_ops_mmx_arith.o codegen_ops_mmx_cmp.o \
|
||||
codegen_ops_mmx_loadstore.o codegen_ops_mmx_logic.o codegen_ops_mmx_pack.o codegen_ops_mmx_shift.o \
|
||||
codegen_ops_mov.o codegen_ops_shift.o codegen_ops_stack.o codegen_reg.o codegen_timing_486.o \
|
||||
codegen_timing_686.o codegen_timing_common.o codegen_timing_k6.o codegen_timing_pentium.o \
|
||||
codegen_timing_p6.o codegen_timing_winchip.o codegen_timing_winchip2.o $(PLATCG)
|
||||
endif
|
||||
|
||||
ifneq ($(WX), n)
|
||||
OPTS += -DUSE_WX $(WX_FLAGS)
|
||||
LIBS += $(WX_LIBS)
|
||||
UIOBJ := wx_main.o wx_ui.o wx_stbar.o wx_render.o
|
||||
else
|
||||
UIOBJ := win_ui.o win_stbar.o \
|
||||
win_sdl.o \
|
||||
win_dialog.o win_about.o \
|
||||
win_settings.o win_devconf.o win_snd_gain.o \
|
||||
win_new_floppy.o win_jsconf.o win_media_menu.o
|
||||
endif
|
||||
|
||||
ifeq ($(OPENAL), y)
|
||||
OPTS += -DUSE_OPENAL
|
||||
endif
|
||||
ifeq ($(FLUIDSYNTH), y)
|
||||
OPTS += -DUSE_FLUIDSYNTH
|
||||
FSYNTHOBJ := midi_fluidsynth.o
|
||||
endif
|
||||
|
||||
ifeq ($(MUNT), y)
|
||||
OPTS += -DUSE_MUNT
|
||||
MUNTOBJ := midi_mt32.o \
|
||||
Analog.o BReverbModel.o File.o FileStream.o LA32Ramp.o \
|
||||
LA32FloatWaveGenerator.o LA32WaveGenerator.o \
|
||||
MidiStreamParser.o Part.o Partial.o PartialManager.o \
|
||||
Poly.o ROMInfo.o SampleRateConverter.o \
|
||||
FIRResampler.o IIR2xResampler.o LinearResampler.o ResamplerModel.o \
|
||||
SincResampler.o InternalResampler.o \
|
||||
Synth.o Tables.o TVA.o TVF.o TVP.o sha1.o c_interface.o
|
||||
endif
|
||||
|
||||
ifeq ($(VNC), y)
|
||||
OPTS += -DUSE_VNC
|
||||
RFLAGS += -DUSE_VNC
|
||||
ifneq ($(VNC_PATH), )
|
||||
OPTS += -I$(VNC_PATH)\INCLUDE
|
||||
VNCLIB := -L$(VNC_PATH)\LIB
|
||||
endif
|
||||
VNCLIB += -lvncserver
|
||||
VNCOBJ := vnc.o vnc_keymap.o
|
||||
endif
|
||||
|
||||
ifeq ($(DISCORD), y)
|
||||
OPTS += -DUSE_DISCORD
|
||||
RFLAGS += -DUSE_DISCORD
|
||||
DISCORDOBJ := win_discord.o
|
||||
endif
|
||||
|
||||
# Options for the DEV branch.
|
||||
ifeq ($(DEV_BRANCH), y)
|
||||
OPTS += -DDEV_BRANCH
|
||||
DEVBROBJ :=
|
||||
|
||||
ifeq ($(AMD_K5), y)
|
||||
OPTS += -DUSE_AMD_K5
|
||||
endif
|
||||
|
||||
ifeq ($(CL5422), y)
|
||||
OPTS += -DUSE_CL5422
|
||||
endif
|
||||
|
||||
ifeq ($(LASERXT), y)
|
||||
OPTS += -DUSE_LASERXT
|
||||
DEVBROBJ += m_xt_laserxt.o
|
||||
endif
|
||||
|
||||
ifeq ($(MGA), y)
|
||||
OPTS += -DUSE_MGA
|
||||
DEVBROBJ += vid_mga.o
|
||||
endif
|
||||
|
||||
ifeq ($(PAS16), y)
|
||||
OPTS += -DUSE_PAS16
|
||||
DEVBROBJ += snd_pas16.o
|
||||
endif
|
||||
|
||||
ifeq ($(PORTABLE3), y)
|
||||
OPTS += -DUSE_PORTABLE3
|
||||
endif
|
||||
|
||||
ifeq ($(PS1M2133), y)
|
||||
OPTS += -DUSE_PS1M2133
|
||||
endif
|
||||
|
||||
ifeq ($(PS2M70T4), y)
|
||||
OPTS += -DUSE_PS2M70T4
|
||||
endif
|
||||
|
||||
ifeq ($(VECTRA54), y)
|
||||
OPTS += -DUSE_VECTRA54
|
||||
endif
|
||||
|
||||
ifeq ($(VPP60), y)
|
||||
OPTS += -DUSE_VPP60
|
||||
endif
|
||||
|
||||
ifeq ($(SIEMENS), y)
|
||||
OPTS += -DUSE_SIEMENS
|
||||
endif
|
||||
|
||||
ifeq ($(596B), y)
|
||||
OPTS += -DUSE_596B
|
||||
endif
|
||||
|
||||
ifeq ($(VGAWONDER), y)
|
||||
OPTS += -DUSE_VGAWONDER
|
||||
endif
|
||||
|
||||
ifeq ($(WIN471), y)
|
||||
OPTS += -DUSE_WIN471
|
||||
endif
|
||||
|
||||
ifeq ($(XL24), y)
|
||||
OPTS += -DUSE_XL24
|
||||
endif
|
||||
|
||||
ifeq ($(NO_SIO), y)
|
||||
OPTS += -DNO_SIO
|
||||
endif
|
||||
|
||||
ifeq ($(GUSMAX), y)
|
||||
OPTS += -DUSE_GUSMAX
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
|
||||
# Options for works-in-progress.
|
||||
ifndef SERIAL
|
||||
SERIAL := serial.o
|
||||
endif
|
||||
|
||||
|
||||
# Final versions of the toolchain flags.
|
||||
CFLAGS := $(WX_FLAGS) $(OPTS) $(DFLAGS) $(COPTIM) $(AOPTIM) \
|
||||
$(AFLAGS) -fomit-frame-pointer -mstackrealign -Wall \
|
||||
-fno-strict-aliasing
|
||||
|
||||
# Add freetyp2 references through pkgconfig
|
||||
CFLAGS := $(CFLAGS) `pkg-config --cflags freetype2`
|
||||
|
||||
CXXFLAGS := $(CFLAGS)
|
||||
|
||||
|
||||
#########################################################################
|
||||
# Create the (final) list of objects to build. #
|
||||
#########################################################################
|
||||
MAINOBJ := pc.o config.o random.o timer.o io.o acpi.o apm.o dma.o ddma.o \
|
||||
nmi.o pic.o pit.o port_92.o ppi.o pci.o mca.o mcr.o mem.o rom.o \
|
||||
usb.o device.o nvr.o nvr_at.o nvr_ps2.o sst_flash.o via_vt82c586b.o \
|
||||
via_vt82c596b.o $(VNCOBJ)
|
||||
|
||||
INTELOBJ := intel_flash.o intel_420ex.o \
|
||||
intel_sio.o intel_piix.o
|
||||
|
||||
CPUOBJ := cpu.o cpu_table.o \
|
||||
808x.o \
|
||||
386.o 386_common.o \
|
||||
386_dynarec.o \
|
||||
x86seg.o x87.o \
|
||||
$(DYNARECOBJ)
|
||||
|
||||
CHIPSETOBJ := acc2168.o acer_m3a.o cs8230.o ali1429.o headland.o \
|
||||
intel_4x0.o ioapic.o neat.o opti495.o opti5x7.o scamp.o scat.o \
|
||||
rabbit.o sis_85c471.o sis_85c496.o \
|
||||
via_apollo.o via_vpx.o wd76c10.o
|
||||
|
||||
MCHOBJ := machine.o machine_table.o \
|
||||
m_xt.o m_xt_compaq.o \
|
||||
m_xt_t1000.o m_xt_t1000_vid.o \
|
||||
m_xt_xi8088.o m_xt_zenith.o \
|
||||
m_pcjr.o \
|
||||
m_amstrad.o m_europc.o \
|
||||
m_olivetti_m24.o m_tandy.o \
|
||||
m_at.o m_at_commodore.o \
|
||||
m_at_t3100e.o m_at_t3100e_vid.o \
|
||||
m_ps1.o m_ps1_hdc.o \
|
||||
m_ps2_isa.o m_ps2_mca.o \
|
||||
m_at_compaq.o \
|
||||
m_at_286_386sx.o m_at_386dx_486.o \
|
||||
m_at_socket4_5.o m_at_socket7_s7.o m_at_sockets7.o \
|
||||
m_at_socket8.o m_at_slot1.o m_at_slot2.o m_at_socket370.o
|
||||
|
||||
DEVOBJ := bugger.o hwm.o hwm_lm75.o hwm_lm78.o ibm_5161.o isamem.o isartc.o lpt.o postcard.o $(SERIAL) \
|
||||
sio_acc3221.o \
|
||||
sio_f82c710.o \
|
||||
sio_fdc37c66x.o sio_fdc37c669.o \
|
||||
sio_fdc37c93x.o \
|
||||
sio_pc87306.o \
|
||||
sio_w83787f.o \
|
||||
sio_w83877f.o sio_w83977f.o \
|
||||
sio_um8669f.o \
|
||||
smbus.o smbus_piix4.o spd.o \
|
||||
keyboard.o \
|
||||
keyboard_xt.o keyboard_at.o \
|
||||
gameport.o \
|
||||
joystick_standard.o joystick_ch_flightstick_pro.o \
|
||||
joystick_sw_pad.o joystick_tm_fcs.o \
|
||||
mouse.o \
|
||||
mouse_bus.o \
|
||||
mouse_serial.o mouse_ps2.o
|
||||
|
||||
FDDOBJ := fdd.o fdc.o fdi2raw.o \
|
||||
fdd_common.o fdd_86f.o \
|
||||
fdd_fdi.o fdd_imd.o fdd_img.o fdd_json.o \
|
||||
fdd_mfm.o fdd_td0.o
|
||||
|
||||
HDDOBJ := hdd.o \
|
||||
hdd_image.o hdd_table.o \
|
||||
hdc.o \
|
||||
hdc_st506_xt.o hdc_st506_at.o \
|
||||
hdc_xta.o \
|
||||
hdc_esdi_at.o hdc_esdi_mca.o \
|
||||
hdc_xtide.o hdc_ide.o \
|
||||
hdc_ide_sff8038i.o
|
||||
|
||||
CDROMOBJ := cdrom.o \
|
||||
cdrom_image_backend.o cdrom_image.o
|
||||
|
||||
ZIPOBJ := zip.o
|
||||
|
||||
MOOBJ := mo.o
|
||||
|
||||
SCSIOBJ := scsi.o scsi_device.o \
|
||||
scsi_cdrom.o scsi_disk.o \
|
||||
scsi_x54x.o \
|
||||
scsi_aha154x.o scsi_buslogic.o \
|
||||
scsi_ncr5380.o scsi_ncr53c8xx.o \
|
||||
scsi_spock.o
|
||||
|
||||
NETOBJ := network.o \
|
||||
net_pcap.o \
|
||||
net_slirp.o \
|
||||
bootp.o ip_icmp.o misc.o socket.o tcp_timer.o cksum.o \
|
||||
ip_input.o queue.o tcp_input.o debug.o ip_output.o \
|
||||
sbuf.o tcp_output.o udp.o if.o mbuf.o slirp.o tcp_subr.o \
|
||||
net_dp8390.o \
|
||||
net_3c503.o net_ne2000.o \
|
||||
net_pcnet.o net_wd8003.o
|
||||
|
||||
PRINTOBJ := png.o prt_cpmap.o \
|
||||
prt_escp.o prt_text.o prt_ps.o
|
||||
|
||||
SNDOBJ := sound.o \
|
||||
openal.o \
|
||||
snd_opl.o snd_opl_backend.o \
|
||||
nukedopl.o \
|
||||
snd_resid.o \
|
||||
convolve.o convolve-sse.o envelope.o extfilt.o \
|
||||
filter.o pot.o sid.o voice.o wave6581__ST.o \
|
||||
wave6581_P_T.o wave6581_PS_.o wave6581_PST.o \
|
||||
wave8580__ST.o wave8580_P_T.o wave8580_PS_.o \
|
||||
wave8580_PST.o wave.o \
|
||||
midi.o midi_system.o \
|
||||
snd_speaker.o \
|
||||
snd_pssj.o \
|
||||
snd_lpt_dac.o snd_lpt_dss.o \
|
||||
snd_adlib.o snd_adlibgold.o snd_ad1848.o snd_audiopci.o \
|
||||
snd_azt2316a.o \
|
||||
snd_cms.o \
|
||||
snd_gus.o \
|
||||
snd_sb.o snd_sb_dsp.o \
|
||||
snd_emu8k.o snd_mpu401.o \
|
||||
snd_sn76489.o snd_ssi2001.o \
|
||||
snd_wss.o \
|
||||
snd_ym7128.o
|
||||
|
||||
VIDOBJ := video.o \
|
||||
vid_table.o \
|
||||
vid_cga.o vid_cga_comp.o \
|
||||
vid_compaq_cga.o \
|
||||
vid_mda.o \
|
||||
vid_hercules.o vid_herculesplus.o vid_incolor.o \
|
||||
vid_colorplus.o \
|
||||
vid_genius.o \
|
||||
vid_pgc.o vid_im1024.o \
|
||||
vid_sigma.o \
|
||||
vid_wy700.o \
|
||||
vid_ega.o vid_ega_render.o \
|
||||
vid_svga.o vid_svga_render.o \
|
||||
vid_vga.o \
|
||||
vid_ati_eeprom.o \
|
||||
vid_ati18800.o vid_ati28800.o \
|
||||
vid_ati_mach64.o vid_ati68860_ramdac.o \
|
||||
vid_bt48x_ramdac.o \
|
||||
vid_av9194.o \
|
||||
vid_icd2061.o vid_ics2595.o \
|
||||
vid_cl54xx.o \
|
||||
vid_et4000.o vid_sc1502x_ramdac.o \
|
||||
vid_et4000w32.o vid_stg_ramdac.o \
|
||||
vid_ht216.o \
|
||||
vid_oak_oti.o \
|
||||
vid_paradise.o \
|
||||
vid_ti_cf62011.o \
|
||||
vid_tvga.o \
|
||||
vid_tgui9440.o vid_tkd8001_ramdac.o \
|
||||
vid_att20c49x_ramdac.o \
|
||||
vid_s3.o vid_s3_virge.o \
|
||||
vid_sdac_ramdac.o \
|
||||
vid_voodoo.o
|
||||
|
||||
PLATOBJ := win.o \
|
||||
win_dynld.o win_thread.o \
|
||||
win_cdrom.o win_keyboard.o \
|
||||
win_crashdump.o win_midi.o \
|
||||
win_mouse.o
|
||||
|
||||
ifeq ($(DINPUT), y)
|
||||
PLATOBJ += win_joystick.o
|
||||
else
|
||||
PLATOBJ += win_joystick_rawinput.o
|
||||
endif
|
||||
|
||||
OBJ := $(MAINOBJ) $(INTELOBJ) $(CPUOBJ) $(CHIPSETOBJ) $(MCHOBJ) \
|
||||
$(DEVOBJ) $(FDDOBJ) $(CDROMOBJ) $(ZIPOBJ) $(MOOBJ) $(HDDOBJ) \
|
||||
$(NETOBJ) $(PRINTOBJ) $(SCSIOBJ) $(SNDOBJ) $(VIDOBJ) \
|
||||
$(PLATOBJ) $(UIOBJ) $(FSYNTHOBJ) $(MUNTOBJ) $(DEVBROBJ) \
|
||||
$(DISCORDOBJ)
|
||||
ifdef EXOBJ
|
||||
OBJ += $(EXOBJ)
|
||||
endif
|
||||
|
||||
LIBS := -mwindows -lcomctl32 \
|
||||
-lopenal -lole32
|
||||
|
||||
ifeq ($(VNC), y)
|
||||
LIBS += $(VNCLIB) -lws2_32
|
||||
endif
|
||||
ifneq ($(WX), n)
|
||||
LIBS += $(WX_LIBS) -lm
|
||||
endif
|
||||
LIBS += -lpng -lz -lwsock32 -lshell32 -liphlpapi -lpsapi -lSDL2 -limm32 -lhid -lsetupapi -loleaut32 -lversion -lwinmm -static -lstdc++
|
||||
ifneq ($(X64), y)
|
||||
LIBS += -Wl,--large-address-aware
|
||||
endif
|
||||
ifeq ($(DINPUT), y)
|
||||
LIBS += -ldinput8
|
||||
endif
|
||||
|
||||
LIBS += -static
|
||||
|
||||
# Build module rules.
|
||||
ifeq ($(AUTODEP), y)
|
||||
%.o: %.c
|
||||
@echo $<
|
||||
@$(CC) $(CFLAGS) $(DEPS) -c $<
|
||||
|
||||
%.o: %.cc
|
||||
@echo $<
|
||||
@$(CPP) $(CXXFLAGS) $(DEPS) -c $<
|
||||
|
||||
%.o: %.cpp
|
||||
@echo $<
|
||||
@$(CPP) $(CXXFLAGS) $(DEPS) -c $<
|
||||
else
|
||||
%.o: %.c
|
||||
@echo $<
|
||||
@$(CC) $(CFLAGS) -c $<
|
||||
|
||||
%.o: %.cc
|
||||
@echo $<
|
||||
@$(CPP) $(CXXFLAGS) -c $<
|
||||
|
||||
%.o: %.cpp
|
||||
@echo $<
|
||||
@$(CPP) $(CXXFLAGS) -c $<
|
||||
|
||||
%.d: %.c $(wildcard $*.d)
|
||||
@echo $<
|
||||
@$(CC) $(CFLAGS) $(DEPS) -E $< >NUL
|
||||
|
||||
%.d: %.cc $(wildcard $*.d)
|
||||
@echo $<
|
||||
@$(CPP) $(CXXFLAGS) $(DEPS) -E $< >NUL
|
||||
|
||||
%.d: %.cpp $(wildcard $*.d)
|
||||
@echo $<
|
||||
@$(CPP) $(CXXFLAGS) $(DEPS) -E $< >NUL
|
||||
endif
|
||||
|
||||
|
||||
all: $(PROG).exe
|
||||
|
||||
|
||||
86Box.res: 86Box.rc
|
||||
@echo Processing $<
|
||||
@$(WINDRES) $(RFLAGS) $(EXTRAS) -i $< -o 86Box.res
|
||||
|
||||
$(PROG).exe: $(OBJ) 86Box.res
|
||||
@echo Linking $(PROG).exe ..
|
||||
@$(CC) $(LDFLAGS) -o $(PROG).exe $(OBJ) 86Box.res $(LIBS)
|
||||
ifneq ($(DEBUG), y)
|
||||
@$(STRIP) $(PROG).exe
|
||||
endif
|
||||
|
||||
pcap_if.res: pcap_if.rc
|
||||
@echo Processing $<
|
||||
@$(WINDRES) $(RFLAGS) -i $< -o pcap_if.res
|
||||
|
||||
pcap_if.exe: pcap_if.o win_dynld.o pcap_if.res
|
||||
@echo Linking pcap_if.exe ..
|
||||
@$(CC) $(LDFLAGS) -o pcap_if.exe pcap_if.o win_dynld.o pcap_if.res
|
||||
ifneq ($(DEBUG), y)
|
||||
@$(STRIP) pcap_if.exe
|
||||
endif
|
||||
|
||||
hello.exe: hello.o
|
||||
$(CXX) $(LDFLAGS) -o hello.exe hello.o $(WXLIBS) $(LIBS)
|
||||
ifneq ($(DEBUG), y)
|
||||
@$(STRIP) hello.exe
|
||||
endif
|
||||
|
||||
|
||||
clean:
|
||||
@echo Cleaning objects..
|
||||
@-rm -f *.o 2>NUL
|
||||
@-rm -f *.res 2>NUL
|
||||
|
||||
clobber: clean
|
||||
@echo Cleaning executables..
|
||||
@-rm -f *.d 2>NUL
|
||||
@-rm -f *.exe 2>NUL
|
||||
# @-rm -f $(DEPFILE) 2>NUL
|
||||
|
||||
ifneq ($(AUTODEP), y)
|
||||
depclean:
|
||||
@-rm -f $(DEPFILE) 2>NUL
|
||||
@echo Creating dependencies..
|
||||
@echo # Run "make depends" to re-create this file. >$(DEPFILE)
|
||||
|
||||
depends: DEPOBJ=$(OBJ:%.o=%.d)
|
||||
depends: depclean $(OBJ:%.o=%.d)
|
||||
@-cat $(DEPOBJ) >>$(DEPFILE)
|
||||
@-rm -f $(DEPOBJ)
|
||||
|
||||
$(DEPFILE):
|
||||
endif
|
||||
|
||||
|
||||
# Module dependencies.
|
||||
ifeq ($(AUTODEP), y)
|
||||
#-include $(OBJ:%.o=%.d) (better, but sloooowwwww)
|
||||
-include *.d
|
||||
else
|
||||
include $(wildcard $(DEPFILE))
|
||||
endif
|
||||
|
||||
|
||||
# End of Makefile.mingw.
|
||||
Reference in New Issue
Block a user