Index | wersja polska |
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.
The display should show:
<memory> c file work 58879 7500 50000 1379 free 50000 1379 c,file? 7500,50000 |
NEW LOAD"MC" RUN
main() { char* p; p=(char*)0xC021; *p++=0x56;*p++=0x60;*p++=0x55;*p++=0xD1; *p++=0x08;*p++=0xE0;*p++=0x04;*p++=0x77; *p++=0x74;*p++=0xC0;*p++=0xB4;*p++=0x84; *p++=0x0D;*p++=0x04;*p++=0xD1;*p++=0x08; *p++=0x96;*p++=0x40;*p++=0x77;*p++=0x74; *p++=0xC0;*p++=0xD1;*p++=0x08;*p++=0x1D; *p++=0x57;*p++=0x71;*p++=0x74;*p++=0xC0; *p++=0xD1;*p++=0x08;*p++=0x23;*p++=0x40; *p++=0x77;*p++=0x74;*p++=0xC0;*p++=0xD1; *p++=0x00;*p++=0x00;*p++=0x80;*p++=0xD1; *p++=0x08;*p++=0x3E;*p++=0x41;*p++=0x77; *p++=0x74;*p++=0xC0;*p++=0xD1;*p++=0x08; *p++=0xE0;*p++=0x04;*p++=0x77;*p++=0x74; *p++=0xC0;*p++=0xB0;*p++=0x84;*p++=0x56; *p++=0x60;*p++=0x45;*p++=0xD6;*p++=0x00; *p++=0x10;*p++=0x0C;*p++=0xD1;*p++=0x00; *p++=0x30;*p++=0x00;*p++=0xA0;*p++=0x00; *p++=0x56;*p++=0x60;*p++=0x65;*p++=0xD6; *p++=0x00;*p++=0x00;*p++=0x00;*p++=0xD6; /*#*/ *p++=0x20;*p++=0xFF;*p++=0x7F;*p++=0x96; /*#*/ *p++=0x59;*p++=0xD8;*p++=0xFE;*p++=0x1E; *p++=0x66;*p++=0x26;*p++=0x06;*p++=0xD1; *p++=0x06;*p++=0x75;*p++=0x02;*p++=0xA6; *p++=0x07;*p++=0x56;*p++=0x60;*p++=0x54; *p++=0xDE;*p++=0x08; }
>E0CE2 0CE2 AE-76 6F-02 FF- |
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.
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 BUP OFF ; call to a routine in bank 0 pointed to by $8,$9 SYSCAL: GST UA,$6 PHS $6 LDW $6,&H0276-1 PHSW $7 PST UA,&H54 JP $8