I am having to do a bit of Assembly coding - - for some 64 bit math - - simple add and subtract.
as I have started coding this I checked what I was doing and getting a series of error messages.
windows 7 64 bit CW10.1 HS08JM project
this is inside of a function
union DLong Add64( union DLong A, union DLong B )
{
static union DLong a, b, C;
static byte D,E,F;
byte I;
I = 7;
a = A;
b = B;
asm
{
LDA D;
ADD E;
STA F;
LDX #7
LDA D,x;
ADD E, x;
STA F, X;
............. more to be added
}
return ( C );
}
error message occurs on the lines that I am trying to index using the X register.
i.e. LDA opcode16,X
I get the error message on the indexed opcodes of
C18123 End of Line expected
for each of the index X assembly codes
I have used inline assembly before without problems - - first time using indexed addressing
thanks Jim P
Jim, I think you need to use address operator @ here:
LDA @D,x;
ADD @E, x;
STA @F, X;
Thanks that makes sense - - - - nothing else seemed to
I figured out a work around - - - I assigned the variables to a fixed address and then hard coded that address
worked but now what I would call ideal or right.
the use of the @ seems to be the key, I did try the & and that did not work.
think that part of my problem is that the variable is on the stack - - when passed. So no fixed address.
even making the variables static did not seem to help as that should have created a fixed address for the variables
Thanks
Hello JP,
While the attached code probably does not do what you require, it does demonstrate a method of setting up a stack frame for arithmetic operations, and makes use of inline assembly code. Maybe you will be able to extract some ideas.
Regards,
Mac
Thanks - I will keep the code for reference and use if the need arrives
Jim P
Hello JP,
While it may not be the cause of your error messages, your inline code does not appear to make sense unless the variables D, E, and F are declared as arrays of at least eight elements. You cannot assume a particular order in which the static variables are linked to memory.
I think that there may also be a problem with the assignments a = A; and b = B; since these are unions, and you do not specify a particular element of the union.
Regards,
Mac
you are looking at lots of test code trying to figure out what I am getting these errors.
and a union to union assignment is just fine - - - - As A = B
note the actual code is simply a block transfer. If assigning an int or something to a union it needs to know
what it is it is being assigned to - - - -