News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

LNK2001: unresolved external symbol _mainCRTStartup

Started by totosayen_cpp, April 28, 2021, 05:46:12 PM

Previous topic - Next topic

jj2007

Ok, we are almost there:
   resultInt dd ? ; result (integer) of the 2 numbers
   resultStr db 100 dup(?) ; result (string) of the 2 numbers
(a single byte cannot hold a string)

inputValue proc text: dword, buffer: dword, bufferSize: word, pValue: dword
  invoke StdOut, text ; displays text
  invoke StdIn, buffer, bufferSize ; inputs string
  invoke atol, buffer ; converts it into a signed number (dword)
  mov edx, pValue ; you passed the address of resultInt
  add [edx], eax ; add eax to result
  ; mov eax, 0 ; no use for that...
  invoke StdOut, addr endline ; writes a new line to clean output
  ret
inputValue endp

Ravi Kiran


totosayen_cpp

Thanks a lot @jj2007  :biggrin: all works fine now thanks to you  :azn:

I've read a little tutorial which explained only a bit mov and print, so I tried to go a little further.
My favourite language is C++, and I wanted to try assembly to have an insight of how it works.

Good evening and maybe see you soon on the forum :-)

jj2007

#18
Good to see it works :thumbsup:

Re commenting your code, here is an example from As a software engineer, can you tell who developed a specific component in your team by looking at the style of coding?

QuoteNow we take the length of array and add it to our counter. This is our offset, how we use it will be a surprise for later. I was thinking about calling the variable myOffet but I didn't want to seem so possessive about it. Actually we should probably break out this block into its own function for debugging but I'm still a little tired from lunch to do that right now.

Don't exaggerate :badgrin: