Skip to content

Commit b5cb6ab

Browse files
committed
Amstrad PC3086: Implement the WD XTA hard disk controller.
1 parent 14cd442 commit b5cb6ab

4 files changed

Lines changed: 83 additions & 14 deletions

File tree

‎src/disk/hdc_xta.c‎

Lines changed: 78 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108

109109
#define WD_REV_1_BIOS_FILE "roms/hdd/xta/idexywd2.bin"
110110
#define WD_REV_2_BIOS_FILE "roms/hdd/xta/infowdbios.rom"
111+
#define PC3086_BIOS_FILE "roms/machines/pc3086/c800.bin"
111112
#define ST50X_BIOS_FILE "roms/hdd/xta/ST05XBIO.BIN"
112113
#define PC5086_BIOS_FILE "roms/machines/pc5086/c800.bin"
113114

@@ -1032,7 +1033,7 @@ xta_init_common(const device_t *info, int type)
10321033
fn = (char *) device_get_bios_file(info, bios_rev, 0);
10331034
/* Revision 2 actually supports 2 drives using drive select. */
10341035
if (!strcmp(bios_rev, "rev_1"))
1035-
max = 1;
1036+
max = 1;
10361037
#ifdef SELECTABLE_BASE
10371038
dev->base = device_get_config_hex16("base");
10381039
#else
@@ -1041,15 +1042,22 @@ xta_init_common(const device_t *info, int type)
10411042
dev->irq = device_get_config_int("irq");
10421043
dev->rom_addr = device_get_config_hex20("bios_addr");
10431044
dev->dma = 3;
1045+
case 1: /* Amstrad PC3086 */
1046+
dev->name = "WDXT-150 PC3086";
1047+
dev->rom_addr = 0xc8000;
1048+
fn = PC3086_BIOS_FILE;
1049+
dev->base = 0x0320;
1050+
dev->irq = 5;
1051+
dev->dma = 3;
10441052
break;
10451053

1046-
case 1: /* EuroPC */
1047-
case 3: /* Amstrad PC5086 */
1054+
case 2: /* EuroPC */
1055+
case 5: /* Amstrad PC5086 */
10481056
switch (dev->type) {
1049-
case 1:
1057+
case 2:
10501058
dev->name = "HD20";
10511059
break;
1052-
case 3:
1060+
case 5:
10531061
dev->name = "ST-50X PC5086";
10541062
dev->rom_addr = 0xc8000;
10551063
fn = PC5086_BIOS_FILE;
@@ -1060,10 +1068,10 @@ xta_init_common(const device_t *info, int type)
10601068
dev->irq = 5;
10611069
dev->dma = 3;
10621070
break;
1063-
case 2: /* Seagate ST-05X Standalone */
1071+
case 3: /* Seagate ST-05X Standalone */
10641072
case 4: /* Seagate ST-05X Standalone secondary device */
10651073
switch (dev->type) {
1066-
case 2:
1074+
case 3:
10671075
dev->name = "ST-50X PRI";
10681076
dev->rom_addr = device_get_config_hex20("bios_addr");
10691077
fn = ST50X_BIOS_FILE;
@@ -1206,7 +1214,51 @@ xta_init_common(const device_t *info, int type)
12061214
else
12071215
dev->sw = (dev->sw & (c ? 0xf3 : 0xfc)) | (0x02 << (c << 1));
12081216
}
1209-
} else if ((dev->type >= 2) && (dev->type <= 4)) {
1217+
} else if (dev->type == 1) {
1218+
/*
1219+
WDXT-150, Revision 3 (Amstrad PC3086) switches:
1220+
- Drive 0, bits 1,0:
1221+
- With bit 4 set:
1222+
- 0,0 = 612/4/17;
1223+
- 0,1 = 615/6/17;
1224+
- 1,0 = 977/5/17;
1225+
- 1,1 = 615/4/17.
1226+
- With bit 4 clear:
1227+
- 0,0 = 971/4/17;
1228+
- 0,1 = 976/6/17;
1229+
- 1,0 = 1024/5/17;
1230+
- 1,1 = 976/4/17.
1231+
- Drive 1, bits 3,2:
1232+
- With bit 4 set:
1233+
- 0,0 = 612/4/17;
1234+
- 0,1 = 615/6/17;
1235+
- 1,0 = 977/5/17;
1236+
- 1,1 = 615/4/17.
1237+
- With bit 4 clear:
1238+
- 0,0 = 971/4/17;
1239+
- 0,1 = 976/6/17;
1240+
- 1,0 = 1024/5/17;
1241+
- 1,1 = 976/4/17.
1242+
*/
1243+
if (drive->tracks == 971)
1244+
dev->sw = ((dev->sw & 0xef) & (c ? 0xf3 : 0xfc)) | (0x00 << (c << 1));
1245+
else if (drive->tracks == 976) {
1246+
if (drive->hpc == 6)
1247+
dev->sw = ((dev->sw & 0xef) & (c ? 0xf3 : 0xfc)) | (0x01 << (c << 1));
1248+
else
1249+
dev->sw = ((dev->sw & 0xef) & (c ? 0xf3 : 0xfc)) | (0x03 << (c << 1));
1250+
} else if (drive->tracks == 1024)
1251+
dev->sw = ((dev->sw & 0xef) & (c ? 0xf3 : 0xfc)) | (0x02 << (c << 1));
1252+
else if (drive->tracks == 615) {
1253+
if (drive->hpc == 6)
1254+
dev->sw = (dev->sw & (c ? 0xf3 : 0xfc)) | (0x01 << (c << 1));
1255+
else
1256+
dev->sw = (dev->sw & (c ? 0xf3 : 0xfc)) | (0x03 << (c << 1));
1257+
} else if (drive->tracks == 612)
1258+
dev->sw = (dev->sw & (c ? 0xf3 : 0xfc)) | (0x00 << (c << 1));
1259+
else
1260+
dev->sw = (dev->sw & (c ? 0xf3 : 0xfc)) | (0x02 << (c << 1));
1261+
} else if ((dev->type >= 3) && (dev->type <= 5)) {
12101262
/*
12111263
Bits 1, 0:
12121264
- 1, 1 = 615/4/17 (20 MB);
@@ -1418,11 +1470,25 @@ const device_t xta_wdxt150_device = {
14181470
.config = wdxt150_config
14191471
};
14201472

1473+
const device_t xta_wdxt150_pc3086_device = {
1474+
.name = "WDXT-150 XTA Fixed Disk Controller (PC3086)",
1475+
.internal_name = "xta_wdxt150",
1476+
.flags = DEVICE_ISA,
1477+
.local = 1,
1478+
.init = xta_init,
1479+
.close = xta_close,
1480+
.reset = NULL,
1481+
.available = NULL /*xta_available*/,
1482+
.speed_changed = NULL,
1483+
.force_redraw = NULL,
1484+
.config = wdxt150_config
1485+
};
1486+
14211487
const device_t xta_hd20_device = {
14221488
.name = "EuroPC HD20 Fixed Disk Controller",
14231489
.internal_name = "xta_hd20",
14241490
.flags = DEVICE_ISA,
1425-
.local = 1,
1491+
.local = 2,
14261492
.init = xta_init,
14271493
.close = xta_close,
14281494
.reset = NULL,
@@ -1436,7 +1502,7 @@ const device_t xta_st50x_device = {
14361502
.name = "ST-50X Fixed Disk Controller",
14371503
.internal_name = "xta_st50x",
14381504
.flags = DEVICE_ISA,
1439-
.local = 2,
1505+
.local = 3,
14401506
.init = xta_st50x_init,
14411507
.close = xta_st50x_close,
14421508
.reset = NULL,
@@ -1447,10 +1513,10 @@ const device_t xta_st50x_device = {
14471513
};
14481514

14491515
const device_t xta_st50x_pc5086_device = {
1450-
.name = "ST-50X Fixed Disk Controller (PC5086)",
1516+
.name = "ST-50X Fixed Disk Controller (PC5086)",
14511517
.internal_name = "xta_st50x_pc5086",
14521518
.flags = DEVICE_ISA,
1453-
.local = 3,
1519+
.local = 5,
14541520
.init = xta_init,
14551521
.close = xta_close,
14561522
.reset = NULL,

‎src/include/86box/hdc.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,10 @@ extern const device_t ide_qua_pnp_device;
106106
extern const device_t mcide_device;
107107

108108
extern const device_t xta_wdxt150_device; /* xta_wdxt150 */
109+
extern const device_t xta_wdxt150_pc3086_device; /* xta_wdxt150 (PC3086) */
109110
extern const device_t xta_hd20_device; /* EuroPC internal */
110111
extern const device_t xta_st50x_device; /* ST-50X */
111-
extern const device_t xta_st50x_pc5086_device; /* ST-50X (PC-5086) */
112+
extern const device_t xta_st50x_pc5086_device; /* ST-50X (PC5086) */
112113

113114
extern const device_t xtide_device; /* xtide_xt */
114115
extern const device_t xtide_at_device; /* xtide_at */

‎src/machine/m_amstrad.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
#include <86box/lpt.h>
6767
#include <86box/fdd.h>
6868
#include <86box/fdc.h>
69+
#include <86box/hdc.h>
6970
#include <86box/sound.h>
7071
#include <86box/snd_speaker.h>
7172
#include <86box/video.h>
@@ -2966,6 +2967,7 @@ machine_amstrad_init(const machine_t *model, int type)
29662967
device_context(&vid_pc3086_device);
29672968
ams->language = device_get_config_int("language");
29682969
device_context_restore();
2970+
device_add(&xta_wdxt150_pc3086_device);
29692971
device_add(&paradise_pvga1a_pc3086_device);
29702972
break;
29712973

‎src/machine/machine_table.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2328,7 +2328,7 @@ const machine_t machines[] = {
23282328
.max_multi = 0
23292329
},
23302330
.bus_flags = MACHINE_PC,
2331-
.flags = MACHINE_VIDEO_FIXED | MACHINE_KEYBOARD | MACHINE_MOUSE,
2331+
.flags = MACHINE_XTA | MACHINE_VIDEO_FIXED | MACHINE_KEYBOARD | MACHINE_MOUSE,
23322332
.ram = {
23332333
.min = 640,
23342334
.max = 640,

0 commit comments

Comments
 (0)