assembly syntax
Posted: 09 Dec 2009 21:09
I tried migrating some microchip C30 functions that use asm
and it fails utterly. The mnenomics are not recognized.
Also, the online help on asm shows instructions like
which is syntax for regular PIC, not dsPIC!
regards peter
and it fails utterly. The mnenomics are not recognized.
Code: Select all
void T4Interrupt(void) {
/*
register vpBank *slot asm("w5");
slot = vpPtr; //this value is used in all statefunctions
(slot->statePtr)(); //call statefunction for slot
vpPtr = (vpBank *)slot->nextVP; //next vp
IFS1bits.T4IF = 0; //clear T4 interruptflag
*/
// 002C2 F80036 push.w 0x0036
asm {
mov.d w4,[w15++]; //save w4,w5
mov.w _vpPtr,w5; //slot = vpPtr; //this value is used in all statefunctions
mov.w [w5+16],w0; //(slot->statePtr)(); //call statefunction for slot
call w0;
mov.w [w5+18],w0; //vpPtr = (vpBank *)slot->nextVP; //next vp
mov.w w0,_vpPtr;
bclr.b IFS1bits,#3; //IFS1bits.T4IF = 0; //clear T4 interruptflag
mov.d [--w15],w4; //restore w4,w5
}
// 002D8 F90036 pop.w 0x0036
}
Code: Select all
unsigned myvar;
void main() {
asm {
MOVLW 10 // just a test
MOVLW _myvar
MOVLW 0 // just a test
MOVLW _myvar+1
}
}
regards peter