From e6f5018d51d002f28625d8c5aaa768006f3ffa22 Mon Sep 17 00:00:00 2001 From: TC1995 Date: Tue, 1 Mar 2022 14:20:11 +0100 Subject: [PATCH] Added the Corel LS2000 53c400-based card. --- src/include/86box/scsi_ncr5380.h | 1 + src/scsi/scsi.c | 1 + src/scsi/scsi_ncr5380.c | 39 ++++++++++++++++++++++++++++---- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/include/86box/scsi_ncr5380.h b/src/include/86box/scsi_ncr5380.h index 380f379e6..6053e0275 100644 --- a/src/include/86box/scsi_ncr5380.h +++ b/src/include/86box/scsi_ncr5380.h @@ -28,6 +28,7 @@ extern const device_t scsi_lcs6821n_device; extern const device_t scsi_rt1000b_device; extern const device_t scsi_t128_device; extern const device_t scsi_t130b_device; +extern const device_t scsi_ls2000_device; #if defined(DEV_BRANCH) && defined(USE_SUMO) extern const device_t scsi_scsiat_device; #endif diff --git a/src/scsi/scsi.c b/src/scsi/scsi.c index 638c0bfaa..b898f9de8 100644 --- a/src/scsi/scsi.c +++ b/src/scsi/scsi.c @@ -77,6 +77,7 @@ static SCSI_CARD scsi_cards[] = { { &buslogic_542bh_device, }, { &buslogic_545s_device, }, { &buslogic_545c_device, }, + { &scsi_ls2000_device, }, { &scsi_lcs6821n_device, }, { &scsi_rt1000b_device, }, { &scsi_t128_device, }, diff --git a/src/scsi/scsi_ncr5380.c b/src/scsi/scsi_ncr5380.c index 60f4632e3..083efabe4 100644 --- a/src/scsi/scsi_ncr5380.c +++ b/src/scsi/scsi_ncr5380.c @@ -48,6 +48,7 @@ #define RT1000B_820R_ROM "roms/scsi/ncr5380/RTBIOS82.ROM" #define T130B_ROM "roms/scsi/ncr5380/trantor_t130b_bios_v2.14.bin" #define T128_ROM "roms/scsi/ncr5380/trantor_t128_bios_v1.12.bin" +#define COREL_LS2000_ROM "roms/scsi/ncr5380/Corel LS2000 - BIOS ROM - Ver 1.65.bin" #define NCR_CURDATA 0 /* current SCSI data (read only) */ @@ -712,7 +713,7 @@ ncr_write(uint16_t port, uint8_t val, void *priv) break; } - if (ncr->dma_mode == DMA_IDLE || ncr_dev->type == 0 || ncr_dev->type == 3) { + if (ncr->dma_mode == DMA_IDLE || ncr_dev->type == 0 || ncr_dev->type >= 3) { bus_host = get_bus_host(ncr); ncr_bus_update(priv, bus_host); } @@ -1079,9 +1080,9 @@ ncr_dma_send(ncr5380_t *ncr_dev, ncr_t *ncr, scsi_device_t *dev) } /* Data ready. */ - if (ncr_dev->type == 3) { + if (ncr_dev->type == 3) data = ncr_dev->t128.buffer[ncr_dev->t128.pos]; - } else + else data = ncr_dev->buffer[ncr_dev->buffer_pos]; bus = get_bus_host(ncr) & ~BUS_DATAMASK; bus |= BUS_SETDATA(data); @@ -1506,6 +1507,18 @@ ncr_init(const device_t *info) t128_write, NULL, NULL, ncr_dev->bios_rom.rom, MEM_MAPPING_EXTERNAL, ncr_dev); break; + + case 4: /* Corel LS2000 */ + ncr_dev->rom_addr = device_get_config_hex20("bios_addr"); + ncr_dev->irq = device_get_config_int("irq"); + rom_init(&ncr_dev->bios_rom, COREL_LS2000_ROM, + ncr_dev->rom_addr, 0x4000, 0x3fff, 0, MEM_MAPPING_EXTERNAL); + + mem_mapping_add(&ncr_dev->mapping, ncr_dev->rom_addr, 0x4000, + memio_read, NULL, NULL, + memio_write, NULL, NULL, + ncr_dev->bios_rom.rom, MEM_MAPPING_EXTERNAL, ncr_dev); + break; } sprintf(temp, "%s: BIOS=%05X", ncr_dev->name, ncr_dev->rom_addr); @@ -1516,7 +1529,7 @@ ncr_init(const device_t *info) ncr_log("%s\n", temp); ncr_reset(ncr_dev, &ncr_dev->ncr); - if (ncr_dev->type < 3) { + if (ncr_dev->type < 3 || ncr_dev->type == 4) { ncr_dev->status_ctrl = STATUS_BUFFER_NOT_READY; ncr_dev->buffer_host_pos = 128; } else { @@ -1572,6 +1585,12 @@ t128_available(void) return(rom_present(T128_ROM)); } +static int +corel_ls2000_available(void) +{ + return(rom_present(COREL_LS2000_ROM)); +} + // clang-format off static const device_config_t ncr5380_mmio_config[] = { { @@ -1735,3 +1754,15 @@ const device_t scsi_t128_device = NULL, NULL, t128_config }; + +const device_t scsi_ls2000_device = +{ + "Corel LS2000", + "ls2000", + DEVICE_ISA, + 4, + ncr_init, ncr_close, NULL, + { corel_ls2000_available }, + NULL, NULL, + ncr5380_mmio_config +};