



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
It's for programming programming problem that are very difficult to find
Typology: Cheat Sheet
1 / 7
This page cannot be seen from the preview
Don't miss anything!




ExitProcess proto WriteString proto WriteInt64 proto WriteHex64 proto ReadString proto ReadInt64 proto Crlf proto .data String1 db " Enter First Operand ", String2 db " Enter Second Operand ", String3 db " Result of addition is ", String4 db " Result of subtraction is ", String5 db " Result of multiplication is ", String6 db " Quotient of division is ", String7 db " Remainder of division is ", string_space db " ", div_string_1 db " Enter high-order 64 bits of the dividend (numerator) ", div_string_2 db " Enter low-order 64 bits of the dividend (numerator) ", div_string_3 db " Enter the divisor (denominator) ", num1 dq? num2 dq? mul_high_result dq? mul_low_result dq? div_high_dividend dq? div_low_dividend dq? div_divisor dq?
call WriteString mov rax, R8 ;move result call WriteInt call crlf ;***************To subtract two numbers************************ mov R8, num mov R9, num sub R8, R9 ;subtract ;**************Display result***************** mov rdx, offset String call WriteString mov rax, R8 ;move result call WriteInt call crlf ;********************To multiply two numbers********************* mov RAX, num1 ;first default operand mov R9, num MUL R9 ;mulitply mov mul_high_result, RDX mov mul_low_result, RAX ;**************Display result***************** mov rdx, offset String5 ;print string call WriteString mov rax, mul_high_result ;move high 64-bits call WriteInt mov rdx , offset string_space ;add space
call WriteString mov rax, mul_low_result ;move low 64-bits call WriteInt call crlf call crlf ;************************To divide two numbers*************** ;****************GET DIVIDEND*************** mov rdx, offset div_string_1 ;To print string call WriteString MOV RAX,0 ;TO CLEAR RAX call ReadInt64 ;Read high-order 64-bit dividend number mov div_high_dividend, rax ;save high-order 64-bit dividend number mov rdx, offset div_string_2 ;To print string call WriteString MOV RAX,0 ;TO CLEAR RAX call ReadInt64 ;Read high-order 64-bit dividend number mov div_low_dividend, rax ;***************GET DIVISOR************* mov rdx, offset div_string_3 ;To print string call WriteString MOV RAX,0 ;TO CLEAR RAX call ReadInt64 ;Read 64-bit divisor mov div_divisor, rax ;save 64-bit divisor ;***************To perform division************** mov rdx, div_high_dividend ;high-order 64 bits mov rax, div_low_dividend ;low-order 64 bits