HP Forums
Really really fast BASIC handheld - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: Not HP Calculators (/forum-7.html)
+--- Forum: Not quite HP Calculators - but related (/forum-8.html)
+--- Thread: Really really fast BASIC handheld (/thread-12144.html)

Pages: 1 2 3


RE: Really really fast BASIC handheld - berndpr - 01-12-2019 10:00 PM

Hallo!

1. You have to buy Smilebasic at the Nintendo Online Shop like a Game and download to the 2DS or 3DS. Actual version is 3.6.0.
The Nintendo New 2DS XL and 3Ds are released at 2017.
I think, this shows the progress of the handheld devices, but sadly our favorite hobby - calculators - are still years behind.
I have paid the same price as a TI-Nspire for the 2DS. But for gaming not for calculating.

Yes, I think too, SmileBasic was developed to program your own games.
The interpreter tells more than 8 MBytes are free!
But it must very fast, so many tasks like sprite, background screen and music is a own function in the multi cores of the ARM. And the calculation is fast, because it's using the buildin math coprocessor.

2. The input of programs are using a very complete virtual keyboard (full qwerty keyboard with many keys and using the shoulder keys as additional shift, auto offline help with command completing) on the touch screen (lower screen). If you are using a good stylus like I from an old PDA, for me the input is not slower as with HP-35S or TI-89.

Very important is the offline help of nearly all commands, because there many new one for grafic, sound etc. And the BASIC has his own dialect.

The output is by default the upper screen, but you can then define both screens together as one or as a second screen. And yes, there are commands for the buttons and touch screen.

The storage for programs is the SD card of the DS (128 GByte in my case).
It use is own directory system with sub directorys. The most programs are very small (only 100 Bytes -100 kByte). Only grafic and sound can use many storage. But SmileBasic has big liberries for music, sounds and grafics.

Here is script for 8 Queens unstructured (only 363 Bytes):
CLS
PRINT "8-Queen-Problem"
OPTION DEFINT
M=MAINCNT
K=1000
PRINT K;" times"
N=K
@L0
R=8
S=0
X=0
DIM A[9]
@L1
IF X==R GOTO @L5
INC X
A[X]=R
@L2
INC S
Y=X
@L3
DEC Y
IF Y==0 GOTO @L1
T=A[X]-A[Y]
IF T==0 GOTO @L4
IF X-Y!=ABS(T) GOTO @L3
@L4
DEC A[x]
IF A[X]!=0 GOTO @L3
DEC X
IF X!=0 GOTO @L4
@L5
DEC N
IF N>1 GOTO @L0
PRINT S
PRINT FORMAT$("%5.4F sec",(MAINCNT-M)/60)

What you see here, is exactly the same as in the BASIC editor!
I have used the original code with the labels @L0 until @L5, because SmileBasic doesn't know command line numbers. Compares are like C with == and !=.
MAINCNT are the vsyncs from start of BASIC (60 per secondes).
N is the counter for the outer loop (here 1000).
DEC ind INC are the decrement and increment commands.
OPTION DEFINT: all variable are integers (floating point numbers are only slightly slower!).
CLS is clear screen, not clear variables!

I have tried some simplification like IF X GOTO or IF !X GOTO and the DIM A[9] outside the outer loop, but this version here is the fastest!

I hope there no errror, because the DS is not using an interface to a PC. I have to type in the code. This is for me no problem. I like it to stop programming by closing the DS. This stops all things in the DS and if I open the DS, everything starts without any delay exactly before closing. It depends not if a program is runnig or the editor/IDE is been used.

I don't know it's using a byte code interpreter, but after RUN the program starts immediatly. But the SmileBasic makes some error checks before execute the commands (errors immediatly after RUN) and some error checks if commands are executed.

Some words to MicroPython in Numworks and Casio FX-CG50.
It is not the real Python, but a reprogrammed special version to be fast and small enough for micro controllers. And as fare as I see, SmileBasic is round 10 times faster as on numworks and FX-CG50.

Some different:
I have seen some benchmark test on the raspberry pi with compiled codes. This is more faster. I have seen a prototype of a kind of calculator with raspberry pi zero at youtube. But the full version 3B+ of the pi could be one of the fasted handheld. But I don't know, if anybody uses this for a homebrew calculator.
Does anybody of you know about this?

Bernd
P.S.: Sorry for the typos!
P.P.S.: Code edit because of errors. Sorry!


RE: Really really fast BASIC handheld - mfleming - 01-13-2019 12:59 AM

(01-12-2019 09:41 PM)StephenG1CMZ Wrote:  Actually, on one of the sites it was suggested that the SD cards are encrypted... Someone even wrote a cassette modem type program to transfer files as audio as a workaround. So editing on a PC might not be straightforward.
https://smilebasicsource.com/forum?ftid=7

Like the idiot I am, I spent most of the afternoon researching this question before placing an order for a New 3DS XL. On the same web site you reference is a 3DS program that can export and import unencrypted SmileBASIC files to and from the SD card. The 3DS has WiFi, and Nintendo provides a means to wirelessly transfer files to a PC over the local network (3DS appears in a Windows file browser under the Network folder). There is also a Notepad++ file for editing a BASIC program with syntax highlighting.

Man, you should have heard the dumb reasons I used to justify the purchase! Wink Thanks Bernd for introducing me to a new time and money waster (I'm sure I'll have fun with the games though)
~Mark


RE: Really really fast BASIC handheld - Stevetuc - 01-13-2019 08:37 AM

According to this link there are a couple of ports of Python to 3DS on github:

https://www.reddit.com/r/3dshacks/comments/5afpr3/what_ever_happened_to_the_python_interpreter_for

One is for Python 2.7 and possibly also 3.0, the other micropython.
There doesn't seem to have been much activity since 2016 but it may be a good starting point.


RE: Really really fast BASIC handheld - pier4r - 01-13-2019 09:55 AM

(01-12-2019 10:00 PM)berndpr Wrote:  Hallo!

1. You have to buy Smilebasic at the Nintendo Online Shop like a Game and download to the 2DS or 3DS. Actual version is 3.6.0.
The Nintendo New 2DS XL and 3Ds are released at 2017.
I think, this shows the progress of the handheld devices, but sadly our favorite hobby - calculators - are still years behind.

I don't agree on this. In fact I think you have got it backwards.

While I welcome that gaming devices - that are really fast because games are at times complicated and not so optimized - open up to programming with friendly ides, it was not often the case.

Playstation, ps2, ps3, xbox equivalents, nintendo console equivalents and other consoles after the 5th generation (n1) had enough hardware to support friendly programming (that is, with an intuitive ide). So from 1994 if not earlier this was an option. But no one is going to invest resources if there is no audience for them.

Only recently programming is becoming mainstream so people like to try it as a game. But if the IDE is not there, the fast hardware is practically unusable.

Instead calculators are meant for math. So one can use them to find solutions from day 1.
The solution time of a problem is not only the running time of the program, but also the time to develop it. If one is not able to develop a solution on a faster hardware due to missing tools, the solution time is practically infinite. Paper and pen is faster than that.

Due to the solution time including the developing time, I also see it as silly when someone claims that a friendly basic IDE on a gaming platform is already better than prime, nspire, 50g or even the 71B . This because for common operations the simple IDE may be enough, matching a scientific calculator, but what about less common ones?

can you show numbers as fractions easily? like 0.125 is 1/8 . My sharp el506w from 2002 does it quickly.

I bet you have to write a function for that and I bet everyone else has to as well as there is not yet a centralized way to share programs (like a forum or a repository). Something like this: https://smilebasicsource.com/page?pid=1210 but more organic and systematic.

Can you do operations on angles (and similarly with time) seen as degrees minutes
seconds?
say 5d 3m 2s + 0d 58m 96s = 6d 2m 38s

Sure you can, but you need to build a function for it. Part of the solution time. Even fixes for bugs are part of the solution time.
Can you invert a matrix? I bet you need to define a function for it as well.

Can you find roots? For many mathematical functions the el506w or even the hp 34c, can.
And so on.

So at the end of the day either you program your math library (a nice project), or if you are not prepared the chances are that for not so common operations someone with a prime/50g/nspire/ti89/71b/what you have gets the answer months before you.

So no, as long as I don't see a proper math library for smilebasic on the 2DS (or equivalent combinations), easy to set up and use for everyone having the platform (that is, actually it should be like "download this"), those platforms are tens of years back the most advanced calculators.

And I didn't touch the problem of the missing input interface. If we have to compute many single multiplications inputting numbers, with a simple calculator I'm faster than you on the 2ds with smile basic.

So: careful to mistake execution speed as silver bullet. I talk from experience as I learned through pain how much value a good ready made math library holds. For this I still use the 50g and RPL. The thingy is amazing.

n1: https://en.wikipedia.org/wiki/Video_game_console


RE: Really really fast BASIC handheld - xerxes - 01-13-2019 02:56 PM

(01-12-2019 10:00 PM)berndpr Wrote:  I have tried some simplification like IF X GOTO or IF !X GOTO and the DIM A[9] outside the outer loop, but this version here is the fastest!

Thanks for your effort. I think pier4r is right with not accepting it as a calculator, but it's very close to a pocket computer
or similar devices like the organizers from Psion, Sharp and Casio or the HP-200LX.

(01-12-2019 10:00 PM)berndpr Wrote:  I don't know it's using a byte code interpreter, but after RUN the program starts mmediatly.

It starts immediately, because compiling the source to byte code takes a few msec only. Even the PB-2000C (8-bit, 0.91 MHz) needs around
1 second only to compile the C code to bytecode, if I remember correctly. IMHO the test result is too fast to be token interpreted.

(01-12-2019 10:00 PM)berndpr Wrote:  And as fare as I see, SmileBasic is round 10 times faster as on numworks and FX-CG50.

I think it's a relative good result for MicroPython, if we take into consideration that it's running at 59 MHz on the CG-50.

If your Casio SH-3/4 calculator feels too slow: Ftune and C.Basic


RE: Really really fast BASIC handheld - berndpr - 01-13-2019 08:08 PM

Hallo!

I have many calculators form Casio, HP, Sharp and TI , much more to use all them in one year. There are pocket BASIC calculators (like Casio FX-702P, TI-74 BASICALC, SHARP PC-E500S, without matrix operation, complex numbers etc. and CAS, Grafic calculator like HP-48GX, TI-89, FX-CG20 and normal calculator like the Casio FX-991DE, TI-30Pro or the HP 35S without matrix calculation.

It's my hobby. Like many other people in this forum.

And I don't see a big different for programming the old pocket BASIC calculator and the DS. The most grafical problems of me doesn't needs any advanced big libaries. The most annoying thing is waiting of many minutes for the results. It's fun, if I press a button changing values and the results is seen like a film.

And I prefer a device which is easy to transport and easy to use at any place.
A PC is bulky, only at one place useable and complicate to start and to stop.

Therefore I have a notebook and small devices which I can use at boring situation like waiting by the doctor (in Germany more than 2 hours are possible).

I use SmileBasic for fast grafic programs (like mandelbrot, Ulam spiral etc.).
For calculating small problems I can use a scientific calculator app on the DS called Calculator from Cinemax (from the Nintendo store too). The touch button on the screen are big enough for using fingers.

My criteria for a good device is:
All inside (editor, compiler, interpreter etc.)
Fast start and stop (less than second after closing/switch off and open /switch on).
Fast execute
Easy programming (Sorry, editing C and compiling at a PC and send to a device is not easy)
Easy to transport (No, Notebooks doesn't fit in a shirt pocket. )
Additional features (like grafic, gaming, Internet, CAS etc.)

I have expand the 8-Queen program to show all 92 solutions and how the algorythm works with the A list. If anybody interested I can post the program here.

Bernd


RE: Really really fast BASIC handheld - xerxes - 01-13-2019 08:30 PM

(01-13-2019 08:08 PM)berndpr Wrote:  I have expand the 8-Queen program to show all 92 solutions and how the algorythm works the A list. If anybody interested I can post the program here.

Yes, would be interesting to take a look at it.


RE: Really really fast BASIC handheld - pier4r - 01-13-2019 08:40 PM

(01-13-2019 08:08 PM)berndpr Wrote:  Hallo!

I have many calculators, much more to use all them in one year.
It's my hobby. Like many other people in this forum.

And I prefer a device which is easy to transport and easy to use at any place.
A PC is bulky, only at one place useable and complicate to start and to stop.

That's totally fine, and it is great you share with us!

Only the classification of the device and other comparisons (such as <prime, nspire & co are behind>) may receive objections .

For the rest I like the idea of smilebasic, go for it!


RE: Really really fast BASIC handheld - Luigi Vampa - 01-13-2019 09:37 PM

A new little toy to play with:
uLisp (micro Lisp) badge (computer)
http://www.hpmuseum.org/forum/thread-12181.html


RE: Really really fast BASIC handheld - berndpr - 01-13-2019 10:03 PM

Hallo!
Here I show the 8-Queen-Problem with addtional feature to show all changes in A and all 92 solutions.

CLS
PRINT "8-Queen-Problem with all solutions"
OPTION DEFINT
N=0
R=8
S=0
X=0
DIM A[9]
@LA
IF X==R GOTO @LE
INC X
A[X]=R: SHOW S,A
@LB
INC S
Y=X
@LC
DEC Y
IF Y==0 GOTO @LA
T=A[X]-A[Y]
IF T==0 GOTO @LD
IF X-Y!=ABS(T) GOTO @LC
@LD
DEC A[x]:SHOW S,A
IF A[X]!=0 GOTO @LB
DEC X
IF X!=0 GOTO @LD
@LE
IF A[1]==0 GOTO @LF
INC N
ZEIG S,A
PRINT
PRINT N;" .Solution=;S ; " Pos:";
FOR I=1 TO 8
PRINT CHR$(64+A[I]);I;
IF I!=8 THEN PRINT ",";
NEXT
BUTOFF
GOTO @LD
@LF
LOCATE 1,15
PRINT "FINISHED"
END

DEF SHOW S,A
LOCATE 1,2
BUTON
PRINT S
PRINT " A B C D E F G H"
FOR I=1 TO 8
J=A[I]
PRINT J;" ";I;
IF J>0 THEN
PRINT " ."*(J-1);" ";CHRS$(&H2640);" ."*(8-J);
ELSE
PRINT " ."*8;
ENDIF
PRINT " ";I
NEXT
END

DEF BUTON
REPEAT
B=BUTTON()
UNTIL B!=0
IF B==#A THEN VSYNC 3 'only to slow down display or output is faster than the eye.
IF B==#B THEN STOP
END

DEF BUTOFF
BUTON
REPEAT
B=BUTTON()
UNTIL B==0 || B==#X

END

Button B quits the program.
The program runs only, if a key is pressed.
If you press the button X the program progress until the button is released. It stops not at the next solution.

Hold Button A to progress slowly and stops at the next solution.
Any other Button progress fast and stops at next solution.
For next solution release button and hold again.

DEF is define a function
END is end program or end function
BUTTON() return the bits of the pressed hardware keys.
#X is the number (bit) of key X
|| is an OR
N is the number of the solution
"ABC"*3 is a string repeat: "ABCABCABC"
CHRS$(&H2640) is the venus symbol (queen). It's a Unicode value.
If the value in A is a zero, no queen is shown.

This version was developed for Yabasic (PS2 BASIC from the demo cd of the first release, available for PC Windows and Linux too, http://www.yabasic.de/) and is not optimized for speed but use exact the 8-Queen-Benchmark. I have changed it to SmileBASIC (not big changes).

I hope this will help you
Bernd

P.S.:
I have corrected errors in the code and changed the button control.


RE: Really really fast BASIC handheld - xerxes - 01-13-2019 11:20 PM

(01-12-2019 10:00 PM)berndpr Wrote:  Here is script for 8 Queens unstructured (only 363 Bytes):
CLS
PRINT "8-Queen-Problem"
OPTION DEFINT
M=MAINCNT
K=1000
PRINT K;" times"
N=K
@L0
R=8
S=0
X=0
DIM A[9]
@L1
IF X==R GOTO @L5
INC X
A[X]=R
@L2
INC S
Y=X
@L3
DEC Y
IF Y==0 GOTO @L1
T=A[X]-A[Y]
IF T==0 GOTO @L4
IF X-Y!=ABS(T) GOTO @L3
@L4
DEC A[x]
IF A[X]!=0 GOTO @L3

@L4
DEC A[X]
IF A[X]!=0 GOTO @L2
DEC X
IF X!=0 GOTO @L4
@L5
DEC N
IF N>1 GOTO @L0
PRINT S
PRINT FORMAT$("%5.4F sec",(MAINCNT-M)/60)

I've noticed a bug in your test code. The 3 lines after the first @L4 label are surely an oversight
and don't allow to have the node count of S=876. I assume that the code of your 2DS is correct.


RE: Really really fast BASIC handheld - berndpr - 01-14-2019 07:28 PM

(01-13-2019 11:20 PM)xerxes Wrote:  I've noticed a bug in your test code. The 3 lines after the first @L4 label are surely an oversight
and don't allow to have the node count of S=876. I assume that the code of your 2DS is correct.

Hello Xerxes!
Yes, you are right.
Thank you for your help. I have corrected the code.

Bernd


RE: Really really fast BASIC handheld - StephenG1CMZ - 10-16-2019 10:30 PM

I was thinking of splashing out on a Nintendo 2DS and Smilebasic, but this page
http://smilebasic.com/en/buynow/
Says Smilebasic is exclusively for 3DS (not the 2DS or the Switch, apparently).

I could risk a Nintendo 2DS and Smilebasic, but it might no longer be supported... And the Smilebasic has to be downloaded.
An alternative actually available on the High Street is the Casio Cg50, with a version of micropython (but no graphics from Python) and a "C.Basic" that is downloadable - but that is far less common.


RE: Really really fast BASIC handheld - Csaba Tizedes - 10-18-2019 02:08 PM

Hmm..., user definable functions are available - OK. This is good enough. Thanks, I will check it. Is there a FORTRAN to BASIC stuff somewhere?!

Csaba


RE: Really really fast BASIC handheld - toml_12953 - 10-18-2019 04:53 PM

(01-13-2019 10:03 PM)berndpr Wrote:  Hallo!
Here I show the 8-Queen-Problem with addtional feature to show all changes in A and all 92 solutions.

CLS
PRINT "8-Queen-Problem with all solutions"
OPTION DEFINT
N=0
R=8
S=0
X=0
DIM A[9]
@LA
IF X==R GOTO @LE
INC X
A[X]=R: SHOW S,A
@LB
INC S
Y=X
@LC
DEC Y
IF Y==0 GOTO @LA
T=A[X]-A[Y]
IF T==0 GOTO @LD
IF X-Y!=ABS(T) GOTO @LC
@LD
DEC A[x]:SHOW S,A
IF A[X]!=0 GOTO @LB
DEC X
IF X!=0 GOTO @LD
@LE
IF A[1]==0 GOTO @LF
INC N
ZEIG S,A
PRINT
PRINT N;" .Solution=;S ; " Pos:";
FOR I=1 TO 8
PRINT CHR$(64+A[I]);I;
IF I!=8 THEN PRINT ",";
NEXT
BUTOFF
GOTO @LD
@LF
LOCATE 1,15
PRINT "FINISHED"
END

DEF SHOW S,A
LOCATE 1,2
BUTON
PRINT S
PRINT " A B C D E F G H"
FOR I=1 TO 8
J=A[I]
PRINT J;" ";I;
IF J>0 THEN
PRINT " ."*(J-1);" ";CHRS$(&H2640);" ."*(8-J);
ELSE
PRINT " ."*8;
ENDIF
PRINT " ";I
NEXT
END

DEF BUTON
REPEAT
B=BUTTON()
UNTIL B!=0
IF B==#A THEN VSYNC 3 'only to slow down display or output is faster than the eye.
IF B==#B THEN STOP
END

DEF BUTOFF
BUTON
REPEAT
B=BUTTON()
UNTIL B==0 || B==#X

END

Button B quits the program.
The program runs only, if a key is pressed.
If you press the button X the program progress until the button is released. It stops not at the next solution.

Hold Button A to progress slowly and stops at the next solution.
Any other Button progress fast and stops at next solution.
For next solution release button and hold again.

DEF is define a function
END is end program or end function
BUTTON() return the bits of the pressed hardware keys.
#X is the number (bit) of key X
|| is an OR
N is the number of the solution
"ABC"*3 is a string repeat: "ABCABCABC"
CHRS$(&H2640) is the venus symbol (queen). It's a Unicode value.
If the value in A is a zero, no queen is shown.

This version was developed for Yabasic (PS2 BASIC from the demo cd of the first release, available for PC Windows and Linux too, http://www.yabasic.de/) and is not optimized for speed but use exact the 8-Queen-Benchmark. I have changed it to SmileBASIC (not big changes).

I hope this will help you
Bernd

P.S.:
I have corrected errors in the code and changed the button control.

In order to be able to accurately compare the benchmark time to other calculators in the test, you'd have to remove the DEFINT if it causes all variables to be integer. The other units use floating point (except the assembler examples, probably).


RE: Really really fast BASIC handheld - Csaba Tizedes - 04-18-2020 11:04 AM

Something new (?):





Cs.


RE: Really really fast BASIC handheld - toml_12953 - 04-18-2020 04:48 PM

(01-13-2019 09:55 AM)pier4r Wrote:  So at the end of the day either you program your math library (a nice project), or if you are not prepared the chances are that for not so common operations someone with a prime/50g/nspire/ti89/71b/what you have gets the answer months before you.

So no, as long as I don't see a proper math library for smilebasic on the 2DS (or equivalent combinations), easy to set up and use for everyone having the platform (that is, actually it should be like "download this"), those platforms are tens of years back the most advanced calculators.

There's a Python 3 interpreter for 3DS XL or 2DS XL that includes the entire Python standard library including math, cmath, etc.

https://github.com/vbe0201/3DS.py


RE: Really really fast BASIC handheld - toml_12953 - 04-18-2020 08:36 PM

(01-09-2019 04:03 PM)berndpr Wrote:  Hallo,

I tried something from which I have never expacted to be much much faster as the HP Prime.

And it's using interpreted BASIC on a small handheld:

SmileBASIC 4 will be coming out on May 23 2020. It's advertised to be 10x faster than SmileBASIC 3!


RE: Really really fast BASIC handheld - mfleming - 04-19-2020 01:34 AM

(04-18-2020 04:48 PM)toml_12953 Wrote:  There's a Python 3 interpreter for 3DS XL or 2DS XL that includes the entire Python standard library including math, cmath, etc.

https://github.com/vbe0201/3DS.py

Thanks for the reference!

(04-18-2020 04:48 PM)toml_12953 Wrote:  SmileBASIC 4 will be coming out on May 23 2020. It's advertised to be 10x faster than SmileBASIC 3!

But only for the Switch, if I'm not mistaken. Not exactly pocket-sized, but it does look like you can use a keyboard and mouse with it. Assuming you can find a Switch Smile


RE: Really really fast BASIC handheld - Stevetuc - 05-12-2020 07:58 AM

Quote:There's a Python 3 interpreter for 3DS XL or 2DS XL that includes the entire Python standard library including math, cmath, etc.

https://github.com/vbe0201/3DS.py

There is a port of the Numworks calculator to 3DS or 2DS on Github
https://github.com/numworks/epsilon/pull/1528

This also brings Python in a more accessible way if the port is working well . Ill load the .3dsx onto my N3DS XL and give it a try.