
;
;   Assembler test of procedure calling conventions.  Also used as a
;   generalized timing test program.
;


        .base   200

data1:  .long   100
data2:  .long   200

count:  .long   ^d50000

        .base   400

main:   mtpr    #1,#VAX$PR_TODR     ;   Make sure the time-of-day is initialized


        movl    @#count, r2         ;   Inialize the loop counter

loop:   jsb     test
        decl    r2
        bneq    loop

        mfpr    #VAX$PR_TODR, r0    ;   Get the time-of-day value in R0
        mtpr    #0,#VAX$PR_TODR     ;   And turn off the time-of-day clock
        
        halt
        
test:   pushl   @#data1             ;   Push the first addend
        pushl   @#data2             ;   Push the second addend
        calls   #2,@#addsub         ;   Call the add routine
        rsb                         ;   Done, result in R0


;
;   Add routine, takes two parameters from stack and return 
;   sum in R0

addsub: .entry  <r2>                ;   Save scratch register

        movl    b^4(ap), r2         ;   Get first operand
        addl2   b^8(ap), r2         ;   Add in second operand
        movl    r2, r0              ;   Store in return value
        ret                         ;   All done


        .end    main
        
