Register

Casio fx-9860G SD- How to read files in the sd card?

Discuss anything related to calculators. For specific help on certain games/programs check the Released Projects subforum.
Senior Member
User avatar
Posts: 603
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750 G II, Casio fx-9750 G II (SH4), Casio fx-9860G, Casio fx-9860 G SD, Casio fx-9860G Slim, Casio fx-9860 GII SD, Casio fx-9860 GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG 20, Casio Classpad fx-cp400, Casio fx-CG 50

Re: Casio fx-9860G SD- How to read files in the sd card?

Postby SimonLothar » Sun Sep 18, 2016 6:59 am

AmazoNKA wrote:Visually it is also ok
HxD's checksum-32 is 0213c340 and crc-32 is 6ae68bc4 - do they match what you expected please?
Does it also mean I needed to create the file hundreds of times and see if they are all good - or how did you discover that there was a problem with openlog sometimes please?
Thanks again
I do not use an overall checksum, but a 512 byte-block checksum. The 2-byte checksum per block should be 0x5400 for each block.
The function "check write" reads the file and checks the checksum for each block. If the checksum does not match, it does a retry.
Usually there are no more than 10 retries. In case of firmware version 4.0, the escape sequence is not included in the file (according to the documentation). This could lead to some error at the end of the test with the current version of insight.
I'll be back!

Senior Member
Posts: 112
Joined: Mon Mar 02, 2015 10:53 am
Calculators: Casio fx-CG 20

Re: Casio fx-9860G SD- How to read files in the sd card?

Postby AmazoNKA » Sun Sep 18, 2016 4:01 pm

I have started building the interface slowly and it is going to look and hopefully function almost identically to native Memory app with addition of [F3] SD Card and corresponding SD F-key
Code: Select all
658 and 0x02A9

and so far completed the status bar and function keys views for memory views etc but only with small progress on listing of files so far - I can list them but it is not in folders first and then alphabetically like in the OS but some other order plus I miss scrolling, highligting, file icons and sizes etc but just wanted to experiment with storage memory (and quasi mirror of main memory on it) before moving on to doing the same for SD - I shall look at other people's experiments with this but so far I did 250 lines of coding to get the general layout of how I would like the add-in to look - so still need to fix sorting and other issues described above plus filter ".",".." and "@MainMem" out of the lists.

Simon, perhaps you know how I can display file names in 8.3/dos kind of format with ~1 etc at the end of file names longer than 8 characters just the way the OS does it...

Also in case I struggle with parsing of directory listings of SD Card could you please share the output of ls command from openlog so that I can see what bytes they use for end of line and end of list... only if you have them to hand or have time for this

Thank you

Senior Member
User avatar
Posts: 603
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750 G II, Casio fx-9750 G II (SH4), Casio fx-9860G, Casio fx-9860 G SD, Casio fx-9860G Slim, Casio fx-9860 GII SD, Casio fx-9860 GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG 20, Casio Classpad fx-cp400, Casio fx-CG 50

Re: Casio fx-9860G SD- How to read files in the sd card?

Postby SimonLothar » Sun Sep 18, 2016 5:03 pm

AmazoNKA wrote:Simon, perhaps you know how I can display file names in 8.3/dos kind of format with ~1 etc at the end of file names longer than 8 characters just the way the OS does it...
The sparkfun does not support long filenames. I do not know, if I understand your question right. windows shortens long filenames by appending ~1 to the first six characters of the filename. If this is not unique, ~2, ~3 a. s. o. is used. If the capacity of one digit is exhausted, windows uses partly random parts to distiguish filenames (f. i. LAD307~1, see below). Obviously it keeps the first two characters in this case.
F. i.
08.09.2016 05:52 <DIR> LABBAS~1 LabBase_HH
08.09.2016 05:54 <DIR> LABBAS~3 LabBase_JZ
19.08.2016 20:47 <DIR> LABBAS~4 LabBase_P13
13.05.2016 18:09 <DIR> LAD307~1 LabBase_pre13
08.09.2016 05:55 <DIR> LABBAS~2 LabBase_RR

AmazoNKA wrote:Also in case I struggle with parsing of directory listings of SD Card could you please share the output of ls command from openlog so that I can see what bytes they use for end of line and end of list
I just logged this output:
ls<0D><0D><0A>Volume is FAT32<0D><0A>VT4/<0D><0A> VT_0001T.IS2 60410<0D><0A> VT_0002T.IS2 60410<0D><0A> VT_0003T.IS2 60410<0D><0A> VT_0004T.IS2 60410<0D><0A> VT_0005T.IS2 60410<0D><0A> VT_0006T.IS2 60410<0D><0A> VT_0007T.IS2 60410<0D><0A> VT_0008T.IS2 60410<0D><0A>SYSTEM~1/<0D><0A> INDEXE~1 76<0D><0A>CONFIG.TXT 61<0D><0A>NEU.TXT 40<0D><0A>NEU-KO~1.TXT 1552<0D><0A>NEU-KO~2.TXT 1536<0D><0A>>

First (if echo is ON) the command ls<0D> is echoed back, terminated with <0D><0A>.
Then the directory is sent line by line, terminated by <0D><0A> each.
The last char is > (The prompt).

<0D> represents 0x0D, <0A> represents 0x0A
I'll be back!

Senior Member
Posts: 112
Joined: Mon Mar 02, 2015 10:53 am
Calculators: Casio fx-CG 20

Re: Casio fx-9860G SD- How to read files in the sd card?

Postby AmazoNKA » Sun Sep 18, 2016 6:45 pm

thank you so much for kindly explaining this all in such a detail

Senior Member
Posts: 112
Joined: Mon Mar 02, 2015 10:53 am
Calculators: Casio fx-CG 20

Re: Casio fx-9860G SD- How to read files in the sd card?

Postby AmazoNKA » Sat Sep 24, 2016 2:38 pm

Hi Simon,

Regarding my 8.3 question i basically found it strange that bfile system calls we know don't seem to use 8.3 file format yet memory manager app on the calculator shows longer than 8 characters long names truncated with ~1 etc.

I haven't made much progress - just debugged some tiny interface things without any proper functionality being added but once I'm happy with aesthetics my pace should accelerate.

I accidentally discovered how good open/saveFileDialog system calls look in your insight addin and gave save system call a try this morning with a few other modes besides 4 and it seemed to respond with a few different backgrounds etc and I haven't investigated what this system call return yet but it could be potentially very useful for copying the files etc - I wonder how much more you can find out about this and openfiledialog system calls - it seems to me similar calls are used in transfer and export etc interfaces by OS (not just geometry and picture plot addins) but with different function keys used at the bottom- if I could know more about those calls it would be so helpful

Thank you so much for helping here all the time

Senior Member
Posts: 112
Joined: Mon Mar 02, 2015 10:53 am
Calculators: Casio fx-CG 20

Re: Casio fx-9860G SD- How to read files in the sd card?

Postby AmazoNKA » Sat Sep 24, 2016 5:02 pm

after more tests it seems system call 0x0C66 returns 30002 if exited and 946 if [f1]save as is used to enter a file name...

most modes give blank background but 1 gives blue with graphs pictures, 6 pink with pie chart pictures

I hope you could kindly discover a call which returns the path of save choice basically somehow and something similar for open if possible.

Let me know what you think please

Senior Member
User avatar
Posts: 603
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750 G II, Casio fx-9750 G II (SH4), Casio fx-9860G, Casio fx-9860 G SD, Casio fx-9860G Slim, Casio fx-9860 GII SD, Casio fx-9860 GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG 20, Casio Classpad fx-cp400, Casio fx-CG 50

Re: Casio fx-9860G SD- How to read files in the sd card?

Postby SimonLothar » Sat Sep 24, 2016 8:49 pm

This is, what I know:

SysCall 0x0C66: int SaveFileDialog( unsigned short*FileName, int mode );
FileNameBufferLength at least 0x214 (t. i. 0x10A unsigned short items).
mode == 4

If EXIT or QUIT has been hit, the keycode for EXIT ist returned (0x7532). In this case the buffer contains "\\fls0\".
If "SAVE AS" has been hit and a <filename> has been entered, the keycode 0x3B2 is returned and buffer contains the complete path "\\fls0\<filename>".
I'll be back!

Senior Member
Posts: 112
Joined: Mon Mar 02, 2015 10:53 am
Calculators: Casio fx-CG 20

Re: Casio fx-9860G SD- How to read files in the sd card?

Postby AmazoNKA » Sun Sep 25, 2016 9:39 am

Thank you so much for helping with figuring out this call, Simon, I was confused between str and name conversion of file name. I wonder if there is a similar call but with save instead of or in addition to save as button please

Senior Member
User avatar
Posts: 603
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750 G II, Casio fx-9750 G II (SH4), Casio fx-9860G, Casio fx-9860 G SD, Casio fx-9860G Slim, Casio fx-9860 GII SD, Casio fx-9860 GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG 20, Casio Classpad fx-cp400, Casio fx-CG 50

Re: Casio fx-9860G SD- How to read files in the sd card?

Postby SimonLothar » Sun Sep 25, 2016 8:58 pm

There are some more syscalls (0x0C61..0x0C6A). Especially 0x0C61, which is a 9-parameter call.
I did not unravel all of these yet. I hope to gather some usable results during the week.
I'll be back!

Senior Member
Posts: 112
Joined: Mon Mar 02, 2015 10:53 am
Calculators: Casio fx-CG 20

Re: Casio fx-9860G SD- How to read files in the sd card?

Postby AmazoNKA » Mon Sep 26, 2016 11:13 am

That's very kind of you. I hope those system calls are not restricted to g3p files only. If I haven't mentioned before the save only not save as interface appears in memory manager backup save command and also on emulator import command if any of this helps you.

I separately tested OpenFileDialog and it seems to only return *.g3p in the buffer. That's why I worry if those calls are for g3p only. Speaking about other system calls you mentioned some long time ago 0x138c and 0x1388 - i wonder if you know how they are operated and if there are any calls you are looking for now somewhere around there.

Many thanks for being so helpful with all my extra requests

PreviousNext

Return to General

Who is online

Users browsing this forum: No registered users and 10 guests