IBM Basic assembly language and successors: Difference between revisions

Content deleted Content added
Assembler instructions: "USING" (TMI? feel free to delete this)
add "code"..."/code" directives. Fix a link. Mis. I notice M44 info is basically in twice
Line 75:
The simplicity of machine instructions means that the [[source code]] of a program written in assembler will usually be much longer than an equivalent program in, say, [[COBOL]] or [[Fortran]]. In the past, the speed of hand-coded assembler programs was often felt to make up for this drawback, but with the advent of optimizing compilers, [[C (programming language)|C]] for the mainframe, and other advances, assembler has lost much of its appeal. IBM continues to upgrade the assembler, however, and it is still used when the need for speed or very fine control is paramount. However, all of the IBM successors to BAL have included a sophisticated macro facility that allows writing much more compact source code.
 
Another reason to use assembler is that not all operating system functions can be accessed in high level languages. The application program interfaces of IBM's mainframe operating systems is defined as a set of assembly language "macro" instructions, that typically invoke [[Supervisor Call instruction|Supervisor Call]] (<code>SVC</code>) [e.g., on z/OS] or Diagnose (<code>DIAG</code>) [on, e.g., z/VM] instructions to invoke operating system routines. It is possible to use operating system services from programs written in high-level languages by use of assembler subroutines.
 
==Assembler statement format==
Line 131:
</syntaxhighlight>
 
Generally accepted standards, although by no means mandatory, include the identification of general purpose registers with mnemonics. Unlike assemblers for some other systems, such as [[X86 assembly language]], register mnemonics are not reserved symbols but are defined through <code>EQU</code> statements elsewhere in the program. This improves readability of assembler language programs and provides a cross-reference of register usage. Thus typically you may see the following in an assembler program:
 
<syntaxhighlight lang="text">
Line 142:
<!-- Couldn't use <code> within {{efn}}. -->
 
System/360 machine instructions are one, two, or three [[Word (computer architecture)#siizeSize families|halfwords]] in length (two to 6 bytes). Originally there were four instruction formats, designated by the first two bits of the operation code field; [[z/Architecture]] added additional formats.
 
===Macros and conditional assembly===
Line 148:
 
===Operating system macros===
Most programs will require services from the [[operating system]], and the OS provides standard macros for requesting those services. These are analogous to [[Unix]] [[system call]]s. For instance, in [[MVS]] (later z/OS), <code>STORAGE</code> (with the <code>OBTAIN</code> parameter) dynamically allocates a block of memory, and <code>GET</code> retrieves the next logical record from a file.
 
These macros are operating-system-dependent; unlike several higher-level languages, IBM mainframe assembly languages don't provide operating-system-independent statements or libraries to allocate memory, perform I/O operations, and so forth, and different IBM mainframe operating systems are not compatible at the system service level. For example, writing a sequential file would be coded differently in z/OS and in z/VSE.
Line 265:
Assembler H runs on [[OS/360 and successors]]; it was faster and more powerful than Assembler F, but the macro language was not fully compatible.
 
Assembler H Version 2 was announced in 1981 and includes support for Extended Architecture (XA), including the <code>AMODE</code> and <code>RMODE</code> directives.<ref>{{cite book|last=IBM Corporation|title=MVS/Extended Architecture Conversion Notebook|year=1984|url=http://bitsavers.trailing-edge.com/pdf/ibm/370/MVS_XA/GC28-1143-2_MVS_EA_Conversion_Notebook_May84.pdf}}</ref>{{rp|p.3–28}} It was withdrawn from marketing in 1994 and support ended in 1995. It was replaced by High Level Assembler.<ref>{{cite web|last=IBM Corporation|title=5668-962 IBM Assembler H Version 2 Release 1.0|date=20 December 1996|url=http://www-01.ibm.com/common/ssi/cgi-bin/ssialias?infotype=dd&subtype=sm&appname=ShopzSeries&htmlfid=897/ENUS5668-962|accessdate=October 8, 2012}}</ref>
 
===Assembler XF===
Line 301:
...
</syntaxhighlight>
}} <code>USING</code> statements, a list of USING statements currently active, an indication of whether a variable is read or written in the cross-reference, and allowing mixed-case symbol names.<ref>{{cite web
| title = IBM HIGH LEVEL ASSEMBLER/MVS & VM & VSE
| id = 292-244
Line 310:
| accessdate = October 8, 2012
}}
</ref> The ''<code>RSECT</code>'' directive (Read-only Control Section) allows the assembler to check reentrancy on a per-section basis. <code>RSECT</code> was previously "undocumented and inconsistently implemented in Assembler H."<ref>{{cite book|last=IBM Corporation|title=IBM High Level Assembler for MVS & VM & VSE Release 2 Presentation Guide|year=1995|url=http://www.redbooks.ibm.com/redbooks/pdfs/sg243910.pdf|url-status=dead|archiveurl=https://web.archive.org/web/20160123064644/http://www.redbooks.ibm.com/redbooks/pdfs/sg243910.pdf|archivedate=2016-01-23}}</ref>{{RP|p.43}}
 
====High Level Assembler Toolkit====
Line 332:
 
===IBM System/360 TSS assembler===
The assembler for the [[TSS/360|System/360 Model 67 Time Sharing System]] has a number of differences in directives to support unique TSS features. The <code>''PSECT''</code> directive generates a ''Prototype Control Section'' containing relocatable address constants and modifiable data used by the program.<ref>{{cite book|last=IBM Corporation|title=IBM Time Sharing System Assembler Programmer's Guide|year=1976|url=http://bitsavers.informatik.uni-stuttgart.de/pdf/ibm/360/tss/GC28-2032-6_Time_Sharing_System_Assembler_Programmers_Guide_Apr76.pdf}}</ref>{{rp|p.143}}
 
==Non-IBM assemblers==