Hi,
This may be a real stupid question but I can’t figure it out. I’m using Special Edition Codewarrior Eclipse for MCUV10.3 and programming the 9S08PA4. I started a new bareboard project and want to add some inline assembly to the code. This simple code won’t compile, I get “Unknown Opcode C18701” for both MOV and DBZN. This is the only code in the main file:
#include <hidef.h> /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */
int delaycomm;
void main(void) {
EnableInterrupts;
/* include your code here */
asm
{
MOV #$FF,delaycomm;
LoopHere:
NOP;
DBNZ delaycomm,LoopHere;
}
for(;;) {
__RESET_WATCHDOG(); /* feeds the dog */
} /* loop forever */
/* please make sure that you never leave main */
}
Solved! Go to Solution.
Message is probably caused by using other than Tiny memory model, in which static storage variables are placed at address >= 0x100, and as a result MOV can't be used.
Error message is misleading. I tried to compile the same snippet in CW 6.3. It produced
Error : C18700: Unknown Opcode Operand Combination: Opc.:MOV/Dest.:Ext/Source:Imm8.
, which makes sense.
To place variables in zero page use DATA_SEG pragma like this:
#pragma DATA_SEG __SHORT_SEG MY_ZEROPAGE
int delaycomm;
#pragma DATA_SEG DEFAULT // restore memory model default placement
Message is probably caused by using other than Tiny memory model, in which static storage variables are placed at address >= 0x100, and as a result MOV can't be used.
Error message is misleading. I tried to compile the same snippet in CW 6.3. It produced
Error : C18700: Unknown Opcode Operand Combination: Opc.:MOV/Dest.:Ext/Source:Imm8.
, which makes sense.
To place variables in zero page use DATA_SEG pragma like this:
#pragma DATA_SEG __SHORT_SEG MY_ZEROPAGE
int delaycomm;
#pragma DATA_SEG DEFAULT // restore memory model default placement
Hey thanks. Adding the pragma's does the trick. Thanks so much for the insight.