Re: [hatari-devel] Videl Emu and TimerB

[ Thread Index | Date Index | More Archives ]

Thanks Nicolas,

The first problem actually is that many code in mfp.c calls video_... functions
like video_get_position, video_getTimerBPos, ...

And as I don't want to call anything from video (which is no more initialized), it goes wrong.

Do you thing we should encapsulate every mfp.c functions with something like :
if (machine == falcon)
  do_ videl (or do_nothing)
  call video_...

What could explain that the mouse doesn't work anymore ?


Le 07/03/2012 23:25, Nicolas Pomarède a écrit :
On 07/03/2012 21:28, Laurent Sallafranque wrote:

I've given another try to handle all the HBL, VBL, ... into Videl and
stop using video.c for the Falcon)

I manage to arrive to the desktop but with no mouse, because of timerB..

The problem seems to be in void MFP_ActiveEdge_WriteByte(void)
At the end of the function, there's

/* Timer B position changed, update the next interrupt */
if ( LineTimerBCycle_old != LineTimerBCycle )
Video_AddInterruptTimerB ( LineTimerBCycle );

I'd like to recode this addInterruptTimerB into Videl, but I don't know
well what is the TimerB.

Some doc or explanation is needed here.




this is strange, I don't recall timer B is used to drive the mouse on a real ST (and I think it's the same on the falcon), I'm not sure this is the cause of the problem.

Basically, you need to emulate an interrupt that start when videl starts displaying the right border. Forget all other code in video.c (such as the one above), it's only STF/STE, for special corner cases.

So, the "problem" is to compute the correct number of cycles to start the timer B from the HBL interrupt so that the exception happens roughly when videl will start drwaing the right border with color 0 (I'm not sure timer B is available in all the videl's video mode).

A 1st approach to have a timer B is to call the timer B exception from the HBL handler too, but only on visible line (not during top/bottom boder). I think this would fix many demos that require timer B to do rasters (color would not be changed at exactly the correct position (maybe ~80-100 pixels too late), but that's a good base to start).


Mail converted by MHonArc 2.6.19+