; ######################################################################### .386 .model flat, stdcall option casemap :none ; case sensitive ; ######################################################################### include \masm32\include\windows.inc include \masm32\macros\macros.asm ; MASM support macros include \masm32\include\user32.inc include \masm32\include\kernel32.inc include \masm32\include\masm32.inc includelib \masm32\lib\user32.lib includelib \masm32\lib\kernel32.lib includelib \masm32\lib\masm32.lib ; ######################################################################### .data ary dd 1111,2222,3333,4444,5555 .code start: mov esi, offset ary ;Point to the beginning of the dword array. mov ecx, 5 ;There are five elements in the array. myLoop: mov edx, [esi] ;Get element to print ;======================== ;Save essential registers. ;======================== push ecx push esi print str$(edx) ;Show the result at the console. print chr$(13,10) ;Move cursor to a new line. ;======================== ;Restore essential registers. ;======================== pop esi pop ecx ;======================== ;Point to next element in the array. ;======================== add esi, 4 ; NOTE: The array was defined as double words. ; so you have to add four to get to the next array element. ;======================== ;Continue until all elements are printed. ;======================== loop myLoop ; The loop instruction subtracts one from the ; ecx register and ecx does not become zero, then ; it causes the program to jump back to the beginning of ; the loop. invoke ExitProcess,0 ;We are done. end start