Register

CP400 .VCP program format

Discuss issues related to Calculator Hacking/Modding.
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

Postby critor » Fri Aug 22, 2014 11:49 am

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.

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

Postby helder7 » Sat Aug 23, 2014 12:57 am

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.
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

Senior Member
User avatar
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

Postby SimonLothar » Sat Aug 23, 2014 8:50 am

What I found up to now:
List: Show
e001:î
e002:î
e003:î
e004:and
e005:or
e006:xor
e007:î
e008:î
e009:î
e020:abs
e021:absExpand
e022:andConnect
e023:angle
e024:randList
e025:approx
e026:arcLen
e027:arg
e028:arrange
e029:augment
e02a:colDim
e02b:collect
e02c:colNorm
e02d:combine
e02e:compToPol
e02f:compToTrig
e030:conjg
e031:toRect
e032:toPol
e033:toSph
e034:toCyl
e035:crossP
e036:cuml
e037:denominator
e038:det
e039:diag
e03a:diff
e03b:dim
e03c:dotP
e03d:dSolve
e03e:eigVc
e03f:eigVl
e040:eliminate
e041:exchange
e042:expand
e043:cExpand
e044:expToTrig
e045:factor
e046:rFactor
e047:fill
e048:fMin
e049:fMax
e04a:gcd
e04b:getRight
e04c:sin
e04d:siní
e04e:sinh
e04f:sinhí
e050:cos
e051:cosí
e052:cosh
e053:coshí
e054:tan
e055:taní
e056:tanh
e057:tanhí
e058:ident
e059:im
e05a:îS
e05b:invert
e05c:lcm
e05d:lim
e05e:listToMat
e05f:ln
e060:log
e061:matToList
e062:max
e063:mean
e064:median
e065:min
e066:mod
e067:nCr
e068:norm
e069:nPr
e06a:numerator
e06b:polyEval
e06c:prod
e06d:îR
e06e:re
e06f:ref
e070:replace
e071:rewrite
e072:rotate
e073:rowAdd
e074:mRow
e075:mRowAdd
e076:rowDim
e077:rowNorm
e078:rref
e079:seq
e07a:shift
e07b:signum
e07c:simplify
e07d:solve
e07e:sortA
e07f:sortD
e080:stdDev
e081:subList
e082:subMat
e083:sum
e084:îQ
e085:swap
e086:tanLine
e087:taylor
e088:tCollect
e089:tExpand
e08a:trigToExp
e08b:trn
e08c:unitV
e08d:variance
e08e:percent
e08f:îxlist
e090:îP
e091:not
e092:dms
e093:toDMS
e094:frac
e095:int
e096:intg
e097:î
e098:toFrac
e099:Qì
e09a:Qì
e09b:mode
e09c:sequence
e09d:sumSeq
e09e:normal
e09f:rSolve
e0a0:propFrac
e0a1:factorOut
e0a2:getLeft
e0a3:plotTest
e0a4:pxlTest
e0a5:strToExp
e0a6:judge
e0a7:piecewise
e0a8:const
e0a9:constn
e0aa:element
e0ab:select
e0ac:apply
e0ad:rand
e0ae:fRound
e0af:sRound
e0b0:move
e0b1:cursor
e0b2:insert
e0b3:completeSqr
e0b4:à´
e0b5:conicsForm
e0b6:LU
e0b7:QR
e0b8:rangeAppoint
e0b9:percentile
e0ba:laplace
e0bb:invLaplace
e0bc:FFT
e0bd:IFFT
e0be:heaviside
e0bf:delta
e0c0:fourier
e0c1:invFourier
e0c2:finCalc
e0c3:getFinVal
e0c4:gamma
e0c5:rank
e0c6:exp
e0c7:baseConvert
e0c8:impDiff
e0c9:normPDf
e0ca:normCDf
e0cb:binomialPDf
e0cc:binomialCDf
e0cd:chiPDf
e0ce:chiCDf
e0cf:fPDf
e0d0:fCDf
e0d1:geoPDf
e0d2:geoCDf
e0d3:poissonPDf
e0d4:poissonCDf
e0d5:tPDf
e0d6:tCDf
e0d7:invNormCDf
e0d8:invChiCDf
e0d9:invFCDf
e0da:invTCDf
e0db:invBinomialCDf
e0dc:invPoissonCDf
e0dd:invGeoCDf
e0de:iMod
e0df:iGcd
e0e0:iLcm
e0e1:isPrime
e0e2:iFunc
e0e3:randNorm
e0e4:randBin
e0e5:hypergeoPDf
e0e6:hypergeoCDf
e0e7:invHypergeoCDf
e0e8:ncrln
e0e9:compToRect
e120:simpInt
e121:simpFV
e122:cmpdN
e123:cmpdIR
e124:cmpdPV
e125:cmpdPmt
e126:cmpdFV
e127:cashNPV
e128:cashIRR
e129:cashPBP
e12a:cashNFV
e12b:amortBal
e12c:amortInt
e12d:amortPrn
e12e:amortSumInt
e12f:amortSumPrn
e130:convEff
e131:convNom
e132:priceCost
e133:priceSell
e134:priceMargin
e135:dayCount
e136:bondPriceDate
e137:bondYieldDate
e138:bondPriceTerm
e139:bondYieldTerm
e401:î
e402:î
e403:î
e404:î
e405:î
e406:FALSE
e407:TRUE
e408:Undefined
e409:No_Solution
e40a:Identity
e40b:Null
e410:xmin3D
e411:xmax3D
e412:xgrid3D
e413:ymin3D
e414:ymax3D
e415:ygrid3D
e416:zmin3D
e417:zmax3D
e418:angleín
e419:angleí{
e41a:xmin
e41b:xmax
e41c:xscl
e41d:xdot
e41e:ymin
e41f:ymax
e420:yscl
e421:tínmin
e422:tínmax
e423:tínStep
e424:xfact
e425:yfact
e426:GconWStart
e427:GconWEnd
e428:GconWStep
e429:GconHStart
e42a:GconHEnd
e42b:GconHStep
e42c:FStart
e42d:FEnd
e42e:FStep
e42f:FResult
e430:xc
e431:yc
e432:zc
e433:rc
e434:ínc
e435:tc
e436:aì
e437:aì
e438:aì
e439:aì
e43a:aì
e43b:bì
e43c:bì
e43d:bì
e43e:bì
e43f:bì
e440:cì
e441:cì
e442:cì
e443:cì
e444:cì
e445:SqStart
e446:SqEnd
e447:SqResult
e448:nSeq
e449:aì
e44a:aì
e44b:aì
e44c:bì
e44d:bì
e44e:bì
e44f:cì
e450:cì
e451:cì
e452:aì
e453:bì
e454:cì
e455:aì
e456:bì
e457:cì
e458:ncSeq
e459:acSeq
e45a:bcSeq
e45b:ccSeq
e45c:ConicsEq
e45d:list1
e45e:list2
e45f:list3
e460:list4
e461:list5
e462:list6
e463:residual
e464:Sres11
e465:Sres12
e466:Sres21
e467:Sres22
e468:Sres31
e469:Sres32
e46a:Sres41
e46b:Sres42
e46c:Sres51
e46d:Sres52
e46e:Sres61
e46f:Sres62
e470:Sres71
e471:Sres72
e472:Sres81
e473:Sres82
e474:Sres91
e475:Sres92
e476:nStat
e477:î
e478:ìxx
e479:ìxxí
e47a:xíxì
e47b:xíxì
e47c:minX
e47d:maxX
e47e:î
e47f:ìxy
e480:ìxyí
e481:ìxxy
e482:yíxì
e483:yíxì
e484:minY
e485:maxY
e486:aCoef
e487:bCoef
e488:cCoef
e489:dCoef
e48a:eCoef
e48b:rCorr
e48c:rí
e48d:MSe
e48e:Qì
e48f:MedStat
e490:Qì
e491:ModeStat
e492:ModeNStat
e493:ModeFStat
e494:HStart
e495:HStep
e496:medxì
e497:medxì
e498:medxì
e499:medyì
e49a:medyì
e49b:medyì
e49c:prob
e49d:Zvalue
e49e:î
e49f:î
e4a0:xì
e4a1:xì
e4a2:xpíxì
e4a3:nì
e4a4:nì
e4a5:î
e4a6:î
e4a7:î
e4a8:Tvalue
e4a9:df
e4aa:sStat
e4ab:í|í
e4ac:Expected
e4ad:Fvalue
e4ae:dfA
e4af:SumSA
e4b0:MeanSA
e4b1:FvalueA
e4b2:probA
e4b3:dfB
e4b4:SumSB
e4b5:MeanSB
e4b6:FvalueB
e4b7:probB
e4b8:dfAB
e4b9:SumSAB
e4ba:MeanSAB
e4bb:FvalueAB
e4bc:probAB
e4bd:dfErr
e4be:SumSErr
e4bf:MeanSErr
e4c0:LInterval
e4c1:RInterval
e4c2:Probc
e4c3:í|í
e4c4:Fvaluec
e4c5:FactAc
e4c6:Meanc
e4c7:zLower
e4c8:zUpper
e4c9:xì
e4ca:xì
e4cb:tLower
e4cc:tUpper
e4cd:Seed
e4ce:randResult
e4cf:ans
e4d0:ydot
e4d1:aì
e4d2:bì
e4d3:cì
e4d4:aì
e4d5:bì
e4d6:cì
e4d7:smin3D
e4d8:smax3D
e4d9:tmin3D
e4da:tmax3D
e4dd:Observed
e4de:xInv
e4df:Contrib
e4e0:íxíæ
e4e1:síæ
e4e2:íxíç
e4e3:síç
e4e4:síæì
e4e5:síæì
e4e6:spíæ
e810:Break
e811:Do
e812:Else
e813:ElseIf
e814:For
e815:Goto
e816:If
e817:IfEnd
e818:Lbl
e819:LpWhile
e81a:Next
e81b:Step
e81c:Then
e81d:To
e81e:While
e81f:WhileEnd
e820:Switch
e821:Case
e822:Default
e823:SwitchEnd
e824:Skip
e825:Return
e826:Stop
e827:Pause
e828:Wait
e829:Circle
e82a:ClrGraph
e82b:Cls
e82c:Plot
e82d:CallUndef
e82e:DispFTable
e82f:DispSeqTbl
e830:DispSmryTbl
e831:Distance
e832:ZAuto
e833:DrawFTGCon
e834:DrawFTGPlot
e835:DrawGraph
e836:DrawSeqCon
e837:DrawSeqPlt
e838:DrawSeqEtrCon
e839:DrawSeqEtrPlt
e83a:GraphType
e83b:GTSelOff
e83c:GTSelOn
e83d:Horizontal
e83e:Inverse
e83f:Line
e840:NormalLine
e841:PlotChg
e842:PlotOff
e843:PlotOn
e844:PTCross
e845:PTDot
e846:PTNormal
e847:PTSquare
e848:PTBrokenThck
e849:PTThick
e84a:PxlChg
e84b:PxlOff
e84c:PxlOn
e84d:RclGMem
e84e:RclPict
e84f:RclVWin
e850:SeqSelOff
e851:SeqSelOn
e852:SeqType
e853:SheetActive
e854:SheetName
e855:Done
e856:StoGMem
e857:StoPict
e858:StoVWin
e859:ClearSheet
e85a:TangentLine
e85b:Text
e85c:Vertical
e85d:LogP
e85e:ViewWindow
e85f:SmryTSelOn
e860:ZFactor
e861:CheckNaturalNum
e862:Draw3D
e863:SelOn3D
e864:ClearSheet3D
e865:DispDfrTbl
e866:SheetName3D
e867:SheetActive3D
e868:ViewWindow3D
e869:LinearReg
e86a:MedMedLine
e86b:QuadReg
e86c:CubicReg
e86d:QuartReg
e86e:LogReg
e86f:ExpReg
e870:abExpReg
e871:PowerReg
e872:SinReg
e873:LogisticReg
e874:OneVariable
e875:TwoVariable
e876:DispStat
e877:StatGraph
e878:StatGraphSel
e879:Scatter
e87a:xyLine
e87b:NPPlot
e87c:Histogram
e87d:MedBox
e87e:ModBox
e87f:MeanBox
e880:NDist
e881:Broken
e882:LinearR
e883:MedMed
e884:QuadR
e885:CubicR
e886:QuartR
e887:LogR
e888:ExpR
e889:abExpR
e88a:PowerR
e88b:SinR
e88c:LogisticR
e88d:Square
e88e:Cross
e88f:Ldot
e890:Dot
e891:DrawStat
e892:MultiSortA
e893:MultiSortD
e894:DispListEditor
e895:SetSmryTable
e896:VWin
e897:DefaultListEditor
e898:OneSampleZTest
e899:TwoSampleZTest
e89a:OnePropZTest
e89b:TwoPropZTest
e89c:OneSampleTTest
e89d:TwoSampleTTest
e89e:LinRegTTest
e89f:ChiTest
e8a0:TwoSampleFTest
e8a1:OneWayANOVA
e8a2:TwoWayANOVA
e8a3:OneSampleZInt
e8a4:TwoSampleZInt
e8a5:OnePropZInt
e8a6:TwoPropZInt
e8a7:OneSampleTInt
e8a8:TwoSampleTInt
e8a9:NormPD
e8aa:NormCD
e8ab:InvNorm
e8ac:TPD
e8ad:TCD
e8ae:ChiPD
e8af:ChiCD
e8b0:FPD
e8b1:FCD
e8b2:BinomialPD
e8b3:BinomialCD
e8b4:PoissonPD
e8b5:PoissonCD
e8b6:GeoPD
e8b7:GeoCD
e8b8:Off
e8b9:On
e8ba:SetDispGCon
e8bb:SetStatWinAuto
e8bc:SetAxes
e8bd:SetAxes3D
e8be:SetBG
e8bf:Box
e8c0:SetCellWidth
e8c1:SetComplex
e8c2:SetCoord
e8c3:SetCoordOff3D
e8c4:SetCoordPol3D
e8c5:SetCoordRect3D
e8c6:SetDecimal
e8c7:SetDegree
e8c8:SetDeriv
e8c9:SetFix
e8ca:SetFunc
e8cb:SetGrid
e8cc:DispQutTbl
e8cd:SetLabel
e8ce:SetLabel3D
e8cf:SetLeadCursor
e8d0:SetNormal
e8d1:SetRadian
e8d2:SetReal
e8d3:SetSci
e8d4:SetSequence
e8d5:SetSimulGraph
e8d6:SetStandard
e8d7:DispDQTbl
e8d8:Setìxdisp
e8d9:OpenComPort38k
e8da:CloseComPort38k
e8e2:DefaultSetup
e8e3:DispFibTbl
e8e4:StepDisp
e8e5:SetTVariable
e8e6:TableInput
e8e7:DelFolder
e8e8:DelVar
e8e9:GetFolder
e8ea:GetType
e8eb:Local
e8ec:Lock
e8ed:MoveVar
e8ee:NewFolder
e8ef:Rename
e8f0:SetFolder
e8f1:Unlock
e8f2:CopyVar
e8f3:LockFolder
e8f4:UnlockFolder
e8f5:RandSeed
e8f6:ChrToNum
e8f7:ExpToStr
e8f8:NumToChr
e8f9:StrJoin
e8fa:StrCmp
e8fb:StrInv
e8fc:StrLeft
e8fd:StrLen
e901:StrLwr
e902:StrMid
e903:NumToStr
e904:StrRight
e905:StrRotate
e906:StrShift
e907:StrSrc
e908:StrUpr
e909:GetKey
e90a:GetPen
e90b:Locate
e90c:Input
e90d:InputStr
e90e:InputFunc
e90f:Print
e910:ClrText
e911:DispText
e912:Message
e913:PrintNatural
e914:é
e915:Receive
e916:Send
e917:Define
e918:DrawConics
e919:Send38k
e91a:Receive38k
e91b:SetSmryTableQD
e91c:SetDrawCon
e91d:Clear_a_z
e91e:SetDrawPlt
e91f:SendVar38k
e920:GetVar38k
e921:DrawShade
e922:InvChiCD
e923:InvTCD
e924:InvFCD
e925:InvBinomialCD
e926:InvPoissonCD
e927:InvGeoCD
e928:InvNormCD
e929:Number
e92a:SetGrad
e92b:hypergeoPD
e92c:hypergeoCD
e92d:InvHypergeoCD
e92e:PmtBgn
e92f:PmtEnd
e930:DateMode365
e931:DateMode360
e932:PeriodsAnnual
e933:PeriodsSemi
e934:ChiGOFTest
e935:PTThin
e936:SetInequalityPlot
e937:SetSketchColor
e938:SetGraphColor
e939:LineType
e93a:ClrPict
e93b:ColorBlack
e93c:ColorBlue
e93d:ColorRed
e93e:ColorMagenta
e93f:ColorGreen
e940:ColorCyan
e941:ColorYellow
e942:Intersection
e943:Union
(The lists are identical on CP400 1.00 and CP400 2.00)
I'll be back!

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

Postby critor » Tue Jun 09, 2015 2:31 pm

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

Thank you very much.

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

Postby helder7 » Tue Jun 09, 2015 5:00 pm

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
SiO2 + CaCO3 ----------> CaSiO3 + CO2

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

Postby critor » Sun Jun 21, 2015 8:04 pm

Thank you very much Helder7 and Simon for your great help. :thumbup:
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.

Return to Calculator Hacking/Modding Discussions

Who is online

Users browsing this forum: No registered users and 1 guest