diff --git a/src/86box.h b/src/86box.h index 80227a810..0b4ca1f9c 100644 --- a/src/86box.h +++ b/src/86box.h @@ -1,4 +1,4 @@ /* Copyright holders: Tenshi see COPYING for more details */ -#define emulator_version "1.07" +#define emulator_version "1.10" diff --git a/src/Makefile.mingw b/src/Makefile.mingw index 65946b4fd..e780126a3 100644 --- a/src/Makefile.mingw +++ b/src/Makefile.mingw @@ -2,14 +2,13 @@ VPATH = . dosbox lzf resid-fp slirp CPP = g++.exe CC = gcc.exe WINDRES = windres.exe -CFLAGS = -O3 -march=native -mtune=native -fbranch-probabilities -fvpt -fpeel-loops -ftracer -fomit-frame-pointer -ffast-math -msse -msse2 -msse3 -mssse3 -mfpmath=sse -mstackrealign -DRELEASE_BUILD -DFLAGS = -O3 -march=i686 -fomit-frame-pointer -msse2 -mstackrealign -DRELEASE_BUILD -RFLAGS = -DRELEASE_BUILD +CFLAGS = -O3 -march=native -mtune=native -fbranch-probabilities -fvpt -fpeel-loops -ftracer -fomit-frame-pointer -ffast-math -msse -msse2 -msse3 -mssse3 -mfpmath=sse -mstackrealign +DFLAGS = -O3 -march=i686 -fomit-frame-pointer -msse2 -mstackrealign OBJ = 386.o 386_dynarec.o 386_dynarec_ops.o 808x.o acer386sx.o acerm3a.o ali1429.o amstrad.o buslogic.o cdrom.o cdrom-ioctl.o cdrom-iso.o \ cdrom-null.o codegen.o codegen_ops.o codegen_timing_486.o codegen_timing_686.o codegen_timing_pentium.o codegen_timing_winchip.o codegen_x86.o compaq.o config.o cpu.o dac.o \ - device.o disc.o disc_86f.o disc_fdi.o disc_imd.o disc_img.o disc_random.o disc_td0.o dma.o fdc.o fdc37c665.o fdc37c932fr.o fdd.o fdi2raw.o gameport.o headland.o i430hx.o i430lx.o i430fx.o \ + device.o disc.o disc_86f.o disc_fdi.o disc_imd.o disc_img.o disc_random.o disc_td0.o dma.o fdc.o fdc37c665.o fdc37c932fr.o fdd.o fdi2raw.o gameport.o hdd.o headland.o i430hx.o i430lx.o i430fx.o \ i430nx.o i430vx.o i440fx.o ide.o intel.o intel_flash.o io.o jim.o joystick_ch_flightstick_pro.o joystick_standard.o joystick_sw_pad.o joystick_tm_fcs.o keyboard.o keyboard_amstrad.o keyboard_at.o \ - keyboard_olim24.o keyboard_pcjr.o keyboard_xt.o lpt.o mcr.o mem.o memregs.o model.o mouse.o mouse_ps2.o \ + keyboard_olim24.o keyboard_pcjr.o keyboard_xt.o lpt.o mcr.o mem.o memregs.o mfm_at.o model.o mouse.o mouse_ps2.o \ mouse_serial.o ne2000.o neat.o nethandler.o nmi.o nvr.o olivetti_m24.o opti495.o pc.o pc87306.o pci.o pic.o piix.o pit.o ppi.o ps1.o ps2.o rom.o rtc.o \ scat.o scsi.o serial.o sis496.o sis85c471.o sio.o sound.o sound_ad1848.o sound_adlib.o sound_adlibgold.o sound_cms.o \ sound_dbopl.o sound_emu8k.o sound_gus.o sound_mpu401_uart.o sound_opl.o sound_pas16.o sound_ps1.o sound_pssj.o sound_resid.o \ diff --git a/src/Makefile.mingw64 b/src/Makefile.mingw64 index 0acc20863..2b285a556 100644 --- a/src/Makefile.mingw64 +++ b/src/Makefile.mingw64 @@ -2,14 +2,13 @@ VPATH = . dosbox lzf resid-fp slirp CPP = g++.exe CC = gcc.exe WINDRES = windres.exe -CFLAGS = -O3 -march=native -mtune=native -fbranch-probabilities -fvpt -fpeel-loops -ftracer -fomit-frame-pointer -ffast-math -msse -msse2 -msse3 -mssse3 -mfpmath=sse -mstackrealign -DRELEASE_BUILD -DFLAGS = -O3 -fomit-frame-pointer -msse2 -mstackrealign -DRELEASE_BUILD -RFLAGS = -DRELEASE_BUILD +CFLAGS = -O3 -march=native -mtune=native -fbranch-probabilities -fvpt -fpeel-loops -ftracer -fomit-frame-pointer -ffast-math -msse -msse2 -msse3 -mssse3 -mfpmath=sse -mstackrealign +DFLAGS = -O3 -fomit-frame-pointer -msse2 -mstackrealign OBJ = 386.o 386_dynarec.o 386_dynarec_ops.o 808x.o acer386sx.o acerm3a.o ali1429.o amstrad.o buslogic.o cdrom.o cdrom-ioctl.o cdrom-iso.o \ cdrom-null.o codegen.o codegen_ops.o codegen_timing_486.o codegen_timing_686.o codegen_timing_pentium.o codegen_timing_winchip.o codegen_x86-64.o compaq.o config.o cpu.o dac.o \ - device.o disc.o disc_86f.o disc_fdi.o disc_imd.o disc_img.o disc_random.o disc_td0.o dma.o fdc.o fdc37c665.o fdc37c932fr.o fdd.o fdi2raw.o gameport.o headland.o i430hx.o i430lx.o i430fx.o \ + device.o disc.o disc_86f.o disc_fdi.o disc_imd.o disc_img.o disc_random.o disc_td0.o dma.o fdc.o fdc37c665.o fdc37c932fr.o fdd.o fdi2raw.o gameport.o hdd.o headland.o i430hx.o i430lx.o i430fx.o \ i430nx.o i430vx.o i440fx.o ide.o intel.o intel_flash.o io.o jim.o joystick_ch_flightstick_pro.o joystick_standard.o joystick_sw_pad.o joystick_tm_fcs.o keyboard.o keyboard_amstrad.o keyboard_at.o \ - keyboard_olim24.o keyboard_pcjr.o keyboard_xt.o lpt.o mcr.o mem.o memregs.o model.o mouse.o mouse_ps2.o \ + keyboard_olim24.o keyboard_pcjr.o keyboard_xt.o lpt.o mcr.o mem.o memregs.o mfm_at.o model.o mouse.o mouse_ps2.o \ mouse_serial.o ne2000.o neat.o nethandler.o nmi.o nvr.o olivetti_m24.o opti495.o pc.o pc87306.o pci.o pic.o piix.o pit.o ppi.o ps1.o ps2.o rom.o rtc.o \ scat.o scsi.o serial.o sis496.o sis85c471.o sio.o sound.o sound_ad1848.o sound_adlib.o sound_adlibgold.o sound_cms.o \ sound_dbopl.o sound_emu8k.o sound_gus.o sound_mpu401_uart.o sound_opl.o sound_pas16.o sound_ps1.o sound_pssj.o sound_resid.o \ diff --git a/src/device.h b/src/device.h index 970b4067f..6ac7628d7 100644 --- a/src/device.h +++ b/src/device.h @@ -46,7 +46,8 @@ char *device_get_config_string(char *name); enum { - DEVICE_NOT_WORKING = 1 /*Device does not currently work correctly and will be disabled in a release build*/ + DEVICE_NOT_WORKING = 1, /*Device does not currently work correctly and will be disabled in a release build*/ + DEVICE_AT = 2 /*Device requires an AT-compatible system*/ }; int model_get_config_int(char *s); diff --git a/src/disc_img.c b/src/disc_img.c index 5bbe87526..94bf48014 100644 --- a/src/disc_img.c +++ b/src/disc_img.c @@ -232,6 +232,9 @@ char ext[4]; uint8_t first_byte, second_byte, third_byte, fourth_byte; +/* This is hard-coded to 0 - if you really need to read those NT 3.1 Beta floppy images, change this to 1 and recompile the emulator. */ +uint8_t fdf_suppress_final_byte = 0; + void img_load(int drive, char *fn) { int size; @@ -388,13 +391,13 @@ void img_load(int drive, char *fn) size += (run & 0x7f); if (!track_bytes) { - size--; + size -= fdf_suppress_final_byte; } } else { /* Literal block. */ - size += (track_bytes - 1); + size += (track_bytes - fdf_suppress_final_byte); literal = (uint8_t *) malloc(track_bytes); fread(literal, 1, track_bytes, img[drive].f); free(literal); @@ -451,7 +454,7 @@ void img_load(int drive, char *fn) track_bytes--; if (!track_bytes) { - real_run--; + real_run -= fdf_suppress_final_byte; } rep_byte = fgetc(img[drive].f); if (real_run) @@ -467,7 +470,7 @@ void img_load(int drive, char *fn) fread(literal, 1, real_run, img[drive].f); if (!track_bytes) { - real_run--; + real_run -= fdf_suppress_final_byte; } if (run & 0x7f) { @@ -482,9 +485,9 @@ void img_load(int drive, char *fn) /* Literal block. */ literal = (uint8_t *) malloc(track_bytes); fread(literal, 1, track_bytes, img[drive].f); - memcpy(bpos, literal, track_bytes - 1); + memcpy(bpos, literal, track_bytes - fdf_suppress_final_byte); free(literal); - bpos += (track_bytes - 1); + bpos += (track_bytes - fdf_suppress_final_byte); track_bytes = 0; } diff --git a/src/hdd.c b/src/hdd.c new file mode 100644 index 000000000..219c381f6 --- /dev/null +++ b/src/hdd.c @@ -0,0 +1,93 @@ +#include "ibm.h" +#include "device.h" +#include "hdd.h" + +#include "mfm_at.h" +#include "xtide.h" + +char hdd_controller_name[16]; + +static device_t null_hdd_device; + +static int hdd_controller_current; + +static struct +{ + char name[50]; + char internal_name[16]; + device_t *device; + int is_mfm; +} hdd_controllers[] = +{ + {"None", "none", &null_hdd_device, 0}, + {"AT Fixed Disk Adapter", "mfm_at", &mfm_at_device, 1}, + {"XTIDE", "xtide", &xtide_device, 0}, + {"XTIDE (AT)", "xtide_at", &xtide_at_device, 0}, + {"", "", NULL, 0} +}; + +char *hdd_controller_get_name(int hdd) +{ + return hdd_controllers[hdd].name; +} + +char *hdd_controller_get_internal_name(int hdd) +{ + return hdd_controllers[hdd].internal_name; +} + +int hdd_controller_get_flags(int hdd) +{ + return hdd_controllers[hdd].device->flags; +} + +int hdd_controller_available(int hdd) +{ + return device_available(hdd_controllers[hdd].device); +} + +int hdd_controller_current_is_mfm() +{ + return hdd_controllers[hdd_controller_current].is_mfm; +} + +void hdd_controller_init(char *internal_name) +{ + int c = 0; + + while (hdd_controllers[c].device) + { + if (!strcmp(internal_name, hdd_controllers[c].internal_name)) + { + hdd_controller_current = c; + if (strcmp(internal_name, "none")) + device_add(hdd_controllers[c].device); + return; + } + c++; + } + fatal("Could not find hdd_controller %s\n", internal_name); +} + + +static void *null_hdd_init() +{ + return NULL; +} + +static void null_hdd_close(void *p) +{ +} + +static device_t null_hdd_device = +{ + "Null HDD controller", + 0, + null_hdd_init, + null_hdd_close, + NULL, + NULL, + NULL, + NULL, + NULL +}; diff --git a/src/hdd.h b/src/hdd.h new file mode 100644 index 000000000..605118623 --- /dev/null +++ b/src/hdd.h @@ -0,0 +1,8 @@ +char *hdd_controller_get_name(int hdd); +char *hdd_controller_get_internal_name(int hdd); +int hdd_controller_get_flags(int hdd); +int hdd_controller_available(int hdd); +int hdd_controller_current_is_mfm(); +void hdd_controller_init(char *internal_name); + +extern char hdd_controller_name[16]; diff --git a/src/mem.c b/src/mem.c index 0619e717a..f523d5d93 100644 --- a/src/mem.c +++ b/src/mem.c @@ -48,12 +48,12 @@ static mem_mapping_t romext_mapping; int shadowbios,shadowbios_write; -int enable_xtide = 0; - static unsigned char isram[0x10000]; static uint8_t ff_array[0x1000]; +int enable_xtide = 0; + int mem_size; uint32_t biosmask; int readlnum=0,writelnum=0; @@ -64,34 +64,6 @@ uint8_t romext[32768]; uint32_t ram_mapped_addr[64]; -static void mem_load_xtide_bios() -{ - FILE *f; - f=romfopen("roms/ide_xt.bin","rb"); - -// is486=0; - if (f) - { - fread(romext,16384,1,f); - mem_mapping_enable(&romext_mapping); - fclose(f); - } -} - -static void mem_load_atide_bios() -{ - FILE *f; - f=romfopen("roms/ide_at.bin","rb"); - -// is486=0; - if (f) - { - fread(romext,16384,1,f); - mem_mapping_enable(&romext_mapping); - fclose(f); - } -} - static void mem_load_atide115_bios() { FILE *f; @@ -136,10 +108,6 @@ int loadbios() } fclose(ff); fclose(f); - if (enable_xtide) - { - mem_load_xtide_bios(); - } loadfont("roms/pc1512/40078.ic127", 2); return 1; case ROM_PC1640: @@ -156,10 +124,6 @@ int loadbios() f=romfopen("roms/pc1640/40100","rb"); if (!f) break; fclose(f); - if (enable_xtide) - { - mem_load_xtide_bios(); - } return 1; case ROM_PC200: f=romfopen("roms/pc200/pc20v2.1","rb"); @@ -172,10 +136,6 @@ int loadbios() } fclose(ff); fclose(f); - if (enable_xtide) - { - mem_load_xtide_bios(); - } loadfont("roms/pc200/40109.bin", 1); return 1; case ROM_TANDY: @@ -183,10 +143,6 @@ int loadbios() if (!f) break; fread(rom,65536,1,f); fclose(f); - if (enable_xtide) - { - mem_load_xtide_bios(); - } return 1; case ROM_TANDY1000HX: f = romfopen("roms/tandy1000hx/v020000.u12", "rb"); @@ -194,10 +150,6 @@ int loadbios() fread(rom, 0x20000, 1, f); fclose(f); biosmask = 0x1ffff; - if (enable_xtide) - { - mem_load_xtide_bios(); - } return 1; case ROM_TANDY1000SL2: f = romfopen("roms/tandy1000sl2/8079047.hu1" ,"rb"); @@ -212,10 +164,6 @@ int loadbios() } fclose(ff); fclose(f); - if (enable_xtide) - { - mem_load_xtide_bios(); - } return 1; /* case ROM_IBMPCJR: f=fopen("pcjr/bios.rom","rb"); @@ -236,20 +184,12 @@ int loadbios() fread(rom + 0x8000, 0x8000, 1, ff); fclose(ff); fclose(f); - if (enable_xtide) - { - mem_load_xtide_bios(); - } return 1; } else { fread(rom,65536,1,f); fclose(f); - if (enable_xtide) - { - mem_load_xtide_bios(); - } return 1; } break; @@ -266,20 +206,12 @@ int loadbios() if (!f) break; fread(rom+0xE000,8192,1,f); fclose(f); - if (enable_xtide) - { - mem_load_xtide_bios(); - } return 1; case ROM_DTKXT: f=romfopen("roms/dtk/DTK_ERSO_2.42_2764.bin","rb"); if (!f) break; fread(rom+0xE000,8192,1,f); fclose(f); - if (enable_xtide) - { - mem_load_xtide_bios(); - } return 1; case ROM_OLIM24: f = romfopen("roms/olivetti_m24/olivetti_m24_version_1.43_low.bin" ,"rb"); @@ -292,10 +224,6 @@ int loadbios() } fclose(ff); fclose(f); - if (enable_xtide) - { - mem_load_xtide_bios(); - } return 1; case ROM_PC2086: @@ -314,10 +242,6 @@ int loadbios() f = romfopen("roms/pc2086/40186.ic171", "rb"); if (!f) break; fclose(f); - if (enable_xtide) - { - mem_load_xtide_bios(); - } biosmask = 0x3fff; return 1; @@ -329,10 +253,6 @@ int loadbios() f = romfopen("roms/pc3086/c000.bin", "rb"); if (!f) break; fclose(f); - if (enable_xtide) - { - mem_load_xtide_bios(); - } biosmask = 0x3fff; return 1; @@ -353,10 +273,6 @@ int loadbios() } fclose(ff); fclose(f); - if (enable_xtide) - { - mem_load_atide_bios(); - } return 1; case ROM_CMDPC30: f = romfopen("roms/cmdpc30/commodore pc 30 iii even.bin", "rb"); @@ -371,6 +287,7 @@ int loadbios() fclose(f); biosmask = 0x7fff; return 1; +#if 0 case ROM_CMDPC60: f = romfopen("roms/cmdpc60/cbm-pc60c-bios-lo-v1.36-390473-07.bin", "rb"); ff = romfopen("roms/cmdpc60/cbm-pc60c-bios-hi-v1.36-390474-07.bin", "rb"); @@ -384,6 +301,7 @@ int loadbios() fclose(f); biosmask = 0x1ffff; return 1; +#endif case ROM_DELL200: f=romfopen("roms/dells200/dell0.bin","rb"); ff=romfopen("roms/dells200/dell1.bin","rb"); @@ -459,10 +377,6 @@ int loadbios() fread(rom+0x8000,32768,1,f); fclose(f); // memset(romext,0x63,0x8000); - if (enable_xtide) - { - mem_load_xtide_bios(); - } return 1; case ROM_IBMPC: @@ -487,10 +401,6 @@ int loadbios() if (!f) break; fread(rom+0xC000,8192,1,f); fclose(f); - if (enable_xtide) - { - mem_load_xtide_bios(); - } return 1; case ROM_MEGAPC: @@ -609,11 +519,11 @@ int loadbios() fread(rom, 0x20000, 1, f); fclose(f); //#endif - biosmask = 0x1ffff; if (enable_xtide) { - mem_load_atide115_bios(); + mem_load_atide115_bios(); } + biosmask = 0x1ffff; return 1; case ROM_IBMPS1_2121: @@ -623,11 +533,11 @@ int loadbios() fseek(f, 0x20000, SEEK_SET); fread(rom, 0x20000, 1, f); fclose(f); - biosmask = 0x1ffff; if (enable_xtide) { - mem_load_atide115_bios(); + mem_load_atide115_bios(); } + biosmask = 0x1ffff; return 1; case ROM_DESKPRO_386: @@ -642,10 +552,6 @@ int loadbios() fclose(ff); fclose(f); biosmask = 0x7fff; - if (enable_xtide) - { - mem_load_atide_bios(); - } return 1; case ROM_AMIXT: @@ -653,10 +559,6 @@ int loadbios() if (!f) break; fread(rom + 0xE000, 8192, 1, f); fclose(f); - if (enable_xtide) - { - mem_load_xtide_bios(); - } return 1; case ROM_LTXT: @@ -664,10 +566,6 @@ int loadbios() if (!f) break; fread(rom + 0xE000, 8192, 1, f); fclose(f); - if (enable_xtide) - { - mem_load_xtide_bios(); - } return 1; case ROM_LXT3: @@ -675,10 +573,6 @@ int loadbios() if (!f) break; fread(rom + 0xE000, 8192, 1, f); fclose(f); - if (enable_xtide) - { - mem_load_xtide_bios(); - } return 1; case ROM_SPC4200P: /*Samsung SPC-4200P*/ @@ -722,10 +616,6 @@ int loadbios() if (!f) break; fread(rom + 0xE000, 8192, 1, f); fclose(f); - if (enable_xtide) - { - mem_load_xtide_bios(); - } return 1; case ROM_JUKOPC: @@ -733,10 +623,6 @@ int loadbios() if (!f) break; fread(rom + 0xE000, 8192, 1, f); fclose(f); - if (enable_xtide) - { - mem_load_xtide_bios(); - } return 1; case ROM_IBMPS2_M30_286: @@ -744,11 +630,11 @@ int loadbios() if (!f) break; fread(rom, 0x20000, 1, f); fclose(f); - biosmask = 0x1ffff; if (enable_xtide) { - mem_load_atide115_bios(); + mem_load_atide115_bios(); } + biosmask = 0x1ffff; return 1; case ROM_DTK486: diff --git a/src/mfm_at.c b/src/mfm_at.c new file mode 100644 index 000000000..a6623c92c --- /dev/null +++ b/src/mfm_at.c @@ -0,0 +1,645 @@ +#define _LARGEFILE_SOURCE +#define _LARGEFILE64_SOURCE +#define _GNU_SOURCE +#include +#include +#include +#include + +#include + +#include "ibm.h" +#include "device.h" +#include "io.h" +#include "pic.h" +#include "timer.h" + +#include "mfm_at.h" + + +#define IDE_TIME (TIMER_USEC*10)//(5 * 100 * (1 << TIMER_SHIFT)) + +#define STAT_ERR 0x01 +#define STAT_INDEX 0x02 +#define STAT_CORRECTED_DATA 0x04 +#define STAT_DRQ 0x08 /* Data request */ +#define STAT_DSC 0x10 +#define STAT_SEEK_COMPLETE 0x20 +#define STAT_READY 0x40 +#define STAT_BUSY 0x80 + +#define ERR_DAM_NOT_FOUND 0x01 /*Data Address Mark not found*/ +#define ERR_TR000 0x02 /*Track 0 not found*/ +#define ERR_ABRT 0x04 /*Command aborted*/ +#define ERR_ID_NOT_FOUND 0x10 /*ID not found*/ +#define ERR_DATA_CRC 0x40 /*Data CRC error*/ +#define ERR_BAD_BLOCK 0x80 /*Bad Block detected*/ + +#define CMD_RESTORE 0x10 +#define CMD_READ 0x20 +#define CMD_WRITE 0x30 +#define CMD_VERIFY 0x40 +#define CMD_FORMAT 0x50 +#define CMD_SEEK 0x70 +#define CMD_DIAGNOSE 0x90 +#define CMD_SET_PARAMETERS 0x91 + +extern char ide_fn[4][512]; + +typedef struct mfm_drive_t +{ + int spt, hpc; + int tracks; + int cfg_spt; + int cfg_hpc; + int current_cylinder; + FILE *hdfile; +} mfm_drive_t; + +typedef struct mfm_t +{ + uint8_t status; + uint8_t error; + int secount,sector,cylinder,head,cylprecomp; + uint8_t command; + uint8_t fdisk; + int pos; + + int drive_sel; + int reset; + uint16_t buffer[256]; + int irqstat; + + int callback; + + mfm_drive_t drives[2]; +} mfm_t; + +uint16_t mfm_readw(uint16_t port, void *p); +void mfm_writew(uint16_t port, uint16_t val, void *p); + +static inline void mfm_irq_raise(mfm_t *mfm) +{ +// pclog("IDE_IRQ_RAISE\n"); + if (!(mfm->fdisk&2)) + picint(1 << 14); + + mfm->irqstat=1; +} + +static inline void mfm_irq_lower(mfm_t *mfm) +{ + picintc(1 << 14); +} + +void mfm_irq_update(mfm_t *mfm) +{ + if (mfm->irqstat && !((pic2.pend|pic2.ins)&0x40) && !(mfm->fdisk & 2)) + picint(1 << 14); +} + +/* + * Return the sector offset for the current register values + */ +static int mfm_get_sector(mfm_t *mfm, off64_t *addr) +{ + mfm_drive_t *drive = &mfm->drives[mfm->drive_sel]; + int heads = drive->cfg_hpc; + int sectors = drive->cfg_spt; + + if (drive->current_cylinder != mfm->cylinder) + { + pclog("mfm_get_sector: wrong cylinder\n"); + return 1; + } + if (mfm->head > heads) + { + pclog("mfm_get_sector: past end of configured heads\n"); + return 1; + } + if (mfm->sector >= sectors+1) + { + pclog("mfm_get_sector: past end of configured sectors\n"); + return 1; + } + if (mfm->head > drive->hpc) + { + pclog("mfm_get_sector: past end of heads\n"); + return 1; + } + if (mfm->sector >= drive->spt+1) + { + pclog("mfm_get_sector: past end of sectors\n"); + return 1; + } + + *addr = ((((off64_t) mfm->cylinder * heads) + mfm->head) * + sectors) + (mfm->sector - 1); + + return 0; +} + +/** + * Move to the next sector using CHS addressing + */ +static void mfm_next_sector(mfm_t *mfm) +{ + mfm_drive_t *drive = &mfm->drives[mfm->drive_sel]; + + mfm->sector++; + if (mfm->sector == (drive->cfg_spt + 1)) + { + mfm->sector = 1; + mfm->head++; + if (mfm->head == drive->cfg_hpc) + { + mfm->head = 0; + mfm->cylinder++; + if (drive->current_cylinder < drive->tracks) + drive->current_cylinder++; + } + } +} + +static void loadhd(mfm_t *mfm, int d, const char *fn) +{ + mfm_drive_t *drive = &mfm->drives[d]; + + if (drive->hdfile == NULL) + { + /* Try to open existing hard disk image */ + drive->hdfile = fopen64(fn, "rb+"); + if (drive->hdfile == NULL) + { + /* Failed to open existing hard disk image */ + if (errno == ENOENT) + { + /* Failed because it does not exist, + so try to create new file */ + drive->hdfile = fopen64(fn, "wb+"); + if (drive->hdfile == NULL) + { + pclog("Cannot create file '%s': %s", + fn, strerror(errno)); + return; + } + } + else + { + /* Failed for another reason */ + pclog("Cannot open file '%s': %s", + fn, strerror(errno)); + return; + } + } + } + + drive->spt = hdc[d].spt; + drive->hpc = hdc[d].hpc; + drive->tracks = hdc[d].tracks; +} + + + +void mfm_write(uint16_t port, uint8_t val, void *p) +{ + mfm_t *mfm = (mfm_t *)p; + +// pclog("mfm_write: addr=%04x val=%02x\n", port, val); + switch (port) + { + case 0x1F0: /* Data */ + mfm_writew(port, val | (val << 8), p); + return; + + case 0x1F1: /* Write precompenstation */ + mfm->cylprecomp = val; + return; + + case 0x1F2: /* Sector count */ + mfm->secount = val; + return; + + case 0x1F3: /* Sector */ + mfm->sector = val; + return; + + case 0x1F4: /* Cylinder low */ + mfm->cylinder = (mfm->cylinder & 0xFF00) | val; + return; + + case 0x1F5: /* Cylinder high */ + mfm->cylinder = (mfm->cylinder & 0xFF) | (val << 8); + return; + + case 0x1F6: /* Drive/Head */ + mfm->head = val & 0xF; + mfm->drive_sel = (val & 0x10) ? 1 : 0; + if (mfm->drives[mfm->drive_sel].hdfile == NULL) + mfm->status = 0; + else + mfm->status = STAT_READY | STAT_DSC; + return; + + case 0x1F7: /* Command register */ + if (mfm->drives[mfm->drive_sel].hdfile == NULL) + fatal("Command on non-present drive\n"); + + mfm_irq_lower(mfm); + mfm->command = val; + mfm->error = 0; + + switch (val & 0xf0) + { + case CMD_RESTORE: +// pclog("Restore\n"); + mfm->command &= ~0x0f; /*Mask off step rate*/ + mfm->status = STAT_BUSY; + timer_process(); + mfm->callback = 200*IDE_TIME; + timer_update_outstanding(); + break; + + case CMD_SEEK: +// pclog("Seek to cylinder %i\n", mfm->cylinder); + mfm->command &= ~0x0f; /*Mask off step rate*/ + mfm->status = STAT_BUSY; + timer_process(); + mfm->callback = 200*IDE_TIME; + timer_update_outstanding(); + break; + + default: + switch (val) + { + case CMD_READ: case CMD_READ+1: + case CMD_READ+2: case CMD_READ+3: +// pclog("Read %i sectors from sector %i cylinder %i head %i %i\n",mfm->secount,mfm->sector,mfm->cylinder,mfm->head,ins); + mfm->command &= ~3; + if (val & 2) + fatal("Read with ECC\n"); + mfm->status = STAT_BUSY; + timer_process(); + mfm->callback = 200*IDE_TIME; + timer_update_outstanding(); + break; + + case CMD_WRITE: case CMD_WRITE+1: + case CMD_WRITE+2: case CMD_WRITE+3: +// pclog("Write %i sectors to sector %i cylinder %i head %i\n",mfm->secount,mfm->sector,mfm->cylinder,mfm->head); + mfm->command &= ~3; + if (val & 2) + fatal("Write with ECC\n"); + mfm->status = STAT_DRQ | STAT_DSC;// | STAT_BUSY; + mfm->pos=0; + break; + + case CMD_VERIFY: case CMD_VERIFY+1: +// pclog("Read verify %i sectors from sector %i cylinder %i head %i\n",mfm->secount,mfm->sector,mfm->cylinder,mfm->head); + mfm->command &= ~1; + mfm->status = STAT_BUSY; + timer_process(); + mfm->callback = 200 * IDE_TIME; + timer_update_outstanding(); + break; + + case CMD_FORMAT: +// pclog("Format track %i head %i\n", mfm->cylinder, mfm->head); + mfm->status = STAT_DRQ | STAT_BUSY; + mfm->pos=0; + break; + + case CMD_SET_PARAMETERS: /* Initialize Drive Parameters */ + mfm->status = STAT_BUSY; + timer_process(); + mfm->callback = 30*IDE_TIME; + timer_update_outstanding(); + break; + + case CMD_DIAGNOSE: /* Execute Drive Diagnostics */ + mfm->status = STAT_BUSY; + timer_process(); + mfm->callback = 200*IDE_TIME; + timer_update_outstanding(); + break; + + default: + pclog("Bad MFM command %02X\n", val); + mfm->status = STAT_BUSY; + timer_process(); + mfm->callback = 200*IDE_TIME; + timer_update_outstanding(); + break; + } + } + break; + + case 0x3F6: /* Device control */ + if ((mfm->fdisk & 4) && !(val & 4)) + { + timer_process(); + mfm->callback = 500*IDE_TIME; + timer_update_outstanding(); + mfm->reset = 1; + mfm->status = STAT_BUSY; +// pclog("MFM Reset\n"); + } + if (val & 4) + { + /*Drive held in reset*/ + timer_process(); + mfm->callback = 0; + timer_update_outstanding(); + mfm->status = STAT_BUSY; + } + mfm->fdisk = val; + mfm_irq_update(mfm); + return; + } +// fatal("Bad IDE write %04X %02X\n", addr, val); +} + +void mfm_writew(uint16_t port, uint16_t val, void *p) +{ + mfm_t *mfm = (mfm_t *)p; + +// pclog("Write IDEw %04X\n",val); + mfm->buffer[mfm->pos >> 1] = val; + mfm->pos += 2; + + if (mfm->pos >= 512) + { + mfm->pos = 0; + mfm->status = STAT_BUSY; + timer_process(); + mfm->callback = 6*IDE_TIME; + timer_update_outstanding(); + } +} + +uint8_t mfm_read(uint16_t port, void *p) +{ + mfm_t *mfm = (mfm_t *)p; + uint8_t temp; + + switch (port) + { + case 0x1F0: /* Data */ + temp = mfm_readw(port, mfm) & 0xff; + break; + + case 0x1F1: /* Error */ + temp = mfm->error; + break; + + case 0x1F2: /* Sector count */ + temp = (uint8_t)mfm->secount; + break; + + case 0x1F3: /* Sector */ + temp = (uint8_t)mfm->sector; + break; + + case 0x1F4: /* Cylinder low */ + temp = (uint8_t)(mfm->cylinder&0xFF); + break; + + case 0x1F5: /* Cylinder high */ + temp = (uint8_t)(mfm->cylinder>>8); + break; + + case 0x1F6: /* Drive/Head */ + temp = (uint8_t)(mfm->head | (mfm->drive_sel ? 0x10 : 0) | 0xa0); + break; + + case 0x1F7: /* Status */ + mfm_irq_lower(mfm); + temp = mfm->status; + break; + } + +// pclog("mfm_read: addr=%04x val=%02x %04X:%04x\n", port, temp, CS, cpu_state.pc); + return temp; +} + +uint16_t mfm_readw(uint16_t port, void *p) +{ + mfm_t *mfm = (mfm_t *)p; + uint16_t temp; + + temp = mfm->buffer[mfm->pos >> 1]; + mfm->pos += 2; + + if (mfm->pos >= 512) + { +// pclog("Over! packlen %i %i\n",ide->packlen,ide->pos); + mfm->pos=0; + mfm->status = STAT_READY | STAT_DSC; + if (mfm->command == CMD_READ) + { + mfm->secount = (mfm->secount - 1) & 0xff; + if (mfm->secount) + { + mfm_next_sector(mfm); + mfm->status = STAT_BUSY; + timer_process(); + mfm->callback = 6*IDE_TIME; + timer_update_outstanding(); + } + } + } + +// pclog("mem_readw: temp=%04x %i\n", temp, mfm->pos); + return temp; +} + +static void do_seek(mfm_t *mfm) +{ + mfm_drive_t *drive = &mfm->drives[mfm->drive_sel]; + + if (mfm->cylinder < drive->tracks) + drive->current_cylinder = mfm->cylinder; + else + drive->current_cylinder = drive->tracks-1; +} + +void mfm_callback(void *p) +{ + mfm_t *mfm = (mfm_t *)p; + mfm_drive_t *drive = &mfm->drives[mfm->drive_sel]; + off64_t addr; + int c; + +// pclog("mfm_callback: command=%02x reset=%i\n", mfm->command, mfm->reset); + mfm->callback = 0; + if (mfm->reset) + { + mfm->status = STAT_READY | STAT_DSC; + mfm->error = 1; + mfm->secount = 1; + mfm->sector = 1; + mfm->head = 0; + mfm->cylinder = 0; + mfm->reset = 0; +// pclog("Reset callback\n"); + return; + } + switch (mfm->command) + { + case CMD_RESTORE: + drive->current_cylinder = 0; + mfm->status = STAT_READY | STAT_DSC; + mfm_irq_raise(mfm); + break; + + case CMD_SEEK: + do_seek(mfm); + mfm->status = STAT_READY | STAT_DSC; + mfm_irq_raise(mfm); + break; + + case CMD_READ: + do_seek(mfm); + if (mfm_get_sector(mfm, &addr)) + { + mfm->error = ERR_ID_NOT_FOUND; + mfm->status = STAT_READY | STAT_DSC | STAT_ERR; + mfm_irq_raise(mfm); + break; + } + +// pclog("Read %i %i %i %08X\n",ide.cylinder,ide.head,ide.sector,addr); + fseeko64(drive->hdfile, addr * 512, SEEK_SET); + fread(mfm->buffer, 512, 1, drive->hdfile); + mfm->pos = 0; + mfm->status = STAT_DRQ | STAT_READY | STAT_DSC; +// pclog("Read sector callback %i %i %i offset %08X %i left %i %02X\n",ide.sector,ide.cylinder,ide.head,addr,ide.secount,ide.spt,ide.atastat[ide.board]); +// if (addr) output=3; + mfm_irq_raise(mfm); + readflash = 1; + break; + + case CMD_WRITE: + do_seek(mfm); + if (mfm_get_sector(mfm, &addr)) + { + mfm->error = ERR_ID_NOT_FOUND; + mfm->status = STAT_READY | STAT_DSC | STAT_ERR; + mfm_irq_raise(mfm); + break; + } + fseeko64(drive->hdfile, addr * 512, SEEK_SET); + fwrite(mfm->buffer, 512, 1, drive->hdfile); + mfm_irq_raise(mfm); + mfm->secount = (mfm->secount - 1) & 0xff; + if (mfm->secount) + { + mfm->status = STAT_DRQ | STAT_READY | STAT_DSC; + mfm->pos = 0; + mfm_next_sector(mfm); + } + else + mfm->status = STAT_READY | STAT_DSC; + readflash = 1; + break; + + case CMD_VERIFY: + do_seek(mfm); + mfm->pos = 0; + mfm->status = STAT_READY | STAT_DSC; +// pclog("Read verify callback %i %i %i offset %08X %i left\n",ide.sector,ide.cylinder,ide.head,addr,ide.secount); + mfm_irq_raise(mfm); + readflash=1; + break; + + case CMD_FORMAT: + do_seek(mfm); + if (mfm_get_sector(mfm, &addr)) + { + mfm->error = ERR_ID_NOT_FOUND; + mfm->status = STAT_READY | STAT_DSC | STAT_ERR; + mfm_irq_raise(mfm); + break; + } + fseeko64(drive->hdfile, addr * 512, SEEK_SET); + memset(mfm->buffer, 0, 512); + for (c = 0; c < mfm->secount; c++) + { + fwrite(mfm->buffer, 512, 1, drive->hdfile); + } + mfm->status = STAT_READY | STAT_DSC; + mfm_irq_raise(mfm); + readflash = 1; + break; + + case CMD_DIAGNOSE: + mfm->error = 1; /*No error detected*/ + mfm->status = STAT_READY | STAT_DSC; + mfm_irq_raise(mfm); + break; + + case CMD_SET_PARAMETERS: /* Initialize Drive Parameters */ + drive->cfg_spt = mfm->secount; + drive->cfg_hpc = mfm->head+1; + pclog("Parameters: spt=%i hpc=%i\n", drive->cfg_spt,drive->cfg_hpc); + mfm->status = STAT_READY | STAT_DSC; + mfm_irq_raise(mfm); + break; + + default: + pclog("Callback on unknown command %02x\n", mfm->command); + mfm->status = STAT_READY | STAT_ERR | STAT_DSC; + mfm->error = ERR_ABRT; + mfm_irq_raise(mfm); + break; + } +} + +void *mfm_init() +{ + mfm_t *mfm = malloc(sizeof(mfm_t)); + memset(mfm, 0, sizeof(mfm_t)); + + loadhd(mfm, 0, ide_fn[0]); + loadhd(mfm, 1, ide_fn[1]); + + mfm->status = STAT_READY | STAT_DSC; + mfm->error = 1; /*No errors*/ + + io_sethandler(0x01f0, 0x0001, mfm_read, mfm_readw, NULL, mfm_write, mfm_writew, NULL, mfm); + io_sethandler(0x01f1, 0x0007, mfm_read, NULL, NULL, mfm_write, NULL, NULL, mfm); + io_sethandler(0x03f6, 0x0001, NULL, NULL, NULL, mfm_write, NULL, NULL, mfm); + + timer_add(mfm_callback, &mfm->callback, &mfm->callback, mfm); + + return mfm; +} + +void mfm_close(void *p) +{ + mfm_t *mfm = (mfm_t *)p; + int d; + + for (d = 0; d < 2; d++) + { + mfm_drive_t *drive = &mfm->drives[d]; + + if (drive->hdfile != NULL) + fclose(drive->hdfile); + } + + free(mfm); +} + +device_t mfm_at_device = +{ + "IBM PC AT Fixed Disk Adapter", + DEVICE_AT, + mfm_init, + mfm_close, + NULL, + NULL, + NULL, + NULL, + NULL +}; diff --git a/src/mfm_at.h b/src/mfm_at.h new file mode 100644 index 000000000..67907af23 --- /dev/null +++ b/src/mfm_at.h @@ -0,0 +1 @@ +extern device_t mfm_at_device; diff --git a/src/model.c b/src/model.c index 133c32ca5..495f75d8b 100644 --- a/src/model.c +++ b/src/model.c @@ -72,7 +72,6 @@ #include "vid_tandy.h" #include "w83877f.h" #include "wd76c10.h" -#include "xtide.h" void xt_init(); void pcjr_init(); @@ -82,6 +81,7 @@ void ams_init(); void europc_init(); void olim24_init(); void at_init(); +void at_ide_init(); void deskpro386_init(); void ps1_m2011_init(); void ps1_m2121_init(); @@ -125,67 +125,66 @@ PCI_RESET pci_reset_handler; MODEL models[] = { - {"IBM PC", ROM_IBMPC, "ibmpc", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, - {"IBM XT", ROM_IBMXT, "ibmxt", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, - {"IBM PCjr", ROM_IBMPCJR, "ibmpcjr", { "", cpus_pcjr, "", NULL, "", NULL, "", NULL, "", NULL}, 1, 0, 128, 640, 128, pcjr_init, &pcjr_device}, - {"Generic XT clone", ROM_GENXT, "genxt", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, - {"AMI XT clone", ROM_AMIXT, "amixt", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, - {"DTK XT clone", ROM_DTKXT, "dtk", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, - {"VTech Laser Turbo XT", ROM_LTXT, "ltxt", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, - {"VTech Laser XT3", ROM_LXT3, "lxt3", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, - {"Phoenix XT clone", ROM_PXXT, "pxxt", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, - {"Juko XT clone", ROM_JUKOPC, "jukopc", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, - {"Tandy 1000", ROM_TANDY, "tandy", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 1, 0, 128, 640, 128, tandy1k_init, &tandy1000_device}, - {"Tandy 1000 HX", ROM_TANDY1000HX, "tandy1000hx", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 1, 0, 256, 640, 128, tandy1k_init, &tandy1000hx_device}, - {"Tandy 1000 SL/2", ROM_TANDY1000SL2, "tandy1000sl2", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 1, 0, 512, 768, 128, tandy1ksl2_init, NULL}, - {"Amstrad PC1512", ROM_PC1512, "pc1512", { "", cpus_pc1512, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_AMSTRAD, 512, 640, 128, ams_init, NULL}, - {"Sinclair PC200", ROM_PC200, "pc200", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_AMSTRAD, 512, 640, 128, ams_init, NULL}, - {"Euro PC", ROM_EUROPC, "europc", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 512, 640, 128, europc_init, NULL}, - {"Olivetti M24", ROM_OLIM24, "olivetti_m24", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_OLIM24, 128, 640, 128, olim24_init, NULL}, - {"Amstrad PC1640", ROM_PC1640, "pc1640", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_AMSTRAD, 640, 640, 0, ams_init, NULL}, - {"Amstrad PC2086", ROM_PC2086, "pc2086", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_AMSTRAD, 640, 640, 0, ams_init, NULL}, - {"Amstrad PC3086", ROM_PC3086, "pc3086", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_AMSTRAD, 640, 640, 0, ams_init, NULL}, - {"IBM AT", ROM_IBMAT, "ibmat", { "", cpus_ibmat, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT, 1, 16, 1, at_init, NULL}, - {"Commodore PC 30 III", ROM_CMDPC30, "cmdpc30", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT, 1, 16, 1, at_init, NULL}, - {"AMI 286 clone", ROM_AMI286, "ami286", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT, 1, 16, 1, at_neat_init, NULL}, - {"Award 286 clone", ROM_AWARD286, "award286", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT, 1, 16, 1, at_scat_init, NULL}, - {"DELL System 200", ROM_DELL200, "dells200", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT, 1, 16, 1, at_init, NULL}, - {"Hyundai Super-286TR", ROM_SUPER286TR, "super286tr", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT, 1, 16, 1, at_scat_init, NULL}, - {"Samsung SPC-4200P", ROM_SPC4200P, "spc4200p", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT, 1, 16, 1, at_scat_init, NULL}, - {"IBM PS/1 model 2011", ROM_IBMPS1_2011, "ibmps1es", { "", cpus_ps1_m2011, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_AT | MODEL_PS2, 1, 16, 1, ps1_m2011_init, NULL}, - {"IBM PS/2 Model 30-286", ROM_IBMPS2_M30_286, "ibmps2_m30_286", { "", cpus_ps2_m30_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2, 1, 16, 1, ps2_m30_286_init, NULL}, - {"IBM PS/1 model 2121", ROM_IBMPS1_2121, "ibmps1_2121", { "Intel", cpus_i386SX, "AMD", cpus_Am386SX, "Cyrix", cpus_486SLC, "", NULL, "", NULL}, 1, MODEL_AT | MODEL_PS2, 1, 16, 1, ps1_m2121_init, NULL}, - {"IBM PS/1 m.2121 + ISA", ROM_IBMPS1_2121_ISA, "ibmps1_2121_isa", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2, 1, 16, 1, ps1_m2121_init, NULL}, - {"Compaq Deskpro 386", ROM_DESKPRO_386, "dekspro386", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 0, MODEL_AT, 1, 15, 1, deskpro386_init, NULL}, - {"DTK 386SX clone", ROM_DTK386, "dtk386", { "Intel", cpus_i386SX, "AMD", cpus_Am386SX, "Cyrix", cpus_486SLC, "", NULL, "", NULL}, 0, MODEL_AT, 1, 16, 1, at_neat_init, NULL}, - {"Amstrad MegaPC", ROM_MEGAPC, "megapc", { "Intel", cpus_i386SX, "AMD", cpus_Am386SX, "Cyrix", cpus_486SLC, "", NULL, "", NULL}, 1, MODEL_AT | MODEL_PS2, 1, 16, 1, at_wd76c10_init, NULL}, - {"AMI 386SX clone", ROM_AMI386SX, "ami386", { "Intel", cpus_i386SX, "AMD", cpus_Am386SX, "Cyrix", cpus_486SLC, "", NULL, "", NULL}, 0, MODEL_AT, 1, 256, 1, at_headland_init, NULL}, - {"Commodore PC 60 III", ROM_CMDPC60, "cmdpc60", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 0, MODEL_AT, 1, 16, 1, at_init, NULL}, + {"IBM PC", ROM_IBMPC, "ibmpc", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, + {"IBM XT", ROM_IBMXT, "ibmxt", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, + {"IBM PCjr", ROM_IBMPCJR, "ibmpcjr", { "", cpus_pcjr, "", NULL, "", NULL, "", NULL, "", NULL}, 1, 0, 128, 640, 128, pcjr_init, &pcjr_device}, + {"Generic XT clone", ROM_GENXT, "genxt", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, + {"AMI XT clone", ROM_AMIXT, "amixt", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, + {"DTK XT clone", ROM_DTKXT, "dtk", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, + {"VTech Laser Turbo XT", ROM_LTXT, "ltxt", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, + {"VTech Laser XT3", ROM_LXT3, "lxt3", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, + {"Phoenix XT clone", ROM_PXXT, "pxxt", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, + {"Juko XT clone", ROM_JUKOPC, "jukopc", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 64, 640, 64, xt_init, NULL}, + {"Tandy 1000", ROM_TANDY, "tandy", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 1, 0, 128, 640, 128, tandy1k_init, &tandy1000_device}, + {"Tandy 1000 HX", ROM_TANDY1000HX, "tandy1000hx", { "", cpus_8088, "", NULL, "", NULL, "", NULL, "", NULL}, 1, 0, 256, 640, 128, tandy1k_init, &tandy1000hx_device}, + {"Tandy 1000 SL/2", ROM_TANDY1000SL2, "tandy1000sl2", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 1, 0, 512, 768, 128, tandy1ksl2_init, NULL}, + {"Amstrad PC1512", ROM_PC1512, "pc1512", { "", cpus_pc1512, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_AMSTRAD, 512, 640, 128, ams_init, NULL}, + {"Sinclair PC200", ROM_PC200, "pc200", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_AMSTRAD, 512, 640, 128, ams_init, NULL}, + {"Euro PC", ROM_EUROPC, "europc", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 0, 0, 512, 640, 128, europc_init, NULL}, + {"Olivetti M24", ROM_OLIM24, "olivetti_m24", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_OLIM24, 128, 640, 128, olim24_init, NULL}, + {"Amstrad PC1640", ROM_PC1640, "pc1640", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_AMSTRAD, 640, 640, 0, ams_init, NULL}, + {"Amstrad PC2086", ROM_PC2086, "pc2086", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_AMSTRAD, 640, 640, 0, ams_init, NULL}, + {"Amstrad PC3086", ROM_PC3086, "pc3086", { "", cpus_8086, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_AMSTRAD, 640, 640, 0, ams_init, NULL}, + {"IBM AT", ROM_IBMAT, "ibmat", { "", cpus_ibmat, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT, 1, 16, 1, at_init, NULL}, + {"Commodore PC 30 III", ROM_CMDPC30, "cmdpc30", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 16, 1, at_init, NULL}, + {"AMI 286 clone", ROM_AMI286, "ami286", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 16, 1, at_neat_init, NULL}, + {"Award 286 clone", ROM_AWARD286, "award286", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 16, 1, at_scat_init, NULL}, + {"DELL System 200", ROM_DELL200, "dells200", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT, 1, 16, 1, at_init, NULL}, + {"Hyundai Super-286TR", ROM_SUPER286TR, "super286tr", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT, 1, 16, 1, at_scat_init, NULL}, + {"Samsung SPC-4200P", ROM_SPC4200P, "spc4200p", { "", cpus_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT, 1, 16, 1, at_scat_init, NULL}, + {"IBM PS/1 model 2011", ROM_IBMPS1_2011, "ibmps1es", { "", cpus_ps1_m2011, "", NULL, "", NULL, "", NULL, "", NULL}, 1, MODEL_AT | MODEL_PS2, 1, 16, 1, ps1_m2011_init, NULL}, + {"IBM PS/2 Model 30-286", ROM_IBMPS2_M30_286, "ibmps2_m30_286", { "", cpus_ps2_m30_286, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2, 1, 16, 1, ps2_m30_286_init, NULL}, + {"IBM PS/1 model 2121", ROM_IBMPS1_2121, "ibmps1_2121", { "Intel", cpus_i386SX, "AMD", cpus_Am386SX, "Cyrix", cpus_486SLC, "", NULL, "", NULL}, 1, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 16, 1, ps1_m2121_init, NULL}, + {"IBM PS/1 m.2121 + ISA", ROM_IBMPS1_2121_ISA, "ibmps1_2121_isa", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 16, 1, ps1_m2121_init, NULL}, + {"Compaq Deskpro 386", ROM_DESKPRO_386, "dekspro386", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 0, MODEL_AT, 1, 15, 1, deskpro386_init, NULL}, + {"DTK 386SX clone", ROM_DTK386, "dtk386", { "Intel", cpus_i386SX, "AMD", cpus_Am386SX, "Cyrix", cpus_486SLC, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 16, 1, at_neat_init, NULL}, + {"Amstrad MegaPC", ROM_MEGAPC, "megapc", { "Intel", cpus_i386SX, "AMD", cpus_Am386SX, "Cyrix", cpus_486SLC, "", NULL, "", NULL}, 1, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 16, 1, at_wd76c10_init, NULL}, + {"AMI 386SX clone", ROM_AMI386SX, "ami386", { "Intel", cpus_i386SX, "AMD", cpus_Am386SX, "Cyrix", cpus_486SLC, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 256, 1, at_headland_init, NULL}, /* The MegaPC manual says 386DX model of the Amstrad PC70386 exists, but Sarah Walker just *had* to remove 386DX CPU's from some boards. */ - {"Amstrad MegaPC 386DX", ROM_MEGAPCDX, "megapcdx", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 1, MODEL_AT | MODEL_PS2, 1, 16, 1, at_wd76c10_init, NULL}, - {"MR 386DX clone", ROM_MR386DX_OPTI495, "mr386dx", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 0, MODEL_AT, 1, 256, 1, at_opti495_init, NULL}, - {"AMI 386DX clone", ROM_AMI386DX_OPTI495, "ami386dx", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 0, MODEL_AT, 1, 256, 1, at_opti495_init, NULL}, - {"AMI 486 clone", ROM_AMI486, "ami486", { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486, "", NULL, "", NULL}, 0, MODEL_AT, 1, 256, 1, at_ali1429_init, NULL}, - {"AMI WinBIOS 486", ROM_WIN486, "win486", { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486, "", NULL, "", NULL}, 0, MODEL_AT, 1, 256, 1, at_ali1429_init, NULL}, - {"DTK PKM-0038S E-2", ROM_DTK486, "dtk486", { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486, "", NULL, "", NULL}, 0, MODEL_AT, 1, 256, 1, at_dtk486_init, NULL}, - {"Award SiS 496/497", ROM_SIS496, "sis496", { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486, "", NULL, "", NULL}, 0, MODEL_AT, 1, 256, 1, at_sis496_init, NULL}, - {"Rise Computer R418", ROM_R418, "r418", { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486, "", NULL, "", NULL}, 0, MODEL_AT, 1, 256, 1, at_r418_init, NULL}, - {"Intel Premiere/PCI", ROM_REVENGE, "revenge", { "Intel", cpus_Pentium5V, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2, 1, 128, 1, at_batman_init, NULL}, - {"Micro Star 586MC1", ROM_586MC1, "586mc1", { "Intel", cpus_Pentium5V50, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT, 1, 128, 1, at_586mc1_init, NULL}, - {"Intel Premiere/PCI II", ROM_PLATO, "plato", { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2, 1, 128, 1, at_plato_init, NULL}, - {"Intel Advanced/EV", ROM_ENDEAVOR, "endeavor", { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2, 1, 128, 1, at_endeavor_init, NULL}, - {"Intel Advanced/ZP", ROM_ZAPPA, "zappa", { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2, 1, 128, 1, at_endeavor_init, NULL}, - {"PC Partner MB500N", ROM_MB500N, "mb500n", { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2, 1, 128, 1, at_mb500n_init, NULL}, - {"Intel Advanced/ATX", ROM_THOR, "thor", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2, 1, 256, 1, at_endeavor_init, NULL}, - {"MR Intel Advanced/ATX", ROM_MRTHOR, "mrthor", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2, 1, 256, 1, at_endeavor_init, NULL}, - {"ASUS P/I-P54TP4XE", ROM_P54TP4XE, "p54tp4xe", { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2, 1, 512, 1, at_p54tp4xe_init, NULL}, - {"Acer M3a", ROM_ACERM3A, "acerm3a", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2, 1, 512, 1, at_acerm3a_init, NULL}, - {"Acer V35N", ROM_ACERV35N, "acerv3n", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2, 1, 512, 1, at_acerv35n_init, NULL}, - {"ASUS P/I-P55T2P4", ROM_P55T2P4, "p55r2p4", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2, 1, 512, 1, at_p55t2p4_init, NULL}, - {"Award 430VX PCI", ROM_430VX, "430vx", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2, 1, 256, 1, at_i430vx_init, NULL}, - {"Epox P55-VA", ROM_P55VA, "p55va", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2, 1, 256, 1, at_p55va_init, NULL}, - {"ASUS P/I-P55TVP4", ROM_P55TVP4, "p55tvp4", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2, 1, 256, 1, at_p55tvp4_init, NULL}, - {"Award 440FX PCI", ROM_440FX, "440fx", { "Intel", cpus_PentiumPro, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2, 1, 1024, 1, at_i440fx_init, NULL}, + {"Amstrad MegaPC 386DX", ROM_MEGAPCDX, "megapcdx", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 1, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 16, 1, at_wd76c10_init, NULL}, + {"MR 386DX clone", ROM_MR386DX_OPTI495, "mr386dx", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 256, 1, at_opti495_init, NULL}, + {"AMI 386DX clone", ROM_AMI386DX_OPTI495, "ami386dx", { "Intel", cpus_i386DX, "AMD", cpus_Am386DX, "Cyrix", cpus_486DLC, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 256, 1, at_opti495_init, NULL}, + {"AMI 486 clone", ROM_AMI486, "ami486", { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 256, 1, at_ali1429_init, NULL}, + {"AMI WinBIOS 486", ROM_WIN486, "win486", { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 256, 1, at_ali1429_init, NULL}, + {"DTK PKM-0038S E-2", ROM_DTK486, "dtk486", { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 256, 1, at_dtk486_init, NULL}, + {"Award SiS 496/497", ROM_SIS496, "sis496", { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 256, 1, at_sis496_init, NULL}, + {"Rise Computer R418", ROM_R418, "r418", { "Intel", cpus_i486, "AMD", cpus_Am486, "Cyrix", cpus_Cx486, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 256, 1, at_r418_init, NULL}, + {"Intel Premiere/PCI", ROM_REVENGE, "revenge", { "Intel", cpus_Pentium5V, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 128, 1, at_batman_init, NULL}, + {"Micro Star 586MC1", ROM_586MC1, "586mc1", { "Intel", cpus_Pentium5V50, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_HAS_IDE, 1, 128, 1, at_586mc1_init, NULL}, + {"Intel Premiere/PCI II", ROM_PLATO, "plato", { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 128, 1, at_plato_init, NULL}, + {"Intel Advanced/EV", ROM_ENDEAVOR, "endeavor", { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 128, 1, at_endeavor_init, NULL}, + {"Intel Advanced/ZP", ROM_ZAPPA, "zappa", { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 128, 1, at_endeavor_init, NULL}, + {"PC Partner MB500N", ROM_MB500N, "mb500n", { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 128, 1, at_mb500n_init, NULL}, + {"Intel Advanced/ATX", ROM_THOR, "thor", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 256, 1, at_endeavor_init, NULL}, + {"MR Intel Advanced/ATX", ROM_MRTHOR, "mrthor", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 256, 1, at_endeavor_init, NULL}, + {"ASUS P/I-P54TP4XE", ROM_P54TP4XE, "p54tp4xe", { "Intel", cpus_PentiumS5, "IDT", cpus_WinChip, "AMD", cpus_K5, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 512, 1, at_p54tp4xe_init, NULL}, + {"Acer M3a", ROM_ACERM3A, "acerm3a", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 512, 1, at_acerm3a_init, NULL}, + {"Acer V35N", ROM_ACERV35N, "acerv3n", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 512, 1, at_acerv35n_init, NULL}, + {"ASUS P/I-P55T2P4", ROM_P55T2P4, "p55r2p4", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 512, 1, at_p55t2p4_init, NULL}, + {"Award 430VX PCI", ROM_430VX, "430vx", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 256, 1, at_i430vx_init, NULL}, + {"Epox P55-VA", ROM_P55VA, "p55va", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 256, 1, at_p55va_init, NULL}, + {"ASUS P/I-P55TVP4", ROM_P55TVP4, "p55tvp4", { "Intel", cpus_Pentium, "IDT", cpus_WinChip, "Cyrix", cpus_6x86, "AMD", cpus_K56, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 256, 1, at_p55tvp4_init, NULL}, + {"Award 440FX PCI", ROM_440FX, "440fx", { "Intel", cpus_PentiumPro, "", NULL, "", NULL, "", NULL, "", NULL}, 0, MODEL_AT | MODEL_PS2 | MODEL_HAS_IDE, 1, 1024, 1, at_i440fx_init, NULL}, {"", -1, "", {"", 0, "", 0, "", 0}, 0,0,0, 0} }; @@ -260,7 +259,6 @@ void xt_init() mem_add_bios(); pit_set_out_func(1, pit_refresh_timer_xt); keyboard_xt_init(); - xtide_init(); nmi_init(); if (joystick_type != 7) device_add(&gameport_device); } @@ -288,7 +286,6 @@ void tandy1k_init() device_add(&sn76489_device); else device_add(&ncr8496_device); - xtide_init(); nmi_init(); if (romset != ROM_TANDY) device_add(&tandy_eeprom_device); @@ -301,7 +298,6 @@ void tandy1ksl2_init() mem_add_bios(); keyboard_tandy_init(); device_add(&pssj_device); - xtide_init(); nmi_init(); device_add(&tandy_rom_device); device_add(&tandy_eeprom_device); @@ -316,7 +312,6 @@ void ams_init() amstrad_init(); keyboard_amstrad_init(); nvr_init(); - xtide_init(); nmi_init(); fdc_set_dskchg_activelow(); if (joystick_type != 7) device_add(&gameport_device); @@ -328,7 +323,6 @@ void europc_init() mem_add_bios(); jim_init(); keyboard_xt_init(); - xtide_init(); nmi_init(); if (joystick_type != 7) device_add(&gameport_device); } @@ -340,7 +334,6 @@ void olim24_init() keyboard_olim24_init(); nvr_init(); olivetti_m24_init(); - xtide_init(); nmi_init(); if (joystick_type != 7) device_add(&gameport_device); } @@ -360,6 +353,12 @@ void at_init() if (joystick_type != 7) device_add(&gameport_device); } +void at_ide_init() +{ + at_init(); + ide_init(); +} + void deskpro386_init() { at_init(); @@ -414,43 +413,43 @@ void ps2_m30_286_init() void at_neat_init() { - at_init(); + at_ide_init(); neat_init(); } void at_scat_init() { - at_init(); + at_ide_init(); scat_init(); } /* void at_acer386sx_init() { - at_init(); + at_ide_init(); acer386sx_init(); } void at_82335_init() { - at_init(); + at_ide_init(); i82335_init(); } */ void at_wd76c10_init() { - at_init(); + at_ide_init(); wd76c10_init(); } void at_headland_init() { - at_init(); + at_ide_init(); headland_init(); } void at_opti495_init() { - at_init(); + at_ide_init(); opti495_init(); } @@ -472,7 +471,7 @@ void secondary_ide_check() void at_ali1429_init() { - at_init(); + at_ide_init(); ali1429_init(); secondary_ide_check(); @@ -480,14 +479,14 @@ void at_ali1429_init() /* void at_um8881f_init() { - at_init(); + at_ide_init(); pci_init(PCI_CONFIG_TYPE_1, 0, 31); um8881f_init(); } */ void at_dtk486_init() { - at_init(); + at_ide_init(); memregs_init(); sis85c471_init(); secondary_ide_check(); @@ -495,7 +494,7 @@ void at_dtk486_init() void at_sis496_init() { - at_init(); + at_ide_init(); memregs_init(); pci_init(PCI_CONFIG_TYPE_1, 0, 31); device_add(&sis496_device); @@ -509,7 +508,7 @@ void at_r418_init() void at_premiere_common_init() { - at_init(); + at_ide_init(); memregs_init(); pci_init(PCI_CONFIG_TYPE_2, 0xd, 0x10); sio_init(1); @@ -526,7 +525,7 @@ void at_batman_init() void at_586mc1_init() { - at_init(); + at_ide_init(); memregs_init(); pci_init(PCI_CONFIG_TYPE_2, 0xd, 0x10); i430lx_init(); @@ -543,7 +542,7 @@ void at_plato_init() void at_advanced_common_init() { - at_init(); + at_ide_init(); memregs_init(); pci_init(PCI_CONFIG_TYPE_1, 0xd, 0x10); i430fx_init(); @@ -567,7 +566,7 @@ void at_marl_init() void at_mb500n_init() { - at_init(); + at_ide_init(); pci_init(PCI_CONFIG_TYPE_1, 0xd, 0x10); i430fx_init(); piix_init(7); @@ -578,7 +577,7 @@ void at_mb500n_init() #if 0 void at_powermate_v_init() { - at_init(); + at_ide_init(); powermate_memregs_init(); pci_init(PCI_CONFIG_TYPE_1, 0, 31); i430fx_init(); @@ -591,7 +590,7 @@ void at_powermate_v_init() void at_p54tp4xe_init() { - at_init(); + at_ide_init(); memregs_init(); pci_init(PCI_CONFIG_TYPE_1, 0xd, 0x10); i430fx_init(); @@ -602,7 +601,7 @@ void at_p54tp4xe_init() void at_acerm3a_init() { - at_init(); + at_ide_init(); memregs_init(); powermate_memregs_init(); pci_init(PCI_CONFIG_TYPE_1, 0xd, 0x10); @@ -615,7 +614,7 @@ void at_acerm3a_init() void at_acerv35n_init() { - at_init(); + at_ide_init(); memregs_init(); powermate_memregs_init(); pci_init(PCI_CONFIG_TYPE_1, 0xd, 0x10); @@ -628,7 +627,7 @@ void at_acerv35n_init() void at_p55t2p4_init() { - at_init(); + at_ide_init(); memregs_init(); pci_init(PCI_CONFIG_TYPE_1, 0, 31); i430hx_init(); @@ -639,7 +638,7 @@ void at_p55t2p4_init() void at_i430vx_init() { - at_init(); + at_ide_init(); memregs_init(); pci_init(PCI_CONFIG_TYPE_1, 0, 31); i430vx_init(); @@ -650,7 +649,7 @@ void at_i430vx_init() void at_p55tvp4_init() { - at_init(); + at_ide_init(); memregs_init(); pci_init(PCI_CONFIG_TYPE_1, 0, 31); i430vx_init(); @@ -661,7 +660,7 @@ void at_p55tvp4_init() void at_p55va_init() { - at_init(); + at_ide_init(); memregs_init(); pci_init(PCI_CONFIG_TYPE_1, 0, 31); i430vx_init(); @@ -672,7 +671,7 @@ void at_p55va_init() void at_i440fx_init() { - at_init(); + at_ide_init(); memregs_init(); pci_init(PCI_CONFIG_TYPE_1, 0, 31); i440fx_init(); diff --git a/src/model.h b/src/model.h index eceda3a39..272770732 100644 --- a/src/model.h +++ b/src/model.h @@ -5,9 +5,10 @@ #define MODEL_PS2 2 #define MODEL_AMSTRAD 4 #define MODEL_OLIM24 8 -#define MODEL_NEC 16 -#define MODEL_FUJITSU 32 -#define MODEL_RM 64 +#define MODEL_HAS_IDE 16 +#define MODEL_NEC 32 +#define MODEL_FUJITSU 64 +#define MODEL_RM 128 typedef struct { diff --git a/src/nvr.c b/src/nvr.c index f94dc029e..3a1520c61 100644 --- a/src/nvr.c +++ b/src/nvr.c @@ -206,10 +206,10 @@ void loadnvr() case ROM_PC2086: f = romfopen(nvr_concat("pc2086.nvr"), "rb"); break; case ROM_PC3086: f = romfopen(nvr_concat("pc3086.nvr"), "rb"); break; case ROM_IBMAT: f = romfopen(nvr_concat("at.nvr"), "rb"); break; - case ROM_IBMPS1_2011: f = romfopen(nvr_concat("ibmps1_2011.nvr"), "rb"); break; - case ROM_IBMPS1_2121: f = romfopen(nvr_concat("ibmps1_2121.nvr"), "rb"); break; - case ROM_IBMPS1_2121_ISA: f = romfopen(nvr_concat("ibmps1_2121_isa.nvr"), "rb"); break; - case ROM_IBMPS2_M30_286: f = romfopen(nvr_concat("ibmps2_m30_286.nvr"), "rb"); break; + case ROM_IBMPS1_2011: f = romfopen(nvr_concat("ibmps1_2011.nvr"), "rb"); nvrmask = 127; break; + case ROM_IBMPS1_2121: f = romfopen(nvr_concat("ibmps1_2121.nvr"), "rb"); nvrmask = 127; break; + case ROM_IBMPS1_2121_ISA: f = romfopen(nvr_concat("ibmps1_2121_isa.nvr"), "rb"); nvrmask = 127; break; + case ROM_IBMPS2_M30_286: f = romfopen(nvr_concat("ibmps2_m30_286.nvr"), "rb"); nvrmask = 127; break; case ROM_CMDPC30: f = romfopen(nvr_concat("cmdpc30.nvr"), "rb"); nvrmask = 127; break; case ROM_AMI286: f = romfopen(nvr_concat("ami286.nvr"), "rb"); nvrmask = 127; break; case ROM_AWARD286: f = romfopen(nvr_concat("award286.nvr"), "rb"); nvrmask = 127; break; @@ -254,7 +254,9 @@ void loadnvr() case ROM_THOR: f = romfopen(nvr_concat("thor.nvr"), "rb"); nvrmask = 127; break; case ROM_MRTHOR: f = romfopen(nvr_concat("mrthor.nvr"), "rb"); nvrmask = 127; break; case ROM_ZAPPA: f = romfopen(nvr_concat("zappa.nvr"), "rb"); nvrmask = 127; break; +#if 0 case ROM_CMDPC60: f = romfopen(nvr_concat("cmdpc60.nvr"), "rb"); nvrmask = 127; break; +#endif default: return; } if (!f) @@ -340,7 +342,9 @@ void savenvr() case ROM_THOR: f = romfopen(nvr_concat("thor.nvr"), "wb"); break; case ROM_MRTHOR: f = romfopen(nvr_concat("mrthor.nvr"), "wb"); break; case ROM_ZAPPA: f = romfopen(nvr_concat("zappa.nvr"), "wb"); break; +#if 0 case ROM_CMDPC60: f = romfopen(nvr_concat("cmdpc60.nvr"), "wb"); break; +#endif default: return; } fwrite(nvrram,128,1,f); diff --git a/src/pc.c b/src/pc.c index 37f12430a..1b46fcba9 100644 --- a/src/pc.c +++ b/src/pc.c @@ -56,6 +56,7 @@ #include "vid_voodoo.h" #include "video.h" #include "amstrad.h" +#include "hdd.h" #include "nethandler.h" #define NE2000 1 #define RTL8029AS 2 @@ -522,7 +523,8 @@ void resetpchard() if (SSI2001) device_add(&ssi2001_device); if (voodoo_enabled) - device_add(&voodoo_device); + device_add(&voodoo_device); + hdd_controller_init(hdd_controller_name); pc_reset(); loadnvr(); @@ -800,6 +802,12 @@ void loadconfig(char *fn) else strcpy(discfns[3], ""); ui_writeprot[3] = config_get_int(NULL, "disc_4_writeprot", 0); + p = (char *)config_get_string(NULL, "hdd_controller", ""); + if (p) + strncpy(hdd_controller_name, p, sizeof(hdd_controller_name)-1); + else + strncpy(hdd_controller_name, "none", sizeof(hdd_controller_name)-1); + mem_size = config_get_int(NULL, "mem_size", 4096); if (mem_size < ((models[model].flags & MODEL_AT) ? models[model].min_ram*1024 : models[model].min_ram)) mem_size = ((models[model].flags & MODEL_AT) ? models[model].min_ram*1024 : models[model].min_ram); @@ -1026,6 +1034,8 @@ void saveconfig() config_set_int(NULL, "disc_3_writeprot", ui_writeprot[2]); config_set_string(NULL, "disc_4", discfns[3]); config_set_int(NULL, "disc_4_writeprot", ui_writeprot[3]); + config_set_string(NULL, "hdd_controller", hdd_controller_name); + config_set_int(NULL, "mem_size", mem_size); config_set_int(NULL, "cdrom_1_host_drive", cdrom_drives[0].host_drive); diff --git a/src/pc.rc b/src/pc.rc index 4de2f70a0..bf041602e 100644 --- a/src/pc.rc +++ b/src/pc.rc @@ -383,13 +383,13 @@ BEGIN VK_F12, IDM_FILE_RESET_CAD, CONTROL, VIRTKEY END -ConfigureDlg DIALOGEX 0, 0, 252+40, 236+80 +ConfigureDlg DIALOGEX 0, 0, 252+40, 236+100 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Configure 86Box" FONT 9, "Segoe UI" BEGIN - DEFPUSHBUTTON "OK",IDOK,64,292,50,14, WS_TABSTOP - PUSHBUTTON "Cancel",IDCANCEL,128,292,50,14, WS_TABSTOP + DEFPUSHBUTTON "OK",IDOK,64,312,50,14, WS_TABSTOP + PUSHBUTTON "Cancel",IDCANCEL,128,312,50,14, WS_TABSTOP COMBOBOX IDC_COMBO1,62,16,157,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Configure", IDC_CONFIGUREMOD, 224, 16, 40, 14, WS_TABSTOP COMBOBOX IDC_COMBOVID,62,36,157,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP @@ -405,27 +405,27 @@ BEGIN EDITTEXT IDC_MEMTEXT, 62, 136, 36, 14, ES_AUTOHSCROLL | ES_NUMBER CONTROL "", IDC_MEMSPIN, UPDOWN_CLASS, UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_SETBUDDYINT, 98, 136, 12, 14 LTEXT "MB", IDC_TEXT_MB, 98, 136, 10, 10 - CONTROL "CMS / Game Blaster",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,192,102,10 - CONTROL "Gravis Ultrasound",IDC_CHECKGUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,208,102,10 + CONTROL "CMS / Game Blaster",IDC_CHECK3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,212,102,10 + CONTROL "Gravis Ultrasound",IDC_CHECKGUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,228,102,10 - CONTROL "Innovation SSI-2001",IDC_CHECKSSI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,192,102,10 - CONTROL "En. XTIDE",IDC_CHECKXTIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,224,192,40,10 - CONTROL "SCSI Controller",IDC_CHECKBUSLOGIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,208,102,10 - PUSHBUTTON "Configure", IDC_CONFIGUREBUSLOGIC, 224, 208, 40, 14, WS_TABSTOP + CONTROL "Innovation SSI-2001",IDC_CHECKSSI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,212,102,10 + CONTROL "En. XTIDE",IDC_CHECKXTIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,224,212,40,10 + CONTROL "SCSI Controller",IDC_CHECKBUSLOGIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,228,102,10 + PUSHBUTTON "Configure", IDC_CONFIGUREBUSLOGIC, 224, 228, 40, 14, WS_TABSTOP - CONTROL "Enable time sync",IDC_CHECKSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,224,102,10 - CONTROL "Voodoo Graphics",IDC_CHECKVOODOO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,224,102,10 - PUSHBUTTON "Configure", IDC_CONFIGUREVOODOO, 224, 224, 40, 14, WS_TABSTOP + CONTROL "Enable time sync",IDC_CHECKSYNC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,14,244,102,10 + CONTROL "Voodoo Graphics",IDC_CHECKVOODOO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,244,102,10 + PUSHBUTTON "Configure", IDC_CONFIGUREVOODOO, 224, 244, 40, 14, WS_TABSTOP - LTEXT "Mouse :",IDC_STATIC,15,240,40,10 - COMBOBOX IDC_COMBOMOUSE,62,240,157,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + LTEXT "Mouse :",IDC_STATIC,15,260,40,10 + COMBOBOX IDC_COMBOMOUSE,62,260,157,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP - LTEXT "Joystick :",IDC_STATIC,15,260,40,10 - COMBOBOX IDC_COMBOJOY,62,260,157,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - DEFPUSHBUTTON "Joystick 1...",IDC_JOY1,16,276,50,14, WS_TABSTOP - PUSHBUTTON "Joystick 2...",IDC_JOY2,80,276,50,14, WS_TABSTOP - DEFPUSHBUTTON "Joystick 3...",IDC_JOY3,144,276,50,14, WS_TABSTOP - PUSHBUTTON "Joystick 4...",IDC_JOY4,208,276,50,14, WS_TABSTOP + LTEXT "Joystick :",IDC_STATIC,15,280,40,10 + COMBOBOX IDC_COMBOJOY,62,280,157,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + DEFPUSHBUTTON "Joystick 1...",IDC_JOY1,16,296,50,14, WS_TABSTOP + PUSHBUTTON "Joystick 2...",IDC_JOY2,80,296,50,14, WS_TABSTOP + DEFPUSHBUTTON "Joystick 3...",IDC_JOY3,144,296,50,14, WS_TABSTOP + PUSHBUTTON "Joystick 4...",IDC_JOY4,208,296,50,14, WS_TABSTOP LTEXT "Machine :",IDC_STATIC,15,16,40,10 LTEXT "Video :",IDC_STATIC,15,36,34,10 @@ -438,14 +438,16 @@ BEGIN COMBOBOX IDC_COMBONET,162,136,57,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Configure", IDC_CONFIGURENET, 224, 136, 40, 14, WS_TABSTOP LTEXT "Memory :",IDC_STATIC,15,136,40,10 - LTEXT "FDD 1 :",IDC_STATIC,15,156,40,10 - LTEXT "FDD 2 :",IDC_STATIC,125,156,40,10 - COMBOBOX IDC_COMBODR1,62,156,57,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBODR2,162,156,57,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "FDD 3 :",IDC_STATIC,15,176,40,10 - LTEXT "FDD 4 :",IDC_STATIC,125,176,40,10 - COMBOBOX IDC_COMBODR3,62,176,57,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_COMBODR4,162,176,57,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "HDD :",IDC_STATIC,15,156,40,10 + COMBOBOX IDC_COMBOHDD, 62,156,157,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "FDD 1 :",IDC_STATIC,15,176,40,10 + LTEXT "FDD 2 :",IDC_STATIC,125,176,40,10 + COMBOBOX IDC_COMBODR1,62,176,57,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_COMBODR2,162,176,57,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "FDD 3 :",IDC_STATIC,15,196,40,10 + LTEXT "FDD 4 :",IDC_STATIC,125,196,40,10 + COMBOBOX IDC_COMBODR3,62,196,57,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + COMBOBOX IDC_COMBODR4,162,196,57,120,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP END HdConfDlg DIALOGEX 0, 0, 270, DLG_HEIGHT @@ -609,6 +611,88 @@ BEGIN LTEXT "Type:",IDC_STATIC,94,39,17,8 END +HdConfDlgMfm DIALOGEX 0, 0, 210, 172 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Configure Hard Discs" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,31+12,152,50,14 + PUSHBUTTON "Cancel",IDCANCEL,101+12,152,50,14 + + LTEXT "C:",IDC_STATIC,7,6,27,10 + EDITTEXT IDC_EDIT_C_FN, 7, 22, 136, 12, WS_DISABLED + PUSHBUTTON "...",IDC_CFILE,7 + 136, 22, 16, 14 + PUSHBUTTON "New",IDC_CNEW,7 + 136 + 16, 22, 24, 14 + PUSHBUTTON "Eject", IDC_EJECTC, 7 + 136 + 16 + 24, 22, 24, 14 + + EDITTEXT IDC_EDIT_C_SPT,36,38,16,12, WS_DISABLED + EDITTEXT IDC_EDIT_C_HPC,94,38,16,12, WS_DISABLED + EDITTEXT IDC_EDIT_C_CYL,152,38,28,12, WS_DISABLED + LTEXT "Sectors:",IDC_STATIC,7,38,27,10 + LTEXT "Heads:",IDC_STATIC,63,38,29,8 + LTEXT "Cylinders:",IDC_STATIC,120,38,32,12 + LTEXT "", IDC_TEXT_C_SIZE, 7, 54, 136, 12 + + LTEXT "D:",IDC_STATIC,7,76,27,10 + EDITTEXT IDC_EDIT_D_FN, 7, 92, 136, 12, WS_DISABLED + PUSHBUTTON "...",IDC_DFILE,7 + 136, 92, 16, 14 + PUSHBUTTON "New",IDC_DNEW,7 + 136 + 16, 92, 24, 14 + PUSHBUTTON "Eject", IDC_EJECTD, 7 + 136 + 16 + 24, 92, 24, 14 + + EDITTEXT IDC_EDIT_D_SPT,36,108,16,12, WS_DISABLED + EDITTEXT IDC_EDIT_D_HPC,94,108,16,12, WS_DISABLED + EDITTEXT IDC_EDIT_D_CYL,152,108,28,12, WS_DISABLED + LTEXT "Sectors:",IDC_STATIC,7,108,27,10 + LTEXT "Heads:",IDC_STATIC,63,108,29,8 + LTEXT "Cylinders:",IDC_STATIC,120,108,32,12 + LTEXT "", IDC_TEXT_D_SIZE, 7, 124, 136, 12 +END + +HdNewDlgMfm DIALOGEX 0, 0, 186, 102 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "New Hard Disc" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,31,82,50,14 + PUSHBUTTON "Cancel",IDCANCEL,101,82,50,14 + + EDITTEXT IDC_EDITC, 7, 6, 136, 12 + PUSHBUTTON "...",IDC_CFILE,7 + 136, 6, 16, 14 + + EDITTEXT IDC_EDIT1,36,22,16,12 + EDITTEXT IDC_EDIT2,94,22,16,12 + EDITTEXT IDC_EDIT3,152,22,28,12 + LTEXT "Sectors:",IDC_STATIC,7,22,27,10 + LTEXT "Heads:",IDC_STATIC,63,22,29,8 + LTEXT "Cylinders:",IDC_STATIC,120,22,32,12 + LTEXT "", IDC_TEXT1, 7, 38, 136, 12 + + COMBOBOX IDC_HDTYPE, 7,54,172,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + +END + +HdSizeDlgMfm DIALOGEX 0, 0, 186, 102 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Hard disc parameters" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,31,82,50,14 + PUSHBUTTON "Cancel",IDCANCEL,101,82,50,14 + + LTEXT "Initial settings are based on file size",IDC_STATIC,7,6,170,10 + + EDITTEXT IDC_EDIT1,36,22,16,12 + EDITTEXT IDC_EDIT2,94,22,16,12 + EDITTEXT IDC_EDIT3,152,22,28,12 + LTEXT "Sectors:",IDC_STATIC,7,22,27,10 + LTEXT "Heads:",IDC_STATIC,63,22,29,8 + LTEXT "Cylinders:",IDC_STATIC,120,22,32,12 + LTEXT "", IDC_TEXT1, 7, 38, 136, 12 + + COMBOBOX IDC_HDTYPE, 7,54,172,120,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP + +END + StatusDlg DIALOGEX 0,0,186,186+20+180 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Status" diff --git a/src/resources.h b/src/resources.h index 0722f2ebc..4df7017c2 100644 --- a/src/resources.h +++ b/src/resources.h @@ -251,8 +251,9 @@ #define IDC_COMBOJOY 1064 #define IDC_COMBOWS 1065 #define IDC_COMBOMOUSE 1066 -#define IDC_COMBODR3 1067 -#define IDC_COMBODR4 1068 +#define IDC_COMBOHDD 1067 +#define IDC_COMBODR3 1068 +#define IDC_COMBODR4 1069 #define IDC_CHECK1 1010 #define IDC_CHECK2 1011 #define IDC_CHECK3 1012 @@ -353,6 +354,8 @@ #define IDC_EDIT_J_FN 1237 #define IDC_TEXT_J_SIZE 1247 +#define IDC_HDTYPE 1280 + #define IDC_MEMSPIN 1100 #define IDC_MEMTEXT 1101 #define IDC_STEXT1 1102 diff --git a/src/win-config.c b/src/win-config.c index a1894ee9e..f209635f4 100644 --- a/src/win-config.c +++ b/src/win-config.c @@ -16,6 +16,7 @@ #include "buslogic.h" #include "fdd.h" #include "gameport.h" +#include "hdd.h" #include "model.h" #include "mouse.h" #include "nvr.h" @@ -30,6 +31,7 @@ static int romstolist[ROM_MAX], listtomodel[ROM_MAX], romstomodel[ROM_MAX], mode static int settings_sound_to_list[20], settings_list_to_sound[20]; static int settings_mouse_to_list[20], settings_list_to_mouse[20]; static int settings_network_to_list[20], settings_list_to_network[20]; +static char *hdd_names[16]; static int mouse_valid(int type, int model) { @@ -42,6 +44,71 @@ static int mouse_valid(int type, int model) return 1; } +static void recalc_hdd_list(HWND hdlg, int model, int use_selected_hdd) +{ + HWND h; + + h = GetDlgItem(hdlg, IDC_COMBOHDD); + + if (models[model].flags & MODEL_HAS_IDE) + { + SendMessage(h, CB_RESETCONTENT, 0, 0); + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Internal IDE"); + EnableWindow(h, FALSE); + SendMessage(h, CB_SETCURSEL, 0, 0); + } + else + { + char *s; + int valid = 0; + char old_name[16]; + int c, d; + + if (use_selected_hdd) + { + c = SendMessage(h, CB_GETCURSEL, 0, 0); + + if (c != -1 && hdd_names[c]) + strncpy(old_name, hdd_names[c], sizeof(old_name)-1); + else + strcpy(old_name, "none"); + } + else + strncpy(old_name, hdd_controller_name, sizeof(old_name)-1); + + SendMessage(h, CB_RESETCONTENT, 0, 0); + c = d = 0; + while (1) + { + s = hdd_controller_get_name(c); + if (s[0] == 0) + break; + if ((hdd_controller_get_flags(c) & DEVICE_AT) && !(models[model].flags & MODEL_AT)) + { + c++; + continue; + } + if (!hdd_controller_available(c)) + { + c++; + continue; + } + SendMessage(h, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)s); + hdd_names[d] = hdd_controller_get_internal_name(c); + if (!strcmp(old_name, hdd_names[d])) + { + SendMessage(h, CB_SETCURSEL, d, 0); + valid = 1; + } + c++; + d++; + } + + if (!valid) + SendMessage(h, CB_SETCURSEL, 0, 0); + } +} + static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam) { char temp_str[256]; @@ -369,6 +436,9 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR } SendMessage(h, CB_SETCURSEL, settings_mouse_to_list[mouse_type], 0); + + recalc_hdd_list(hdlg, romstomodel[romset], 0); + return TRUE; case WM_COMMAND: @@ -446,11 +516,15 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR h = GetDlgItem(hdlg, IDC_COMBOMOUSE); temp_mouse_type = settings_list_to_mouse[SendMessage(h, CB_GETCURSEL, 0, 0)]; + h = GetDlgItem(hdlg, IDC_COMBOHDD); + c = SendMessage(h, CB_GETCURSEL, 0, 0); + if (temp_model != model || gfx != gfxcard || mem != mem_size || temp_cpu != cpu || temp_cpu_m != cpu_manufacturer || fpu != hasfpu || temp_GAMEBLASTER != GAMEBLASTER || temp_GUS != GUS || temp_fpu != enable_external_fpu || temp_SSI2001 != SSI2001 || temp_sound_card_current != sound_card_current || temp_xtide != enable_xtide || temp_voodoo != voodoo_enabled || temp_buslogic != buslogic_enabled || temp_dynarec != cpu_use_dynarec || temp_mouse_type != mouse_type || - temp_fd1_type != fdd_get_type(0) || temp_fd2_type != fdd_get_type(1) || temp_fd3_type != fdd_get_type(2) || temp_fd4_type != fdd_get_type(3) || temp_network_card_current != network_card_current) + temp_fd1_type != fdd_get_type(0) || temp_fd2_type != fdd_get_type(1) || temp_fd3_type != fdd_get_type(2) || temp_fd4_type != fdd_get_type(3) || + temp_network_card_current != network_card_current || strncmp(hdd_names[c], hdd_controller_name, sizeof(hdd_controller_name)-1)) { if (MessageBox(NULL,"This will reset 86Box!\nOkay to continue?","86Box",MB_OKCANCEL)==IDOK) { @@ -479,6 +553,11 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR network_card_current = temp_network_card_current; + if (hdd_names[c]) + strncpy(hdd_controller_name, hdd_names[c], sizeof(hdd_controller_name)-1); + else + strcpy(hdd_controller_name, "none"); + mem_resize(); loadbios(); resetpchard(); @@ -643,6 +722,8 @@ static BOOL CALLBACK config_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR SendMessage(h, CB_SETCURSEL, settings_mouse_to_list[temp_mouse_type], 0); else SendMessage(h, CB_SETCURSEL, 0, 0); + + recalc_hdd_list(hdlg, temp_model, 1); } break; case IDC_COMBOCPUM: diff --git a/src/win-hdconf.c b/src/win-hdconf.c index 98d5dc42e..73df0c97f 100644 --- a/src/win-hdconf.c +++ b/src/win-hdconf.c @@ -657,5 +657,8 @@ static BOOL CALLBACK hdconf_dlgproc(HWND hdlg, UINT message, WPARAM wParam, LPAR void hdconf_open(HWND hwnd) { - DialogBox(hinstance, TEXT("HdConfDlg"), hwnd, hdconf_dlgproc); + if (hdd_controller_current_is_mfm()) + DialogBox(hinstance, TEXT("HdConfDlgMfm"), hwnd, hdconf_dlgproc); + else + DialogBox(hinstance, TEXT("HdConfDlg"), hwnd, hdconf_dlgproc); } diff --git a/src/xtide.c b/src/xtide.c index b464d0231..14c7bf95e 100644 --- a/src/xtide.c +++ b/src/xtide.c @@ -1,20 +1,26 @@ -/* Copyright holders: Sarah Walker - see COPYING for more details -*/ #include "ibm.h" +#include "device.h" #include "io.h" #include "ide.h" +#include "mem.h" +#include "rom.h" #include "xtide.h" -uint8_t xtide_high; - -void xtide_write(uint16_t port, uint8_t val, void *priv) +typedef struct xtide_t { + uint8_t data_high; + rom_t bios_rom; +} xtide_t; + +static void xtide_write(uint16_t port, uint8_t val, void *p) +{ + xtide_t *xtide = (xtide_t *)p; + switch (port & 0xf) { case 0x0: - writeidew(0, val | (xtide_high << 8)); + writeidew(0, val | (xtide->data_high << 8)); return; case 0x1: case 0x2: case 0x3: @@ -23,7 +29,7 @@ void xtide_write(uint16_t port, uint8_t val, void *priv) return; case 0x8: - xtide_high = val; + xtide->data_high = val; return; case 0xe: @@ -32,14 +38,16 @@ void xtide_write(uint16_t port, uint8_t val, void *priv) } } -uint8_t xtide_read(uint16_t port, void *priv) +static uint8_t xtide_read(uint16_t port, void *p) { + xtide_t *xtide = (xtide_t *)p; uint16_t tempw; + switch (port & 0xf) { case 0x0: tempw = readidew(0); - xtide_high = tempw >> 8; + xtide->data_high = tempw >> 8; return tempw & 0xff; case 0x1: case 0x2: case 0x3: @@ -47,15 +55,76 @@ uint8_t xtide_read(uint16_t port, void *priv) return readide(0, (port & 0xf) | 0x1f0); case 0x8: - return xtide_high; + return xtide->data_high; case 0xe: return readide(0, 0x3f6); } } -void xtide_init() +static void *xtide_init() { + xtide_t *xtide = malloc(sizeof(xtide_t)); + memset(xtide, 0, sizeof(xtide_t)); + + rom_init(&xtide->bios_rom, "roms/ide_xt.bin", 0xc8000, 0x4000, 0x3fff, 0, MEM_MAPPING_EXTERNAL); ide_init(); - io_sethandler(0x0300, 0x0010, xtide_read, NULL, NULL, xtide_write, NULL, NULL, NULL); + ide_pri_disable(); + ide_sec_disable(); + io_sethandler(0x0300, 0x0010, xtide_read, NULL, NULL, xtide_write, NULL, NULL, xtide); + + return xtide; } + +static void *xtide_at_init() +{ + xtide_t *xtide = malloc(sizeof(xtide_t)); + memset(xtide, 0, sizeof(xtide_t)); + + rom_init(&xtide->bios_rom, "roms/ide_at.bin", 0xc8000, 0x4000, 0x3fff, 0, MEM_MAPPING_EXTERNAL); + ide_init(); + + return xtide; +} + +static void xtide_close(void *p) +{ + xtide_t *xtide = (xtide_t *)p; + + free(xtide); +} + +static int xtide_available() +{ + return rom_present("roms/ide_xt.bin"); +} + +static int xtide_at_available() +{ + return rom_present("roms/ide_at.bin"); +} + +device_t xtide_device = +{ + "XTIDE", + 0, + xtide_init, + xtide_close, + xtide_available, + NULL, + NULL, + NULL, + NULL +}; +device_t xtide_at_device = +{ + "XTIDE (AT)", + DEVICE_AT, + xtide_at_init, + xtide_close, + xtide_at_available, + NULL, + NULL, + NULL, + NULL +}; diff --git a/src/xtide.h b/src/xtide.h index bc1761369..6780844f6 100644 --- a/src/xtide.h +++ b/src/xtide.h @@ -1,4 +1,2 @@ -/* Copyright holders: Sarah Walker - see COPYING for more details -*/ -void xtide_init(); +extern device_t xtide_device; +extern device_t xtide_at_device;