From 5f12dea7677bdf088b6075985d9f7585ce946f2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Strohh=C3=A4cker?= Date: Sat, 13 Sep 2008 20:04:28 +0000 Subject: [PATCH] reset dma request line on soundblaster reset (thanks to hal), fixes 3d bomber Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3219 --- include/dma.h | 13 +++++++++++-- src/hardware/dma.cpp | 8 ++++++-- src/hardware/sblaster.cpp | 4 +++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/include/dma.h b/include/dma.h index 74080d6d..84cca2b0 100644 --- a/include/dma.h +++ b/include/dma.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dma.h,v 1.17 2007-01-08 19:45:37 qbix79 Exp $ */ +/* $Id: dma.h,v 1.18 2008-09-13 20:04:28 c2woody Exp $ */ #ifndef DOSBOX_DMA_H #define DOSBOX_DMA_H @@ -46,6 +46,7 @@ public: Bit8u trantype; bool masked; bool tcount; + bool request; DMA_CallBack callback; DmaChannel(Bit8u num, bool dma16); @@ -59,6 +60,8 @@ public: void Register_Callback(DMA_CallBack _cb) { callback = _cb; SetMask(masked); + if (callback) Raise_Request(); + else Clear_Request(); } void ReachedTC(void) { tcount=true; @@ -68,6 +71,12 @@ public: pagenum=val; pagebase=(pagenum >> DMA16) << (16+DMA16); } + void Raise_Request(void) { + request=true; + } + void Clear_Request(void) { + request=false; + } Bitu Read(Bitu size, Bit8u * buffer); Bitu Write(Bitu size, Bit8u * buffer); }; diff --git a/src/hardware/dma.cpp b/src/hardware/dma.cpp index 5a367fd9..ee17c59c 100644 --- a/src/hardware/dma.cpp +++ b/src/hardware/dma.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2007 The DOSBox Team + * Copyright (C) 2002-2008 The DOSBox Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,6 +16,8 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* $Id: dma.cpp,v 1.39 2008-09-13 20:04:28 c2woody Exp $ */ + #include #include "dosbox.h" #include "mem.h" @@ -231,7 +233,8 @@ Bitu DmaController::ReadControllerReg(Bitu reg,Bitu len) { chan=GetChannel(i); if (chan->tcount) ret|=1 << i; chan->tcount=false; - if (chan->callback) ret|=1 << (i+4); +// if (chan->callback) ret|=1 << (i+4); + if (chan->request) ret|=1 << (4+i); } return ret; default: @@ -256,6 +259,7 @@ DmaChannel::DmaChannel(Bit8u num, bool dma16) { increment = true; autoinit = false; tcount = false; + request = false; } Bitu DmaChannel::Read(Bitu want, Bit8u * buffer) { diff --git a/src/hardware/sblaster.cpp b/src/hardware/sblaster.cpp index a7aac8cc..5bc3e801 100644 --- a/src/hardware/sblaster.cpp +++ b/src/hardware/sblaster.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: sblaster.cpp,v 1.69 2008-08-28 17:37:23 c2woody Exp $ */ +/* $Id: sblaster.cpp,v 1.70 2008-09-13 20:04:28 c2woody Exp $ */ #include #include @@ -680,6 +680,7 @@ static void DSP_Reset(void) { sb.dma.autoinit=false; sb.dma.mode=DSP_DMA_NONE; sb.dma.remain_size=0; + if (sb.dma.chan) sb.dma.chan->Clear_Request(); sb.freq=22050; sb.time_constant=45; sb.dac.used=0; @@ -1482,6 +1483,7 @@ public: if (sb.type==SBT_NONE) return; sb.chan=MixerChan.Install(&SBLASTER_CallBack,22050,"SB"); sb.dsp.state=DSP_S_NORMAL; + sb.dma.chan=NULL; for (i=4;i<=0xf;i++) { if (i==8 || i==9) continue;