CS401 Assignment 2 Solution

No Comments




Question No. 2:

After attempting previous question, u are now able to write, assemble and debug a Subroutine program. Write an assembly language code to find the minimum number from an array of ten numbers using a subroutine. Explain each instruction of program in your own words and also attach the snapshot of your AFD (A Fullscreen Debugger) showing the executed code of final results. 
(10 marks)

(Program using subroutine: 5 marks, Explanation: 3 marks, Snapshot: 2 marks)




Q 1:
Name:  01.PNG Views: 10 Size:  86.2 KB
Name:  02.PNG Views: 9 Size:  84.4 KB
Name:  03.PNG Views: 9 Size:  48.6 KB

Q- 2 Solution
@ All-- This is just idea. es ki logic mai koi galti nai hai. 10000 percent theeek execute ho k theek result deta hai. but overall gud programing practice nai ki mai nai es mai. Coz yeh mjy just as idea share krna tha .

Name:  111.png Views: 9 Size:  50.5 KB


Solution of Q2: 

; To All, kindly make changes before submit.
; I know the logic of the program is very bad. But this is just Idea.
[ORG 0x0100]
mov ax, 0 
mov bx, 2
mov cx, 18
mov dx, [values]

CALL l1 
mov [minimum], dx 

mov ax, 0x4C00 
int 0x21
values: dw 9,72,7,11,6,8,14,5,10,2 
minimum: dw 0
l1: mov ax, [values + bx] 
cmp dx, ax 
jge l2 

add bx, 2 
sub cx, 2 
jnz l1
ret 

l2: mov dx, ax 
add bx, 2
sub cx, 2
jnz l1
ret
Next PostNewer Post Previous PostOlder Post Home

0 comments

Post a Comment