The first computer I used, back when dinosaurs really did rule was the IBM 7040. The 7040 was the trailing end of a computer architecture that started back in the dim mists of (almost) pre history when the switching circuits were ruled by vacuum tubes. One of the important reasons for the success (140 were made) of the 704 was its gigantic (for the day) 32K words of memory. No doubt there were people wondering how they could use all that memory!
There were two problems that ultimately led to the collapsed of the architecture. By the early 1960s it was clear much, much more memory would be required in the future. There were one off extensions that got 64K words of memory using bank switching, but, at best, this is a terribly clumsy way to add memory. The other problem is each instruction that addressed memory had a 15 bit field with the storage address of the data. Every time a program was loaded into memory these data addresses had to be relocated to contain the actual storage address of the data the instruction used. This was painfully slow.
Now, let's look at a System/360 program.
Loc Object Code Addr1 Addr2 Stmt Source Statement
000000 00000 0006C 1 BASEREG CSECT
2 SAVE (14,2)
000000 4+ DS 0H
000000 90E2 D00C 0000C 5+ STM 14,2,12(13)
000004 0520 6 BALR 2,0
R:2 00006 7 USING *,2
000006 41F0 201E 00024 8 LA 15,SAVEAREA
00000A 50D0 F004 00004 9 ST 13,4(,15)
00000E 50F0 D008 00008 10 ST 15,8(,13)
000012 18DF 11 LR 13,15
12 * YOUR PROGRAM LOGIC GOES HERE!
000014 58D0 D004 00004 13 L 13,4(,13)
14 RETURN (14,2),RC=0
000018 98E2 D00C 0000C 16+ LM 14,2,12(13)
00001C 41F0 0000 00000 17+ LA 15,0(0,0)
000020 07FE 18+ BR 14
000022 0000
000024 0000000000000000 19 SAVEAREA DC 18F'0'
000000 20 END BASEREG
In this program SAVE and RETURN are macro calls: a "macro" is instructions to the Assembler (the program that translates source code to binary data for the computer) to generate addition code. This SAVE macro just generates one real instruction: STM 14,2,12(13). The convention in System/360 is register 13 contains the address of a save area, which is just a data area used to store registers.
BALR 2,0
USING *,2
LA 15,SAVEAREA
ST 13,4(,15)
ST 15,8(,13)
LR 13,15
The BALR instruction is normally used to call another program: this BALR instruction stores the address of the next instruction in register 2, but it does not actually go to another program because register 0 cannot be used for that purpose.
The USING instruction is a directive to the Assembler program. The USING instruction is the programmer promising the Assembler program that register 2 contains the current address.
LA 15,SAVEAREA
The LA (Load Address) instruction is a machine instruction that tells the computer to compute the address of SAVEAREA. 41F0201E is the binary data that the computer uses. 41 is the data the computer interprets as Load Address. F is register 15, where the computer will store the address, and 201E is the "address;" 2 is register 2, the base register, and 01E is the factor to add to the base register. The 01E was calculated by the Assembler program by using the address supplied by the USING instruction and the data address, 00024, supplied by the programmer and effectively determined by the Assembler: 24 - 6 = 01E. Back in 1968, when I understood what was going on I immediately saw 2 advantages compared to the IBM 704 tradition. First, the base register had a much larger potential address than the measly 32K of the 704. The second is once calculated by the Assembler this 01E was fixed. The system could load the program anywhere in storage without altering anything in the program.
The Assembler program is wonderfully flexible. You can specify the base register and offset directly without making the Assembler compute the offset. This is what ST 13,4(,15) is doing.
Many instructions do not require the Assembler (or the machine) to compute an address: this is what the BALR and LR instructions do in our little program.
Nothing is "free" in this scheme. Most instructions require the computer to do arithmetic to compute a data address in every instruction, and this has the effect that the computer runs slower. Perhaps 10 years later when virtual memory came in you had nay sayers grumbling about the computational cost of the extra arithmetic required under the covers for the virtual memory to work.