Added Iomega ZIP emulation.

This commit is contained in:
OBattler
2018-01-26 22:17:09 +01:00
parent 45e55a7163
commit 410ecb1f22
28 changed files with 5050 additions and 405 deletions

View File

@@ -8,7 +8,7 @@
* *
* Configuration file handler. * Configuration file handler.
* *
* Version: @(#)config.c 1.0.37 2018/01/16 * Version: @(#)config.c 1.0.38 2018/01/21
* *
* Authors: Sarah Walker, * Authors: Sarah Walker,
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -36,6 +36,7 @@
#include "device.h" #include "device.h"
#include "lpt.h" #include "lpt.h"
#include "cdrom/cdrom.h" #include "cdrom/cdrom.h"
#include "zip.h"
#include "disk/hdd.h" #include "disk/hdd.h"
#include "disk/hdc.h" #include "disk/hdc.h"
#include "disk/hdc_ide.h" #include "disk/hdc_ide.h"
@@ -452,7 +453,7 @@ load_general(void)
#ifdef USE_LANGUAGE #ifdef USE_LANGUAGE
/* /*
* Currently, 86Box is English (US) only, but in the future * Currently, 86Box is English (US) only, but in the future
* (version 1.30 at the earliest) other languages will be * (version 3.0 at the earliest) other languages will be
* added, therefore it is better to future-proof the code. * added, therefore it is better to future-proof the code.
*/ */
plat_langid = config_get_hex16(cat, "language", 0x0409); plat_langid = config_get_hex16(cat, "language", 0x0409);
@@ -938,7 +939,7 @@ load_hard_disks(void)
} }
/* Load "Removable Devices" section. */ /* Load old "Removable Devices" section. */
static void static void
load_removable_devices(void) load_removable_devices(void)
{ {
@@ -949,6 +950,180 @@ load_removable_devices(void)
wchar_t *wp; wchar_t *wp;
int c; int c;
if (find_section(cat) == NULL)
return;
for (c=0; c<FDD_NUM; c++) {
sprintf(temp, "fdd_%02i_type", c+1);
p = config_get_string(cat, temp, (c < 2) ? "525_2dd" : "none");
fdd_set_type(c, fdd_get_from_internal_name(p));
if (fdd_get_type(c) > 13)
fdd_set_type(c, 13);
sprintf(temp, "fdd_%02i_fn", c + 1);
wp = config_get_wstring(cat, temp, L"");
#if 0
/*
* NOTE:
* Temporary hack to remove the absolute
* path currently saved in most config
* files. We should remove this before
* finalizing this release! --FvK
*/
if (! wcsnicmp(wp, usr_path, wcslen(usr_path))) {
/*
* Yep, its absolute and prefixed
* with the EXE path. Just strip
* that off for now...
*/
wcsncpy(floppyfns[c], &wp[wcslen(usr_path)], sizeof_w(floppyfns[c]));
} else
#endif
wcsncpy(floppyfns[c], wp, sizeof_w(floppyfns[c]));
/* if (*wp != L'\0')
pclog("Floppy%d: %ls\n", c, floppyfns[c]); */
sprintf(temp, "fdd_%02i_writeprot", c+1);
ui_writeprot[c] = !!config_get_int(cat, temp, 0);
sprintf(temp, "fdd_%02i_turbo", c + 1);
fdd_set_turbo(c, !!config_get_int(cat, temp, 0));
sprintf(temp, "fdd_%02i_check_bpb", c+1);
fdd_set_check_bpb(c, !!config_get_int(cat, temp, 1));
/* Check whether each value is default, if yes, delete it so that only non-default values will later be saved. */
sprintf(temp, "fdd_%02i_type", c+1);
config_delete_var(cat, temp);
sprintf(temp, "fdd_%02i_fn", c+1);
config_delete_var(cat, temp);
sprintf(temp, "fdd_%02i_writeprot", c+1);
config_delete_var(cat, temp);
sprintf(temp, "fdd_%02i_turbo", c+1);
config_delete_var(cat, temp);
sprintf(temp, "fdd_%02i_check_bpb", c+1);
config_delete_var(cat, temp);
}
memset(temp, 0x00, sizeof(temp));
for (c=0; c<CDROM_NUM; c++) {
sprintf(temp, "cdrom_%02i_host_drive", c+1);
cdrom_drives[c].host_drive = config_get_int(cat, temp, 0);
cdrom_drives[c].prev_host_drive = cdrom_drives[c].host_drive;
sprintf(temp, "cdrom_%02i_parameters", c+1);
p = config_get_string(cat, temp, NULL);
if (p != NULL)
sscanf(p, "%u, %s", &cdrom_drives[c].sound_on, s);
else
sscanf("0, none", "%u, %s", &cdrom_drives[c].sound_on, s);
cdrom_drives[c].bus_type = hdd_string_to_bus(s, 1);
/* Default values, needed for proper operation of the Settings dialog. */
cdrom_drives[c].ide_channel = cdrom_drives[c].scsi_device_id = c + 2;
sprintf(temp, "cdrom_%02i_ide_channel", c+1);
if ((cdrom_drives[c].bus_type == CDROM_BUS_ATAPI_PIO_ONLY) ||
(cdrom_drives[c].bus_type == CDROM_BUS_ATAPI_PIO_AND_DMA)) {
sprintf(tmp2, "%01u:%01u", (c+2)>>1, (c+2)&1);
p = config_get_string(cat, temp, tmp2);
if (! strstr(p, ":")) {
sscanf(p, "%i", (int *)&cdrom_drives[c].ide_channel);
cdrom_drives[c].ide_channel &= 7;
} else {
sscanf(p, "%01u:%01u", &board, &dev);
board &= 3;
dev &= 1;
cdrom_drives[c].ide_channel = (board<<1)+dev;
}
if (cdrom_drives[c].ide_channel > 7)
cdrom_drives[c].ide_channel = 7;
} else {
sprintf(temp, "cdrom_%02i_scsi_location", c+1);
if (cdrom_drives[c].bus_type == CDROM_BUS_SCSI) {
sprintf(tmp2, "%02u:%02u", c+2, 0);
p = config_get_string(cat, temp, tmp2);
sscanf(p, "%02u:%02u",
&cdrom_drives[c].scsi_device_id,
&cdrom_drives[c].scsi_device_lun);
if (cdrom_drives[c].scsi_device_id > 15)
cdrom_drives[c].scsi_device_id = 15;
if (cdrom_drives[c].scsi_device_lun > 7)
cdrom_drives[c].scsi_device_lun = 7;
} else {
config_delete_var(cat, temp);
}
}
sprintf(temp, "cdrom_%02i_image_path", c+1);
wp = config_get_wstring(cat, temp, L"");
#if 0
/*
* NOTE:
* Temporary hack to remove the absolute
* path currently saved in most config
* files. We should remove this before
* finalizing this release! --FvK
*/
if (! wcsnicmp(wp, usr_path, wcslen(usr_path))) {
/*
* Yep, its absolute and prefixed
* with the EXE path. Just strip
* that off for now...
*/
wcsncpy(cdrom_image[c].image_path, &wp[wcslen(usr_path)], sizeof_w(cdrom_image[c].image_path));
} else
#endif
wcsncpy(cdrom_image[c].image_path, wp, sizeof_w(cdrom_image[c].image_path));
wcscpy(cdrom_image[c].prev_image_path, cdrom_image[c].image_path);
if (cdrom_drives[c].host_drive < 'A')
cdrom_drives[c].host_drive = 0;
if ((cdrom_drives[c].host_drive == 0x200) &&
(wcslen(cdrom_image[c].image_path) == 0))
cdrom_drives[c].host_drive = 0;
/* If the CD-ROM is disabled, delete all its variables. */
sprintf(temp, "cdrom_%02i_host_drive", c+1);
config_delete_var(cat, temp);
sprintf(temp, "cdrom_%02i_parameters", c+1);
config_delete_var(cat, temp);
sprintf(temp, "cdrom_%02i_ide_channel", c+1);
config_delete_var(cat, temp);
sprintf(temp, "cdrom_%02i_scsi_location", c+1);
config_delete_var(cat, temp);
sprintf(temp, "cdrom_%02i_image_path", c+1);
config_delete_var(cat, temp);
sprintf(temp, "cdrom_%02i_iso_path", c+1);
config_delete_var(cat, temp);
}
delete_section_if_empty(cat);
}
/* Load "Floppy Drives" section. */
static void
load_floppy_drives(void)
{
char *cat = "Floppy drives";
char temp[512], *p;
wchar_t *wp;
int c;
for (c=0; c<FDD_NUM; c++) { for (c=0; c<FDD_NUM; c++) {
sprintf(temp, "fdd_%02i_type", c+1); sprintf(temp, "fdd_%02i_type", c+1);
p = config_get_string(cat, temp, (c < 2) ? "525_2dd" : "none"); p = config_get_string(cat, temp, (c < 2) ? "525_2dd" : "none");
@@ -1009,6 +1184,19 @@ load_removable_devices(void)
config_delete_var(cat, temp); config_delete_var(cat, temp);
} }
} }
}
/* Load "Other Removable Devices" section. */
static void
load_other_removable_devices(void)
{
char *cat = "Other removable devices";
char temp[512], tmp2[512], *p;
char s[512];
unsigned int board = 0, dev = 0;
wchar_t *wp;
int c;
memset(temp, 0x00, sizeof(temp)); memset(temp, 0x00, sizeof(temp));
for (c=0; c<CDROM_NUM; c++) { for (c=0; c<CDROM_NUM; c++) {
@@ -1114,6 +1302,99 @@ load_removable_devices(void)
sprintf(temp, "cdrom_%02i_iso_path", c+1); sprintf(temp, "cdrom_%02i_iso_path", c+1);
config_delete_var(cat, temp); config_delete_var(cat, temp);
} }
memset(temp, 0x00, sizeof(temp));
for (c=0; c<ZIP_NUM; c++) {
sprintf(temp, "zip_%02i_parameters", c+1);
p = config_get_string(cat, temp, NULL);
if (p != NULL)
sscanf(p, "%u, %s", &zip_drives[c].is_250, s);
else
sscanf("0, none", "%u, %s", &zip_drives[c].is_250, s);
zip_drives[c].bus_type = hdd_string_to_bus(s, 1);
/* Default values, needed for proper operation of the Settings dialog. */
zip_drives[c].ide_channel = zip_drives[c].scsi_device_id = c + 2;
sprintf(temp, "zip_%02i_ide_channel", c+1);
if ((zip_drives[c].bus_type == ZIP_BUS_ATAPI_PIO_ONLY) ||
(zip_drives[c].bus_type == ZIP_BUS_ATAPI_PIO_AND_DMA)) {
sprintf(tmp2, "%01u:%01u", (c+2)>>1, (c+2)&1);
p = config_get_string(cat, temp, tmp2);
if (! strstr(p, ":")) {
sscanf(p, "%i", (int *)&zip_drives[c].ide_channel);
zip_drives[c].ide_channel &= 7;
} else {
sscanf(p, "%01u:%01u", &board, &dev);
board &= 3;
dev &= 1;
zip_drives[c].ide_channel = (board<<1)+dev;
}
if (zip_drives[c].ide_channel > 7)
zip_drives[c].ide_channel = 7;
} else {
sprintf(temp, "zip_%02i_scsi_location", c+1);
if (zip_drives[c].bus_type == CDROM_BUS_SCSI) {
sprintf(tmp2, "%02u:%02u", c+2, 0);
p = config_get_string(cat, temp, tmp2);
sscanf(p, "%02u:%02u",
&zip_drives[c].scsi_device_id,
&zip_drives[c].scsi_device_lun);
if (zip_drives[c].scsi_device_id > 15)
zip_drives[c].scsi_device_id = 15;
if (zip_drives[c].scsi_device_lun > 7)
zip_drives[c].scsi_device_lun = 7;
} else {
config_delete_var(cat, temp);
}
}
sprintf(temp, "zip_%02i_image_path", c+1);
wp = config_get_wstring(cat, temp, L"");
#if 0
/*
* NOTE:
* Temporary hack to remove the absolute
* path currently saved in most config
* files. We should remove this before
* finalizing this release! --FvK
*/
if (! wcsnicmp(wp, usr_path, wcslen(usr_path))) {
/*
* Yep, its absolute and prefixed
* with the EXE path. Just strip
* that off for now...
*/
wcsncpy(zip_drives[c].image_path, &wp[wcslen(usr_path)], sizeof_w(zip_drives[c].image_path));
} else
#endif
wcsncpy(zip_drives[c].image_path, wp, sizeof_w(zip_drives[c].image_path));
/* If the CD-ROM is disabled, delete all its variables. */
if (zip_drives[c].bus_type == ZIP_BUS_DISABLED) {
sprintf(temp, "zip_%02i_host_drive", c+1);
config_delete_var(cat, temp);
sprintf(temp, "zip_%02i_parameters", c+1);
config_delete_var(cat, temp);
sprintf(temp, "zip_%02i_ide_channel", c+1);
config_delete_var(cat, temp);
sprintf(temp, "zip_%02i_scsi_location", c+1);
config_delete_var(cat, temp);
sprintf(temp, "zip_%02i_image_path", c+1);
config_delete_var(cat, temp);
}
sprintf(temp, "zip_%02i_iso_path", c+1);
config_delete_var(cat, temp);
}
} }
@@ -1150,16 +1431,18 @@ config_load(void)
return; return;
} }
load_general(); /* General */ load_general(); /* General */
load_machine(); /* Machine */ load_machine(); /* Machine */
load_video(); /* Video */ load_video(); /* Video */
load_input_devices(); /* Input devices */ load_input_devices(); /* Input devices */
load_sound(); /* Sound */ load_sound(); /* Sound */
load_network(); /* Network */ load_network(); /* Network */
load_ports(); /* Ports (COM & LPT) */ load_ports(); /* Ports (COM & LPT) */
load_other_peripherals(); /* Other peripherals */ load_other_peripherals(); /* Other peripherals */
load_hard_disks(); /* Hard disks */ load_hard_disks(); /* Hard disks */
load_removable_devices(); /* Removable devices */ load_floppy_drives(); /* Floppy drives */
load_other_removable_devices(); /* Other removable devices */
load_removable_devices(); /* Removable devices (legacy) */
/* Mark the configuration as changed. */ /* Mark the configuration as changed. */
config_changed = 1; config_changed = 1;
@@ -1606,12 +1889,12 @@ save_hard_disks(void)
} }
/* Save "Removable Devices" section. */ /* Save "Floppy Drives" section. */
static void static void
save_removable_devices(void) save_floppy_drives(void)
{ {
char *cat = "Removable devices"; char *cat = "Floppy drives";
char temp[512], tmp2[512]; char temp[512];
int c; int c;
for (c=0; c<FDD_NUM; c++) { for (c=0; c<FDD_NUM; c++) {
@@ -1653,6 +1936,18 @@ save_removable_devices(void)
config_set_int(cat, temp, fdd_get_check_bpb(c)); config_set_int(cat, temp, fdd_get_check_bpb(c));
} }
delete_section_if_empty(cat);
}
/* Save "Other Removable Devices" section. */
static void
save_other_removable_devices(void)
{
char *cat = "Other removable devices";
char temp[512], tmp2[512];
int c;
for (c=0; c<CDROM_NUM; c++) { for (c=0; c<CDROM_NUM; c++) {
sprintf(temp, "cdrom_%02i_host_drive", c+1); sprintf(temp, "cdrom_%02i_host_drive", c+1);
if ((cdrom_drives[c].bus_type == 0) || if ((cdrom_drives[c].bus_type == 0) ||
@@ -1699,6 +1994,44 @@ save_removable_devices(void)
} }
} }
for (c=0; c<ZIP_NUM; c++) {
sprintf(temp, "zip_%02i_parameters", c+1);
if (zip_drives[c].bus_type == 0) {
config_delete_var(cat, temp);
} else {
sprintf(tmp2, "%u, %s", zip_drives[c].is_250,
hdd_bus_to_string(zip_drives[c].bus_type, 1));
config_set_string(cat, temp, tmp2);
}
sprintf(temp, "zip_%02i_ide_channel", c+1);
if ((zip_drives[c].bus_type != ZIP_BUS_ATAPI_PIO_ONLY) &&
(zip_drives[c].bus_type != ZIP_BUS_ATAPI_PIO_AND_DMA)) {
config_delete_var(cat, temp);
} else {
sprintf(tmp2, "%01u:%01u", zip_drives[c].ide_channel>>1,
zip_drives[c].ide_channel & 1);
config_set_string(cat, temp, tmp2);
}
sprintf(temp, "zip_%02i_scsi_location", c + 1);
if (zip_drives[c].bus_type != ZIP_BUS_SCSI) {
config_delete_var(cat, temp);
} else {
sprintf(tmp2, "%02u:%02u", zip_drives[c].scsi_device_id,
zip_drives[c].scsi_device_lun);
config_set_string(cat, temp, tmp2);
}
sprintf(temp, "zip_%02i_image_path", c + 1);
if ((zip_drives[c].bus_type == 0) ||
(wcslen(zip_drives[c].image_path) == 0)) {
config_delete_var(cat, temp);
} else {
config_set_wstring(cat, temp, zip_drives[c].image_path);
}
}
delete_section_if_empty(cat); delete_section_if_empty(cat);
} }
@@ -1706,16 +2039,17 @@ save_removable_devices(void)
void void
config_save(void) config_save(void)
{ {
save_general(); /* General */ save_general(); /* General */
save_machine(); /* Machine */ save_machine(); /* Machine */
save_video(); /* Video */ save_video(); /* Video */
save_input_devices(); /* Input devices */ save_input_devices(); /* Input devices */
save_sound(); /* Sound */ save_sound(); /* Sound */
save_network(); /* Network */ save_network(); /* Network */
save_ports(); /* Ports (COM & LPT) */ save_ports(); /* Ports (COM & LPT) */
save_other_peripherals(); /* Other peripherals */ save_other_peripherals(); /* Other peripherals */
save_hard_disks(); /* Hard disks */ save_hard_disks(); /* Hard disks */
save_removable_devices(); /* Removable devices */ save_floppy_drives(); /* Floppy drives */
save_other_removable_devices(); /* Other removable devices */
config_write(cfg_path); config_write(cfg_path);
} }

View File

@@ -329,7 +329,7 @@ CPU cpus_Pentium5V50[] = {
CPU cpus_PentiumS5[] = { CPU cpus_PentiumS5[] = {
/*Intel Pentium (Socket 5)*/ /*Intel Pentium (Socket 5)*/
{"Pentium 75", CPU_PENTIUM, 9, 75000000, 2, 25000000, 0x524, 0x524, 0, CPU_SUPPORTS_DYNAREC | CPU_REQUIRES_DYNAREC, 7,7,4,4}, {"Pentium 75", CPU_PENTIUM, 9, 75000000, 2, 25000000, 0x522, 0x522, 0, CPU_SUPPORTS_DYNAREC | CPU_REQUIRES_DYNAREC, 7,7,4,4},
{"Pentium OverDrive MMX 75",CPU_PENTIUMMMX,9,75000000,2,25000000,0x1542,0x1542, 0, CPU_SUPPORTS_DYNAREC | CPU_REQUIRES_DYNAREC, 7,7,4,4}, {"Pentium OverDrive MMX 75",CPU_PENTIUMMMX,9,75000000,2,25000000,0x1542,0x1542, 0, CPU_SUPPORTS_DYNAREC | CPU_REQUIRES_DYNAREC, 7,7,4,4},
{"Pentium 90", CPU_PENTIUM, 12, 90000000, 2, 30000000, 0x524, 0x524, 0, CPU_SUPPORTS_DYNAREC | CPU_REQUIRES_DYNAREC, 9,9,4,4}, {"Pentium 90", CPU_PENTIUM, 12, 90000000, 2, 30000000, 0x524, 0x524, 0, CPU_SUPPORTS_DYNAREC | CPU_REQUIRES_DYNAREC, 9,9,4,4},
{"Pentium 100/50", CPU_PENTIUM, 13, 100000000, 2, 25000000, 0x524, 0x524, 0, CPU_SUPPORTS_DYNAREC | CPU_REQUIRES_DYNAREC, 10,10,6,6}, {"Pentium 100/50", CPU_PENTIUM, 13, 100000000, 2, 25000000, 0x524, 0x524, 0, CPU_SUPPORTS_DYNAREC | CPU_REQUIRES_DYNAREC, 10,10,6,6},

File diff suppressed because it is too large Load Diff

View File

@@ -10,7 +10,7 @@
* *
* NOTE: FIXME: Strings 2176 and 2193 are same. * NOTE: FIXME: Strings 2176 and 2193 are same.
* *
* Version: @(#)language.h 1.0.5 2018/01/18 * Version: @(#)language.h 1.0.6 2018/01/23
* *
* Author: Fred N. van Kempen, <decwiz@yahoo.com> * Author: Fred N. van Kempen, <decwiz@yahoo.com>
* *
@@ -46,8 +46,8 @@
#define IDS_2070 2070 // "Ports (COM & LPT)" #define IDS_2070 2070 // "Ports (COM & LPT)"
#define IDS_2071 2071 // "Other peripherals" #define IDS_2071 2071 // "Other peripherals"
#define IDS_2072 2072 // "Hard disks" #define IDS_2072 2072 // "Hard disks"
#define IDS_2073 2073 // "Removable devices" #define IDS_2073 2073 // "Floppy drives"
#define IDS_2074 2074 // "Use CTRL+ALT+PAGE DOWN.." #define IDS_2074 2074 // "Other removable devices"
#define IDS_2075 2075 // "CD-ROM images (*.ISO;*.CU.." #define IDS_2075 2075 // "CD-ROM images (*.ISO;*.CU.."
#define IDS_2076 2076 // "Host CD/DVD Drive (%c:)" #define IDS_2076 2076 // "Host CD/DVD Drive (%c:)"
#define IDS_2077 2077 // "Click to capture mouse" #define IDS_2077 2077 // "Click to capture mouse"
@@ -80,7 +80,7 @@
#define IDS_2104 2104 // "Network Type" #define IDS_2104 2104 // "Network Type"
#define IDS_2105 2105 // "Surround Module" #define IDS_2105 2105 // "Surround Module"
#define IDS_2106 2106 // "MPU-401 Base Address" #define IDS_2106 2106 // "MPU-401 Base Address"
#define IDS_2107 2107 // "PCAP not found.." #define IDS_2107 2107 // "Use CTRL+ALT+PAGE DOWN.."
#define IDS_2108 2108 // "On-board RAM" #define IDS_2108 2108 // "On-board RAM"
#define IDS_2109 2109 // "Memory Size" #define IDS_2109 2109 // "Memory Size"
#define IDS_2110 2110 // "Display Type" #define IDS_2110 2110 // "Display Type"
@@ -148,6 +148,9 @@
#define IDS_2172 2172 // "E&xport to 86F..." #define IDS_2172 2172 // "E&xport to 86F..."
#define IDS_2173 2173 // "Surface-based images (*.8.." #define IDS_2173 2173 // "Surface-based images (*.8.."
#define IDS_2174 2174 // "All floppy images (*.DSK..." #define IDS_2174 2174 // "All floppy images (*.DSK..."
#define IDS_2175 2175 // "ZIP images (*.IM?)\0*.IM..."
#define IDS_2176 2176 // "ZIP images (*.IM?)\0*.IM..."
#define IDS_2177 2177 // "ZIP %i (%03i): %ls"
#define IDS_4096 4096 // "Hard disk (%s)" #define IDS_4096 4096 // "Hard disk (%s)"
#define IDS_4097 4097 // "%01i:%01i" #define IDS_4097 4097 // "%01i:%01i"
@@ -216,6 +219,8 @@
#define IDS_5897 5897 // "DMF (cluster 1024)" #define IDS_5897 5897 // "DMF (cluster 1024)"
#define IDS_5898 5898 // "DMF (cluster 2048)" #define IDS_5898 5898 // "DMF (cluster 2048)"
#define IDS_5899 5899 // "2.88 MB" #define IDS_5899 5899 // "2.88 MB"
#define IDS_5900 5900 // "ZIP 100"
#define IDS_5901 5901 // "ZIP 250"
#define IDS_6144 6144 // "Perfect RPM" #define IDS_6144 6144 // "Perfect RPM"
#define IDS_6145 6145 // "1%% below perfect RPM" #define IDS_6145 6145 // "1%% below perfect RPM"
@@ -226,7 +231,7 @@
#define IDS_LANG_ENUS IDS_7168 #define IDS_LANG_ENUS IDS_7168
#define STR_NUM_2048 127 #define STR_NUM_2048 130
#define STR_NUM_3072 11 #define STR_NUM_3072 11
#define STR_NUM_4096 20 #define STR_NUM_4096 20
#define STR_NUM_4352 7 #define STR_NUM_4352 7
@@ -234,7 +239,7 @@
#define STR_NUM_5120 1 #define STR_NUM_5120 1
#define STR_NUM_5376 7 #define STR_NUM_5376 7
#define STR_NUM_5632 7 #define STR_NUM_5632 7
#define STR_NUM_5888 12 #define STR_NUM_5888 14
#define STR_NUM_6144 4 #define STR_NUM_6144 4
#define STR_NUM_7168 1 #define STR_NUM_7168 1

View File

@@ -8,7 +8,7 @@
* *
* Main emulator module where most things are controlled. * Main emulator module where most things are controlled.
* *
* Version: @(#)pc.c 1.0.53 2018/01/18 * Version: @(#)pc.c 1.0.54 2018/01/21
* *
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/> * Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -57,9 +57,9 @@
#include "disk/hdc.h" #include "disk/hdc.h"
#include "disk/hdc_ide.h" #include "disk/hdc_ide.h"
#include "cdrom/cdrom.h" #include "cdrom/cdrom.h"
#include "cdrom/cdrom.h"
#include "cdrom/cdrom_image.h" #include "cdrom/cdrom_image.h"
#include "cdrom/cdrom_null.h" #include "cdrom/cdrom_null.h"
#include "zip.h"
#include "scsi/scsi.h" #include "scsi/scsi.h"
#include "network/network.h" #include "network/network.h"
#include "sound/sound.h" #include "sound/sound.h"
@@ -171,6 +171,9 @@ static int unscaled_size_x = SCREEN_RES_X, /* current unscaled size X */
efscrnsz_y = SCREEN_RES_Y; efscrnsz_y = SCREEN_RES_Y;
static char buff[1024];
static int seen = 0;
/* /*
* Log something to the logfile or stdout. * Log something to the logfile or stdout.
* *
@@ -182,8 +185,6 @@ void
pclog_ex(const char *fmt, va_list ap) pclog_ex(const char *fmt, va_list ap)
{ {
#ifndef RELEASE_BUILD #ifndef RELEASE_BUILD
static char buff[1024];
static int seen = 0;
char temp[1024]; char temp[1024];
if (stdlog == NULL) { if (stdlog == NULL) {
@@ -476,6 +477,7 @@ usage:
network_init(); network_init();
mouse_init(); mouse_init();
cdrom_global_init(); cdrom_global_init();
zip_global_init();
/* Load the configuration file. */ /* Load the configuration file. */
config_load(); config_load();
@@ -554,6 +556,13 @@ pc_reload(wchar_t *fn)
cdrom_null_open(i, cdrom_drives[i].host_drive); cdrom_null_open(i, cdrom_drives[i].host_drive);
} }
for (i=0; i<ZIP_NUM; i++) {
if (zip_drives[i].bus_type)
SCSIReset(zip_drives[i].scsi_device_id, zip_drives[i].scsi_device_lun);
zip_load(i, zip_drives[i].image_path);
}
fdd_load(0, floppyfns[0]); fdd_load(0, floppyfns[0]);
fdd_load(1, floppyfns[1]); fdd_load(1, floppyfns[1]);
fdd_load(2, floppyfns[2]); fdd_load(2, floppyfns[2]);
@@ -653,6 +662,7 @@ again2:
ide_init_first(); ide_init_first();
cdrom_global_reset(); cdrom_global_reset();
zip_global_reset();
device_init(); device_init();
@@ -669,6 +679,7 @@ again2:
ide_reset_hard(); ide_reset_hard();
cdrom_hard_reset(); cdrom_hard_reset();
zip_hard_reset();
scsi_card_init(); scsi_card_init();
@@ -766,7 +777,7 @@ pc_reset_hard_init(void)
/* Reset the general machine support modules. */ /* Reset the general machine support modules. */
io_init(); io_init();
cpu_set(); // cpu_set();
mem_resize(); mem_resize();
timer_reset(); timer_reset();
device_init(); device_init();
@@ -812,7 +823,7 @@ pc_reset_hard_init(void)
mouse_reset(); mouse_reset();
/* Reset the video card. */ /* Reset the video card. */
video_reset(gfxcard); // video_reset(gfxcard);
/* Reset the Hard Disk Controller module. */ /* Reset the Hard Disk Controller module. */
hdc_reset(); hdc_reset();
@@ -831,6 +842,7 @@ pc_reset_hard_init(void)
scsi_card_init(); scsi_card_init();
cdrom_hard_reset(); cdrom_hard_reset();
zip_hard_reset();
/* Reset and reconfigure the Network Card layer. */ /* Reset and reconfigure the Network Card layer. */
network_reset(); network_reset();
@@ -863,11 +875,14 @@ pc_reset_hard_init(void)
device_add(&bugger_device); device_add(&bugger_device);
/* Reset the CPU module. */ /* Reset the CPU module. */
cpu_set();
resetx86(); resetx86();
dma_reset(); dma_reset();
pic_reset(); pic_reset();
cpu_cache_int_enabled = cpu_cache_ext_enabled = 0; cpu_cache_int_enabled = cpu_cache_ext_enabled = 0;
video_reset(gfxcard);
if (AT) if (AT)
setpitclock(machines[machine].cpu[cpu_manufacturer].cpus[cpu].rspeed); setpitclock(machines[machine].cpu[cpu_manufacturer].cpus[cpu].rspeed);
else else
@@ -929,6 +944,9 @@ pc_close(thread_t *ptr)
plat_mouse_capture(0); plat_mouse_capture(0);
for (i=0; i<ZIP_NUM; i++)
zip_close(i);
for (i=0; i<CDROM_NUM; i++) for (i=0; i<CDROM_NUM; i++)
cdrom_drives[i].handler->exit(i); cdrom_drives[i].handler->exit(i);

View File

@@ -8,13 +8,13 @@
* *
* Define the various platform support functions. * Define the various platform support functions.
* *
* Version: @(#)plat.h 1.0.23 2017/12/15 * Version: @(#)plat.h 1.0.24 2018/01/22
* *
* Authors: Miran Grca, <mgrca8@gmail.com> * Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com> * Fred N. van Kempen, <decwiz@yahoo.com>
* *
* Copyright 2016,2017 Miran Grca. * Copyright 2016-2018 Miran Grca.
* Copyright 2017 Fred N. van Kempen. * Copyright 2017,2018 Fred N. van Kempen.
*/ */
#ifndef EMU_PLAT_H #ifndef EMU_PLAT_H
# define EMU_PLAT_H # define EMU_PLAT_H
@@ -106,6 +106,8 @@ extern uint8_t host_cdrom_drive_available_num;
extern void cdrom_init_host_drives(void); extern void cdrom_init_host_drives(void);
extern void cdrom_eject(uint8_t id); extern void cdrom_eject(uint8_t id);
extern void cdrom_reload(uint8_t id); extern void cdrom_reload(uint8_t id);
extern void zip_eject(uint8_t id);
extern void zip_reload(uint8_t id);
extern void removable_disk_unload(uint8_t id); extern void removable_disk_unload(uint8_t id);
extern void removable_disk_eject(uint8_t id); extern void removable_disk_eject(uint8_t id);
extern void removable_disk_reload(uint8_t id); extern void removable_disk_reload(uint8_t id);

View File

@@ -8,14 +8,14 @@
* *
* Handling of the SCSI controllers. * Handling of the SCSI controllers.
* *
* Version: @(#)scsi.c 1.0.13 2017/12/16 * Version: @(#)scsi.c 1.0.14 2018/01/21
* *
* Authors: Miran Grca, <mgrca8@gmail.com> * Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com> * Fred N. van Kempen, <decwiz@yahoo.com>
* TheCollector1995, <mariogplayer@gmail.com> * TheCollector1995, <mariogplayer@gmail.com>
* *
* Copyright 2016,2017 Miran Grca. * Copyright 2016-2018 Miran Grca.
* Copyright 2017 Fred N. van Kempen. * Copyright 2017,2018 Fred N. van Kempen.
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
@@ -28,6 +28,7 @@
#include "../timer.h" #include "../timer.h"
#include "../device.h" #include "../device.h"
#include "../cdrom/cdrom.h" #include "../cdrom/cdrom.h"
#include "../zip.h"
#include "../disk/hdc.h" #include "../disk/hdc.h"
#include "../plat.h" #include "../plat.h"
#include "scsi.h" #include "scsi.h"
@@ -44,7 +45,6 @@
scsi_device_t SCSIDevices[SCSI_ID_MAX][SCSI_LUN_MAX]; scsi_device_t SCSIDevices[SCSI_ID_MAX][SCSI_LUN_MAX];
// uint8_t SCSIPhase = 0xff; // uint8_t SCSIPhase = 0xff;
// uint8_t SCSIStatus = SCSI_STATUS_OK; // uint8_t SCSIStatus = SCSI_STATUS_OK;
uint8_t scsi_cdrom_id = 3; /*common setting*/
char scsi_fn[SCSI_NUM][512]; char scsi_fn[SCSI_NUM][512];
uint16_t scsi_hd_location[SCSI_NUM]; uint16_t scsi_hd_location[SCSI_NUM];
@@ -153,6 +153,8 @@ void scsi_card_init(void)
build_scsi_hd_map(); build_scsi_hd_map();
pclog("Building SCSI CD-ROM map...\n"); pclog("Building SCSI CD-ROM map...\n");
build_scsi_cdrom_map(); build_scsi_cdrom_map();
pclog("Building SCSI ZIP map...\n");
build_scsi_zip_map();
for (i=0; i<SCSI_ID_MAX; i++) { for (i=0; i<SCSI_ID_MAX; i++) {
for (j=0; j<SCSI_LUN_MAX; j++) { for (j=0; j<SCSI_LUN_MAX; j++) {
@@ -160,6 +162,8 @@ void scsi_card_init(void)
SCSIDevices[i][j].LunType = SCSI_DISK; SCSIDevices[i][j].LunType = SCSI_DISK;
} else if (scsi_cdrom_drives[i][j] != 0xff) { } else if (scsi_cdrom_drives[i][j] != 0xff) {
SCSIDevices[i][j].LunType = SCSI_CDROM; SCSIDevices[i][j].LunType = SCSI_CDROM;
} else if (scsi_zip_drives[i][j] != 0xff) {
SCSIDevices[i][j].LunType = SCSI_ZIP;
} else { } else {
SCSIDevices[i][j].LunType = SCSI_NONE; SCSIDevices[i][j].LunType = SCSI_NONE;
} }
@@ -193,15 +197,19 @@ void scsi_card_reset(void)
void SCSIReset(uint8_t id, uint8_t lun) void SCSIReset(uint8_t id, uint8_t lun)
{ {
uint8_t cdrom_id = scsi_cdrom_drives[id][lun]; uint8_t cdrom_id = scsi_cdrom_drives[id][lun];
uint8_t zip_id = scsi_zip_drives[id][lun];
uint8_t hdc_id = scsi_hard_disks[id][lun]; uint8_t hdc_id = scsi_hard_disks[id][lun];
if (hdc_id != 0xff) { if (hdc_id != 0xff) {
scsi_hd_reset(cdrom_id); scsi_hd_reset(hdc_id);
SCSIDevices[id][lun].LunType = SCSI_DISK; SCSIDevices[id][lun].LunType = SCSI_DISK;
} else { } else {
if (cdrom_id != 0xff) { if (cdrom_id != 0xff) {
cdrom_reset(cdrom_id); cdrom_reset(cdrom_id);
SCSIDevices[id][lun].LunType = SCSI_CDROM; SCSIDevices[id][lun].LunType = SCSI_CDROM;
} else if (zip_id != 0xff) {
zip_reset(zip_id);
SCSIDevices[id][lun].LunType = SCSI_ZIP;
} else { } else {
SCSIDevices[id][lun].LunType = SCSI_NONE; SCSIDevices[id][lun].LunType = SCSI_NONE;
} }

View File

@@ -8,7 +8,7 @@
* *
* SCSI controller handler header. * SCSI controller handler header.
* *
* Version: @(#)scsi_h 1.0.11 2018/01/24 * Version: @(#)scsi_h 1.0.12 2018/01/24
* *
* Authors: TheCollector1995, <mariogplayer@gmail.com> * Authors: TheCollector1995, <mariogplayer@gmail.com>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -241,7 +241,8 @@ extern int prev_status;
enum { enum {
SCSI_NONE = 0, SCSI_NONE = 0,
SCSI_DISK, SCSI_DISK,
SCSI_CDROM SCSI_CDROM,
SCSI_ZIP
}; };
#define MSFtoLBA(m,s,f) ((((m*60)+s)*75)+f) #define MSFtoLBA(m,s,f) ((((m*60)+s)*75)+f)

View File

@@ -8,13 +8,13 @@
* *
* The generic SCSI device command handler. * The generic SCSI device command handler.
* *
* Version: @(#)scsi_device.c 1.0.10 2018/01/06 * Version: @(#)scsi_device.c 1.0.11 2018/01/21
* *
* Authors: Miran Grca, <mgrca8@gmail.com> * Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com> * Fred N. van Kempen, <decwiz@yahoo.com>
* *
* Copyright 2016,2018 Miran Grca. * Copyright 2016-2018 Miran Grca.
* Copyright 2018 Fred N. van Kempen. * Copyright 2017,2018 Fred N. van Kempen.
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
@@ -23,6 +23,7 @@
#include "../86box.h" #include "../86box.h"
#include "../device.h" #include "../device.h"
#include "../cdrom/cdrom.h" #include "../cdrom/cdrom.h"
#include "../zip.h"
#include "../disk/hdd.h" #include "../disk/hdd.h"
#include "scsi.h" #include "scsi.h"
#include "scsi_disk.h" #include "scsi_disk.h"
@@ -43,6 +44,11 @@ static uint8_t scsi_device_target_command(int lun_type, uint8_t id, uint8_t *cdb
cdrom_command(id, cdb); cdrom_command(id, cdb);
return cdrom_CDROM_PHASE_to_scsi(id); return cdrom_CDROM_PHASE_to_scsi(id);
} }
else if (lun_type == SCSI_ZIP)
{
zip_command(id, cdb);
return zip_ZIP_PHASE_to_scsi(id);
}
else else
{ {
return SCSI_STATUS_CHECK_CONDITION; return SCSI_STATUS_CHECK_CONDITION;
@@ -60,6 +66,10 @@ static void scsi_device_target_phase_callback(int lun_type, uint8_t id)
{ {
cdrom_phase_callback(id); cdrom_phase_callback(id);
} }
else if (lun_type == SCSI_ZIP)
{
zip_phase_callback(id);
}
else else
{ {
return; return;
@@ -77,6 +87,10 @@ static int scsi_device_target_err_stat_to_scsi(int lun_type, uint8_t id)
{ {
return cdrom_CDROM_PHASE_to_scsi(id); return cdrom_CDROM_PHASE_to_scsi(id);
} }
else if (lun_type == SCSI_ZIP)
{
return zip_ZIP_PHASE_to_scsi(id);
}
else else
{ {
return SCSI_STATUS_CHECK_CONDITION; return SCSI_STATUS_CHECK_CONDITION;
@@ -94,6 +108,10 @@ static void scsi_device_target_save_cdb_byte(int lun_type, uint8_t id, uint8_t c
{ {
cdrom[id].request_length = cdb_byte; cdrom[id].request_length = cdb_byte;
} }
else if (lun_type == SCSI_ZIP)
{
zip[id].request_length = cdb_byte;
}
else else
{ {
return; return;
@@ -117,6 +135,10 @@ uint8_t *scsi_device_sense(uint8_t scsi_id, uint8_t scsi_lun)
id = scsi_cdrom_drives[scsi_id][scsi_lun]; id = scsi_cdrom_drives[scsi_id][scsi_lun];
return cdrom[id].sense; return cdrom[id].sense;
break; break;
case SCSI_ZIP:
id = scsi_zip_drives[scsi_id][scsi_lun];
return zip[id].sense;
break;
default: default:
return scsi_null_device_sense; return scsi_null_device_sense;
break; break;
@@ -140,6 +162,10 @@ void scsi_device_request_sense(uint8_t scsi_id, uint8_t scsi_lun, uint8_t *buffe
id = scsi_cdrom_drives[scsi_id][scsi_lun]; id = scsi_cdrom_drives[scsi_id][scsi_lun];
cdrom_request_sense_for_scsi(id, buffer, alloc_length); cdrom_request_sense_for_scsi(id, buffer, alloc_length);
break; break;
case SCSI_ZIP:
id = scsi_zip_drives[scsi_id][scsi_lun];
zip_request_sense_for_scsi(id, buffer, alloc_length);
break;
default: default:
memcpy(buffer, scsi_null_device_sense, alloc_length); memcpy(buffer, scsi_null_device_sense, alloc_length);
break; break;
@@ -164,6 +190,10 @@ void scsi_device_type_data(uint8_t scsi_id, uint8_t scsi_lun, uint8_t *type, uin
*type = 0x05; *type = 0x05;
*rmb = 0x80; *rmb = 0x80;
break; break;
case SCSI_ZIP:
*type = 0x00;
*rmb = 0x80;
break;
default: default:
*type = *rmb = 0xFF; *type = *rmb = 0xFF;
break; break;
@@ -185,6 +215,9 @@ int scsi_device_read_capacity(uint8_t scsi_id, uint8_t scsi_lun, uint8_t *cdb, u
case SCSI_CDROM: case SCSI_CDROM:
id = scsi_cdrom_drives[scsi_id][scsi_lun]; id = scsi_cdrom_drives[scsi_id][scsi_lun];
return cdrom_read_capacity(id, cdb, buffer, len); return cdrom_read_capacity(id, cdb, buffer, len);
case SCSI_ZIP:
id = scsi_zip_drives[scsi_id][scsi_lun];
return zip_read_capacity(id, cdb, buffer, len);
default: default:
return 0; return 0;
} }
@@ -219,6 +252,9 @@ int scsi_device_valid(uint8_t scsi_id, uint8_t scsi_lun)
case SCSI_CDROM: case SCSI_CDROM:
id = scsi_cdrom_drives[scsi_id][scsi_lun]; id = scsi_cdrom_drives[scsi_id][scsi_lun];
break; break;
case SCSI_ZIP:
id = scsi_zip_drives[scsi_id][scsi_lun];
break;
default: default:
id = 0; id = 0;
break; break;
@@ -239,6 +275,9 @@ int scsi_device_cdb_length(uint8_t scsi_id, uint8_t scsi_lun)
case SCSI_CDROM: case SCSI_CDROM:
id = scsi_cdrom_drives[scsi_id][scsi_lun]; id = scsi_cdrom_drives[scsi_id][scsi_lun];
return cdrom[id].cdb_len; return cdrom[id].cdb_len;
case SCSI_ZIP:
id = scsi_zip_drives[scsi_id][scsi_lun];
return zip[id].cdb_len;
default: default:
return 12; return 12;
} }
@@ -273,6 +312,9 @@ void scsi_device_command_phase0(uint8_t scsi_id, uint8_t scsi_lun, int cdb_len,
case SCSI_CDROM: case SCSI_CDROM:
id = scsi_cdrom_drives[scsi_id][scsi_lun]; id = scsi_cdrom_drives[scsi_id][scsi_lun];
break; break;
case SCSI_ZIP:
id = scsi_zip_drives[scsi_id][scsi_lun];
break;
default: default:
id = 0; id = 0;
SCSIDevices[scsi_id][scsi_lun].Phase = SCSI_PHASE_STATUS; SCSIDevices[scsi_id][scsi_lun].Phase = SCSI_PHASE_STATUS;
@@ -320,6 +362,9 @@ void scsi_device_command_phase1(uint8_t scsi_id, uint8_t scsi_lun)
case SCSI_CDROM: case SCSI_CDROM:
id = scsi_cdrom_drives[scsi_id][scsi_lun]; id = scsi_cdrom_drives[scsi_id][scsi_lun];
break; break;
case SCSI_ZIP:
id = scsi_zip_drives[scsi_id][scsi_lun];
break;
default: default:
id = 0; id = 0;
return; return;

View File

@@ -8,7 +8,7 @@
* *
* Define the various UI functions. * Define the various UI functions.
* *
* Version: @(#)ui.h 1.0.11 2018/01/18 * Version: @(#)ui.h 1.0.12 2018/01/22
* *
* Authors: Miran Grca, <mgrca8@gmail.com> * Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com> * Fred N. van Kempen, <decwiz@yahoo.com>
@@ -44,10 +44,11 @@ extern void ui_check_menu_item(int id, int checked);
#define SB_ICON_WIDTH 24 #define SB_ICON_WIDTH 24
#define SB_FLOPPY 0x00 #define SB_FLOPPY 0x00
#define SB_CDROM 0x10 #define SB_CDROM 0x10
#define SB_RDISK 0x20 #define SB_ZIP 0x20
#define SB_HDD 0x40 #define SB_RDISK 0x30
#define SB_NETWORK 0x50 #define SB_HDD 0x50
#define SB_TEXT 0x60 #define SB_NETWORK 0x60
#define SB_TEXT 0x70
extern wchar_t *ui_window_title(wchar_t *s); extern wchar_t *ui_window_title(wchar_t *s);
extern void ui_status_update(void); extern void ui_status_update(void);
@@ -62,6 +63,7 @@ extern void ui_sb_set_text_w(wchar_t *wstr);
extern void ui_sb_set_text(char *str); extern void ui_sb_set_text(char *str);
extern void ui_sb_bugui(char *str); extern void ui_sb_bugui(char *str);
extern void ui_sb_mount_floppy_img(uint8_t id, int part, uint8_t wp, wchar_t *file_name); extern void ui_sb_mount_floppy_img(uint8_t id, int part, uint8_t wp, wchar_t *file_name);
extern void ui_sb_mount_zip_img(uint8_t id, int part, uint8_t wp, wchar_t *file_name);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -8,7 +8,7 @@
* *
* Application resource script for Windows. * Application resource script for Windows.
* *
* Version: @(#)86Box.rc 1.0.25 2018/01/24 * Version: @(#)86Box.rc 1.0.26 2018/01/23
* *
* Authors: Miran Grca, <mgrca8@gmail.com> * Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com> * Fred N. van Kempen, <decwiz@yahoo.com>
@@ -272,22 +272,25 @@ BEGIN
COMBOBOX IDC_COMBO_RPM_MODE,53,45,166,14,CBS_DROPDOWNLIST | COMBOBOX IDC_COMBO_RPM_MODE,53,45,166,14,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "...",IDC_CFILE,206,5,13,14 PUSHBUTTON "...",IDC_CFILE,206,5,13,14
LTEXT "Progress:",IDT_1757,7,45,44,12,SS_CENTERIMAGE
CONTROL "IMGCreateProgress",IDC_PBAR_IMG_CREATE,"msctls_progress32",PBS_SMOOTH |
WS_BORDER,53,45,166,14
END END
DLG_CONFIG DIALOG DISCARDABLE 0, 0, 366, 241 DLG_CONFIG DIALOG DISCARDABLE 0, 0, 366, 251
STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "86Box Settings" CAPTION "86Box Settings"
FONT 9, "Segoe UI" FONT 9, "Segoe UI"
BEGIN BEGIN
DEFPUSHBUTTON "OK",IDOK,246,220,50,14 DEFPUSHBUTTON "OK",IDOK,246,230,50,14
PUSHBUTTON "Cancel",IDCANCEL,307,220,50,14 PUSHBUTTON "Cancel",IDCANCEL,307,230,50,14
CONTROL "List2",IDC_SETTINGSCATLIST,"SysListView32",LVS_LIST | CONTROL "List2",IDC_SETTINGSCATLIST,"SysListView32",LVS_LIST |
LVS_SHOWSELALWAYS | LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,7,7,90,197 LVS_SHOWSELALWAYS | LVS_SINGLESEL | WS_BORDER | WS_TABSTOP,7,7,90,207
CONTROL "",-1,"Static",SS_BLACKFRAME | SS_SUNKEN,1,211,363,1 CONTROL "",-1,"Static",SS_BLACKFRAME | SS_SUNKEN,1,221,363,1
/* Leave this commented out until we get into localization. */ /* Leave this commented out until we get into localization. */
#if 0 #if 0
LTEXT "Language:",IDT_1700,7,222,41,10 LTEXT "Language:",IDT_1700,7,232,41,10
COMBOBOX IDC_COMBO_LANG,48,221,108,120,CBS_DROPDOWN | WS_VSCROLL | COMBOBOX IDC_COMBO_LANG,48,231,108,120,CBS_DROPDOWN | WS_VSCROLL |
WS_TABSTOP WS_TABSTOP
#endif #endif
END END
@@ -521,7 +524,7 @@ BEGIN
WS_BORDER,7,16,204,12 WS_BORDER,7,16,204,12
END END
DLG_CFG_REMOVABLE_DEVICES DIALOG DISCARDABLE 97, 0, 267, 202 DLG_CFG_FLOPPY_DRIVES DIALOG DISCARDABLE 97, 0, 267, 103
STYLE DS_CONTROL | WS_CHILD STYLE DS_CONTROL | WS_CHILD
FONT 9, "Segoe UI" FONT 9, "Segoe UI"
BEGIN BEGIN
@@ -536,22 +539,46 @@ BEGIN
BS_AUTOCHECKBOX | WS_TABSTOP,131,86,64,10 BS_AUTOCHECKBOX | WS_TABSTOP,131,86,64,10
CONTROL "Check BPB",IDC_CHECKBPB,"Button", CONTROL "Check BPB",IDC_CHECKBPB,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,196,86,64,10 BS_AUTOCHECKBOX | WS_TABSTOP,196,86,64,10
END
DLG_CFG_OTHER_REMOVABLE_DEVICES DIALOG DISCARDABLE 97, 0, 267, 221
STYLE DS_CONTROL | WS_CHILD
FONT 9, "Segoe UI"
BEGIN
CONTROL "List1",IDC_LIST_CDROM_DRIVES,"SysListView32",LVS_REPORT | CONTROL "List1",IDC_LIST_CDROM_DRIVES,"SysListView32",LVS_REPORT |
LVS_SHOWSELALWAYS | LVS_SINGLESEL | WS_BORDER | LVS_SHOWSELALWAYS | LVS_SINGLESEL | WS_BORDER |
WS_TABSTOP,7,116,253,60 WS_TABSTOP,7,18,253,60
LTEXT "CD-ROM drives:",IDT_1739,7,106,50,8 LTEXT "CD-ROM drives:",IDT_1739,7,7,50,8
COMBOBOX IDC_COMBO_CD_BUS,33,183,90,12,CBS_DROPDOWNLIST | COMBOBOX IDC_COMBO_CD_BUS,33,85,90,12,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP WS_VSCROLL | WS_TABSTOP
LTEXT "Bus:",IDT_1740,7,184,24,8 LTEXT "Bus:",IDT_1740,7,86,24,8
COMBOBOX IDC_COMBO_CD_ID,170,183,22,12,CBS_DROPDOWNLIST | COMBOBOX IDC_COMBO_CD_ID,170,85,22,12,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP WS_VSCROLL | WS_TABSTOP
LTEXT "ID:",IDT_1741,131,184,38,8 LTEXT "ID:",IDT_1741,131,86,38,8
COMBOBOX IDC_COMBO_CD_LUN,239,183,22,12,CBS_DROPDOWNLIST | COMBOBOX IDC_COMBO_CD_LUN,239,85,22,12,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP WS_VSCROLL | WS_TABSTOP
LTEXT "LUN:",IDT_1742,200,184,38,8 LTEXT "LUN:",IDT_1742,200,86,38,8
COMBOBOX IDC_COMBO_CD_CHANNEL_IDE,170,183,90,12,CBS_DROPDOWNLIST | COMBOBOX IDC_COMBO_CD_CHANNEL_IDE,170,85,90,12,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP WS_VSCROLL | WS_TABSTOP
LTEXT "Channel:",IDT_1743,131,184,38,8 LTEXT "Channel:",IDT_1743,131,86,38,8
CONTROL "List1",IDC_LIST_ZIP_DRIVES,"SysListView32",LVS_REPORT |
LVS_SHOWSELALWAYS | LVS_SINGLESEL | WS_BORDER |
WS_TABSTOP,7,117,253,60
LTEXT "ZIP drives:",IDT_1739,7,107,50,8
COMBOBOX IDC_COMBO_ZIP_BUS,33,184,90,12,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Bus:",IDT_1753,7,185,24,8
COMBOBOX IDC_COMBO_ZIP_ID,170,184,22,12,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "ID:",IDT_1754,131,185,38,8
COMBOBOX IDC_COMBO_ZIP_LUN,239,184,22,12,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "LUN:",IDT_1755,200,185,38,8
COMBOBOX IDC_COMBO_ZIP_CHANNEL_IDE,170,184,90,12,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Channel:",IDT_1756,131,185,38,8
CONTROL "ZIP 250",IDC_CHECK250,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,7,204,64,10
END END
@@ -582,12 +609,14 @@ END
145 ICON DISCARDABLE "win/icons/floppy_35_active.ico" 145 ICON DISCARDABLE "win/icons/floppy_35_active.ico"
160 ICON DISCARDABLE "win/icons/cdrom.ico" 160 ICON DISCARDABLE "win/icons/cdrom.ico"
161 ICON DISCARDABLE "win/icons/cdrom_active.ico" 161 ICON DISCARDABLE "win/icons/cdrom_active.ico"
176 ICON DISCARDABLE "win/icons/removable_disk.ico" 176 ICON DISCARDABLE "win/icons/zip.ico"
177 ICON DISCARDABLE "win/icons/removable_disk_active.ico" 177 ICON DISCARDABLE "win/icons/zip_active.ico"
192 ICON DISCARDABLE "win/icons/hard_disk.ico" 192 ICON DISCARDABLE "win/icons/removable_disk.ico"
193 ICON DISCARDABLE "win/icons/hard_disk_active.ico" 193 ICON DISCARDABLE "win/icons/removable_disk_active.ico"
208 ICON DISCARDABLE "win/icons/network.ico" 208 ICON DISCARDABLE "win/icons/hard_disk.ico"
209 ICON DISCARDABLE "win/icons/network_active.ico" 209 ICON DISCARDABLE "win/icons/hard_disk_active.ico"
224 ICON DISCARDABLE "win/icons/network.ico"
225 ICON DISCARDABLE "win/icons/network_active.ico"
256 ICON DISCARDABLE "win/icons/machine.ico" 256 ICON DISCARDABLE "win/icons/machine.ico"
257 ICON DISCARDABLE "win/icons/display.ico" 257 ICON DISCARDABLE "win/icons/display.ico"
258 ICON DISCARDABLE "win/icons/input_devices.ico" 258 ICON DISCARDABLE "win/icons/input_devices.ico"
@@ -596,17 +625,21 @@ END
261 ICON DISCARDABLE "win/icons/ports.ico" 261 ICON DISCARDABLE "win/icons/ports.ico"
262 ICON DISCARDABLE "win/icons/other_peripherals.ico" 262 ICON DISCARDABLE "win/icons/other_peripherals.ico"
263 ICON DISCARDABLE "win/icons/hard_disk.ico" 263 ICON DISCARDABLE "win/icons/hard_disk.ico"
264 ICON DISCARDABLE "win/icons/removable_devices.ico" 264 ICON DISCARDABLE "win/icons/floppy_drives.ico"
265 ICON DISCARDABLE "win/icons/other_removable_devices.ico"
384 ICON DISCARDABLE "win/icons/floppy_525_empty.ico" 384 ICON DISCARDABLE "win/icons/floppy_525_empty.ico"
385 ICON DISCARDABLE "win/icons/floppy_525_empty_active.ico" 385 ICON DISCARDABLE "win/icons/floppy_525_empty_active.ico"
400 ICON DISCARDABLE "win/icons/floppy_35_empty.ico" 400 ICON DISCARDABLE "win/icons/floppy_35_empty.ico"
401 ICON DISCARDABLE "win/icons/floppy_35_empty_active.ico" 401 ICON DISCARDABLE "win/icons/floppy_35_empty_active.ico"
416 ICON DISCARDABLE "win/icons/cdrom_empty.ico" 416 ICON DISCARDABLE "win/icons/cdrom_empty.ico"
417 ICON DISCARDABLE "win/icons/cdrom_empty_active.ico" 417 ICON DISCARDABLE "win/icons/cdrom_empty_active.ico"
432 ICON DISCARDABLE "win/icons/removable_disk_empty.ico" 432 ICON DISCARDABLE "win/icons/zip_empty.ico"
433 ICON DISCARDABLE "win/icons/removable_disk_empty_active.ico" 433 ICON DISCARDABLE "win/icons/zip_empty_active.ico"
448 ICON DISCARDABLE "win/icons/removable_disk_empty.ico"
449 ICON DISCARDABLE "win/icons/removable_disk_empty_active.ico"
512 ICON DISCARDABLE "win/icons/floppy_disabled.ico" 512 ICON DISCARDABLE "win/icons/floppy_disabled.ico"
514 ICON DISCARDABLE "win/icons/cdrom_disabled.ico" 514 ICON DISCARDABLE "win/icons/cdrom_disabled.ico"
515 ICON DISCARDABLE "win/icons/zip_disabled.ico"
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@@ -739,12 +772,20 @@ BEGIN
BOTTOMMARGIN, 137 BOTTOMMARGIN, 137
END END
DLG_CFG_REMOVABLE_DEVICES, DIALOG DLG_CFG_FLOPPY_DRIVES, DIALOG
BEGIN BEGIN
LEFTMARGIN, 7 LEFTMARGIN, 7
RIGHTMARGIN, 260 RIGHTMARGIN, 260
TOPMARGIN, 7 TOPMARGIN, 7
BOTTOMMARGIN, 195 BOTTOMMARGIN, 96
END
DLG_CFG_OTHER_REMOVABLE_DEVICES, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 260
TOPMARGIN, 7
BOTTOMMARGIN, 214
END END
END END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED
@@ -786,8 +827,8 @@ BEGIN
IDS_2070 "Ports (COM & LPT)" IDS_2070 "Ports (COM & LPT)"
IDS_2071 "Other peripherals" IDS_2071 "Other peripherals"
IDS_2072 "Hard disks" IDS_2072 "Hard disks"
IDS_2073 "Removable devices" IDS_2073 "Floppy drives"
IDS_2074 "Use CTRL+ALT+PAGE DOWN to return to windowed mode" IDS_2074 "Other removable devices"
IDS_2075 "CD-ROM images (*.ISO;*.CUE)\0*.ISO;*.CUE\0All files (*.*)\0*.*\0" IDS_2075 "CD-ROM images (*.ISO;*.CUE)\0*.ISO;*.CUE\0All files (*.*)\0*.*\0"
IDS_2076 "Host CD/DVD Drive (%c:)" IDS_2076 "Host CD/DVD Drive (%c:)"
IDS_2077 "Click to capture mouse" IDS_2077 "Click to capture mouse"
@@ -828,6 +869,7 @@ BEGIN
IDS_2104 "Network Type" IDS_2104 "Network Type"
IDS_2105 "Surround Module" IDS_2105 "Surround Module"
IDS_2106 "MPU-401 Base Address" IDS_2106 "MPU-401 Base Address"
IDS_2107 "Use CTRL+ALT+PAGE DOWN to return to windowed mode"
IDS_2108 "On-board RAM" IDS_2108 "On-board RAM"
IDS_2109 "Memory Size" IDS_2109 "Memory Size"
IDS_2110 "Display Type" IDS_2110 "Display Type"
@@ -907,6 +949,9 @@ BEGIN
IDS_2172 "E&xport to 86F..." IDS_2172 "E&xport to 86F..."
IDS_2173 "Surface images (*.86F)\0*.86F\0" IDS_2173 "Surface images (*.86F)\0*.86F\0"
IDS_2174 "All images (*.86F;*.DSK;*.FLP;*.IM?;*.*FD?)\0*.86F;*.DSK;*.FLP;*.IM?;*.*FD?\0Basic sector images (*.DSK;*.FLP;*.IM?;*.*FD?)\0*.DSK;*.FLP;*.IM?;*.IMG;*.*FD?\0Surface images (*.86F)\0*.86F\0" IDS_2174 "All images (*.86F;*.DSK;*.FLP;*.IM?;*.*FD?)\0*.86F;*.DSK;*.FLP;*.IM?;*.*FD?\0Basic sector images (*.DSK;*.FLP;*.IM?;*.*FD?)\0*.DSK;*.FLP;*.IM?;*.IMG;*.*FD?\0Surface images (*.86F)\0*.86F\0"
IDS_2175 "ZIP images (*.IM?;*.ZDI)\0*.IM?;*.ZDI\0All files (*.*)\0*.*\0"
IDS_2176 "ZIP images (*.IM?;*.ZDI)\0*.IM?;*.ZDI\0"
IDS_2177 "ZIP %i (%03i): %ls"
IDS_4096 "Hard disk (%s)" IDS_4096 "Hard disk (%s)"
IDS_4097 "%01i:%01i" IDS_4097 "%01i:%01i"
@@ -975,6 +1020,8 @@ BEGIN
IDS_5897 "DMF (cluster 1024)" IDS_5897 "DMF (cluster 1024)"
IDS_5898 "DMF (cluster 2048)" IDS_5898 "DMF (cluster 2048)"
IDS_5899 "2.88 MB" IDS_5899 "2.88 MB"
IDS_5900 "ZIP 100"
IDS_5901 "ZIP 250"
IDS_6144 "Perfect RPM" IDS_6144 "Perfect RPM"
IDS_6145 "1%% below perfect RPM" IDS_6145 "1%% below perfect RPM"

View File

@@ -8,7 +8,7 @@
# #
# Makefile for Win32 (MinGW32) environment. # Makefile for Win32 (MinGW32) environment.
# #
# Version: @(#)Makefile.mingw 1.0.93 2018/01/25 # Version: @(#)Makefile.mingw 1.0.94 2018/01/25
# #
# Authors: Miran Grca, <mgrca8@gmail.com> # Authors: Miran Grca, <mgrca8@gmail.com>
# Fred N. van Kempen, <decwiz@yahoo.com> # Fred N. van Kempen, <decwiz@yahoo.com>
@@ -400,7 +400,8 @@ DEVOBJ := bugger.o lpt.o $(SERIAL) \
joystick_standard.o joystick_ch_flightstick_pro.o \ joystick_standard.o joystick_ch_flightstick_pro.o \
joystick_sw_pad.o joystick_tm_fcs.o \ joystick_sw_pad.o joystick_tm_fcs.o \
mouse.o \ mouse.o \
mouse_serial.o mouse_ps2.o mouse_bus.o mouse_serial.o mouse_ps2.o mouse_bus.o \
zip.o
FDDOBJ := fdd.o fdc.o fdi2raw.o \ FDDOBJ := fdd.o fdc.o fdi2raw.o \
fdd_common.o fdd_86f.o \ fdd_common.o fdd_86f.o \

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

BIN
src/win/icons/zip.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
src/win/icons/zip_empty.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -8,7 +8,7 @@
* *
* Windows resource defines. * Windows resource defines.
* *
* Version: @(#)resource.h 1.0.18 2018/01/24 * Version: @(#)resource.h 1.0.19 2018/01/26
* *
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/> * Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -36,7 +36,8 @@
#define DLG_CFG_PERIPHERALS 117 /* sub-dialog of config */ #define DLG_CFG_PERIPHERALS 117 /* sub-dialog of config */
#define DLG_CFG_HARD_DISKS 118 /* sub-dialog of config */ #define DLG_CFG_HARD_DISKS 118 /* sub-dialog of config */
#define DLG_CFG_HARD_DISKS_ADD 119 /* sub-dialog of config */ #define DLG_CFG_HARD_DISKS_ADD 119 /* sub-dialog of config */
#define DLG_CFG_REMOVABLE_DEVICES 120 /* sub-dialog of config */ #define DLG_CFG_FLOPPY_DRIVES 120 /* sub-dialog of config */
#define DLG_CFG_OTHER_REMOVABLE_DEVICES 121 /* sub-dialog of config */
/* Static text label IDs. */ /* Static text label IDs. */
#define IDT_1700 1700 /* Language: */ #define IDT_1700 1700 /* Language: */
@@ -86,6 +87,11 @@
#define IDT_1750 1750 /* Disk size: */ #define IDT_1750 1750 /* Disk size: */
#define IDT_1751 1751 /* RPM mode: */ #define IDT_1751 1751 /* RPM mode: */
#define IDT_1752 1752 /* Progress: */ #define IDT_1752 1752 /* Progress: */
#define IDT_1753 1753 /* Bus: */
#define IDT_1754 1754 /* ID: */
#define IDT_1755 1755 /* LUN: */
#define IDT_1756 1756 /* Channel: */
#define IDT_1757 1757 /* Progress: */
/* /*
@@ -178,17 +184,17 @@
#define IDC_COMBO_FD_TYPE 1152 #define IDC_COMBO_FD_TYPE 1152
#define IDC_CHECKTURBO 1153 #define IDC_CHECKTURBO 1153
#define IDC_CHECKBPB 1154 #define IDC_CHECKBPB 1154
#define IDC_BUTTON_FDD_ADD 1155 // status bar menu #define IDC_LIST_CDROM_DRIVES 1155
#define IDC_BUTTON_FDD_EDIT 1156 // status bar menu #define IDC_COMBO_CD_BUS 1156
#define IDC_BUTTON_FDD_REMOVE 1157 // status bar menu #define IDC_COMBO_CD_ID 1157
#define IDC_LIST_CDROM_DRIVES 1158 #define IDC_COMBO_CD_LUN 1158
#define IDC_COMBO_CD_BUS 1159 #define IDC_COMBO_CD_CHANNEL_IDE 1159
#define IDC_COMBO_CD_ID 1160 #define IDC_LIST_ZIP_DRIVES 1160
#define IDC_COMBO_CD_LUN 1161 #define IDC_COMBO_ZIP_BUS 1161
#define IDC_COMBO_CD_CHANNEL_IDE 1162 #define IDC_COMBO_ZIP_ID 1162
#define IDC_BUTTON_CDROM_ADD 1163 // status bar menu #define IDC_COMBO_ZIP_LUN 1163
#define IDC_BUTTON_CDROM_EDIT 1164 // status bar menu #define IDC_COMBO_ZIP_CHANNEL_IDE 1164
#define IDC_BUTTON_CDROM_REMOVE 1165 // status bar menu #define IDC_CHECK250 1165
#define IDC_SLIDER_MAIN 1180 /* sound gain dialog */ #define IDC_SLIDER_MAIN 1180 /* sound gain dialog */
#define IDC_SLIDER_CD 1181 #define IDC_SLIDER_CD 1181
@@ -289,11 +295,17 @@
#define IDM_CDROM_IMAGE 0x2500 #define IDM_CDROM_IMAGE 0x2500
#define IDM_CDROM_HOST_DRIVE 0x2600 #define IDM_CDROM_HOST_DRIVE 0x2600
#define IDM_RDISK_EJECT 0x3200 #define IDM_ZIP_IMAGE_NEW 0x3200
#define IDM_RDISK_RELOAD 0x3300 #define IDM_ZIP_IMAGE_EXISTING 0x3300
#define IDM_RDISK_SEND_CHANGE 0x3400 #define IDM_ZIP_IMAGE_EXISTING_WP 0x3400
#define IDM_RDISK_IMAGE 0x3500 #define IDM_ZIP_EJECT 0x3500
#define IDM_RDISK_IMAGE_WP 0x3600 #define IDM_ZIP_RELOAD 0x3600
#define IDM_RDISK_EJECT 0x4200
#define IDM_RDISK_RELOAD 0x4300
#define IDM_RDISK_SEND_CHANGE 0x4400
#define IDM_RDISK_IMAGE 0x4500
#define IDM_RDISK_IMAGE_WP 0x4600
/* Next default values for new objects */ /* Next default values for new objects */

View File

@@ -8,7 +8,7 @@
* *
* Platform main support module for Windows. * Platform main support module for Windows.
* *
* Version: @(#)win.c 1.0.44 2018/01/18 * Version: @(#)win.c 1.0.45 2018/01/23
* *
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/> * Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
* Miran Grca, <mgrca8@gmail.com> * Miran Grca, <mgrca8@gmail.com>
@@ -716,7 +716,7 @@ plat_setfullscreen(int on)
if (on && video_fullscreen_first) { if (on && video_fullscreen_first) {
video_fullscreen_first = 0; video_fullscreen_first = 0;
ui_msgbox(MBX_INFO, (wchar_t *)IDS_2074); ui_msgbox(MBX_INFO, (wchar_t *)IDS_2107);
} }
/* OK, claim the video. */ /* OK, claim the video. */

View File

@@ -31,6 +31,7 @@
#include "../cdrom/cdrom.h" #include "../cdrom/cdrom.h"
#include "../cdrom/cdrom_image.h" #include "../cdrom/cdrom_image.h"
#include "../cdrom/cdrom_null.h" #include "../cdrom/cdrom_null.h"
#include "../zip.h"
#include "../disk/hdd.h" #include "../disk/hdd.h"
#include "../scsi/scsi.h" #include "../scsi/scsi.h"
#include "../scsi/scsi_disk.h" #include "../scsi/scsi_disk.h"
@@ -151,6 +152,42 @@ cdrom_reload(uint8_t id)
} }
void
zip_eject(uint8_t id)
{
zip_close(id);
if (zip_drives[id].bus_type) {
/* Signal disk change to the emulated machine. */
zip_insert(id);
}
ui_sb_update_icon_state(SB_ZIP | id, 1);
ui_sb_enable_menu_item(SB_ZIP|id, IDM_ZIP_EJECT | id, MF_BYCOMMAND | MF_GRAYED);
ui_sb_enable_menu_item(SB_ZIP|id, IDM_ZIP_RELOAD | id, MF_BYCOMMAND | MF_ENABLED);
ui_sb_update_tip(SB_ZIP | id);
config_save();
}
void
zip_reload(uint8_t id)
{
zip_disk_reload(id);
if (wcslen(zip_drives[id].image_path) == 0) {
ui_sb_enable_menu_item(SB_ZIP|id, IDM_ZIP_EJECT | id, MF_BYCOMMAND | MF_GRAYED);
ui_sb_update_icon_state(SB_ZIP|id, 1);
} else {
ui_sb_enable_menu_item(SB_ZIP|id, IDM_ZIP_EJECT | id, MF_BYCOMMAND | MF_ENABLED);
ui_sb_update_icon_state(SB_ZIP|id, 0);
}
ui_sb_enable_menu_item(SB_ZIP|id, IDM_ZIP_RELOAD | id, MF_BYCOMMAND | MF_GRAYED);
ui_sb_update_tip(SB_ZIP|id);
config_save();
}
void void
removable_disk_unload(uint8_t id) removable_disk_unload(uint8_t id)
{ {

View File

@@ -8,7 +8,7 @@
* *
* Handle the New Floppy Image dialog. * Handle the New Floppy Image dialog.
* *
* Version: @(#)win_new_floppy.c 1.0.0 2018/01/18 * Version: @(#)win_new_floppy.c 1.0.1 2018/01/26
* *
* Authors: Miran Grca, <mgrca8@gmail.com> * Authors: Miran Grca, <mgrca8@gmail.com>
* *
@@ -19,6 +19,7 @@
#include <windows.h> #include <windows.h>
#include <windowsx.h> #include <windowsx.h>
#undef BITMAP #undef BITMAP
#include <commctrl.h>
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
@@ -28,6 +29,7 @@
#include "../plat.h" #include "../plat.h"
#include "../random.h" #include "../random.h"
#include "../ui.h" #include "../ui.h"
#include "../zip.h"
#include "win.h" #include "win.h"
@@ -48,18 +50,20 @@ typedef struct {
} disk_size_t; } disk_size_t;
disk_size_t disk_sizes[12] = { { 0, 1, 2, 1, 0, 40, 8, 2, 0xFE, 2, 2, 1, 112 }, /* 160k */ disk_size_t disk_sizes[14] = { { 0, 1, 2, 1, 0, 40, 8, 2, 0xFE, 2, 2, 1, 112 }, /* 160k */
{ 0, 1, 2, 1, 0, 40, 9, 2, 0xFC, 2, 2, 1, 112 }, /* 180k */ { 0, 1, 2, 1, 0, 40, 9, 2, 0xFC, 2, 2, 1, 112 }, /* 180k */
{ 0, 2, 2, 1, 0, 40, 8, 2, 0xFF, 2, 2, 1, 112 }, /* 320k */ { 0, 2, 2, 1, 0, 40, 8, 2, 0xFF, 2, 2, 1, 112 }, /* 320k */
{ 0, 2, 2, 1, 0, 40, 9, 2, 0xFD, 2, 2, 2, 112 }, /* 360k */ { 0, 2, 2, 1, 0, 40, 9, 2, 0xFD, 2, 2, 2, 112 }, /* 360k */
{ 0, 2, 2, 1, 0, 80, 8, 2, 0xFB, 2, 2, 2, 112 }, /* 640k */ { 0, 2, 2, 1, 0, 80, 8, 2, 0xFB, 2, 2, 2, 112 }, /* 640k */
{ 0, 2, 2, 1, 0, 80, 9, 2, 0xF9, 2, 2, 3, 112 }, /* 720k */ { 0, 2, 2, 1, 0, 80, 9, 2, 0xF9, 2, 2, 3, 112 }, /* 720k */
{ 1, 2, 0, 1, 1, 80, 15, 2, 0xF9, 1, 2, 7, 224 }, /* 1.2M */ { 1, 2, 0, 1, 1, 80, 15, 2, 0xF9, 1, 2, 7, 224 }, /* 1.2M */
{ 1, 2, 0, 1, 1, 77, 8, 3, 0xFE, 1, 2, 2, 192 }, /* 1.25M */ { 1, 2, 0, 1, 1, 77, 8, 3, 0xFE, 1, 2, 2, 192 }, /* 1.25M */
{ 1, 2, 0, 1, 0, 80, 18, 2, 0xF0, 1, 2, 9, 224 }, /* 1.44M */ { 1, 2, 0, 1, 0, 80, 18, 2, 0xF0, 1, 2, 9, 224 }, /* 1.44M */
{ 1, 2, 0, 1, 0, 80, 21, 2, 0xF0, 2, 2, 5, 16 }, /* DMF cluster 1024 */ { 1, 2, 0, 1, 0, 80, 21, 2, 0xF0, 2, 2, 5, 16 }, /* DMF cluster 1024 */
{ 1, 2, 0, 1, 0, 80, 21, 2, 0xF0, 4, 2, 3, 16 }, /* DMF cluster 2048 */ { 1, 2, 0, 1, 0, 80, 21, 2, 0xF0, 4, 2, 3, 16 }, /* DMF cluster 2048 */
{ 2, 2, 3, 1, 0, 80, 36, 2, 0xF0, 2, 2, 9, 240 } }; /* 2.88M */ { 2, 2, 3, 1, 0, 80, 36, 2, 0xF0, 2, 2, 9, 240 }, /* 2.88M */
{ 0, 64, 0, 0, 0, 96, 32, 2, 0, 0, 0, 0, 0 }, /* ZIP 100 */
{ 0, 64, 0, 0, 0, 239, 32, 2, 0, 0, 0, 0, 0 } }; /* ZIP 250 */
static char *empty; static char *empty;
@@ -168,6 +172,9 @@ create_86f(WCHAR *file_name, disk_size_t disk_size, uint8_t rpm_mode)
} }
static int is_zip;
static int static int
create_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_fdi) create_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_fdi)
{ {
@@ -188,6 +195,8 @@ create_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_fdi)
sector_bytes = (128 << disk_size.sector_len); sector_bytes = (128 << disk_size.sector_len);
total_sectors = disk_size.sides * disk_size.tracks * disk_size.sectors; total_sectors = disk_size.sides * disk_size.tracks * disk_size.sectors;
if (total_sectors > ZIP_SECTORS)
total_sectors = ZIP_250_SECTORS;
total_size = total_sectors * sector_bytes; total_size = total_sectors * sector_bytes;
root_dir_bytes = (disk_size.root_dir_entries << 5); root_dir_bytes = (disk_size.root_dir_entries << 5);
fat_size = (disk_size.spfat * sector_bytes); fat_size = (disk_size.spfat * sector_bytes);
@@ -195,7 +204,7 @@ create_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_fdi)
fat2_offs = fat1_offs + fat_size; fat2_offs = fat1_offs + fat_size;
zero_bytes = fat2_offs + fat_size + root_dir_bytes; zero_bytes = fat2_offs + fat_size + root_dir_bytes;
if (is_fdi) { if (!is_zip && is_fdi) {
empty = (char *) malloc(base); empty = (char *) malloc(base);
memset(empty, 0, base); memset(empty, 0, base);
@@ -212,52 +221,58 @@ create_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_fdi)
empty = (char *) malloc(total_size); empty = (char *) malloc(total_size);
memset(empty, 0x00, zero_bytes); memset(empty, 0x00, zero_bytes);
memset(empty + zero_bytes, 0xF6, total_size - zero_bytes);
empty[0x00] = 0xEB; /* Jump to make MS-DOS happy. */ if (!is_zip) {
empty[0x01] = 0x58; memset(empty + zero_bytes, 0xF6, total_size - zero_bytes);
empty[0x02] = 0x90;
empty[0x03] = 0x38; /* '86BOX5.0' OEM ID. */ empty[0x00] = 0xEB; /* Jump to make MS-DOS happy. */
empty[0x04] = 0x36; empty[0x01] = 0x58;
empty[0x05] = 0x42; empty[0x02] = 0x90;
empty[0x06] = 0x4F;
empty[0x07] = 0x58;
empty[0x08] = 0x35;
empty[0x09] = 0x2E;
empty[0x0A] = 0x30;
*(uint16_t *) &(empty[0x0B]) = (uint16_t) sector_bytes; empty[0x03] = 0x38; /* '86BOX5.0' OEM ID. */
*(uint8_t *) &(empty[0x0D]) = (uint8_t) disk_size.spc; empty[0x04] = 0x36;
*(uint16_t *) &(empty[0x0E]) = (uint16_t) 1; empty[0x05] = 0x42;
*(uint8_t *) &(empty[0x10]) = (uint8_t) disk_size.num_fats; empty[0x06] = 0x4F;
*(uint16_t *) &(empty[0x11]) = (uint16_t) disk_size.root_dir_entries; empty[0x07] = 0x58;
*(uint16_t *) &(empty[0x13]) = (uint16_t) total_sectors; empty[0x08] = 0x35;
*(uint8_t *) &(empty[0x15]) = (uint8_t) disk_size.media_desc; empty[0x09] = 0x2E;
*(uint16_t *) &(empty[0x16]) = (uint16_t) disk_size.spfat; empty[0x0A] = 0x30;
*(uint8_t *) &(empty[0x18]) = (uint8_t) disk_size.sectors;
*(uint8_t *) &(empty[0x1A]) = (uint8_t) disk_size.sides;
empty[0x26] = 0x29; /* ')' followed by randomly-generated volume serial number. */ *(uint16_t *) &(empty[0x0B]) = (uint16_t) sector_bytes;
empty[0x27] = random_generate(); *(uint8_t *) &(empty[0x0D]) = (uint8_t) disk_size.spc;
empty[0x28] = random_generate(); *(uint16_t *) &(empty[0x0E]) = (uint16_t) 1;
empty[0x29] = random_generate(); *(uint8_t *) &(empty[0x10]) = (uint8_t) disk_size.num_fats;
empty[0x2A] = random_generate(); *(uint16_t *) &(empty[0x11]) = (uint16_t) disk_size.root_dir_entries;
*(uint16_t *) &(empty[0x13]) = (uint16_t) total_sectors;
*(uint8_t *) &(empty[0x15]) = (uint8_t) disk_size.media_desc;
*(uint16_t *) &(empty[0x16]) = (uint16_t) disk_size.spfat;
*(uint8_t *) &(empty[0x18]) = (uint8_t) disk_size.sectors;
*(uint8_t *) &(empty[0x1A]) = (uint8_t) disk_size.sides;
memset(&(empty[0x2B]), 0x20, 11); empty[0x26] = 0x29; /* ')' followed by randomly-generated volume serial number. */
empty[0x27] = random_generate();
empty[0x28] = random_generate();
empty[0x29] = random_generate();
empty[0x2A] = random_generate();
empty[0x36] = 'F'; memset(&(empty[0x2B]), 0x20, 11);
empty[0x37] = 'A';
empty[0x38] = 'T';
empty[0x39] = '1';
empty[0x3A] = '2';
empty[0x1FE] = 0x55; empty[0x36] = 'F';
empty[0x1FF] = 0xAA; empty[0x37] = 'A';
empty[0x38] = 'T';
empty[0x39] = '1';
empty[0x3A] = '2';
empty[0x3B] = ' ';
empty[0x3C] = ' ';
empty[0x3D] = ' ';
empty[fat1_offs + 0x00] = empty[fat2_offs + 0x00] = empty[0x15]; empty[0x1FE] = 0x55;
empty[fat1_offs + 0x01] = empty[fat2_offs + 0x01] = empty[0xFF]; empty[0x1FF] = 0xAA;
empty[fat1_offs + 0x02] = empty[fat2_offs + 0x02] = empty[0xFF];
empty[fat1_offs + 0x00] = empty[fat2_offs + 0x00] = empty[0x15];
empty[fat1_offs + 0x01] = empty[fat2_offs + 0x01] = 0xFF;
empty[fat1_offs + 0x02] = empty[fat2_offs + 0x02] = 0xFF;
}
fwrite(empty, 1, total_size, f); fwrite(empty, 1, total_size, f);
free(empty); free(empty);
@@ -268,6 +283,236 @@ create_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_fdi)
} }
static int
create_zip_sector_image(WCHAR *file_name, disk_size_t disk_size, uint8_t is_zdi, HWND hwnd)
{
HWND h;
FILE *f;
uint32_t total_size = 0;
uint32_t total_sectors = 0;
uint32_t sector_bytes = 0;
uint32_t root_dir_bytes = 0;
uint32_t fat_size = 0;
uint32_t fat1_offs = 0;
uint32_t fat2_offs = 0;
uint32_t zero_bytes = 0;
uint16_t base = 0x1000;
uint32_t pbar_max = 0;
uint32_t i;
f = plat_fopen(file_name, L"wb");
if (!f)
return 0;
sector_bytes = (128 << disk_size.sector_len);
total_sectors = disk_size.sides * disk_size.tracks * disk_size.sectors;
if (total_sectors > ZIP_SECTORS)
total_sectors = ZIP_250_SECTORS;
total_size = total_sectors * sector_bytes;
root_dir_bytes = (disk_size.root_dir_entries << 5);
fat_size = (disk_size.spfat * sector_bytes);
fat1_offs = sector_bytes;
fat2_offs = fat1_offs + fat_size;
zero_bytes = fat2_offs + fat_size + root_dir_bytes;
pbar_max = total_size;
if (is_zdi)
pbar_max += base;
pbar_max >>= 11;
pbar_max--;
h = GetDlgItem(hwnd, IDC_COMBO_RPM_MODE);
EnableWindow(h, FALSE);
ShowWindow(h, SW_HIDE);
h = GetDlgItem(hwnd, IDT_1751);
EnableWindow(h, FALSE);
ShowWindow(h, SW_HIDE);
h = GetDlgItem(hwnd, IDC_PBAR_IMG_CREATE);
SendMessage(h, PBM_SETRANGE32, (WPARAM) 0, (LPARAM) pbar_max);
SendMessage(h, PBM_SETPOS, (WPARAM) 0, (LPARAM) 0);
EnableWindow(h, TRUE);
ShowWindow(h, SW_SHOW);
h = GetDlgItem(hwnd, IDT_1757);
EnableWindow(h, TRUE);
ShowWindow(h, SW_SHOW);
h = GetDlgItem(hwnd, IDC_PBAR_IMG_CREATE);
pbar_max++;
if (is_zdi) {
empty = (char *) malloc(base);
memset(empty, 0, base);
*(uint32_t *) &(empty[0x08]) = (uint32_t) base;
*(uint32_t *) &(empty[0x0C]) = total_size;
*(uint16_t *) &(empty[0x10]) = (uint16_t) sector_bytes;
*(uint8_t *) &(empty[0x14]) = (uint8_t) disk_size.sectors;
*(uint8_t *) &(empty[0x18]) = (uint8_t) disk_size.sides;
*(uint8_t *) &(empty[0x1C]) = (uint8_t) disk_size.tracks;
fwrite(empty, 1, 2048, f);
SendMessage(h, PBM_SETPOS, (WPARAM) 1, (LPARAM) 0);
fwrite(&empty[0x0800], 1, 2048, f);
free(empty);
SendMessage(h, PBM_SETPOS, (WPARAM) 2, (LPARAM) 0);
pbar_max -= 2;
}
empty = (char *) malloc(total_size);
memset(empty, 0x00, zero_bytes);
if (total_sectors == ZIP_SECTORS) {
/* ZIP 100 */
/* MBR */
*(uint64_t *) &(empty[0x0000]) = 0x0000030000025245LL;
*(uint64_t *) &(empty[0x0008]) = 0x0000000000000000LL;
*(uint64_t *) &(empty[0x0010]) = 0x0900E90300000100LL;
*(uint64_t *) &(empty[0x0018]) = 0x726F70726F430100LL;
*(uint64_t *) &(empty[0x0020]) = 0x202D206E6F697461LL;
*(uint64_t *) &(empty[0x0028]) = 0x30392F33322F3131LL;
*(uint64_t *) &(empty[0x01AE]) = 0x0116010100E905E2LL;
*(uint64_t *) &(empty[0x01B6]) = 0x226BEDCE014E0135LL;
*(uint64_t *) &(empty[0x01BE]) = 0x5E203F0600010180LL;
*(uint64_t *) &(empty[0x01C6]) = 0x0002FE6000000020LL;
*(uint16_t *) &(empty[0x01FE]) = 0xAA55;
/* 4 sectors filled with 0xFA */
memset(&(empty[0x0200]), 0xFA, 0x0800);
/* Iomega_Reserved sector */
*(uint64_t *) &(empty[0x0A00]) = 0x0500000000004D50LL;
*(uint64_t *) &(empty[0x0A08]) = 0xAFF9010051060100LL;
*(uint64_t *) &(empty[0x0A30]) = 0x525F6167656D6F49LL;
*(uint64_t *) &(empty[0x0A38]) = 0x0064657672657365LL;
*(uint64_t *) &(empty[0x0A54]) = 0x03000000AFF90100LL;
/* 26 sectors filled with 0x48 */
memset(&(empty[0x0C00]), 0x48, 0x3400);
/* Boot sector */
*(uint64_t *) &(empty[0x4000]) = 0x584F4236389058EBLL;
*(uint64_t *) &(empty[0x4008]) = 0x0001040200302E35LL;
*(uint64_t *) &(empty[0x4010]) = 0x00C0F80000020002LL;
*(uint64_t *) &(empty[0x4018]) = 0x0000002000400020LL;
*(uint32_t *) &(empty[0x4020]) = 0x0002FFE0;
*(uint16_t *) &(empty[0x4024]) = 0x0080;
empty[0x4026] = 0x29; /* ')' followed by randomly-generated volume serial number. */
empty[0x4027] = random_generate();
empty[0x4028] = random_generate();
empty[0x4029] = random_generate();
empty[0x402A] = random_generate();
memset(&(empty[0x402B]), 0x00, 0x000B);
memset(&(empty[0x4036]), 0x20, 0x0008);
empty[0x4036] = 'F';
empty[0x4037] = 'A';
empty[0x4038] = 'T';
empty[0x4039] = '1';
empty[0x403A] = '6';
empty[0x41FE] = 0x55;
empty[0x41FF] = 0xAA;
empty[0x4200] = empty[0x1C200] = empty[0x4015];
empty[0x4201] = empty[0x1C201] = 0xFF;
empty[0x4202] = empty[0x1C202] = 0xFF;
empty[0x4203] = empty[0x1C203] = 0xFF;
/* Root directory = 0x34200
Data = 0x38200 */
} else {
/* ZIP 250 */
/* MBR */
*(uint64_t *) &(empty[0x0000]) = 0x2054524150492EEBLL;
*(uint64_t *) &(empty[0x0008]) = 0x3930302065646F63LL;
*(uint64_t *) &(empty[0x0010]) = 0x67656D6F49202D20LL;
*(uint64_t *) &(empty[0x0018]) = 0x726F70726F432061LL;
*(uint64_t *) &(empty[0x0020]) = 0x202D206E6F697461LL;
*(uint64_t *) &(empty[0x0028]) = 0x30392F33322F3131LL;
*(uint64_t *) &(empty[0x01AE]) = 0x0116010100E900E9LL;
*(uint64_t *) &(empty[0x01B6]) = 0x2E32A7AC014E0135LL;
*(uint64_t *) &(empty[0x01EE]) = 0xEE203F0600010180LL;
*(uint64_t *) &(empty[0x01F6]) = 0x000777E000000020LL;
*(uint16_t *) &(empty[0x01FE]) = 0xAA55;
/* 31 sectors filled with 0x48 */
memset(&(empty[0x0200]), 0x48, 0x3E00);
/* The second sector begins with some strange data
in my reference image. */
*(uint64_t *) &(empty[0x0200]) = 0x3831393230334409LL;
*(uint64_t *) &(empty[0x0208]) = 0x6A57766964483130LL;
*(uint64_t *) &(empty[0x0210]) = 0x3C3A34676063653FLL;
*(uint64_t *) &(empty[0x0218]) = 0x586A56A8502C4161LL;
*(uint64_t *) &(empty[0x0220]) = 0x6F2D702535673D6CLL;
*(uint64_t *) &(empty[0x0228]) = 0x255421B8602D3456LL;
*(uint64_t *) &(empty[0x0230]) = 0x577B22447B52603ELL;
*(uint64_t *) &(empty[0x0238]) = 0x46412CC871396170LL;
*(uint64_t *) &(empty[0x0240]) = 0x704F55237C5E2626LL;
*(uint64_t *) &(empty[0x0248]) = 0x6C7932C87D5C3C20LL;
*(uint64_t *) &(empty[0x0250]) = 0x2C50503E47543D6ELL;
*(uint64_t *) &(empty[0x0258]) = 0x46394E807721536ALL;
*(uint64_t *) &(empty[0x0260]) = 0x505823223F245325LL;
*(uint64_t *) &(empty[0x0268]) = 0x365C79B0393B5B6ELL;
/* Boot sector */
*(uint64_t *) &(empty[0x4000]) = 0x584F4236389058EBLL;
*(uint64_t *) &(empty[0x4008]) = 0x0001080200302E35LL;
*(uint64_t *) &(empty[0x4010]) = 0x00EFF80000020002LL;
*(uint64_t *) &(empty[0x4018]) = 0x0000002000400020LL;
*(uint32_t *) &(empty[0x4020]) = 0x000777E0;
*(uint16_t *) &(empty[0x4024]) = 0x0080;
empty[0x4026] = 0x29; /* ')' followed by randomly-generated volume serial number. */
empty[0x4027] = random_generate();
empty[0x4028] = random_generate();
empty[0x4029] = random_generate();
empty[0x402A] = random_generate();
memset(&(empty[0x402B]), 0x00, 0x000B);
memset(&(empty[0x4036]), 0x20, 0x0008);
empty[0x4036] = 'F';
empty[0x4037] = 'A';
empty[0x4038] = 'T';
empty[0x4039] = '1';
empty[0x403A] = '6';
empty[0x41FE] = 0x55;
empty[0x41FF] = 0xAA;
empty[0x4200] = empty[0x22000] = empty[0x4015];
empty[0x4201] = empty[0x22001] = 0xFF;
empty[0x4202] = empty[0x22002] = 0xFF;
empty[0x4203] = empty[0x22003] = 0xFF;
/* Root directory = 0x3FE00
Data = 0x38200 */
}
for (i = 0; i < pbar_max; i++) {
fwrite(&empty[i << 11], 1, 2048, f);
SendMessage(h, PBM_SETPOS, (WPARAM) i + 2, (LPARAM) 0);
}
free(empty);
fclose(f);
return 1;
}
static int fdd_id, sb_part; static int fdd_id, sb_part;
static int file_type = 0; /* 0 = IMG, 1 = Japanese FDI, 2 = 86F */ static int file_type = 0; /* 0 = IMG, 1 = Japanese FDI, 2 = 86F */
@@ -306,18 +551,27 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
uint8_t disk_size, rpm_mode; uint8_t disk_size, rpm_mode;
int ret; int ret;
FILE *f; FILE *f;
int zip_types;
switch (message) { switch (message) {
case WM_INITDIALOG: case WM_INITDIALOG:
plat_pause(1); plat_pause(1);
memset(fd_file_name, 0, 512 * sizeof(wchar_t)); memset(fd_file_name, 0, 512 * sizeof(wchar_t));
h = GetDlgItem(hdlg, IDC_COMBO_DISK_SIZE); h = GetDlgItem(hdlg, IDC_COMBO_DISK_SIZE);
for (i = 0; i < 12; i++) if (is_zip) {
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) plat_get_string(IDS_5888 + i)); zip_types = zip_drives[fdd_id].is_250 ? 2 : 1;
for (i = 0; i < zip_types; i++)
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) plat_get_string(IDS_5900 + i));
} else {
for (i = 0; i < 12; i++)
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) plat_get_string(IDS_5888 + i));
}
SendMessage(h, CB_SETCURSEL, 0, 0);
EnableWindow(h, FALSE); EnableWindow(h, FALSE);
h = GetDlgItem(hdlg, IDC_COMBO_RPM_MODE); h = GetDlgItem(hdlg, IDC_COMBO_RPM_MODE);
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) plat_get_string(IDS_6144 + i)); SendMessage(h, CB_ADDSTRING, 0, (LPARAM) plat_get_string(IDS_6144 + i));
SendMessage(h, CB_SETCURSEL, 0, 0);
EnableWindow(h, FALSE); EnableWindow(h, FALSE);
ShowWindow(h, SW_HIDE); ShowWindow(h, SW_HIDE);
h = GetDlgItem(hdlg, IDT_1751); h = GetDlgItem(hdlg, IDT_1751);
@@ -325,6 +579,12 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
ShowWindow(h, SW_HIDE); ShowWindow(h, SW_HIDE);
h = GetDlgItem(hdlg, IDOK); h = GetDlgItem(hdlg, IDOK);
EnableWindow(h, FALSE); EnableWindow(h, FALSE);
h = GetDlgItem(hdlg, IDC_PBAR_IMG_CREATE);
EnableWindow(h, FALSE);
ShowWindow(h, SW_HIDE);
h = GetDlgItem(hdlg, IDT_1757);
EnableWindow(h, FALSE);
ShowWindow(h, SW_HIDE);
break; break;
case WM_COMMAND: case WM_COMMAND:
@@ -332,15 +592,24 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
case IDOK: case IDOK:
h = GetDlgItem(hdlg, IDC_COMBO_DISK_SIZE); h = GetDlgItem(hdlg, IDC_COMBO_DISK_SIZE);
disk_size = SendMessage(h, CB_GETCURSEL, 0, 0); disk_size = SendMessage(h, CB_GETCURSEL, 0, 0);
if (is_zip)
disk_size += 12;
if (file_type == 2) { if (file_type == 2) {
h = GetDlgItem(hdlg, IDC_COMBO_RPM_MODE); h = GetDlgItem(hdlg, IDC_COMBO_RPM_MODE);
rpm_mode = SendMessage(h, CB_GETCURSEL, 0, 0); rpm_mode = SendMessage(h, CB_GETCURSEL, 0, 0);
ret = create_86f(fd_file_name, disk_sizes[disk_size], rpm_mode); ret = create_86f(fd_file_name, disk_sizes[disk_size], rpm_mode);
} else } else {
ret = create_sector_image(fd_file_name, disk_sizes[disk_size], file_type); if (is_zip)
if (ret) ret = create_zip_sector_image(fd_file_name, disk_sizes[disk_size], file_type, hdlg);
ui_sb_mount_floppy_img(fdd_id, sb_part, 0, fd_file_name); else
else { ret = create_sector_image(fd_file_name, disk_sizes[disk_size], file_type);
}
if (ret) {
if (is_zip)
ui_sb_mount_zip_img(fdd_id, sb_part, 0, fd_file_name);
else
ui_sb_mount_floppy_img(fdd_id, sb_part, 0, fd_file_name);
} else {
new_floppy_msgbox(hdlg, MBX_ERROR, (wchar_t *)IDS_4108); new_floppy_msgbox(hdlg, MBX_ERROR, (wchar_t *)IDS_4108);
return TRUE; return TRUE;
} }
@@ -350,7 +619,7 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
return TRUE; return TRUE;
case IDC_CFILE: case IDC_CFILE:
if (!file_dlg_w(hdlg, plat_get_string(IDS_2174), L"", 1)) { if (!file_dlg_w(hdlg, plat_get_string(is_zip ? IDS_2176 : IDS_2174), L"", 1)) {
h = GetDlgItem(hdlg, IDC_EDIT_FILE_NAME); h = GetDlgItem(hdlg, IDC_EDIT_FILE_NAME);
f = _wfopen(wopenfilestring, L"rb"); f = _wfopen(wopenfilestring, L"rb");
if (f != NULL) { if (f != NULL) {
@@ -362,16 +631,24 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
memset(fd_file_name, 0, sizeof(fd_file_name)); memset(fd_file_name, 0, sizeof(fd_file_name));
wcscpy(fd_file_name, wopenfilestring); wcscpy(fd_file_name, wopenfilestring);
h = GetDlgItem(hdlg, IDC_COMBO_DISK_SIZE); h = GetDlgItem(hdlg, IDC_COMBO_DISK_SIZE);
EnableWindow(h, TRUE); if (!is_zip || zip_drives[fdd_id].is_250)
EnableWindow(h, TRUE);
wcs_len = wcslen(wopenfilestring); wcs_len = wcslen(wopenfilestring);
ext_offs = wcs_len - 4; ext_offs = wcs_len - 4;
ext = &(wopenfilestring[ext_offs]); ext = &(wopenfilestring[ext_offs]);
if ((wcs_len >= 4) && !wcsicmp(ext, L".FDI")) if (is_zip) {
file_type = 1; if (((wcs_len >= 4) && !wcsicmp(ext, L".ZDI")))
else if ((wcs_len >= 4) && !wcsicmp(ext, L".86F")) file_type = 1;
file_type = 2; else
else file_type = 0;
file_type = 0; } else {
if (((wcs_len >= 4) && !wcsicmp(ext, L".FDI")))
file_type = 1;
else if ((((wcs_len >= 4) && !wcsicmp(ext, L".86F")) || (filterindex == 3)))
file_type = 2;
else
file_type = 0;
}
h = GetDlgItem(hdlg, IDT_1751); h = GetDlgItem(hdlg, IDT_1751);
if (file_type == 2) { if (file_type == 2) {
EnableWindow(h, TRUE); EnableWindow(h, TRUE);
@@ -407,7 +684,8 @@ NewFloppyDialogProcedure(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
void void
NewFloppyDialogCreate(HWND hwnd, int id, int part) NewFloppyDialogCreate(HWND hwnd, int id, int part)
{ {
fdd_id = id; fdd_id = id & 0x7f;
sb_part = part; sb_part = part;
is_zip = !!(id & 0x80);
DialogBox(hinstance, (LPCTSTR)DLG_NEW_FLOPPY, hwnd, NewFloppyDialogProcedure); DialogBox(hinstance, (LPCTSTR)DLG_NEW_FLOPPY, hwnd, NewFloppyDialogProcedure);
} }

File diff suppressed because it is too large Load Diff

View File

@@ -8,7 +8,7 @@
* *
* Implement the application's Status Bar. * Implement the application's Status Bar.
* *
* Version: @(#)win_stbar.c 1.0.9 2018/01/18 * Version: @(#)win_stbar.c 1.0.10 2018/01/23
* *
* Authors: Miran Grca, <mgrca8@gmail.com> * Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com> * Fred N. van Kempen, <decwiz@yahoo.com>
@@ -36,6 +36,7 @@
#include "../cdrom/cdrom.h" #include "../cdrom/cdrom.h"
#include "../cdrom/cdrom_image.h" #include "../cdrom/cdrom_image.h"
#include "../cdrom/cdrom_null.h" #include "../cdrom/cdrom_null.h"
#include "../zip.h"
#include "../disk/hdd.h" #include "../disk/hdd.h"
#include "../disk/hdc.h" #include "../disk/hdc.h"
#include "../floppy/fdd.h" #include "../floppy/fdd.h"
@@ -132,11 +133,11 @@ StatusBarCreateFloppySubmenu(HMENU m, int id)
AppendMenu(m, MF_STRING, IDM_FLOPPY_IMAGE_EXISTING_WP | id, AppendMenu(m, MF_STRING, IDM_FLOPPY_IMAGE_EXISTING_WP | id,
plat_get_string(IDS_2163)); plat_get_string(IDS_2163));
AppendMenu(m, MF_SEPARATOR, 0, 0); AppendMenu(m, MF_SEPARATOR, 0, 0);
AppendMenu(m, MF_STRING, IDM_FLOPPY_EJECT | id,
plat_get_string(IDS_2164));
AppendMenu(m, MF_SEPARATOR, 0, 0);
AppendMenu(m, MF_STRING, IDM_FLOPPY_EXPORT_TO_86F | id, AppendMenu(m, MF_STRING, IDM_FLOPPY_EXPORT_TO_86F | id,
plat_get_string(IDS_2172)); plat_get_string(IDS_2172));
AppendMenu(m, MF_SEPARATOR, 0, 0);
AppendMenu(m, MF_STRING, IDM_FLOPPY_EJECT | id,
plat_get_string(IDS_2164));
if (floppyfns[id][0] == 0x0000) { if (floppyfns[id][0] == 0x0000) {
EnableMenuItem(m, IDM_FLOPPY_EJECT | id, MF_BYCOMMAND | MF_GRAYED); EnableMenuItem(m, IDM_FLOPPY_EJECT | id, MF_BYCOMMAND | MF_GRAYED);
@@ -203,11 +204,37 @@ check_menu_items:
} }
static void
StatusBarCreateZIPSubmenu(HMENU m, int id)
{
AppendMenu(m, MF_STRING, IDM_ZIP_IMAGE_NEW | id,
plat_get_string(IDS_2161));
AppendMenu(m, MF_SEPARATOR, 0, 0);
AppendMenu(m, MF_STRING, IDM_ZIP_IMAGE_EXISTING | id,
plat_get_string(IDS_2162));
AppendMenu(m, MF_STRING, IDM_ZIP_IMAGE_EXISTING_WP | id,
plat_get_string(IDS_2163));
AppendMenu(m, MF_SEPARATOR, 0, 0);
AppendMenu(m, MF_STRING, IDM_ZIP_EJECT | id,
plat_get_string(IDS_2164));
AppendMenu(m, MF_STRING, IDM_ZIP_RELOAD | id,
plat_get_string(IDS_2167));
if (zip_drives[id].image_path[0] == 0x0000) {
EnableMenuItem(m, IDM_ZIP_EJECT | id, MF_BYCOMMAND | MF_GRAYED);
EnableMenuItem(m, IDM_ZIP_RELOAD | id, MF_BYCOMMAND | MF_ENABLED);
} else {
EnableMenuItem(m, IDM_ZIP_EJECT | id, MF_BYCOMMAND | MF_ENABLED);
EnableMenuItem(m, IDM_ZIP_RELOAD | id, MF_BYCOMMAND | MF_GRAYED);
}
}
static void static void
StatusBarCreateRemovableDiskSubmenu(HMENU m, int id) StatusBarCreateRemovableDiskSubmenu(HMENU m, int id)
{ {
AppendMenu(m, MF_STRING, IDM_RDISK_EJECT | id, AppendMenu(m, MF_STRING, IDM_RDISK_EJECT | id,
plat_get_string(IDS_2166)); plat_get_string(IDS_2164));
AppendMenu(m, MF_STRING, IDM_RDISK_RELOAD | id, AppendMenu(m, MF_STRING, IDM_RDISK_RELOAD | id,
plat_get_string(IDS_2167)); plat_get_string(IDS_2167));
AppendMenu(m, MF_SEPARATOR, 0, 0); AppendMenu(m, MF_SEPARATOR, 0, 0);
@@ -358,6 +385,32 @@ StatusBarCreateCdromTip(int part)
} }
static void
StatusBarCreateZIPTip(int part)
{
WCHAR tempTip[512];
int drive = sb_part_meanings[part] & 0xf;
int type = zip_drives[drive].is_250 ? 250 : 100;
if (wcslen(floppyfns[drive]) == 0) {
_swprintf(tempTip, plat_get_string(IDS_2177),
drive+1, type, plat_get_string(IDS_2057));
} else {
_swprintf(tempTip, plat_get_string(IDS_2177),
drive+1, type, zip_drives[drive].image_path);
}
if (sbTips[part] != NULL) {
free(sbTips[part]);
sbTips[part] = NULL;
}
sbTips[part] = (WCHAR *)malloc((wcslen(tempTip) << 1) + 2);
wcscpy(sbTips[part], tempTip);
}
static void static void
StatusBarCreateRemovableDiskTip(int part) StatusBarCreateRemovableDiskTip(int part)
{ {
@@ -437,6 +490,10 @@ ui_sb_update_tip(int meaning)
StatusBarCreateCdromTip(part); StatusBarCreateCdromTip(part);
break; break;
case SB_ZIP:
StatusBarCreateZIPTip(part);
break;
case SB_RDISK: case SB_RDISK:
StatusBarCreateRemovableDiskTip(part); StatusBarCreateRemovableDiskTip(part);
break; break;
@@ -584,6 +641,27 @@ ui_sb_update_panes(void)
sb_parts++; sb_parts++;
} }
} }
for (i=0; i<ZIP_NUM; i++) {
/* Could be Internal or External IDE.. */
if ((zip_drives[i].bus_type==ZIP_BUS_ATAPI_PIO_ONLY) &&
!(hdint || !memcmp(hdc_name, "ide", 3))) {
continue;
}
/* Could be Internal or External IDE.. */
if ((zip_drives[i].bus_type==ZIP_BUS_ATAPI_PIO_AND_DMA) &&
!(hdint || !memcmp(hdc_name, "ide", 3))) {
continue;
}
if ((zip_drives[i].bus_type == ZIP_BUS_SCSI) &&
(scsi_card_current == 0)) {
continue;
}
if (zip_drives[i].bus_type != 0) {
sb_parts++;
}
}
for (i=0; i<HDD_NUM; i++) { for (i=0; i<HDD_NUM; i++) {
if ((hdd[i].bus==HDD_BUS_SCSI_REMOVABLE) && (scsi_card_current != 0)) { if ((hdd[i].bus==HDD_BUS_SCSI_REMOVABLE) && (scsi_card_current != 0)) {
sb_parts++; sb_parts++;
@@ -659,6 +737,27 @@ ui_sb_update_panes(void)
sb_parts++; sb_parts++;
} }
} }
for (i=0; i<ZIP_NUM; i++) {
/* Could be Internal or External IDE.. */
if ((zip_drives[i].bus_type==ZIP_BUS_ATAPI_PIO_ONLY) &&
!(hdint || !memcmp(hdc_name, "ide", 3))) {
continue;
}
/* Could be Internal or External IDE.. */
if ((zip_drives[i].bus_type==ZIP_BUS_ATAPI_PIO_AND_DMA) &&
!(hdint || !memcmp(hdc_name, "ide", 3))) {
continue;
}
if ((zip_drives[i].bus_type == ZIP_BUS_SCSI) && (scsi_card_current == 0)) {
continue;
}
if (zip_drives[i].bus_type != 0) {
edge += SB_ICON_WIDTH;
iStatusWidths[sb_parts] = edge;
sb_part_meanings[sb_parts] = SB_ZIP | i;
sb_parts++;
}
}
for (i=0; i<HDD_NUM; i++) { for (i=0; i<HDD_NUM; i++) {
if ((hdd[i].bus==HDD_BUS_SCSI_REMOVABLE) && (scsi_card_current != 0)) { if ((hdd[i].bus==HDD_BUS_SCSI_REMOVABLE) && (scsi_card_current != 0)) {
edge += SB_ICON_WIDTH; edge += SB_ICON_WIDTH;
@@ -745,9 +844,18 @@ ui_sb_update_panes(void)
StatusBarCreateCdromTip(i); StatusBarCreateCdromTip(i);
break; break;
case SB_ZIP: /* Iomega ZIP */
sb_icon_flags[i] = (wcslen(floppyfns[sb_part_meanings[i] & 0xf]) == 0) ? 256 : 0;
sb_part_icons[i] = 176 + sb_icon_flags[i];
sb_menu_handles[i] = StatusBarCreatePopupMenu(i);
StatusBarCreateZIPSubmenu(sb_menu_handles[i], sb_part_meanings[i] & 0xf);
EnableMenuItem(sb_menu_handles[i], IDM_ZIP_EJECT | (sb_part_meanings[i] & 0xf), MF_BYCOMMAND | ((sb_icon_flags[i] & 256) ? MF_GRAYED : MF_ENABLED));
StatusBarCreateZIPTip(i);
break;
case SB_RDISK: /* Removable hard disk */ case SB_RDISK: /* Removable hard disk */
sb_icon_flags[i] = (wcslen(hdd[sb_part_meanings[i] & 0x1f].fn) == 0) ? 256 : 0; sb_icon_flags[i] = (wcslen(hdd[sb_part_meanings[i] & 0x1f].fn) == 0) ? 256 : 0;
sb_part_icons[i] = 176 + sb_icon_flags[i]; sb_part_icons[i] = 192 + sb_icon_flags[i];
sb_menu_handles[i] = StatusBarCreatePopupMenu(i); sb_menu_handles[i] = StatusBarCreatePopupMenu(i);
StatusBarCreateRemovableDiskSubmenu(sb_menu_handles[i], sb_part_meanings[i] & 0x1f); StatusBarCreateRemovableDiskSubmenu(sb_menu_handles[i], sb_part_meanings[i] & 0x1f);
EnableMenuItem(sb_menu_handles[i], IDM_RDISK_EJECT | (sb_part_meanings[i] & 0x1f), MF_BYCOMMAND | ((sb_icon_flags[i] & 256) ? MF_GRAYED : MF_ENABLED)); EnableMenuItem(sb_menu_handles[i], IDM_RDISK_EJECT | (sb_part_meanings[i] & 0x1f), MF_BYCOMMAND | ((sb_icon_flags[i] & 256) ? MF_GRAYED : MF_ENABLED));
@@ -757,12 +865,12 @@ ui_sb_update_panes(void)
break; break;
case SB_HDD: /* Hard disk */ case SB_HDD: /* Hard disk */
sb_part_icons[i] = 192; sb_part_icons[i] = 208;
StatusBarCreateDiskTip(i); StatusBarCreateDiskTip(i);
break; break;
case SB_NETWORK: /* Network */ case SB_NETWORK: /* Network */
sb_part_icons[i] = 208; sb_part_icons[i] = 224;
StatusBarCreateNetworkTip(i); StatusBarCreateNetworkTip(i);
break; break;
@@ -802,14 +910,29 @@ StatusBarPopupMenu(HWND hwnd, POINT pt, int id)
void void
ui_sb_mount_floppy_img(uint8_t id, int part, uint8_t wp, wchar_t *file_name) ui_sb_mount_floppy_img(uint8_t id, int part, uint8_t wp, wchar_t *file_name)
{ {
fdd_close(id); fdd_close(id);
ui_writeprot[id] = wp; ui_writeprot[id] = wp;
fdd_load(id, file_name); fdd_load(id, file_name);
ui_sb_update_icon_state(SB_FLOPPY | id, wcslen(floppyfns[id]) ? 0 : 1); ui_sb_update_icon_state(SB_FLOPPY | id, wcslen(floppyfns[id]) ? 0 : 1);
EnableMenuItem(sb_menu_handles[part], IDM_FLOPPY_EJECT | id, MF_BYCOMMAND | (wcslen(floppyfns[id]) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(sb_menu_handles[part], IDM_FLOPPY_EJECT | id, MF_BYCOMMAND | (wcslen(floppyfns[id]) ? MF_ENABLED : MF_GRAYED));
EnableMenuItem(sb_menu_handles[part], IDM_FLOPPY_EXPORT_TO_86F | id, MF_BYCOMMAND | (wcslen(floppyfns[id]) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(sb_menu_handles[part], IDM_FLOPPY_EXPORT_TO_86F | id, MF_BYCOMMAND | (wcslen(floppyfns[id]) ? MF_ENABLED : MF_GRAYED));
ui_sb_update_tip(SB_FLOPPY | id); ui_sb_update_tip(SB_FLOPPY | id);
config_save(); config_save();
}
void
ui_sb_mount_zip_img(uint8_t id, int part, uint8_t wp, wchar_t *file_name)
{
zip_close(id);
zip_drives[id].ui_writeprot = wp;
zip_load(id, file_name);
zip_insert(id);
ui_sb_update_icon_state(SB_ZIP | id, wcslen(zip_drives[id].image_path) ? 0 : 1);
EnableMenuItem(sb_menu_handles[part], IDM_ZIP_EJECT | id, MF_BYCOMMAND | (wcslen(zip_drives[id].image_path) ? MF_ENABLED : MF_GRAYED));
EnableMenuItem(sb_menu_handles[part], IDM_ZIP_RELOAD | id, MF_BYCOMMAND | (wcslen(zip_drives[id].image_path) ? MF_GRAYED : MF_ENABLED));
ui_sb_update_tip(SB_ZIP | id);
config_save();
} }
@@ -981,6 +1104,34 @@ StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
config_save(); config_save();
break; break;
case IDM_ZIP_IMAGE_NEW:
id = item_params & 0x0003;
part = ui_sb_find_part(SB_ZIP | id);
NewFloppyDialogCreate(hwnd, id | 0x80, part); /* NewZIPDialogCreate */
break;
case IDM_ZIP_IMAGE_EXISTING:
case IDM_ZIP_IMAGE_EXISTING_WP:
id = item_params & 0x0003;
part = ui_sb_find_part(SB_ZIP | id);
if ((part == -1) || (sb_menu_handles == NULL))
break;
ret = file_dlg_w_st(hwnd, IDS_2175, zip_drives[id].image_path, 0);
if (! ret)
ui_sb_mount_zip_img(id, part, (item_id == IDM_ZIP_IMAGE_EXISTING_WP) ? 1 : 0, wopenfilestring);
break;
case IDM_ZIP_EJECT:
id = item_params & 0x0003;
zip_eject(id);
break;
case IDM_ZIP_RELOAD:
id = item_params & 0x0003;
zip_reload(id);
break;
case IDM_RDISK_EJECT: case IDM_RDISK_EJECT:
id = item_params & 0x001f; id = item_params & 0x001f;
removable_disk_eject(id); removable_disk_eject(id);
@@ -1068,6 +1219,8 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
hIcon[i] = LoadIconEx((PCTSTR) i); hIcon[i] = LoadIconEx((PCTSTR) i);
for (i = 208; i < 210; i++) for (i = 208; i < 210; i++)
hIcon[i] = LoadIconEx((PCTSTR) i); hIcon[i] = LoadIconEx((PCTSTR) i);
for (i = 224; i < 226; i++)
hIcon[i] = LoadIconEx((PCTSTR) i);
for (i = 384; i < 386; i++) for (i = 384; i < 386; i++)
hIcon[i] = LoadIconEx((PCTSTR) i); hIcon[i] = LoadIconEx((PCTSTR) i);
for (i = 400; i < 402; i++) for (i = 400; i < 402; i++)
@@ -1076,6 +1229,8 @@ StatusBarCreate(HWND hwndParent, uintptr_t idStatus, HINSTANCE hInst)
hIcon[i] = LoadIconEx((PCTSTR) i); hIcon[i] = LoadIconEx((PCTSTR) i);
for (i = 432; i < 434; i++) for (i = 432; i < 434; i++)
hIcon[i] = LoadIconEx((PCTSTR) i); hIcon[i] = LoadIconEx((PCTSTR) i);
for (i = 448; i < 450; i++)
hIcon[i] = LoadIconEx((PCTSTR) i);
GetWindowRect(hwndParent, &rectDialog); GetWindowRect(hwndParent, &rectDialog);
dw = rectDialog.right - rectDialog.left; dw = rectDialog.right - rectDialog.left;

2550
src/zip.c Normal file

File diff suppressed because it is too large Load Diff

210
src/zip.h Normal file
View File

@@ -0,0 +1,210 @@
/*
* 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 the Iomega ZIP drive with SCSI(-like)
* commands, for both ATAPI and SCSI usage.
*
* Version: @(#)zip.h 1.0.0 2018/01/22
*
* Author: Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2018 Miran Grca.
*/
#ifndef EMU_ZIP_H
#define EMU_ZIP_H
#define ZIP_NUM 4
#define ZIP_PHASE_IDLE 0
#define ZIP_PHASE_COMMAND 1
#define ZIP_PHASE_COMPLETE 2
#define ZIP_PHASE_DATA_IN 3
#define ZIP_PHASE_DATA_IN_DMA 4
#define ZIP_PHASE_DATA_OUT 5
#define ZIP_PHASE_DATA_OUT_DMA 6
#define ZIP_PHASE_ERROR 0x80
#define BUF_SIZE 32768
#define IDE_TIME (5LL * 100LL * (1LL << TIMER_SHIFT))
#define ZIP_TIME (5LL * 100LL * (1LL << TIMER_SHIFT))
#define ZIP_SECTORS (96*2048)
#define ZIP_250_SECTORS (489532)
enum {
ZIP_BUS_DISABLED = 0,
ZIP_BUS_ATAPI_PIO_ONLY = 4,
ZIP_BUS_ATAPI_PIO_AND_DMA,
ZIP_BUS_SCSI,
ZIP_BUS_USB = 8
};
typedef struct {
uint8_t previous_command;
int toctimes;
int media_status;
int is_dma;
int requested_blocks; /* This will be set to something other than 1 when block reads are implemented. */
uint64_t current_page_code;
int current_page_len;
int current_page_pos;
int mode_select_phase;
int total_length;
int written_length;
int do_page_save;
uint8_t error;
uint8_t features;
uint16_t request_length;
uint8_t status;
uint8_t phase;
uint32_t sector_pos;
uint32_t sector_len;
uint32_t packet_len;
int packet_status;
uint8_t atapi_cdb[16];
uint8_t current_cdb[16];
uint32_t pos;
int callback;
int data_pos;
int cdb_len_setting;
int cdb_len;
int cd_status;
int prev_status;
int unit_attention;
uint8_t sense[256];
int request_pos;
uint8_t *buffer;
int times;
uint32_t seek_pos;
int total_read;
int block_total;
int all_blocks_total;
int old_len;
int block_descriptor_len;
int init_length;
} zip_t;
typedef struct {
int max_blocks_at_once;
int host_drive;
int prev_host_drive;
unsigned int bus_type; /* 0 = ATAPI, 1 = SCSI */
uint8_t bus_mode; /* Bit 0 = PIO suported;
Bit 1 = DMA supportd. */
uint8_t ide_channel;
unsigned int scsi_device_id;
unsigned int scsi_device_lun;
unsigned int is_250;
unsigned int atapi_dma;
wchar_t image_path[1024];
wchar_t prev_image_path[1024];
uint32_t medium_size;
int read_only;
int ui_writeprot;
FILE *f;
} zip_drive_t;
extern zip_t zip[ZIP_NUM];
extern zip_drive_t zip_drives[ZIP_NUM];
extern uint8_t atapi_zip_drives[8];
extern uint8_t scsi_zip_drives[16][8];
#define zip_sense_error zip[id].sense[0]
#define zip_sense_key zip[id].sense[2]
#define zip_asc zip[id].sense[12]
#define zip_ascq zip[id].sense[13]
#define zip_drive zip_drives[id].host_drive
#ifdef __cplusplus
extern "C" {
#endif
extern int (*ide_bus_master_read)(int channel, uint8_t *data, int transfer_length);
extern int (*ide_bus_master_write)(int channel, uint8_t *data, int transfer_length);
extern void (*ide_bus_master_set_irq)(int channel);
extern void ioctl_close(uint8_t id);
extern uint32_t zip_mode_sense_get_channel(uint8_t id, int channel);
extern uint32_t zip_mode_sense_get_volume(uint8_t id, int channel);
extern void build_atapi_zip_map(void);
extern void build_scsi_zip_map(void);
extern int zip_ZIP_PHASE_to_scsi(uint8_t id);
extern int zip_atapi_phase_to_scsi(uint8_t id);
extern void zip_command(uint8_t id, uint8_t *cdb);
extern void zip_phase_callback(uint8_t id);
extern uint32_t zip_read(uint8_t channel, int length);
extern void zip_write(uint8_t channel, uint32_t val, int length);
extern int zip_lba_to_msf_accurate(int lba);
extern void zip_close(uint8_t id);
extern void zip_disk_reload(uint8_t id);
extern void zip_reset(uint8_t id);
extern void zip_set_signature(int id);
extern void zip_request_sense_for_scsi(uint8_t id, uint8_t *buffer, uint8_t alloc_length);
extern void zip_update_cdb(uint8_t *cdb, int lba_pos, int number_of_blocks);
extern void zip_insert(uint8_t id);
extern int find_zip_for_scsi_id(uint8_t scsi_id, uint8_t scsi_lun);
extern int zip_read_capacity(uint8_t id, uint8_t *cdb, uint8_t *buffer, uint32_t *len);
extern void zip_global_init(void);
extern void zip_global_reset(void);
extern void zip_hard_reset(void);
extern int zip_load(uint8_t id, wchar_t *fn);
extern void zip_close(uint8_t id);
#ifdef __cplusplus
}
#endif
#endif /*EMU_ZIP_H*/