Omnimaga

Calculator Community => HP Calculators => Topic started by: supergems on May 08, 2015, 10:28:21 am

Title: HRAST BASIC for HP-48G/G+/GX, HP-49G and HP-49G+/50G
Post by: supergems on May 08, 2015, 10:28:21 am
From the author:

Quote
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

HRAST BASIC 48K
http://www.hrastprogrammer.com/hrastbas/hrast48k.zip
https://www.hpcalc.org/details/8906

HRAST BASIC 32K
http://www.hrastprogrammer.com/hrastbas/hrast32k.zip
https://www.hpcalc.org/details/8905

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

Details can be found in the official discussion on MoHPC forum:

http://www.hpmuseum.org/forum/thread-3774.html


Best regards :)
Title: Re: HRAST BASIC for HP-48G/G+/GX, HP-49G and HP-49G+/50G
Post by: TIfanx1999 on May 08, 2015, 10:40:46 am
That's pretty neat. I'll have to take a close look at it at some point. :D
Title: Re: HRAST BASIC for HP-48G/G+/GX, HP-49G and HP-49G+/50G
Post by: supergems on May 08, 2015, 11:36:15 am
It's very interesting to compare different programming languages benchmark on the HP 50g using the N-Queens Problem:

userRPL: 22.6s
HRAST Basic: 7.2s
sysRPL: 2.32s
HP Pascal Studio 2.1 / Cross Compiler: 0.895s
HP Pascal Studio 2.1 / Cross Compiler / Fast Mode x1.5 (75->203 MHz): 0.622s
newRPL: 0.106s
HPGCC 3.0 / RegVars / Cross Compiler / Slow Mode x12.7 (75->6.0 MHz): 0.00613s
Assembly / ARM9 @ 6.0 MHz / Slow Mode x13: 0.00524s
HPGCC 3.0 / RegVars / Cross Compiler: 0.000484s
Assembly / ARM9 @ 75 MHz: 0.000404s
Assembly / ARM9 @ 192 MHz / Fast Mode x2.7: 0.000150s
HPGCC 3.0 / RegVars / Cross Compiler / Fast Mode x2.5 (75->192 MHz): 0.000192s

userRPL
Code: [Select]
<<
  0.
  DO
    8. SWAP 1. +
    WHILE
      DUP2
      DO 1. -
      UNTIL
        DUP2 5. + PICK - ABS
        DUP2 - * NOT
      END
    REPEAT
      DROP
      WHILE SWAP DUP 1. SAME
      REPEAT -
      END
      1. - SWAP
    END
    DROP
  UNTIL DUP 8. SAME
  END
  ->LIST
 >>

HRAST Basic
Code: [Select]
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 ? S



Reference:

Calculator Speed Benchmark using the N-Queens Problem
http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/articles.cgi?read=700