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

Re: [MiNT] TAS in GFA Linker



on 9/6/14, 4:20 AM, Vincent Rivière wrote:

> 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.
> 
> Excellent!
> 
> 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 !!!

One thing leads to another. :)
 
> 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.

Soon as TAS was in my sights as the culprit I had dug out my 68K reference
manuals and was comparing it to BSET. I noticed the condition flags differ
and verified your suggestions before applying them. ;)
 
> 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.

Updated my source scanning tool and found one TAS in the library and one in
the interpreter. Its in an obscure subroutine that does printing in GFA
windows. A little more fixing and GFA will me TAS free.

Thanks again to all for posting infos and such.

-- 
Lonny Pursell    http://www.bright.net/~gfabasic/