Author Topic: Array  (Read 90 times)

Alex81524

  • Regular Member
  • *
  • Posts: 7
Array
« on: September 11, 2018, 06:17:58 AM »
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