pesit bangalore south campuspesitsouth.pes.edu/pdf/2018/ec/15ec42-c-parallel.pdfq.no. questions and...

17
USN 1 P E PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Electronics and Communication INTERNAL ASSESSMENT TEST 1 Date : 26/02/2018 Marks: 40 Subject & Code : Microprocessor - 15EC42 and 10EC62 Sem & Sec: 5 th sem - C and parallel Name of faculty : Shwetha S Bhat Time : 11:30am -1:00pm Note: Answer FIVE full questions, selecting any ONE full question from each part. Marks PART 1 1 a With a neat diagram explain the internal architecture of 8086 Microprocessor 5 b Give a brief of all the registers of 8086 Microprocessor 3 OR 2 With example show how the following instructions are used: a.) AAM b.) AAD c.) PUSHF d.) LAHF 8 PART 2 3 a Write an ALP to implement DAS instruction 4 b If DS = AB04H, CS = 9960H, SS = 3B00H, BP = 7E74H, SP = 0135H, SI = 1245H, DI = 4356H, then determine physical address of the following instructions: i) MOV [BP+DI+6], AH ii) ADD AL, [5036H] 4 OR 4 a Explain memory organization of 8086 microprocessor 4 b Write an ALP to find 2 nd largest number in a series of five 8-bit numbers using procedures 4 PART 3 5 a Explain memory segmentation of 8086 microprocessor 4 b Evaluate the assembler instruction code for the following if the opcode of ADD is 000000 ADD 0FABE [BX] [DI], DX 4 OR 6 Write an ALP to count the number of one’s and zero’s in a 16bit number using shift/rotate instruction 8

Upload: buinhu

Post on 26-Jun-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

USN1 P E

PESIT Bangalore South CampusHosur road, 1km before Electronic City, Bengaluru -100

Department of Electronics and Communication

INTERNAL ASSESSMENT TEST 1Date : 26/02/2018 Marks: 40Subject & Code : Microprocessor - 15EC42 and 10EC62 Sem & Sec: 5th sem - C and parallelName of faculty : Shwetha S Bhat Time : 11:30am -1:00pm

Note: Answer FIVE full questions, selecting any ONE full question from each part. Marks

PART 11 a With a neat diagram explain the internal architecture of 8086 Microprocessor 5

b Give a brief of all the registers of 8086 Microprocessor 3

OR2 With example show how the following instructions are used:

a.) AAM b.) AAD c.) PUSHF d.) LAHF8

PART 23 a Write an ALP to implement DAS instruction 4

b If DS = AB04H, CS = 9960H, SS = 3B00H, BP = 7E74H, SP = 0135H, SI = 1245H,DI = 4356H, then determine physical address of the following instructions:i) MOV [BP+DI+6], AH ii) ADD AL, [5036H]

4

OR4 a Explain memory organization of 8086 microprocessor 4

b Write an ALP to find 2nd largest number in a series of five 8-bit numbers usingprocedures

4

PART 35 a Explain memory segmentation of 8086 microprocessor 4

b Evaluate the assembler instruction code for the following if the opcode of ADD is000000ADD 0FABE [BX] [DI], DX

4

OR6 Write an ALP to count the number of one’s and zero’s in a 16bit number using

shift/rotate instruction8

PART 47 a Write an ALP to generate 1st - 10 numbers of a Fibonacci series and store them in

a memory location8

OR8 a Write an ALP to find the LCM of two 8-bit numbers 8

PART 59 a Explain the different addressing modes in 8086 with example 8

OR10 a Write and ALP to find the EVEN and ODD numbers in an array of five 16-bit

numbers and store them in two different arrays in memory8

P.E.S. Istitute of Technology( Bangalore South Campus)Hosur Road, ( 1Km Before Electronic City), Bangalore 560100.

Department of Electronics and CommunicationSCHEME AND SOLUTION

__I__ INTERNAL TESTFaculty: Shwetha S Bhat Semester: 4th sem C section

Subject: Microprocessors Sub. Code: 15EC42 and 10EC62

Q.No. Questions and its answers Marks2 With example show how the following instructions are used:

a) AAM : ASCII multiplicationThe aam instruction adjusts the result of a mul instruction

Multiplication should not be performed on ASCII» Can be done on unpacked BCD•The aam instruction works as followsAL is divided by 10Quotient is stored in AHRemainder in AL

aam does not work with imul instruction

Example 1mov AL,3 ; multiplier in unpacked BCD formmov BL,9 ; multiplicand in unpacked BCD formmul BL ; result 001BH is in AXaam ; AX := 0207H

or AX,3030H ; AX := 3237H

b) AAD : ASCII divisionThe aad instruction adjusts the numerator in AX before dividing two unpacked decimalNumbers

The denominator is a single unpacked byte The aad instruction works as followsMultiplies AH by 10 and adds it to AL and sets AH to 0Example: » If AX is 0207H before

Aad» AX is changed to 001BH afteraad

aad instruction reverses the changes done by aam

Example: Divide 27 by 5mov AX,0207H ; dividend in unpacked BCD formmov BL,05H ; divisor in unpacked BCD formaad ; AX := 001BHdiv BL ; AX := 0205H

• aad converts the unpacked BCD number in AX to binary form so that divcan be used

c) PUSHF

Push Flag Register Onto StackOperation : flags register -> stackDescription : For a word, SP - 2 and copies FLAGS to the new top of stack pointed to by SP.

d) LAHF

Load Register AH From Flags

Copies bits 0-7 of the flags register into AH. This includes flags AF, CF, PF, SF and ZF other bits areundefined.

4 b) Write an ALP to find 2nd largest number is a series of five 8bit numbers using procedures

.MODEL SMALL

.STACK

.DATANUM DB 06H,09H,08H,03HLEN DW $-NUMRES DB 00H.CODEMOV AX,@DATAMOV DS,AXLEA DI,NUMMOV SI,DIMOV CX,LENDEC CXCALL LARGESTPUSH DIPUSH AXMOV [DI],00HMOV DI,NUMMOV SI,DIMOV CX,LENDEC CXCALL LARGESTPOP AXPOP DIMOV [DI],ALMOV AH,4CHINT 21H

LARGEST PROCMOV AL,[SI]BACK:INC SICMP AL,[SI]JNC NEXTMOV AL,[SI]MOV DI,SINEXT:LOOP BACKRETLARGEST ENDPEND

`

6 Write an ALP to count the number of one’s and zero’s in a 16bit number using shift/rotate instruction

CODE.MODEL SMALL.DATAM1 DB “THE NUMBER OF LOGICAL ONESARE:$”M2 DB “THE NUMBER OF LOGICAL ZEROSARE:$”M3 DB 00H,00HM4 DB “ENTER THE NUMBER WHOSE ONESAND ZEROS ARE TO BE COUNTED:$”M5 DB 00HM6 DB 00H.CODEMOV AX,@DATAMOV DS,AXLEA SI,M3LEA DX,M4MOV AH,09HINT 21HMOV CX,0002HUP:MOV AH,01HINT 21HMOV [SI],ALINC SILOOP UPMOV AH,00HMOV AL,M3(0)SUB AL,30HMOV BL,10HMUL BLMOV CL,M3(1)SUB CL,30HADD AL,CLMOV CL,08HUP1: CLCSHR AL,01HJC ONESADD M5,01H

DEC CLJNZ UP1JMP EXIT1ONES:ADD M6,01HDEC CLJNZ UP1EXIT1:LEA DX,M2MOV AH,09HINT 21HADD M5,30HMOV DL,M5MOV AH,02HINT 21HLEA DX,M1MOV AH,09HINT 21HADD M6,30HMOV DL,M6MOV AH,02HINT 21HMOV AH,4CHINT 21HEND

8. Write an ALP to find the LCM of two 8-bit numbers

.MODEL SMALL

.DATAN1 db 7N2 db 2R db 2 dup (0).CODEMOV AX,@DATAMOV DS,AXMOV AL,N1MOV BL,N2START: PUSH AL

PUSH BLDIV BLCMP AH,0JE EXITPOP DLPOP ALADD AL,N1ADC AH,0JMP START

EXIT: POP BLPOP ALMOV R, AHMOV AH,4CHINT 21HEND

10. Write and ALP to find the EVEN and ODD numbers in an array of five 16-bit numbers and store themin two different arrays in memory

.MODEL SMALL

.DATAARR DW 1234H,2345H,3456H,4567H,5678HLEN DW ($-ARR)/2EVENARR DW 8000HODDARR DW 9000H

.CODEMOV AX,@DATAMOV DS,AXMOV CX,LEN

LEA SI,ARRMOV BX,ODDARRMOV DI,EVENARR

BACK:MOV AX,[SI]SHR AX,01HJNC EVEN1MOV AX,[SI]MOV [BX],AXINC BXINC BXJMP NEXT

EVEN1:MOV AX,[SI]MOV [DI],AXINC DIINC DI

NEXT:INC SIINC SILOOP BACK

MOV AH,4CHINT 21HEND