Re: ROM Dump of Amiga Keyboard controller

From: Gerrit Heitsch <>
Date: Fri, 18 Jul 2014 16:25:17 +0200
Message-ID: <>
On 07/18/2014 05:33 AM, Jim Brain wrote:
> However, I went back tonight and tried it the "by the book" way.  It
> does work, and it works well.  I fed this into RAM:
> lda #0
> sta $82
> loop2: ldx #00
> loop: lda $100,x
> sta $80
> lda #$ff
> sta $82
> lda #$00
> sta $82
> inx
> bne loop
> inc $08
> lda $08
> cmp #$10
> bne loop2
> loop3: beq loop3

What do you use $82 for? Handshake to show that the next byte is ready?

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


CPY $08

And also start reading at $0800 and not $0100.

> (crappy code alert!)
> Doing this:
>   while(1) {
>      RESET_ON();
>      send_data(0xEA);
>      send_data(0xEA);  // it'll work without the remaining 3 of these,
> but it's better with all 4
>      send_data(0xEA);
>      send_data(0xEA);
>      TEST_ON();
>      send_data(0xEA);  // it needs a mininum of 4 cycles, looks like...
>      send_data(0xEA);
>      send_data(0xEA);
>      send_data(0xEA);

I see you took out the sync code... That means you have total control 
now and no longer have to guess in what cycle you are.

> And, I was able to dump out the entire 2kB of ROM.  I also found out
> that it looks like the system requires 4 cycles after RESET goes high to
> start

Probably has something to do with loading the RESET vector and getting 
things set up internally before putting the program counter onto the 
address bus for the first command fetch. Does any 6502 datasheet show a 
clock by clock diagram for what happens once RESET goes high?

> Yet, I submit that I would never have gotten to this point without first
> getting the "non-RUN from RAM" version of the code to work first.  At
> least at this point, I knew how to get the code to run on the 6502...

Doesn't matter, it worked and you got the code out from the 6500/1.


       Message was sent through the cbm-hackers mailing list
Received on 2014-07-18 15:00:02

Archive generated by hypermail 2.2.0.