CP400 .VCP program format
6 posts
• Page 1 of 1
- critor
- Member
- Posts: 46
- Joined: Wed Jul 24, 2013 3:33 am
- Calculators: Casio fx-7400GII (SH4), Casio fx-9750GII (SH4), Casio fx-9860GII SD, Casio Classpad 330, Casio fx-CG50, Casio Classpad fx-CP400
CP400 .VCP program format
Hi,
I'd like to be able to generate fx-CP400 program files and so I'm checking the .VCP format.
Do you have anything on this ?
There are 3 main parts apparently:
- header
- program text
- tokenized program
For example, 'Input' token is E90C and 'Pause' token is E8 27.
But 'If' and 'While' instructions seem to be more problematic.
They seem to share the same E801 token and to be followed by a E803 token and six bytes... maybe some kind of an offset or jump to the next instruction in the text or tokenized program.
But I haven't managed to figure out how to calculate those six bytes correctly.
Any idea on this ?
Thanks.
I'd like to be able to generate fx-CP400 program files and so I'm checking the .VCP format.
Do you have anything on this ?
There are 3 main parts apparently:
- header
- program text
- tokenized program
For example, 'Input' token is E90C and 'Pause' token is E8 27.
But 'If' and 'While' instructions seem to be more problematic.
They seem to share the same E801 token and to be followed by a E803 token and six bytes... maybe some kind of an offset or jump to the next instruction in the text or tokenized program.
But I haven't managed to figure out how to calculate those six bytes correctly.
Any idea on this ?
Thanks.
- helder7
- Senior Member
- Posts: 369
- Joined: Tue Jan 03, 2012 11:24 pm
- Calculators: Casio Afx 1.0, Casio fx-9860GII SD, Casio Classpad 330, Casio fx-CG20, Casio Classpad fx-CP400
Re: CP400 .VCP program format
I started to do some time ago an editor of basic programs (.XCP) for ClassPad but never got to finish, since at the time I did not know how 'If', 'While', 'goto' and other instructions worked.
Recently, found documentation of the format mcs at mkanter site: https://web.archive.org/web/20110312214 ... sspad/mcs/
The MCS format was used until classpad 300 OS 3.00, when it was replaced by XCP and VCP. Although the format has changed, there are things in common between formats and tokens are one.
The commands that use addresses are: Break, Case, Else, Else If, Goto, If, LpWhile, Next, Skip, Switch, Then, To, While, WhileEnd and the way to calculate is described on that page.
After some tests (my tests were done with xcp files, but I think vcp is similar), the only difference I found was that the total size of 'header' used as reference increased one byte.
Below is an updated version of the sample program provided at the bottom of that page, for reference.
Recently, found documentation of the format mcs at mkanter site: https://web.archive.org/web/20110312214 ... sspad/mcs/
The MCS format was used until classpad 300 OS 3.00, when it was replaced by XCP and VCP. Although the format has changed, there are things in common between formats and tokens are one.
The commands that use addresses are: Break, Case, Else, Else If, Goto, If, LpWhile, Next, Skip, Switch, Then, To, While, WhileEnd and the way to calculate is described on that page.
After some tests (my tests were done with xcp files, but I think vcp is similar), the only difference I found was that the total size of 'header' used as reference increased one byte.
Below is an updated version of the sample program provided at the bottom of that page, for reference.
- Code: Select all
AATP* + 0x0e |Text | Hex | Notes
0000000E |If x<0 | E801 20783C30 E803 00000021 00 | (Address of Else + 0x06)
0000001A |Then | 00 |
0000001B |Else | E804 00000022 00 | (Address of IfEnd)
00000022 |IfEnd | 00 |
00000023 |Cls | E82B 00 |
00000026 |While 99 | E801 203939 E803 00000038 00 | (Address of WhileEnd + 0x06)
00000032 |WhileEnd | E804 00000026 00 | (Address of While)
00000039 |Cls | E82B 00 |
0000003C |Lbl b | 00 |
0000003D |Goto b | E804 0000003C 00 | (Address of Lbl)
00000044 |Cls | E82B 00 |
00000047 |Do | 00 |
00000048 |LpWhile x<0 | E801 20783C30 E802 00000047 00FF012078| (Address of Do)
* AATP = Absolute address of tokenized program
SiO2 + CaCO3 ----------> CaSiO3 + CO2
- 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: CP400 .VCP program format
What I found up to now:
(The lists are identical on CP400 1.00 and CP400 2.00)
List: Show
I'll be back!
- critor
- Member
- Posts: 46
- Joined: Wed Jul 24, 2013 3:33 am
- Calculators: Casio fx-7400GII (SH4), Casio fx-9750GII (SH4), Casio fx-9860GII SD, Casio Classpad 330, Casio fx-CG50, Casio Classpad fx-CP400
Re: CP400 .VCP program format
Thank you very much.
I think I've now figured out almost everything about generating a program file using the VCP/XCP format.
General format seems to be :
My last problem is the two last bytes which are likely to be a checksum.
Could you help me figuring out how to calculate them ?
![Image](https://i.imgur.com/mMRpPYi.png)
Thank you very much.
I think I've now figured out almost everything about generating a program file using the VCP/XCP format.
General format seems to be :
- header
- \x00
- program text
- \x00 \xFF
- \x00
- program tokens
- \x00 \xFF
- optionnal padding bytes
- checksum (2 bytes)
My last problem is the two last bytes which are likely to be a checksum.
Could you help me figuring out how to calculate them ?
![Image](https://i.imgur.com/mMRpPYi.png)
Thank you very much.
- helder7
- Senior Member
- Posts: 369
- Joined: Tue Jan 03, 2012 11:24 pm
- Calculators: Casio Afx 1.0, Casio fx-9860GII SD, Casio Classpad 330, Casio fx-CG20, Casio Classpad fx-CP400
Re: CP400 .VCP program format
Some ASCII-hex coded numbers need special treatment in the checksum calculation.
Below is an example for the file t1-(Program).xcp:
t1-(Program).xcp
56 43 50 2E 58 44 41 54 41 00 35 66 34 64 34 33 | VCP.XDATA.5f4d43
35 33 30 35 6D 61 69 6E 00 30 33 74 31 00 30 30 | 5305main.03t1.00
30 30 30 30 33 31 6D 61 69 6E FF FF FF FF FF FF | 000031main......
FF FF FF FF FF FF 74 31 FF FF FF FF FF FF FF FF | ......t1........
FF FF FF FF FF FF 00 00 00 14 47 55 51 FF FF FF | ..........GUQ...
FF FF FF FF FF FF FF 30 30 30 30 30 30 31 34 04 | .......00000014.
00 00 00 04 00 00 00 01 00 00 00 00 31 00 FF 00 | ............1...
31 00 FF 30 65 | 1..0e
Calculation
line 1: 0x89 + 0x5F + 0x4D + 0x43
line 2: 0x53 + 0x05 + 0xA5 + 0x03 + 0xA5 + 0x00
line 3: 0x00 + 0x00 + 0x31 + 0x9F
line 4: 0x97
line 5: 0xF8
line 6: 0xF9 + 0x00 + 0x00 + 0x00 + 0x14 + 0x04
line 7: 0x35
line 8: 0x30
Result of sum = F2
0xF2 - 0x02 = 0xF0
(0xFF) + (~(0xF0)) = 0e
Below is an example for the file t1-(Program).xcp:
t1-(Program).xcp
56 43 50 2E 58 44 41 54 41 00 35 66 34 64 34 33 | VCP.XDATA.5f4d43
35 33 30 35 6D 61 69 6E 00 30 33 74 31 00 30 30 | 5305main.03t1.00
30 30 30 30 33 31 6D 61 69 6E FF FF FF FF FF FF | 000031main......
FF FF FF FF FF FF 74 31 FF FF FF FF FF FF FF FF | ......t1........
FF FF FF FF FF FF 00 00 00 14 47 55 51 FF FF FF | ..........GUQ...
FF FF FF FF FF FF FF 30 30 30 30 30 30 31 34 04 | .......00000014.
00 00 00 04 00 00 00 01 00 00 00 00 31 00 FF 00 | ............1...
31 00 FF 30 65 | 1..0e
Calculation
line 1: 0x89 + 0x5F + 0x4D + 0x43
line 2: 0x53 + 0x05 + 0xA5 + 0x03 + 0xA5 + 0x00
line 3: 0x00 + 0x00 + 0x31 + 0x9F
line 4: 0x97
line 5: 0xF8
line 6: 0xF9 + 0x00 + 0x00 + 0x00 + 0x14 + 0x04
line 7: 0x35
line 8: 0x30
Result of sum = F2
0xF2 - 0x02 = 0xF0
(0xFF) + (~(0xF0)) = 0e
SiO2 + CaCO3 ----------> CaSiO3 + CO2
- critor
- Member
- Posts: 46
- Joined: Wed Jul 24, 2013 3:33 am
- Calculators: Casio fx-7400GII (SH4), Casio fx-9750GII (SH4), Casio fx-9860GII SD, Casio Classpad 330, Casio fx-CG50, Casio Classpad fx-CP400
Re: CP400 .VCP program format
Thank you very much Helder7 and Simon for your great help.
After months of work, I've finally released it.
The images/PDF converter for the Casio fx-CP400 :
https://tiplanet.org/forum/editgx.php?mode=44
You just provide one or several PDF or image files, and you get :
- each PDF page or image converted as a .c2p file
- a program for reading the converted document, letting you scroll by screen width/height in each page, go to the next/previous page, or even go to the page number of your choice
Note this is also my first real program on the fx-CP400.
Here is a video of it :
http://gfycat.com/OblongDimpledHuia
If you need a Premium account on TI-Planet to try/test the converter without any limit, feel free to ask.
For the moment, I haven't investigated at all the compatibility with older Classpad models.
![Thumbup :thumbup:](./images/smilies/icon_thumbup.gif)
After months of work, I've finally released it.
The images/PDF converter for the Casio fx-CP400 :
https://tiplanet.org/forum/editgx.php?mode=44
You just provide one or several PDF or image files, and you get :
- each PDF page or image converted as a .c2p file
- a program for reading the converted document, letting you scroll by screen width/height in each page, go to the next/previous page, or even go to the page number of your choice
Note this is also my first real program on the fx-CP400.
Here is a video of it :
http://gfycat.com/OblongDimpledHuia
If you need a Premium account on TI-Planet to try/test the converter without any limit, feel free to ask.
For the moment, I haven't investigated at all the compatibility with older Classpad models.
6 posts
• Page 1 of 1
Return to Calculator Hacking/Modding Discussions
Who is online
Users browsing this forum: No registered users and 4 guests