# Nothing

Topics: Source code, Programming language, Assembly language Pages: 25 (3036 words) Published: September 27, 2010
UNIT -2
AIRTHMETIC OPERATIONS:
1. Write an assembly language program to add data located at offset 0100H in 2000H segment to another data byte available at 0600H in the same segment and store the result at 0700H in the same segment.

Data Segment
Org 2000h
Org 0100h
Num1 db 05h
Org 0600h
Num2 db 03h
Org 0700h
Result db ?
Data ends

Code segment
Assume CS: code, DS: data
Start: MOV AX, DATA
MOV DS, AX
MOV AL, NUM1
MOV BL, NUM2
MOV RESULT, AL
MOV AH, 4CH ; HALT
INT 21H
Code ends
End start

2. Repeat the same above without using data segment.

Code segment
Org 2000h
Assume CS: code
Start: MOV SI, 0100H
MOV AL, [SI]
MOV SI, 0600H
MOV BL, [SI]
MOV RESULT, AL
MOV AH, 4CH ; HALT
INT 21H
Code ends
End start

3. Write an assembly language program to add the contents of the memory location 2000H: 0500H to contents of 3000H: 0510H and store the result in 5000H: 0514H.

Code segment
Assume CS: code, DS: data
Start: MOV AX, 2000H
MOV DS, AX
MOV SI, 0500H
MOV AL, [SI]
MOV AX, 3000H
MOV DS, AX
MOV SI, 0510H
MOV BL, [SI]
MOV AX, 5000H
MOV DS, AX
MOV SI, 0514H
MOV [SI], AL
MOV AH, 4CH ; HALT
INT 21H
Code ends
End start
4. Write an assembly language program to add the immediate byte 05H to the data residing in memory location, whose address is computed using DS=2000H and offset=0600H.Store the result at 0700H.

Code segment
Assume CS: code, DS: data
Start: MOV AX, 2000H
MOV DS, AX
MOV AL, [0600H]
MOV [0700H], AX
MOV AH, 4CH ; HALT
INT 21H
Code ends
End start
5. Write an assembly language program for the addition of a series of 8-bit numbers.

Data Segment
Org 2000h
List db 05h, 12h, 99h, 68h, 50h
Result dw ?
Data ends

Code segment
Assume CS: code, DS: data
Start: MOV AX, DATA
MOV DS, AX
MOV CX, 05H
MOV SI, OFFSET LIST
MOV AL, [SI]
Back: INC SI
LOOP BACK
MOV RESULT, AX
MOV AH, 4CH ; HALT
INT 21H
Code ends
End start

6. Write an assembly language program to store the value 99H at 5 consecutive locations. Data Segment
Org 2000h
Num1 db 99h
Result db 01h dup (?) ; duplicate 1 location Data ends

Code segment
Assume CS: code, DS: data
Start: MOV AX, DATA
MOV DS, AX
MOV CX, 05H
MOV SI, OFFSET RESULT
Back: MOV [SI], NUM1
INC SI
LOOP BACK
MOV AH, 4CH ; HALT
INT 21H
Code ends
End start
7. Write an assembly language program to move 5 bytes of data using indirect addressing. Data Segment
Org 2000h
List db 05h, 12h, 99h, 68h, 50h
Result db 05h dup (0) ; duplicate 5 locations with 0’s Data ends
Code segment
Assume CS: code, DS: data
Start: MOV AX, DATA
MOV DS, AX
MOV CX, 05H
MOV...