IBM Basic assembly language and successors: Difference between revisions

Content deleted Content added
add assembler coding form
Assembler instructions: "USING" (TMI? feel free to delete this)
Line 96:
 
===Assembler instructions===
Assembler instructions, sometimes termed [[Assembly language#Assembly directives|directives]], pseudo operations or pseudoops on other systems, are requests to the assembler to perform various operations during the code generation process. For instance, <code>CSECT</code> means "start a section of code here"; <code>DSECT</code> provides data definitions for a structure, but generates no code; <code>DC</code> defines a constant to be placed in the object code.
 
One of the more important assembler instructions is <code>USING</code>, which supports the truncated addressing of the S/360 architecture. It guides the assembler in determining what base register and offset it should use for a relative address. In BAL, it was limited to the form
Line 103:
USING base,reg-1,...,reg-n
</syntaxhighlight>
Machine instruction addresses specify a ''displacement'' (0–4095 bytes) from the value in a ''base register''. <code>USING</code> allows the programmer to tell the assembler that the specified base registers are assumed to contain the address of "base", base+4096 (if multiple registers are specified), etc. This only provides a shortcut for the programmer, who otherwise would have to specify the base register in each instruction. Programmers are still responsible for actually loading the address of "base" into reg-1 before writing code that depends on this value.
 
===Machine instructions (mnemonic)===