[go: up one dir, main page]

0% found this document useful (0 votes)
22 views8 pages

Group 6 Microprocessor

micro processing

Uploaded by

Hana Yaregal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views8 pages

Group 6 Microprocessor

micro processing

Uploaded by

Hana Yaregal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

MEKDELA AMBA UNIVERSITY

Collage of computation and informatics


Department of software engineering

Group 6

Microprocessor and assembly language group assignment

Name ID no

1. Tibebe Difabachew……………………………………………1400183

2.Tsion Tafese………………………………………………....….1402392

3.Tsion Wendemu……………………………………………...….1402398

4.Yenew Daregot…………………………………………..……..1402494

5.Yohas Habtamu………………………………..……………….1402527

6.Yonas Sehale………………………………..…………………..1402530

Submitted to Mr. Ahmed S

Submitted date 13/10/2016

i
ii
1.Give the content of the flags register after execution of the following instruction. (SF, CF,OF, PF, ZF,
AF).

MOV AX, 6DB9H


MOV BX, 3C4AH
ADD AX, BX

SOLUTION:

MOV AX, 6DB9 H


MOV BX, 3C4A H
ADD AX, BX

AX=6DB9H
BX=3C4AH
AA03H

AX=0110 1101 1011 1001


BX=0011 1100 0100 1010

0110 1101 1011 1001


+0011 1100 0100 1010
=1010 1010 0000 0011

AF=1; there is a carry from bit 3 to bit 4.


OF=1; there is a carry from bit 14 to 15 but not carry out from bit 15.
SF=1; MSB is 1 or set.
PF=1; the lower byte of result has even numbers of ones.
CF=0; there is no carryout from bit 15.
ZF=0; the result is different from zero.

2. Assume that the registers have the following values (all in hex) and that CS=1000, DS =2000, SS =
3000, SI = 4000, DI = 5000, BX = 6080, BP = 7000, AX = 25FF, CX = 8791, and DX = 1299.

a, Calculate the physical address of the memory where the operand is stored

b, and the contents of the memory locations.

1
a) MOV [1250], DX

SOLUTION:

a, physical Address:

Move the content of DL into DS:1250


Move the content of DH into DS:1250+1
DL=99 H
DH=12 H
PA=DS *10 H + offset
PA=2000 *10 H+1250 // since our DS=2000
PA=20000 H +1250
PA= 21250 H

b, contents of memory location:

PA=21250 = 99 H //DL=99H
PA=21250 + 1 =21251 = 12 H //DH=12 H

b) MOV 50[BX + DI], BX

SOLUTION:

a, physical Address:

BL=80 H
BH=60 H
Move the content of BL into DS: Bx+DI+50
Move the content of BH into DS: BX+DI+50+1

PA=DS *10 H+BX+DI+50


PA=20000 H +6080+5000+50
PA=2B0D0 H

b, content of memory location:

2
PA=2B0D0 = 80 H //BL=80 H
PA=2B0D0+1 =2B0D1 = 60 H //BH=60 H

3. Using string instructions, write a program that transfers a block of data from DATA1 to DATA2.
Assume DATA1=” Abebe beso bela!”.

SOLUTION:

.model small
.stack 100
.data
data1 db "Abebe beso bela!$";
data2 db 16 dup(?);
.code
main proc
mov AX,@DATA
mov DS, AX
mov ES ,AX
CLD
Mov SI, offset Data1
Mov DI, offset Data 2
mov cx,16
REP MOVSB
mov AH,09H
int 21h
mov AH,4CH
int 21h
main endp
end main

4. Write a program to scan for the letter ‘P’, in ”MICROPROCESSOR” strings.

a) If the letter is found, display on screen ‘THE LETTER IS FOUND ! ’

b) If the letter is not found, display on screen ‘THE LETTER IS NOT FOUND !

3
SOLUTION:

.model small
.stack 100
.data
data1 db 'MICROPROCESSOR'
mesg1 db "the letter is found!$"
mesg2 db "the letter is not found!$"
.code
main proc far
mov AX,@DATA
mov DS,AX
mov ES,AX
lea DI,data1
CLD
mov CX,14
mov AL,'P'
REPNE SCASB
JE XX
mov AH,09H
lea DX,mesg2
int 21H
jmp EXIT
XX:mov AH,09H
lea DX,mesg1
int 21H
EXIT:MOV AH,4CH
int 21H
main endp
end main

5. Assuming that there is a spelling of “Ahmed" in an electronic dictionary and a user type

in “Ahimd", write a program that compares these two and displays the following

message, depending on the result:

a) If they are equal, display "The spelling is correct".

b) If they are not equal, display "Wrong spelling".

4
. MODEL SMALL
.DATA
DATA_DICT DB "Ahmed"
DATA_TYPED DB "Ahimd "
MESSAGE1 DB "The spelling is correct",'$'
MESSAGE2 DB "Wrong spelling",'$'
. CODE; write the code here

SOLUTION:

. MODEL SMALL
.DATA
DATA_DICT DB "Ahmed"
DATA_TYPED DB "Ahimd "
MESSAGE1 DB "The spelling is correct",'$'
MESSAGE2 DB "Wrong spelling",'$'

.CODE
MOV AX, @DATA
MOV DS, AX

LEA SI, DATA_DICT


LEA DI, DATA_TYPED

REPEAT:
LODSB
LODSB
CMP AL, AH
JNE NOT_EQUAL
OR AL, AL
JNZ REPEAT
MOV DX, OFFSET MESSAGE1
JMP DISPLAY_MESSAGE

NOT_EQUAL:
MOV DX, OFFSET MESSAGE2

DISPLAY_MESSAGE:

5
MOV AH, 09h
INT 21h

MOV AH, 4Ch


INT 21h
END

You might also like