HP Forums
SATURN BASIC for HP-48G/G+/GX, HP-49G and HP-49G+/50G - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: SATURN BASIC for HP-48G/G+/GX, HP-49G and HP-49G+/50G (/thread-3774.html)

Pages: 1 2 3


RE: HRAST BASIC for HP-48G/G+/GX, HP-49G and HP-49G+/50G - Massimo Gnerucci - 12-14-2016 06:17 PM

(12-14-2016 06:04 PM)Vtile Wrote:  No problem at all, I truely think that it were unjustified ban. While I somehow understand those wikipedia actives.

Thank you.
Ban cancelled.


RE: HRAST BASIC for HP-48G/G+/GX, HP-49G and HP-49G+/50G - pier4r - 04-26-2017 05:50 AM

I'm not sure this is gravedigging, this was at page 38 of 81 in the general forum but it is a great work from hrast programmer,

As far as I understood hrast basic behaves like a library on the hp 48,49,50. Is it coded in native code (with assembly or hpgcc) or sysrpl?

I read of a user wanting basic on the 50g, I guess Alvaro, but he missed this work.


RE: HRAST BASIC for HP-48G/G+/GX, HP-49G and HP-49G+/50G - HrastProgrammer - 04-26-2017 07:57 AM

(04-26-2017 05:50 AM)pier4r Wrote:  I'm not sure this is gravedigging, this was at page 38 of 81 in the general forum but it is a great work from hrast programmer

Thanks!

Quote:As far as I understood hrast basic behaves like a library on the hp 48,49,50.

No, it is a code object which you send to the calculator, store to a variable and run from there. The reason I didn't put it into library is because I use some self-modifying code to fixup lots of address at startup, so I can use absolute addressing no matter where the interpreter has been loaded into memory. I am not sure it would work correctly with libraries.

Quote:Is it coded in native code (with assembly or hpgcc) or sysrpl?

The good old pure machine language, with the exception of some SysRPL code during initialization Smile


RE: HRAST BASIC for HP-48G/G+/GX, HP-49G and HP-49G+/50G - pier4r - 04-26-2017 11:07 AM

Nice, I may try it among my explorations with the 50g (although newRPL is also great).

I hope you put it also on hpcalc.org or something that is visible, I saw this thread because I'm reading this forum from the start (80+ pages are not too much since I skip a lot of specific content for other calculators), but a normal user may not see it at all.

On hpcalc.org one can at least check the programming section for 48,49,50 series and without visibility, in a world that spams information, even nice works get unnoticed (at least until someone has the proper search string with a proper search engine).


RE: HRAST BASIC for HP-48G/G+/GX, HP-49G and HP-49G+/50G - HrastProgrammer - 04-26-2017 11:28 AM

(04-26-2017 11:07 AM)pier4r Wrote:  I hope you put it also on hpcalc.org or something that is visible

It won't happen, I am afraid, because I want only one download location for all my software, so only the latest versions are available for download and I can update them immediately when I need. Uploading something to hpcalc.org and then waiting for days or (sometimes) weeks for it to show up is really out of the question. All my software on hpcalc.org is from the time when I didn't have my own website yet.


RE: HRAST BASIC for HP-48G/G+/GX, HP-49G and HP-49G+/50G - StephenG1CMZ - 05-05-2017 07:10 AM

(05-03-2015 05:50 PM)HrastProgrammer Wrote:  It makes me very happy to announce the availability of my HRAST BASIC high-level programming language, interpreter and development environment for HP-48G/G+/GX, HP-49G and HP-49G+/50G calculators. This isn't really an ordinary BASIC as used to be on various home and pocket computers. It is inspired by BASIC but in many aspects it is more like Pascal, C, COMAL or Forth (internally). I've been working on it for quite some time and I have now come to the point where it is stable enough to be released to the public for the first time. This is the culmination of my work as far as HP/calculator development is concerned and I must admit that I am very proud of it. The final result is "the BASIC as I always wanted it to be" because I was never really satisfied with the choice of development tools available on HP calculators.

As far as I know, this is the first and only BASIC interpreter made for any HP calculator after HP-71B released in 1983. And this is the first and only BASIC interpreter developed outside Hewlett-Packard for any HP calculator ever. Those facts make me even more proud and happy Smile

The first version was HRAST BASIC 32K because it should work on the basic HP-48G with 32K RAM only and after installing the emulator you can still (although barely) allocate a reasonable 8K of RAM for BASIC program and data. The feature set is fixed and no new features will be implemented for 32K version because I want it to stay under 20K. The final version is HRAST BASIC 48K which needs at least 48K of free RAM for normal work. Although I consider 48K version finished as well, there are still a few non-essential things left to be implemented if/when time permits.

Three main goals during the development were to make it as powerful as possible, to make it as fast as possible and to use as little memory as possible. Those goals don't usually go very well together so every time I had to choose between speed and memory - I choosed speed. Furthermore, I wanted everything to be limited by the available memory only - there is no fixed expression stack, no fixed GOSUB/FOR/NEXT and PROC/FUNC stack, expressions can be as complex as you want, you can call subprograms/procedures/functions as deeply as you want, you can have as many nested control structures as you want, etc, etc. This system is very complex but works great and the result is very powerful and fast BASIC interpreter, comparable in complexity and speed to, for example, Acorn BBC B home computer which is well known for its great and very fast BASIC. And it is certainly much faster and much more powerful than all other BASICs on pocket computers and calculators. I made a lot of benchmarks and I will present some results here. The first benchmark is "8-Queens" problem as described on the following site:

http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/articles.cgi?read=700

HRAST BASIC running on HP-48GX finishes this benchmark in 16.4 seconds.
HRAST BASIC running on HP-49G+ finishes this benchmark in 7.2 seconds.

This makes it much faster than all other BASICs on this page except QBasic, Power, Turbo and Quick BASIC running on HP-200LX. The benchmark program is here, so you can get a picture how an optimized program for HRAST BASIC looks like (various strange details from this program will be explained throughout the manual):

Code:

CALL QUEEN,8
PROC QUEEN(INTEGER N) INTEGER A[N+1],D,S=1,X,Y A[1]=N
FOR X=2 TO N S> A[X]=N FOR Y=X-1 D=A[X]-A[Y]
IF NOT D OR X-Y=ABS D@ A[X]< WHILE NOT A[X]@ X< A[X]< ENDWHILE S> Y=X
NEXT NEXT ? A[1],A[2],A[3] ? A[4],A[5],A[6] ? A[7],A[8]

A little slower but more clear version of the same benchmark:

Code:

CALL QUEEN,8
PROC QUEEN(INTEGER N)
INTEGER A[N+1],D,S=1,X,Y: A[1]=N
FOR X=2 TO N: S=S+1: A[X]=N
FOR Y=X-1: D=A[X]-A[Y]
IF D=0 OR X-Y=ABS D@ {
_ A[X]=A[X]-1
_ WHILE NOT A[X]@ X=X-1: A[X]=A[X]-1: ENDWHILE
_ S=S+1: Y=X
}
NEXT: NEXT
? A[1],A[2],A[3]
? A[4],A[5],A[6]
? A[7],A[8]

I also executed all PCW home computer benchmarks (slightly modified for HRAST BASIC):

http://www.geocities.ws/peterochocki/computers/pcwbm.html
http://www.geocities.ws/peterochocki/computers/calbench/calcbms.html

REAL results for BM1..BM8 on HP-48GX are: 0.24s, 2.78s, 9.09s, 8.82s, 9.33s, 11.85s, 19.75s, 27.43s, Average = 11.16s

INTEGER results for BM1..BM8 on HP-48GX are: 0.24s, 1.78s, 5.58s, 5.64s, 6.14s, 8.66s, 15.83s, 26.64s, Average = 8.81s

REAL results for BM1..BM8 on HP-49G+ are: 0.07s, 1.97s, 6.03s, 6.08s, 6.41s, 7.75s, 11.70s, 17.92s, Average = 7.24s

INTEGER results for BM1..BM8 on HP-49G+ are: 0.07s, 0.73s, 2.37s, 2.49s, 2.81s, 3.99s, 7.49s, 16.83s, Average = 4.60s

Not bad for an ancient 4-bit CPU and the emulation of an ancient 4-bit CPU Smile

One of the reasons for such performance is because I avoided dynamic/heap memory allocation, fragmentation and garbage collection at all costs. Dynamic memory allocation needs copying/moving and copying/moving kills speed and performance. I hate garbage collectors, they are totally unpredictable. And if you don't leave garbage than you don't have to collect it, do you? That's why HRAST BASIC works a lot like FORTH internally. Actually, at first I intended to develop HRAST FORTH but I decided not to do it because I concluded that a more high-level language would be much more appropriate for practical use. FORTH is a great language but a little cumbersome to work with various data types: floating point numbers, complex numbers, strings, arrays, matrices, etc. But a lot of code I developed for HRAST FORTH made it into HRAST BASIC.

HRAST BASIC has no connection to the so-called HP BASIC available in HP-49G and HP-49G+/50G which is not BASIC at all, just an awkward algebraic wrapper over UserRPL. Furthermore, the interpreter doesn't use RPL operating system except some SysRPL code during the initialization and machine language math routines - there is really no need to reinvent the wheel here.

Please, keep in mind that HRAST BASIC is not a free software. I put a lot of my own time, knowledge and energy into this project, so I am expecting some compensation for those efforts. That's why I am releasing HRAST BASIC as shareware. It is not crippled or limited in any way and you can use it freely for 32 days. If you decide to use it after 32 days you have to make a fixed donation of 48 USD to my PayPal account (it is the same as my e-mail address). This amount covers the installation of both 32K and 48K versions on as many calculators as you want. It doesn't cover commercial or group usage (a single donation for the whole classroom, for example) - contact me by mail and we'll arrange something. HRAST BASIC is not a commercial product and I don't have a business which can sell it to you. So, I accept PayPal donations only - if this is not OK with you then, please, don't donate and don't use HRAST BASIC.

As with all my software, HRAST BASIC has that "HrastProgrammer's" way-of-working and look-and-feel which is not appealing to everyone because I developed it for myself in the first place. The feature set is fixed and I will not change anything in this regard, no matter how some features could look strange or quirky at first sight. I am sharing HRAST BASIC in the current form because such development tool/environment didn't exist before and it could possibly be helpful to someone else as well. But, if you don't like it or it doesn't work for you for whatever reason and don't want to use it after (or before) 32 days then just delete it, simple as that. Donations cannot be returned so think twice before donating. I didn't protect this software in any way and I will rely on the honesty of the users only Smile

OK, HRAST BASIC download is here:

32K version ... http://www.hrastprogrammer.com/hrastbas/hrast32k.zip

48K version ... http://www.hrastprogrammer.com/hrastbas/hrast48k.zip

The installation is very simple and is the same for all calculators. First, send the appropriate HRAST file (HRAST48, HRAST49 or HRAST50) containing the interpreter to the calculator and store it to a variable. Then send the appropriate RAMH file (RAMH48 for HP-48G/G+/GX and RAMH49 for HP-49G and HP-49G+/50G) to the calculator and store it to (another) variable. Put the number of BASIC kilobytes (BTW, no "kibibytes" and similar crap, please) needed and execute RAMH. This will create HRAST BASIC environment in form of an character string object of the required size (for example, 8 RAMH to create an 8K environment, minimum is 2K). Store this environment to the HRAM variable and start the interpreter by executing the variable where HRAST file has been stored. The interpreter will look for the HRAM variable in the current directory and (if it finds one and it was not already initialized) will initialize it and continue execution. If it doesn't find the HRAM variable an "Object Not in Port" error will be reported and the interpreter will abort execution.

Please, note that bugs are inevitable in such a complex piece of software, especially in such early state and under various "borderline" conditions, so watch for them and report them to me if you find any. I just hope I didn't make such a terrible mistakes like typing x=18.9 on Atari ST BASIC causing "function not yet done System error #%N, please restart" error ... So far, The interpreter has been tested on the following calculators: HP-48GX ROM version R, HP-49G ROM version 1.19-5, HP-49G+ ROM versions 1.23/2.15 and HP-50G ROM version 2.15. If you have problems running on other ROM versions report them to me as well and I will investigate. I reserve the right to mark a particular bug as "feature" or "by design" if I judge that something isn't really a bug or even if it is a bug but could somehow be useful. I also reserve the right to fix some bugs in 48K version only, due to the lack of space in 32K version.

In order to save space the interpreter is using an unsupported ROM font table entry on HP-48G/G+/GX. On HP-49G and HP-49G+/50G the system font table stored in RAM is used but I don't have any experience with alternate fonts on those calculators. So, in both cases there is a slight possibility that something can go wrong with different ROM versions or different calculator configurations. If something like this occurs then, please, report this to me.

The manual is here:

http://www.hrastprogrammer.com/hrastbas/HRAST_BASIC.pdf

It still leaves a few things to desire and I will update it when needed. This is a reference manual, not a book teaching BASIC language - the reader is expected to have a good programming knowledge in order to use HRAST BASIC and to understand the content of this manual. Please, report all errors to me so I can correct them. Also note that english is not my native language, so I will appreciate very much all corrections in regard to grammar, spelling, etc.

Enjoy Smile

Those "PCW Benchmarks" you linked to now have pop-ups: Apparently I won something...So didnt try to read any benchmarks Smile


RE: HRAST BASIC for HP-48G/G+/GX, HP-49G and HP-49G+/50G - HrastProgrammer - 05-05-2017 07:59 AM

(05-05-2017 07:10 AM)StephenG1CMZ Wrote:  Those "PCW Benchmarks" you linked to now have pop-ups: Apparently I won something...So didnt try to read any benchmarks Smile

As far as I remember, there were no popups when I wrote the manual. But those are not my pages anyway, and I cannot be responsible for popups. And it wasn't really necessary to quote the whole post just for this Wink


RE: HRAST BASIC for HP-48G/G+/GX, HP-49G and HP-49G+/50G - Massimo Gnerucci - 05-05-2017 03:40 PM

(05-05-2017 07:59 AM)HrastProgrammer Wrote:  And it wasn't really necessary to quote the whole post just for this Wink

Wink


RE: HRAST BASIC for HP-48G/G+/GX, HP-49G and HP-49G+/50G - pier4r - 03-13-2018 08:35 PM

So, upping an old thread (about a very good work)

I make it public as maybe someone else wants to chime in on the same point.

From this post
http://www.hpmuseum.org/forum/thread-10300-post-92955.html#pid92955

to this page
http://www.jeffcalc.hp41.eu/emu71/index.html#sforth

to this page
http://www.hrastprogrammer.com/hp71x/

to this page
http://www.hrastprogrammer.com/emulators.htm

From here learning that a lot of work of hrast programmer is not free (and mostly out of my budget). It is ok, but I can read about it, since it seems well done. Plus I like the idea of posting the mail as image,

to this link
http://www.hrastprogrammer.com/hrastbas/HRAST_BASIC.pdf

Now I address the Thread starter.

Quote:This is the culmination of my work as far as HP/calculator
development is concerned and I [...] Those
facts make me even more proud and happy!
I think that everyone that does a similar amount of work should (must) be proud of it. Indeed you even ask for a transaction, and that is good.

But then you say
Quote:Of course, this will be largely ignored by the community (if you don't
understand something than just ignore [...]) and I won't
never get any credits for this achievement [...]

I disagree with this. I agree that when people don't understand something (or the work needed for a result) then they cannot even cherish the person that did the work, exactly because they don't see it. But this happens, one should be prepared for it or should do marketing to inform the others how difficult was to produce the result. Expecting that people that are not interested become interested overnight is source of frustration.

Then I also think that many appreciate you work or would like to be able to do the same, even just in term of self discipline to follow through. At least I do. The problem is that due to the 1-9-90 rule many appreciate but without exposing the appreciation. If there would be "likes" maybe it would be more obvious. Like on reddit, there are post with 18000 likes and 2 comments, because people don't want to comment like "yeah, well done" (I do, indeed see my post count). But also, still on reddit, cat pictures are way more trendy than calculators, math or science submissions.

All this to say: kudos for the work and maybe it would help to think that many may appreciate your work without saying it.


RE: HRAST BASIC for HP-48G/G+/GX, HP-49G and HP-49G+/50G - Eric Rechlin - 03-14-2018 02:34 AM

(03-13-2018 08:35 PM)pier4r Wrote:  Like on reddit, there are post with 18000 likes and 2 comments, because people don't want to comment like "yeah, well done" (I do, indeed see my post count).

That's because doing so is against the rules on that site. Never comment to say things like "Great, upvoted". Just upvote, or leave a more insightful comment. Any comments saying such are supposed to be downvoted because they don't contribute to the discussion.


RE: HRAST BASIC for HP-48G/G+/GX, HP-49G and HP-49G+/50G - HrastProgrammer - 03-14-2018 07:38 AM

(03-13-2018 08:35 PM)pier4r Wrote:  But also, still on reddit, cat pictures are way more trendy than calculators, math or science submissions.

Today it's not even cat pictures anymore, but selfies and all that, I am afraid ...

Quote:All this to say: kudos for the work and maybe it would help to think that many may appreciate your work without saying it.

Thank you very much for the nice words, I appreciate this very much Smile


RE: HRAST BASIC for HP-48G/G+/GX, HP-49G and HP-49G+/50G - HrastProgrammer - 04-03-2019 07:07 AM

I am bumping this thread because I fixed two bugs in HRAST-BASIC: one related to implicit REAL/COMPLEX to INTEGER conversion and one about tokenizing/evaluating expressions entered with INPUT statement. For example, entering FN keyword alone turns the calculator off or some other strange things happen Smile

Those bugs were present in both 32K and 48K versions. No new version numbers are assigned, just re-download the latest versions.


RE: HRAST BASIC for HP-48G/G+/GX, HP-49G and HP-49G+/50G - Massimo Gnerucci - 04-03-2019 12:02 PM

Thanks for your continued support, Ž/Ж
Be well!


RE: HRAST BASIC for HP-48G/G+/GX, HP-49G and HP-49G+/50G - HrastProgrammer - 04-03-2019 02:11 PM

(04-03-2019 12:02 PM)Massimo Gnerucci Wrote:  Thanks for your continued support, Ž/Ж
Be well!

Smile


RE: SATURN BASIC for HP-48G/G+/GX, HP-49G and HP-49G+/50G - HrastProgrammer - 04-21-2023 09:22 AM

Hello!

I renamed HRAST-BASIC to SATURN BASIC because this name suits the interpreter better as it really is the "BASIC for SATURN CPU" and was never planned for any other architecture. I kept "HRAST" in filenames and URLs though, to avoid breaking the existing links.

HrastProgrammer