Test1-S 2014
Test1-S 2014
Test1-S 2014
II SEMESTER 2013-2014
EEEF241/CSF241/INSTRF241MICROPROCESSOR PROGRAMMING AND INTERFACING
TEST I (OPEN BOOK)-Solutions
TIME: 60 Min. 28/02/2014 MM: 40
IDNO: Name:
Q1. Construct the machine code in hexadecimal for the following 80486(operating in 32-bit mode)
instructions. [4]
(i) MOV AL, ES: [EAX+2*ESI] 26 8A 04 70
Q3. For the following Instructions what will be the machine cycles executed by 8086 [4]
Instruction Cycles Instruction Cycles
A POP AX MEMR – Instruction B ADD [SI],AX MEMR – Instruction
MEMR – operand
MEMR – Into AX
MEMW - Result
C CBW MEMR – Instruction D INC Word Ptr [SI] MEMR – Instruction
MEMR – Operand
MEMW - Result
Q4. Write an 80486 ALP that will add the two nibbles in a data byte together and if there is a carry in the
nibble addition it will right ‘C’ into a memory location. If there is no carry in nibble addition it will write
‘N’ into the location. This has to be done on array of 25d data bytes stored from location dat1. The
result for each byte must be written from location car1.
For E.g. If
dat1 db 45h,89h,27h, 0F2h, 3Eh and so on
The program has to add 4 and 5 in case of first byte and there will be no carry in adding the two nibbles
(4-bit addition) so N has to be written into car1 and if case of 2nd data 8 and 9 will be added and result
will have a carry in the nibble addition so C will be written into next location.
Hence after the program is executed the location
car1 will have the values ‘N’, ‘C’, ‘N’,’C’,’C’ and so on [10]
.model Tiny
.486
.data
dat1 db 89h,3eh,0f1h,45h,23h,89h,3eh,0f1h,45h,23h,89h,3eh,0f1h,45h,23h,89h,3eh,0f1h,
45h,23h,89h,3eh,0f1h,45h,23h
car1 db 25 dup('N')
.code
.start
lea si,dat1
lea di,car1
mov cx,25
mov dh,'C'
x1: lodsb
mov ah,al
and al,0fh
and ah,0f0h
rol al,4
add ah,al
jnc x2
mov [di],dh
x2: inc di
loop x1
.exit
end
DS:0118H 45 54 46 F8 23 35 24 ‘I’
DS:0120H ‘N’ ‘T’ ‘E’ ‘R’ 7A 7A 7A 7A
DS:0128H 7A 7A X X X 33 00 0F
(b) For the code section of the above program. Fill in the table below. (You can assume that all status flags
are cleared initially). You only need to show contents of registers that are affected. Values must of
registers must be given in hexadecimal.
[3+9]
Q6. If a processor is working at 5 MHz and Ready Signal is made low for 3 T states a normal MEMR
machine cycle will execute for 1400 ns [2]