[Coco] Re: Technical: PIA Help
Brad Grier
bradgrier at cox.net
Thu Dec 1 21:16:14 EST 2005
Correction: the interrupt start address is $c4e2, not $c4fe - I have a
lot of numbers scribbled on the paper in front of me.
Brad Grier wrote:
> Hi Robert,
>
> I reached my conclusions by stepping through Mocha in debug mode. I also
> used the debugger in Jeff Vavasour's emulator (the game doesn't work
> quite right there either - it does work in David Keil's emulator). I'm
> surprised it doesn't work in MESS.
>
> The strobing appears to be in the interrupt routine (both the write to
> $ff02 and the read of $ff00). The routine starts at $c4fe - you don't
> have to go far to see the *first* write/read of $ff02 and $ff00.
>
> By the way, what is RTSI?
>
> Brad
>
>
>
> Robert Gault wrote:
>
>> You correct in your understand of the keyboard strobing. As to the
>> game, my first question would be how do you know what the game is
>> doing? Have you disassembled the code or are you monitoring the
>> emulated registers with a built-in debugging routine.
>>
>> There is a Tetris ROM image on RTSI which is 16K and works with a
>> Coco3 in high res graphics and a Coco1/2 in low res graphics. A very
>> very quick scan through the code did not find the $FF02 strobing. Does
>> the store $FF02 with $FF occur during the interrupt, or is $FF00 read
>> during the interrupt, or both?
>>
>> By the way, this image does not run correctly in MESS. Key presses are
>> detected but the game responds as though several wrong keys were
>> pressed. I'm not sure how or if I can test it on a real Coco without a
>> ROM pack.
>>
>> Brad Grier wrote:
>>
>>> Hello all,
>>>
>>> I'm trying to get Tetris to work in Mocha but I'm having trouble
>>> getting the emulator to recognize key presses in the game. This is
>>> the only program I've found that exhibits this behavior.
>>>
>>> My understanding of the CoCo PIA keyboard routine is as follows:
>>> Write a zero to the bit that corresponds to the keyboard column
>>> you're interested in (with the rest of the bits set to 1) and poke it
>>> into 0xff02. Next read 0xff00 and if a key is pressed you'll get a
>>> zero in the bit corresponding to the keyboard row.
>>>
>>> Tetris seems to do all of it's keyboard polling from a field sync
>>> interrupt routine. It's constantly poking 0xff into 0xff02 - normally
>>> Mocha would ignore the subsequent read at 0xff00 because no bits are
>>> zero. I've found that if I treat 0xff as a request to see if *any*
>>> key is down regardless of column, I can at least get some keys to
>>> kind of work. Maybe it all boils down to what does a 0xff into 0xff02
>>> really do? I'm sure I'm overlooking something obvious...
>>>
>>> Anyway, I've been making a lot of changes to Mocha recently and this
>>> one is last on the list for the time being. That, and I like Tetris.
>>>
>>> Thanks,
>>>
>>> Brad
>>> http://members.cox.net/javacoco/
>>>
>>>
>>
>
>
More information about the Coco
mailing list