You are on page 1of 4

SWE 1003 - Digital Logic and Microprocessors Lab

Assessment III - Microprocessor

1. Write an ALP to perform 16- bit addition and subtraction.


mov ax,1213h
mov bx,1516h
add ax,bx
mov 2000h,ax
hlt
2. Write an ALP to find the product and quotient and remainder of
two 16 bit numbers.
3. Program to transfer block of ten 16-bit data to from one location
to the other location in the memory.
;BLOCK TRANSFER
MOV SI,2000H
MOV DI,2050H
MOV CL,13H

LOOP:MOV AX,[SI]
MOV [DI],AX
INC SI
INC DI
DEC CL
JNZ LOOP
HLT

4. Write an ALP to find the smallest among three numbers.


MOV SI, 1000h
MOV DI, 1010h
MOV CL, 05h
Loop1:
INC SI
MOV BL, [SI]
CMP AL, bl
dec cl
JC loop
MOV AL, BL
loop:

jnz LOOP1
mov [di],al
HLT

5. Write an ALP to separate odd and even number from a given


sequence of 10 numbers.

mov si,2000h
mov di,2050h
mov cl,0ah
back:mov al,[si]
and al,01h
jnz skip
mov al,[si]
mov [di],al
inc di
skip:inc si

dec cl
jnz back
6. Write an ALP to find the factorial of a given number.
7. Write an ALP to generate the average of n numbers.
MOV SI,1000H
MOV AL,[SI]
MOV CL,05H
LOOP: INC SI
ADD AL,[SI]
DEC CL
JNZ LOOP
mov [1010h],al
mov bl,05h
div bl

HLT
8. Write an ALP to generate a Fibonacci sequence of 13 numbers.

MOV SI,1000H
MOV CL,0DH
MOV [SI],00H
INC SI
DEC CL
DEC CL
MOV [SI],01H
L:MOV AL,[SI-1]
ADD AL,[SI]
INC SI
MOV [SI],AL
DEC CL
JNZ L
HLT

9. Write an ALP to sort a given array of elements in ascending


order.

10. Write an ALP to sort a given array of elements in


descending order.

You might also like