Index wersja polskawersja polska

How to read out the contents of a memory card using a PB-2000C

Relevant reference: "Executing machine code on the Casio PB-2000C"

A PB-2000C with 64kB RAM and an FA-7 or MD-100 interface is required.

BTW, I'm looking for the memory image of an OM-54A ROM card (CASL assembly language + COMET simulator).

Calculator setup

The display should show:

<memory>      c    file    work 
   58879   7500   50000    1379
    free          50000    1379
c,file? 7500,50000

Loading the machine code

main() {
char* p;
*p++=0x00;*p++=0x00;*p++=0x00;*p++=0xD6; /*#*/
*p++=0x20;*p++=0xFF;*p++=0x7F;*p++=0x96; /*#*/

Executing the machine code

0CE2 AE-76 6F-02 FF-            

Using the memory card

As a result of this procedure, a file named "MEMO" should appear, containing the lower 32kB of the card ROM image + an EOF character (0x1A). It can be transferred through the RS232 port with the menu [save].

To get the upper 32kB of the card ROM contents, repeat the above steps using a slightly modified C program. The lines marked with the comment /*#*/ should be replaced with following ones:

*p++=0x00;*p++=0x00;*p++=0x80;*p++=0xD6; /*#*/
*p++=0x20;*p++=0xFF;*p++=0xFF;*p++=0x96; /*#*/

Please note that the calculator is turned on and the bus is active when the card is inserted. This isn't dangerous, but could occasionally crash the calculator (it never happened to me, though). In such case try again.

Appendix: assembler source code

        ORG     &HC021
        START   &HC021

        PST     UA,&H55
; wait for the card slot being unlocked
        LDW     $8,&H04E0
L1:     CAL     SYSCAL
        JR      NZ,L1
; search for a file "MEMO"
        NA      $4,$SX
        LDW     $8,&H4096
        CAL     SYSCAL
; if a file "MEMO" exists, delete it
        LDW     $8,&H571D
        CAL     NC,SYSCAL
; create an empty sequential file of the name "MEMO"
        LDW     $8,&H4023
        CAL     SYSCAL
; resize the file to &H8000 bytes
        LDW     $0,&H8000       ;number of bytes
        LDW     $8,&H413E       ;expand the file
        CAL     SYSCAL
; wait for the card slot being locked
        LDW     $8,&H04E0
L2:     CAL     SYSCAL
        JR      Z,L2
; map the card to the memory bank 2
        PST     UA,&H45
        PRE     IX,&H0C10
        LDW     $0,&H0030
        STW     $0,(IX+$31)
; copy &H8000 bytes from the card to the file
        PST     UA,&H65         ;source = bank 2, destination = bank 1
        PRE     IX,0            ;source beginning address
        PRE     IY,&H7FFF       ;source ending address
        PRE     IZ,$25          ;destination address

; call to a routine in the bank 0 pointed to by $8,$9
        PHS     $6
        LDW     $6,&H0276-1
        PHSW    $7
        PST     UA,&H54
        JP      $8