[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] TAS in GFA Linker

On 06/09/2014 05:43, Lonny Pursell wrote:
Initial tests seem to indicate a stable linker now. \o/
Pierre will do more testing, but I think its solved.


And would you believe the best?

Yesterday, just after providing you replacement instructions for TAS in the GFA Linker, I tested the new PmDoom 0.59 on the FireBee. Everything worked fine, except the keyboard in full screen which hangs after a few keystrokes (long lasting bug). Then I got an intuition: the keyboard hangs after a few press/releases. The scancode press/release indication is in bit 7. Bit 7, funny, the same one used by TAS. By chance, maybe there is a TAS in the SDL keyboard routine? That would explain things. So I looked at the SDL sources and... there was one TAS !!!

The TAS instruction had already been replaced by BTST on ColdFire, but for another reason. SDL used TAS D0, but on ColdFire that addressing mode is not available (the read-modify-write special cycle is a nonsense on a register). So it had been replaced by BTST (as TAS was only used to test the high bit).

But yesterday morning, Andreas gave me a hint by saying that TAS ans BSET were not interchangeable. And Thomas posted the documentation here, where it appears that TAS and BSET do not set the same condition flags.

And that was the mistake in SDL!

The original code looked like:
    tas  d0
    spl  (a0)

Naturally, it had been replaced by:
    btst #7,d0
    spl  (a0)

But it was wrong!
SPL uses the N flag.
As the documentation says, TAS sets the N bit, but BTST does not change it!

So I replaced SPL by SEQ (similar to the GFA patch), and it worked :-D

Many thanks to all of you, after years we can finally enjoy PmDoom and other SDL suff in full screen on ColdFire.

PS: There are still bugs in the FireBee's FPGA which prevent to correctly display a lot of standard VIDEL video modes, including standard Falcon TrueColor. But that's another story.

Vincent Rivière