alright, I've had trouble with this, searched a bit, and still cant find out what the heck is wrong with this...masm and it gives me "C:\test.asm(73) : error A2070: invalid instruction operands"
.while (K!=PWLen)
invoke IntMul,PWarray,K
add TBytes, eax
add K,1
.endw ;<---Line 73
.while (K!=PWLen)
invoke IntMul,PWarray,K
add TBytes, eax
add K,1
.endw ;<---Line 73
If you ask me, I think it is with ".while (K!=PWLen)" K and PWLen cannot be both variable. One has to be a register.
hah! I love you! You are a golden god :grin:
one other question and I'll be set...i'm porting this incredibly simple routine from vb right....but vb has this UBound function. I looked it up on MSDN because i figured i could find a way to make it work with masm, but since i'm not that skilled at this assembly thing yet (doh), i've been stuck on it for about 2 hours now.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/office97/html/output/F1/D6/S5B2CB.asp <--the MSDN definition of UBound
could ya lead me in the right direction?
one other question and I'll be set...i'm porting this incredibly simple routine from vb right....but vb has this UBound function. I looked it up on MSDN because i figured i could find a way to make it work with masm, but since i'm not that skilled at this assembly thing yet (doh), i've been stuck on it for about 2 hours now.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/office97/html/output/F1/D6/S5B2CB.asp <--the MSDN definition of UBound
could ya lead me in the right direction?
That's right, the way a WHILE loop is constructed the error would always occur on the ENDW line...
Translates in assembly to:
So the error is on the cmp , line
.WHILE [Var] == [Var]
mov ecx, 10
.ENDW
Translates in assembly to:
jmp W2
W1:
mov ecx,10
W2:
cmp [Var], [Var] ; <<< Error ends up here
je W1
So the error is on the cmp , line
I am not a VB coder, so the term dimension makes no sense to me. Perhaps some explanation and example of how to use it would be useful.
When working with arrays in assembly, you're basically working with one-dimensional arrays that go from index 0 to "limit of array - 1". So, if you have an array of 512 elements, it goes from 0 to 511.
Of course you can work with multidimensional arrays, but you will have to do all index calculations manually... It becomes pretty funny if you need multiple indices with different lower/upper bounds.
For one-dimensional arrays, you can do something like
to get the upper bound. For more complicated stuff, I suggest that you keep the bounds as EQUates.
Of course you can work with multidimensional arrays, but you will have to do all index calculations manually... It becomes pretty funny if you need multiple indices with different lower/upper bounds.
For one-dimensional arrays, you can do something like
.data?
myarray DWORD 512 dup (?)
.code
mov ecx, sizeof myarray / sizeof type myarray
to get the upper bound. For more complicated stuff, I suggest that you keep the bounds as EQUates.
blahblah,
I believe UBound retrieves a member (variable) of the array 'object'. Arrays are implemented as objects in VB, in C/C++ they are SafeArray's, basically exactly the same thing/compatible with VB's arrays. Check the SAFEARRAY data type on MSDN for an 'internal' look at VB array's. I've done a bit of cross VB, C/C++ (and assembler with VB) work already. PAINFUL! You CANNOT use UBound from VB on an array implemented in assembler.
Regards
I believe UBound retrieves a member (variable) of the array 'object'. Arrays are implemented as objects in VB, in C/C++ they are SafeArray's, basically exactly the same thing/compatible with VB's arrays. Check the SAFEARRAY data type on MSDN for an 'internal' look at VB array's. I've done a bit of cross VB, C/C++ (and assembler with VB) work already. PAINFUL! You CANNOT use UBound from VB on an array implemented in assembler.
Regards