[PATCH] VDI mode MFP video / timer B support

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Fixes TOS 1.x "Desktop Info..." dialog freeze in VDI mode
(due to Atari logo color cycling using MFP timer B).

It also allows running few demos in VDI mode without freezes, with
somewhat better colors and timer B synched music working.  VDI planes
and screen width obviously needs to match ST low-rez for demos.

Examples of demos that work in 320x208@16 VDI mode with this:
- Dune's Fantasia
- CareBears' SoWatt & Flashback
- Paradox' STE PaceMaker (except for end part)
---
 src/mfp.c   |  2 ++
 src/video.c | 11 ++++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/mfp.c b/src/mfp.c
index 645fd8a8..7607340a 100644
--- a/src/mfp.c
+++ b/src/mfp.c
@@ -2291,6 +2291,7 @@ void MFP_TimerBData_ReadByte(void)
 	/* Video DE signal is connected to Timer B on the main MFP */
 	if ( IoAccessCurrentAddress == 0xfffa21 )
 	{
+#if VDIRES_NO_MFP
 		if (bUseVDIRes)
 		{
 			/* HBLs are disabled in VDI mode, but TOS expects to read a 1 */
@@ -2299,6 +2300,7 @@ void MFP_TimerBData_ReadByte(void)
 		/* Special case when reading $fffa21, we need to test if the current read instruction */
 		/* overlaps the horizontal video position where $fffa21 is changed */
 		else
+#endif
 		{
 			int FrameCycles, HblCounterVideo;
 			int pos_start , pos_read;
diff --git a/src/video.c b/src/video.c
index 680d0955..75d0dc23 100644
--- a/src/video.c
+++ b/src/video.c
@@ -2655,7 +2655,6 @@ void Video_Sync_WriteByte ( void )
 	int FrameCycles, HblCounterVideo, LineCycles;
 	Uint8 Freq;
 
-
 	if ( bUseVDIRes )
 		return;						/* no 50/60 Hz freq in VDI mode */
 
@@ -3189,9 +3188,11 @@ void Video_InterruptHandler_EndLine(void)
 	/* Remove this interrupt from list and re-order */
 	CycInt_AcknowledgeInterrupt();
 
+#if VDIRES_NO_MFP
 	/* Ignore HBLs in VDI mode */
 	if (bUseVDIRes)
 		return;
+#endif
 
 	/* Generate new Endline, if need to - there are 313 HBLs per frame */
 	if (nHBL < nScanlinesPerFrame-1)
@@ -4308,7 +4309,9 @@ static void Video_AddInterrupt ( int Line , int Pos , interrupt_id Handler )
 static void Video_AddInterruptHBL ( int Line , int Pos )
 {
 //fprintf ( stderr , "add hbl line=%d pos=%d\n" , Line , Pos );
+#if VDIRES_NO_MFP
 	if ( !bUseVDIRes )
+#endif
 	{
 		Video_AddInterrupt ( Line , Pos , INTERRUPT_VIDEO_HBL );
 	}
@@ -4318,7 +4321,9 @@ static void Video_AddInterruptHBL ( int Line , int Pos )
 void Video_AddInterruptTimerB ( int LineVideo , int CycleVideo , int Pos )
 {
 //fprintf ( stderr , "add timerb line=%d cycle=%d pos=%d\n" , LineVideo , CycleVideo , Pos );
+#if VDIRES_NO_MFP
 	if ( !bUseVDIRes )
+#endif
 	{
 		/* If new position is not reached yet, next interrupt should be on current line */
 		/* else it should be on next line */
@@ -4346,7 +4351,11 @@ void Video_StartInterrupts ( int PendingCyclesOver )
 	int Pos;
 
 	/* HBL/Timer B are not emulated in VDI mode */
+#if VDIRES_NO_MFP
 	if (!bUseVDIRes)
+#else
+	if (true)
+#endif
 	{
 		ShifterFrame.ShifterLines[0].StartCycle = 0;		/* 1st HBL always starts at cycle 0 */
 
-- 
2.11.0


--------------6E59F14215F754D109EA747C--



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/