"hi" 
->
104
105

maybe the result in an "array"
ar[0]  = 104
ar[1]  = 105

it does not work http://www.asmcommunity.net/board/index.php?topic=17893.0
Posted on 2006-07-27 12:50:53 by golden_jubilee
The values will be available to you as hexadecimal. Therefore if you grab "hi" it will look like 68h, 69h. Now you need to transform that to Decimal 104d, 105d and display it in Ascii.

First you have tyo get each letter separately and convert it's value (68h for "h") to it's ascii decimal counterpart ("104"). I will use the Api wsprintf for that job as it can do both at the same time.


.586
.model flat,stdcall
option casemap:none

include kernel32.inc
include user32.inc
includelib user32.lib
includelib kernel32.lib


.data
String db "hi",0
Format db "%lu,",0
.data?
szTemp db 256 dup (?)
.code
start:

push esi ; on XP always save ebx, esi edi if you use them
push edi

mov esi, offset String
mov edi, offset szTemp

@again:
movzx edx, byte ptr
or edx, edx ; test for 0
jz @out ; if 0 found jump out
invoke wsprintf, edi, offset Format, edx ; convert the hex number to decimal ascii look at api wsprintf for more info
add edi, eax ;add number of characters copied into the buffer to pointer of where to write
inc esi ; point to next letter in String
jmp @again

@out:
mov byte ptr ,0 ; delete the last comma

pop edi
pop esi

invoke MessageBox,0,offset szTemp,0,0
invoke ExitProcess,0

end start


There's no way to store the converted number into an array, everything is supposed to be in hexadecimal. If you need to display the decimal ascii value of something then convert it on the fly and display it.
Posted on 2006-07-28 08:15:57 by JimmyClif
works fine, thx
Posted on 2006-07-28 13:58:24 by golden_jubilee