Paradigm | assembly language |
---|---|
Developer | IBM |
First appeared | 1964 |
OS | IBM Basic Programming Support, Basic Operating System/360 |
License | free |
Paradigm | macro assembly language |
---|---|
Developer | IBM |
First appeared | 1966 |
OS | IBM OS/VS, DOS/VS, VM/370 and related |
License | varied |
Paradigm | macro assembly language |
---|---|
Developer | IBM |
First appeared | 1992 |
Stable release | Version 1 Release 6 |
OS | IBM MVS/ESA and successors, VM/ESA and successors, VSE/ESA and successors |
License | proprietary |
Website | https://www.ibm.com/products/high-level-assembler-and-toolkit-feature |
Major implementations | |
High Level Assembler |
The IBM Basic assembly language and successors is a series of assembly languages and assemblers made for the IBM System/360 mainframe system and its successors through the IBM Z.
The first of these, the Basic Assembly Language (BAL), is an extremely restricted assembly language, introduced in 1964 and used on 360 systems with only 8 KB of main memory, and only a card reader, a card punch, and a printer for input/output, as part of IBM Basic Programming Support (BPS/360). The Basic Assembler for BAL was also available as part of Basic Operating System/360 (BOS/360).
Subsequently, an assembly language appeared for the System/360 that had more powerful features and usability, such as support for macros. This language, and the line of assemblers that implemented it, continued to evolve for the System/370 and the architectures that followed, inheriting and extending its syntax. Some in the computer industry referred to these under the generic term "Basic Assembly Language" or "BAL". [1] Many did not, however, and IBM itself usually referred to them as simply the "System/360 Assembler Language", [2] as the "Assembler" for a given operating system or platform, [3] or similar names. Specific assemblers were known by such names [lower-alpha 1] as Assembler E, Assembler F, Assembler H, and so forth. Programmers utilizing this language, and this family of assemblers, also refer to them as ALC (for Assembly Language Coding), or simply "the assembler".
The latest derived language is known as the IBM High-Level Assembler (HLASM).
As it is an assembly language, BAL uses the native instruction set of the IBM mainframe architecture on which it runs, System/360.
The successors to BAL use the native instruction sets of the IBM mainframe architectures on which they run, including System/360, System/370, System/370-XA, ESA/370, ESA/390, and z/Architecture.
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 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 (SVC
) [e.g., on z/OS] or Diagnose (DIAG
) [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.
The format of assembler language statements reflects the layout of an 80-column punched card, though successive versions have relaxed most of the restrictions.
Basic Assembly language also permits an alternate statement format with the statement starting in column 25, allowing the assembled instruction to be punched into the same card beginning in column 1. This option was not continued in later versions of the assembler.
Three main types of instructions are found in the source code of a program written in assembler.
Assembler instructions, sometimes termed directives, pseudo operations or pseudoops on other systems, are requests to the assembler to perform various operations during the code generation process. For instance, CSECT
means "start a section of code here"; DSECT
provides data definitions for a structure, but generates no code; DC
defines a constant to be placed in the object code.
One of the more important assembler instructions is USING
, which supports the base-displacement 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
USING base,reg-1,...,reg-n
Machine instruction addresses on S/360 specify a displacement (0–4095 bytes) from the value in a base register; while later versions of the architecture added relative-address formats, the older formats are still used by many instructions. USING
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 the register before writing code that depends on this value.
The related DROP
assembler instruction nullifies a previous USING
.
There is a one-to-one relationship with machine instructions. The full mnemonic instruction set is described in the Principles of Operation [4] manual for each instruction set. Examples:
* This is a comment line * Load the fullword integer stored at the * location labeled 'ZIGGY' into general register 3: L 3,ZIGGY SLA 4,5 shift the value in general register 4 left by 5 bits MVC TARGET,SOURCE move characters from location 'SOURCE' to 'TARGET' AP COUNT,=P'1' add 1 to value in memory location 'COUNT' (packed decimal format) B NEXT unconditional branch to label 'NEXT' HERE EQU * This is a label CLC TARGET,=C'ADDRESS' Compare memory location 'TARGET' to string 'ADDRESS' BE THERE branch if equal to program label 'THERE'
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 EQU
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:
R3 EQU 3 ... L R3,ZIGGY
Some notable instruction mnemonics are BALR
[lower-alpha 2] for a call storing the return address and condition code in a register, SVC
, [lower-alpha 3] DIAG
, [lower-alpha 4] and ZAP
. [5]
System/360 machine instructions are one, two, or three 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.
The Basic Programming Support assembler did not support macros. Later assembler versions beginning with Assembler D [6] allow the programmer to group instructions together into macros and add them to a library, which can then be invoked in other programs, usually with parameters, like the preprocessor facilities in C and related languages. Macros can include conditional assembler instructions, such as AIF
(an ‘if’ construct), used to generate different code according to the chosen parameters. That makes the macro facility of this assembler very powerful. While multiline macros in C are an exception, macro definitions in assembler can easily be hundreds of lines.
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 calls. For instance, in MVS (later z/OS), STORAGE
(with the OBTAIN
parameter) dynamically allocates a block of memory, and GET
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.
The following fragment shows how the logic "If SEX = 'M', add 1 to MALES; else, add 1 to FEMALES" would be performed in assembler.
CLI SEX,C'M' Male? BNE IS_FEM If not, branch around L 7,MALES Load current value of MALES into register 7 LA 7,1(7) add 1 ST 7,MALES store back the result B GO_ON Finished with this portion IS_FEM EQU * A label L 7,FEMALES Load current value in FEMALES into register 7 LA 7,1(7) add 1 ST 7,FEMALES store back the result GO_ON EQU * - rest of program - * MALES DC F'0' Counter for MALES (initially=0) FEMALES DC F'0' Counter for FEMALES (initially=0)
The following is the ubiquitous "Hello, World!" program, and would, executing under an IBM operating system such as OS/VS1 or MVS, display the words 'Hello, World!' on the operator's console:
HELLO CSECT The name of this program is 'HELLO' * Register 15 points here on entry from OPSYS or caller. STM 14,12,12(13) Save registers 14,15, and 0 thru 12 in caller's Save area LR 12,15 Set up base register with program's entry point address USING HELLO,12 Tell assembler which register we are using for pgm. base LA 15,SAVE Now Point at our own save area ST 15,8(13) Set forward chain ST 13,4(15) Set back chain LR 13,15 Set R13 to address of new save area * -end of housekeeping (similar for most programs) - WTO 'Hello, World!' Write To Operator (Operating System macro) * L 13,4(13) restore address to caller-provided save area XC 8(4,13),8(13) Clear forward chain LM 14,12,12(13) Restore registers as on entry DROP 12 The opposite of 'USING' SR 15,15 Set register 15 to 0 so that the return code (R15) is Zero BR 14 Return to caller * SAVE DS 18F Define 18 fullwords to save calling program registers END HELLO This is the end of the program
WTO
is an assembler macro that generates an operating system call. Because of saving registers and later restoring and returning, this small program is usable as a batch program invoked directly by the operating system Job control language (JCL) like this:
//EXECPGM=HELLO
or, alternatively, it can be CALLed as a subroutine from such a program:
CALL 'HELLO'
With the exception of the assemblers for the IBM System/360 Model 20, the IBM assemblers were largely upward-compatible. The differences were mainly in the complexity of expressions allowed and in macro processing. OS/360 assemblers were originally designated according to their memory requirements.
The assembler for BPS is the true "basic assembler." It was intended to be loaded from cards and would run on an 8 KB System/360 (except Model 20). It has no support for macro instructions or extended mnemonics (such as BH in place of BC 2 to branch if condition code 2 indicates a high compare). It can assemble only a single control section and does not allow dummy sections (structure definitions). Parenthesized expressions are not allowed and expressions are limited to three terms with the only operators being '+', '-', and '*'. [7] : 59–61
The Basic Operating System has two assembler versions. Both require 16 KB memory, one is tape resident and the other disk. [8] : 7–8
Assembler D was the DOS/360 assembler for machines with a memory size of 16 KB. It came in two versions: A 10 KB variant for machines with the minimum 16 KB memory, and a 14 KB variant for machines with 24 KB. An F-level assembler was also available for DOS machines with 64 KB or more. D assemblers offered nearly all the features of higher versions. [9] : 7
Assembler E was designed to run on an OS/360 system with a minimum of 32 KB of main storage, with the assembler itself requiring 15 KB. [10] : 2 Assembler F can run under either DOS/360 or OS/360 on a system with a 64 KB memory, with the assembler requiring 44 KB. [11] [12] [13] These assemblers are a standard part of OS/360; the version that was generated was specified at system generation (SYSGEN).
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 AMODE
and RMODE
directives. [14] : 3-28 It was withdrawn from marketing in 1994 and support ended in 1995. It was replaced by High Level Assembler. [15]
Assembler XF is a mostly compatible upgrade of Assembler F that includes the new System/370 architecture instructions. This version provides a common assembler for OS/VS, DOS/VS and VM systems. Other changes include relaxing restrictions on expressions and macro processing. Assembler XF requires a minimum partition/region size of 64 KB (virtual). Recommended size is 128 KB. [16] : 73
High Level Assembler or HLASM was released in June 1992 replacing IBM's Assembler H Version 2. [17] [18] It was the default translator for System/370 and System/390, and supported the MVS, VSE, and VM operating systems. As of 2023 it is IBM's current assembler programming language for its z/OS, z/VSE, z/VM and z/TPF operating systems on z/Architecture mainframe computers. Release 6 and later also run on Linux, and generate ELF or GOFF object files (this environment is sometimes referred to as Linux on IBM Z). [19] While working at IBM, John Robert Ehrman created and was the lead developer for HLASM [lower-alpha 5] and is considered the "father of high level assembler". [21]
Despite the name, HLASM on its own does not have many of the features normally associated with a high-level assembler. The name may come from the additional macro language capabilities, such as the ability to write user-defined functions. The assembler is mostly similar to Assembler H and Assembler(XF), incorporating the SLAC (Stanford Linear Accelerator) modifications. Among features added were an indication of CSECT
/DSECT
for location counter, dependent [lower-alpha 6] and labelled [lower-alpha 7] USING
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. [22] The RSECT
directive (Read-only Control Section) allows the assembler to check reentrancy on a per-section basis. RSECT
was previously "undocumented and inconsistently implemented in Assembler H." [23] : 41
The High Level Assembler Toolkit is a separately priced accompaniment to the High Level Assembler. The toolkit contains: [24]
The IBM 7090/7094 Support Package, known as SUPPAK, "consists of three programs designed to permit programs written for a System 360 to be assembled, tested, and executed on an IBM 709, 7090, 7094, or 7094 II."
This cross-assembler runs on a 7090 or 7094 system and was used while System/360 was in development. [7] [25] This assembler supports six-bit BCD character set as well as eight-bit EBCDIC.
IBM supplied two assemblers for the Model 20: the Model 20 Basic Assembler, and the Model 20 DPS/TPS Assembler. Both supported only instructions available on the Model 20, including unique instructions CIO
, TIO
, XIOB
, SPSW
, BAS
, BASR
, and HPR
. [26] : 110 The Basic Assembler is a slightly more restricted version of System/360 Basic Assembler; [27] notably, symbols are restricted to four characters in length. This version is capable of running on a system with 4 KB memory, and macro support is limited to IOCS macros. The card versions are two-pass assemblers that only support card input/output. The tape-resident versions are one-pass, using magnetic tape for intermediate storage. Programs assembled with the CPS Assembler can address a maximum of 16 KB. [27] : 7–8
The DPS/TPS assembler is a somewhat restricted version of System/360 BPS/BOS Assembler. [26] : 132–134
The IBM System/360 Model 44 Programming System Assembler processes a language that is a "selected subset" of OS/360 and DOS/360 assembler language.
Most significantly the Model 44 assembler lacks support for macros and continuation statements. On the other hand it has a number of features not found in other System/360 assemblers—notably instructions to update a card image source dataset, named common, and implicit definition of SETA
assembler variables. [28]
It has no support for storage-to-storage (SS) instructions or the convert to binary (CVB
), convert to decimal (CVD
), read direct (RDD
) and write direct (WRD
) instructions. [29] It does include four instructions unique to the Model 44: Change Priority Mask (CHPM
), Load PSW Special (LPSX
), Read Direct Word (RDDW
), and Write Direct Word (WRDW
).
It also includes directives to update the source program, a function performed by utility programs in other systems (SKPTO
, REWND
, NUM
, OMIT
and ENDUP
). [29] : 53, 73
The assembler for the System/360 Model 67 Time Sharing System has a number of differences in directives to support unique TSS features. The PSECT
directive generates a Prototype Control Section containing relocatable address constants and modifiable data used by the program. [30] : 143
"Assembler G" is a set of modifications made to Assembler F in the 1970s by the University of Waterloo (Assembler F was/is open source). Enhancements are mostly in better handling of input/output and improved buffering which speed up assemblies considerably. [31] "Assembler G" was never an IBM product.
There have been several IBM-compatible assemblers for special environments. [32]
Originally all System/360 operating systems were written in assembler language, and all system interfaces were defined by macro definitions. Access from high-level languages (HLLs) was restricted to what that language supplied, and other system calls had to be coded as assembler subroutines called from HLL programs. Also, IBM allowed customization of OS features by an installation thru what were known as Exits—user-supplied routines that could extend or alter normal OS functions. These exits were required to be coded in assembler language. Later, IBM recoded OS/360 in a systems programming language, PL/S, but, except for a short trial, decided not to release the PL/S compiler to users. As a result of these factors, assembler language saw significant use on IBM systems for many years.
BASR
and similar instructions. SVC
have been replaced by a PC
instruction.DIAG
as an HVC
instruction.USING
is one that specifies a relocatable expression instead of a list of registers: USING IHADCB,SYSPRINT ... TM DCBOPTCD,DCBOPTC Test OPTCD in SYSPRINT ...
USING
is one that only affects instructions that explicitly refer to it by qualifying an expression with a label: LA R4,SYSIN LA R5,SYSPRINT IN USING IHADCB,R4 OUT USING IHADCB,R5 ... TM IN.DCBOFLGS,DCBOFTM Test OFLGS in SYSIN ... TM OUT.DCBOPTCD,DCBOPTC Test OPTCD in SYSPRINT ...
In computer programming, assembly language, often referred to simply as assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence between the instructions in the language and the architecture's machine code instructions. Assembly language usually has one statement per machine instruction (1:1), but constants, comments, assembler directives, symbolic labels of, e.g., memory locations, registers, and macros are generally also supported.
IBM mainframes are large computer systems produced by IBM since 1952. During the 1960s and 1970s, IBM dominated the computer market with the 7000 series and the later System/360, followed by the System/370. Current mainframe computers in IBM's line of business computers are developments of the basic design of the System/360.
Multiple Virtual Storage, more commonly called MVS, is the most commonly used operating system on the System/370, System/390 and IBM Z IBM mainframe computers. IBM developed MVS, along with OS/VS1 and SVS, as a successor to OS/360. It is unrelated to IBM's other mainframe operating system lines, e.g., VSE, VM, TPF.
A direct-access storage device (DASD) is a secondary storage device in which "each physical record has a discrete location and a unique address". The term was coined by IBM to describe devices that allowed random access to data, the main examples being drum memory and hard disk drives. Later, optical disc drives and flash memory units are also classified as DASD.
Hercules is a computer emulator allowing software written for IBM mainframe computers and for plug compatible mainframes to run on other types of computer hardware, notably on low-cost personal computers. Development started in 1999 by Roger Bowler, a mainframe systems programmer.
The IBM System/370 (S/370) is a range of IBM mainframe computers announced as the successors to the System/360 family on June 30, 1970. The series mostly maintains backward compatibility with the S/360, allowing an easy migration path for customers; this, plus improved performance, were the dominant themes of the product announcement.
In computing, Interactive System Productivity Facility (ISPF) is a software product for many historic IBM mainframe operating systems and currently the z/OS and z/VM operating systems that run on IBM mainframes. It includes a screen editor, the user interface of which was emulated by some microcomputer editors sold commercially starting in the late 1980s, including SPF/PC.
VM is a family of IBM virtual machine operating systems used on IBM mainframes System/370, System/390, zSeries, System z and compatible systems, including the Hercules emulator for personal computers.
Job Control Language (JCL) is a scripting language used on IBM mainframe operating systems to instruct the system on how to run a batch job or start a subsystem. The purpose of JCL is to say which programs to run, using which files or devices for input or output, and at times to also indicate under what conditions to skip a step. Parameters in the JCL can also provide accounting information for tracking the resources used by a job as well as which machine the job should run on.
IBM CICS is a family of mixed-language application servers that provide online transaction management and connectivity for applications on IBM mainframe systems under z/OS and z/VSE.
Disk Operating System/360, also DOS/360, or simply DOS, is the discontinued first member of a sequence of operating systems for IBM System/360, System/370 and later mainframes. It was announced by IBM on the last day of 1964, and it was first delivered in June 1966. In its time, DOS/360 was the most widely used operating system in the world.
The IBM Time Sharing System TSS/360 is a discontinued early time-sharing operating system designed exclusively for a special model of the System/360 line of mainframes, the Model 67. Made available on a trial basis to a limited set of customers in 1967, it was never officially released as a supported product by IBM. TSS pioneered a number of novel features, some of which later appeared in more popular systems such as MVS. TSS was migrated to System/370 and 303x systems, but despite its many advances and novel capabilities, TSS failed to meet expectations and was eventually canceled. The Resident Supervisor of TSS/370 was used as the basis for a port of UNIX to the IBM mainframe. TSS/360 also inspired the development of the TSS/8 operating system.
A debug symbol is a special kind of symbol that attaches additional information to the symbol table of an object file, such as a shared library or an executable. This information allows a symbolic debugger to gain access to information from the source code of the binary, such as the names of identifiers, including variables and routines.
In IBM mainframe operating systems, basic partitioned access method (BPAM) is an access method for libraries, called partitioned datasets (PDSes) in IBM terminology. BPAM is used in OS/360, OS/VS2, MVS, z/OS, and others.
A Supervisor Call instruction (SVC) is a hardware instruction used by the System/360 family of IBM mainframe computers up to contemporary zSeries, the Amdahl 470V/5, 470V/6, 470V/7, 470V/8, 580, 5880, 5990M, and 5990A, and others; Univac 90/60, 90/70 and 90/80, and possibly others; the Fujitsu M180 (UP) and M200 (MP), and others; and is also used in the Hercules open source mainframe emulation software. It causes an interrupt to request a service from the operating system. The system routine providing the service is called an SVC routine. SVC is a system call.
In IBM mainframe operating systems, Execute Channel Program (EXCP) is a macro generating a system call, implemented as a Supervisor Call instruction, for low-level device access, where the programmer is responsible for providing a channel program—a list of device-specific commands (CCWs)—to be executed by I/O channels, control units and devices. EXCP for OS/360 and successors is more specifically described in the OS System Programmer's Guide.; EXCP for DOS/360 and successors is more specifically described in DOS Supervisor and I/O Macros. This article mostly reflects OS/360 through z/OS; some details are different for TOS/360 and DOS/360 through z/VSE.
The history of IBM mainframe operating systems is significant within the history of mainframe operating systems, because of IBM's long-standing position as the world's largest hardware supplier of mainframe computers. IBM mainframes run operating systems supplied by IBM and by third parties.
OS/360, officially known as IBM System/360 Operating System, is a discontinued batch processing operating system developed by IBM for their then-new System/360 mainframe computer, announced in 1964; it was influenced by the earlier IBSYS/IBJOB and Input/Output Control System (IOCS) packages for the IBM 7090/7094 and even more so by the PR155 Operating System for the IBM 1410/7010 processors. It was one of the earliest operating systems to require the computer hardware to include at least one direct access storage device.
The OS/360 Object File Format is the standard object module file format for the IBM DOS/360, OS/360 and VM/370, Univac VS/9, and Fujitsu BS2000 mainframe operating systems. In the 1990s, the format was given an extension with the XSD-type record for the MVS Operating System to support longer module names in the C Programming Language. This format is still in use by the z/VSE operating system. In contrast, it has been superseded by the GOFF file format on the MVS Operating System and on the z/VM Operating System. Since the MVS and z/VM loaders will still handle this older format, some compilers have chosen to continue to produce this format instead of the newer GOFF format.