[Coco] Re: Technical: PIA Help

Gene Heskett gene.heskett at verizon.net
Thu Dec 1 21:27:14 EST 2005

On Thursday 01 December 2005 21:09, 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?

That stands for Alan Battigers(sp sorry Alan) Real Time Services Inc,
addressable as os9archive.rtsi.com, where he has been so kind as to
serve as both an ftp portal for coco/m68k/os9 related stuff, and web
based access for the last few years.  Our archive has been hosted there 
something like nearly 20 years, since shortly after delphi was closed to
us.  We don't say thank you nearly often enough.  I believe the
internet registration fees are also paid by Alan.

>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/

Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
99.36% setiathome rank, not too shabby for a WV hillbilly
Yahoo.com and AOL/TW attorneys please note, additions to the above
message by Gene Heskett are:
Copyright 2005 by Maurice Eugene Heskett, all rights reserved.

More information about the Coco mailing list