Re: ROM Dump of Amiga Keyboard controller

From: Jim Brain <brain_at_jbrain.com>
Date: Thu, 17 Jul 2014 22:33:44 -0500
Message-ID: <53C89598.6000807@jbrain.com>
On 7/17/2014 3:44 PM, silverdr@wfmh.org.pl wrote:
> On 2014-07-05 at 21:13:22, silverdr@wfmh.org.pl (silverdr@wfmh.org.pl) wrote:
>> On 2014-07-05 at 21:11:09, Gerrit Heitsch (gerrit@laosinh.s.bawue.de) 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.
> http://e4aws.silverdr.com/hard/6500_1/
>
> It's not yet linked - I find it at some 80% ready and would appreciate comments / corrections. Especially the part:
>
> http://e4aws.silverdr.com/hard/6500_1/index.php#technical_details
>
> 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
inx
bne loop
inc $08
lda $08
cmp #$10
bne loop2
loop3: beq loop3


(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);

     for(i = 0; i< sizeof(code);i++) {
       send_data(0xA9);
       send_data(code[i]);
       send_data(0x85);
       send_data(0x00 + i);
       TEST_OFF();
       send_data(0);  // extra cycle
       TEST_ON();
     }
     send_data(0x4c); // jmp $0
     send_data(0);
     send_data(0);
     TEST_OFF();
     PORTC = 0;
     DDRC = 0;
     while(PINC);
     while(1) {
       while(!PINC);
       UDR = PINA;  // uart output
       while(PINC);
     }
   }

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

>


-- 
Jim Brain
brain@jbrain.com
www.jbrain.com


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

Archive generated by hypermail 2.2.0.