1 Replies - 1894 Views - Last Post: 02 September 2012 - 10:07 PM

#1 eXplosiv  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 02-September 12

problem with conversion of decimal to binary

Posted 02 September 2012 - 10:03 PM

.data
appname db"simple program",0
.code
start:
mov eax,23
again:
div eax,2
mov bx,dx
shr edx,1
.if eax!=0
jmp again
.else 
invoke MessageBox,addr NULL,edx,addr appname,MB_OK
invoke ExitProcess,NULL
.endif
end start

what is the problem in the code it does not return answer in message box
Is This A Good Question/Topic? 0
  • +

Replies To: problem with conversion of decimal to binary

#2 GunnerInc  Icon User is offline

  • "Hurry up and wait"
  • member icon




Reputation: 858
  • View blog
  • Posts: 2,281
  • Joined: 28-March 11

Re: problem with conversion of decimal to binary

Posted 02 September 2012 - 10:07 PM

invoke MessageBox,addr NULL,edx,addr appname,MB_OK


First parameter is a HANDLE to the MessageBox parent (or NULL for the desktop) JUST NULL not ADDR NULL. Second parameter is a pointer to a null terminated string, NOT a number, so you will have to convert the number in ebx to a string. Looks like you are using MASM, if you are there is a function called dwtoa (DWORD to ASCII) that you could use.

also div eax,2 is not a valid syntax for div
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1