; ; test_tst0_call_a_subroutine.rta ; =============================== ; ; The program demonstrates a subroutine call. ; ; There are no multiple name spaces and no linking. ; A subroutine is only a copied source text. ; ; MAIN PROGRAM ; ; Data ; _name Call~a~subroutine _var a ; input value _var x ; output value _var return ; return address variable ; ; Code ; input a Enter~a~number mov .a a ; give the parameter to the sub ; ---------------------------- mov return $call_up ; save the return address jump $up ; call the subroutine $call_up: ; label to mark the return address ; ---------------------------- nop 1 ; 1st instruction after return nop 2 mov x .a output x The~3rd~root exit nop nop nop ; ; SUBROUTINE ; ; Data ; _var .a ; a point namespace ; ; Code ; $up: ; entry point root .a 3 ; Computes the 3rd root jump return ; jump return _end