News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Array

Started by Alex81524, September 11, 2018, 06:17:58 AM

Previous topic - Next topic

Alex81524

Hello everybody.
Help display array elements:
...
.data
titl db "MessageBox",0;
buf1 dq 2 dup(0) ;
ifmt1 db "Array:", 10,"mas3[0] = %d"," mas3[8] = %d",0
mas3 dq 5,6,7,8
.code     
entry_point proc
invoke wsprintf,ADDR buf1,ADDR ifmt1,mas3[0],mas3[8];  ,mas3[16],mas3[24];
invoke MessageBox,0,addr buf1,addr titl,MB_OK;
invoke ExitProcess,0 ;
entry_point endp
   end

You can, of course, also with overwriting through registers:
...
ifmt1 db "Array:",10,"mas3[0] =  %d,",10,"mas3[8] =  %d,",10,
"mas3[16] = %d,",10,"mas3[24] = %d.",0
mas3 dq 5,6,7,8
.code     
entry_point proc
mov r10,mas3
mov r11,mas3[8]
mov r12,mas3[16]
mov r13,mas3[24]
invoke wsprintf,ADDR buf1,ADDR ifmt1,r10,r11,r12,r13;

But this is very ugly