Vector Operations and Indexing Competency: C5 Lecture no. 20
Vector Operations An ordered sequence of data items is known as Vector. Vector base address: Starting address of vector. Vector operation: Reading a vector of data items from input unit and storing in memory starting from a specified address.
Reading a Vector Reading a vector of 20 data items and storing it in memory with vector base address 300.
Indexed Addressing STORE R2, R5, SA R5 – Index Register. R2 – Data read is stored in this register. SA – starting address of the vector. Effective Address(EA) = SA + C(R1)
Symbolic Program LDIMMR1, 20; Load R1 with 20 LDIMMR5, 0; Initialize R5 to zero LOOP: INPR2; Read data from input device INCR5; Increment R5 STORER2, R5, 299; Indexed address as two registers are used. BCTR1, LOOP; C(R1)<- C(R1) – 1. If (C(R1) > 0) goto LOOP HALT