I am trying to initialize this array 10 by 10, but the masm compilers trows an error. Syntax too complex!
My background is c/c++. I find very weird the limitations of MASM.
this is how i am trying to initialize the array:
pic1 byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
1, 1, 1, 1, 1, 1, 1, 1, 1, 1
You're running up against a line-length limitation. Either of these should work:
pic1 byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
pic2 byte 10*10 dup(1)
It works! Thanks a lot Mike!
Caution with the sizeof operator: pic1=10, pic2=100 bytes. This is because only the line behind the label is being considered when calculating sizeof pic1.
you can solve that by rolling your own...
pic1 byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
byte 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
SIZEOFpic1 EQU $-pic1