0% found this document useful (0 votes)
3 views3 pages

VUID Assembly Task

The document contains an assembly language program that identifies the smallest odd digit from a predefined array of digits and adds this digit to each element in the array. It then displays the smallest odd digit and the modified result array. Additionally, there is a requirement for a screenshot of the program's output in DOSBox.

Uploaded by

azeemyasin3
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)
3 views3 pages

VUID Assembly Task

The document contains an assembly language program that identifies the smallest odd digit from a predefined array of digits and adds this digit to each element in the array. It then displays the smallest odd digit and the modified result array. Additionally, there is a requirement for a screenshot of the program's output in DOSBox.

Uploaded by

azeemyasin3
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/ 3

Assembly Language Program – VUID

Task
a) Assembly Language Program
.model small
.stack 100h
.data
vuid db 2,5,0,2,2,2,0,4,2 ; Numeric part of VUID
len db 9 ; Total 9 digits
odd_min db 99 ; Initialize with high value
result db 9 dup(?) ; Array for results
msg1 db 'Smallest odd digit: $'
msg2 db 13,10,'Result array: $'
newline db 13,10,'$'

.code
main:
mov ax, @data
mov ds, ax
mov es, ax

; Step 1: Find smallest odd digit


mov cx, 9 ; counter
lea si, vuid
mov bl, 99 ; odd_min in BL

find_odd:
mov al, [si]
test al, 1 ; check if odd
jz not_odd
cmp al, bl
jge not_odd
mov bl, al ; store as smallest odd
not_odd:
inc si
loop find_odd

mov odd_min, bl

; Step 2: Add each digit with smallest odd and store


lea si, vuid
lea di, result
mov cl, len
mov bl, odd_min
add_loop:
mov al, [si]
add al, bl
mov [di], al
inc si
inc di
dec cl
jnz add_loop

; Step 3: Show smallest odd digit


mov ah, 09h
lea dx, msg1
int 21h

mov ah, 02h


mov dl, odd_min
add dl, '0'
int 21h

; New line
mov ah, 09h
lea dx, newline
int 21h

; Step 4: Show result array


mov ah, 09h
lea dx, msg2
int 21h

lea si, result


mov cl, len
show_loop:
mov al, [si]
aam ; Convert to two digits
add ah, '0'
add al, '0'

mov dl, ah
mov ah, 02h
int 21h

mov dl, al
mov ah, 02h
int 21h

mov dl, ' '


mov ah, 02h
int 21h
inc si
dec cl
jnz show_loop

; Exit
mov ah, 4ch
int 21h
end main

b) Screenshot Showing the Results


Paste your DOSBox screenshot showing the program output here.

You might also like