MICRO
UNIT – 3Programming – 1 Q1) Explain PUSH and POP instruction for 8086?A1) The PUSH instruction transfers two or four bytes of data to the stack. It copies content of the internal register set, except the segment registers to the stack. The PUSHA i.e push all instruction copies the register to the stack in given order AX, BX, CX, DX, BX, SP, BP, SI and DI. The PUSHF copies the content of flag register to the stack. PUSHAD and POPAD instructions push and pop the contents of the 32-bit register set in 80386 - Pentium 4. PUSHA and POPA instructions do not function in the 64-bit mode of operation for the Pentium 4
Fig 1 PUSH InstructionsThe POP instruction removes data from the stack and places it into the target 16-bit register. POPF removes 16-bit number from the stack and places it into the flag register. The POPFD removes 32-bit number from the stack and places it into the extended flag register. POPA removes 16-bit data from stack and places it into the register in following order DI, SI, BP, SP, BX, DX, CX, AX.
Q2) Write the instructions to transfer address in 8086?A2) Instructions to transfer the address LEA − It loads the address of operand to the given register. LDS − Used to load DS register and other given register from the memory LES − Used to load ES register and other given register from the memory. Q3) Write the instructions to transfer flag register in 8086?A3) Instructions to transfer flag registers LAHF − It loads AH with the lower byte of the flag register. SAHF − It stores AH register to lower byte of the flag register. PUSHF − It copies the flag register at the top of the stack. POPF − It copies a word at the top of the stack. Q4) Write the string data transfer instructions?A4) It is a group of words and their memory is always placed in a sequential order.Following are the instructions under this group − REP − It repeats the given instruction till CX ≠ 0. REPE/REPZ − It repeats the given instruction until zero flag ZF = 1 or CX = 0. REPNE/REPNZ − It repeats the given instruction until zero flag ZF = 1 or CX = 0. MOVS/MOVSB/MOVSW − It moves the byte from one string to another. COMS/COMPSB/COMPSW − It compares two string bytes. INS/INSB/INSW – It’s an input string byte from the I/O port given to the memory location. OUTS/OUTSB/OUTSW − It’s an input string byte from the memory location to the I/O port. SCAS/SCASB/SCASW − It scan’s a string and compares its byte with a byte present in AL or string word with a word present in AX. LODS/LODSB/LODSW − It stores the string byte into AL or AX. Q5) Write the control instruction for process control action of processor in 8086?A5) These instructions are used to control the processor action by setting/resetting the flag values.Following are the instructions under this group − STC – It sets CF to 1 CLC – It clears CF to 0 CMC − It complements the carry flag CF. STD − It sets the direction flag DF to 1 CLD – It clears the direction flag DF to 0 STI − It enables INTR input. CLI − It clears the interrupt enable flag. Q6) What are segment override prefix?A6) One of the segment registers is always used as the segment when evaluating an address. The available segment registers are the Data Segment (DS), Extra Segment (ES), Stack Segment (SS), or Code Segment (CS). A segment override prefix allows any segment register (DS, ES, SS, or CS) to be used as the segment when evaluating addresses in an instruction. An override is made by adding the segment register plus a colon to the beginning of the memory reference of the instruction as in the following examples: mov ax, [es:60126] Use es as the segment mov ax, [cs:bx] Use cs as the segment mov ax, [ss:bp+si+3] Use ss as the segment Q7) What are assembler directives explain in detail?A7) They convert assembly language program to machine language. The basic aim of the assemble directive are to sow the beginning and end of program. They give storage location for data. They also define the start and end of different segments.They are also called as pseudo-opcode. These instructions are neither translated into machine code nor assigned any memory location in the object file. Some of the important assembler directives for an assembler or a cross assembler are listed and described here.Data -Bytes (Data Bytes): Assemble bytes of data are stored in successive memory location until all values are stored. This is a convenient way of writing a data string.Exapmle-1If we do not use LDA, 4150HMOV B,AOrMVI B, 25HMOV A, BWe use DB, 25H, 29H Data Word (DB) It is used to just initialise an area of 2 bytes at a time. For example: DW 2050HData Quard Word (DQ)It initialises 4 word or 8-bits in one instruction that means we take word which occupy a 8-bit number of decimal. For example: DQ 2050 95 76 30 75 95 86 HDefinite 10 Bit (DT) It is similar to DQ but it occupies 2 bits extra. For example: DT 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 AB H.Define Double Word (DD)It is similar to DQ and DT. For example: DD 2050 60 75HDefinite Storage Location (DS)Reserves a specified number of memory locations. In this example four memory locations are reserved for OUTBUF. For example: OUTBUF DS4ORGIf we use ORG 4000H that means the next block of instructions should be stored in memory location starting 4000H.EQU (equate)Generally, we transfer any information in port address. Instead of MVI A, 09H OUT PAPA EQU 40HENDIt is similar to HALT. But the HLT suggest the end of program but that does not necessarily mean it is the end of the assembly. Q8) Write the instructions for performing division in 8086?A8) Instructions to perform division DIV − It divides the unsigned word or unsigned double word by word. IDIV − It divides the signed word or signed double word by word. AAD − It is ASCII adjust after division. CBW − It copies of sign bit of the lower byte. CWD − It fills the upper word of the double word with the sign bit of the lower word. Q9) Write the instructions to perform addition in 8086?A9) Instructions to perform addition ADD − It adds the provided word to word. ADC − It adds word with carry. INC − It increments the provided byte by 1. AAA − It adjusts ASCII after addition. DAA − It is decimal adjust. Q10) What is special addressing mode in MOV?A10) When memory data are referenced by only the displacement mode of addressing. Example MOV [1000H], DL. Whenever an instruction has only a displacement, the MOD field is always 00 and the R/M field is always 110
Fig 2 Special Addressing Mode used by MOV [1000H], DL
Q2) Write the instructions to transfer address in 8086?A2) Instructions to transfer the address
0 matching results found