Monday 25 November 2019

cs 401 Assignment no.2 Solution Fall 2019



Question No 1
[org0*0100]
Mov ax, 1
Mov bx, 0
Mov cx, 0
Number: dw 0
        Jmp start
Factnol:
f-loop: mul word [number]
sub word[number], 1
cmp word[number], 2
jge f-loop
ret
start:
clc
mov cx, [ID+bx]
mov [number],  cx
add bx, 2
shr cx, 1
call factnol
Mov ax, 0*4c00
int 0*21
ID: bc 1,7,0,4,0,6,4,8,6   write your id here

Question No 2 Solution:
[org 0*0100]
Number 1:   dw 1
Number 2:   dw 2
Large:     dw 0
Mov ax, [number1]
Mov ax, [number2]
cmp ax , bx
Mov[large], bx
Jmp the end
Next:
         Mov [large], ax
The end:
Mov ax , 0*4c00
Int 0*21

No comments:

Post a Comment