Re: ROM Dump of Amiga Keyboard controller

From: Gerrit Heitsch <>
Date: Sat, 19 Jul 2014 07:15:06 +0200
Message-ID: <>
On 07/19/2014 02:03 AM, Jim Brain wrote:
> On 7/18/2014 9:25 AM, Gerrit Heitsch wrote:
>> On 07/18/2014 05:33 AM, Jim Brain wrote:
>> What do you use $82 for? Handshake to show that the next byte is ready?
> Yep.  Otherwise, how do you know (without counting cycles on the host),
> when the next byte is ready to be read on PORTA?
>> The code could be optimized further, not that it's necessary for this
>> purpose, but it just jumped out at me when looking at your code and I
>> noticed you didn't use the Y register. Simply add
>> LDY #$10
>> at the beginning and then instead of
>> LDA $08
>> CMP #$10
>> use
>> CPY $08
> I'm curious how that is "optimized"  :-)  Doesn't it also need an INY in
> there?  With that added, it takes more cycles and more codespace...

No, it takes less cycles since Y is loaded with $#10 once at the 
beginning to the program before entering any loop. Then it's used as a 
constant to compare against while your code always loads the contents of 
$08 into the accu and then compares it against #$10. So instead of 
LDA/CMP (5 cycles) you only have the CPY (3 cycles) inside the loop.

Not that it really makes any real difference, but if there is a spare 
register I can use, I like to use it.


       Message was sent through the cbm-hackers mailing list
Received on 2014-07-19 06:00:03

Archive generated by hypermail 2.2.0.