Dear VU Students here you read and download CS401 Assignment No.1 Solution Fall 2018. Our Blog team Provide Just Idea Solution. File has been added below in .docx format. We recommend you to read complete post before downloading Solution File. You Also Like our Facebook Page, Join Facebook Group, follow on Google+ and Subscribe our YouTube Channel. Please Share it with your Friends. Thank you. 


Solution: 
[org 0x0100] ; offset 
jmp start ; jump to start label 
arrdw VUID ; AD VU ID 
size: dw 9 ; num of digit in id 
start: ; start here 
mov bx , 0  ; init bx 
mov cx , [size] ; init cx with id digit 
add cx , [size] ; add digit_id into cx 
mov si , 0 ; init si 
mov di , 0 ; init di 
  
go: 
cmp si , cx ; done? 
jg exit ; go to exit 
mov di , si ; put si into di 
add word di ,2 ; add 2 into di 
mov bx , si ; put si into bx 
  
sort:  
mov ax , [arr+di] ; 1st item into ax 
mov dx , [arr+bx] ; 2nd item inot bx 
cmp dx , ax ; lesser? 
jl relocate ; jump to relocate 
  
return: ; move next 
add di , 2 ; advance to next num 
cmp di , cx ; lesser? 
jl sort ; go to sorted 
jnl sorted 
relocate: ; relocation starts 
mov bx , di ; swap them 
jmp return ; go to next 
  
sorted: 
mov ax , [arr+si] ; x into ax 
mov dx , [arr+bx] ; y into dx 
mov [arr+si] , dx ; x = y 
mov [arr+bx] , ax ; y = x 
add word si ,2 ; add 2 into si 
jmp go 
exit: 
mov ax , 0x4c00 ; terminate 
  
int 0x21 

Download

Post a Comment

 
Top