hello every body and specially L D[AR2,P#0.0] . this is my first program using
pointers.this program is to get the maximum value in an array of data of any length.i write it as FB.i test it and it works very good.thank you again L D[AR2,P#0.0].
L #LEN //array length (input formal param.)
L -1
+I
L 0
==I
= #c_1_elem //case of one element array len.
TAK
T #LEN2 // temp address
L P##ARRAY_ADRS //pointer to array start address
LAR1
L W [AR1,P#0.0]
T #tmp_db_add
OPN DB [#tmp_db_add]
L D [AR1,P#2.0]
LAR1
L W [AR1,P#0.0]
T #temp //to carry the max value
A #c_1_elem
JC END
lmax: L #temp
+AR1 P#2.0
L W [AR1,P#0.0]
<I
JCN rr
T #temp
rr: L #LEN2
L -1
+I
T #LEN2
L 0
==I
JCN lmax
L #temp
T #MAX_VAL
BE
END: T #MAX_VAL
pointers.this program is to get the maximum value in an array of data of any length.i write it as FB.i test it and it works very good.thank you again L D[AR2,P#0.0].
L #LEN //array length (input formal param.)
L -1
+I
L 0
==I
= #c_1_elem //case of one element array len.
TAK
T #LEN2 // temp address
L P##ARRAY_ADRS //pointer to array start address
LAR1
L W [AR1,P#0.0]
T #tmp_db_add
OPN DB [#tmp_db_add]
L D [AR1,P#2.0]
LAR1
L W [AR1,P#0.0]
T #temp //to carry the max value
A #c_1_elem
JC END
lmax: L #temp
+AR1 P#2.0
L W [AR1,P#0.0]
<I
JCN rr
T #temp
rr: L #LEN2
L -1
+I
T #LEN2
L 0
==I
JCN lmax
L #temp
T #MAX_VAL
BE
END: T #MAX_VAL