<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Mon, 13 Oct 2008 23:00:28 +0100
From   : mfirth@... (Michael Firth)
Subject: [Fwd: Re: *CONFIGURE Q]

----- Original Message ----- 
From: "Phill Harvey-Smith" <afra@...>
To: <bbc-micro@...>
Sent: Monday, October 13, 2008 10:37 PM
Subject: [BBC-Micro] [Fwd: Re: *CONFIGURE Q]


>
>
> -------- Original Message --------
> Subject: Re: [BBC-Micro] *CONFIGURE Q
> Date: Mon, 13 Oct 2008 22:36:19 +0100
> From: Phill Harvey-Smith <afra@...>
> To: Michael Firth <mfirth@...>
> References:
> <89056F0D6B620444BE8677A5802EE49F060EA264@...><48EBCBAE.3000703
at aurigae.demon.co.uk><269382A7193A4E1B86A5F0643A336814@...>
> <48F281CE.9060101@...>
> <D014E111998944849D2D0B377513D94F@...>
>
> Michael Firth wrote:
>
>> It would appear so. From the BeebEm sources (included with the
>> installation):
>>
>>   case 0x89: /* BIT Immediate */
>>    if (MachineType==3) BITInstrHandler(ReadPaged(ProgramCounter++));
>>    break;
>>
>> and
>
> Yep.
>
>> INLINE static void BITInstrHandler(int16 operand) {
>>  PSR&=~(FlagZ | FlagN | FlagV);
>>  /* z if result 0, and NV to top bits of operand */
>>  PSR|=(((Accumulator & operand)==0)<<1) | (operand & 192);
>> } /* BITInstrHandler */
>>
>> As you suspected, the BIT instruction is clearing the N and V flags in
>> all cases.
>>
>> It looks like the fix may be a bit fiddly, because of the way the
>> instruction decoding is done.
>
> What I ended up doing was to replicte the BITInstrHandler, as
> BITInstrImmHandler so that it just changed the Z flag, and then changed
> case 0x89 to call it instead of the original, this seems to work fine.
>
>> I suspect the only fix is to add an extra parameter to the
>> BITInstrHandler function, which is a flag which is '1' if its an
>> immediate BIT.
>
> I considdered doing that, but the above seemed to fit in better with
> what was already there :)
>
>> I may have a hack at this at some point, and try and build BeebEm with
>> the change.
>
> I can post the change here if you want, what's the policy as regards
> attachments (of the updated source file)on the group, I have sent the
> fixed source file to BeebEm's maintainer.
>
That's fine, I've managed to hack my version of the change into the sources.

My bigger challenge is installing the whole Visual Studio stuff on my PC, as 
I haven't done any Windows software building for years.

Have you tested the fix in either MESS or BeebEm?

Hopefully you having sent the fix to the maintainer will mean that a fixed 
version of BeebEm is generally available in due course.

Michael 
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>