Andyo2424 wrote:Hi, everyone I'm currently taking an assembly course (HLASM), I just had one question about explicit addressing D(X,B), How do I know what register to use as an index register? how do I know what value to input as a displacement value? how do I know what register to use as a base register? I often see examples like
5,8(0,2) but I dont understand what that goes or what that does, is it like an array? thank you
Yes, you're right. Taken in isolation, something like 5,8(0,2) is basically meaningless. In fact, most of us retired dinosaurs don't write it like that; we write 5,8(,2). It's the exact same thing, but it gets the pseudo index register 0 out of the picture as register 0 is not, and cannot be, an index register.
In fact, we might write
L 5,8(,2) or
ST 5,8(,2)
In some ways, in System/360 derived computer architectures, the term "index register" is basically meaningless. An earlier computer design - the IBM 704, which morphed over about 10 years to the 709, 7040 and 7090 computer systems - had several specialized registers called "index registers." These registers could only be used as index registers. By current standards they were weird as their values were subtracted, not added, to the basic operand address. The idea of an index register was considered to be important when the System/360 design was devised, but the idea of dedicated index registers was dropped. Instead an "index register" is just a general purpose register used as an "index register" in some instructions. In fact, for those of us dinosaurs changing over to System/360 from the 704 tradition the idea was sort of a sick joke as the ideas they were often used for in 704 type systems did not transition easily System/360. In fact, most of the time, in my opinion, you're better off thinking of the "index register" as the third operand in a 3 input adder. Just to show how elusive the concept is, it took me 20 years or more to realize this concept and put it into practice in my programs.
The index register idea went into instructions called "branch index high" or "branch index low or equal" which were analogs of 704 instructions with a similar name and purpose, but until you replaced the idea of "index" with the idea of "value" you could not realize the true worth of these instructions in System/360.