In his October mainframe column, columnist Robert Crawford asked what commonly used Assembler instruction can be used to add three numbers together and place the answer in a fourth location. The answer is Load Address (LA).

Below is Crawford’s answer and the next Assembler Quiz.

Most of us have seen LA used to get the address of a label:

LA R13,SAVEAREA

But if you look in the Principle of Operations manual you will see the actual format of the instruction is as follows:

LA R1,O(X,B)

Where: R1 is the register to receive the addressX is the index registerB is the base registerO is an offset to be added to the sum of the base and index registers

In other words, the magical thing we call an address is actually just a number computed by adding two registers together with an offset. So, at the end of this instruction sequence:LA R1,4 R1=4
LA R2,3 R2=3
LA R3,2(R1,R2) R3=2+4+3

Register 3 contains 9

We received 9 correct answers to this question. The first three will receive a Startbucks gift card.

New Assembler Quiz: One more quiz before I run out of ideas. What sequence of three instructions can exchange the values of two registers without using memory or a third register? As before, send your answers to editor@searchdatacenter.com and the first three correct answers will win a $5 Starbucks gift card.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States.
Privacy

Processing your reply...

There was an error processing your information. Please try again later.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States.
Privacy

Processing your reply...

About This Blog

A blog about mainframe computers and related issues, including Linux on Big Iron, application modernization, mainframe jobs, CICS, server consolidation and third party mainframe software.