hi guys
i have a problem i serach a loop routine for this
.data
sptext dd number1,number2,number3,0
number1 db "t1",0
number2 db "t2",0
number3 db "t3",0
.code
lea esi, sptext
mov edi, DWORD PTR [esi]
@loop:
invoke MessageBox,hWnd,edi,0,MB_OK
add edi, 2
inc ebx
cmp ebx,3
jnz @loop
can your help me?
greets
ragdog
I am guessing at what you require but if it is to display the list one item at a time here are 2 methods of doing it.
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
include \masm32\include\masm32rt.inc
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
comment * -----------------------------------------------------
Build this template with
"CONSOLE ASSEMBLE AND LINK"
----------------------------------------------------- *
.data
sptext db "t1 t2 t3",0
number1 db "t1",0
number2 db "t2",0
number3 db "t3",0
tarr dd number1,number2,number3
.code
start:
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
main proc
LOCAL ptxt :DWORD ; address of source text
LOCAL parr :DWORD ; variable to use for array memory
LOCAL acnt :DWORD ; array element counter
LOCAL lcnt :DWORD ; loop counter
push esi
; --------
; METHOD 1
; --------
mov ptxt, OFFSET sptext ; get the address of the text array
invoke wtok,ptxt,ADDR parr ; tokenise it writing an array of pointers
mov lcnt, eax ; get the array member count
mov esi, parr ; put the array address into ESI
lbl0:
fn MessageBox,0,[esi],"Method 1",MB_OK ; call the message box
add esi, 4 ; increment ESI up to next array member address
sub lcnt, 1 ; decrement the loop counter
jnz lbl0
free parr ; release the memory from the tokeniser.
; --------
; METHOD 2
; --------
mov esi, OFFSET tarr
mov lcnt, LENGTHOF tarr
lbl1:
fn MessageBox,0,[esi],"Method 2",MB_OK
add esi, 4
sub lcnt, 1
jnz lbl1
pop esi
invoke ExitProcess,0 ; bye
main endp
; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
end start
nice its works :U
i use method 2 is good for my problem
thanks
ragdog