Microprocessor 8085 instructions of data functional group


8085 INSTRUCTIONS:–

In 8085 there are 246 instructions. These instructions are of 80 different types these instructions can be classified into 5 functional group

1. Data
2. Arithmetic
3. Logical
4. Branch
5. Machine control group.

1.DATA FUNCTIONAL GROUP :– this group of instruction transfers or copies data from one location that is source to another location that is destination without changing the content of source. The term data transfer means copying data. The contents of destination are modified whereas the contents of source are not changed. Flag registers are not affected by the data transfer instructions. Various data transfer instructions are as follows:–

1.MVI INSTRUCTIONS :– Move immediate 8 bit data. Op code is MVI and operand R,data M,data.

In this instruction 8 bit data is copied or moved in the destination register or memory location. If the operand is memory its address is specified by HL register pair. No flag is affected and immediate addressing mode is used for source operand.

Example:– MVI B,92H.

In this instruction the data 92H is copied in the register B.

Example 2 MVI M,38H.

H-20H , L-50H

2. LXI :– Load register pair immediate.

Rp,16 bit data. Op code is LXI, operands Rp, 16 bit data.

This instruction will load the given 16 bit data in the register pair specify in the operand here Rp means register pair no flag is affected. Immediate addressing mode is used as source operand.

Example:– LXI B,2050H

THIS instruction will load 16 bit data 2050H in the register pair BC register.

3. Mov:– move data from one register to another register

            MOV Rd,Rs

This instruction copies the content of source register that is Rs into the destination register that is Rd but the contents of source register are not changed. Register addressing is used for both source and destination operands. No flag is affected.

Example:– MOV B,C

THIS instruction will copy the content of C into the destination register B.

Let us assume that B contains 72 and C 9F then 72 will overwrited with 9F  and 72 will erased

4. MOV Rd ,M:–  It will move the contents of memory location into the destination register Rd. This instruction will copy the contents of memory location whise address. In HL pair register into the destination register. The contents of memory location are not changed.

Register addressing mode is used for destination operand and indirect addressing mode is used for source operand. No flag is affected.

Example :– MOV B,M  H-20H ,L-50H.

This instruction will copy the contents of memory location whose address is in the HL register into the B register.

Suppose H contain 20H and L contains 50H and memory location 2050H contains data 3AH

5. LDA  Address:– Load accumulator direct.

Opcode LDA AND operand

In this instruction 16 bit address of a memory location where data resigns is specified inn the instruction. Thia instructions will copy the contents if memory location with the address given into the accumulator the contents of memory location are not changed thus a 3 byte instruction 1 byte gives the op code whereas 2nd and 3rd bytes specifies the high and low order address. No flag is affected and direct Addressing mode is used.

EXAMPLE:– LDA 2400H

Assume that 2400H address contain data 3A this instruction will load data of memory location whose address is 2400H into the accumulator.

6. STA ADDRESS:– Store accumulator.

Op code is STA and operand is the 16 bit address.

The contents of the accumulator are copied to a memory location whose address is given in the instruction this is a 3 byte instruction 1st byte is op code , 2nd and 3rd byte high and low order address. No flags are affected and direct addressing modes are used.

Example :– STA 2400H

7. LHLD address :– load HL DIRECT.

Load HL pair register direct  .op code is LHLD .AND operand is 16 bit address .

This instruction will load the data of the memory location whose address is specified in the instruction into the L register. And data of the next memory location that is address +1 is loaded into the H register the data of the memory location are not changed no flags are affected. Direct addressing mode is used

Example:– LHLD 2400H.

Assume that memory location 2400 contains the data 78H and 2401 contains 3AH. This instruction will copy the data of memory location 2400 into the L register and 2401 into the H register.

8. SHLD address:— SHLD address op code is SHLD OPERAND 16 BIT ADDRESS

STORE HL REGISTER PAIR DIRECT.

THE contents of HL register pair are stored in the memory location specified by the 16 bit address the contents of L register are stored in the memory location given by 16 but address and the content of H register are stored in next memory location. The contents of HL register pair are not changed it is a 3 byte . No flag is affected and direct addressing mode is used.

Example :– SHLD 2400G

LDAX Rp :– op code is LDAX AND operand is Rp. LOAD ACCUMULATOR REGISTER PAIR INDIRECT. It will be of 1 byte.

This instruction will load the contents of memory location whose address is specified in the register pair into the accumulator the contents of register pair are not changed. No flags are affected and indirect addressing mode is used for the source operand.

This instruction is used only for BC OR DE register pair.

Example :–LDAX. B

assume that register B contain 20H and reguster C contains 50H and the memory location 2050 contains the data 3A

This instruction will load the contents of memory location that is 2050 given in BC. register pair into the accumulator.

10  STAX :– STORE ACCUMULATOR REGISTER PAIR INDIRECT.

STAX =OPCODE

Contents of accumulator are copied into the memory location. Whose address is given into the register pair. The contents of accumulator or the register pair are not changed. No flag are affected and indirect addressing mode is used. For  Destination operands.


11. XCHG:– Exchange the contents of 

This instruction exchange the contents of HL Register pair with de register pair.

Op code is XCHG operand is null and size us 1 byte. In this instruction the contents of H registers are exchanged with the contents of D register and the content of L register with E register. No flags are affected and implicit is used

Example :– XCHG

assume D register contains 20H And E register contains 80H and H register 50and L register contain 90.

After the execution of instruction DE AND HL are exchanged.

12.  IN :– MEans input data to accumulator from the input port specified with 8 bit address

  IN  8bit address

Opcode is IN and operand is 8bits data and it’s size is 2 bytes.

The contents of the input port whose address is specified in the instruction are read and copied to the accumulator the input and output devices connected to the 8085 microprocessor have 8 bit address. No flags are affected.

Example :– IN 02H.A

13. OUT :– Output dat from accumulator to a port with 8 bit address and op code is OUT and operand is 8 bit address it is 2 byte address

The contents of the accumulator are copied into the  output port whose 8 bit address is specified in the instruction are print  to the accumulator. . No flags are affected.

Example :– OUT 02H.A

The in and out instruction are used to transfer data between input and output devices or accumulator so they may be grouped as input,output instruction.

14. PUSH :– It pushes register pair on to stack

  PUSH Rp

Opcode is PUSH operand is Rp and this is 1 byte.

The contents of the register pair given in the instruction are copied into the stack. The stack pointer register incremented and the contents of the high order register are copied into that stack location. The SP again incremented and the content of low order register  are copied into that location the operand PSW(program status word)  gives the contents of accumulator and flag register

Accumulator is high order register and flag us a low order register.

Example :– Push B

Assume that stack pointer contains the address 2050 B contains 32H and C contains 50H . The instructions will copy the contents of register pair BC on the top of the stack.

15. POP:– Pop of top of stack to the register pair. Pop is op code and Rp is operand and size is 1 byte

The contents of the memory location whose address is pointed by ye stack pointer register are copied into register pair given in the instruction the contents of memory location pointed by the stack pointer are copied to the low order register and stack pointer is decremented by 1. Again the contents of the memory location are copied to high order register given in the register and stack pointer is again decremented by 1. No flags are affected.

Example :– POP H

Assume SP contains the address 2050 and H and L contains no data. The instructions pop H will copy the contents of memory location 2050 into the L Register and 2049 into the H register and  the new stack top will changed from 2050 to 2048. The pop and push instruction are also known as stack instruction.

16. XTHL :–  Exchange the contents of HL register with the stack top. Op code is XTHL and operands is null and size is 1 byte.

The contents of the stack location whose address is given by the stack pointer are exchanged with the register L and the contents of register H are exchanged with the contents of the next stack location that is by incrementing stack pointer the contents of the stack pointer register are not changed. No flags are affected.

Example:–

Assume that stack pointer contains 2050  and value 37 stack pointer+1 contains 2051 and value 52 and H contains 32 and L contains 50 so the value of 2050 address pointed by SP is copied into L register and that is 2050 new value is 50 and L register new value is 50 also the value at the address 2051 is exchanged with the contents of H register that is new value that is 32 and the new value is 37

17. SPHL:– Contents of HL register pair are copied into the stack pointer op is SPHL And instruction is of 1 byte.

The instruction will copy the contents of H register into the high order address and the content of L Register into the low order address. No flags are affected and tge contents of register pair are not changed.

Example:– SPHL 

Microprocessor 8085instructions and addressing modes.


8085 instructions and programming.

An instruction is a command given to the Microprocessor to perform a particular task on particular data .

Example move a,b

It is a binary pattern design inside the Microprocessor to perform particular process. Any instructions consist of two parts.

1 op Code.

2 data or operand.

Which specifies the data to be operated

For ex:– mov C,A. 

In this instruction we are trying to copy the contents of accumulator register to register C  this instruction has two parts that is move and C,A

1st part mov is called op. code which specifies that data is to move

2nd part that is C,A is called the operands that is data of A register to be copied to C register. The binary code for this instruction is 4FH that is 01001111(binary form) available from 8085 set. Which is converted into hexadecimal that is 4FH.

Instruction and data format in8085 :– 8085 is a 8 bit Microprocessor that means it can handle 8 bits of data also the memory location of 8085 is designed to have 8 bit data. If a 16 bit data is to be stored it is stored in either following ways:–

1. By using a pair of register where each register can hold 8 bit data BC,DE,HL

2. It can be also be stored into consecutive memory location pointed by HL pair register.

3. In some instructions only one register is specified the content of that register is one of the operand but the other operand is accumulator.

Types of instruction:–

1–1byte instructions

2–2byte instructions

3–3byte instructions

Depending upon the length of the machine code of the instructions

The instructions can be classified into 3 types.

1. 1byte instruction :– one byte instruction include the operation code and the operand in the same byte that is 8 bits so the length if the machine code for such instructions is of one byte.

Examples:– of these types of instruction

Mov C,A  mov is the op code and C,A is operands and the machine code is 01001111.

ADD B ,A

A=A+B

AND machine code is 80H and in binary 10000000.

CMA  compliments of accumulator register.

Op code is CMA  and operands is null

And machine code is 2FH and binary is 00101111.

2. 2byte instructions:– In a two byte instruction the 1 st byte specifics the op cod e and 2nd bit is operands which consist of 8 bits and or 8bits for address

For examples:– MVI A,324 (MOVE IMMEDIATE) in this instruction the op code is MVI which is of 8 bits. And operands which contains 8 bit data.

Example IN 02 (input ,read)

Opcode is IN and operands is 02.

3. 3 byte instructions :– in the 2 byte instruction the 1st byte specifies the op code whereas 2nd and 3rd specifies 16 bit data.

For example:-JMP  2050

In this instruction the op code is JMP abd the operands is 2050 that meand the machine code consist of 3 byte 1st byte represents the op code and 2nd and 3rd byte represents address. 50 is higher bits then 20

Addressing modes:–

Data which is to be operated is stored in the memory location or successive memory locations each instructions required certain data for its operation. There are various techniques to specify the addresses of data. These techniques are called addressing modes.

8085 has following the addressing modes

1. immediate addressing modes.
2. register addressing modes
3. direct addressing modes
4. indirect addressing modes
5. implicit addressing modes


1. Immediate addressing modes :–
 in this mode the e data is specified in the instruction itself but the data can be of 8 bits or 16 bits. The data is contained in the memory bytes following the op code byte instruction. The op code byte instruction with letter I (immediate) fall under this category along with the operand/data which can be of 8 bit or 16 bits. This type of instructions can be of 2 bytes or 3 bytes.

Example:– MVI  A, 05H

2. Register addressing modes:– in this mode the instruction specifies the general purpose register in which the data is located that is data to be  loaded stored in the registers rather than memory. In this addresses mode is op code ,destination register and source register. Due to this addressing mode there is faster execution. Instruction in this mode generally 1 byte.

Example:– MOV A,B in which op code is MOV and operands are A,B and it is of 1 byte.

ADD B 

3. Direct addressing mode:-– in this mode the address where data is found is specified directly the 2nd and 3rd byte may contain the memory address. These type of instructions are generally of 3bytes or 2 bytes

Example:– STA 2400H (STORE ACCUMULATOR).

In this instruction it will store the content of accumulator in the memory location whose address is 2400H

IN  02  Reads the contents of input port. 

4. Indirect addressing mode:– In this mode the memory address is specified indirectly by the content of register pair

The example of

LDAX B  2400H

In this instruction we will move the content of memory location whose address is contents of BC register pair to the accumulator in this instruction the data specifies indirectly in the BC register pair.

5.Implicit addressing modes :– In some instructions operands is fixed or need not to be specified the addressing mode for this is known as implicit a

Example :– CMA (COMPLIMENT ACCUMULATOR)

CMA IN THIS OP code is CMA and operand is null this instruction means compliment the contents of accumulator.

MICRO PROGRAM AND HARD WIRED FULL TOPIC.

Computer organisation..

Micro program control unit vs hard wired control unit.

To execute an instructions c.p.u. designs place an important role it is a process of creating a cpu component of computer hardware. The main objective of cpu is to execute list of instruction like addition etc. Cpu design focus on :–

1 data path. Ex ALU and pipeline

2 control unit that is the logic which controls the. Data path

3 memory component such as registers files. Cache memory

4 clock circuit

5 transceiver circuit

There are two possible designs of control unit available :–

1 Hard wired

2 Micro programmed

1.  HARD WIRED :– in this unit the control unit uses fixed logic circuit to interpret the instructions and generate the control signals from them the fixed logic circuit  block includes combinational and sequential circuit that generates the required control output for decoding and encoding functions by separating the decoding and encoding function we can draw more detailed block diagram for hard wired control unit as shown in fig.

The instructions decoder decodes the instructions loded in the instructions register if instructions register is of 8 bit then the instructions decoder generates 256 BITS OF  ADDRESS  1 for each instructions

According to the op code in the ir register only one line among the all input lines of decoder goes high this is said to 1  and all other lines set to 0 the step decoder provides the separate signal line for each step in a control sequence the encoder gets the input from instructions decoder, step counter , external input and conditions codes it uses all these input to generate  after execution of each instructions end signal is generated which reset the control of step counter and make it ready of the generations the control step for next generation .

The factors affecting the design of hard wired control unit :–

1 the amount of hardware.

2 the speed of operations.

3 the cost.

      There are 4 techniques for the design of hard wired control unit :–

1. state table method:- it is a classical method of sequential design ot manages the hardware required in control  unit and constructs a straight transition table. Every generation of state has a set of control signal.

2. Delay element method:- In this control signal follow a proper signal and specific time delay between two groups of control signal is added to ensure synchronization these are controlled by a common clock signal.

3. Sequence counter method;- it uses a step counter for timing purpose.

4. PLA(programmable logic array):-  it uses PLA for generating control signal.

Advantages of hard wired control unit :–

1. Hard wired control unit is fast because control signal is generated by the sequential circuit based on present state and other input conditions.

2. The delay in generation of control signal that means one method can generate control signal faster than the classical method.

Disadvantages :-

1. More is the control signal required by the cpu more will be complex will be the design of control unit.

2. Hard wired control unit is a regit ( not flexible)  approch.this means modification in this is very difficult that means it requires re arranging of wires in hardware circuit.

3. It is very difficult to add new features in the existing design of control unit.

   MICRO PROGRAMMED CONTROL UNIT

In this program micro signal are stored in special memory called control memory it is implemented using programming approach every instruction in the processor is executed by a sequence of 1 or more sets of micro operations. Each micro operations is associated with a specific set of control lines which when activated causes that micro operations to take place. Micro programming is a method of control unit design in which the control signal selection and sequencing stored in a memory called control memory. The control signal to be activated at any time are specified by the micro signal which is fetched by the control memory in the similar way as the instructions from the main memory each micro instructions also specifies the next micro instructions to be used there by providing the necessary information for sequencing a sequence if one or more micro instructions designed to control specific operations such as addition, multiplication etc. micro programs for all instructions are stored in control memory the address. Were these instructions stored in control memory micro programs sequencer and micro program controller It generates the instructions according to the instruction stored in instructions register so,it consist of micro program sequencer .control address register, micro instructions register and control memory..

The components of control unit work as follows :–

1. Control address register:– it holds the address of next micro instructions to be read. Every time a new instructions is loaded into the instructions register the output of the block sequencer is loaded to the control  address register

2. when the address is available in the control address register the sequencer issues the read command to control memory

3. After issue of read command the control word from the location of that address is read into micro instruction register.

4. The control address register is automatically incremented by the clock so that next instructions can be read by control memory.

5. The content of micro instruction register is sent to the instruction decoder which generates control signal and send it to the various parts of processor in the correct sequence.

ADVANTAGES:–

1. It simplifies the design of control unit so it is cheaper and less prone to error.

2. The control function or operation are implemented in software rather than hardware.

3. The design process is systematic.

4. It is more flexible than hard wired control and it can be changed to implement new system specification.

5. Complex operations such as floating point arithmetic can be done efficiently.

Disadvantages :–

1. it is slower than the hardware control unit because it takes time to access the micro instructions from the control memory and also in compling the micro program.

2. The flexibility is achieved at the extra hardware cost of control memory and it access circuit.

 QUE. — Difference between micro program control unit and hard wired?

ANS:– Hard wired:-1. Hard wired control unit is fast

Micro program unit is slow speed

2. H.W. control function it is implemented in hardware

MICRO PROGRAM :– It is implemented in software.

3. HARD WIRED:–Flexibility it is not flexible or regit. Because to make new changes in the system specification or to add new instructions we have to change the complete hardware.circuit

M.PC.U.:– It is more flexible than hard wire as changes can be implemented by using new instructions.

4.M.P.C.U. Ability to handle large or complex instruction.

 HARD WIRED:— IT is difficult to handle complex instructions.

5. Design process hard wired somewhat complicated

It is orderly and systematic.

6.  H.W.C.U. Applications it is mostly 7sed in R.I.S.T. microprocessoR

it is used in  C.I.S.T.  microprocessor.

8. Instruction set size. There are usually under 100 instructions.

There are usually over 100 instructions.

9 ROM/CACHE SIZE there is no memory used.(HARD WIRED)

The control memory is of size 2k to 10k.(M.P.C.U.)

10. Chip area  hard wired uses least area on the IC

it uses more area on the IC.(M.P.C.U.)

REDUCED INSTRUCTIONS SET (R.I.S.C.)

  The classification of instruction set of the processor inclides two types.

1 R.I.S.C.

2. C.I.S.C.

1.. R.I.S.C :- it is a computer that was used in early 1980s it can be considered as revolution in the Architecture of computers it is simply a computer with less number of vertical micro instructions in risc the user program are compiled into the sequence of these micro instructions and then directly executed by the hardware without any interpreter these is the secret behind the speed of risc machine due to elemination of interpretation. As the result of which simple things such as adding of two registers by a program can be completed in a single micro instructions. The risc instruction set consist of less than 100 instructions with a fixed instruction format of 32 bits. Only 3 to 5 simple addressing modes are used in these most of the instructions are executed in one cycle with hard wired control unit most of the instructions are register based. the main market for risc processor are the system requires low power,small size and low cost.

Characteristics of R.I.S.C. :–

1. It has few instruction types and less addressing modes

2. It has fixed and easily decoded instructions format

3. Most instructions are executed in one cycle with hard wired control unit.

4. Fast single cycle instructions execution.

5. Memory access is limited due to load and store instructions.

6.  it uses complier but no interpreter.

7. All the operations are done within the register of cpu

8. It uses pipeline concept.

R.I.S.C

INSTRUCTION FORMAT :–

The basic instructions format used in risc processor contains

1. 7 bit op code

2. To 5 bit register name as destination. Source.

3. Address mode bit represented as I i =0   not immediate address. I=1 means immediate address

Condition mode bit represented as c

C=0 means do not set condition code, c=1 means set condition code.

There are basically 3 addressing mode

1 Register direct mode

2 register indirect mode

3 Index addressing mode.

Drawbacks of risc.

1. R.I.S.C. processor lacks some important instructions found in CISC.

2. THE presence of hard wired is another short coming because it is less flexible and more prone to error.

3. Increase in the length of 5he risc program results in more no. Of instruction or more memory.

4. It uses a large register file which can cause problem .

C.I.S.C. COMPLEX INSTRUCTION SET COMPUTER.

The computers at the earliest time were very simple in their design also the high level languages used by these computer were simple. But with the release of IBM360 series the concept of microprogramming starts the instruction set used in this processors were designed not only to do simple binary operations but they can do floating point and other complex operations as wella as As a result of the instructions set is highly complexed and so the micro program becomes complex also. With the concept of microprogramming the programming become easier. Because a programmer could remember a set of 30 to 100 instructions and a set of 3 to 10 addressing modes this is known as orthogonal instructions set and further called complex instructions set computer the slower speed of main memory in comparison cpu also encouraged the spread cisc computers.

The main characteristics of C.I.S.C. :–

1 It has a large no. Of instructions typically in 100s ranging from 100 to 350

2. Some instructions are for special task which are rarely used.

3. It has different types of instruction and data format of different length.

4. It has at wide variety of addressing modes ranging from 5 to 20. It has a small set 9f general purpose register ranging from 8 to 24

5. many high level language is directly implemented in the hardware.

6. the translation of program from high level to low level language is done by a compiler

7. the main goal cisc is to provide single machine instructor for each statement written in high level language.

This architecture is based on micro programmed control unit design.

Disadvantages Of CISC.

1. CISC processor are slower in nature in comparison of risc because  of more and more instructions the machine language is more complicated.

2. More instructions in the instruction set means more time is spent in decoding the operations mode.

3. In CISC the analysis of address is very difficult because same micro instruction would have been repeated in the micro programs

4. Many instruction and addressing that have been added that have rarely used.

DIFFERENCE BETWEEN RISC AND CISC

ANS:-

1.. INSTRUCTION SET risc has small set of instruction and most of the instruction based on register

Cisc has large no. Of instructions

2.. instruction format :– risc has instruction has fixed format of 32 bit per instruction

Cisc instruction have variable format ranging from 6 to 64 bits.

3.. addressing mode risc has a limited addressing mode ranging from 3 to 5

Cisc has large no. Of addressing mode ranging from 5 to 20.

4.. general purpose register risc it has.a large no. Of general purpose register from 32 to 192.

Cisc has small set of general purpose register ranging from 8 to 24.

5.. cache design and usage:- risc uses spilt cache memory one for instructions and one for data

Cisc uses common cache memory for instructions and data.

6.. pipelining risc architecture that is it performs parallel processing and pipelined

Cisc is not pipelined at all.

7.. processor speed:- risc computer has a speed of 52 to 200mhz with no cycle for all instructions.

Cisc has a processor speed of 33 to 66 mhz .

8.. cpu control design risc uses hard wired control without any control memory

Cisc uses microprogrammed with control memory.

SOME IMPORTANT QUESTIONS ON THIS CHAPTER:–

1. What are the addressing modes used in the micro computer system?

2. what are the various types of instruction format used in a computer system?

3. what do you mean by stack organization?

4. what do you mean by general organisation register explain with the help of example?

5. what of you mean by cpu what are various components of cpu?

Arrays and its type and operations

ARRAYS :-
Array is a simple non preemptive data structure with linear collection of homogenous elements the only difference is that the dimension of the array make change depending on its type of element so an array is a finite order set of homogenous elements that us the element of same types finite means a fixed size or value and order means that 1,2,3 to nth element to be identified by using an index or subscript the element of an array. The 1st element of the array holds the base address that is the starting address of array rest of its has convective of address so the lost remains
Are also known as subscripted because all of them have same name but different index number for their identification. An array name is the pointer to the first location of the block allocated to the name of array. To declare an array we must keep 3 things
1. Name of array
2. Data type
3. Index of array.
Types of array
One dimensional array
An array in which each element can be referenced by one subscript and index is known linear array
For example
A=[5]
Having 5 integer values
Stored in a contiguous memory types.
Address calculation of element of 1dimensional array:- base address +index*size of data type.
Address of 1st element is known as base address.
2dimensional array:- an array in which two subscript are used to identify the position of an element is known as 2 dimensional array it is also called matrix or array of arrays. The first subscript identified is row number and 2 subscript is column number for ex. Int a[3] [4]
In this we have 3 rows 4 columns.
Elements are arranged in the matrix as shown in diagram.
To access the first element we use a00
But all the elements of 2d array is also stored in the contiguous location in the memory. And we use the concept of matrix to understand the implementation of 2d array.
Operations on array:-
1st operation is creation of an array
Algorithm
Create( La, lb,ub)
step 1 Let La
Step 1 LB:=1,UB:=10

2. Traversing of array:- traversing means to access the all the elements if array starting fr 1st element to last element one by one for this the lower bound and upper bound mist be known starting the lower bound and upper bound each element is listed and display for an array a the algorithm is shown as below:-
Algorithm
Traversing
Step 1 read (lb,ub)
‌Step 2 repeat for k =lb to ub incremented by 1 print a [k]
‌[end of for loop]
‌exit

Insertion of array:- it means to insert a element in an array. Two types of insertion are possible into array this can be either at the end of the array or at the the particular position. In 1 st case if n elements are present in an array and array size is more than n than new element can be add at n+1 position.

Step 1 declare array as A[N] where n is the size of array
Step 2 read k where k is the no. Of the elements present in the array.
Step 3 for i=1 to n read A[i] and increment
Step 4 read item (item is the element to be added at the end) a(k+1) item is added in the array.
Step 5 stop.
Insertion at the particular position in the array:-
In the 2nd case the element insertion is on particular place let it has to be inserted in position 12 while there are 25 element present in array of size 50 to do this the element from 12th position to 25th position must be moved downward to new location to accumulate the new element and keep the order of the element.
Algorithm of insertion at particular
Let a is an len is total no. Of element 0resent in array pos is the position where no. Is to be inserted
Void insert (A,len,pos,num)
Step 1 repeat for i=len down to pos decrement by 1 a(i+1) =ai and repeat.(elemented are shifted for loop)
A(pos)=num (element is added to the position)
Step 3 len =len+1 (length of array increase)
Step 4 repeat for i =1 to len
print ai
End repeat (list of new elements)
Step 5 end or exit

Deletion of array:- it means to delete an element of array it can also be done by two methods that is either at the end or from a particular position
To delete an element from the last position where len is the total no. Of element present in the array and array name is A
Deletion of last element:–
void delete (A,len)
Step 1. Item =A(len) (element to be deleted is taken out from the array)
Step 2. Len=len-1 (decrement of len by 1)
Step 3. End
2nd case is one when the element has to be deleted from particular place.
For ex:– if we want to delete an element from 12th position in this case all the elements 13th position onwards are shifted one position 1 if A is an array pos is the position from element is to be deleted and len=total no. Of element in the array then the following
Deletion of element from a particular position
Void delete(A,pos,len)
Step1 item =A[pos] (element is taken out in item)
Step2. Repeat for pos to len-1 a[i] =a+1
end repeat
Step 3 len=len-1 (length is decremented by 1
Step 4 for i =length
Print A[i]
Step 5 end

Searching an array:- in this algorithm we searched for a particular element that is the finding the location in the list of elements. There are many different searching algorithm
There are two types of searching
1 linear
2 binary search
1 linear search:- consider a linear array A with n elements the most easy way to search a given item in A is to compare item with each element if A one by one that is first we check A0=item ,A1=item and so on this method which searches array sequentially to allocate element is known as linear search. For this letters assign item to A[n] that is the position following the last element array A then loc=n where loc is the location of the item that occurs on data.
Algorithm:—
Void linear search (A,n,item,loc)
Step 1. Insert item at the end of array A
Set a[n] is the item
Step 2 set loc=0 (intialize counter
Step 3 repeat while A location is not equal to item loc=loc+1(search of the item)
End of loop
Step 4 if loc=n then loc=none (search is unsuccessful

Binary search:- if the list is unordered or not sorted then sequential search is the option but if the list or array is sorted then their is a simple method based on divide and conqueor method known as binary search method.
For ex. In our day to day life we used this method of searching for ex. If we want to searcha a name in which names are arranged alphabetically. We open a random page in the middle check the name given into it this checking of middle page tells whether the name we are searching lies in the first half middle half or second half if the name is found in middle page the search is over otherwise the half part in which name lies we searched again by dividing it into two parts and this process continues till we successful find the name otherwise search is unsuccessful. We take an array A. Whose elements are(first,Afirst+1,afirst+2, alast ) here 1st and the last elements are the locatikn of given array.
Now we determine the mid value which is obtain by using firmula mid=1st+last divided by 2 integer .
The function integer is ti assign the integer value to mid. If A (mid)=data is the value in A to be searched then the search is successful.otherwise a new segment that is left half or right half and search again.
Algorithm:—-
void binary search(A,lb,ub,data,loc)
Step 1. Set 1st=lb and set last =ub mid=integer (1st+last divided by.2 )
Step 2. Repeat step 3 and 4 while large is equal to 1st and A(mid) is not equal to data.
Step 3. If data is >A(mid) then
Set last mid-1 else 1st =mid+1(end of if else statement)
Step 4. Set mid=integer of 1st+last divided by 2 (end of step2 loop)
Step 5 if A (mid) =data then
Set loc=mid(search=successful)
else set loc=nul(search=unsuccessful)
Step 6 End.

2 dimensional array operations:-
Row major :- in this implementation of memory allocation is done row by row all elements in 1 st row stores first and then the elements of 2nd row and so on.
Column major:– in this implementation memory allocation is done by column by column that is all elements of 1st column then 2nd and so on
Address calculation:– like 1 d array the o.s. does not keep track of the location of every element of given 2 d array but it keeps track the address of 1st element which is known as base address. The address of any element can be calculated by following formulas:–
Row major implementation :- location of
W is the size of data type
row major formula:–A[I][J]=Base(A)+w(N(I-m)+(J-n)
Column major :–Base(A)+w(M(J-m)+(I-n)
Various operation of
Addition of 2 matrics
Subtractions of 2 matrics
Multiplications of 2 matrics.
Feel free to reach to comment section for the doubts….