Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

CS401

Assignment no 2
Solution fall 2024
Student I’d: BC200417570

Assembly language:

[org 0x0100]
jmp start
MSG1 db '$'
Name db ' Tayeba noor$ '
VUID db ' BC200417570$ '
CGPA db ' 2.17$ '
Course_code db ' CS401$ '
MSG db 'Sum of VU ID is :$'
vuid_array: dw 2,0,0,4,1,7,5,7,0
Sum: dw 0
clrscr:
mov ah, 06h
mov al, 0
mov bh, 07h
mov cx, 00
mov dh, 24
mov dl, 79
int 10h
ret
Sum_vuid :
mov bx, 0
mov cx, 9
mov ax, 0
Sum_loop :
add ax, [vuid_array + bx]
add bx, 2
loop sum_loop
mov [Sum], ax
mov ax, [Sum]
mov cx, 10
mov bx, 10
mov di, -2
sub si, di
convert_digit :
xor dx, dx
div cx
add dl, '0'
dec si
mov [si], dl
test ax, ax
jnz convert_digit
mov dx, si
mov ah, 09h
int 21h
ret
Sum_str: time 2 db 0
start:
call clrscr
mov ah, 02h
mov bh, 0
mov dh, 00h
mov dl, 00h
int 10h
mov dx, Name
mov ah, 09h
int 21h
mov dl, 0Ah
mov ah, 02h
int 21h
mov dx, VUID
mov ah, 09h
int 21h
mov dl, 0Ah
mov ah, 02h
int 21h
mov dx, CGPA
mov ah, 09h
int 21h
mov dl, 0Ah
mov ah, 02h
int 21h
mov dx, course_code
mov ah, 09h
int 21h
mov dl, 0Ah
mov ah, 02h
int 21h
mov dx, MSG2
mov ah,09h
int 21h
mov ah, 09h
int 21h
mov dl, 0Ah
mov ah,02h
int 21h
mov dx, MSG2
mov ah,09h
int 21h
call sum_vuid
mov ah, 09h
int 21h
call sum_vuid
mov dl, 0Ah
mov ah,02h
int 21h
mov ax, 4C00h
int 21h

Output Screenshot:
1:

You might also like