Merge branch 'master' of https://github.com/OBattler/86Box into experimental
This commit is contained in:
BIN
src/ICONS/network.ico
Normal file
BIN
src/ICONS/network.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@@ -205,6 +205,9 @@ bool CDROM_Interface_Image::IsMode2(unsigned long sector)
|
||||
|
||||
bool CDROM_Interface_Image::LoadIsoFile(char* filename)
|
||||
{
|
||||
int shift = 0;
|
||||
int totalPregap = 0;
|
||||
|
||||
tracks.clear();
|
||||
|
||||
// data track
|
||||
@@ -216,6 +219,7 @@ bool CDROM_Interface_Image::LoadIsoFile(char* filename)
|
||||
return false;
|
||||
}
|
||||
track.number = 1;
|
||||
track.track_number = 1;//IMPORTANT: This is needed.
|
||||
track.attr = DATA_TRACK;//data
|
||||
|
||||
// try to detect iso type
|
||||
@@ -239,7 +243,7 @@ bool CDROM_Interface_Image::LoadIsoFile(char* filename)
|
||||
// leadout track
|
||||
track.number = 2;
|
||||
track.track_number = 0xAA;
|
||||
track.attr = 0;
|
||||
track.attr = 0x16; /* Was 0x00 but I believe 0x16 is appropriate. */
|
||||
track.start = track.length;
|
||||
track.length = 0;
|
||||
track.file = NULL;
|
||||
@@ -389,7 +393,8 @@ bool CDROM_Interface_Image::LoadCueSheet(char *cuefile)
|
||||
// add leadout track
|
||||
track.number++;
|
||||
track.track_number = 0xAA;
|
||||
track.attr = 0;//sync with load iso
|
||||
// track.attr = 0;//sync with load iso
|
||||
track.attr = 0x16; /* Was 0x00 but I believe 0x16 is appropriate. */
|
||||
track.start = 0;
|
||||
track.length = 0;
|
||||
track.file = NULL;
|
||||
|
@@ -228,7 +228,7 @@ static int image_get_last_block(uint8_t id, uint8_t starttrack, int msf, int max
|
||||
{
|
||||
uint32_t address;
|
||||
cdimg[id]->GetAudioTrackInfo(c+1, number, tmsf, attr);
|
||||
address = MSFtoLBA(tmsf.min, tmsf.sec, tmsf.fr);
|
||||
address = MSFtoLBA(tmsf.min, tmsf.sec, tmsf.fr) - 150; /* Do the - 150 here as well. */
|
||||
if (address > lb)
|
||||
lb = address;
|
||||
}
|
||||
@@ -733,7 +733,7 @@ static void lba_to_msf(uint8_t *buf, int lba)
|
||||
lba += 150;
|
||||
buf[0] = (lba / 75) / 60;
|
||||
buf[1] = (lba / 75) % 60;
|
||||
buf[2] = lba % 75;
|
||||
buf[2] = lba % 75;
|
||||
}
|
||||
|
||||
static uint32_t image_size(uint8_t id)
|
||||
@@ -747,64 +747,12 @@ static int image_readtoc(uint8_t id, unsigned char *b, unsigned char starttrack,
|
||||
int len=4;
|
||||
int c,d;
|
||||
uint32_t temp;
|
||||
uint8_t *q;
|
||||
|
||||
int first_track;
|
||||
int last_track;
|
||||
int number;
|
||||
unsigned char attr;
|
||||
TMSF tmsf;
|
||||
int lb;
|
||||
|
||||
if (cdrom_image[id].image_is_iso)
|
||||
{
|
||||
if (starttrack > 1 && starttrack != 0xaa)
|
||||
return -1;
|
||||
q = b + 2;
|
||||
*q++ = 1; /* first session */
|
||||
*q++ = 1; /* last session */
|
||||
if (starttrack <= 1) {
|
||||
*q++ = 0; /* reserved */
|
||||
*q++ = 0x14; /* ADR, control */
|
||||
*q++ = 1; /* track number */
|
||||
*q++ = 0; /* reserved */
|
||||
if (msf) {
|
||||
*q++ = 0; /* reserved */
|
||||
lba_to_msf(q, 0);
|
||||
q += 3;
|
||||
} else {
|
||||
/* sector 0 */
|
||||
*q++ = 0;
|
||||
*q++ = 0;
|
||||
*q++ = 0;
|
||||
*q++ = 0;
|
||||
}
|
||||
}
|
||||
/* lead out track */
|
||||
*q++ = 0; /* reserved */
|
||||
*q++ = 0x16; /* ADR, control */
|
||||
*q++ = 0xaa; /* track number */
|
||||
*q++ = 0; /* reserved */
|
||||
lb = image_size(id) - 1;
|
||||
if (msf) {
|
||||
*q++ = 0; /* reserved */
|
||||
lba_to_msf(q, lb);
|
||||
q += 3;
|
||||
} else {
|
||||
*q++ = lb >> 24;
|
||||
*q++ = lb >> 16;
|
||||
*q++ = lb >> 8;
|
||||
*q++ = lb;
|
||||
}
|
||||
len = q - b;
|
||||
if (len > maxlen)
|
||||
{
|
||||
len = maxlen;
|
||||
}
|
||||
b[0] = (uint8_t)(((len-2) >> 8) & 0xff);
|
||||
b[1] = (uint8_t)((len-2) & 0xff);
|
||||
return len;
|
||||
}
|
||||
|
||||
cdimg[id]->GetAudioTracks(first_track, last_track, tmsf);
|
||||
|
||||
b[2] = first_track;
|
||||
@@ -829,6 +777,7 @@ static int image_readtoc(uint8_t id, unsigned char *b, unsigned char starttrack,
|
||||
break;
|
||||
cdimg[id]->GetAudioTrackInfo(c+1, number, tmsf, attr);
|
||||
|
||||
// pclog("Len %i max %i Track %02X - %02X %02X %02i:%02i:%02i %08X\n",len,maxlen,toc[c].cdte_track,toc[c].cdte_adr,toc[c].cdte_ctrl,toc[c].cdte_addr.msf.minute, toc[c].cdte_addr.msf.second, toc[c].cdte_addr.msf.frame,MSFtoLBA(toc[c].cdte_addr.msf.minute, toc[c].cdte_addr.msf.second, toc[c].cdte_addr.msf.frame));
|
||||
b[len++] = 0; /* reserved */
|
||||
b[len++] = attr;
|
||||
b[len++] = number; /* track number */
|
||||
@@ -843,7 +792,7 @@ static int image_readtoc(uint8_t id, unsigned char *b, unsigned char starttrack,
|
||||
}
|
||||
else
|
||||
{
|
||||
temp = MSFtoLBA(tmsf.min, tmsf.sec, tmsf.fr);
|
||||
temp = MSFtoLBA(tmsf.min, tmsf.sec, tmsf.fr) - 150;
|
||||
b[len++] = temp >> 24;
|
||||
b[len++] = temp >> 16;
|
||||
b[len++] = temp >> 8;
|
||||
@@ -852,50 +801,42 @@ static int image_readtoc(uint8_t id, unsigned char *b, unsigned char starttrack,
|
||||
if (single)
|
||||
break;
|
||||
}
|
||||
|
||||
if (len > maxlen)
|
||||
{
|
||||
len = maxlen;
|
||||
}
|
||||
|
||||
b[0] = (uint8_t)(((len-2) >> 8) & 0xff);
|
||||
b[1] = (uint8_t)((len-2) & 0xff);
|
||||
/*
|
||||
pclog("Table of Contents:\n");
|
||||
pclog("First track - %02X\n", first_track);
|
||||
pclog("Last track - %02X\n", last_track);
|
||||
for (c = 0; c <= last_track; c++)
|
||||
{
|
||||
cdimg[id]->GetAudioTrackInfo(c+1, number, tmsf, attr);
|
||||
pclog("Track %02X - number %02X control %02X adr %02X address %02X %02X %02X %02X\n", c, number, attr, 0, 0, tmsf.min, tmsf.sec, tmsf.fr);
|
||||
}
|
||||
for (c = 0;c <= last_track; c++) {
|
||||
cdimg[id]->GetAudioTrackInfo(c+1, number, tmsf, attr);
|
||||
pclog("Track %02X - number %02X control %02X adr %02X address %06X\n", c, number, attr, 0, MSF_TO_FRAMES(tmsf.min, tmsf.sec, tmsf.fr));
|
||||
}
|
||||
*/
|
||||
return len;
|
||||
}
|
||||
|
||||
static int image_readtoc_session(uint8_t id, unsigned char *b, int msf, int maxlen)
|
||||
{
|
||||
if (!cdimg[id]) return 0;
|
||||
int len = 4;
|
||||
|
||||
int number;
|
||||
TMSF tmsf;
|
||||
unsigned char attr;
|
||||
uint8_t *q;
|
||||
|
||||
if (cdrom_image[id].image_is_iso)
|
||||
{
|
||||
q = b + 2;
|
||||
*q++ = 1; /* first session */
|
||||
*q++ = 1; /* last session */
|
||||
|
||||
*q++ = 1; /* session number */
|
||||
*q++ = 0x14; /* data track */
|
||||
*q++ = 0; /* track number */
|
||||
*q++ = 0xa0; /* lead-in */
|
||||
*q++ = 0; /* min */
|
||||
*q++ = 0; /* sec */
|
||||
*q++ = 0; /* frame */
|
||||
*q++ = 0;
|
||||
|
||||
if (maxlen < 12)
|
||||
{
|
||||
return maxlen;
|
||||
}
|
||||
return 12;
|
||||
}
|
||||
if (!cdimg[id]) return 0;
|
||||
|
||||
cdimg[id]->GetAudioTrackInfo(1, number, tmsf, attr);
|
||||
|
||||
if (number == 0)
|
||||
{
|
||||
number = 1;
|
||||
}
|
||||
|
||||
b[2] = 1;
|
||||
b[3] = 1;
|
||||
b[len++] = 0; /* reserved */
|
||||
@@ -911,7 +852,7 @@ static int image_readtoc_session(uint8_t id, unsigned char *b, int msf, int maxl
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t temp = MSFtoLBA(tmsf.min, tmsf.sec, tmsf.fr);
|
||||
uint32_t temp = MSFtoLBA(tmsf.min, tmsf.sec, tmsf.fr) - 150; /* Do the - 150. */
|
||||
b[len++] = temp >> 24;
|
||||
b[len++] = temp >> 16;
|
||||
b[len++] = temp >> 8;
|
||||
@@ -928,8 +869,6 @@ static int image_readtoc_session(uint8_t id, unsigned char *b, int msf, int maxl
|
||||
|
||||
static int image_readtoc_raw(uint8_t id, unsigned char *b, int msf, int maxlen)
|
||||
{
|
||||
if (!cdimg[id]) return 0;
|
||||
|
||||
int track;
|
||||
int len = 4;
|
||||
|
||||
@@ -938,93 +877,9 @@ static int image_readtoc_raw(uint8_t id, unsigned char *b, int msf, int maxlen)
|
||||
int number;
|
||||
unsigned char attr;
|
||||
TMSF tmsf;
|
||||
uint8_t *q;
|
||||
int lb;
|
||||
|
||||
if (cdrom_image[id].image_is_iso)
|
||||
{
|
||||
q = b + 2;
|
||||
*q++ = 1; /* first session */
|
||||
*q++ = 1; /* last session */
|
||||
|
||||
*q++ = 1; /* session number */
|
||||
*q++ = 0x14; /* data track */
|
||||
*q++ = 0; /* track number */
|
||||
*q++ = 0xa0; /* lead-in */
|
||||
*q++ = 0; /* min */
|
||||
*q++ = 0; /* sec */
|
||||
*q++ = 0; /* frame */
|
||||
*q++ = 0;
|
||||
*q++ = 1; /* first track */
|
||||
*q++ = 0x00; /* disk type */
|
||||
*q++ = 0x00;
|
||||
|
||||
*q++ = 1; /* session number */
|
||||
*q++ = 0x14; /* data track */
|
||||
*q++ = 0; /* track number */
|
||||
*q++ = 0xa1;
|
||||
*q++ = 0; /* min */
|
||||
*q++ = 0; /* sec */
|
||||
*q++ = 0; /* frame */
|
||||
*q++ = 0;
|
||||
*q++ = 1; /* last track */
|
||||
*q++ = 0x00;
|
||||
*q++ = 0x00;
|
||||
|
||||
*q++ = 1; /* session number */
|
||||
*q++ = 0x14; /* data track */
|
||||
*q++ = 0; /* track number */
|
||||
*q++ = 0xa2; /* lead-out */
|
||||
*q++ = 0; /* min */
|
||||
*q++ = 0; /* sec */
|
||||
*q++ = 0; /* frame */
|
||||
lb = image_size(id) >> 11;
|
||||
/* this is raw, must be msf */
|
||||
if (msf)
|
||||
{
|
||||
*q++ = 0; /* reserved */
|
||||
lba_to_msf(q, lb);
|
||||
q += 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
*q++ = (lb >> 24) & 0xff;
|
||||
*q++ = (lb >> 16) & 0xff;
|
||||
*q++ = (lb >> 8) & 0xff;
|
||||
*q++ = lb & 0xff;
|
||||
}
|
||||
|
||||
*q++ = 1; /* session number */
|
||||
*q++ = 0x14; /* ADR, control */
|
||||
*q++ = 0; /* track number */
|
||||
*q++ = 1; /* point */
|
||||
*q++ = 0; /* min */
|
||||
*q++ = 0; /* sec */
|
||||
*q++ = 0; /* frame */
|
||||
/* same here */
|
||||
if (msf)
|
||||
{
|
||||
*q++ = 0; /* reserved */
|
||||
lba_to_msf(q, 0);
|
||||
q += 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
*q++ = 0;
|
||||
*q++ = 0;
|
||||
*q++ = 0;
|
||||
*q++ = 0;
|
||||
}
|
||||
|
||||
len = q - b;
|
||||
if (len > maxlen)
|
||||
{
|
||||
len = maxlen;
|
||||
}
|
||||
b[0] = (uint8_t)(((len-2) >> 8) & 0xff);
|
||||
b[1] = (uint8_t)((len-2) & 0xff);
|
||||
return len;
|
||||
}
|
||||
if (!cdimg[id]) return 0;
|
||||
|
||||
cdimg[id]->GetAudioTracks(first_track, last_track, tmsf);
|
||||
|
||||
@@ -1048,21 +903,10 @@ static int image_readtoc_raw(uint8_t id, unsigned char *b, int msf, int maxlen)
|
||||
b[len++]=0;
|
||||
b[len++]=0;
|
||||
b[len++]=0;
|
||||
if (msf)
|
||||
{
|
||||
b[len++]=0;
|
||||
b[len++] = tmsf.min;
|
||||
b[len++] = tmsf.sec;
|
||||
b[len++] = tmsf.fr;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32_t temp = MSFtoLBA(tmsf.min, tmsf.sec, tmsf.fr);
|
||||
b[len++] = temp >> 24;
|
||||
b[len++] = temp >> 16;
|
||||
b[len++] = temp >> 8;
|
||||
b[len++] = temp;
|
||||
}
|
||||
b[len++]=0;
|
||||
b[len++] = tmsf.min;
|
||||
b[len++] = tmsf.sec;
|
||||
b[len++] = tmsf.fr;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
@@ -19,6 +19,8 @@ extern void image_close(uint8_t id);
|
||||
void update_status_bar_icon_state(int tag, int state);
|
||||
extern void cdrom_set_null_handler(uint8_t id);
|
||||
|
||||
void pclog(const char *format, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -1912,7 +1912,7 @@ void d86f_format_track(int drive, int side, int do_write)
|
||||
if (do_write)
|
||||
{
|
||||
d86f_write_direct(drive, side, d86f[drive].fill, 0);
|
||||
d86f_handler[drive].write_data(drive, side, d86f[drive].datac++, d86f[drive].fill);
|
||||
d86f_handler[drive].write_data(drive, side, d86f[drive].datac, d86f[drive].fill);
|
||||
}
|
||||
d86f_calccrc(drive, d86f[drive].fill);
|
||||
break;
|
||||
|
@@ -796,7 +796,7 @@ static void esdi_mca_write(int port, uint8_t val, void *p)
|
||||
}
|
||||
}
|
||||
|
||||
static void loadhd(esdi_t *esdi, int d, const wchar_t *fn)
|
||||
static void loadhd(esdi_t *esdi, int hdc_num, int d, const wchar_t *fn)
|
||||
{
|
||||
esdi_drive_t *drive = &esdi->drives[d];
|
||||
|
||||
@@ -829,15 +829,16 @@ static void loadhd(esdi_t *esdi, int d, const wchar_t *fn)
|
||||
}
|
||||
}
|
||||
|
||||
drive->spt = hdc[d].spt;
|
||||
drive->hpc = hdc[d].hpc;
|
||||
drive->tracks = hdc[d].tracks;
|
||||
drive->sectors = hdc[d].spt * hdc[d].hpc * hdc[d].tracks;
|
||||
drive->spt = hdc[hdc_num].spt;
|
||||
drive->hpc = hdc[hdc_num].hpc;
|
||||
drive->tracks = hdc[hdc_num].tracks;
|
||||
drive->sectors = hdc[hdc_num].spt * hdc[hdc_num].hpc * hdc[hdc_num].tracks;
|
||||
}
|
||||
|
||||
static void *esdi_init()
|
||||
{
|
||||
int i = 0;
|
||||
int c = 0;
|
||||
|
||||
esdi_t *esdi = malloc(sizeof(esdi_t));
|
||||
memset(esdi, 0, sizeof(esdi_t));
|
||||
@@ -847,7 +848,12 @@ static void *esdi_init()
|
||||
|
||||
for (i = 0; i < HDC_NUM; i++)
|
||||
{
|
||||
loadhd(esdi, hdc[i].mfm_channel, hdd_fn[i]);
|
||||
if ((hdc[i].bus == 1) && (hdc[i].mfm_channel < MFM_NUM))
|
||||
{
|
||||
loadhd(esdi, i, hdc[i].mfm_channel, hdd_fn[i]);
|
||||
c++;
|
||||
if (c >= MFM_NUM) break;
|
||||
}
|
||||
}
|
||||
|
||||
timer_add(esdi_callback, &esdi->callback, &esdi->callback, esdi);
|
||||
|
55
src/ide.h
55
src/ide.h
@@ -11,33 +11,34 @@ typedef struct IDE
|
||||
typedef struct __attribute__((__packed__)) IDE
|
||||
#endif
|
||||
{
|
||||
int type;
|
||||
int board;
|
||||
uint8_t atastat;
|
||||
uint8_t error;
|
||||
int secount,sector,cylinder,head,drive,cylprecomp;
|
||||
uint8_t command;
|
||||
uint8_t fdisk;
|
||||
int pos;
|
||||
int packlen;
|
||||
int spt,hpc;
|
||||
int tracks;
|
||||
int packetstatus;
|
||||
uint8_t asc;
|
||||
int reset;
|
||||
FILE *hdfile;
|
||||
uint16_t buffer[65536];
|
||||
int irqstat;
|
||||
int service;
|
||||
int lba;
|
||||
int channel;
|
||||
uint32_t lba_addr;
|
||||
int skip512;
|
||||
int blocksize, blockcount;
|
||||
uint16_t dma_identify_data[3];
|
||||
int hdi,base;
|
||||
int hdc_num;
|
||||
uint8_t specify_success;
|
||||
int type;
|
||||
int board;
|
||||
uint8_t atastat;
|
||||
uint8_t error;
|
||||
int secount,sector,cylinder,head,drive,cylprecomp;
|
||||
uint8_t command;
|
||||
uint8_t fdisk;
|
||||
int pos;
|
||||
int packlen;
|
||||
int spt,hpc;
|
||||
int tracks;
|
||||
int packetstatus;
|
||||
uint8_t asc;
|
||||
int reset;
|
||||
FILE *hdfile;
|
||||
uint16_t buffer[65536];
|
||||
int irqstat;
|
||||
int service;
|
||||
int lba;
|
||||
int channel;
|
||||
uint32_t lba_addr;
|
||||
int skip512;
|
||||
int blocksize, blockcount;
|
||||
uint16_t dma_identify_data[3];
|
||||
int hdi,base;
|
||||
int hdc_num;
|
||||
uint8_t specify_success;
|
||||
int mdma_mode;
|
||||
} IDE;
|
||||
#ifdef __MSC__
|
||||
# pragma pack(pop)
|
||||
|
@@ -763,7 +763,7 @@ static void xebec_callback(void *p)
|
||||
}
|
||||
}
|
||||
|
||||
static void loadhd(xebec_t *xebec, int d, const wchar_t *fn)
|
||||
static void loadhd(xebec_t *xebec, int c, int d, const wchar_t *fn)
|
||||
{
|
||||
mfm_drive_t *drive = &xebec->drives[d];
|
||||
|
||||
@@ -796,9 +796,9 @@ static void loadhd(xebec_t *xebec, int d, const wchar_t *fn)
|
||||
}
|
||||
}
|
||||
|
||||
drive->spt = hdc[d].spt;
|
||||
drive->hpc = hdc[d].hpc;
|
||||
drive->tracks = hdc[d].tracks;
|
||||
drive->spt = hdc[c].spt;
|
||||
drive->hpc = hdc[c].hpc;
|
||||
drive->tracks = hdc[c].tracks;
|
||||
}
|
||||
|
||||
static struct
|
||||
@@ -844,15 +844,18 @@ static void xebec_set_switches(xebec_t *xebec)
|
||||
static void *xebec_init()
|
||||
{
|
||||
int i = 0;
|
||||
int c = 0;
|
||||
|
||||
xebec_t *xebec = malloc(sizeof(xebec_t));
|
||||
memset(xebec, 0, sizeof(xebec_t));
|
||||
|
||||
for (i = 0; i < HDC_NUM; i++)
|
||||
{
|
||||
if (hdc[i].bus == 1)
|
||||
if ((hdc[i].bus == 1) && (hdc[i].mfm_channel < MFM_NUM))
|
||||
{
|
||||
loadhd(xebec, hdc[i].mfm_channel, hdd_fn[i]);
|
||||
loadhd(xebec, i, hdc[i].mfm_channel, hdd_fn[i]);
|
||||
c++;
|
||||
if (c > MFM_NUM) break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -904,15 +907,18 @@ device_t mfm_xebec_device =
|
||||
static void *dtc_5150x_init()
|
||||
{
|
||||
int i = 0;
|
||||
int c = 0;
|
||||
|
||||
xebec_t *xebec = malloc(sizeof(xebec_t));
|
||||
memset(xebec, 0, sizeof(xebec_t));
|
||||
|
||||
for (i = 0; i < HDC_NUM; i++)
|
||||
{
|
||||
if (hdc[i].bus == 1)
|
||||
if ((hdc[i].bus == 1) && (hdc[i].mfm_channel < MFM_NUM))
|
||||
{
|
||||
loadhd(xebec, hdc[i].mfm_channel, hdd_fn[i]);
|
||||
loadhd(xebec, i, hdc[i].mfm_channel, hdd_fn[i]);
|
||||
c++;
|
||||
if (c > MFM_NUM) break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -35,6 +35,7 @@ static SCSI_CARD scsi_cards[] = {
|
||||
{ "None", "none", NULL },
|
||||
{ "Adaptec AHA-1540B", "aha1540b", &aha1540b_device },
|
||||
{ "Adaptec AHA-1542CF", "aha1542cf", &aha1542cf_device },
|
||||
{ "Adaptec AHA-1640", "aha1640", &aha1640_device },
|
||||
{ "BusLogic BT-542B", "bt542b", &buslogic_device },
|
||||
{ "BusLogic BT-958D PCI", "bt958d", &buslogic_pci_device },
|
||||
{ "", "", NULL }
|
||||
|
@@ -25,7 +25,9 @@
|
||||
#include <stdarg.h>
|
||||
#include "ibm.h"
|
||||
#include "io.h"
|
||||
#include "mca.h"
|
||||
#include "mem.h"
|
||||
#include "mca.h"
|
||||
#include "rom.h"
|
||||
#include "dma.h"
|
||||
#include "pic.h"
|
||||
@@ -176,7 +178,6 @@ static uint16_t aha_ports[] = {
|
||||
0x0130, 0x0134, 0x0000, 0x0000
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Write data to the BIOS space.
|
||||
*
|
||||
@@ -258,7 +259,7 @@ aha_patch(uint8_t *romptr, uint16_t ioaddr)
|
||||
|
||||
/* Initialize AHA-154xNN-specific stuff. */
|
||||
static void
|
||||
aha154x_bios(uint16_t ioaddr, uint32_t memaddr, aha_info *aha)
|
||||
aha154x_bios(uint16_t ioaddr, uint32_t memaddr, aha_info *aha, int irq, int dma)
|
||||
{
|
||||
uint32_t bios_size;
|
||||
uint32_t bios_addr;
|
||||
@@ -388,10 +389,11 @@ again:
|
||||
/* Initialize the on-board EEPROM. */
|
||||
memset(aha_eep, 0x00, EEP_SIZE);
|
||||
aha_eep[0] = 7; /* SCSI ID 7 */
|
||||
aha_eep[1] = 15-9; /* IRQ15 */
|
||||
aha_eep[1] |= (6<<4); /* DMA6 */
|
||||
aha_eep[2] = (EE2_HABIOS | /* BIOS Space Reserved */
|
||||
EE2_SEEKRET); /* Immediate return on seek */
|
||||
aha_eep[0] |= (0x10 | 0x20 | 0x40);
|
||||
aha_eep[1] = irq-9; /* IRQ15 */
|
||||
aha_eep[1] |= (dma<<4); /* DMA6 */
|
||||
aha_eep[2] = (EE2_DYNSCAN | /* BIOS Space Reserved */
|
||||
EE2_EXT1G | EE2_RMVOK); /* Immediate return on seek */
|
||||
aha_eep[3] = SPEED_50; /* speed 5.0 MB/s */
|
||||
aha_eep[6] = (EE6_TERM | /* host term enable */
|
||||
EE6_RSTBUS); /* reset SCSI bus on boot */
|
||||
@@ -843,6 +845,7 @@ typedef struct {
|
||||
mem_mapping_t mmio_mapping;
|
||||
aha_info aha;
|
||||
int chip;
|
||||
uint8_t pos_regs[8];
|
||||
} aha_t;
|
||||
#pragma pack(pop)
|
||||
|
||||
@@ -855,7 +858,8 @@ static aha_t *ResetDev;
|
||||
|
||||
enum {
|
||||
CHIP_AHA154XB,
|
||||
CHIP_AHA154XCF
|
||||
CHIP_AHA154XCF,
|
||||
CHIP_AHA1640
|
||||
};
|
||||
|
||||
|
||||
@@ -2175,6 +2179,34 @@ aha_cmd_cb(void *priv)
|
||||
AHA_Callback += 50 * SCSI_TIME;
|
||||
}
|
||||
|
||||
uint8_t aha_mca_read(int port, void *p)
|
||||
{
|
||||
aha_t *dev = (aha_t *)p;
|
||||
|
||||
return dev->pos_regs[port & 7];
|
||||
}
|
||||
|
||||
static uint16_t aha_mca_addr[6] = {0x130, 0x134, 0x230, 0x234, 0x330, 0x334};
|
||||
|
||||
void aha_mca_write(int port, uint8_t val, void *p)
|
||||
{
|
||||
aha_t *dev = (aha_t *)p;
|
||||
uint16_t addr;
|
||||
|
||||
if (port < 0x102)
|
||||
return;
|
||||
|
||||
addr = aha_mca_addr[dev->pos_regs[4] & 6];
|
||||
io_removehandler(addr, 0x0004, aha_read, aha_readw, NULL, aha_write, aha_writew, NULL, dev);
|
||||
|
||||
dev->pos_regs[port & 7] = val;
|
||||
|
||||
if (dev->pos_regs[2] & 1)
|
||||
{
|
||||
io_sethandler(addr, 0x0004, aha_read, aha_readw, NULL, aha_write, aha_writew, NULL, dev);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
aha_init(int chip, int has_bios)
|
||||
@@ -2222,6 +2254,14 @@ aha_init(int chip, int has_bios)
|
||||
}
|
||||
}
|
||||
|
||||
if (dev->chip == CHIP_AHA1640)
|
||||
{
|
||||
pclog("Aha1640 initialized\n");
|
||||
mca_add(aha_mca_read, aha_mca_write, dev);
|
||||
dev->pos_regs[0] = 0x1F;
|
||||
dev->pos_regs[1] = 0x0F;
|
||||
}
|
||||
|
||||
timer_add(aha_reset_poll, &ResetCB, &ResetCB, dev);
|
||||
timer_add(aha_cmd_cb, &AHA_Callback, &AHA_Callback, dev);
|
||||
|
||||
@@ -2231,7 +2271,7 @@ aha_init(int chip, int has_bios)
|
||||
|
||||
if (bios) {
|
||||
/* Perform AHA-154xNN-specific initialization. */
|
||||
aha154x_bios(dev->Base, bios_addr, &dev->aha);
|
||||
aha154x_bios(dev->Base, bios_addr, &dev->aha, dev->Irq, dev->DmaChannel);
|
||||
}
|
||||
|
||||
return(dev);
|
||||
@@ -2251,6 +2291,12 @@ aha_154xCF_init(void)
|
||||
return(aha_init(CHIP_AHA154XCF, 1));
|
||||
}
|
||||
|
||||
static void *
|
||||
aha_1640_init(void)
|
||||
{
|
||||
return(aha_init(CHIP_AHA1640, 1));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
aha_close(void *priv)
|
||||
@@ -2359,6 +2405,77 @@ static device_config_t aha_154XCF_config[] = {
|
||||
}
|
||||
};
|
||||
|
||||
static device_config_t aha_1640_config[] = {
|
||||
{
|
||||
"addr", "Address", CONFIG_SELECTION, "", 0x330,
|
||||
{
|
||||
{
|
||||
"0x330", 0x330
|
||||
},
|
||||
{
|
||||
"0x334", 0x334
|
||||
},
|
||||
{
|
||||
"0x230", 0x230
|
||||
},
|
||||
{
|
||||
"0x234", 0x234
|
||||
},
|
||||
{
|
||||
"0x130", 0x130
|
||||
},
|
||||
{
|
||||
"0x134", 0x134
|
||||
},
|
||||
{
|
||||
""
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
"irq", "IRQ", CONFIG_SELECTION, "", 10,
|
||||
{
|
||||
{
|
||||
"IRQ 10", 10
|
||||
},
|
||||
{
|
||||
"IRQ 11", 11
|
||||
},
|
||||
{
|
||||
"IRQ 12", 12
|
||||
},
|
||||
{
|
||||
"IRQ 14", 14
|
||||
},
|
||||
{
|
||||
"IRQ 15", 15
|
||||
},
|
||||
{
|
||||
""
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
"dma", "DMA channel", CONFIG_SELECTION, "", 6,
|
||||
{
|
||||
{
|
||||
"DMA 5", 5
|
||||
},
|
||||
{
|
||||
"DMA 6", 6
|
||||
},
|
||||
{
|
||||
"DMA 7", 7
|
||||
},
|
||||
{
|
||||
""
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
"", "", -1
|
||||
}
|
||||
};
|
||||
|
||||
device_t aha1540b_device = {
|
||||
"Adaptec AHA-1540B",
|
||||
@@ -2383,3 +2500,15 @@ device_t aha1542cf_device = {
|
||||
NULL,
|
||||
aha_154XCF_config
|
||||
};
|
||||
|
||||
device_t aha1640_device = {
|
||||
"Adaptec AHA-1640",
|
||||
DEVICE_MCA,
|
||||
aha_1640_init,
|
||||
aha_close,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
aha_1640_config
|
||||
};
|
@@ -12,6 +12,7 @@ typedef struct {
|
||||
|
||||
extern device_t aha1540b_device;
|
||||
extern device_t aha1542cf_device;
|
||||
extern device_t aha1640_device;
|
||||
|
||||
|
||||
#endif /*SCSI_AHA154X_H*/
|
||||
|
@@ -188,10 +188,10 @@ int file_dlg(HWND hwnd, WCHAR *f, char *fn, int save)
|
||||
|
||||
int file_dlg_w_st(HWND hwnd, int i, WCHAR *fn, int save)
|
||||
{
|
||||
file_dlg_w(hwnd, win_language_get_string_from_id(i), fn, save);
|
||||
return file_dlg_w(hwnd, win_language_get_string_from_id(i), fn, save);
|
||||
}
|
||||
|
||||
int file_dlg_st(HWND hwnd, int i, char *fn, int save)
|
||||
{
|
||||
file_dlg(hwnd, win_language_get_string_from_id(i), fn, save);
|
||||
return file_dlg(hwnd, win_language_get_string_from_id(i), fn, save);
|
||||
}
|
||||
|
@@ -1192,6 +1192,7 @@ static BOOL CALLBACK win_settings_peripherals_proc(HWND hdlg, UINT message, WPAR
|
||||
int c = 0;
|
||||
int d = 0;
|
||||
LPTSTR lptsTemp;
|
||||
device_t *scsi_dev;
|
||||
|
||||
switch (message)
|
||||
{
|
||||
@@ -1210,21 +1211,26 @@ static BOOL CALLBACK win_settings_peripherals_proc(HWND hdlg, UINT message, WPAR
|
||||
break;
|
||||
}
|
||||
|
||||
settings_scsi_to_list[c] = d;
|
||||
|
||||
settings_scsi_to_list[c] = d;
|
||||
|
||||
if (scsi_card_available(c))
|
||||
{
|
||||
if (c == 0)
|
||||
scsi_dev = scsi_card_getdevice(c);
|
||||
|
||||
if (!scsi_dev || (scsi_dev->flags & DEVICE_MCA) == (models[temp_model].flags & MODEL_MCA))
|
||||
{
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2152));
|
||||
if (c == 0)
|
||||
{
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) win_language_get_string_from_id(2152));
|
||||
}
|
||||
else
|
||||
{
|
||||
mbstowcs(lptsTemp, s, strlen(s) + 1);
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp);
|
||||
}
|
||||
settings_list_to_scsi[d] = c;
|
||||
d++;
|
||||
}
|
||||
else
|
||||
{
|
||||
mbstowcs(lptsTemp, s, strlen(s) + 1);
|
||||
SendMessage(h, CB_ADDSTRING, 0, (LPARAM) lptsTemp);
|
||||
}
|
||||
settings_list_to_scsi[d] = c;
|
||||
d++;
|
||||
}
|
||||
|
||||
c++;
|
||||
|
67
src/win.c
67
src/win.c
@@ -920,8 +920,14 @@ void update_status_bar_panes(HWND hwnds)
|
||||
c_ide_dma = count_hard_disks(3);
|
||||
c_scsi = count_hard_disks(4);
|
||||
|
||||
for (i = 0; i < sb_parts; i++)
|
||||
{
|
||||
SendMessage(hwnds, SB_SETICON, i, (LPARAM) NULL);
|
||||
}
|
||||
|
||||
sb_parts = 0;
|
||||
memset(sb_part_meanings, 0, 40);
|
||||
memset(iStatusWidths, 0, 48);
|
||||
memset(sb_part_meanings, 0, 48);
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (fdd_get_type(i) != 0)
|
||||
@@ -950,14 +956,14 @@ void update_status_bar_panes(HWND hwnds)
|
||||
sb_part_meanings[sb_parts] = 0x20;
|
||||
sb_parts++;
|
||||
}
|
||||
if (c_ide_pio && (models[model].flags & MODEL_HAS_IDE) || !memcmp(hdd_controller_name, "xtide", 5))
|
||||
if (c_ide_pio && ((models[model].flags & MODEL_HAS_IDE) || !memcmp(hdd_controller_name, "xtide", 5)))
|
||||
{
|
||||
edge += sb_icon_width;
|
||||
iStatusWidths[sb_parts] = edge;
|
||||
sb_part_meanings[sb_parts] = 0x21;
|
||||
sb_parts++;
|
||||
}
|
||||
if (c_ide_dma && (models[model].flags & MODEL_HAS_IDE) || !memcmp(hdd_controller_name, "xtide", 5))
|
||||
if (c_ide_dma && ((models[model].flags & MODEL_HAS_IDE) || !memcmp(hdd_controller_name, "xtide", 5)))
|
||||
{
|
||||
edge += sb_icon_width;
|
||||
iStatusWidths[sb_parts] = edge;
|
||||
@@ -1605,11 +1611,8 @@ void win_cdrom_eject(uint8_t id)
|
||||
/* Signal disc change to the emulated machine. */
|
||||
cdrom_insert(id);
|
||||
}
|
||||
if (cdrom_drives[id].host_drive == 200)
|
||||
{
|
||||
CheckMenuItem(hmenu, IDM_CDROM_1_IMAGE + id, MF_UNCHECKED);
|
||||
}
|
||||
else
|
||||
CheckMenuItem(hmenu, IDM_CDROM_1_IMAGE + id, MF_UNCHECKED);
|
||||
if ((cdrom_drives[id].host_drive >= 65) && (cdrom_drives[id].host_drive <= 90))
|
||||
{
|
||||
CheckMenuItem(hmenu, IDM_CDROM_1_REAL + id + (cdrom_drive << 2), MF_UNCHECKED);
|
||||
}
|
||||
@@ -1795,21 +1798,25 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||
break;
|
||||
|
||||
case IDM_VID_FULLSCREEN:
|
||||
if (video_fullscreen_first)
|
||||
{
|
||||
video_fullscreen_first = 0;
|
||||
msgbox_info(ghwnd, 2193);
|
||||
}
|
||||
startblit();
|
||||
video_wait_for_blit();
|
||||
mouse_close();
|
||||
vid_apis[0][vid_api].close();
|
||||
video_fullscreen = 1;
|
||||
vid_apis[1][vid_api].init(ghwnd);
|
||||
mouse_init();
|
||||
leave_fullscreen_flag = 0;
|
||||
endblit();
|
||||
device_force_redraw();
|
||||
|
||||
if(video_fullscreen!=1){
|
||||
|
||||
if (video_fullscreen_first)
|
||||
{
|
||||
video_fullscreen_first = 0;
|
||||
msgbox_info(ghwnd, 2193);
|
||||
}
|
||||
startblit();
|
||||
video_wait_for_blit();
|
||||
mouse_close();
|
||||
vid_apis[0][vid_api].close();
|
||||
video_fullscreen = 1;
|
||||
vid_apis[1][vid_api].init(ghwnd);
|
||||
mouse_init();
|
||||
leave_fullscreen_flag = 0;
|
||||
endblit();
|
||||
device_force_redraw();
|
||||
}
|
||||
break;
|
||||
|
||||
case IDM_VID_FS_FULL:
|
||||
@@ -2209,6 +2216,7 @@ LRESULT CALLBACK StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPAR
|
||||
int cdrom_id = 0;
|
||||
int menu_sub_param = 0;
|
||||
int menu_super_param = 0;
|
||||
int ret = 0;
|
||||
|
||||
HMENU hmenu;
|
||||
|
||||
@@ -2219,7 +2227,8 @@ LRESULT CALLBACK StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPAR
|
||||
{
|
||||
case IDM_DISC_1:
|
||||
case IDM_DISC_1_WP:
|
||||
if (!file_dlg_w_st(hwnd, 2173, discfns[0], 0))
|
||||
ret = file_dlg_w_st(hwnd, 2173, discfns[0], 0);
|
||||
if (!ret)
|
||||
{
|
||||
disc_close(0);
|
||||
ui_writeprot[0] = (LOWORD(wParam) == IDM_DISC_1_WP) ? 1 : 0;
|
||||
@@ -2231,7 +2240,8 @@ LRESULT CALLBACK StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPAR
|
||||
break;
|
||||
case IDM_DISC_2:
|
||||
case IDM_DISC_2_WP:
|
||||
if (!file_dlg_w_st(hwnd, 2173, discfns[1], 0))
|
||||
ret = file_dlg_w_st(hwnd, 2173, discfns[1], 0);
|
||||
if (!ret)
|
||||
{
|
||||
disc_close(1);
|
||||
ui_writeprot[1] = (LOWORD(wParam) == IDM_DISC_2_WP) ? 1 : 0;
|
||||
@@ -2243,7 +2253,8 @@ LRESULT CALLBACK StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPAR
|
||||
break;
|
||||
case IDM_DISC_3:
|
||||
case IDM_DISC_3_WP:
|
||||
if (!file_dlg_w_st(hwnd, 2173, discfns[2], 0))
|
||||
ret = file_dlg_w_st(hwnd, 2173, discfns[2], 0);
|
||||
if (!ret)
|
||||
{
|
||||
disc_close(2);
|
||||
ui_writeprot[2] = (LOWORD(wParam) == IDM_DISC_3_WP) ? 1 : 0;
|
||||
@@ -2255,7 +2266,8 @@ LRESULT CALLBACK StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPAR
|
||||
break;
|
||||
case IDM_DISC_4:
|
||||
case IDM_DISC_4_WP:
|
||||
if (!file_dlg_w_st(hwnd, 2173, discfns[3], 0))
|
||||
ret = file_dlg_w_st(hwnd, 2173, discfns[3], 0);
|
||||
if (!ret)
|
||||
{
|
||||
disc_close(3);
|
||||
ui_writeprot[3] = (LOWORD(wParam) == IDM_DISC_4_WP) ? 1 : 0;
|
||||
@@ -2394,6 +2406,7 @@ LRESULT CALLBACK StatusBarProcedure(HWND hwnd, UINT message, WPARAM wParam, LPAR
|
||||
return 0;
|
||||
|
||||
case WM_LBUTTONDOWN:
|
||||
case WM_RBUTTONDOWN:
|
||||
GetClientRect(hwnd, (LPRECT)& rc);
|
||||
pt.x = GET_X_LPARAM(lParam);
|
||||
pt.y = GET_Y_LPARAM(lParam);
|
||||
|
Reference in New Issue
Block a user