Professional Documents
Culture Documents
308 New
308 New
Practical 8
Aim-Write ALP to copy array numbers from source to destination.
Code:
org 100h
MOV SI,800H
MOV DI,900H
MOV CL,[SI]
INC SI
BACK: MOV BL,[SI]
MOV [DI],BL
INC SI
INC DI
DEC CL
JNZ BACK
Ret
Output:
Code:
org 100h
MOV SI,600H
MOV CL,03H
MOV BL,CL
BACK: ADD AL,[SI]
ADC AH,00H
INC SI
DEC CL
JNZ BACK
DIV BL
MOV [700H],AX
Ret
Output:
Code:
org 100h
MOV SI,700H
MOV CL,[SI]
MOV BL,CL
INC SI
MOV AL,00H
BACK: ADD AL,[SI]
ADC AH,00H
INC SI
DEC CL
JNZ BACK
DIV BL
MOV [900H],AX
Ret
Output:
Aim-Smallest Number
Code:
org 100h
MOV SI,400H
MOV CL,[SI]
MOV CH,00H
INC SI
MOV AL,[SI]
DEC CL
INC SI
BACK: CMP AL,[SI]
JC L1
MOV AL,[SI]
L1: INC SI
LOOP BACK
MOV [500H],AL
Ret
Output:
Code:
MOV SI,1000h
MOV CL,[SI]
DEC CL
REPEAT:
MOV SI,1000h
MOV CH,[SI]
dec CH
INC SI
REPCOM:
MOV AL, [SI]
INC SI
CMP AL,[SI]
JC AHEAD
XCHG AL,[SI]
XCHG AL,[si-1]
AHEAD:
dec ch
jnz repcom
DEC CL
JNZ REPEAT
HLT
Output:
Code:
org 100h
.DATA
ANS DB ?
.CODE
MAIN PROC
mov cx,[800h]
mov ax,0001
mov dx,0000
l1:
mul cx
loop l1
mov [0600h],ax
mov [0601h],dx
mov ANS,al
hlt
END MAIN
ret
LDRP-ITR Page No-
Microprocessor Architecture and programming 21BECE30308
Output:
Code:
org 100h
.DATA
ANS DB ?
.CODE
MAIN PROC
mov al,00h
mov si,700h
mov [si],al
add si,01h
add al,01h
mov [si],al
mov cx,[900h]
sub cx,0002h
l1:
mov al,[si-1]
add al,[si]
add si,01h
mov [si],al
mov ans,al
loop l1
hlt
END MAIN
ret
Code:
org 100h
mov si, 700h
mov di, 800h
mov dl,[di]
mov bl,01h
mov al,[si]
again:
cmp al,dl
jz avail
inc si
inc bl
mov al,[si]
cmp al,20h
jnz again
nodata:
mov cx,0000h
mov [di+1],cx
mov [di+3],cx
jmp over
avail:
mov bh,0ffh
mov [di+1],bh
mov [di+2],bl
mov [di+3],si
over:
hlt
LDRP-ITR Page No-
Microprocessor Architecture and programming 21BECE30308
Output:
Code:
include 'emu8086.inc'
org 100h
.model small
.data
arr db 8 dup(?)
.code
main proc
mov ax,@data
mov ds,ax
mov cx,8
mov si,offset arr
print "Enter the elements in array: "
loopIn:
mov ah,1
int 21h
mov [si],al
inc si
loop loopIn
mov ah,2
mov dl,10
int 21h
mov dl,13
int 21h
mov si,offset arr
mov cx,8
print "Array elements are : "
loopOut:
mov dl,[si]
mov ah,2
int 21h
mov dl,32
mov ah,2
int 21h
inc si
loop loopOut
main endp
ret
LDRP-ITR Page No-
Microprocessor Architecture and programming 21BECE30308
Output:
Code:
.DATA
MSG1 DB 10,13,'Enter number: $'
MSG2 DB 10,13,'Result:Number is Even$'
MSG3 DB 10,13,'Result:Number is Odd$'
DATA ENDS
DISPLAY MACRO MSG
MOV AH, 9
LEA DX, MSG
INT 21H
ENDM
.CODE
ASSUME CS:CODE, DS:DATA
START:
MOV AX, DATA
MOV DS, AX
DISPLAY MSG1
MOV AH, 1
INT 21H
MOV AH, 0
CHECK:
MOV DL, 2
DIV DL
CMP AH, 0
JNE ODD
EVEN:
DISPLAY MSG2
JMP DONE
ODD:
DISPLAY MSG3
DONE:
MOV AH, 4CH
INT 21H
CODE ENDS
END START
LDRP-ITR Page No-
Microprocessor Architecture and programming 21BECE30308
Output:
Code:
org 100h
mov si,700h
mov cl,[si]
mov ch,00h
inc si
mov di,750h
l1:
mov al,[si]
add al,[di]
mov [si],al
inc si
inc di
loop l1
hlt
Output: