Re: ROM Dump of Amiga Keyboard controller

From: Jim Brain <>
Date: Thu, 17 Jul 2014 22:33:44 -0500
Message-ID: <>
On 7/17/2014 3:44 PM, wrote:
> On 2014-07-05 at 21:13:22, ( wrote:
>> On 2014-07-05 at 21:11:09, Gerrit Heitsch ( wrote:
>>> Would it be possible to post your code, setup and notes somewhere so
>>> whoever has a spare 6570-036 or other Amiga keyboard controller can use
>>> that info to try to dump it?
>>> My experience with AVR is limited to the ATtiny series and even there
>>> quite limited, but I bet someone else would be able to replicate your
>>> setup easily.
>> I've got all the details from Jim, including schematic and the code. I'll prepare it and
>> put online soon.
> It's not yet linked - I find it at some 80% ready and would appreciate comments / corrections. Especially the part:
> I would like more details on why it was so difficult to do it "by the book" and upload the dumper to RAM, etc.
I can provide that (sorry, I meant to respond to your page, but it's 
been a bit busy)

To be blunt, I didn't give serious consideration to trying this out 
initially, because I felt the likelihood that I could:

a) get code to run on the 6502
b) get it to store data into RAM
c) get the 6502 to start running my code
d) get the 6502 code running from RAM to output data to me

had a probability hovering around 0.  That is a lot of "planets" to 
align.  And, I am not the most precise of people (not a detail person, 
they would say).

But, Greg King's post suggesting that one need not write a program to 
run from RAM, but simply one that ran, period, removed 2 of the 4 steps 
from the equation, and then I thought I had a chance.

I felt as though there were already enough variables, and removing 2 of 
them would increase the chances for success.

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
bne loop
inc $08
lda $08
cmp #$10
bne loop2
loop3: beq loop3

(crappy code alert!)

Doing this:

  while(1) {
     send_data(0xEA);  // it'll work without the remaining 3 of these, 
but it's better with all 4

     send_data(0xEA);  // it needs a mininum of 4 cycles, looks like...


     for(i = 0; i< sizeof(code);i++) {
       send_data(0x00 + i);
       send_data(0);  // extra cycle
     send_data(0x4c); // jmp $0
     PORTC = 0;
     DDRC = 0;
     while(1) {
       UDR = PINA;  // uart output

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, and there needs to be some time while RESET is low to put things 
in order.

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



Jim Brain

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

Archive generated by hypermail 2.2.0.