Added external Floppy disk controller support.
This commit is contained in:
23
src/config.c
23
src/config.c
@@ -783,6 +783,26 @@ load_other_peripherals(void)
|
||||
else
|
||||
scsi_card_current = 0;
|
||||
|
||||
if (machines[machine].flags & MACHINE_FDC_FIXED) {
|
||||
config_delete_var(cat, "fdc");
|
||||
fdc_type = FDC_INTERNAL;
|
||||
} else {
|
||||
p = config_get_string(cat, "fdc", NULL);
|
||||
if (p == NULL) {
|
||||
if (machines[machine].flags & MACHINE_FDC) {
|
||||
p = (char *)malloc((strlen("internal")+1)*sizeof(char));
|
||||
strcpy(p, "internal");
|
||||
} else {
|
||||
p = (char *)malloc((strlen("none")+1)*sizeof(char));
|
||||
strcpy(p, "none");
|
||||
}
|
||||
free_p = 1;
|
||||
}
|
||||
fdc_type = fdc_ext_get_from_internal_name(p);
|
||||
if (free_p)
|
||||
free(p);
|
||||
}
|
||||
|
||||
p = config_get_string(cat, "hdc", NULL);
|
||||
if (p == NULL) {
|
||||
if (machines[machine].flags & MACHINE_HDC) {
|
||||
@@ -1744,6 +1764,9 @@ save_other_peripherals(void)
|
||||
config_set_string(cat, "scsicard",
|
||||
scsi_card_get_internal_name(scsi_card_current));
|
||||
|
||||
config_set_string(cat, "fdc",
|
||||
fdc_ext_get_internal_name(fdc_type));
|
||||
|
||||
config_set_string(cat, "hdc",
|
||||
hdc_get_internal_name(hdc_current));
|
||||
|
||||
|
113
src/floppy/fdc.c
113
src/floppy/fdc.c
@@ -35,6 +35,7 @@
|
||||
#include <86box/ui.h>
|
||||
#include <86box/fdd.h>
|
||||
#include <86box/fdc.h>
|
||||
#include <86box/fdc_pii15xb.h>
|
||||
|
||||
|
||||
extern uint64_t motoron[FDD_NUM];
|
||||
@@ -89,6 +90,9 @@ int lastbyte=0;
|
||||
int floppymodified[4];
|
||||
int floppyrate[4];
|
||||
|
||||
|
||||
int fdc_type;
|
||||
|
||||
#ifdef ENABLE_FDC_LOG
|
||||
int fdc_do_log = ENABLE_FDC_LOG;
|
||||
|
||||
@@ -110,6 +114,105 @@ fdc_log(const char *fmt, ...)
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct {
|
||||
const char *internal_name;
|
||||
const device_t *device;
|
||||
} fdc_ext_t;
|
||||
|
||||
|
||||
static const device_t fdc_none_device = {
|
||||
"None",
|
||||
0, FDC_NONE,
|
||||
NULL, NULL, NULL,
|
||||
NULL, NULL, NULL,
|
||||
NULL
|
||||
};
|
||||
static const device_t fdc_internal_device = {
|
||||
"Internal Floppy Drive Controller",
|
||||
0, FDC_INTERNAL,
|
||||
NULL, NULL, NULL,
|
||||
NULL, NULL, NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
static fdc_ext_t fdc_devices[] = {
|
||||
{ "none", &fdc_none_device },
|
||||
{ "internal", &fdc_internal_device },
|
||||
{ "dtk_pii151b", &fdc_pii151b_device },
|
||||
{ "dtk_pii158b", &fdc_pii158b_device },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
char *
|
||||
fdc_ext_get_name(int fdc_ext)
|
||||
{
|
||||
return((char *)fdc_devices[fdc_ext].device->name);
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
fdc_ext_get_internal_name(int fdc_ext)
|
||||
{
|
||||
return((char *)fdc_devices[fdc_ext].internal_name);
|
||||
}
|
||||
|
||||
int
|
||||
fdc_ext_get_id(char *s)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
while (strlen((char *) fdc_devices[c].name))
|
||||
{
|
||||
if (!strcmp((char *) fdc_devices[c].name, s))
|
||||
return c;
|
||||
c++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
fdc_ext_get_from_internal_name(char *s)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
while (fdc_devices[c].internal_name != NULL) {
|
||||
if (! strcmp((char *)fdc_devices[c].internal_name, s))
|
||||
return(c);
|
||||
c++;
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
const device_t *
|
||||
fdc_ext_get_device(int fdc_ext)
|
||||
{
|
||||
return(fdc_devices[fdc_ext].device);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
fdc_ext_has_config(int fdc_ext)
|
||||
{
|
||||
const device_t *dev = fdc_ext_get_device(fdc_ext);
|
||||
|
||||
if (dev == NULL) return(0);
|
||||
|
||||
if (dev->config == NULL) return(0);
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
int
|
||||
fdc_ext_available(int fdc_ext)
|
||||
{
|
||||
return(device_available(fdc_devices[fdc_ext].device));
|
||||
}
|
||||
|
||||
|
||||
|
||||
uint8_t
|
||||
fdc_get_current_drive(void)
|
||||
{
|
||||
@@ -2271,3 +2374,13 @@ const device_t fdc_at_nsc_device = {
|
||||
fdc_reset,
|
||||
NULL, NULL, NULL
|
||||
};
|
||||
|
||||
const device_t fdc_dp8473_device = {
|
||||
"NS DP8473 Floppy Drive Controller",
|
||||
0,
|
||||
FDC_FLAG_NSDP,
|
||||
fdc_init,
|
||||
fdc_close,
|
||||
fdc_reset,
|
||||
NULL, NULL, NULL
|
||||
};
|
||||
|
221
src/floppy/fdc_pii15xb.c
Normal file
221
src/floppy/fdc_pii15xb.c
Normal file
@@ -0,0 +1,221 @@
|
||||
/*
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Implementation of the DTK PII-151B and PII-158B cards.
|
||||
*
|
||||
* These are DP8473-based floppy controller ISA cards for XT
|
||||
* class systems, and allow usage of standard and high-density
|
||||
* drives on them. They have their own BIOS which takes over
|
||||
* from the standard system BIOS.
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2019 Fred N. van Kempen.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with
|
||||
* or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the entire
|
||||
* above notice, this list of conditions and the following
|
||||
* disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names
|
||||
* of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#define _LARGEFILE_SOURCE
|
||||
#define _LARGEFILE64_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#define HAVE_STDARG_H
|
||||
#include <86box/86box.h>
|
||||
#include <86box/device.h>
|
||||
#include <86box/io.h>
|
||||
#include <86box/mem.h>
|
||||
#include <86box/pic.h>
|
||||
#include <86box/rom.h>
|
||||
#include <86box/machine.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/plat.h>
|
||||
#include <86box/ui.h>
|
||||
#include <86box/fdc.h>
|
||||
#include <86box/fdd.h>
|
||||
#include <86box/fdc_pii15xb.h>
|
||||
|
||||
#define ROM_PII_151B L"floppy/dtk/pii-151b.rom"
|
||||
#define ROM_PII_158B L"floppy/dtk/pii-158b.rom"
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
int type;
|
||||
|
||||
uint32_t bios_addr,
|
||||
bios_size;
|
||||
rom_t bios_rom;
|
||||
|
||||
fdc_t *fdc;
|
||||
} pii_t;
|
||||
|
||||
|
||||
/* Load and enable a BIOS ROM if we have one, and is enabled. */
|
||||
static void
|
||||
set_bios(pii_t *dev, const wchar_t *fn)
|
||||
{
|
||||
uint32_t temp;
|
||||
FILE *fp;
|
||||
|
||||
/* Only do this if needed. */
|
||||
if ((fn == NULL) || (dev->bios_addr == 0)) return;
|
||||
|
||||
if ((fp = rom_fopen(fn, L"rb")) == NULL) return;
|
||||
|
||||
(void)fseek(fp, 0L, SEEK_END);
|
||||
temp = ftell(fp);
|
||||
(void)fclose(fp);
|
||||
|
||||
/* Assume 128K, then go down. */
|
||||
dev->bios_size = 0x020000;
|
||||
while (temp < dev->bios_size)
|
||||
dev->bios_size >>= 1;
|
||||
|
||||
/* Create a memory mapping for the space. */
|
||||
rom_init(&dev->bios_rom, fn, dev->bios_addr,
|
||||
dev->bios_size, dev->bios_size-1, 0, MEM_MAPPING_EXTERNAL);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
pii_close(void *priv)
|
||||
{
|
||||
pii_t *dev = (pii_t *)priv;
|
||||
|
||||
free(dev);
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
pii_init(const device_t *info)
|
||||
{
|
||||
pii_t *dev;
|
||||
|
||||
dev = (pii_t *)mem_alloc(sizeof(pii_t));
|
||||
memset(dev, 0x00, sizeof(pii_t));
|
||||
dev->type = info->local;
|
||||
|
||||
dev->bios_addr = device_get_config_hex20("bios_addr");
|
||||
|
||||
if (dev->bios_addr != 0x000000) {
|
||||
switch (dev->type)
|
||||
case 151:
|
||||
set_bios(dev, ROM_PII_151B);
|
||||
break;
|
||||
case 158:
|
||||
set_bios(dev, ROM_PII_158B);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Attach the DP8473 chip. */
|
||||
dev->fdc = device_add(&fdc_dp8473_device);
|
||||
|
||||
//pclog("FDC: %s (I/O=%04X, flags=%08x)\n",
|
||||
// info->name, dev->fdc->base_address, dev->fdc->flags);
|
||||
|
||||
return(dev);
|
||||
}
|
||||
|
||||
static int pii_151b_available(void)
|
||||
{
|
||||
return rom_present(ROM_PII_151B);
|
||||
}
|
||||
|
||||
static int pii_158_available(void)
|
||||
{
|
||||
return rom_present(ROM_PII_158B);
|
||||
}
|
||||
|
||||
static const device_config_t pii_config[] = {
|
||||
{
|
||||
"bios_addr", "BIOS address", CONFIG_HEX20, "", 0x0ce000,
|
||||
{
|
||||
{
|
||||
"Disabled", 0
|
||||
},
|
||||
{
|
||||
"CA00H", 0x0ca000
|
||||
},
|
||||
{
|
||||
"CC00H", 0x0cc000
|
||||
},
|
||||
{
|
||||
"CE00H", 0x0ce000
|
||||
},
|
||||
{
|
||||
""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"speed", "Drive Speed", CONFIG_SELECTION, "", 0,
|
||||
{
|
||||
{
|
||||
"Single", 0
|
||||
},
|
||||
{
|
||||
"Dual", 1
|
||||
},
|
||||
{
|
||||
""
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"", "", -1
|
||||
}
|
||||
};
|
||||
|
||||
const device_t fdc_pii151b_device = {
|
||||
"DTK PII-151B (MiniMicro) Floppy Drive Controller",
|
||||
DEVICE_ISA,
|
||||
151,
|
||||
pii_init, pii_close, NULL,
|
||||
pii_151b_available, NULL, NULL,
|
||||
pii_config
|
||||
};
|
||||
|
||||
const device_t fdc_pii158b_device = {
|
||||
"DTK PII-158B (MiniMicro4) Floppy Drive Controller",
|
||||
DEVICE_ISA,
|
||||
158,
|
||||
pii_init, pii_close, NULL,
|
||||
pii_158_available, NULL, NULL,
|
||||
pii_config
|
||||
};
|
@@ -117,7 +117,8 @@ typedef struct {
|
||||
parallel_enabled[3]; /* LPT1, LPT2, LPT3 enabled */
|
||||
|
||||
/* Other peripherals category */
|
||||
int hdc, /* Hard disk controller */
|
||||
int fdc_type, /* Floppy disk controller type */
|
||||
hdc, /* Hard disk controller */
|
||||
scsi_card, /* SCSI controller */
|
||||
ide_ter_enabled, /* Tertiary IDE controller enabled */
|
||||
ide_qua_enabled, /* Quaternary IDE controller enabled */
|
||||
|
@@ -22,6 +22,11 @@
|
||||
#ifndef EMU_FDC_H
|
||||
# define EMU_FDC_H
|
||||
|
||||
extern int fdc_type;
|
||||
|
||||
/* Controller types. */
|
||||
#define FDC_NONE 0
|
||||
#define FDC_INTERNAL 1
|
||||
|
||||
#define FDC_FLAG_PCJR 0x01 /* PCjr */
|
||||
#define FDC_FLAG_DISKCHG_ACTLOW 0x02 /* Amstrad, PS/1, PS/2 ISA */
|
||||
@@ -33,6 +38,7 @@
|
||||
#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_NSDP 0x400 /* DP8473N, DP8473V */
|
||||
|
||||
|
||||
typedef struct {
|
||||
@@ -178,7 +184,15 @@ extern const device_t fdc_at_ps1_device;
|
||||
extern const device_t fdc_at_smc_device;
|
||||
extern const device_t fdc_at_winbond_device;
|
||||
extern const device_t fdc_at_nsc_device;
|
||||
extern const device_t fdc_dp8473_device;
|
||||
#endif
|
||||
|
||||
extern char *fdc_ext_get_name(int fdc_ext);
|
||||
extern char *fdc_ext_get_internal_name(int fdc_ext);
|
||||
extern int fdc_ext_get_id(char *s);
|
||||
extern int fdc_ext_get_from_internal_name(char *s);
|
||||
extern const device_t *fdc_ext_get_device(int fdc_ext);
|
||||
extern int fdc_ext_has_config(int fdc_ext);
|
||||
extern int fdc_ext_available(int fdc_ext);
|
||||
|
||||
#endif /*EMU_FDC_H*/
|
||||
|
56
src/include/86box/fdc_pii15xb.h
Normal file
56
src/include/86box/fdc_pii15xb.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* VARCem Virtual ARchaeological Computer EMulator.
|
||||
* An emulator of (mostly) x86-based PC systems and devices,
|
||||
* using the ISA,EISA,VLB,MCA and PCI system buses, roughly
|
||||
* spanning the era between 1981 and 1995.
|
||||
*
|
||||
* This file is part of the VARCem Project.
|
||||
*
|
||||
* Implementation of the DTK PII-151B and PII-158B cards.
|
||||
*
|
||||
* These are DP8473-based floppy controller ISA cards for XT
|
||||
* class systems, and allow usage of standard and high-density
|
||||
* drives on them. They have their own BIOS which takes over
|
||||
* from the standard system BIOS.
|
||||
*
|
||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||
*
|
||||
* Copyright 2019 Fred N. van Kempen.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with
|
||||
* or without modification, are permitted provided that the
|
||||
* following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the entire
|
||||
* above notice, this list of conditions and the following
|
||||
* disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer in the documentation and/or other
|
||||
* materials provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names
|
||||
* of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
#ifndef FLOPPY_PII15XB_H
|
||||
# define FLOPPY_PII15XB_H
|
||||
|
||||
extern const device_t fdc_pii151b_device;
|
||||
extern const device_t fdc_pii158b_device;
|
||||
|
||||
#endif /*FLOPPY_PII15XB_H*/
|
@@ -40,6 +40,8 @@
|
||||
#define MACHINE_MOUSE 0x008000 /* sys has int mouse */
|
||||
#define MACHINE_SOUND 0x010000 /* sys has int sound */
|
||||
#define MACHINE_NONMI 0x020000 /* sys does not have NMI's */
|
||||
#define MACHINE_FDC 0x040000 /* sys has int FDC */
|
||||
#define MACHINE_FDC_FIXED 0x080000 /* sys has ONLY int FDC */
|
||||
#else
|
||||
#define MACHINE_PC 0x000000 /* PC architecture */
|
||||
#define MACHINE_AT 0x000001 /* PC/AT architecture */
|
||||
@@ -57,6 +59,8 @@
|
||||
#define MACHINE_MOUSE 0x008000 /* sys has int mouse */
|
||||
#define MACHINE_SOUND 0x010000 /* sys has int sound */
|
||||
#define MACHINE_NONMI 0x020000 /* sys does not have NMI's */
|
||||
#define MACHINE_FDC 0x040000 /* sys has int FDC */
|
||||
#define MACHINE_FDC_FIXED 0x080000 /* sys has ONLY int FDC */
|
||||
#endif
|
||||
|
||||
#define IS_ARCH(m, a) (machines[(m)].flags & (a)) ? 1 : 0;
|
||||
|
@@ -99,6 +99,7 @@
|
||||
#define IDT_1765 1765 /* Board #3: */
|
||||
#define IDT_1766 1766 /* Board #4: */
|
||||
#define IDT_1767 1767 /* ISA RTC: */
|
||||
#define IDT_1768 1768 /* Ext FD Controller: */
|
||||
|
||||
|
||||
/*
|
||||
@@ -180,6 +181,8 @@
|
||||
#define IDC_CHECK_POSTCARD 1130
|
||||
#define IDC_COMBO_ISARTC 1131
|
||||
#define IDC_CONFIGURE_ISARTC 1132
|
||||
#define IDC_COMBO_FDC_EXT 1133
|
||||
#define IDC_CONFIGURE_FDC_EXT 1134
|
||||
#define IDC_GROUP_ISAMEM 1140
|
||||
#define IDC_COMBO_ISAMEM_1 1141
|
||||
#define IDC_COMBO_ISAMEM_2 1142
|
||||
|
@@ -551,7 +551,12 @@ BEGIN
|
||||
LTEXT "#4:",IDT_1766,12,172,21,10
|
||||
COMBOBOX IDC_COMBO_ISAMEM_4,25,171,190,120,
|
||||
CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
PUSHBUTTON "Configure",IDC_CONFIGURE_ISAMEM_4,217,171,38,12
|
||||
PUSHBUTTON "Configure",IDC_CONFIGURE_ISAMEM_4,217,171,38,12
|
||||
|
||||
LTEXT "External FD Controller:",IDT_1768,7,190,48,10
|
||||
COMBOBOX IDC_COMBO_FDC_EXT,64,189,155,120,CBS_DROPDOWNLIST |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
PUSHBUTTON "Configure",IDC_CONFIGURE_FDC_EXT,217,185,38,12
|
||||
END
|
||||
|
||||
DLG_CFG_HARD_DISKS DIALOG DISCARDABLE 97, 0, 267, 154
|
||||
|
@@ -51,6 +51,7 @@
|
||||
#include <86box/hdc.h>
|
||||
#include <86box/hdc_ide.h>
|
||||
#include <86box/zip.h>
|
||||
#include <86box/fdc.h>
|
||||
#include <86box/fdd.h>
|
||||
#include <86box/network.h>
|
||||
#include <86box/sound.h>
|
||||
@@ -95,7 +96,7 @@ static int temp_lpt_devices[3];
|
||||
static int temp_serial[2], temp_lpt[3];
|
||||
|
||||
/* Other peripherals category */
|
||||
static int temp_hdc, temp_scsi_card, temp_ide_ter, temp_ide_qua;
|
||||
static int temp_fdc_ext, temp_hdc, temp_scsi_card, temp_ide_ter, temp_ide_qua;
|
||||
static int temp_bugger;
|
||||
static int temp_postcard;
|
||||
static int temp_isartc;
|
||||
@@ -247,6 +248,7 @@ win_settings_init(void)
|
||||
|
||||
/* Other peripherals category */
|
||||
temp_scsi_card = scsi_card_current;
|
||||
temp_fdc_ext = fdc_type;
|
||||
temp_hdc = hdc_current;
|
||||
temp_ide_ter = ide_ter_enabled;
|
||||
temp_ide_qua = ide_qua_enabled;
|
||||
@@ -356,6 +358,7 @@ win_settings_changed(void)
|
||||
|
||||
/* Peripherals category */
|
||||
i = i || (scsi_card_current != temp_scsi_card);
|
||||
i = i || (fdc_type != temp_fdc_ext);
|
||||
i = i || (hdc_current != temp_hdc);
|
||||
i = i || (temp_ide_ter != ide_ter_enabled);
|
||||
i = i || (temp_ide_qua != ide_qua_enabled);
|
||||
@@ -462,6 +465,7 @@ win_settings_save(void)
|
||||
/* Peripherals category */
|
||||
scsi_card_current = temp_scsi_card;
|
||||
hdc_current = temp_hdc;
|
||||
fdc_type = temp_fdc_ext;
|
||||
ide_ter_enabled = temp_ide_ter;
|
||||
ide_qua_enabled = temp_ide_qua;
|
||||
bugger_enabled = temp_bugger;
|
||||
@@ -1584,6 +1588,48 @@ win_settings_ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
recalc_fdc_list(HWND hdlg)
|
||||
{
|
||||
HWND h = GetDlgItem(hdlg, IDC_COMBO_FDC_EXT);
|
||||
int c = 0, d = 0;
|
||||
int found_card = 0;
|
||||
WCHAR szText[512];
|
||||
|
||||
SendMessage(h, CB_RESETCONTENT, 0, 0);
|
||||
SendMessage(h, CB_SETCURSEL, 0, 0);
|
||||
|
||||
while (1) {
|
||||
/* Skip "internal" if machine doesn't have it. */
|
||||
if ((c == 1) && !(machines[temp_machine].flags & MACHINE_FDC)) {
|
||||
c++;
|
||||
continue;
|
||||
}
|
||||
|
||||
char *s = fdc_ext_get_name(c);
|
||||
|
||||
if (!s[0])
|
||||
break;
|
||||
|
||||
if (fdc_ext_available(c) &&
|
||||
device_is_valid(fdc_ext_get_device(c), machines[temp_machine].flags)) {
|
||||
mbstowcs(szText, s, strlen(s) + 1);
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) szText);
|
||||
if (c == temp_fdc_ext) {
|
||||
SendMessage(h, CB_SETCURSEL, d, 0);
|
||||
found_card = 1;
|
||||
}
|
||||
|
||||
d++;
|
||||
}
|
||||
|
||||
c++;
|
||||
}
|
||||
if (!found_card)
|
||||
SendMessage(h, CB_SETCURSEL, 0, 0);
|
||||
EnableWindow(h, (machines[temp_machine].flags & MACHINE_FDC_FIXED) ? FALSE : TRUE);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
recalc_hdc_list(HWND hdlg)
|
||||
@@ -1648,6 +1694,15 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa
|
||||
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
|
||||
stransi = (char *) malloc(512);
|
||||
|
||||
/*FD (Ext) controller config*/
|
||||
recalc_fdc_list(hdlg);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_CONFIGURE_FDC_EXT);
|
||||
if (fdc_ext_has_config(temp_fdc_ext))
|
||||
EnableWindow(h, TRUE);
|
||||
else
|
||||
EnableWindow(h, FALSE);
|
||||
|
||||
/*HD controller config*/
|
||||
recalc_hdc_list(hdlg);
|
||||
|
||||
@@ -1776,6 +1831,38 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa
|
||||
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDC_CONFIGURE_FDC_EXT:
|
||||
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
|
||||
stransi = (char *) malloc(512);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_FDC_EXT);
|
||||
SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp);
|
||||
wcstombs(stransi, lptsTemp, 512);
|
||||
temp_deviceconfig |= deviceconfig_open(hdlg, (void *)fdc_ext_get_device(fdc_ext_get_id(stransi)));
|
||||
|
||||
free(stransi);
|
||||
free(lptsTemp);
|
||||
break;
|
||||
|
||||
case IDC_COMBO_FDC_EXT:
|
||||
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
|
||||
stransi = (char *) malloc(512);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_FDC_EXT);
|
||||
SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp);
|
||||
wcstombs(stransi, lptsTemp, 512);
|
||||
temp_fdc_ext = fdc_ext_get_id(stransi);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_CONFIGURE_FDC_EXT);
|
||||
if (fdc_ext_has_config(temp_fdc_ext))
|
||||
EnableWindow(h, TRUE);
|
||||
else
|
||||
EnableWindow(h, FALSE);
|
||||
|
||||
free(stransi);
|
||||
free(lptsTemp);
|
||||
break;
|
||||
|
||||
case IDC_CONFIGURE_HDC:
|
||||
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
|
||||
stransi = (char *) malloc(512);
|
||||
@@ -1898,6 +1985,11 @@ win_settings_peripherals_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lPa
|
||||
lptsTemp = (LPTSTR) malloc(512 * sizeof(WCHAR));
|
||||
stransi = (char *) malloc(512);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_FDC_EXT);
|
||||
SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp);
|
||||
wcstombs(stransi, lptsTemp, 512);
|
||||
temp_fdc_ext = fdc_ext_get_id(stransi);
|
||||
|
||||
h = GetDlgItem(hdlg, IDC_COMBO_HDC);
|
||||
SendMessage(h, CB_GETLBTEXT, SendMessage(h, CB_GETCURSEL, 0, 0), (LPARAM) lptsTemp);
|
||||
wcstombs(stransi, lptsTemp, 512);
|
||||
|
Reference in New Issue
Block a user