! File:parc-10-Params.s
! Illustrates passing 10 parameters
! ===================================================
        .section ".text"
        .global main
        .global Stop, End

!    x = add10( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 );

        .section ".text"
        .global main
        .global Stop, End

!       First 6 parameters are passed through o0... o6
!       Last 4 parameters are stored in the stack - we need 4 x 4 = 16 words

main:   save    %sp, -(92 + 16 + 4), %sp    !  4 bytes pad because
					    !  %sp must be div. by 8


	mov 1, %o0 		! first parameter 
	mov 2, %o1 		! second parameter 
	mov 3, %o2 		! third parameter 
	mov 4, %o3 		! fourth parameter 
	mov 5, %o4 		! fifth parameter 
	mov 6, %o5 		! sixth parameter 


	mov 7, %l0
	st %l0, [%sp+92] 	! seventh parameter 
	mov 8, %l0
	st %l0, [%sp+96] 	! eigth parameter 
	mov 9, %l0
	st %l0, [%sp+100] 	! ninth parameter 
	mov 10, %l0
	st %l0, [%sp+104] 	! tenth parameter


	call Add10
	nop

	add	%o0, %g0, %o1
        sethi   %hi(Str),%o0
        add     %o0,%lo(Str),%o0
        call    printf
	nop

Stop:
	ret 
	restore
End:
	.section ".data"
Str:   .ascii  "x = %d\n\0"