We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi, I want to assign variables of a C file to specified registers for indirect addressing in assembler. Here is a example:
void Function (void) interrupt 0 using 1 { unsigned char i; // at r0 . . // doing something in c . . #pragma asm . . // doing something in assembler . mov a, @r0 . #pragma endasm . . . }
I realise this doesn't answer your question at all, but may I ask what it is you are doing in assembler and why you don't just do it in C instead? Stefan
You cannot put a variable into a register bank register, but you can place a variable into, for example, the accumulator. See: http://www.keil.com/forum/docs/thread1252.asp for an example.
I realise this doesn't answer your question at all, but may I ask what it is you are doing in assembler and why you don't just do it in C instead? I use C for acessing XDATA variables in structures and arrays only. This way is easier. All other code must be in assembler, because all two DPRT are used for speed requirements. I want to access the XDATA like this:
unsigned char i; // at r0 . . i = g_oDevice.m_aoInGroup[ucGroup].m_oChannelAddr.m_aucAddressLow[ucChannel]; //(e.g. r0 = i = 0x34) . . #pragma asm . . mov MPAGE, #0x12 movx a, @r0 // does the same like: // mov dptr, #0x1234 // movx a, @dptr // but all dptr are in use for other stuff . #pragma endasm