Two instances of the IDE code setting the error register did not set it in the cdrom struct if drive is CD-ROM, now they do, fixes CD-ROM booting on the Intel Advanced/ATX and possibly other things;
Fixed IDE and ATAPI 8-bit data reads and writes by rewriting the IDE and CD-ROM PIO data read and write code so that the base code is now 8-bit; Added some compiler directives that if set, will enable togglable logging and log breakpoints; Empty IDE channels now always report a status of 0x10 rather than 0x20, and do it on port 3F6h/376h/36Eh/3EEh too, fixes OAKCDROM.SYS infinite loop when hitting an empty IDE channel.
This commit is contained in:
@@ -50,4 +50,4 @@ clean :
|
||||
$(CPP) $(CFLAGS) -c $<
|
||||
|
||||
pc.res: pc.rc
|
||||
$(WINDRES) -i pc.rc --input-format=rc -o pc.res -O coff
|
||||
$(WINDRES) $(RFLAGS) -i pc.rc --input-format=rc -o pc.res -O coff
|
||||
|
||||
@@ -50,4 +50,4 @@ clean :
|
||||
$(CPP) $(CFLAGS) -c $<
|
||||
|
||||
pc.res: pc.rc
|
||||
$(WINDRES) -i pc.rc --input-format=rc -o pc.res -O coff
|
||||
$(WINDRES) $(RFLAGS) -i pc.rc --input-format=rc -o pc.res -O coff
|
||||
|
||||
@@ -518,7 +518,7 @@ int scsi_base = 0x330;
|
||||
int scsi_dma = 6;
|
||||
int scsi_irq = 11;
|
||||
|
||||
int buslogic_do_log = 1;
|
||||
int buslogic_do_log = 0;
|
||||
|
||||
static void BuslogicStartMailbox(Buslogic_t *Buslogic);
|
||||
|
||||
|
||||
87
src/cdrom.c
87
src/cdrom.c
@@ -1,8 +1,10 @@
|
||||
/* CD-ROM emulation, used by both ATAPI and SCSI */
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "86box.h"
|
||||
#include "cdrom.h"
|
||||
@@ -188,7 +190,7 @@ uint8_t cdrom_mode_sense_pages_saved[CDROM_NUM][0x40][0x40] =
|
||||
[GPMODE_CAPABILITIES_PAGE] = { GPMODE_CAPABILITIES_PAGE, 0x12, 0, 0, 1, 0, 0, 0, 0x02, 0xC2, 0, 2, 0, 0, 0x02, 0xC2, 0, 0, 0, 0 } }
|
||||
};
|
||||
|
||||
int cdrom_do_log = 1;
|
||||
int cdrom_do_log = 0;
|
||||
|
||||
void cdrom_log(const char *format, ...)
|
||||
{
|
||||
@@ -732,11 +734,6 @@ void cdrom_update_request_length(uint8_t id, int len, int block_len)
|
||||
{
|
||||
len = cdrom[id].block_total;
|
||||
}
|
||||
if (cdrom[id].packet_len == 0)
|
||||
{
|
||||
cdrom[id].packet_len = cdrom[id].sector_len * block_len;
|
||||
}
|
||||
cdrom_log("Packet length now: %i (%i * %i)\n", cdrom[id].packet_len, cdrom[id].sector_len, block_len);
|
||||
break;
|
||||
default:
|
||||
cdrom[id].packet_len = len;
|
||||
@@ -1065,6 +1062,7 @@ int cdrom_read_data(uint8_t id, int msf, int type, int flags, int *len)
|
||||
int cdsize = 0;
|
||||
|
||||
int i = 0;
|
||||
int temp_len = 0;
|
||||
|
||||
if (cdrom_drives[id].handler->pass_through)
|
||||
{
|
||||
@@ -1097,13 +1095,16 @@ int cdrom_read_data(uint8_t id, int msf, int type, int flags, int *len)
|
||||
}
|
||||
|
||||
cdrom[id].old_len = 0;
|
||||
*len = 0;
|
||||
|
||||
for (i = 0; i < cdrom[id].requested_blocks; i++)
|
||||
{
|
||||
ret = cdrom_drives[id].handler->readsector_raw(id, cdbufferb + cdrom[id].data_pos, cdrom[id].sector_pos, msf, type, flags, len);
|
||||
ret = cdrom_drives[id].handler->readsector_raw(id, cdbufferb + cdrom[id].data_pos, cdrom[id].sector_pos, msf, type, flags, &temp_len);
|
||||
|
||||
cdrom[id].data_pos += *len;
|
||||
cdrom[id].old_len += *len;
|
||||
cdrom[id].data_pos += temp_len;
|
||||
cdrom[id].old_len += temp_len;
|
||||
|
||||
*len += temp_len;
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
@@ -1514,6 +1515,10 @@ void cdrom_command(uint8_t id, uint8_t *cdb)
|
||||
{
|
||||
cdrom[id].status &= ~ERR_STAT;
|
||||
}
|
||||
else
|
||||
{
|
||||
cdrom[id].error = 0;
|
||||
}
|
||||
|
||||
cdrom[id].packet_len = 0;
|
||||
cdrom[id].request_pos = 0;
|
||||
@@ -1755,7 +1760,14 @@ void cdrom_command(uint8_t id, uint8_t *cdb)
|
||||
}
|
||||
|
||||
cdrom[id].packet_len = max_len * alloc_length;
|
||||
cdrom_data_command_finish(id, alloc_length * cdrom[id].requested_blocks, alloc_length, alloc_length * cdrom[id].requested_blocks, 0);
|
||||
if (cdrom[id].requested_blocks > 1)
|
||||
{
|
||||
cdrom_data_command_finish(id, alloc_length, alloc_length / cdrom[id].requested_blocks, alloc_length, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
cdrom_data_command_finish(id, alloc_length, alloc_length, alloc_length, 0);
|
||||
}
|
||||
cdrom[id].all_blocks_total = cdrom[id].block_total;
|
||||
if (cdrom[id].packet_status != CDROM_PHASE_COMPLETE)
|
||||
{
|
||||
@@ -2650,13 +2662,13 @@ int cdrom_write_to_ide_dma(uint8_t channel)
|
||||
|
||||
uint8_t id = atapi_cdrom_drives[channel];
|
||||
|
||||
cdbufferb = (uint8_t *) cdrom[id].buffer;
|
||||
|
||||
if (id > CDROM_NUM)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
cdbufferb = (uint8_t *) cdrom[id].buffer;
|
||||
|
||||
if (ide_bus_master_read)
|
||||
{
|
||||
if (ide_bus_master_read(channel >> 1, cdbufferb, cdrom[id].request_length))
|
||||
@@ -2678,13 +2690,13 @@ int cdrom_write_to_scsi_dma(uint8_t scsi_id)
|
||||
|
||||
uint8_t id = scsi_cdrom_drives[scsi_id];
|
||||
|
||||
cdbufferb = (uint8_t *) cdrom[id].buffer;
|
||||
|
||||
if (id > CDROM_NUM)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
cdbufferb = (uint8_t *) cdrom[id].buffer;
|
||||
|
||||
cdrom_log("Writing to SCSI DMA: SCSI ID %02X, init length %i\n", scsi_id, SCSIDevices[scsi_id].InitLength);
|
||||
memcpy(SCSIDevices[scsi_id].CmdBuffer, cdbufferb, SCSIDevices[scsi_id].InitLength);
|
||||
cdrom_log("CD-ROM %i: Data from CD buffer: %02X %02X %02X %02X %02X %02X %02X %02X\n", id, cdbufferb[0], cdbufferb[1], cdbufferb[2], cdbufferb[3], cdbufferb[4], cdbufferb[5], cdbufferb[6], cdbufferb[7]);
|
||||
@@ -2767,11 +2779,15 @@ int cdrom_phase_callback(uint8_t id)
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t cdrom_read(uint8_t channel)
|
||||
/* Reimplement as 8-bit due to reimplementation of IDE data read and write. */
|
||||
uint8_t cdrom_read(uint8_t channel)
|
||||
{
|
||||
uint8_t *cdbufferb;
|
||||
|
||||
uint8_t id = atapi_cdrom_drives[channel];
|
||||
|
||||
uint16_t temp = 0;
|
||||
// uint16_t temp = 0;
|
||||
uint8_t temp = 0;
|
||||
int ret = 0;
|
||||
|
||||
if (id > CDROM_NUM)
|
||||
@@ -2779,14 +2795,16 @@ uint32_t cdrom_read(uint8_t channel)
|
||||
return 0;
|
||||
}
|
||||
|
||||
temp = cdrom[id].buffer[cdrom[id].pos >> 1];
|
||||
cdbufferb = (uint8_t *) cdrom[id].buffer;
|
||||
|
||||
cdrom[id].pos += 2;
|
||||
cdrom[id].request_pos += 2;
|
||||
temp = cdbufferb[cdrom[id].pos];
|
||||
|
||||
cdrom[id].pos++;
|
||||
cdrom[id].request_pos++;
|
||||
|
||||
if (cdrom[id].packet_status == CDROM_PHASE_DATA_IN)
|
||||
{
|
||||
cdrom[id].total_read += 2;
|
||||
cdrom[id].total_read++;
|
||||
ret = cdrom_block_check(id);
|
||||
/* If the block check has returned 0, this means all the requested blocks have been read, therefore the command has finished. */
|
||||
if (ret)
|
||||
@@ -2817,9 +2835,11 @@ uint32_t cdrom_read(uint8_t channel)
|
||||
}
|
||||
}
|
||||
|
||||
/* If the result is 1, issue an IRQ, otherwise not. */
|
||||
int cdrom_write(uint8_t channel, uint16_t val)
|
||||
/* Reimplement as 8-bit due to reimplementation of IDE data read and write. */
|
||||
void cdrom_write(uint8_t channel, uint8_t val)
|
||||
{
|
||||
uint8_t *cdbufferb;
|
||||
|
||||
uint8_t id = atapi_cdrom_drives[channel];
|
||||
|
||||
int ret = 0;
|
||||
@@ -2829,27 +2849,16 @@ int cdrom_write(uint8_t channel, uint16_t val)
|
||||
return 0;
|
||||
}
|
||||
|
||||
cdrom[id].buffer[cdrom[id].pos >> 1] = val;
|
||||
cdrom[id].pos += 2;
|
||||
cdbufferb = (uint8_t *) cdrom[id].buffer;
|
||||
|
||||
cdbufferb[cdrom[id].pos] = val;
|
||||
cdrom[id].pos++;
|
||||
|
||||
if (cdrom[id].packet_status == CDROM_PHASE_DATA_OUT)
|
||||
{
|
||||
ret = cdrom_mode_select_write(id, val & 0xff);
|
||||
if (ret == 1)
|
||||
{
|
||||
ret = 2;
|
||||
}
|
||||
ret = cdrom_mode_select_write(id, val);
|
||||
cdrom_mode_select_return(id, ret);
|
||||
/* Make sure to not do another write, if it has terminated. */
|
||||
if (ret != -6)
|
||||
{
|
||||
cdrom_mode_select_write(id, val >> 8);
|
||||
if (cdrom_mode_select_return(id, ret) == 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
else if (cdrom[id].packet_status == CDROM_PHASE_IDLE)
|
||||
{
|
||||
|
||||
@@ -189,8 +189,8 @@ int cdrom_CDROM_PHASE_to_scsi(uint8_t id);
|
||||
int cdrom_atapi_phase_to_scsi(uint8_t id);
|
||||
void cdrom_command(uint8_t id, uint8_t *cdb);
|
||||
int cdrom_phase_callback(uint8_t id);
|
||||
uint32_t cdrom_read(uint8_t channel);
|
||||
int cdrom_write(uint8_t channel, uint16_t val);
|
||||
uint8_t cdrom_read(uint8_t channel);
|
||||
int cdrom_write(uint8_t channel, uint8_t val);
|
||||
int cdrom_lba_to_msf_accurate(int lba);
|
||||
void cdrom_reset(uint8_t id);
|
||||
void cdrom_set_signature(int id);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -203,7 +204,7 @@ static struct __attribute__((packed))
|
||||
uint32_t dma_over;
|
||||
} d86f[FDD_NUM];
|
||||
|
||||
int d86f_do_log = 1;
|
||||
int d86f_do_log = 0;
|
||||
|
||||
void d86f_log(const char *format, ...)
|
||||
{
|
||||
|
||||
@@ -116,7 +116,7 @@ int discrate[4];
|
||||
|
||||
int discint;
|
||||
|
||||
int fdc_do_log = 1;
|
||||
int fdc_do_log = 0;
|
||||
|
||||
void fdc_log(const char *format, ...)
|
||||
{
|
||||
|
||||
@@ -596,3 +596,12 @@ int mem_a20_state;
|
||||
void fatal(const char *format, ...);
|
||||
|
||||
extern int scsi_model, scsi_base, scsi_irq, scsi_dma;
|
||||
|
||||
#ifdef ENABLE_LOG_TOGGLES
|
||||
extern int buslogic_do_log;
|
||||
extern int cdrom_do_log;
|
||||
extern int d86f_do_log;
|
||||
extern int fdc_do_log;
|
||||
extern int ide_do_log;
|
||||
extern int ne2000_do_log;
|
||||
#endif
|
||||
|
||||
169
src/ide.c
169
src/ide.c
@@ -6,8 +6,10 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
@@ -134,11 +136,11 @@ int idecallback[4] = {0, 0, 0, 0};
|
||||
|
||||
int cur_ide[4];
|
||||
|
||||
int ide_do_log = 1;
|
||||
int ide_do_log = 0;
|
||||
|
||||
void ide_log(const char *format, ...)
|
||||
{
|
||||
#ifdef ENABLE_CDROM_LOG
|
||||
#ifdef ENABLE_IDE_LOG
|
||||
if (ide_do_log)
|
||||
{
|
||||
va_list ap;
|
||||
@@ -724,11 +726,13 @@ void resetide(void)
|
||||
|
||||
int idetimes = 0;
|
||||
|
||||
void writeidew(int ide_board, uint16_t val)
|
||||
void ide_write_data(int ide_board, uint8_t val)
|
||||
{
|
||||
int ret = 0;
|
||||
IDE *ide = &ide_drives[cur_ide[ide_board]];
|
||||
|
||||
uint8_t *idebufferb = (uint8_t *) ide->buffer;
|
||||
|
||||
#if 0
|
||||
if (ide_drive_is_cdrom(ide))
|
||||
{
|
||||
@@ -737,8 +741,8 @@ void writeidew(int ide_board, uint16_t val)
|
||||
#endif
|
||||
|
||||
// ide_log("Write IDEw %04X\n",val);
|
||||
ide->buffer[ide->pos >> 1] = val;
|
||||
ide->pos += 2;
|
||||
idebufferb[ide->pos] = val;
|
||||
ide->pos++;
|
||||
|
||||
if (ide->command == WIN_PACKETCMD)
|
||||
{
|
||||
@@ -778,6 +782,13 @@ void writeidew(int ide_board, uint16_t val)
|
||||
}
|
||||
}
|
||||
|
||||
void writeidew(int ide_board, uint16_t val)
|
||||
{
|
||||
// ide_log("WriteIDEw %04X\n", val);
|
||||
ide_write_data(ide_board, val);
|
||||
ide_write_data(ide_board, val >> 8);
|
||||
}
|
||||
|
||||
void writeidel(int ide_board, uint32_t val)
|
||||
{
|
||||
// ide_log("WriteIDEl %08X\n", val);
|
||||
@@ -799,7 +810,7 @@ void writeide(int ide_board, uint16_t addr, uint8_t val)
|
||||
switch (addr)
|
||||
{
|
||||
case 0x1F0: /* Data */
|
||||
writeidew(ide_board, val | (val << 8));
|
||||
ide_write_data(ide_board, val);
|
||||
return;
|
||||
|
||||
/* Note to self: for ATAPI, bit 0 of this is DMA if set, PIO if clear. */
|
||||
@@ -954,11 +965,11 @@ void writeide(int ide_board, uint16_t addr, uint8_t val)
|
||||
case 0x1F7: /* Command register */
|
||||
if (ide->type == IDE_NONE)
|
||||
{
|
||||
if (val == WIN_SRST)
|
||||
{
|
||||
callbackide(ide_board);
|
||||
}
|
||||
ide->error=1;
|
||||
if (ide_drive_is_cdrom(ide))
|
||||
{
|
||||
cdrom[atapi_cdrom_drives[ide->channel]].error = 1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
#if 0
|
||||
@@ -972,6 +983,10 @@ void writeide(int ide_board, uint16_t addr, uint8_t val)
|
||||
|
||||
// ide_log("New IDE command - %02X %i %i\n",ide->command,cur_ide[ide_board],ide_board);
|
||||
ide->error=0;
|
||||
if (ide_drive_is_cdrom(ide))
|
||||
{
|
||||
cdrom[atapi_cdrom_drives[ide->channel]].error = 0;
|
||||
}
|
||||
switch (val)
|
||||
{
|
||||
case WIN_SRST: /* ATAPI Device Reset */
|
||||
@@ -1241,6 +1256,66 @@ ide_bad_command:
|
||||
// fatal("Bad IDE write %04X %02X\n", addr, val);
|
||||
}
|
||||
|
||||
uint8_t ide_read_data(int ide_board)
|
||||
{
|
||||
IDE *ide = &ide_drives[cur_ide[ide_board]];
|
||||
uint8_t temp;
|
||||
|
||||
uint8_t *idebufferb = (uint8_t *) ide->buffer;
|
||||
|
||||
temp = idebufferb[ide->pos];
|
||||
|
||||
ide->pos++;
|
||||
|
||||
if (ide->command == WIN_PACKETCMD)
|
||||
{
|
||||
if (!ide_drive_is_cdrom(ide))
|
||||
{
|
||||
ide_log("Drive not CD-ROM (position: %i)\n", ide->pos);
|
||||
return 0;
|
||||
}
|
||||
temp = cdrom_read(cur_ide[ide_board]);
|
||||
if (cdrom[atapi_cdrom_drives[cur_ide[ide_board]]].callback)
|
||||
{
|
||||
idecallback[ide_board] = cdrom[atapi_cdrom_drives[cur_ide[ide_board]]].callback;
|
||||
}
|
||||
}
|
||||
if (ide->pos>=512 && ide->command != WIN_PACKETCMD)
|
||||
{
|
||||
ide->pos=0;
|
||||
ide->atastat = READY_STAT | DSC_STAT;
|
||||
if (ide_drive_is_cdrom(ide))
|
||||
{
|
||||
// cdrom[atapi_cdrom_drives[cur_ide[ide_board]]].pos = 0;
|
||||
cdrom[atapi_cdrom_drives[cur_ide[ide_board]]].status = READY_STAT | DSC_STAT;
|
||||
cdrom[atapi_cdrom_drives[cur_ide[ide_board]]].packet_status = CDROM_PHASE_IDLE;
|
||||
}
|
||||
ide->packetstatus = ATAPI_STATUS_IDLE;
|
||||
if (ide->command == WIN_READ || ide->command == WIN_READ_NORETRY || ide->command == WIN_READ_MULTIPLE)
|
||||
{
|
||||
ide->secount = (ide->secount - 1) & 0xff;
|
||||
if (ide->secount)
|
||||
{
|
||||
ide_next_sector(ide);
|
||||
ide->atastat = BUSY_STAT;
|
||||
timer_process();
|
||||
if (ide->command == WIN_READ_MULTIPLE)
|
||||
{
|
||||
callbackide(ide_board);
|
||||
}
|
||||
else
|
||||
{
|
||||
idecallback[ide_board]=6*IDE_TIME;
|
||||
}
|
||||
timer_update_outstanding();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ide_log("Read IDEw %04X\n",temp);
|
||||
return temp;
|
||||
}
|
||||
|
||||
uint8_t readide(int ide_board, uint16_t addr)
|
||||
{
|
||||
IDE *ide = &ide_drives[cur_ide[ide_board]];
|
||||
@@ -1252,21 +1327,23 @@ uint8_t readide(int ide_board, uint16_t addr)
|
||||
addr|=0x90;
|
||||
addr&=0xFFF7;
|
||||
|
||||
if (ide->type == IDE_NONE && (addr == 0x1f0 || addr == 0x1f7))
|
||||
if (ide->type == IDE_NONE && (addr == 0x1f0 || addr == 0x1f7 || addr == 0x3f6))
|
||||
{
|
||||
if (addr == 0x1f7)
|
||||
if ((addr == 0x1f7) || (addr == 0x3f6))
|
||||
{
|
||||
/* This is apparently required for an empty ID channel. */
|
||||
return 0x20;
|
||||
ide_log("Reading port %04X on empty IDE channel, returning 0x20...\n", addr);
|
||||
// return 0x20;
|
||||
return DSC_STAT;
|
||||
}
|
||||
ide_log("Reading port %04X on empty IDE channel, returning zero...\n", addr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (addr)
|
||||
{
|
||||
case 0x1F0: /* Data */
|
||||
tempw = readidew(ide_board);
|
||||
temp = tempw & 0xff;
|
||||
return ide_read_data(ide_board);
|
||||
break;
|
||||
|
||||
/* For ATAPI: Bits 7-4 = sense key, bit 3 = MCR (media change requested),
|
||||
@@ -1427,60 +1504,12 @@ int all_blocks_total = 0;
|
||||
|
||||
uint16_t readidew(int ide_board)
|
||||
{
|
||||
IDE *ide = &ide_drives[cur_ide[ide_board]];
|
||||
uint16_t temp;
|
||||
|
||||
temp = ide->buffer[ide->pos >> 1];
|
||||
|
||||
ide->pos += 2;
|
||||
|
||||
if (ide->command == WIN_PACKETCMD)
|
||||
{
|
||||
if (!ide_drive_is_cdrom(ide))
|
||||
{
|
||||
ide_log("Drive not CD-ROM (position: %i)\n", ide->pos);
|
||||
return 0;
|
||||
}
|
||||
temp = cdrom_read(cur_ide[ide_board]);
|
||||
if (cdrom[atapi_cdrom_drives[cur_ide[ide_board]]].callback)
|
||||
{
|
||||
idecallback[ide_board] = cdrom[atapi_cdrom_drives[cur_ide[ide_board]]].callback;
|
||||
}
|
||||
}
|
||||
if (ide->pos>=512 && ide->command != WIN_PACKETCMD)
|
||||
{
|
||||
ide->pos=0;
|
||||
ide->atastat = READY_STAT | DSC_STAT;
|
||||
if (ide_drive_is_cdrom(ide))
|
||||
{
|
||||
// cdrom[atapi_cdrom_drives[cur_ide[ide_board]]].pos = 0;
|
||||
cdrom[atapi_cdrom_drives[cur_ide[ide_board]]].status = READY_STAT | DSC_STAT;
|
||||
cdrom[atapi_cdrom_drives[cur_ide[ide_board]]].packet_status = CDROM_PHASE_IDLE;
|
||||
}
|
||||
ide->packetstatus = ATAPI_STATUS_IDLE;
|
||||
if (ide->command == WIN_READ || ide->command == WIN_READ_NORETRY || ide->command == WIN_READ_MULTIPLE)
|
||||
{
|
||||
ide->secount = (ide->secount - 1) & 0xff;
|
||||
if (ide->secount)
|
||||
{
|
||||
ide_next_sector(ide);
|
||||
ide->atastat = BUSY_STAT;
|
||||
timer_process();
|
||||
if (ide->command == WIN_READ_MULTIPLE)
|
||||
{
|
||||
callbackide(ide_board);
|
||||
}
|
||||
else
|
||||
{
|
||||
idecallback[ide_board]=6*IDE_TIME;
|
||||
}
|
||||
timer_update_outstanding();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ide_log("Read IDEw %04X\n",temp);
|
||||
return temp;
|
||||
uint16_t temp = 0;
|
||||
uint16_t temp2 = 0;
|
||||
temp = ide_read_data(ide_board);
|
||||
temp2 = ide_read_data(ide_board);
|
||||
temp2 <<= 8;
|
||||
return (temp | temp2);
|
||||
}
|
||||
|
||||
uint32_t readidel(int ide_board)
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
// Peter Grehan (grehan@iprg.nokia.com) coded all of this
|
||||
// NE2000/ether stuff.
|
||||
//#include "vl.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
24
src/pc.rc
24
src/pc.rc
@@ -292,11 +292,35 @@ BEGIN
|
||||
MENUITEM "Take s&creenshot\tCtrl+F11", IDM_VID_SCREENSHOT
|
||||
END
|
||||
MENUITEM "&Status", IDM_STATUS
|
||||
#ifdef ENABLE_LOG_TOGGLES
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Enable BusLogic logs\tCtrl+F4", IDM_LOG_BUSLOGIC
|
||||
MENUITEM "Enable CD-ROM logs\tCtrl+F5", IDM_LOG_CDROM
|
||||
MENUITEM "Enable floppy (86F) logs\tCtrl+F6", IDM_LOG_D86F
|
||||
MENUITEM "Enable floppy controller logs\tCtrl+F7", IDM_LOG_FDC
|
||||
MENUITEM "Enable IDE logs\tCtrl+F8", IDM_LOG_IDE
|
||||
MENUITEM "Enable NE2000 logs\tCtrl+F9", IDM_LOG_NE2000
|
||||
#endif
|
||||
#ifdef ENABLE_LOG_BREAKPOINT
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&Log breakpoint\tCtrl+F10", IDM_LOG_BREAKPOINT
|
||||
#endif
|
||||
END
|
||||
END
|
||||
|
||||
MainAccel ACCELERATORS
|
||||
BEGIN
|
||||
#ifdef ENABLE_LOG_TOGGLES
|
||||
VK_F4, IDM_LOG_BUSLOGIC, CONTROL, VIRTKEY
|
||||
VK_F5, IDM_LOG_CDROM, CONTROL, VIRTKEY
|
||||
VK_F6, IDM_LOG_D86F, CONTROL, VIRTKEY
|
||||
VK_F7, IDM_LOG_FDC, CONTROL, VIRTKEY
|
||||
VK_F8, IDM_LOG_IDE, CONTROL, VIRTKEY
|
||||
VK_F9, IDM_LOG_NE2000, CONTROL, VIRTKEY
|
||||
#endif
|
||||
#ifdef ENABLE_LOG_BREAKPOINT
|
||||
VK_F10, IDM_LOG_BREAKPOINT, CONTROL, VIRTKEY
|
||||
#endif
|
||||
VK_F11, IDM_VID_SCREENSHOT, CONTROL, VIRTKEY
|
||||
VK_F12, IDM_FILE_RESET_CAD, CONTROL, VIRTKEY
|
||||
END
|
||||
|
||||
@@ -187,6 +187,17 @@
|
||||
#define IDM_SCSI_DMA5 45405
|
||||
#define IDM_SCSI_DMA6 45406
|
||||
#define IDM_SCSI_DMA7 45407
|
||||
#ifdef ENABLE_LOG_TOGGLES
|
||||
#define IDM_LOG_BUSLOGIC 51200
|
||||
#define IDM_LOG_CDROM 51201
|
||||
#define IDM_LOG_D86F 51202
|
||||
#define IDM_LOG_FDC 51203
|
||||
#define IDM_LOG_IDE 51204
|
||||
#define IDM_LOG_NE2000 51205
|
||||
#endif
|
||||
#ifdef ENABLE_LOG_BREAKPOINT
|
||||
#define IDM_LOG_BREAKPOINT 51206
|
||||
#endif
|
||||
|
||||
#define IDC_COMBO1 1000
|
||||
#define IDC_COMBOVID 1001
|
||||
|
||||
47
src/win.c
47
src/win.c
@@ -732,6 +732,15 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||
|
||||
CheckMenuItem(menu, IDM_SCSI_DMA5 - 5 + scsi_dma, MF_CHECKED);
|
||||
|
||||
#ifdef ENABLE_LOG_TOGGLES
|
||||
CheckMenuItem(menu, IDM_LOG_BUSLOGIC, buslogic_do_log ? MF_CHECKED : MF_UNCHECKED);
|
||||
CheckMenuItem(menu, IDM_LOG_CDROM, cdrom_do_log ? MF_CHECKED : MF_UNCHECKED);
|
||||
CheckMenuItem(menu, IDM_LOG_D86F, d86f_do_log ? MF_CHECKED : MF_UNCHECKED);
|
||||
CheckMenuItem(menu, IDM_LOG_FDC, fdc_do_log ? MF_CHECKED : MF_UNCHECKED);
|
||||
CheckMenuItem(menu, IDM_LOG_IDE, ide_do_log ? MF_CHECKED : MF_UNCHECKED);
|
||||
CheckMenuItem(menu, IDM_LOG_NE2000, ne2000_do_log ? MF_CHECKED : MF_UNCHECKED);
|
||||
#endif
|
||||
|
||||
CheckMenuItem(menu, IDM_VID_FORCE43, force_43 ? MF_CHECKED : MF_UNCHECKED);
|
||||
CheckMenuItem(menu, IDM_VID_OVERSCAN, enable_overscan ? MF_CHECKED : MF_UNCHECKED);
|
||||
CheckMenuItem(menu, IDM_VID_FLASH, enable_flash ? MF_CHECKED : MF_UNCHECKED);
|
||||
@@ -1500,6 +1509,44 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM
|
||||
take_screenshot();
|
||||
break;
|
||||
|
||||
#ifdef ENABLE_LOG_TOGGLES
|
||||
case IDM_LOG_BUSLOGIC:
|
||||
buslogic_do_log ^= 1;
|
||||
CheckMenuItem(hmenu, IDM_LOG_BUSLOGIC, buslogic_do_log ? MF_CHECKED : MF_UNCHECKED);
|
||||
break;
|
||||
|
||||
case IDM_LOG_CDROM:
|
||||
cdrom_do_log ^= 1;
|
||||
CheckMenuItem(hmenu, IDM_LOG_CDROM, cdrom_do_log ? MF_CHECKED : MF_UNCHECKED);
|
||||
break;
|
||||
|
||||
case IDM_LOG_D86F:
|
||||
d86f_do_log ^= 1;
|
||||
CheckMenuItem(hmenu, IDM_LOG_D86F, d86f_do_log ? MF_CHECKED : MF_UNCHECKED);
|
||||
break;
|
||||
|
||||
case IDM_LOG_FDC:
|
||||
fdc_do_log ^= 1;
|
||||
CheckMenuItem(hmenu, IDM_LOG_FDC, fdc_do_log ? MF_CHECKED : MF_UNCHECKED);
|
||||
break;
|
||||
|
||||
case IDM_LOG_IDE:
|
||||
ide_do_log ^= 1;
|
||||
CheckMenuItem(hmenu, IDM_LOG_IDE, ide_do_log ? MF_CHECKED : MF_UNCHECKED);
|
||||
break;
|
||||
|
||||
case IDM_LOG_NE2000:
|
||||
ne2000_do_log ^= 1;
|
||||
CheckMenuItem(hmenu, IDM_LOG_NE2000, ne2000_do_log ? MF_CHECKED : MF_UNCHECKED);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_LOG_BREAKPOINT
|
||||
case IDM_LOG_BREAKPOINT:
|
||||
pclog("---- LOG BREAKPOINT ----\n");
|
||||
break;
|
||||
#endif
|
||||
|
||||
case IDM_CONFIG_LOAD:
|
||||
pause = 1;
|
||||
if (!getfile(hwnd, "Configuration (*.CFG)\0*.CFG\0All files (*.*)\0*.*\0", ""))
|
||||
|
||||
Reference in New Issue
Block a user