From 617fd7006dc6f99aea355e40ef126b867d3c8782 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Strohh=C3=A4cker?= Date: Tue, 19 Apr 2011 19:46:02 +0000 Subject: [PATCH] fix sb halt/continue sequence when no transfer in progress (thanks to tcostin, fixes some GameWizard crash) Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3696 --- src/hardware/sblaster.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/hardware/sblaster.cpp b/src/hardware/sblaster.cpp index 0c35000f..b6989abf 100644 --- a/src/hardware/sblaster.cpp +++ b/src/hardware/sblaster.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2002-2010 The DOSBox Team + * Copyright (C) 2002-2011 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 @@ -900,6 +900,9 @@ static void DSP_DoCommand(void) { case 0xd0: /* Halt 8-bit DMA */ // DSP_ChangeMode(MODE_NONE); // Games sometimes already program a new dma before stopping, gives noise + if (sb.mode==MODE_NONE) { + // possibly different code here that does not switch to MODE_DMA_PAUSE + } sb.mode=MODE_DMA_PAUSE; PIC_RemoveEvents(END_DMA_Event); break; @@ -920,7 +923,7 @@ static void DSP_DoCommand(void) { case 0xd4: /* Continue DMA 8-bit*/ if (sb.mode==MODE_DMA_PAUSE) { sb.mode=MODE_DMA_MASKED; - sb.dma.chan->Register_Callback(DSP_DMA_CallBack); + if (sb.dma.chan!=NULL) sb.dma.chan->Register_Callback(DSP_DMA_CallBack); } break; case 0xd9: /* Exit Autoinitialize 16-bit */