[TT# 1592][t] Improve test for open opcode delegation. All tests in the file pass...
[parrot.git] / examples / subs / pasm_sub1.pasm
blob39d5490a0cf6c313d95c1b41c50d61900a41d921
1 # Copyright (C) 2001-2005, Parrot Foundation.
2 # $Id$
4 =head1 NAME
6 examples/subs/pasm_sub1.pasm - Parrot calling conventions
8 =head1 SYNOPSIS
10     % ./parrot examples/subs/pasm_sub1.pasm
12 =head1 DESCRIPTION
14 Sample subroutines in Parrot assembler.
15 Shows you how to create a C<.Sub> and C<invokecc> it.
17 = TODO
19 Examples for parameter passing.
21 =head1 SEE ALSO
23 F<docs/ops/core.pod>
24 F<docs/pdds/pdd03_calling_conventions.pod>
26 =cut
28     # Fetch a subroutine objec
29     .const 'Sub' P0 = "_sub"
31     # Call the sub in argument, create return continuation
32     invokecc P0
34     # got here, because the sub invoked the return continuation
35     print "Hello from main\n"
37     end
39 # A subroutine
40 .pcc_sub _sub:
41     print "Hello from subroutine\n"
43     # Call the return continuation
44     returncc
46 # Local Variables:
47 #   mode: pir
48 #   fill-column: 100
49 # End:
50 # vim: expandtab shiftwidth=4 ft=pir: