10 MP
10 MP
: 10
;Rollno. : B-79
section .data
blankmsg db 10,'',10
;-------------------------------------------------------------
section .bss
numascii resb 03
multi1 resb 02
resl resb 02
multi2 resb 02
dispbuff resb 04
;------------------------------------------------------------
%macro dispmsg 2
mov rax,1
mov rdi,1
mov rsi,%1
mov rdx,%2
syscall
%endmacro
%macro accept 2
mov rax,0
mov rdi,0
mov rsi,%1
mov rdx,%2
syscall
%endmacro
;----------------------------------------------------------
section .text
global _start
_start:
dispmsg welmsg,welmsg_len
dispmsg nummsg,nummsg_len
accept numascii,3
call packnum
mov [multi1],bl
dispmsg nummsg,nummsg_len
accept numascii,3
call packnum
mov [multi2],bl
mov al,[multi1]
mov cl,0 ;shift cntr
mov edx,0 ;
addup:
mov bh,00h
add [resl],bx
mov bl,[multi2]
next1: inc cl
dec edx
jnz addup
dispmsg resmsg,resmsg_len
mov bx,[resl]
call disp16_proc
dispmsg blankmsg,blank_len
mov ebx,00
int 80h
packnum:
mov bl,0
mov ecx,02
mov esi,numascii
up1:
rol bl,04
mov al,[esi]
cmp al,39h
jbe skip1
sub al,07h
add bl,al
inc esi
loop up1
ret
disp16_proc:
mov ecx,4
mov edi,dispbuff
dup1:
rol bx,4
mov al,bl
and al,0fh
cmp al,09
jbe dskip
add al,07h
mov [edi],al
inc edi
loop dup1
dispmsg dispbuff,4
ret
----------------------------------------
output
[Admin@localhost vaishnavi]$ nasm -f elf64 MPL10A.asm
Multiplication of elements::0110
[Admin@localhost vaishnavi]$