Compile-time calculation: Difference between revisions
Content added Content deleted
PatGarrett (talk | contribs) (→{{header|360 Assembly}}: Section added) |
PatGarrett (talk | contribs) m (→{{header|360 Assembly}}: Superfluous blanks suppressed) |
||
Line 13: | Line 13: | ||
=={{header|360 Assembly}}== |
=={{header|360 Assembly}}== |
||
First example with the assembler equivalence pseudo instruction (EQU): |
First example with the assembler equivalence pseudo instruction (EQU): |
||
<lang 360asm> |
<lang 360asm>COMPCALA CSECT |
||
COMPCALA CSECT |
|||
L R1,=A(FACT10) r1=10! |
L R1,=A(FACT10) r1=10! |
||
XDECO R1,PG |
XDECO R1,PG |
||
Line 20: | Line 19: | ||
BR R14 exit |
BR R14 exit |
||
FACT10 EQU 10*9*8*7*6*5*4*3*2*1 factorial computation |
FACT10 EQU 10*9*8*7*6*5*4*3*2*1 factorial computation |
||
PG DS CL12 |
PG DS CL12</lang> |
||
</lang> |
|||
{{out}} in the assembler listing ( 375F00 hexadecimal of 10!) |
{{out}} in the assembler listing ( 375F00 hexadecimal of 10!) |
||
<pre> |
<pre> |
||
Line 31: | Line 29: | ||
</pre> |
</pre> |
||
Second example with an assembler macro instruction: |
Second example with an assembler macro instruction: |
||
<lang 360asm> |
<lang 360asm> MACRO |
||
MACRO |
|||
&LAB FACT ®,&N parameters |
&LAB FACT ®,&N parameters |
||
&F SETA 1 f=1 |
&F SETA 1 f=1 |
||
Line 53: | Line 50: | ||
PG DS CL12 |
PG DS CL12 |
||
YREGS |
YREGS |
||
END COMPCALB |
END COMPCALB</lang> |
||
</lang> |
|||
{{out}} in the assembler listing |
{{out}} in the assembler listing |
||
<pre> |
<pre> |
||
Line 61: | Line 57: | ||
+ L R1,=A(3628800) load reg with factorial |
+ L R1,=A(3628800) load reg with factorial |
||
</pre> |
</pre> |
||
=={{header|Ada}}== |
=={{header|Ada}}== |