Transfer files programatically
35 posts
• Page 1 of 4 • 1, 2, 3, 4
- gbl08ma
- Senior Member
- Posts: 141
- Joined: Wed May 16, 2012 2:50 pm
- Location: Portugal
- Calculators: Casio fx-CG20
Transfer files programatically
I'd like to know if there's a way for an add-in to invoke the file transfer dialog and have a file transmitted to another calculator, without the need to tell the user to go to the Link app and choose the file manually. Basically I'm looking for a syscall or some other way to transfer a file through the 3-pin serial port, using the Casio protocol (so that it would be compatible with any calculator, not just those with a custom add-in installed). Ideally this would be made with the file transfer dialog, and the add-in would resume execution after the file transfer.
- SimonLothar
- Senior Member
-
- Posts: 605
- Joined: Sat Sep 15, 2012 6:59 am
- Location: Krautland ****
- Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400
Re: Transfer files programatically
In the vicinity of Prizm's syscall 0x1381 there are some functions, concerning APP_LINK (fx_calculators...). The protocol 7.00 is -to a certain degree- supported on the Prizm, too. But as there has not been such a request, yet, the details have still to be reveiled. But I think it should be possible to implement your idea.gbl08ma wrote:I'd like to know if there's a way for an add-in to invoke the file transfer dialog and have a file transmitted to another calculator, without the need to tell the user to go to the Link app and choose the file manually. Basically I'm looking for a syscall or some other way to transfer a file through the 3-pin serial port, using the Casio protocol (so that it would be compatible with any calculator, not just those with a custom add-in installed). Ideally this would be made with the file transfer dialog, and the add-in would resume execution after the file transfer.
I'll be back!
- gbl08ma
- Senior Member
- Posts: 141
- Joined: Wed May 16, 2012 2:50 pm
- Location: Portugal
- Calculators: Casio fx-CG20
Re: Transfer files programatically
I already looked into what the syscalls near 0x1381 are, see my notes here: https://gist.github.com/gbl08ma/5823653 ... e1-txt-L48
Note that I didn't test any parameters, in fact I discovered these through trial and error (on the emulator so there's no risk), because I don't have a SH4 disassembler.
Note that I didn't test any parameters, in fact I discovered these through trial and error (on the emulator so there's no risk), because I don't have a SH4 disassembler.
- SimonLothar
- Senior Member
-
- Posts: 605
- Joined: Sat Sep 15, 2012 6:59 am
- Location: Krautland ****
- Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400
Re: Transfer files programatically
It looks as if 0x1384 is the call you need. It takes two arguments.
0x1384: void APP_LINK_transmit_select_dialog( void*buffer1, void*buffer2 );
Invokes the MAIN MENU Link transmit dialog. This call takes two pointers as arguments. The first buffer is 0x30 bytes long. The second buffer is 0x214 bytes long. The first buffer is initialized by syscall 0x0D79( buffer1, 0 ) (see below). The second buffer is initialized with zeros.
0x0D79: void App_InitDlgDescriptor( void*P1, unsigned char P2 );
The function of this call is not yet known in detail, but it does the following job:
it sets *(unsigned char*)P1 to P2;
it sets *(unsigned short*)(P1+2) to 0;
it sets 13 bytes starting at *(unsigned char*)(P1+4) to 0;
it sets *(unsigned short*)(P1+0x20) to 0;
it sets *(unsigned int*)(P1+0x24) to 0;
it sets 6 words starting at *(unsigned short*)(P1+0x12) to 0xFFFF;
it sets *(unsigned int*)(P1+0x28) to 0;
it sets *(unsigned char*)(P1+0x2C) to 0;
it sets *(unsigned char*)(P1+0x2D) to 0;
leaving some bytes undefined most probably due to structure-alignment.
featuring
which communicated with MAIN MENU Link receive of my fx-9750GII like a charm. Though I cannot except nasty border cases. Reading the OS is not always easy.
0x1384: void APP_LINK_transmit_select_dialog( void*buffer1, void*buffer2 );
Invokes the MAIN MENU Link transmit dialog. This call takes two pointers as arguments. The first buffer is 0x30 bytes long. The second buffer is 0x214 bytes long. The first buffer is initialized by syscall 0x0D79( buffer1, 0 ) (see below). The second buffer is initialized with zeros.
0x0D79: void App_InitDlgDescriptor( void*P1, unsigned char P2 );
The function of this call is not yet known in detail, but it does the following job:
it sets *(unsigned char*)P1 to P2;
it sets *(unsigned short*)(P1+2) to 0;
it sets 13 bytes starting at *(unsigned char*)(P1+4) to 0;
it sets *(unsigned short*)(P1+0x20) to 0;
it sets *(unsigned int*)(P1+0x24) to 0;
it sets 6 words starting at *(unsigned short*)(P1+0x12) to 0xFFFF;
it sets *(unsigned int*)(P1+0x28) to 0;
it sets *(unsigned char*)(P1+0x2C) to 0;
it sets *(unsigned char*)(P1+0x2D) to 0;
leaving some bytes undefined most probably due to structure-alignment.
featuring
- Code: Select all
App_InitDlgDescriptor( buffer1, 0 );
memset( buffer2, 0, sizeof buffer2 );
APP_LINK_transmit_select_dialog( buffer1, buffer2 );
which communicated with MAIN MENU Link receive of my fx-9750GII like a charm. Though I cannot except nasty border cases. Reading the OS is not always easy.
I'll be back!
- gbl08ma
- Senior Member
- Posts: 141
- Joined: Wed May 16, 2012 2:50 pm
- Location: Portugal
- Calculators: Casio fx-CG20
Re: Transfer files programatically
I think you either didn't understand what I meant, or I'm not understanding your explanation.
I'm looking for a way to send a file without the user needing to select it.
With the syscalls you listed, where do I provide the filename for sending? From my understanding these syscalls are for selecting a file, not for sending it.
I basically want to go straight to the "Transmitting... \n\n AC: Cancel" dialog, without having the user choose the file to send.
Meanwhile, I just had an idea unrelated to my original question. Maybe App_InitDlgDescriptor can be used to provide OpenFileDialog with instructions to open files other than just .g3p (picture) files?
I'm looking for a way to send a file without the user needing to select it.
With the syscalls you listed, where do I provide the filename for sending? From my understanding these syscalls are for selecting a file, not for sending it.
I basically want to go straight to the "Transmitting... \n\n AC: Cancel" dialog, without having the user choose the file to send.
Meanwhile, I just had an idea unrelated to my original question. Maybe App_InitDlgDescriptor can be used to provide OpenFileDialog with instructions to open files other than just .g3p (picture) files?
- SimonLothar
- Senior Member
-
- Posts: 605
- Joined: Sat Sep 15, 2012 6:59 am
- Location: Krautland ****
- Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400
Re: Transfer files programatically
That's what I referred to.gbl08ma wrote:... Ideally this would be made with the file transfer dialog, and the add-in would resume execution after the file transfer.
But anyhow, the other way is possible, too. Stay put...
I'll be back!
- gbl08ma
- Senior Member
- Posts: 141
- Joined: Wed May 16, 2012 2:50 pm
- Location: Portugal
- Calculators: Casio fx-CG20
Re: Transfer files programatically
Sorry, by "file transfer dialog" I didn't mean the one where people select the file, but the "Transmitting..." one. The idea is to have my add-in choose the file (for example, for sharing calendar events between calculators).
- SimonLothar
- Senior Member
-
- Posts: 605
- Joined: Sat Sep 15, 2012 6:59 am
- Location: Krautland ****
- Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400
Re: Transfer files programatically
Alas, there seems to be no dedicated syscall, which sends a file. The function must be constructed by means of the protocol 7.00 functions. I once coded this for my file converter (a windows program). Porting it to the Prizm will take some time.
I'll be back!
- gbl08ma
- Senior Member
- Posts: 141
- Joined: Wed May 16, 2012 2:50 pm
- Location: Portugal
- Calculators: Casio fx-CG20
Re: Transfer files programatically
That probably means that the code that builds up the protocol 7.00 apparatus is inside the APP_LINK_transmit_select_dialog syscall. I guess I will not implement event sharing functions then.
- SimonLothar
- Senior Member
-
- Posts: 605
- Joined: Sat Sep 15, 2012 6:59 am
- Location: Krautland ****
- Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400
Re: Transfer files programatically
In version 18 of fx_calculators_SuperH_based.chm (just uploaded) I arranged some information concerning the problem. See for "Sending a file via the serial interface..." in the helpfile's index. I hope I included everything necessary.
As suspected, this is not simple. I checked it on a fx9860-system (OS 2.00) and on a fxCG 20 (OS 1.04) as receivers. The sender has been a fxCG 20 (OS 1.04) in both cases. I did not encounter problems, yet.
As suspected, this is not simple. I checked it on a fx9860-system (OS 2.00) and on a fxCG 20 (OS 1.04) as receivers. The sender has been a fxCG 20 (OS 1.04) in both cases. I did not encounter problems, yet.
I'll be back!
35 posts
• Page 1 of 4 • 1, 2, 3, 4
Who is online
Users browsing this forum: No registered users and 6 guests