REXX Language implementation
This chapter has general information about writing programs in assembly language using the rxas assembler programs. It discusses the assembler file format, linkage conventions, and other useful programming information, including the \crexx{} level B feature which allows including assembly language statements in Rexx programs.
rxas commandThe assembler is started by invoking the rxas executable and takes options, which are specified before the name of the source file.
\small \immediate\write18{rxas -h > rxasoutput.txt} \VerbatimInput{rxasoutput.txt} \large
.rxbin file. The default is the name of the input file.The format of the source lines follows the general layout of assembly source, without fixed offsets. As most .rxas files will be generated by the rxc compiler from Rexx source, let’s have a quick look at what it looks like.
```rexx options levelb import rxfnsb
say “hello, rxas!” say “Today is” date()
The generated assembler source follows:
```rxas <!--hello.rxas-->
main() .locals=8
say "hello, rxas!"
load r1,5
call r7,date(),r1
sconcat r7,"Today is",r7
say r7
ret
date() .expose=rxfnsb.date
We can see that the first component of the lines are the procedure names or the instruction mnemonics ; this program has no labels. After the instructions, their parameters are placed.
It is recommended that a label starts in the first column of the line.1 The label needs to be ended by a colon (‘:’). Its purpose is to be a symbolic location to branch into when decisions are taken.
Procedure names are identifiers for routines in the program. Procedure main() carries a special role, as that is the one the VM runtime gives control to when a program is started.
rxas assemblerrxas is an optimizing assembler2 which can rearrange instructions or eliminate them entirely.
The assembler command enables the inclusion of arbitrary assembler instructions within a Rexx program. The compiler validates the instruction mnemonic and arguments, ensuring that variables are converted into the appropriate register number.
This example uses the linkarg assembler instruction with two variables and an integer constant.
assembler linkarg e,i,5