<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Tue, 13 May 2003 16:51:13 +0100
From   : tom@...
Subject: Re: Beebem VIA bugs (was: Compiling Beebem)

What's happenend to the BeebEm website? I've got BeebEm 1.35 (I 
think) and the VIA stuff generally looks a bit broken:

1. Timer 2 latch is 16 bit, but it should be 8
2. Timer 2 is always reloaded from latches, should just underflow 
(the latches are never used in this way)
3. Timer 2 one-shot causes continuous interrupts
4. Reads of ACR always return FF.

(IFR bit 5 is T2 by the way...)

The problem on my version is #3.

When the Beeb is reset T2 is random and relevant ACR bit is 0 (1-
shot). So it takes at most 0xFFFF*2 CPU cycles before the IRQ is 
fired. ~500,000 cycles after starting, the OS acknowledges all 
(spurious) pending system and user VIA IRQs, including the T2 
timeout. Since T2 is one-shot, and user VIA T2 is never reloaded, T2 
interrupts never occur even if you enable them because it's already 
happened.

I tried to hack some of this into BeebEm to check my theory but 
there's no code for handling 1-shot stuff at all and it looked like 
it would be more than just a 5 minute job. I checked it in a 
roundabout way on my emulator and this does seem to be the case. User 
VIA T2 must have timed out within 500,000 cycles of power on (or just 
cold reset?), and once acknowledged must not generate any more IRQs 
for the OS to work properly.

BLATANT PLUG: All the stuff mentioned on this thread works fine on my 
new emulator just as it does on a real Beeb. Yes including decrypting 
using timers! Should be out within the next week or so -- I just need 
to fix Watford DDFS.

--Tom

On 13 May 2003 at 15:50, Richard_Talbot-Watkins@... wrote:

> 
> Steve Fewell wrote:
> 
> > The problem (in brief) is that the statement '?&FE6E=&A0' causes
> > the emulated BBC to hang, when it should be initialising a 6522
> > Interrupt (I think).
> 
> OK, I've investigated this a little further in BeebEm 1.41, and, yes, the
> above line causes the
> emulator to hang.  However, if I enter the following straight after a
> reset:
> 
> P%=&900:[OPT2:LDA&FE6D:AND#&20:BEQP%+5:STA&FE6D:JMP!&206:]
> ?&206=0:?&207=9
> 
> ...to provide a Timer 1 IRQ handler for the User VIA...
> 
> and then enter ?&FE6E=&A0, all is well.
> 
> I suspect a real Beeb may well do this too.  It's possible that what's
> happening is the User VIA Timer 1 IRQ is being repeatedly generated, as
> it's not being serviced (and the IRQ state cleared, as per the tiny IRQ2V
> handler code above), thus causing the Beeb to hang.
> 
> Rich
> --
>                                                                            
>  Rich Talbot-Watkins                       Richard_Talbot-Watkins@... 
>  Sony Computer Entertainment Europe              Direct line: 01223 341865 
>  Cambridge Studio                                                          
>                                                                            
> 
> 
> 
> 
> 
> 
> **********************************************************************
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> postmaster@...
> 
> This footnote also confirms that this email message has been checked
> for all known viruses.
> 
> **********************************************************************
>  SCEE 2003
> 
> 
> 


-- 
--Tom





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