summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/amigafdc.cpp
diff options
context:
space:
mode:
author Angelo Salese <angelosa@users.noreply.github.com>2022-02-22 00:20:36 +0100
committer GitHub <noreply@github.com>2022-02-22 00:20:36 +0100
commitdeff4306c57c85618a82ace317dde9b823a309b6 (patch)
treeae15c3d4b8199da356a8866eac38b3856d19ca21 /src/devices/machine/amigafdc.cpp
parent1b3409de9bedfa1b057f5d776e118808b8563028 (diff)
amiga.cpp: modernization changes (#9263)
Structural changes: - amiga_copper.cpp: convert to device, added copins implementation as debugging mailbox, convert to logmacro.h; - 8364_paula.cpp: convert audio implementation accessors from switch-case to per-channel maps; - amiga.cpp: convert OCS/ECS/AGA chipset flavours to address_map_bank_device, currently using the older custom_chip_r/_w as a legacy trampoline that will be progressively removed once that we have working implementations of Agnus/Denise and derivatives; - akiko.cpp: convert to logmacro.h; - amigafdc.cpp: better elaborate QA notes, add "Trackdisk" to device long name as officially referred by Amiga SDK: - amiga.cpp: kicked off an amiga_demos.xml SW list hookup; Adds the following implementation detail changes: - amigaaga.cpp: fix sprites and bitplanes in dualpf modes, fixes at very least cd32:dstreets on gameplay; - amigaaga.cpp: fix BPLCON0 when planes == 7 is set, fixes title screen GFXs in surfninj; - amigaaga.cpp: use HAM6 when not in AGA mode, fixes colors in cdtv:townona when run with CD32 system; - amigaaga.cpp: fix sprite control fetches when FMODE != 0, fixes at very least Digger AGA sprites display; - amigaaga.cpp: add extended bitplane delay hooks; - amigaaga.cpp: fix HAM8 when in HIRES mode, fixes at least roadkill title and car screens; - amiga.cpp: allow LOF bit to be set by writing bit 15 on VPOSW, fix roadkill AGA boot; - amigaaga.cpp: implement Extra Half-Brite mode, used by bblow_a main menu - amiga.cpp: disallow blitter address writes to go beyond the allocated chip RAM, fixes OCS sockid and AGA sockid_a drawing spurious filled tiles on playfield; - amiga.cpp, amigaaga.cpp: workaround most GFX pitch corruptions, caused by implicit DDFSTOP overrunning width loop; - amiga.cpp: allow DDFSTRT and DDFSTOP to read bit 2 in lores mode, fix swordsod GFX pitch in gameplay; - amiga.cpp: use pf2pri for non-dual playfield, fixes alfred player sprite visibility; - akiko.cpp: subq command adds +2 in command buffer, fixes cdtv:defcrown hardlock emulation; - amigaaga.cpp: implement bscan2; - amiga.cpp: disable floppy drive default for CD32; - cubo.cpp: add inputs to eldoralg/odeontw/odeontw2; - amiga.cpp: allow CD32 to read CDTV titles from SW list; New NOT_WORKING software list additions --------------------------------------- cdtv.xml: 17 Bit - Collection for Amiga CDTV, 17 Bit - Continuation Disc, A Bun for Barney (USA), Advanced Military Systems (Europe), American Heritage Illustrated Encyclopedic Dictionary (USA, 1991a Edition), Barney Bear Goes to School (USA), Cinderella - The Original Fairy Tale (USA), Defender of the Crown CDTV (Europe), Deutschland Kompakt (Germany), Fantastic Voyage (USA), Garden Fax - Garden Plants (USA), Garden Fax - Trees, Shrubs, Roses, and Conifers (USA), Language TV - English (France), Lemmings (Europe), Log!cal (Europe), Mud Puddle (USA, Multi 5), Pandora's CD v1.0 (alt), Psycho Killer (U2A2020UA), CDTV Demo Disc (Europe), Raffles (Sweden), Snoopy - The Case of the Missing Blanket (Sweden), Team Yankee (Europe), The Curse of Ra (Germany), The Demo Collection for Amiga CDTV (Europe, Black Disc), The Hutchinson Encyclopedia (Europe), The New Basics Electronic Cookbook (USA, 1991a Edition), Time Table of History - Business, Politics & Media (USA, 1991a Edition), Trivial Pursuit - The CDTV Edition (Europe, v1.0a), Turrican (Germany, alt), Turrican II: The Final Fight (Germany, alt), Welcome to CDTV Multimedia (USA, CDRM-499000), Wrath of the Demon (USA), Xenon 2 - Megablast (Eng, Fra, Ger, Ita), Ten on Ten Compilation [redump.org]
Diffstat (limited to 'src/devices/machine/amigafdc.cpp')
-rw-r--r--src/devices/machine/amigafdc.cpp71
1 files changed, 41 insertions, 30 deletions
diff --git a/src/devices/machine/amigafdc.cpp b/src/devices/machine/amigafdc.cpp
index dc288d1d191..adb31fc76ea 100644
--- a/src/devices/machine/amigafdc.cpp
+++ b/src/devices/machine/amigafdc.cpp
@@ -1,10 +1,29 @@
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
-/***************************************************************************
+/**************************************************************************************************
- Amiga floppy disk controller emulation
+ Amiga floppy disk controller emulation "Trackdisk"
-***************************************************************************/
+ Contained inside MOS 8364 Paula device
+
+ TODO:
+ - Some games currently writes 2+ dsksync to the buffer (marked as "[FDC] dsksync" in SW list):
+ Current workaround:
+ 1. comment out dma_write in DMA_WAIT_START handling and change the dma_state *only*;
+ 2. remove all of the non-DMA_WAIT_START phase inside the dsksync sub-section;
+ NB: according to documentation syncing doesn't really write anything on the bus,
+ so technically this "workaround" is more correct.
+ However it unfortunately causes other SW regressions, most notably in Workbench.
+ - Other games trashes memory or refuses to boot, in a few instances randomly
+ (marked as "[FDC] with adkcon=1100", implies dsksync disabled):
+ they often uses the AmigaDOS trackdisk BIOS functions, which may be expecting a
+ different timing. May be worth testing this out with the SDK;
+ - "[FDC] format" or in general writing to disks doesn't work properly.
+ i.e. formatting a disk in any Workbench version will cause a system crash once it completes.
+ - Fix ready line read handling;
+ - FDC LED output callback;
+
+**************************************************************************************************/
#include "emu.h"
@@ -24,7 +43,7 @@
#define LOGDMA(...) LOGMASKED(LOG_DMA, __VA_ARGS__)
#define LOGSYNC(...) LOGMASKED(LOG_SYNC, __VA_ARGS__)
-DEFINE_DEVICE_TYPE(AMIGA_FDC, amiga_fdc_device, "amiga_fdc", "Amiga FDC")
+DEFINE_DEVICE_TYPE(AMIGA_FDC, amiga_fdc_device, "amiga_fdc", "Amiga \"Trackdisk\" FDC")
void amiga_fdc_device::floppy_formats(format_registration &fr)
{
@@ -33,16 +52,16 @@ void amiga_fdc_device::floppy_formats(format_registration &fr)
fr.add(FLOPPY_IPF_FORMAT);
}
-amiga_fdc_device::amiga_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, AMIGA_FDC, tag, owner, clock),
- m_write_index(*this),
- m_read_dma(*this),
- m_write_dma(*this),
- m_write_dskblk(*this),
- m_write_dsksyn(*this),
- m_leds(*this, "led%u", 1U),
- m_fdc_led(*this, "fdc_led"),
- floppy(nullptr), t_gen(nullptr), dsklen(0), pre_dsklen(0), dsksync(0), dskbyt(0), adkcon(0), dmacon(0), dskpt(0), dma_value(0), dma_state(0)
+amiga_fdc_device::amiga_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
+ : device_t(mconfig, AMIGA_FDC, tag, owner, clock)
+ , m_write_index(*this)
+ , m_read_dma(*this)
+ , m_write_dma(*this)
+ , m_write_dskblk(*this)
+ , m_write_dsksyn(*this)
+ , m_leds(*this, "led%u", 1U)
+ , m_fdc_led(*this, "fdc_led")
+ , floppy(nullptr), t_gen(nullptr), dsklen(0), pre_dsklen(0), dsksync(0), dskbyt(0), adkcon(0), dmacon(0), dskpt(0), dma_value(0), dma_state(0)
{
}
@@ -70,7 +89,6 @@ void amiga_fdc_device::device_start()
t_gen = timer_alloc(0);
}
-
void amiga_fdc_device::device_reset()
{
floppy = nullptr;
@@ -267,14 +285,7 @@ void amiga_fdc_device::live_run(const attotime &limit)
if(!(dskbyt & 0x2000)) {
if(cur_live.shift_reg == dsksync) {
if(adkcon & 0x0400) {
- // FIXME: exact dsksync behaviour
- // - Some games currently writes two dsksync to the buffer (marked as "[FDC] dsksync"),
- // removing one will make most of them happy.
- // This is reported as 0-lower cylinder good and everything else as bad in the ATK suite;
- // - Some games trashes memory, mostly the ones with "[FDC] dsksync bootblock":
- // they attempt to load the tracks in AmigaDOS in the same way that's done by the
- // Kickstart to check if the disk is bootable.
- // This is reported as 0-upper cylinder bad in the ATK suite;
+ // FIXME: exact dsksync behaviour, cfr. note at top
if(dma_state == DMA_WAIT_START) {
cur_live.bit_counter = 0;
@@ -298,8 +309,6 @@ void amiga_fdc_device::live_run(const attotime &limit)
} else if(cur_live.bit_counter != 8)
cur_live.bit_counter = 0;
}
- //else
- // LOGSYNC("%s: no DSKSYNC\n", this->tag());
dskbyt |= 0x1000;
m_write_dsksyn(1);
@@ -320,12 +329,11 @@ void amiga_fdc_device::live_run(const attotime &limit)
dma_state = DMA_RUNNING_BYTE_1;
break;
- case DMA_RUNNING_BYTE_1: {
+ case DMA_RUNNING_BYTE_1:
dma_value |= cur_live.shift_reg & 0xff;
dma_write(dma_value);
break;
}
- }
}
} else {
if(cur_live.bit_counter != 8)
@@ -366,9 +374,9 @@ void amiga_fdc_device::dma_check()
bool was_writing = dskbyt & 0x2000;
dskbyt &= 0x9fff;
if(dma_enabled()) {
- LOGDMA("%s: DMA start dskpt=%08x dsklen=%04x dir=%s adkcon=%04x dsksync=%04x\n",
+ LOGDMA("%s: DMA start dskpt=%08x dsklen=%04x dir=%s adkcon=%04x dsksync=%04x state=%d\n",
machine().describe_context(),
- dskpt, dsklen & 0x3fff, BIT(dsklen, 14) ? "RAM->disk" : "disk->RAM", adkcon, dsksync
+ dskpt, dsklen & 0x3fff, BIT(dsklen, 14) ? "RAM->disk" : "disk->RAM", adkcon, dsksync, dma_state
);
if(dma_state == IDLE) {
@@ -454,7 +462,10 @@ void amiga_fdc_device::dsksync_w(uint16_t data)
void amiga_fdc_device::dmacon_set(uint16_t data)
{
live_sync();
- LOGDMA("%s: DMACON set DSKEN %d DMAEN %d (%04x)\n", machine().describe_context(), BIT(data, 4), BIT(data, 9), data);
+ // log changes only
+ // FIXME: needs better boilerplate code on top level
+ if ((data & 0x210) != (dmacon & 0x210))
+ LOGDMA("%s: DMACON set DSKEN %d DMAEN %d (%04x)\n", machine().describe_context(), BIT(data, 4), BIT(data, 9), data);
dmacon = data;
dma_check();
live_run();