;accept two numbers from user and perform multiplication ;accept the two numbers from user and if number is betwwen 0 to 9 then subtract 30 and if number is above 9 subtract 37 then ; 12 ; / \ ; 31 32 ; -30 -30 ; ___ ____ ; --> 01 02 ;now reverse the numbers obtained i.e 01->10 and add two numbers i.e 10+02=12(obtained again) to reverse number we; ; will use rotate command and it will execute 4 times global _start _start: section .text %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 dispmsg msg1,len1 accept num,03 call convert mov [no1],al dispmsg msg2,len2 accept num,03 call convert mov [no2],al dispmsg msg3,len3 mov bx,0000h mov [res],bx mov bx,[no1] back6: add [res] ,bx dec byte[no2] jnz back6 mov rax,[res] call display mov rax,60 mov rdi,0 syscall convert: mov rsi,num mov al,[rsi] cmp al,39h jbe label4 sub al,07h label4: sub al,30h rol al,04 mov bl,al inc rsi mov al,[rsi] cmp al,39h jbe label5 sub al,07h label5: sub al,30h add al,bl ret display: mov rsi,disparr+15 mov rcx,16 l2: mov rdx,0 mov rbx,10h div rbx cmp DL,09h jbe l1 add DL,07h l1: add DL,30h mov [rsi],DL dec rsi dec rcx jnz l2 mov rax,1 mov rdi,1 mov rsi,disparr mov rdx,16 syscall ret section .data msg1 db "Enter 1st number: ",0ah len1 equ $-msg1 msg2 db "Enter 2nd number: ",0ah len2 equ $-msg2 msg3 db "Multiplication: ",0ah len3 equ $-msg3 section .bss num resb 50 no1 resb 50 no2 resb 50 res resb 50 disparr resb 50
To embed this project on your website, copy the following code and paste it into your website's HTML: