Unexpected output with DumpMem in MASM - Assembly -


i have written simple small assembly program in masm output getting unexpected , prefixed 3. have entered 12345 on displaying shows output as

31 32 33 34 35

where if don't take input user , hard code mystring byte 1,2,3,4,6 - shows output 01 02 03 04 06

help me in understanding behavior - in advance

here program code:

include irvine32.inc  .data disp byte "enter string : ",0 mystring byte 5 dup(?)  .code  main proc mov edx,offset disp call writestring mov edx, offset mystring mov ecx, 50 call readstring mov esi, offset mystring mov ecx, lengthof mystring mov ebx, type mystring call dumpmem  exit main endp end main 

you dumping hexadecimal values of ascii codes of characters in string, since how stored in memory. 31 hex = ascii '0', 32 hex = ascii '1', etc.

note convert ascii digit such '0' corresponding byte value need subtract 0x30. conversely can convert decimal digit stored byte equivalent ascii character code adding 0x30.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -