Help with LH and AR instructions
Posted: Thu Dec 08, 2016 12:13 pm
Hello,
I have a two tables as defined below.My COBOL program is passing these two while calling an Assembler program.
R1 Register points to ASSGND-DAYS table/array and R2 Points to MEETING-TABLE.
I have the below code in my Assembler program.
GETSEM LH R5,2(R2) LOAD START PER OF MT ENTRY
AR R5,R1 ADD ARRAY ADDR
LH will load the contents(half word) of R2 from a displacement of 2.Therefore the contents of MT-PER-FR will be loaded to R5.
Lets say MT-PER-FR has a value of +04.So now R5 will have 0004.
with AR R5,R1 We are adding the contents of R1 i.e R1 has the address of ASSGND-DAYS array to R5.
Why are they doing this ? Is this how they point R5 to MT-PER-FR ?
Thanks
I have a two tables as defined below.My COBOL program is passing these two while calling an Assembler program.
01 ASSGND-DAYS.
05 FILLER OCCURS 050 TIMES PIC X(2).
01 MEETING-TABLE SYNCHRONIZED.
05 MT-TABLE-ENTRY OCCURS 1000 TIMES INDEXED BY MT-X1.
10 MT-SEM-DAYS PIC X(2).
10 MT-PERIODS.
15 MT-PER-FR PIC S9(4) COMP-4.
15 MT-PER-TO PIC S9(4) COMP-4.
05 FILLER OCCURS 050 TIMES PIC X(2).
01 MEETING-TABLE SYNCHRONIZED.
05 MT-TABLE-ENTRY OCCURS 1000 TIMES INDEXED BY MT-X1.
10 MT-SEM-DAYS PIC X(2).
10 MT-PERIODS.
15 MT-PER-FR PIC S9(4) COMP-4.
15 MT-PER-TO PIC S9(4) COMP-4.
R1 Register points to ASSGND-DAYS table/array and R2 Points to MEETING-TABLE.
I have the below code in my Assembler program.
GETSEM LH R5,2(R2) LOAD START PER OF MT ENTRY
AR R5,R1 ADD ARRAY ADDR
LH will load the contents(half word) of R2 from a displacement of 2.Therefore the contents of MT-PER-FR will be loaded to R5.
Lets say MT-PER-FR has a value of +04.So now R5 will have 0004.
with AR R5,R1 We are adding the contents of R1 i.e R1 has the address of ASSGND-DAYS array to R5.
Why are they doing this ? Is this how they point R5 to MT-PER-FR ?
Thanks