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
Posted on 2004-06-22 00:47:53 by blahblah
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.
Posted on 2004-06-22 00:57:09 by roticv
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. <--the MSDN definition of UBound

could ya lead me in the right direction?
Posted on 2004-06-22 01:16:25 by blahblah
That's right, the way a WHILE loop is constructed the error would always occur on the ENDW line...

.WHILE [Var] == [Var]

mov ecx, 10

Translates in assembly to:

jmp W2

mov ecx,10
cmp [Var], [Var] ; <<< Error ends up here
je W1

So the error is on the cmp , line
Posted on 2004-06-22 01:20:19 by donkey
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.
Posted on 2004-06-22 01:34:04 by roticv
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

myarray DWORD 512 dup (?)
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.
Posted on 2004-06-22 02:55:36 by f0dder

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.

Posted on 2004-06-22 04:26:49 by SubEvil