Assume that the offset is beginning at EF00H, what is the offset of data that contain value (55)? Marks DB 88, 44, 55, 90, 77 Answer: EF02H Assume that the offset is beginning at EF00H, what is the offset of data that contain value (55)? Marks DW 88, 44, 55, 90, 77 Answer:EF04H Assume that the offset is beginning at 2EF00H, what is the offset of data that contain value (5)? Std DD 1, 6, 5,8,9 Answer:2EF08H What is the content of AX, after the execution of the following instructions? MOV AL, 95 SUB AH, AH MOV BH, 10 DIV BH Answer: 0509H Number of the times the instruction sequence below will loop before coming out of loop is MOV AL, 00H Al: INC AL JNZ Al Answer:256 After execution the following instructions, what is the contents of the register AX. Give your answer in Hexadecimal. array DW 1111H, 2222H, 3333H, 4444H MOV BX, 1 MOV SI, 6 MOV AX, array[BX] [SI-2] Answer:4433H ) مختلف عليها ع الكىمبايلر4444)/ عند الدكتىر4433 Write the contents of AX, CX, and Flags in this order (CF, PF, AF, SF, and ZF) after the execution of the following instructions. MOV CX, 0604H MOV AX, OA98H SHL AH, CL ADD CX, AX Answer: AX=0A80H,CX=1084H,CF=0,PF=0,AF=0,SF=1,ZF=0 Consider the following fragment of assembly code: DATA DW 7,6,5,4 COUNTER EQU 4 … XOR AX, AX STC MOV CX, COUNTER MOV SI, OFFSET DATA NEW: ADC AX, WORD PTR [SI] ADD SI, 2 LOOP NEW NEXT: --------------What will be the value in AX when control reaches NEXT? Answer:23 Assume AL register contains the ASCII code for a letter Z; we need to convert to z. Write one instruction to do that. Answer: MOV AL,Z OR AL,00100000B ;20H Assume the following same initial processor state AX 6521H CF AF ZF SF PF BX ABCDH 1 0 1 0 0 CX 0105H DX 876FH OF 0 What are the flags after CMP AH, CL Answer : CF=0,ZF=0,SF=0 Assume the following same initial processor state AX 6521H BX ABCDH CF AF ZF SF PF CX 0105H 1 0 1 0 0 DX 876FH What will be the contents of AX after SUB AL, AH ? Answer: AX=65BCH OF 0 Write a subroutine that makes all bits of the register Al zero if the least and most significant bit of AL are 0, otherwise, makes all bits of AL one. Answer: MOV BL,AL OR BL,01111110B CMP BL,01111110B JE ZERO MOV AL,OFFH RET ZERO: MOV AL,00H RET Consider the following Boolean expression: IF ((X>Y)AND (Z < T))OR (A± B) THEN C = D Write an assembly language code to implement the above expression. Assume that all variables are declared. Answer: COM JA CMP MOV JMP OA: CMP JMP MOV Z,T OA X,Y C,D DONE A,B DONE C,D Write on line to declare 120 4-Bytes words, starting at memory location with offset 1200H, all initialized to 0, and name it DATA . Answer: ORG 1200H DATA QB 120 DUP(0) We need to multiplies the most significant 4 bits and least significant 4 bits of register AX, write a subroutine to do that. Answer: MOV BL,AL AND AX,0F000H MOV CX,4H MOV AL,AH ROR AL,CL AND BL,0FH MUL BL RET Write the contents of AX, and Flags in this order (CF, PF. AF, SF. And ZF) after the execution of the following instructions MOV MUL SUB ADC AX, 8F0AH AL AH, AL AX, AX Answer:AX=38C9H,CF=1,PF=1,AF=0,SF=0,ZF=0 Q1. (5%) According to the figure below that shows the memory circuit of 8086 microprocessor. Note: A16 – A19 are not used, (don’t cares). = 1. What is the total size of the memory in the circuit? Answer:4k 2. What are the beginning and ending address of the memory in chip 1? Answer:8800H-8FFFH 3. What are the beginning and ending address of the memory in chip 2? Answer: B000H-B7FFH 4. Are the memory chips in circuit ROM or RAM? Why? Answer: ROM , HAVE ONLY READ SIGNAL RD 5. How will you replace the two NANDs gates in the circuit with one 3-to-8 decoder without changing the memory size or the memory addresses? Assume that the decoder has one active high enable G1, and two active low enables G2A , G2B. Attach your sketch. Y1 TO Chip 1,Y6 TO chip2 Q2 For an 8086 system working in real mode, the following address decoding circuit is given. 1. What range of addresses (in H) corresponds to each output of the decoders? 2. What is the total number of bytes in all ranges decoded by using this circuit? SIZE OF MEMORY = 16 KBYTE Q3 Design a memory interface for the 8086, which will provide 256K bytes of SRAM, organized as 128K x 16 bits, starting at address 40000H and using SRAM chips 32K x 8 bit. The SRAM chips have three control signals ̅̅̅̅̅, ̅̅̅̅ and ̅̅̅̅. Use the 74LS138 (3- to-8 decoder) for the implementation of the decoding circuit. The 74LS138 has three control signals G1, ̅̅̅̅̅̅, and ̅̅̅̅̅̅. بالدوسية الحمرا Q4. There is a need to add 56K byte of memory to a certine microprocessor based system (20-bit address bus and 8-bit data bus) in the address range A0000H – ADFFFH. The quantity of memory chips and the corresponding address ranges are as follows: 4 (8Kx8) RAM chips will be used to decode A0000H – A7FFFH 2 (4Kx8) RAM chips will be used to decode A8000H – A9FFFH 1 (16Kx8) RAM chip will be used to decode AA000H – ADFFFH a) Design an address decoding circuit using a 74LS139 decoder (search on how to use this decoder). Show all connections and signals in detail. b) Determine the available address range and size in KB in the memory map for any additional memory chip. Q1. Write an assembly language program to count how many times the character A is repeated in a string entered by the user. Print the result on the screen taking into account that the number of characters can be more than 9, but less than 255. Assembly code: table DB '0123456789ABCDEF' RE DB 10,13 ,'NUMBER OF A IS : ','$' .CODE MOV BL,00H MOV CX,10H INPUT: MOV AH,01 INT 21H CMP AL,'A' JNE CONT INC BL CONT: LOOP INPUT ;NUMBER OF CHARS YOU WANT TO ENTER MOV AH,09 MOV DX,OFFSET RE INT 21H ;THE REST OF THE CODE I TOKE FROM THE INTERNET CAUSE WHEN I WAS TRYING TO PRINT THE VALUE IN HEX IT CONVERTS IT INTO ASCII AND I DONT KNOW HOW TO CONVERT IT, I HOPE IT DOESNT DO MUCH ON MY GRADE MOV DL, BL LEA BX, table ; load data table. MOV AL, DL SHR AL, 4 ; leave high part only. XLAT ; get hex digit. MOV AH, 0Eh ; teletype sub-function. INT 10h MOV AL, DL AND AL, 0Fh ; leave low part only. XLAT ; get hex digit. MOV AH, 0Eh ; teletype sub-function. INT 10h HLT ENDP RET Q2. Without using string advanced string operations, write an assembly program to check if a password entered by the user is correct or not. Print “Your password is correct” or “You password is incorrect” accordingly. Code. .model small .DATA PASSW DB 'ABCD1234' TRUE DB 10,13, 'Your password is correct', '$' FALSE DB 10,13, 'Your password is incorrect', '$' .CODE MOV SI,@DATA MOV DS,SI MOV DI,OFFSET PASSW MOV CX,08H INPUT: MOV AH,01H INT 21H PUSH AX PUSH [DI] INC DI LOOP INPUT MOV CX,08H CHECK: POP AX POP BX CMP AL, BL JNE NOTCORRECT LOOP CHECK MOV AH,09H MOV DX, OFFSET TRUE INT 21H HLT NOTCORRECT: MOV AH,09H MOV DX, OFFSET FALSE INT 21H HLT ENDP RET 1. ADD BX,[0220] is a legal operation. Select one: True False The correct answer is 'True.' 2. The total physical memory which can be interfaced to an 8086 processor is: Select one: a. 64 Kbyte b. 64 byte c. 1 Mbyte d. 1 Gbyte e. 1 Kbyte The correct answer is: 1 Mbyte 3. The default segment size of an 8086 system is: Select one: a. 64 byte b. 1 Gbyte c. 64 Kbyte d. 1 Kbyte e. 1 Mbyte The correct answer is: 64 Kbyte 4. Which of the following pins is used to enable the most significant bits of the data bus during read/write operations? Select one: a. READY b. BHE ’ c. RD’ & WR’ d. ALE e. M/IO’ The correct answer is: 'BHE’ 5. High level programming language is machine specific. Select one: True False The correct answer is 'False.' 6. MOV AX,DS is a legal operation. Select one: True False The correct answer is 'False.' 7. MOV CX,2255H is a legal operation. Select one: True False The correct answer is 'True.' 8. Which of the following pins is used in the demultiplexing of the 8086 Address/data lines Select one: a. HOLD b. DT/R’ c. BHE’ d. READY e. ALE The correct answer is: ALE 9. A0 -A19 are used to access address lines only. Select one: True False The correct answer is 'True.' 10.Which of the following pointers is used with the stack segment? Select one: a. BP b. BX c. SP d. IP e. CS Feedback The correct answer is: SP 11.If AX=7722, BX=2255, CX=C423, SP=3328. What are the contents of BX after the following code is executed PUSH AX PUSH BX POP CX Select one: a. 3326 b. 3328 c. C423 d. 2255 e. 7722 The correct answer is: 2255 12.The reason for separating the BIU and EU inside the 8086 CPU was to: Select one: a. Implement pipelining b. Any part can be easily replaced if it breaks down c. Be compatible with the 8088 d. Split 16 bit registers to 8 bits e. Calculate the physical address. The correct answer is: Implement pipelining 13.MOV DH,CH is a legal operation. Select one: True False The correct answer is 'True.' 14.If AX=2255, BX=7722, CX=C423, SP=3328. What are the contents of CX after the following code is executed PUSH BX PUSH AX POP CX Select one: a. 3326 b. 2255 c. 3328 d. 7722 e. C423 The correct answer is: 2255 15.If ADD AX,BX is executed, the value of the parity flag will depend whether the number of zeros is odd or even. Select one: True False The correct answer is 'True.' 16.When using high level programming language, the programmer must know all the internal details of the CPU, including the register sizes, memory capacity, and instruction details. Select one: True False The correct answer is 'False.' 17.MOV FR,2255H is a legal operation. Select one: True False The correct answer is 'False' 1. ADD *BX+,*0220+ is a legal operation. Select one: True False The correct answer is 'False'. 2. If CS=82B6H and IP=434AH, what is the Physical address? Select one: a. 434AH b. 92B5FH c. 86EAAH d. 82B60H The correct answer is: 86EAAH 3. The most significant part of the address bits are sent out on lines through A16 – A19. Select one: True False The correct answer is 'True'. 4. The status of the PF after the execution the following instructions is 1: MOV CX, 173FH MOV AX, 8A9EH ADD AL, CH ADD CH, AL Select one: True False The correct answer is 'True'. 5. The 16 bit flag of 8086 microprocessor is responsible to indicate Select one: a. The condition of memory b. The condition of result of ALU operation c. The result of addition d. The result of subtraction The correct answer is: The condition of result of ALU operation 6. The microprocessor determines whether the specified condition exists or not by testing the carry flag. Select one: True False The correct answer is 'False' 7. Given that SS=2400, SP=8631H, AX=4FA6H, and DX=8C3FH. The contents of registers AL=3FH, DH=4FH and SP=8632H after the execution of the following lines of instructions PUSH AX PUSH DX POP AX POP DX Select one: True False The correct answer is 'False'. 8. Suppose that before the following code is executed the top of the stack SP=1402H MOV AX,1 MOV BX,2 MOV CX,3 Rep: MUL BL PUSH AX DEC CX JNZ Rep POP BX POP CX POP DX NOP What is the content of DX when reaching the NOP instruction. Select one: a. 0004H b. 0008H c. 1402H d. 0002H The correct answer is: 0002H 9. Assume that the registers have the following values (all in Hex) , CS = 1100, DS= 2100, SS= 3100, SI= 4100, DI= 5100, BX= 6180, BP= 7200, AX= 25FF, CX= 8791, and DX= 1299. Calculate the physical address of the memory location where the operand is stored for the following MOV [SI], AL Select one: a. 25100H b. 36104H c. 25101H d. 38200H The correct answer is: 25100H 10. The status of the PF after the execution the following instructions is 1: MOV CX, 173FH MOV AX, 8A9EH ADD AL, CH ADD CH, AL Select one: True False The correct answer is 'True'. 11. Given that SS=2800, SP=8631H, AX=4FA6H, and DX=8C3FH. The physical address of the memory location pointed by the stack pointer after execution of the following lines of instructions is 2C631H. PUSH AX PUSH DX POP AX POP DX Select one: True False The correct answer is 'False'. 12. The index register are used to hold Select one: a. offset address b. segment memory c. offset memory d. memory register The correct answer is: offset address 13. Given that SS=2400, SP=8631H, AX=4FA6H, and DX=8C3FH. The contents of registers AL=3FH, DH=4FH and SP=8631H after the execution of the following lines of instructions PUSH AX PUSH DX POP AX POP DX Select one: True False The correct answer is 'True'. 14. The 8086 fetches instruction one after another from stack segment of memory. Select one: True False The correct answer is 'False' 15. The physical address of the stack is obtained by SS: SP combination. Select one: True False The correct answer is 'True'. 16. Suppose that before the following code is executed the top of the stack SP=1402H MOV AX,1 MOV BX,2 MOV CX,3 Rep: MUL BL PUSH AX DEC CX JNZ Rep POP AX POP BX POP CX POP DX NOP What is the value of SP when reaching the NOP instruction. Select one: a. 1404H b. 0008H c. 1402H d. 1406H The correct answer is: 1402H 17. "In minimum mode of the 8086, AD0-AD15 lines are multiplexed, while A16-A19 are not" This claim is: Select one: a. Always incorrect b. Some times correct, depending on the case c. Always correct d. Cannot be determined, and requires more information The correct answer is: Always incorrect 18. The status of the CF after the execution the following instructions is 1: MOV CX, 173FH MOV AX, 8A9EH ADD AL, CH ADD AX, AX Select one: True False The correct answer is 'True'. 19. A 20-bit address bus can locate 1,048,576 locations. Select one: True False The correct answer is 'True'. 20. If CS = 0701H, SS = 0801H, SI = 0100H and IP = 0108H the address of the next instruction is 07110H. Select one: True False The correct answer is 'False'. 21. The" PUSH source" instruction copies a word from source to the stack. Select one: True False The correct answer is 'True'. 22. The microprocessor determines whether the specified condition exists or not by its flag. Select one: True False The correct answer is 'True'.