The right way to declare two dimensional array :/

Hi!
I have searched whole internet and found 2 ways of declaring 2d arrays:
(i want to declare array of the size of default windows console)
areatodraw TIMES 25*80 db 0x00
or
areatodraw db 25 dup(80 dup(0x00))
none seems to work when i try to draw end of line character to the last char
in row
i calculate the adress like this- (row-1)*lenghtofrow+positioninrow
mov areatodraw[0x50], 0x8A

im not sure why it isint working maybe i move the value wrong way, can anyone help?

i get the "Extra characters on line" error when array element is moved to ebx

Also another question does the windows Sleep function remove its parameter from stack automatically? I noticed if i add 0x04 to esp after calling sleep after some time program crashes when it reaches bottom of the stack, when i dont do this program runs just fine

"areatodraw" is just a pointer. You can access bytes by simple addition:

Code:

movebx, areatodraw + 0x50;offset 0x50 bytes

Szustarol wrote:

Also another question does the windows Sleep function remove its parameter from stack automatically? I noticed if i add 0x04 to esp after calling sleep after some time program crashes when it reaches bottom of the stack, when i dont do this program runs just fine

All Windows API calls (except for WSPRINTF) use STDCALL convention, so you should normally have no need to manually adjust ESP after calling.

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum