Assembly language programs 8086




















You signed out in another tab or window. INC SI. INC DI. DEC CX. INT 21H. MOV CX , 9. SHL AL , 1. ADD DL , '0'. SUB CX , 1. IF CX! MOV BL , 2. DIV BL. ADD BL , 1. LESS :. SUB BL , 1. ARR DB? ADD SI , 9. MUL BL. Assembly level programming is very important to low-level embedded system design is used to access the processor instructions to manipulate hardware.

It is a most primitive machine level language is used to make efficient code that consumes less number of clock cycles and takes less memory as compared to the high-level programming language. It is a complete hardware oriented programing language to write a program the programmer must be aware of embedded hardware. Here, we are providing basics of assembly level programming The assembly programming language is a low-level language which is developed by using mnemonics.

Before writing the program the embedded designers must have sufficient knowledge on particular hardware of the controller or processor, so first we required to know hardware of processor. The microprocessor requires a program to perform the operations that require a memory for read and save the functions. The assembly level programming is based on the memory registers.

A Register is the main part of the microprocessors and controllers which are located in the memory that provides a faster way of collecting and storing the data. If we want to manipulate data to a processor or controller by performing multiplication, addition, etc. The microprocessor contains various kinds of registers that can be classified according to their instructions such as;.

SHR is a logical shift right instruction used for unsigned operands. It shifts the bits of operand one by one to the right. In every shift, the least significant bit goes to the carry flag and insert zeros in the higher bit. The operand to be shifted can be a register or a memory location. Specify the number of shifts by loading the value into CL register. If the bits are to be shifted once, then specify it in the instruction. The destination operand can be a register, or a memory location and count indicate the number of shifts.

So the least significant bit which is 1 goes to carry flag and all others bits are shifted by 1. Insert 0 at the most significant bit. So, the final result obtained after shifting is whose hexadecimal value is This instruction is arithmetic right shift which deals with signed operands. The operation of this instruction is similar to the SHR instruction.

The only difference is when the bits are shifted to the right, the empty bits at MSB are filled with sign bit instead of zeros. This instruction can also be used for division of signed number by 2 if the count is 1. There are two shift left instructions. One is used for signed operands and the other one is used for unsigned operands. Both instructions are explained in this section. The SHL is the logical left shift for unsigned operands. It shifts the operand bits to the left.

The destination can be a register or a memory location. The number of shifts are stored in CL register which is then loaded in the count operand.



0コメント

  • 1000 / 1000