[Coco] Technical: PIA Help

Robert Gault robert.gault at worldnet.att.net
Thu Dec 1 18:32:52 EST 2005


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