]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
24/32-bit DMA option and clockport expander support.
authorToni Wilen <twilen@winuae.net>
Sat, 31 Oct 2020 10:57:47 +0000 (12:57 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 31 Oct 2020 10:57:47 +0000 (12:57 +0200)
15 files changed:
a2091.cpp
akiko.cpp
cdtv.cpp
cfgfile.cpp
expansion.cpp
include/a2091.h
include/autoconf.h
include/memory.h
include/options.h
memory.cpp
ncr9x_scsi.cpp
ncr_scsi.cpp
od-win32/win32gui.cpp
scsi.cpp
sndboard.cpp

index e19fb2ddc998db934276cdd999f882508b4e53c9..ce00be8121f60a54e060c8d9445f807f88fa317c 100644 (file)
--- a/a2091.cpp
+++ b/a2091.cpp
@@ -701,7 +701,7 @@ static bool do_dma_commodore_8727(struct wd_state *wd, struct scsi_data *scsi)
                        status = scsi_receive_data (scsi, &v1, true);
                        if (!status)
                                status = scsi_receive_data(scsi, &v2, true);
-                       put_word((wd->cdmac.dmac_acr << 1) & 0xffffff, (v1 << 8) | v2);
+                       dma_put_word((wd->cdmac.dmac_acr << 1) & wd->dma_mask, (v1 << 8) | v2);
                        if (wd->wc.wd_dataoffset < sizeof wd->wc.wd_data - 1) {
                                wd->wc.wd_data[wd->wc.wd_dataoffset++] = v1;
                                wd->wc.wd_data[wd->wc.wd_dataoffset++] = v2;
@@ -716,7 +716,7 @@ static bool do_dma_commodore_8727(struct wd_state *wd, struct scsi_data *scsi)
                                break;
                }
 #if WD33C93_DEBUG > 0
-               write_log (_T("%s Done DMA from WD, %d/%d %08X\n"), WD33C93, scsi->offset, scsi->data_len, (odmac_acr << 1) & 0xffffff);
+               write_log (_T("%s Done DMA from WD, %d/%d %08X\n"), WD33C93, scsi->offset, scsi->data_len, (odmac_acr << 1) & dma_mask);
 #endif
                wd->cdmac.c8727_pcsd |= 1 << 7;
                return true;
@@ -730,7 +730,7 @@ static bool do_dma_commodore_8727(struct wd_state *wd, struct scsi_data *scsi)
 #endif
                for (;;) {
                        int status;
-                       uae_u16 v = get_word((wd->cdmac.dmac_acr << 1) & 0xffffff);
+                       uae_u16 v = dma_get_word((wd->cdmac.dmac_acr << 1) & wd->dma_mask);
                        if (wd->wc.wd_dataoffset < sizeof wd->wc.wd_data - 1) {
                                wd->wc.wd_data[wd->wc.wd_dataoffset++] = v >> 8;
                                wd->wc.wd_data[wd->wc.wd_dataoffset++] = v;
@@ -748,7 +748,7 @@ static bool do_dma_commodore_8727(struct wd_state *wd, struct scsi_data *scsi)
                                break;
                }
 #if WD33C93_DEBUG > 0
-               write_log (_T("%s Done DMA to WD, %d/%d %08x\n"), WD33C93, scsi->offset, scsi->data_len, (odmac_acr << 1) & 0xffffff);
+               write_log (_T("%s Done DMA to WD, %d/%d %08x\n"), WD33C93, scsi->offset, scsi->data_len, (odmac_acr << 1) & (currprefs.cs_z2dma32bit ? 0xffffffff : 0xffffff));
 #endif
                wd->cdmac.c8727_pcsd |= 1 << 7;
                return true;
@@ -768,7 +768,7 @@ static bool do_dma_commodore(struct wd_state *wd, struct scsi_data *scsi)
                while (run) {
                        uae_u8 v;
                        int status = scsi_receive_data(scsi, &v, true);
-                       put_byte(wd->cdmac.dmac_acr, v);
+                       dma_put_byte(wd->cdmac.dmac_acr & wd->dma_mask, v);
                        if (wd->wc.wd_dataoffset < sizeof wd->wc.wd_data)
                                wd->wc.wd_data[wd->wc.wd_dataoffset++] = v;
                        if (decreasetc (&wd->wc))
@@ -789,7 +789,7 @@ static bool do_dma_commodore(struct wd_state *wd, struct scsi_data *scsi)
                bool run = true;
                while (run) {
                        int status;
-                       uae_u8 v = get_byte(wd->cdmac.dmac_acr);
+                       uae_u8 v = dma_get_byte(wd->cdmac.dmac_acr & wd->dma_mask);
                        if (wd->wc.wd_dataoffset < sizeof wd->wc.wd_data)
                                wd->wc.wd_data[wd->wc.wd_dataoffset++] = v;
                        status = scsi_send_data (scsi, v);
@@ -870,7 +870,7 @@ static bool do_dma_gvp_s2(struct wd_state *wd, struct scsi_data *scsi)
                for (;;) {
                        uae_u8 v;
                        int status = scsi_receive_data(scsi, &v, true);
-                       put_byte(get_gvp_s2_addr(&wd->gdmac), v);
+                       dma_put_byte(get_gvp_s2_addr(&wd->gdmac) & wd->dma_mask, v);
                        if (wd->wc.wd_dataoffset < sizeof wd->wc.wd_data)
                                wd->wc.wd_data[wd->wc.wd_dataoffset++] = v;
                        wd->gdmac.addr++;
@@ -891,7 +891,7 @@ static bool do_dma_gvp_s2(struct wd_state *wd, struct scsi_data *scsi)
                }
                for (;;) {
                        int status;
-                       uae_u8 v = get_byte(get_gvp_s2_addr(&wd->gdmac));
+                       uae_u8 v = dma_get_byte(get_gvp_s2_addr(&wd->gdmac) & wd->dma_mask);
                        if (wd->wc.wd_dataoffset < sizeof wd->wc.wd_data)
                                wd->wc.wd_data[wd->wc.wd_dataoffset++] = v;
                        status = scsi_send_data (scsi, v);
@@ -3885,13 +3885,14 @@ static void scsi_thread (void *wdv)
        wds->scsi_thread_running = -1;
 }
 
-void init_wd_scsi (struct wd_state *wd)
+void init_wd_scsi (struct wd_state *wd, bool dma24bit)
 {
        wd->configured = 0;
        wd->enabled = true;
        wd->wc.wd_used = 0;
        wd->wc.wd33c93_ver = 1;
        wd->baseaddress = 0;
+       wd->dma_mask = dma24bit ? 0x00ffffff : 0xffffffff;
        if (wd == wd_cdtv) {
                wd->cdtv = true;
        }
@@ -3924,7 +3925,7 @@ bool a3000scsi_init(struct autoconfig_info *aci)
        struct wd_state *wd = wd_a3000;
        if (!wd)
                return false;
-       init_wd_scsi (wd);
+       init_wd_scsi(wd, false);
        wd->enabled = true;
        wd->configured = -1;
        wd->baseaddress = 0xdd0000;
@@ -4075,7 +4076,7 @@ bool a2091_init (struct autoconfig_info *aci)
        if (!wd)
                return false;
 
-       init_wd_scsi(wd);
+       init_wd_scsi(wd, aci->rc->dma24bit);
 
        wd->cdmac.old_dmac = aci->rc->subtype == 0;
        wd->threaded = true;
@@ -4161,7 +4162,7 @@ static bool a2090x_init (struct autoconfig_info *aci, bool combitec)
        if (!wd)
                return false;
 
-       init_wd_scsi(wd);
+       init_wd_scsi(wd, aci->rc->dma24bit);
 
        if (aci->rc->device_settings & 1)
                ew(aci->autoconfig_raw, 0x30, 0x80); // SCSI only flag
@@ -4315,7 +4316,7 @@ static bool gvp_init(struct autoconfig_info *aci, bool series2, bool accel)
        if (!wd)
                return false;
 
-       init_wd_scsi(wd);
+       init_wd_scsi(wd, aci->rc->dma24bit);
        wd->configured = 0;
        wd->threaded = true;
        memcpy(&wd->bank, &gvp_bank, sizeof addrbank);
@@ -4489,7 +4490,7 @@ bool comspec_preinit (struct autoconfig_info *aci)
                return false;
 
        comspec_ac(aci);
-       init_wd_scsi(wd);
+       init_wd_scsi(wd, aci->rc->dma24bit);
        wd->configured = 0;
        wd->dmac_type = COMSPEC_CHIP;
        wd->autoconfig = true;
index 344cde9975ef9ab37f3676c7c1fb22c0ce226d7e..a146ccff66351b66d0feac469e1fc4b3c33dd7b7 100644 (file)
--- a/akiko.cpp
+++ b/akiko.cpp
@@ -1320,10 +1320,12 @@ static void cdrom_run_read (void)
                        buf[1] = 0;
                        buf[2] = 0;
                        buf[3] = cdrom_sector_counter & 31;
-                       for (int i = 0; i < 2352; i++)
-                               put_byte (cdrom_addressdata + seccnt * 4096 + i, buf[i]);
-                       for (int i = 0; i < 73 * 2; i++)
-                               put_byte (cdrom_addressdata + seccnt * 4096 + 0xc00 + i, 0);
+                       for (int i = 0; i < 2352; i++) {
+                               dma_put_byte(cdrom_addressdata + seccnt * 4096 + i, buf[i]);
+                       }
+                       for (int i = 0; i < 73 * 2; i++) {
+                               dma_put_byte(cdrom_addressdata + seccnt * 4096 + 0xc00 + i, 0);
+                       }
                        cdrom_pbx &= ~(1 << seccnt);
                        set_status (CDINTERRUPT_PBX);
 
@@ -1340,9 +1342,11 @@ static void cdrom_run_read (void)
                                else
                                        cdrom_subcodeoffset = 128;
                                // 96 byte subchannel data
-                               for (int i = 0; i < SUB_CHANNEL_SIZE; i++)
-                                       put_byte(subcode_address + cdrom_subcodeoffset + i, subbuf[i]);
-                               put_long(subcode_address + cdrom_subcodeoffset + SUB_CHANNEL_SIZE, 0xffff0000);
+                               for (int i = 0; i < SUB_CHANNEL_SIZE; i++) {
+                                       dma_put_byte(subcode_address + cdrom_subcodeoffset + i, subbuf[i]);
+                               }
+                               dma_put_word(subcode_address + cdrom_subcodeoffset + SUB_CHANNEL_SIZE + 0, 0xffff);
+                               dma_put_word(subcode_address + cdrom_subcodeoffset + SUB_CHANNEL_SIZE + 2, 0x0000);
                                cdrom_subcodeoffset += 100;
                                set_status(CDINTERRUPT_SUBCODE);
                        }
index 20ab05f2290247a38f28d76e5ed70df629ebd5ab..43541a359e295ab4ac3d7e9847e1076320fce4a8 100644 (file)
--- a/cdtv.cpp
+++ b/cdtv.cpp
@@ -77,6 +77,7 @@ static volatile uae_u16 dmac_dawr;
 static volatile uae_u32 dmac_acr;
 static volatile int dmac_wtc;
 static volatile int dmac_dma;
+static uae_u32 dma_mask;
 
 static volatile int activate_stch, cdrom_command_done;
 static volatile int cdrom_sector, cdrom_sectors, cdrom_length, cdrom_offset;
@@ -677,8 +678,8 @@ static void dma_do_thread (void)
                        }
 
                }
-               put_byte (dmac_acr, buffer[(cdrom_offset % cdtv_sectorsize) + 0]);
-               put_byte (dmac_acr + 1, buffer[(cdrom_offset % cdtv_sectorsize) + 1]);
+               dma_put_byte(dmac_acr & dma_mask, buffer[(cdrom_offset % cdtv_sectorsize) + 0]);
+               dma_put_byte((dmac_acr + 1) & dma_mask, buffer[(cdrom_offset % cdtv_sectorsize) + 1]);
                cnt--;
                dmac_acr += 2;
                cdrom_length -= 2;
@@ -1691,6 +1692,7 @@ bool cdtv_init(struct autoconfig_info *aci)
        ew(0x24, 0x00); /* ser.no. Byte 3 */
 
        if (aci) {
+               dma_mask = aci->rc->dma24bit ? 0x00ffffff : 0xffffffff;
                aci->label = dmac_bank.name;
                aci->hardwired = true;
                aci->addrbank = &dmac_bank;
@@ -1768,7 +1770,7 @@ bool cdtvscsi_init(struct autoconfig_info *aci)
        if (!aci->doinit)
                return true;
        cdtvscsi = true;
-       init_wd_scsi(wd_cdtv);
+       init_wd_scsi(wd_cdtv, aci->rc->dma24bit);
        wd_cdtv->dmac_type = COMMODORE_DMAC;
        if (configured > 0)
                map_banks_z2(&dmac_bank, configured, 0x10000 >> 16);
index 550c4629291bc56fd399b6623f781b2b78a7c1a4..6e31720f94f7518925e4bc3cd0e0e2f074fe142d 100644 (file)
@@ -1453,7 +1453,7 @@ static void cfgfile_write_board_rom(struct uae_prefs *prefs, struct zfile *f, st
                                _stprintf(buf, _T("%s%s_rom"), name, i ? _T("_ext") : _T(""));
                                cfgfile_dwrite_str (f, buf, rc->romident);
                        }
-                       if (rc->autoboot_disabled || rc->inserted || ert->subtypes || ert->settings || ert->id_jumper || br->device_order > 0 || is_custom_romboard(br)) {
+                       if (rc->autoboot_disabled || rc->dma24bit || rc->inserted || ert->subtypes || ert->settings || ert->id_jumper || br->device_order > 0 || is_custom_romboard(br)) {
                                TCHAR buf2[256], *p;
                                buf2[0] = 0;
                                p = buf2;
@@ -1478,6 +1478,11 @@ static void cfgfile_write_board_rom(struct uae_prefs *prefs, struct zfile *f, st
                                                _tcscat(buf2, _T(","));
                                        _tcscat(buf2, _T("autoboot_disabled=true"));
                                }
+                               if (rc->dma24bit) {
+                                       if (buf2[0])
+                                               _tcscat(buf2, _T(","));
+                                       _tcscat(buf2, _T("dma24bit=true"));
+                               }
                                if (rc->inserted) {
                                        if (buf2[0])
                                                _tcscat(buf2, _T(","));
@@ -1623,6 +1628,10 @@ static bool cfgfile_readramboard(const TCHAR *option, const TCHAR *value, const
                        if (s)
                                rb->no_reset_unmap = true;
                        xfree(s);
+                       s = cfgfile_option_get(value, _T("nodma"));
+                       if (s)
+                               rb->nodma = true;
+                       xfree(s);
                        s = cfgfile_option_get(value, _T("data"));
                        if (s && _tcslen(s) >= 3 * 16 - 1) {
                                rb->autoconfig_inuse = true;
@@ -1739,6 +1748,12 @@ static void cfgfile_writeramboard(struct uae_prefs *prefs, struct zfile *f, cons
                _tcscpy(p, _T("no_reset_unmap=true"));
                p += _tcslen(p);
        }
+       if (rb->nodma) {
+               if (tmp2[0])
+                       *p++ = ',';
+               _tcscpy(p, _T("nodma=true"));
+               p += _tcslen(p);
+       }
        if (rb->autoconfig_inuse) {
                uae_u8 *ac = rb->autoconfig;
                if (tmp2[0])
@@ -5225,6 +5240,9 @@ static bool cfgfile_read_board_rom(struct uae_prefs *p, const TCHAR *option, con
                                        if (cfgfile_option_bool(buf2, _T("autoboot_disabled")) == 1) {
                                                brc->roms[idx].autoboot_disabled = true;
                                        }
+                                       if (cfgfile_option_bool(buf2, _T("dma24bit")) == 1) {
+                                               brc->roms[idx].dma24bit = true;
+                                       }
                                        if (cfgfile_option_bool(buf2, _T("inserted")) == 1) {
                                                brc->roms[idx].inserted= true;
                                        }
index 91fd7a03b30f2a8b9d23714fa7ba2b5c25a2a949..8bfc3d780739b98382a268baefef50043db390e3 100644 (file)
@@ -1528,44 +1528,6 @@ static bool expamem_init_uaeboard(struct autoconfig_info *aci)
        return true;
 }
 
-static void loadboardfile(addrbank *ab, struct boardloadfile *lf)
-{
-       if (!ab->baseaddr)
-               return;
-       if (!lf->loadfile[0])
-               return;
-       struct zfile *zf = zfile_fopen(lf->loadfile, _T("rb"));
-       if (zf) {
-               int size = lf->filesize;
-               if (!size) {
-                       size = ab->allocated_size;
-               }
-               else if (lf->loadoffset + size > ab->allocated_size)
-                       size = ab->allocated_size - lf->loadoffset;
-               if (size > 0) {
-                       int total = zfile_fread(ab->baseaddr + lf->loadoffset, 1, size, zf);
-                       write_log(_T("Expansion file '%s': load %u bytes, offset %u, start addr %08x\n"),
-                               lf->loadfile, total, lf->loadoffset, ab->start + lf->loadoffset);
-               }
-               zfile_fclose(zf);
-       } else {
-               write_log(_T("Couldn't open expansion file '%s'\n"), lf->loadfile);
-       }
-}
-
-static void initramboard(addrbank *ab, struct ramboard *rb)
-{
-       if (!ab->baseaddr)
-               return;
-       loadboardfile(ab, &rb->lf);
-       if (rb->readonly) {
-               ab->lput = empty_put;
-               ab->wput = empty_put;
-               ab->bput = empty_put;
-               ab->jit_write_flag = 0;
-       }
-}
-
 /*
 *  Z3fastmem Memory
 */
@@ -4290,27 +4252,27 @@ static const struct expansionsubromtype accessx_sub[] = {
 static const struct expansionsubromtype supra_sub[] = {
        {
                _T("A500 ByteSync/XP"), _T("bytesync"), ROMTYPE_NONE | ROMTYPE_SUPRA,
-               1056, 9, 0, false,
+               1056, 9, 0, false, 0,
                { 0xd1, 13, 0x00, 0x00, 0x04, 0x20, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00 },
        },
        {
                _T("A2000 Word Sync"), _T("wordsync"), ROMTYPE_NONE | ROMTYPE_SUPRA,
-               1056, 9, 0, false,
+               1056, 9, 0, false, 0,
                { 0xd1, 12, 0x00, 0x00, 0x04, 0x20, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00 },
        },
        {
                _T("A500 Autoboot"), _T("500"), ROMTYPE_NONE | ROMTYPE_SUPRA,
-               1056, 5, 0, false,
+               1056, 5, 0, false, 0,
                { 0xd1, 8, 0x00, 0x00, 0x04, 0x20, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00 },
        },
        {
                _T("Non Autoboot (4x4)"), _T("4x4"), ROMTYPE_NOT | ROMTYPE_SUPRA,
-               1056, 2, 0, false,
+               1056, 2, 0, false, 0,
                { 0xc1, 1, 0x00, 0x00, 0x04, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
        },
        {
                _T("A2000 DMA"), _T("dma"), ROMTYPE_NONE | ROMTYPE_SUPRADMA,
-               1056, 2, 0, false,
+               1056, 2, 0, false, EXPANSIONTYPE_DMA24,
                { 0xd1, 3, 0x00, 0x00, 0x04, 0x20, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00 },
        },
        {
@@ -5125,7 +5087,7 @@ const struct expansionromtype expansionroms[] = {
                _T("cdtvdmac"), _T("CDTV DMAC"), _T("Commodore"),
                NULL, cdtv_init, NULL, NULL, ROMTYPE_CDTVDMAC | ROMTYPE_NOT, 0, 0, BOARD_AUTOCONFIG_Z2, true,
                NULL, 0,
-               false, EXPANSIONTYPE_INTERNAL
+               false, EXPANSIONTYPE_INTERNAL | EXPANSIONTYPE_DMA24
        },
        {
                _T("cdtvscsi"), _T("CDTV SCSI"), _T("Commodore"),
@@ -5145,7 +5107,7 @@ const struct expansionromtype expansionroms[] = {
                _T("cdtvcr"), _T("CDTV-CR"), _T("Commodore"),
                NULL, cdtvcr_init, NULL, NULL, ROMTYPE_CDTVCR | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_AFTER_Z2, true,
                NULL, 0,
-               false, EXPANSIONTYPE_INTERNAL
+               false, EXPANSIONTYPE_INTERNAL | EXPANSIONTYPE_DMA24
        },
        {
                _T("scsi_a3000"), _T("A3000 SCSI"), _T("Commodore"),
@@ -5306,7 +5268,7 @@ const struct expansionromtype expansionroms[] = {
                _T("a2090a"), _T("A2090a"), _T("Commodore"),
                NULL, a2090_init, NULL, a2090_add_scsi_unit, ROMTYPE_A2090 | ROMTYPE_NONE, 0, 0, BOARD_AUTOCONFIG_Z2, false,
                NULL, 0,
-               true, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_CUSTOM_SECONDARY,
+               true, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_CUSTOM_SECONDARY | EXPANSIONTYPE_DMA24,
                0, 0, 0, false, NULL,
                false, 0, a2090a_settings
        },
@@ -5314,7 +5276,7 @@ const struct expansionromtype expansionroms[] = {
                _T("a2090b"), _T("A2090 Combitec"), _T("Commodore"),
                a2090b_preinit, a2090b_init, NULL, a2090_add_scsi_unit, ROMTYPE_A2090B | ROMTYPE_NONE, 0, 0, BOARD_AUTOCONFIG_Z2, true,
                NULL, 0,
-               true, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_CUSTOM_SECONDARY,
+               true, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_CUSTOM_SECONDARY | EXPANSIONTYPE_DMA24,
                0, 0, 0, false, NULL,
                false, 0, a2090a_settings
        },
@@ -5322,7 +5284,7 @@ const struct expansionromtype expansionroms[] = {
                _T("a2091"), _T("A590/A2091"), _T("Commodore"),
                NULL, a2091_init, NULL, a2091_add_scsi_unit, ROMTYPE_A2091 | ROMTYPE_NONE, 0, 0, BOARD_AUTOCONFIG_Z2, false,
                a2091_sub, 1,
-               true, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_CUSTOM_SECONDARY,
+               true, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_CUSTOM_SECONDARY | EXPANSIONTYPE_DMA24,
                commodore, commodore_a2091, 0, true, NULL
        },
        {
@@ -5337,7 +5299,7 @@ const struct expansionromtype expansionroms[] = {
                _T("comspec"), _T("SA series"), _T("Comspec Communications"),
                comspec_preinit, comspec_init, NULL, comspec_add_scsi_unit, ROMTYPE_COMSPEC, 0, 0, BOARD_AUTOCONFIG_Z2, true,
                comspec_sub, 0,
-               true, EXPANSIONTYPE_SCSI,
+               true, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_DMA24,
                0, 0, 0, false, NULL,
                false, 0, comspec_settings
        },
@@ -5406,7 +5368,7 @@ const struct expansionromtype expansionroms[] = {
                _T("gvp"), _T("GVP Series II"), _T("Great Valley Products"),
                NULL, gvp_init_s2, NULL, gvp_s2_add_scsi_unit, ROMTYPE_GVPS2 | ROMTYPE_NONE, ROMTYPE_GVPS12, 0, BOARD_AUTOCONFIG_Z2, false,
                NULL, 0,
-               true, EXPANSIONTYPE_SCSI,
+               true, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_DMA24,
                2017, 10, 0
        },
        {
@@ -5445,7 +5407,7 @@ const struct expansionromtype expansionroms[] = {
                _T("trifecta"), _T("Trifecta"), _T("ICD"),
                NULL, trifecta_init, NULL, trifecta_add_idescsi_unit, ROMTYPE_TRIFECTA | ROMTYPE_NONE, 0, 0, BOARD_AUTOCONFIG_Z2, false,
                trifecta_sub, 0,
-               true, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_IDE,
+               true, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_IDE | EXPANSIONTYPE_DMA24,
                2071, 32, 0, false, NULL,
                true, 0, trifecta_settings,
                { 0xd1, 0x23, 0x40, 0x00, 0x08, 0x17, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00 }
@@ -5566,13 +5528,13 @@ const struct expansionromtype expansionroms[] = {
                _T("masoboshi"), _T("MasterCard"), _T("Masoboshi"),
                NULL, masoboshi_init, NULL, masoboshi_add_idescsi_unit, ROMTYPE_MASOBOSHI | ROMTYPE_NONE, 0, 0, BOARD_AUTOCONFIG_Z2, false,
                masoboshi_sub, 0,
-               true, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_IDE
+               true, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_IDE | EXPANSIONTYPE_DMA24
        },
        {
                _T("hardframe"), _T("HardFrame"), _T("Microbotics"),
                NULL, hardframe_init, NULL, hardframe_add_scsi_unit, ROMTYPE_HARDFRAME, 0, 0, BOARD_AUTOCONFIG_Z2, false,
                NULL, 0,
-               true, EXPANSIONTYPE_SCSI,
+               true, EXPANSIONTYPE_SCSI | EXPANSIONTYPE_DMA24,
                0, 0, 0, false, NULL,
                true
        },
@@ -5870,7 +5832,7 @@ const struct expansionromtype expansionroms[] = {
                _T("prelude1200"), _T("Prelude 1200"), _T("Albrecht Computer Technik"),
                NULL, prelude1200_init, NULL, NULL, ROMTYPE_PRELUDE1200 | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true,
                NULL, 0,
-               false, EXPANSIONTYPE_SOUND,
+               false, EXPANSIONTYPE_SOUND | EXPANSIONTYPE_CLOCKPORT,
                0, 0, 0, false, NULL,
                false, 0, toccata_soundcard_settings
        },
index 272c4e1fb49bad7bca0830ebbe8feb20790784dc..91b08f15f718509c2c33099bf3c4fdfae5bef727 100644 (file)
@@ -119,10 +119,11 @@ struct wd_state {
        addrbank bank;
        addrbank bank2;
        void *userdata;
+       uae_u32 dma_mask;
 };
 extern wd_state *wd_cdtv;
 
-extern void init_wd_scsi (struct wd_state*);
+extern void init_wd_scsi (struct wd_state*, bool);
 extern void scsi_dmac_a2091_start_dma (struct wd_state*);
 extern void scsi_dmac_a2091_stop_dma (struct wd_state*);
 
index bbba85df3aff35d167a1b0660a9c050c0728e4f4..f8059a6423f95d3a9137c2db5aa03367586fc7c0 100644 (file)
@@ -191,6 +191,8 @@ typedef void(*DEVICE_MEMORY_CALLBACK)(struct romconfig*, uae_u8*, int);
 #define EXPANSIONTYPE_X86_EXPANSION 0x20000
 #define EXPANSIONTYPE_PCMCIA 0x40000
 #define EXPANSIONTYPE_CUSTOMDISK 0x80000
+#define EXPANSIONTYPE_CLOCKPORT 0x100000
+#define EXPANSIONTYPE_DMA24 0x200000
 
 #define EXPANSIONBOARD_CHECKBOX 0
 #define EXPANSIONBOARD_MULTI 1
@@ -212,6 +214,7 @@ struct expansionsubromtype
        int memory_mid, memory_pid;
        uae_u32 memory_serial;
        bool memory_after;
+       int deviceflags;
        uae_u8 autoconfig[16];
 };
 struct expansionromtype
index b27b7d5e243b4c5b6c32282f555fd8a67acc1734..0c957662bf7585c65481ce738acadf300d91db1f 100644 (file)
@@ -95,6 +95,7 @@ enum
        ABFLAG_CHIPRAM = 4096, ABFLAG_CIA = 8192, ABFLAG_PPCIOSPACE = 16384,
        ABFLAG_MAPPED = 32768,
        ABFLAG_DIRECTACCESS = 65536,
+       ABFLAG_NODMA = 131072,
        ABFLAG_CACHE_ENABLE_DATA = CACHE_ENABLE_DATA << ABFLAG_CACHE_SHIFT,
        ABFLAG_CACHE_ENABLE_DATA_BURST = CACHE_ENABLE_DATA_BURST << ABFLAG_CACHE_SHIFT,
        ABFLAG_CACHE_ENABLE_INS = CACHE_ENABLE_INS << ABFLAG_CACHE_SHIFT,
@@ -524,6 +525,8 @@ extern void set_roms_modified (void);
 extern void reload_roms(void);
 extern bool read_kickstart_version(struct uae_prefs *p);
 extern void chipmem_setindirect(void);
+extern void initramboard(addrbank * ab, struct ramboard* rb);
+extern void loadboardfile(addrbank * ab, struct boardloadfile* lf);
 
 uae_u32 memory_get_long(uaecptr);
 uae_u32 memory_get_word(uaecptr);
@@ -669,6 +672,11 @@ STATIC_INLINE void *get_pointer (uaecptr addr)
 # endif
 #endif
 
+void dma_put_word(uaecptr addr, uae_u16 v);
+uae_u16 dma_get_word(uaecptr addr);
+void dma_put_byte(uaecptr addr, uae_u8 v);
+uae_u8 dma_get_byte(uaecptr addr);
+
 void memory_put_long(uaecptr, uae_u32);
 void memory_put_word(uaecptr, uae_u32);
 void memory_put_byte(uaecptr, uae_u32);
index 73afb12ac2292340082f609e4833e44fa3441d50..dbf13baee6daad983a3af2e83d6493caadd77ade 100644 (file)
@@ -382,6 +382,7 @@ struct romconfig
        uae_u32 board_ram_size;
        bool autoboot_disabled;
        bool inserted;
+       bool dma24bit;
        int device_id;
        int device_settings;
        int subtype;
@@ -438,6 +439,7 @@ struct ramboard
        uae_u32 end_address;
        uae_u32 write_address;
        bool readonly;
+       bool nodma;
        struct boardloadfile lf;
 };
 struct expansion_params
index 5c710be135ed0789e3a2c92d7643d91d7f4dbcb1..c244e32b3614d7a5d451e8fa80e539bd08f90548 100644 (file)
@@ -3528,6 +3528,53 @@ uae_u8 *save_rom (int first, int *len, uae_u8 *dstptr)
 
 #endif /* SAVESTATE */
 
+static void REGPARAM2 empty_put(uaecptr addr, uae_u32 v)
+{
+}
+
+void loadboardfile(addrbank* ab, struct boardloadfile* lf)
+{
+       if (!ab->baseaddr)
+               return;
+       if (!lf->loadfile[0])
+               return;
+       struct zfile* zf = zfile_fopen(lf->loadfile, _T("rb"));
+       if (zf) {
+               int size = lf->filesize;
+               if (!size) {
+                       size = ab->allocated_size;
+               }
+               else if (lf->loadoffset + size > ab->allocated_size)
+                       size = ab->allocated_size - lf->loadoffset;
+               if (size > 0) {
+                       int total = zfile_fread(ab->baseaddr + lf->loadoffset, 1, size, zf);
+                       write_log(_T("Expansion file '%s': load %u bytes, offset %u, start addr %08x\n"),
+                               lf->loadfile, total, lf->loadoffset, ab->start + lf->loadoffset);
+               }
+               zfile_fclose(zf);
+       }
+       else {
+               write_log(_T("Couldn't open expansion file '%s'\n"), lf->loadfile);
+       }
+}
+
+void initramboard(addrbank* ab, struct ramboard* rb)
+{
+       ab->flags &= ~ABFLAG_NODMA;
+       if (rb->nodma)
+               ab->flags |= ABFLAG_NODMA;
+       if (!ab->baseaddr)
+               return;
+       loadboardfile(ab, &rb->lf);
+       if (rb->readonly) {
+               ab->lput = empty_put;
+               ab->wput = empty_put;
+               ab->bput = empty_put;
+               ab->jit_write_flag = 0;
+       }
+}
+
+
 /* memory helpers */
 
 void memcpyha_safe(uaecptr dst, const uae_u8 *src, int size)
@@ -3712,3 +3759,32 @@ int memory_valid_address(uaecptr addr, uae_u32 size)
        addr &= ab->mask;
        return addr + size <= ab->allocated_size;
 }
+
+void dma_put_word(uaecptr addr, uae_u16 v)
+{
+       addrbank* ab = &get_mem_bank(addr);
+       if (ab->flags & ABFLAG_NODMA)
+               return;
+       put_word(addr, v);
+}
+void dma_put_byte(uaecptr addr, uae_u8 v)
+{
+       addrbank* ab = &get_mem_bank(addr);
+       if (ab->flags & ABFLAG_NODMA)
+               return;
+       put_byte(addr, v);
+}
+uae_u16 dma_get_word(uaecptr addr)
+{
+       addrbank* ab = &get_mem_bank(addr);
+       if (ab->flags & ABFLAG_NODMA)
+               return 0xffff;
+       return get_word(addr);
+}
+uae_u8 dma_get_byte(uaecptr addr)
+{
+       addrbank* ab = &get_mem_bank(addr);
+       if (ab->flags & ABFLAG_NODMA)
+               return 0xff;
+       return get_byte(addr);
+}
index 85d13b67a11916b0d556dae432d858ed988c91e9..305dc629b01108dfe56056ec1d225104bd2c4b3e 100644 (file)
@@ -106,6 +106,7 @@ struct ncr9x_state
        uaecptr dma_ptr;
        bool dma_on;
        int dma_cnt;
+       uae_u32 dma_mask;
        uae_u8 states[16];
        struct romconfig *rc;
        struct ncr9x_state **self_ptr;
@@ -477,7 +478,7 @@ static int masoboshi_dma_read(void *opaque, uint8_t *buf, int len)
        if (ncr->dma_on) {
                m68k_cancel_idle();
                while (len > 0) {
-                       uae_u16 v = get_word(ncr->dma_ptr & ~1);
+                       uae_u16 v = dma_get_word((ncr->dma_ptr & ~1) & ncr->dma_mask);
                        *buf++ = v >> 8;
                        len--;
                        if (len > 0) {
@@ -510,7 +511,7 @@ static int masoboshi_dma_write(void *opaque, uint8_t *buf, int len)
                                v |= *buf++;
                                len--;
                        }
-                       put_word(ncr->dma_ptr & ~1, v);
+                       dma_put_word((ncr->dma_ptr & ~1) & ncr->dma_mask, v);
                        ncr->dma_ptr += 2;
                }
                return -1;
@@ -532,7 +533,7 @@ static int trifecta_dma_read(void *opaque, uint8_t *buf, int len)
                //write_log(_T("Trifecta DMA from %08x, %d bytes\n"), ncr->dma_ptr, len);
                m68k_cancel_idle();
                while (len > 0) {
-                       uae_u16 v = get_word(ncr->dma_ptr & ~1);
+                       uae_u16 v = dma_get_word((ncr->dma_ptr & ~1) & ncr->dma_mask);
                        *buf++ = v >> 8;
                        len--;
                        if (len > 0) {
@@ -560,7 +561,7 @@ static int trifecta_dma_write(void *opaque, uint8_t *buf, int len)
                                v |= *buf++;
                                len--;
                        }
-                       put_word(ncr->dma_ptr & ~1, v);
+                       dma_put_word((ncr->dma_ptr & ~1) & ncr->dma_mask, v);
                        ncr->dma_ptr += 2;
                }
                return -1;
@@ -578,7 +579,7 @@ static int fastlane_dma_read(void *opaque, uint8_t *buf, int len)
        }
        m68k_cancel_idle();
        while (len > 0) {
-               uae_u16 v = get_word(ncr->dma_ptr & ~1);
+               uae_u16 v = dma_get_word(ncr->dma_ptr & ~1);
                *buf++ = v >> 8;
                len--;
                if (len > 0) {
@@ -606,7 +607,7 @@ static int fastlane_dma_write(void *opaque, uint8_t *buf, int len)
                        v |= *buf++;
                        len--;
                }
-               put_word(ncr->dma_ptr & ~1, v);
+               dma_put_word(ncr->dma_ptr & ~1, v);
                ncr->dma_ptr += 2;
        }
        return -1;
@@ -621,7 +622,7 @@ static int cyberstorm_mk1_mk2_dma_read(void *opaque, uint8_t *buf, int len)
        }
        m68k_cancel_idle();
        while (len > 0) {
-               uae_u16 v = get_word(ncr->dma_ptr & ~1);
+               uae_u16 v = dma_get_word(ncr->dma_ptr & ~1);
                *buf++ = v >> 8;
                len--;
                if (len > 0) {
@@ -649,7 +650,7 @@ static int cyberstorm_mk1_mk2_dma_write(void *opaque, uint8_t *buf, int len)
                        v |= *buf++;
                        len--;
                }
-               put_word(ncr->dma_ptr & ~1, v);
+               dma_put_word(ncr->dma_ptr & ~1, v);
                ncr->dma_ptr += 2;
        }
        return -1;
@@ -664,7 +665,7 @@ static int blizzard_dma_read(void *opaque, uint8_t *buf, int len)
        }
        m68k_cancel_idle();
        while (len > 0) {
-               uae_u16 v = get_word((ncr->dma_ptr & 0x7fffffff) * 2);
+               uae_u16 v = dma_get_word((ncr->dma_ptr & 0x7fffffff) * 2);
                *buf++ = v >> 8;
                len--;
                if (len > 0) {
@@ -692,7 +693,7 @@ static int blizzard_dma_write(void *opaque, uint8_t *buf, int len)
                        v |= *buf++;
                        len--;
                }
-               put_word((ncr->dma_ptr & 0x7fffffff) * 2, v);
+               dma_put_word((ncr->dma_ptr & 0x7fffffff) * 2, v);
                ncr->dma_ptr++;
        }
        return -1;
@@ -2507,6 +2508,7 @@ static void ncr9x_add_scsi_unit(struct ncr9x_state **ncrp, int ch, struct uaedev
 {
        struct ncr9x_state *ncr = allocscsi(ncrp, rc, ch);
        if (ch >= 0 && ncr) {
+               ncr->dma_mask = rc->dma24bit ? 0x00ffffff : 0xffffffff;
                if (ci->type == UAEDEV_CD)
                        add_ncr_scsi_cd (ncr, ch, ci->device_emu_unit, ci->uae_unitnum);
                else if (ci->type == UAEDEV_TAPE)
index ed8a738dc131caae3fc2e9e38a71998ff870920e..333a6fde7fac72d038a50a5549a85c1116c83707 100644 (file)
@@ -272,10 +272,10 @@ int pci_dma_rw(PCIDevice *dev, dma_addr_t addr, void *buf, dma_addr_t len, DMADi
        uae_u8 *p = (uae_u8*)buf;
        while (len > 0) {
                if (!dir) {
-                       *p = get_byte(addr);
+                       *p = dma_get_byte(addr);
                }
                else {
-                       put_byte(addr, *p);
+                       dma_put_byte(addr, *p);
                }
                p++;
                len--;
@@ -365,9 +365,9 @@ int pci710_dma_rw(PCIDevice *dev, dma_addr_t addr, void *buf, dma_addr_t len, DM
        uae_u8 *p = (uae_u8*)buf;
        while (len > 0) {
                if (!dir) {
-                       *p = get_byte (addr);
+                       *p = dma_get_byte(addr);
                } else {
-                       put_byte (addr, *p);
+                       dma_put_byte(addr, *p);
                }
                p++;
                len--;
index 21bf3b1445e154221bd7cf3dcd151cb245cad637..28ff798d3fac61ee422c701aa4a52dbdb5e7a8ce 100644 (file)
@@ -9364,6 +9364,7 @@ static void enable_for_memorydlg (HWND hDlg)
        ew(hDlg, IDC_AUTOCONFIG_DATA,  ac && size);
        ew(hDlg, IDC_FASTMEMAUTOCONFIGUSE, isfast);
        ew(hDlg, IDC_FASTMEMNOAUTOCONFIG, isfast);
+       ew(hDlg, IDC_FASTMEMDMA, isfast);
        ew(hDlg, IDC_MEMORYRAM, true);
        ew(hDlg, IDC_MEMORYMEM, true);
        ew(hDlg, IDC_RAM_ADDRESS, manual && size);
@@ -9477,6 +9478,7 @@ static void setfastram_selectmenu(HWND hDlg, int mode)
        struct ramboard *rb = fastram_select_ramboard;
        setchecked(hDlg, IDC_FASTMEMAUTOCONFIGUSE, rb && rb->autoconfig_inuse);
        setchecked(hDlg, IDC_FASTMEMNOAUTOCONFIG, rb && rb->manual_config);
+       setchecked(hDlg, IDC_FASTMEMDMA, rb && rb->nodma == 0);
        if (rb) {
                if (rb->manual_config) {
                        if (rb->end_address <= rb->start_address || rb->start_address + rb->size < rb->end_address)
@@ -10256,17 +10258,9 @@ static void init_expansion2(HWND hDlg, bool init)
                }
        }
 
-       SendDlgItemMessage(hDlg, IDC_SCSIROMSELECTNUM, CB_RESETCONTENT, 0, 0);
-       for (int i = 0; i < MAX_DUPLICATE_EXPANSION_BOARDS; i++) {
-               TCHAR tmp[10];
-               _stprintf(tmp, _T("%d"), i + 1);
-               SendDlgItemMessage(hDlg, IDC_SCSIROMSELECTNUM, CB_ADDSTRING, 0, (LPARAM)tmp);
-       }
-
        if (scsiromselected > 0)
                gui_set_string_cursor(scsiromselect_table, hDlg, IDC_SCSIROMSELECT, scsiromselected);
        SendDlgItemMessage(hDlg, IDC_SCSIROMSELECTCAT, CB_SETCURSEL, scsiromselectedcatnum, 0);
-       SendDlgItemMessage(hDlg, IDC_SCSIROMSELECTNUM, CB_SETCURSEL, scsiromselectednum, 0);
 
        SendDlgItemMessage(hDlg, IDC_SCSIROMID, CB_RESETCONTENT, 0, 0);
        int index;
@@ -10294,6 +10288,7 @@ static void values_to_expansion2dlg_sub(HWND hDlg)
        SendDlgItemMessage(hDlg, IDC_SCSIROMSUBSELECT, CB_RESETCONTENT, 0, 0);
        const struct expansionromtype *er = &expansionroms[scsiromselected];
        const struct expansionsubromtype *srt = er->subtypes;
+       int deviceflags = er->deviceflags;
        ew(hDlg, IDC_SCSIROMSUBSELECT, srt != NULL);
        while (srt && srt->name) {
                SendDlgItemMessage(hDlg, IDC_SCSIROMSUBSELECT, CB_ADDSTRING, 0, (LPARAM) srt->name);
@@ -10301,18 +10296,31 @@ static void values_to_expansion2dlg_sub(HWND hDlg)
        }
        int index;
        struct boardromconfig *brc = get_device_rom(&workprefs, expansionroms[scsiromselected].romtype, scsiromselectednum, &index);
-       if (brc) {
+       if (brc && er->subtypes) {
                SendDlgItemMessage(hDlg, IDC_SCSIROMSUBSELECT, CB_SETCURSEL, brc->roms[index].subtype, 0);
                SendDlgItemMessage(hDlg, IDC_SCSIROMID, CB_SETCURSEL, brc->roms[index].device_id, 0);
+               deviceflags |= er->subtypes[brc->roms[index].subtype].deviceflags;
        } else if (srt) {
                SendDlgItemMessage(hDlg, IDC_SCSIROMSUBSELECT, CB_SETCURSEL, 0, 0);
                SendDlgItemMessage(hDlg, IDC_SCSIROMID, CB_SETCURSEL, 0, 0);
        }
-       if (er->zorro < 2 || er->singleonly) {
+       SendDlgItemMessage(hDlg, IDC_SCSIROMSELECTNUM, CB_RESETCONTENT, 0, 0);
+       if (deviceflags & EXPANSIONTYPE_CLOCKPORT) {
+               SendDlgItemMessage(hDlg, IDC_SCSIROMSELECTNUM, CB_ADDSTRING, 0, (LPARAM)_T("-"));
+       }
+       for (int i = 0; i < MAX_AVAILABLE_DUPLICATE_EXPANSION_BOARDS; i++) {
+               TCHAR tmp[10];
+               _stprintf(tmp, _T("%d"), i + 1);
+               SendDlgItemMessage(hDlg, IDC_SCSIROMSELECTNUM, CB_ADDSTRING, 0, (LPARAM)tmp);
+       }
+       SendDlgItemMessage(hDlg, IDC_SCSIROMSELECTNUM, CB_SETCURSEL, scsiromselectednum, 0);
+       if ((er->zorro < 2 || er->singleonly) && !(deviceflags & EXPANSIONTYPE_CLOCKPORT)) {
                scsiromselectednum = 0;
                SendDlgItemMessage(hDlg, IDC_SCSIROMSELECTNUM, CB_SETCURSEL, 0, 0);
        }
-       ew(hDlg, IDC_SCSIROMSELECTNUM, er->zorro >= 2 && !er->singleonly);
+       ew(hDlg, IDC_SCSIROMSELECTNUM, (er->zorro >= 2 && !er->singleonly) || (deviceflags & EXPANSIONTYPE_CLOCKPORT));
+       hide(hDlg, IDC_SCSIROM24BITDMA, (deviceflags & EXPANSIONTYPE_DMA24) == 0);
+       ew(hDlg, IDC_SCSIROM24BITDMA, (deviceflags & EXPANSIONTYPE_DMA24) != 0);
 }
 
 static void values_from_expansion2dlg(HWND hDlg)
@@ -10340,6 +10348,7 @@ static void values_from_expansion2dlg(HWND hDlg)
                }
                brc->roms[index].autoboot_disabled = ischecked(hDlg, IDC_SCSIROMFILEAUTOBOOT);
                brc->roms[index].inserted = ischecked(hDlg, IDC_SCSIROMFILEPCMCIA);
+               brc->roms[index].dma24bit = ischecked(hDlg, IDC_SCSIROM24BITDMA);
 
                int v = SendDlgItemMessage(hDlg, IDC_SCSIROMID, CB_GETCURSEL, 0, 0L);
                if (v != CB_ERR && !isnew)
@@ -10372,6 +10381,16 @@ static void values_from_expansion2dlg(HWND hDlg)
                clear_device_rom(&workprefs, expansionroms[scsiromselected].romtype, scsiromselectednum, true);
        }
        if (changed) {
+               // singleonly check and removal
+               if (expansionroms[scsiromselected].singleonly) {
+                       if (get_device_rom(&workprefs, expansionroms[scsiromselected].romtype, scsiromselectednum, &index)) {
+                               for (int i = 0; i < MAX_EXPANSION_BOARDS; i++) {
+                                       if (i != scsiromselectednum) {
+                                               clear_device_rom(&workprefs, expansionroms[scsiromselected].romtype, i, true);
+                                       }
+                               }
+                       }
+               }
                init_expansion2(hDlg, false);
                values_to_expansion2dlg_sub(hDlg);
        }
@@ -10400,6 +10419,7 @@ static void values_to_expansion2_expansion_roms(HWND hDlg, UAEREG *fkey)
                const struct expansionromtype *ert = &expansionroms[scsiromselected];
                int romtype = ert->romtype;
                int romtype_extra = ert->romtype_extra;
+               int deviceflags = ert->deviceflags;
 
                brc = get_device_rom(&workprefs, romtype, scsiromselectednum, &index);
                if (brc && ert->subtypes) {
@@ -10408,6 +10428,7 @@ static void values_to_expansion2_expansion_roms(HWND hDlg, UAEREG *fkey)
                                romtype = esrt->romtype;
                                romtype_extra = 0;
                        }
+                       deviceflags |= esrt->deviceflags;
                }
                ew(hDlg, IDC_SCSIROMFILE, true);
                ew(hDlg, IDC_SCSIROMCHOOSER, true);
@@ -10425,7 +10446,7 @@ static void values_to_expansion2_expansion_roms(HWND hDlg, UAEREG *fkey)
                        addromfiles(fkey, hDlg, IDC_SCSIROMFILE, brc ? brc->roms[index].romfile : NULL, romtype, romtype_extra);
                        setchecked(hDlg, IDC_SCSIROMFILEAUTOBOOT, brc && brc->roms[index].autoboot_disabled);
                }
-               if (ert->deviceflags & EXPANSIONTYPE_PCMCIA) {
+               if (deviceflags & EXPANSIONTYPE_PCMCIA) {
                        setchecked(hDlg, IDC_SCSIROMFILEPCMCIA, brc && brc->roms[index].inserted);
                        hide(hDlg, IDC_SCSIROMFILEPCMCIA, 0);
                } else {
@@ -10433,6 +10454,9 @@ static void values_to_expansion2_expansion_roms(HWND hDlg, UAEREG *fkey)
                        if (brc)
                                brc->roms[index].inserted = false;
                }
+               hide(hDlg, IDC_SCSIROM24BITDMA, (deviceflags & EXPANSIONTYPE_DMA24) == 0);
+               ew(hDlg, IDC_SCSIROM24BITDMA, (deviceflags & EXPANSIONTYPE_DMA24) != 0);
+               setchecked(hDlg, IDC_SCSIROM24BITDMA, brc && brc->roms[index].dma24bit);
        } else {
                hide(hDlg, IDC_SCSIROMCHOOSER, 0);
                hide(hDlg, IDC_SCSIROMFILE, 0);
@@ -10445,6 +10469,8 @@ static void values_to_expansion2_expansion_roms(HWND hDlg, UAEREG *fkey)
                SendDlgItemMessage(hDlg, IDC_SCSIROMFILE, CB_RESETCONTENT, 0, 0);
                ew(hDlg, IDC_SCSIROMFILE, false);
                ew(hDlg, IDC_SCSIROMCHOOSER, false);            
+               ew(hDlg, IDC_SCSIROM24BITDMA, 0);
+               hide(hDlg, IDC_SCSIROM24BITDMA, 1);
        }
        if (keyallocated)
                regclosetree(fkey);
@@ -10585,7 +10611,6 @@ static void values_to_expansion2dlg (HWND hDlg, int mode)
        load_keyring(&workprefs, NULL);
 
        values_to_expansion2_expansion_roms(hDlg, fkey);
-
        values_to_expansion2_expansion_settings(hDlg, mode);
 
        if (workprefs.cpuboard_type) {
@@ -10601,8 +10626,6 @@ static void values_to_expansion2dlg (HWND hDlg, int mode)
 
        gui_set_string_cursor(scsiromselect_table, hDlg, IDC_SCSIROMSELECT, scsiromselected);
        values_to_expansion2dlg_sub(hDlg);
-
-
 }
 
 static void updatecpuboardsubtypes(HWND hDlg)
@@ -10749,6 +10772,7 @@ static INT_PTR CALLBACK Expansion2DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LP
                                break;
                                case IDC_SCSIROMFILEAUTOBOOT:
                                case IDC_SCSIROMFILEPCMCIA:
+                               case IDC_SCSIROM24BITDMA:
                                values_from_expansion2dlg(hDlg);
                                break;
                                case IDC_SOCKETS:
@@ -11521,14 +11545,20 @@ static INT_PTR CALLBACK MemoryDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPARA
                        recursive++;
                        switch (LOWORD(wParam))
                        {
+                       case IDC_FASTMEMDMA:
+                               if (fastram_select_ramboard) {
+                                       struct ramboard* rb = fastram_select_ramboard;
+                                       rb->nodma = ischecked(hDlg, IDC_FASTMEMDMA) == 0;
+                                       setfastram_selectmenu(hDlg, 0);
+                               }
                        case IDC_FASTMEMAUTOCONFIGUSE:
-                       if (fastram_select_ramboard) {
-                               struct ramboard *rb = fastram_select_ramboard;
-                               rb->autoconfig_inuse = ischecked(hDlg, IDC_FASTMEMAUTOCONFIGUSE);
-                               rb->manual_config = false;
-                               setfastram_selectmenu(hDlg, 0);
-                       }
-                       break;
+                               if (fastram_select_ramboard) {
+                                       struct ramboard* rb = fastram_select_ramboard;
+                                       rb->autoconfig_inuse = ischecked(hDlg, IDC_FASTMEMAUTOCONFIGUSE);
+                                       rb->manual_config = false;
+                                       setfastram_selectmenu(hDlg, 0);
+                               }
+                               break;
                                case IDC_FASTMEMNOAUTOCONFIG:
                                if (fastram_select_ramboard) {
                                        struct ramboard *rb = fastram_select_ramboard;
index 0e4f93a95f8c51e3daa6eb275a683342a06bbaee..b52752f75c473cfd85242c0036677dddaea7f88f 100644 (file)
--- a/scsi.cpp
+++ b/scsi.cpp
@@ -842,6 +842,7 @@ struct soft_scsi
        bool dma_controller;
        bool dma_drq;
        bool dma_autodack;
+       uae_u32 dma_mask;
        struct romconfig *rc;
        struct soft_scsi **self_ptr;
 
@@ -981,6 +982,7 @@ static struct soft_scsi *generic_soft_scsi_add(int ch, struct uaedev_config_info
        ss->bank = &soft_bank_generic;
        ss->subtype = rc->subtype;
        ss->intena = false;
+       ss->dma_mask = 0xffffffff;
        if (boardsize > 0) {
                ss->board_size = boardsize;
                ss->board_mask = ss->board_size - 1;
@@ -1443,9 +1445,9 @@ static void supra_do_dma(struct soft_scsi *ncr)
        int len = ncr->dmac_length;
        for (int i = 0; i < len; i++) {
                if (ncr->dmac_direction < 0) {
-                       x_put_byte(ncr->dmac_address, ncr5380_bget(ncr, 0));
+                       dma_put_byte(ncr->dmac_address & ncr->dma_mask, ncr5380_bget(ncr, 0));
                } else if (ncr->dmac_direction > 0) {
-                       ncr5380_bput(ncr, 0, x_get_byte(ncr->dmac_address));
+                       ncr5380_bput(ncr, 0, dma_get_byte(ncr->dmac_address & ncr->dma_mask));
                }
                ncr->dmac_length--;
                ncr->dmac_address++;
@@ -1464,9 +1466,9 @@ static void hardframe_do_dma(struct soft_scsi *ncr)
                        uae_u8 v = aic_bget_dma(ncr, &phaseerr);
                        if (phaseerr)
                                break;
-                       x_put_byte(ncr->dmac_address, v);
+                       dma_put_byte(ncr->dmac_address & ncr->dma_mask, v);
                } else if (ncr->dmac_direction > 0) {
-                       uae_u8 v = x_get_byte(ncr->dmac_address);
+                       uae_u8 v = dma_get_byte(ncr->dmac_address & ncr->dma_mask);
                        aic_bput_dma(ncr, v, &phaseerr);
                        if (phaseerr)
                                break;
@@ -1481,9 +1483,9 @@ static void xebec_do_dma(struct soft_scsi *ncr)
        struct raw_scsi *rs = &ncr->rscsi;
        while (rs->bus_phase == SCSI_SIGNAL_PHASE_DATA_OUT || rs->bus_phase == SCSI_SIGNAL_PHASE_DATA_IN) {
                if (rs->bus_phase == SCSI_SIGNAL_PHASE_DATA_IN) {
-                       x_put_byte(ncr->dmac_address, ncr5380_bget(ncr, 8));
+                       dma_put_byte(ncr->dmac_address & ncr->dma_mask, ncr5380_bget(ncr, 8));
                } else if (rs->bus_phase == SCSI_SIGNAL_PHASE_DATA_OUT) {
-                       ncr5380_bput(ncr, 8, x_get_byte(ncr->dmac_address));
+                       ncr5380_bput(ncr, 8, dma_get_byte(ncr->dmac_address & ncr->dma_mask));
                }
        }
 }
@@ -1493,11 +1495,11 @@ static void overdrive_do_dma(struct soft_scsi *ncr)
        struct raw_scsi *rs = &ncr->rscsi;
        while ((rs->bus_phase == SCSI_SIGNAL_PHASE_DATA_OUT || rs->bus_phase == SCSI_SIGNAL_PHASE_DATA_IN) && ncr->dmac_length > 0) {
                if (rs->bus_phase == SCSI_SIGNAL_PHASE_DATA_IN) {
-                       x_put_byte(ncr->dmac_address, ncr5380_bget(ncr, 8));
+                       dma_put_byte(ncr->dmac_address & ncr->dma_mask, ncr5380_bget(ncr, 8));
                        ncr->dmac_address++;
                        ncr->dmac_length--;
                } else if (rs->bus_phase == SCSI_SIGNAL_PHASE_DATA_OUT) {
-                       ncr5380_bput(ncr, 8, x_get_byte(ncr->dmac_address));
+                       ncr5380_bput(ncr, 8, dma_get_byte(ncr->dmac_address & ncr->dma_mask));
                        ncr->dmac_address++;
                        ncr->dmac_length--;
                }
index f79a49261d982bc1d491aed8efbf8d17ee556e1f..dc5b6f3b4d7155e528a3ddd2d1a53f0e60d95fe3 100644 (file)
@@ -1429,6 +1429,7 @@ struct snddev_data {
        uae_u8 acmemory[128];
        int configured;
        uae_u32 baseaddress;
+       uae_u32 baseaddress_mask, baseaddress_value;
        uae_u8 ad1848_index;
        uae_u8 ad1848_index_mask;
        uae_u8 ad1848_regs[32];
@@ -1977,18 +1978,23 @@ static void toccata_put(struct snddev_data *data, uaecptr addr, uae_u8 v)
                        hit = false;
                }
        } else if (data->type == SNDDEV_PRELUDE1200) {
-               if ((addr & 0x00ff) == 0x15) { // Reset FIFOs and CS4231A
-                       codec_stop(data);
-                       data->snddev_status = 0;
-                       data->snddev_irq = 0;
-                       data->fifo_write_index = 0;
-                       data->fifo_read_index = 0;
-                       data->data_in_fifo = 0;
-                       data->snddev_status = 0;
-                       data->snddev_irq = 0;
-                       data->fifo_half = 0;
-               } else if ((addr & 0x00ff) == 0x19) { // ?
-                       ;
+
+               if ((addr & data->baseaddress_mask) == data->baseaddress_value) {
+                       if ((addr & 0x00ff) == 0x15) { // Reset FIFOs and CS4231A
+                               codec_stop(data);
+                               data->snddev_status = 0;
+                               data->snddev_irq = 0;
+                               data->fifo_write_index = 0;
+                               data->fifo_read_index = 0;
+                               data->data_in_fifo = 0;
+                               data->snddev_status = 0;
+                               data->snddev_irq = 0;
+                               data->fifo_half = 0;
+                       } else if ((addr & 0x00ff) == 0x19) { // ?
+                               ;
+                       } else {
+                               hit = false;
+                       }
                } else {
                        hit = false;
                }
@@ -2080,20 +2086,24 @@ static uae_u8 toccata_get(struct snddev_data *data, uaecptr addr)
 
        } else if (data->type == SNDDEV_PRELUDE1200) {
 
-               if ((addr & 0x00ff) == 0x15) { // FIFO Status
-                       if (data->data_in_fifo >= data->fifo_size / 2)
-                               v |= 0x08;
-                       if (!data->data_in_fifo)
-                               v |= 0x04;
-                       if (data->data_in_record_fifo >= data->fifo_size / 2)
-                               v |= 0x02;
-                       if (data->data_in_record_fifo >= data->fifo_size)
-                               v |= 0x01;
-                       v ^= 0xff;
-               } else if ((addr & 0x00ff) == 0x1d) { // id?
-                       v = 0x05;
-               } else if ((addr & 0x00ff) == 0x19) { // ?
-                       v = 0x00;
+               if ((addr & data->baseaddress_mask) == data->baseaddress_value) {
+                       if ((addr & 0x00ff) == 0x15) { // FIFO Status
+                               if (data->data_in_fifo >= data->fifo_size / 2)
+                                       v |= 0x08;
+                               if (!data->data_in_fifo)
+                                       v |= 0x04;
+                               if (data->data_in_record_fifo >= data->fifo_size / 2)
+                                       v |= 0x02;
+                               if (data->data_in_record_fifo >= data->fifo_size)
+                                       v |= 0x01;
+                               v ^= 0xff;
+                       } else if ((addr & 0x00ff) == 0x1d) { // id?
+                               v = 0x05;
+                       } else if ((addr & 0x00ff) == 0x19) { // ?
+                               v = 0x00;
+                       } else {
+                               hit = false;
+                       }
                } else {
                        hit = false;
                }
@@ -2249,6 +2259,10 @@ bool prelude1200_init(struct autoconfig_info *aci)
        aci->addrbank = &prelude1200_bank;
        aci->start = 0xd80000;
        aci->size = 0x10000;
+       if (aci->devnum > 0) {
+               aci->start = 0xd80000 + (aci->devnum - 1) * 0x4000;
+               aci->size = 0x4000;
+       }
        device_add_reset(sndboard_reset);
 
        if (!aci->doinit)
@@ -2258,6 +2272,12 @@ bool prelude1200_init(struct autoconfig_info *aci)
 
        data->configured = 1;
        data->baseaddress = 0xd80000;
+       data->baseaddress_mask = 0;
+       data->baseaddress_value = 0;
+       if (aci->devnum > 0) {
+               data->baseaddress_mask = 0xc000;
+               data->baseaddress_value = (aci->devnum - 1) * 0x4000;
+       }
        data->type = SNDDEV_PRELUDE1200;
        data->fifo_size = 1024;
        data->codec_reg1_mask = 0x00ff;