michael coury

Inline Assembly Troubles (Such a Noob Problem)

Discussion created by michael coury on Aug 1, 2006
Latest reply on Aug 1, 2006 by CompilerGuru
I am having some trouble with my inline assmebly. to preface everthing, this is my routine to read memory out to the serial port

void ReadRamOut(word iMemory, int iByte) {
int i = 0;
char *memory_ptr;

memory_ptr = (char*)iMemory;

for( i=0; i
SCIStartTransmit(*(memory_ptr+i));
} // end for
} // end ReadRamOut


Here is the code to write to flash

DisableInterrupts
memory_ptr = (char*)iMemory;
for( i=0; i
ctemp = gu8SCIData[i];
asm{
LDA ctemp
STA memory_ptr
}
WriteFlash();
memory_ptr++;
} // end for loop

iMode = 0x00;
gu8SCIIndex = 0;
EnableInterrupts

I show the ReadRamOut routine because that method of pointing to a memory location has worked for me... so I assumed it would work again for the inline assembly....
Now assume iMemory = 0x1600. instead of writing ctemp to the memory location 0x1600 it writes over the 0x1600 with the contents of ctemp. I have tried a few different combinations of iMemory and memory_ptr to get this to work.. Any Ideas?

Message Edited by mjcoury on 2006-08-01 08:58 AM

Outcomes