Date : Tue, 30 Aug 1994 10:46:59 WET DST
From : Bonfield James <jkb@...>
Subject: Re: BBC keyboard interrupts.
James Fidell writes:
>
>Stephen Quan wrote:
>
>> Frankly, I can't get the System VIA or the keypad to respond.
>> I have put in debug code that will trace all reads and writes to
>> &FE40-&FE4F. Also, I painstakenly got all the flags in IFR and
>> IER figured out (I might bring it in tomorrow and post the 4 line
>> macro for both of these 2 via registers to see if anyone see
>> anything wrong with it).
>
>I had exactly the same problem at one point. I never managed to work
>out what was going wrong. In desperation, I just went on and implemented
>functionality in the system VIA that I hadn't yet done, thinking that
>I'd leave the problem for a while and come back to it later.
>
>For reasons that I don't understand, once I'd implemented the T1/T2 timer
>code, the problem went away. I don't know why this should be -- perhaps
>I inadvertently corrected a bug in the VIA emulation.
This sounds SO familier! I had a whole host of problems, of which one of them
was that IER simply never had CA2 interrupts enabled. Another, more worrying
bug I had was that I had the usage of the 'I' bit in P swapped around! Quite
how anything ever worked was beyond me ;-) I'm not quite sure what fixed it,
but now things are more or less working.
When I hit a key an interrupt is generated, the 6522 is scanned, the key is
correctly determined and stored in &EC (plus the &ED operations), and the BBC
somewhere still doesn't work. Looking in &EC I see that there's actually
values with their high bit set. My 6522 code certainly isn't storing these, so
the OS is modifying these values at some later stage. Does the high bit mean
anything for the &EC/&ED values does anyone know? Does any of this sound
familier?
I've decided to throw away my UNIX itimer mechanism, or at least most of it.
I was using a nice itimer queueing system where I register a function with
'current' and 'repeat' timeval structures. However mysteriously my timeval
structures appear to occasionally wrap around and wait forever, despite code
to deliberately add and call the registered function until the values are
positive again. I suspect there's some horrid race condition I've missed.
The real problem though is that it causes me such a headache when debugging!
James