Post Reply 
Summation based benchmark for calculators
02-18-2019, 11:13 PM (This post was last modified: 02-19-2019 05:58 PM by Jonathan Busby.)
Post: #165
RE: Summation based benchmark for calculators
Here is my summation code, mostly written in Saturn assembly for the HP48G/GX ( ROM version R ) :

Code:
::
    0LASTOWDOB!
    CK1NOLASTWD
    CK&DISPATCH1
    real    
    ::
        DUP
        % 1000000000
        %>=
        OVER
        % 0 
        %<=
        OR
        IT
        ::
            #203 ERRORSTO AtUserStack ERRJMP
        ;
        COERCE
CODE
speedup     EQU 0
ATANF       EQU #2B6FB
SINF        EQU #2B6E0
EXPF        EQU #2B6AA
GETANGMODE  EQU #2AEF6
!NROOTF     EQU #2B6CE
PUSH%%LOOP  EQU #2A235
ATTNFLG     EQU #807F7
                    

                    
        GOSBVL      =POP#
        GOSBVL      =SAVPTR
        C=A         A
        C=C-1       A
        GONC        no_error
        P=          0
        GOSBVL      =GETPTR
        LA(5)       #203
        GOVLNG      =Errjmp
no_error
        RSTK=C
        IF  speedup
        GOSUB       SPD1
        ENDIF

        GOSBVL  GETANGMODE
        GOSUB   +
        BSS         16
        BSS         16
+       C=RSTK
        D1=C
    
        C=0         W
        DAT1=C      W
        D1=D1+      16
        DAT1=C      W
        D1=D1-      16
        R4=C.F      W
-
        D0=(5)      ATTNFLG
        A=DAT0      A   
        ?A#0        A
        GOYES       onkeyexit1
onkeyexit1
        GONC        +
        GOTO        onkeyexit2
+       A=R4.F      W
        P=          15

        LC(1)       14
        C=C-A       P
        P=C         15
        C=0         W
        C=C+1       P
        SETDEC
        P=          14
        A=A+C       WP
        SETHEX
        GONC        noadjust              
        A=A+1       S
        P=          14
        ASR         WP
        LC(1)       1
        A=A+C       P
noadjust
        C=0         W
        C=A         S
        P=C         15
        C=0         W
        C=P         0



        R4=A.F      W
 
        B=A         W
        B=0         S
        A=C         W    
        P=          0
        SETDEC
        GOSBVL      ATANF
        GOSBVL      SINF
        GOSBVL      EXPF
        SETHEX
        C=0         W
        D=C         W
        P=          14
        LC(1)       3
        D=C         P
        P=          0
        C=0         W
        SETDEC
        GOSBVL      !NROOTF

        SETHEX                  
        C=DAT1      W
        D=C         W
        D1=D1+      16
        C=DAT1      W
        D1=D1-      16
                    
        CDEX        W
        SETDEC
        GOSBVL      =RADDF
        SETHEX
        DAT1=A      W
        C=B         W
        D1=D1+      16
        DAT1=C      W
        D1=D1-      16
        C=RSTK
        C=C-1       A

        GOC         +   
        RSTK=C
        GOTO        -
+


        IF  speedup
        GOSUB       SPD2
        ENDIF
        P=          0
        GOVLNG      PUSH%%LOOP  
onkeyexit2
        IF  speedup
        GOSUB       SPD2
        ENDIF
        P=          0
        GOVLNG      =GETPTRLOOP

SPD1
        GOSBVL      =DispOff
        INTOFF
        RTN
SPD2
        GOSBVL      =DispOn
        INTON
        RTN 
ENDCODE
    ;
;

The results are as follows :

*Display and keyboard scanning turned on*
  • 10 : 0.41739 seconds, result = 13.7118350167043
  • 100 : 4.31073 seconds, result = 139.297187045924
  • 1000 : 39.74079 seconds, result = 1395.34628774339
  • 10000 : 376.86231 seconds, result = 13955.8579042908

and

*Display and keyboard scanning turned off*

( Same long real numeric results as above )
  • 10 : 0.36663 seconds
  • 100 : 3.77957 seconds
  • 1000 : 34.81678 seconds
  • 10000 : 330.17057 seconds


I hope this helps.

Jonathan

EDIT : I have attached the HP48G/GX-R binary and the source as well.


Attached File(s)
.zip  savage_extended.zip (Size: 1.34 KB / Downloads: 7)

Aeternitas modo est. Longa non est, paene nil.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Summation based benchmark for calculators - Jonathan Busby - 02-18-2019 11:13 PM



User(s) browsing this thread: 45 Guest(s)