Tuesday, March 4, 2014

MPP Experiment 4

The download contains both the algorithms and flowcharts along with the answer to Q3. Q1 can be found in techmax/technical and Q2 is fairly easy, so it has been skipped.

CLICK HERE TO DOWNLOAD!

Here are the codes:

SMALLest number:
.model small
.stack 100h
data segment
array db 50h,20h,99h,30h,40h,10h,60h,70h,80h,90h
max db 0ffh
data ends
code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax
xor dl,dl
mov cl,0Ah
lea bx,array
mov al,max
back: cmp al,[BX+DI]
jc skip
mov dl,[BX+DI]
mov al,dl
skip: inc di
dec cl
jnz back
mov max,al
hlt
code ends
end start

LARGEest number:

.model small
.stack 100h
data segment
array db 10h,20h,99h,30h,40h,50h,60h,70h,80h,90h
max db 0
data ends
code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax
xor dl,dl
mov cl,0Ah
lea bx,array
mov al,max
back: cmp al,[BX+DI]
jnc skip
mov dl,[BX+DI]
mov al,dl
skip: inc di
dec cl
jnz back
mov max,al
hlt
code ends
end start