I have some questions in Assembler whose answers were difficult to find. Can you please help for the same?
1) How to swap the contents of register/memory without using a third variable/memory/register?
2) Why the program and data area together can only be 4095 bytes by using one base register?
3) What is AMODE and RMODE in assembler?
4) what is the meaning of global variable in assembler and how can we define it?
5) Whether the below instructions are correct, then how many bytes will be moved to A in each case, I thought they are correct and 0 and 1 byte will be moved respectively but the interviewer said it's wrong. Can you please correct?
a) MVC A(0), B
B) MVC A(1), B
6) Is it possible that a variable defined in the DSECT in the main program can be used in the sub-program other than passing its address in register, if yes can you please give an example for the same?
7) In a DSECT, how assembler understands that it should not allocate any memory?
8) What happens if we use DC in a DSECT?
9) Where are the variables that are defined in a DSECT stored? If it is a temporary memory then how are they stored?
10) What is the use of base register in the program with respect to reference? Is it used in the whole program for referring anything other than helping in setting up addressibility?
11) What is destructive overlap? can you please give an example?
12) What will the following instructions do?
a) L R3,3
b) LA R3,R4
13) I want to execute some code in the main program if the return code from the sub-program is '0' and want to display "Error" if the return code from the sub-program is '4'. In my sub-program I have to setup return code '0' and return code '4' in different situations. I understand that we can check the return code generated by the sub-program in the main program by checking the content of register R0 and also we can't load any value in register R0. So, in this case, how can I code my sub-program in order to setup return code '0' and '4' and then get it checked in my main program?