[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Old RAM cards protocol



In an article, howland.reston.ans.net  (Paul Guertin) asks:

> Finally, here's the code Locksmith uses when scanning slots to find
> RAM cards. I don't understand the part between 206E and 2083. What
> exactly does it do?

  <shortened>

> 206E-          B1 40       LDA   ($40),Y    ;LOOK AT $CX00--$CX7F
> 2070-          48          PHA
> 2071-          68          PLA
> 2072-          D1 40       CMP   ($40),Y    ;HUH?
> 2074-          D0 0F       BNE   STDLCTST
> 2076- SELFMOD  91 3E       STA   ($3E),Y    ;STORE DATA HERE, NEXT TIME
> 2078-          D0 0B       BNE   STDLCTST   ;AROUND WE'LL CMP THEM AND DO
> 207A-          C8          INY              ;THE SAME TEST
> 207B-          10 F1       BPL   $206E
>
> 207D-          88          DEY
> 207E-          D1 3E       CMP   ($3E),Y    ;HUH?
> 2080-          D0 6D       BNE   NEXTSLOT   ;NOT A LANGUAGE CARD, TRY
> 2082-          88          DEY              ; NEXT SLOT
> 2083-          10 F9       BPL   $207E
>
> (STDLCTST is a standard language card test: read $D000, EOR $FF, write
> $D000, CMP $D000)

Well, I'll try to lighten the darknes a little bit (though the whole
thing seems a little bit tricky to me , too).

The part between $206E ans $2074 is rathe simple: The program is
scanning the area of memory, which is reserved for the ROM of each
extention card (for example C600-C6FF usually contain the boot-
routines, if the disc-card is in slot #6). If there is neither a ROM
nor a RAM attached to this area, the results you get when reading
these adresses are random. If you read twice, the bytes will differ
(PHA PLA is probably short for some NOPs).

The second part containing $2076 and $207D-$2083 is a bit more
difficult. Here is my guess: Suppose the part contains RAM. After a
cold-start, the RAM of one page usually contains the same bytes at
all adresses (try it out: turn on the computer and look for example
at $6000-$60FF). I figure the routine test if there is a (at this time
unused) RAM. But probably that's not the whole story, for randomly
one byte of the page may differ from the others (you see it if you
list a big area of unused RAM), an then the routine would fail.

Hope I could help you and good luck with disassembling (boy that
where times when we were seeking for the last update of LOCKSMITH ...
:- ).
-------------------------------------------------------------------------
      //     //                                                =========
     //     //       Harald Lakatha                              00I00
    //     //                                                   0  I  0
   //=====//         email: USER580@edvzbb2.tuwien.ac.at        0  I  0
  //     //          voice: austria+222/42 39 163               0  I  0
 //     //           mail:  Abt-Karl-Gasse 17/3                  00I00
//     //======             A-1180 Wien                        =========
-------------------------------------------------------------------------