Wednesday, November 24, 2021

simple program read two numbers from user and calculate multiplication

Include irvine32.inc
;AddTwo.asm-adds two 32-bit integer.
;chapter3 example
.386
.model flat,stdcall
.stack 4096
ExitProcess proto,dwExitCode:dword
.data 
msg1 byte "please enter 1st number:",0
msg2 byte "please enter 2nd number:",0
msg3 byte "multiply is:",0
var1 dword ?
var2 dword ?
multi dword ?
.code
main proc
  mov edx,offset msg1
  call WriteString
  call ReadInt
  mov var1,eax
  call crlf
  mov edx,offset msg2
   call WriteString
   call ReadInt
   mov var2,eax
   mov eax,0
   mov eax,var1
   mul var2
   mov multi,eax
    mov edx,offset msg3
   call WriteString
     call WriteInt
call dumpregs
  invoke ExitProcess,0
  main endp
  end main

No comments:

Post a Comment