Edited by sentaro21, 25 October 2023 - 08:58 AM.
#681
Posted 23 October 2023 - 10:57 AM
#682
Posted 25 October 2023 - 02:18 PM
#683
Posted 26 October 2023 - 05:43 AM
Edited by sentaro21, 27 October 2023 - 03:54 AM.
#684
Posted 09 December 2023 - 12:05 PM
#685
Posted 10 December 2023 - 02:17 PM
\\fls0\root.bin
\\fls0\FOLDER\file.bin
When I have a PROGRAM.g1m in SMEM:
16->Dim List 1 Load("/root.bin")->List 1 Load("/DATA/file.bin)->List 1This works fine.
However, when I have this program in Main Mem, it fails on line 3 (load from folder)
I put most programs in Main Mem to reduce flash wear and I can also recover programs if I accidentally delete them.
To resolve this I used BFile syscalls, but that is a bit annoying as it leaks file handles sometimes because I forget a BFile_Close syscall somewhere.
#686
Posted 10 December 2023 - 02:39 PM
If I create a list with N->Dim List 1, is it guaranteed that List 1 is a contiguos memory area of N elements? And when exactly does C.Basic move pointers around? I noticed that clearing a list/mat/vec sometimes causes reallocation of other lists/vecs/mats, even creating strings can cause that (probably because Mat r has to be reallocated). This cause headaches because some programs tend to break because they hold a reference to a list while that has already been moved. Is it possible to pin/fix a list in place? Maybe something like
{1,2,3,4}->Fixed List 1.L &List 1->A 16->Dim Fixed List 2.B &List 2->B 'A, B still point to the same location, even if other things have been allocated/deallicated in the meantime SysCall(_SCmemcpy,B,A,16) '_SCmemcpy is set to 0x1DD0 or 0xACF depending on calculator
Edited by HappyCalc, 10 December 2023 - 02:40 PM.
#687
Posted 10 December 2023 - 07:20 PM
@sentaro21
Thanks for the update. FKeyMenu is finally customizable simply by numerical expressions instead of bunch of Ifs
I noticed a few bugs in the new version:
- In FX version, the cursor in file manager does not fully cover the current line.
- Pressing
while Hist pop-up is shown in C.Basic catalog goes back to program editor instead of only closing the pop-up.
Also, thanks for uploading more old C.Basic versions on e-Gadget! But it seems like CBASIC099o1.zip in your archive is corrupted. (^^;
#688
Posted 11 December 2023 - 10:06 AM
#689
Posted 14 December 2023 - 05:13 AM
Dear Sentaro, I am happy to see you again here. I worked with C.Basic all the time. Half a year ago, I switched to the most up-to-date model Graph 90+E, which is a close sibling to the CG-50. I love the white housings, where I can read the symbols easier.
Using it I detected, that battery life is much longer.
I update C.basic today.
Edited by piu58, 14 December 2023 - 05:28 AM.
#690
Posted 15 December 2023 - 04:33 AM
#691
Posted 15 December 2023 - 05:34 AM
Dear sentaro and all, my most advanced project is the simulation of an open cluster with the calculator. If you let a bunch of stars do what they want, you see interesting effects. Which occur in reality too
- development of a dense core and a halo
- some of the stars escape
- you get double stars, which generate energy = velocity for the other stars
Double stars are a remarkable numerical problem, because I have a time step control. The simulation of double stars requires small time steps.
I changed my comments into English, but I let the changed version not run. May be you have to eliminate tiny problems lie a missing ' or so.
The program recommends 50 stars, but I worked with larger numbers too.
The first such calculations were done by Sebastian Hoerner starting around 1951 with very few bodies. Sverre Aarseth dedicated all of his professional life to that problems. His Fortran programs are very advanced and freely available.
Here is a wiki site to the problem.
https://en.wikipedia.../N-body_problem
~
If you run the program you get a graph with the traces of the stars. In the top line is given:
time (ahead the .)number of escaper (after the .)Wkin/Wpot, that is the relation kinetic to potential energy
'ProgramMode:RUN 'nbody, Open and galactic clusters. Leapfrog method. ' Stop for looking at results: line 236 R/S ' w0=|r| w1=|v| r0-2=Koor v0-2:velocity ' t = sqrt(rrr/Gm) t*. 't(Mio.a)=sqrt(6.4rrr/m) r/Ly m/mS Goto M 'Main Lbl i'init ClrGraph 0->X 0->Y 1->G 2->l 'Limit for escapers 10->N "N"?N 1->Q 1->M 0.136*Sqrt(N)->W'Relax. 30->S "final time"?S 0.03->J'use J=0.03 for balance between accuracy and calculation time "J"?J 1->g 0.1*Sqrt(1/N)->d 0.05/(N^.333)->a'Plummer radius reduces creation of double stars {N,3}->Dim Mat r {N,3}->Dim Mat v {N,3}->Dim Mat w {N,3}->Dim Mat a {N,3}->Dim Mat b {N,1}->Dim Mat m 'Startwerte 0->i While i<N 0->R 0->V For 0->j To 2 Ran#->Z 2Q*(Z-0.5)->r[i,j] R+r[i,j]^<2>->R Ran#->Z 2*(Z-0.5)->v[i,j] V+v[i,j]^<2>->V Next SqrtR->R SqrtV->V If (R<Q) And (V<1) M/N->m[i] i+1->i IfEnd WhileEnd Gosub b 'baryz R 'virialisieren Gosub k Gosub p Sqrt(2*K/P)->c For 0->i To N-1 For 0->k To 2 v[i,k]/c->v[i,k] 'virial. 0->v[i,k] 'cc Next Next Gosub B'baryz V Gosub a'first acceleration here Return Lbl g'Grafik For 0->i To N-1 Blue Plot r[i,0]/Q,r[i,1]/Q Next Return Lbl a'acceleration For 0->p To N-1 For 0->k To 2 a[p,k]->b[p,k] 0->a[p,k] Next Next 0->B For 0->p To N-1 For p+1->q To N-1 Sqrt((r[p,0]-r[q,0])^<2>+(r[p,1]-r[q,1])^<2>+(r[p,2]-r[q,2])^<2>)->R R(RR+aa)->E For 0->k To 2 G*(r[q,k]-r[p,k])/E->A a[p,k]+m[q]*A->a[p,k] a[q,k]-m[p]*A->a[q,k] Next'k Next'q Sqrt((a[p,0]-b[p,0])^<2>+(a[p,1]-b[p,1])^<2>+(a[p,2]-b[p,2])^<2>)->j Sqrt(a[p,0]^<2>+a[p,1]^<2>+a[p,2]^<2>)->A If j/A>B j/A->B IfEnd Next'p d->D If B>0 J/B*d->D IfEnd Return Lbl p'Wpot 0->P For 0->i To N-1 For i+1->j To N-1 0->R For 0->k To 2 (r[i,k]-r[j,k])^<2>+R->R Next Sqrt(R)->R P+m[i]*m[j]/R->P Next Next Return Lbl k'Wkin 0->K For 0->i To N-1 v[i,0]^<2>+v[i,1]^<2>+v[i,2]^<2>->V K+m[i]/2*V->K Next Return Lbl b'baryzentrisch R 0->x:0->y:0->z:0->L For 0->i To N-1 {i,x,r[i,0]} m[i]*r[i,0]+x->x m[i]*r[i,1]+y->y m[i]*r[i,2]+z->z m[i]+L->L Next For 0->i To N-1 r[i,0]-x/L->r[i,0] r[i,1]-y/L->r[i,1] r[i,2]-z/L->r[i,2] Next Return Lbl B'baryzentrisch V 0->x:0->y:0->z For 0->i To N-1 v[i,0]+x->x v[i,1]+y->y v[i,2]+z->z Next For 0->i To N-1 v[i,0]-x/N->v[i,0] v[i,1]-y/N->v[i,1] v[i,2]-z/N->v[i,2] Next Return Lbl l'Leapfrog1 For 0->i To N-1 For 0->k To 2 v[i,k]+a[i,k]*d/2->w[i,k] Next Next For 0->i To N-1 For 0->k To 2 r[i,k]+w[i,k]*d->r[i,k] Next Next Gosub a For 0->i To N-1 For 0->k To 2 w[i,k]+a[i,k]*d/2->v[i,k] Next Next Return Lbl L'Leapfrog While t<=T Gosub l t+d->t If g>0.1 D->d IfEnd WhileEnd Return Lbl G'Init graf ClrGraph:CoordOff:AxesOff:GridOff:LabelOff:S-L-Normal:Rad:'#_SketchThin _ '_AxesOn_ ' x0 x\1 dx y0 y\1 dy ViewWindow (-)7.2,7.2,1,(-)4,4,1 Return 'Print.XY / Grafik Lbl P Text 1,9," " Text 1,9,X Text 1,179,Y Return 'Stop Lbl S Plot :Text 1,1,">"Disps While Getkey<>31:WhileEnd'exit=47 Text 1,1," " Plot : Return Lbl M Gosub G Gosub i 1000->o "number of outputs"?o Gosub g 0->X Gosub P S/o->s'values for output 0->t While t<S t+s->T If (T>S) S->T IfEnd Gosub L Gosub g t->X Gosub P 0->n ' escaper For 0->i To N-1 r[i,0]^<2>+r[i,1]^<2>+r[i,2]^<2>->R v[i,0]^<2>+v[i,1]^<2>+v[i,2]^<2>->V SqrtR->R SqrtV->V R->w[i,0] Vc->w[i,1] 0.6->w[i,2] ' (O)=place (G)=velocity R>l=>n+1->n Next t->X Gosub k Gosub p 100*n+K/P->Y Gosub P 'R//S for looking at the results in w0,1 n>N/10-0.5=>Stop WhileEnd Gosub S Stop
Edited by piu58, 15 December 2023 - 09:47 AM.
#692
Posted 15 December 2023 - 05:35 AM
@Sentaro21
Well, I managed to fix the CBASIC099o1.zip using WinZip and successfully retrieved most of its files. Suprisingly the g1a file is also saved and works as usual. Some of its source files are lost, but anyway I uploaded it on my Mediafire driver.
I am working on C.Basic version documentation, so I have to trace every C.Basic version you have released and see what exactly you have changed in each of them, as well as making some sort of table like this : https://imgur.com/a/vXixVMC (credits to Minecraft Wiki)
#693
Posted 18 December 2023 - 06:10 AM
#694
Posted 29 May 2024 - 11:38 AM
wow, this program is amazing although i wont be able to test it yet, I am amazed by how much effort is still put into making these prograams!
#695
Posted 06 June 2024 - 04:51 PM
It changes the pocket calculator into a real programming system.
#696
Posted 04 August 2024 - 09:48 AM
Hi everyone
Since January this year I have participated in the development of C.Basic. During these months I have set up the Git page for C.Basic and documented all known bugs there.
A while ago Lephenixnoir and I did research on the inferior floating-point arithmetic performance of GCC when compared to Renesas SHC compiler. The conclusion is that the current GCC configuration still use an older software FPU library `fp-bit` for sh-elf, while other targets have switched to a newer one called `soft-fp`. The benchmark results show that the build with `soft-fp` is faster than the one with SHC. As such, I began to port C.Basic FX to fxSDK and GCC. The N-Queens results validate the performance uplift.
The new update for FX Edition (v2.50 build 1) has been published. Click the link below to check the full changelogs and download the latest version. If you find any bugs, please report here or in the Git bug tracker
https://git.planet-c...ases/tag/2.50.1
Thanks, CalcLoverHK
Edited by CalcLoverHK, 11 August 2024 - 05:43 AM.
#697
Posted 08 August 2024 - 11:31 AM
I am currently unable to test the latest CBASIC update. But I will be very grateful to you for your help in clarifying some of the problems associated with the development of this project.
Here are my stupid questions.
1) 1.012040->X: Int(10^4×Frac(10^2×FracX))
Ans=2040 . Does CBASIC v.2.50 return the correct result in this example?
2) Do the deltaList, Cuml, Percent and Prod functions work in CBASIC now?
3) Do trigonometric functions in Integer mode work correctly?
4) If the number of nested For or While loops exceeds the number 7 (seven), will the program run in the latest version of CBASIC?
5) In the fx-9860gii-2 model, the BackLight 1 (On) command has an unpredictable duration: either infinity or time set in manual settings. The BackLight 2 (Change) command has the same defect. The BackLight 3 (Off) command does not work at all.
6) If the program was started from the /ABC folder, can it call the program from any other folder that was saved in flash memory? For example, from the /DEF folder? In ti-83+/84+ and in ti-89T/v200 it is very easy to do, and I can work with huge databases that exceed the size of RAM.
The 8-Queens benchmark is a very limited test that does not reflect the actual capabilities of the calculator. In other tests, we will get different results. In some calculations, for example, the fx-9750g+ (4.3 MHz) is faster than even the hp-50g (75 MHz).
Using one non-standard command in 8-queens benchmark in CBASIC, even in older versions, already gives a result for fx-9860gii-2 of 0.4_sec (29 MHz) without any code optimization.
(OffTopic). One of my recent projects is the study of chess algorithms on graphing calculators. 8×8 board - Fischer random chess and Contemporary random chess. 9×9 board - Modern random chess (MRC by Jose M Carrillo) and some variations on this theme. To my great disappointment, I still haven`t seen any successful chess software for HP-Prime (400 MHz). It is very strange that even a cheap cellphone priced at $25 (100 MHz) can play chess well (ChessMaster.jar or KasparovChess.jar) and reproduce much more complex programs than modern calculators can do. (OffTopic).
I wish success in your work to all fans of CASIO calculators.
Edited by Hlib2, 08 August 2024 - 04:56 PM.
#698
Posted 08 August 2024 - 02:52 PM
Here`s how it might look in CBASIC:
... BASIC code ... : CheckOff : ... BASIC code ... : CheckOn : ... BASIC code.
The CheckOn/Off mode can be added to the list of general application settings with the ability to check the current status: CheckOnState (0 or 1).
#699
Posted 09 August 2024 - 07:37 PM
Hi Hlib2, glad to see you coming back. To be honest, I was kinda concerned about your situation as you offlined for 2 years and you happened to be in Ukraine which we all know what is happening. Regardless though, stay safe .
1) 1.012040->X: Int(10^4×Frac(10^2×FracX))
Ans=2040 . Does CBASIC v.2.50 return the correct result in this example?
It still outputs 2039 which is obviously incorrect. Unfortunately this seems to be the case of inaccuracy of floating-point arithmetic which is nearly impossible to deal with properly. In this case the actual value has an offset of -2.273736754*10^-13, but this value is unpredictable and there is no feasible way to find the correction value to compensate the error.
2) Do the deltaList, Cuml, Percent and Prod functions work in CBASIC now?
Only Prod function works for now.
3) Do trigonometric functions in Integer mode work correctly?
Nope, and it would be worthless to implement them in integer version, after all they are meant for calculation involving fractions and the integer mode will truncate the result, making it inaccurate. However, if you really want to use them in your program running in integer mode, you can first add '#CBDBL before them and get back to integer mode by '#CBINT later. To save the non-integer results, append # to variable like sin 30->A#. Note that you have to refer this variable as "A#" because it is a floating-point type which is different from A% (integer variable A).
4) If the number of nested For or While loops exceeds the number 7 (seven), will the program run in the latest version of CBASIC?
It will not run as it results in Nesting ERROR due to the design constraints below. I do agree this design is inflexible and there should be idealy 1 macro defining the stack limit, instead of equally allocating the stack area to these loop structures.
#define StackGotoMax 10+26+2+6+26 #define StackGosubMax 16 #define IfCntMax 32 #define StackForMax 7 #define StackWhileMax 7 #define StackDoMax 7 #define StackSwitchMax 7
5) In the fx-9860gii-2 model, the BackLight 1 (On) command has an unpredictable duration: either infinity or time set in manual settings. The BackLight 2 (Change) command has the same defect. The BackLight 3 (Off) command does not work at all.
"BackLight 3" should be "BackLight 0". I was able to reproduce the issue. Since backlight duration is RTC-driven, apparently the RTC timer stopped updating while C.Basic was displaying "Done", hence the infinity. However, if you enable Exec TimeDsp and press
to show execute time, the timer operated as usual and backlight can automatically turn itself off. Not sure why this happens.
6) If the program was started from the /ABC folder, can it call the program from any other folder that was saved in flash memory? For example, from the /DEF folder? In ti-83+/84+ and in ti-89T/v200 it is very easy to do, and I can work with huge databases that exceed the size of RAM.
C.Basic is unable to call program in different folder for now as the support of viewing subfolders is incomplete.
Another idea related to the running of the CBASIC interpreter. To speed up the calculator, I suggest adding a command that temporarily cancels checking for all errors in each program statement (syntax, matching data types, correct array sizes, etc.). On your own risk, as assembler-code fragments inside BASIC program in ti-89T/84+(with appropriate libraries) or in hp-49g +/50g.
Here`s how it might look in CBASIC:
... BASIC code ... : CheckOff : ... BASIC code ... : CheckOn : ... BASIC code.
The CheckOn/Off mode can be added to the list of general application settings with the ability to check the current status: CheckOnState (0 or 1).
Good idea, though for the command part it can be '#ERR0/1 to maintain compatibility with Casio Basic. Idealy, I think instead of disabling error checking, it would be better to seperate it entirely from C.Basic function implementations and leave that to debug mode only.
Thanks for your suggestions!
Edited by CalcLoverHK, 11 August 2024 - 05:37 AM.
- Hlib2 likes this
#700
Posted 14 August 2024 - 10:13 AM
1) 1.012040->X: Int(10^4×Frac(10^2×FracX))
Ans=2040 . Does CBASIC v.2.50 return the correct result in this example?
The calculatotor an casio basic use BCD coding of floating point numbers. So all the decimal numerals were preserved.
C.basic uses a binary represention. The preservation of decimal places is not assured. If you want the correct answer you shave to use
Int(0.5+10^4*Frac(10^2*Frac x))
You have to do this in almost all programming languages.
Do trigonometric functions in Integer mode work correctly?
Integers are not thought for triconometric functions. I don't see a reason for using this.
#701
Posted 15 August 2024 - 10:31 AM
This is a very clear and detailed explanation of current issues. I appreciate your help!
@ piu58
Yes, this is a useful way. In CBASIC, we also need to check the results more carefully and avoid dangerous constructions.If you want the correct answer you have to use
Int(0.5+10^4*Frac(10^2*Frac x))
You are absolutely right. In integer mode √A and #√A, ln A and #ln A, e^A and #e^A run normally, but sin A without # gives Syntax ERROR. Obviously, this makes some sense.Integers are not thought for triconometric functions. I don`t see a reason for using this.
#702
Posted 31 August 2024 - 02:29 PM
Hi all
A new bugfix update for FX Edition (v2.50 build 2) has been published. Click the link below to check the full changelogs and download the latest version.
https://git.planet-c...ases/tag/2.50.2
The GCC port for CG Edition is still underway. Although we have managed to compile the build, it has several critical ABI issues and crash points. Please wait until we are able to fix most of them for now.
Thanks for your patience.
- CalcLoverHK
#703
Posted 20 October 2024 - 04:47 AM
Hi all
Build 3 for FX Edition 2.50 has been published. This version mainly contains refactoring changes that bring down the add-in size
https://git.planet-c...ases/tag/2.50.3
- CalcLoverHK
(Update)
A floating-point performance regression has been discovered in the previous version. Please install the patched version below.
https://git.planet-c...es/tag/2.50.3.1
Edited by CalcLoverHK, 20 October 2024 - 08:00 PM.
Also tagged with one or more of these keywords: Casio Basic C.Basic
General →
Your Projects →
Inside Casio Basic is now to be preparedStarted by Krtyski , 02 Dec 2016 Casio Basic C.Basic |
|
|
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users