}
/* if absolute address given then it mark it as
- volatile */
- if (IS_ABSOLUTE (sym->etype))
- SPEC_VOLATILE (sym->etype) = 1;
+ volatile -- except in the PIC port */
+
+#if !OPT_DISABLE_PIC
+ /* The PIC port uses a different peep hole optimizer based on "pCode" */
+ if (!TARGET_IS_PIC)
+#endif
+
+ if (IS_ABSOLUTE (sym->etype))
+ SPEC_VOLATILE (sym->etype) = 1;
+
/* global variables declared const put into code */
/* if no other storage class specified */
if (sym->level == 0 &&
if(reg->isFixed) {
if (validAddress(reg->address,reg->size)) {
- fprintf(stderr,"%s - %s address = 0x%03x\n",__FUNCTION__,reg->name, reg->address);
+ //fprintf(stderr,"%s - %s address = 0x%03x\n",__FUNCTION__,reg->name, reg->address);
mapRegister(reg);
return reg->address;
}
mapRegister(reg);
return reg->address;
}
- fprintf(stderr, "WARNING: Ignoring Out of Range register assignment at fixed address %d, %s\n",
- reg->address, reg->name);
+
+ //fprintf(stderr, "WARNING: Ignoring Out of Range register assignment at fixed address %d, %s\n",
+ // reg->address, reg->name);
} else {
return rs;
case AOP_STR:
- DEBUGpic14_emitcode(";","%d",__LINE__);
aop->coff = offset ;
if (strcmp(aop->aopu.aop_str[offset],"a") == 0 &&
dname)
return "acc";
+ DEBUGpic14_emitcode(";","%d - %s",__LINE__, aop->aopu.aop_str[offset]);
return aop->aopu.aop_str[offset];
emitpcode(POC_SWAPFW, popCopyReg(&pc_ssave));
emitpcode(POC_MOVWF, popCopyReg(&pc_status));
emitpcode(POC_SWAPF, popCopyReg(&pc_wsave));
- emitpcode(POC_MOVFW, popCopyReg(&pc_wsave));
+ emitpcode(POC_SWAPFW, popCopyReg(&pc_wsave));
addpCode2pBlock(pb,newpCodeLabel("END_OF_INTERRUPT",-1));
emitpcodeNULLop(POC_RETFIE);
}
- check_carry:
+ // check_carry:
if (AOP_TYPE(result) == AOP_CRY && AOP_SIZE(result)) {
DEBUGpic14_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__);
pic14_outBitC(result);
{
int size = max(AOP_SIZE(left),AOP_SIZE(right));
int offset = 0;
+ int res_offset = 0; /* the result may be a different size then left or right */
+ int res_size = AOP_SIZE(result);
resolvedIfx rIfx;
symbol *lbl;
unsigned long lit = 0L;
DEBUGpic14_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__);
- DEBUGpic14_AopType(__LINE__,left,right,NULL);
-
+ DEBUGpic14_AopType(__LINE__,left,right,result);
+ if(result)
+ DEBUGpic14_emitcode ("; ***","%s %d result is not null",__FUNCTION__,__LINE__);
resolveIfx(&rIfx,ifx);
lbl = newiTempLabel(NULL);
emitSKPNZ;
emitpcode(POC_GOTO,popGetLabel(lbl->key));
offset++;
+ if(res_offset < res_size-1)
+ res_offset++;
lit >>= 8;
}
break;
AOP_TYPE(right) == AOP_DIR ||
(AOP_TYPE(left) == AOP_DIR && AOP_TYPE(right) == AOP_LIT) ||
(IS_AOP_PREG(left) && !IS_AOP_PREG(right))) {
- switch(size) {
- case 2:
- genc16bit2lit(left, lit, 0);
- emitSKPNZ;
- emitpcode(POC_GOTO,popGetLabel(lbl->key));
- break;
- default:
- while (size--) {
- int emit_skip=1;
- if((AOP_TYPE(left) == AOP_DIR) &&
- ((AOP_TYPE(right) == AOP_REG) || (AOP_TYPE(right) == AOP_DIR))) {
+ //int lbl_key = (rIfx.condition) ? rIfx.lbl->key : lbl->key;
+ int lbl_key = lbl->key;
+
+ if(result) {
+ emitpcode(POC_CLRF,popGet(AOP(result),res_offset));
+ //emitpcode(POC_INCF,popGet(AOP(result),res_offset));
+ }else {
+ DEBUGpic14_emitcode ("; ***","%s %d -- ERROR",__FUNCTION__,__LINE__);
+ fprintf(stderr, "%s %d error - expecting result to be non_null\n",
+ __FUNCTION__,__LINE__);
+ return;
+ }
- emitpcode(POC_MOVFW,popGet(AOP(left),offset));
- emitpcode(POC_XORFW,popGet(AOP(right),offset));
+/* switch(size) { */
+/* case 2: */
+/* genc16bit2lit(left, lit, 0); */
+/* emitSKPNZ; */
+/* emitpcode(POC_GOTO,popGetLabel(lbl->key)); */
+/* break; */
+/* default: */
+ while (size--) {
+ int emit_skip=1;
+ if((AOP_TYPE(left) == AOP_DIR) &&
+ ((AOP_TYPE(right) == AOP_REG) || (AOP_TYPE(right) == AOP_DIR))) {
- } else if((AOP_TYPE(left) == AOP_DIR) && (AOP_TYPE(right) == AOP_LIT)){
+ emitpcode(POC_MOVFW,popGet(AOP(left),offset));
+ emitpcode(POC_XORFW,popGet(AOP(right),offset));
+
+ } else if((AOP_TYPE(left) == AOP_DIR) && (AOP_TYPE(right) == AOP_LIT)){
- switch (lit & 0xff) {
- case 0:
- emitpcode(POC_MOVFW,popGet(AOP(left),offset));
- break;
- case 1:
- emitpcode(POC_DECFSZ,popGet(AOP(left),offset));
- emitpcode(POC_GOTO,popGetLabel(lbl->key));
- emit_skip=0;
- break;
- case 0xff:
- emitpcode(POC_INCFSZ,popGet(AOP(left),offset));
- emitpcode(POC_GOTO,popGetLabel(lbl->key));
- emit_skip=0;
- break;
- default:
- emitpcode(POC_MOVFW,popGet(AOP(left),offset));
- emitpcode(POC_XORLW,popGetLit(lit & 0xff));
- }
- lit >>= 8;
+ switch (lit & 0xff) {
+ case 0:
+ emitpcode(POC_MOVFW,popGet(AOP(left),offset));
+ break;
+ case 1:
+ emitpcode(POC_DECFSZW,popGet(AOP(left),offset));
+ emitpcode(POC_INCF,popGet(AOP(result),res_offset));
+ //emitpcode(POC_GOTO,popGetLabel(lbl->key));
+ emit_skip=0;
+ break;
+ case 0xff:
+ emitpcode(POC_INCFSZW,popGet(AOP(left),offset));
+ //emitpcode(POC_INCF,popGet(AOP(result),res_offset));
+ //emitpcode(POC_INCFSZW,popGet(AOP(left),offset));
+ emitpcode(POC_GOTO,popGetLabel(lbl_key));
+ emit_skip=0;
+ break;
+ default:
+ emitpcode(POC_MOVFW,popGet(AOP(left),offset));
+ emitpcode(POC_XORLW,popGetLit(lit & 0xff));
+ }
+ lit >>= 8;
+ } else {
+ emitpcode(POC_MOVF,popGet(AOP(left),offset));
+ }
+ if(emit_skip) {
+ if(AOP_TYPE(result) == AOP_CRY) {
+ pic14_emitcode(";***","%s %d",__FUNCTION__,__LINE__);
+ if(rIfx.condition)
+ emitSKPNZ;
+ else
+ emitSKPZ;
+ emitpcode(POC_GOTO,popGetLabel(rIfx.lbl->key));
} else {
- emitpcode(POC_MOVF,popGet(AOP(left),offset));
- }
- if(emit_skip) {
- if(AOP_TYPE(result) == AOP_CRY) {
- pic14_emitcode(";***","%s %d",__FUNCTION__,__LINE__);
- if(rIfx.condition)
- emitSKPNZ;
- else
- emitSKPZ;
- emitpcode(POC_GOTO,popGetLabel(rIfx.lbl->key));
- } else {
- /* fix me. probably need to check result size too */
- emitpcode(POC_CLRF,popGet(AOP(result),0));
- if(rIfx.condition)
- emitSKPNZ;
- else
- emitSKPZ;
- emitpcode(POC_INCF,popGet(AOP(result),0));
- }
- if(ifx)
- ifx->generated=1;
+ /* fix me. probably need to check result size too */
+ //emitpcode(POC_CLRF,popGet(AOP(result),0));
+ if(rIfx.condition)
+ emitSKPZ;
+ else
+ emitSKPNZ;
+ emitpcode(POC_GOTO,popGetLabel(lbl_key));
+ //emitpcode(POC_INCF,popGet(AOP(result),res_offset));
}
- emit_skip++;
- offset++;
+ if(ifx)
+ ifx->generated=1;
}
- break;
+ emit_skip++;
+ offset++;
+ if(res_offset < res_size-1)
+ res_offset++;
}
+/* break; */
+/* } */
} else if(AOP_TYPE(right) == AOP_REG &&
AOP_TYPE(left) != AOP_DIR){
emitSKPZ;
emitpcode(POC_GOTO,popGetLabel(rIfx.lbl->key));
offset++;
+ if(res_offset < res_size-1)
+ res_offset++;
}
}else{
offset++;
}
}
+
+ emitpcode(POC_INCF,popGet(AOP(result),res_offset));
+ if(!rIfx.condition)
+ emitpcode(POC_GOTO,popGetLabel(rIfx.lbl->key));
+
emitpLabel(lbl->key);
+ DEBUGpic14_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__);
+
if(ifx)
ifx->generated = 1;
}
pic14_outBitC(result);
} else {
+ DEBUGpic14_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__);
gencjne(left,right,result,ifx);
/*
if(ifx)
static void genAndOp (iCode *ic)
{
operand *left,*right, *result;
- symbol *tlbl;
+/* symbol *tlbl; */
DEBUGpic14_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__);
/* note here that && operations that are in an
aopOp((right=IC_RIGHT(ic)),ic,FALSE);
aopOp((result=IC_RESULT(ic)),ic,FALSE);
+ DEBUGpic14_AopType(__LINE__,left,right,result);
+
+ emitpcode(POC_MOVFW,popGet(AOP(left),0));
+ emitpcode(POC_ANDFW,popGet(AOP(right),0));
+ emitpcode(POC_MOVWF,popGet(AOP(result),0));
+
/* if both are bit variables */
- if (AOP_TYPE(left) == AOP_CRY &&
- AOP_TYPE(right) == AOP_CRY ) {
- pic14_emitcode("mov","c,%s",AOP(left)->aopu.aop_dir);
- pic14_emitcode("anl","c,%s",AOP(right)->aopu.aop_dir);
- pic14_outBitC(result);
- } else {
- tlbl = newiTempLabel(NULL);
- pic14_toBoolean(left);
- pic14_emitcode("jz","%05d_DS_",tlbl->key+100);
- pic14_toBoolean(right);
- pic14_emitcode("","%05d_DS_:",tlbl->key+100);
- pic14_outBitAcc(result);
- }
+/* if (AOP_TYPE(left) == AOP_CRY && */
+/* AOP_TYPE(right) == AOP_CRY ) { */
+/* pic14_emitcode("mov","c,%s",AOP(left)->aopu.aop_dir); */
+/* pic14_emitcode("anl","c,%s",AOP(right)->aopu.aop_dir); */
+/* pic14_outBitC(result); */
+/* } else { */
+/* tlbl = newiTempLabel(NULL); */
+/* pic14_toBoolean(left); */
+/* pic14_emitcode("jz","%05d_DS_",tlbl->key+100); */
+/* pic14_toBoolean(right); */
+/* pic14_emitcode("","%05d_DS_:",tlbl->key+100); */
+/* pic14_outBitAcc(result); */
+/* } */
freeAsmop(left,NULL,ic,(RESULTONSTACK(ic) ? FALSE : TRUE));
freeAsmop(right,NULL,ic,(RESULTONSTACK(ic) ? FALSE : TRUE));
}
} else {
+ int clear_carry=0;
/* left is not the accumulator */
if(lit & 0xff) {
emitpcode(POC_MOVLW, popGetLit(lit & 0xff));
emitpcode(POC_ADDFW, popGet(AOP(left),0));
- } else
+ } else {
emitpcode(POC_MOVFW, popGet(AOP(left),0));
-
+ /* We don't know the state of the carry bit at this point */
+ clear_carry = 1;
+ }
//emitpcode(POC_MOVWF, popGet(AOP(result),0,FALSE,FALSE));
emitMOVWF(result,0);
- lit >>= 8;
while(--size) {
+ lit >>= 8;
if(lit & 0xff) {
- emitpcode(POC_MOVLW, popGetLit(lit & 0xff));
- //emitpcode(POC_MOVWF, popGet(AOP(result),offset,FALSE,FALSE));
- emitMOVWF(result,offset);
- emitpcode(POC_MOVFW, popGet(AOP(left),offset));
- emitSKPNC;
- emitpcode(POC_INCFSZW,popGet(AOP(left),offset));
- emitpcode(POC_ADDWF, popGet(AOP(result),offset));
+ if(clear_carry) {
+ /* The ls byte of the lit must've been zero - that
+ means we don't have to deal with carry */
+
+ emitpcode(POC_MOVLW, popGetLit(lit & 0xff));
+ emitpcode(POC_ADDFW, popGet(AOP(left),offset));
+ emitpcode(POC_MOVWF, popGet(AOP(left),offset));
+
+ clear_carry = 0;
+
+ } else {
+ emitpcode(POC_MOVLW, popGetLit(lit & 0xff));
+ //emitpcode(POC_MOVWF, popGet(AOP(result),offset,FALSE,FALSE));
+ emitMOVWF(result,offset);
+ emitpcode(POC_MOVFW, popGet(AOP(left),offset));
+ emitSKPNC;
+ emitpcode(POC_INCFSZW,popGet(AOP(left),offset));
+ emitpcode(POC_ADDWF, popGet(AOP(result),offset));
+ }
+
} else {
emitpcode(POC_CLRF, popGet(AOP(result),offset));
emitpcode(POC_RLF, popGet(AOP(result),offset));
emitpcode(POC_MOVFW, popGet(AOP(left),offset));
emitpcode(POC_ADDWF, popGet(AOP(result),offset));
}
- offset++;
+ offset++;
}
}
}
if(s)
pcl->label = Safe_strdup(s);
-
+ //fprintf(stderr,"newpCodeLabel: key=%d, name=%s\n",key, ((s)?s:""));
return ( (pCode *)pcl);
}
((pCodeOpLabel *)pcop)->key = key;
+ //fprintf(stderr,"newpCodeOpLabel: key=%d, name=%s\n",key,((s)?s:""));
return pcop;
}
if( (pct = findLabelinpBlock(pb,pcol)) != NULL)
LinkFlow_pCode(PCI(pc),PCI(pct));
else
- fprintf(stderr, "ERROR: %s, couldn't find label\n",__FUNCTION__);
+ fprintf(stderr, "ERROR: %s, couldn't find label. key=%d,lab=%s\n",
+ __FUNCTION__,pcol->key,((PCOP(pcol)->name)?PCOP(pcol)->name:"-"));
+ //fprintf(stderr,"newpCodeOpLabel: key=%d, name=%s\n",key,((s)?s:""));
continue;
}
while(isPCinFlow(pc,PCODE(pcfl))) {
-
reg = getRegFromInstruction(pc);
#if 0
if(reg) {
}
#endif
- if(reg && REG_BANK(reg)!=cur_bank) {
+ if((reg && REG_BANK(reg)!=cur_bank) ||
+ ((PCI(pc)->op == POC_CALL) && (cur_bank != 0) )) {
+
/* Examine the instruction before this one to make sure it is
* not a skip type instruction */
pcprev = findPrevpCode(pc->prev, PC_OPCODE);
+
if(!pcprev || (pcprev && !isPCI_SKIP(pcprev))) {
- int b = cur_bank ^ REG_BANK(reg);
+ int b;
+ int reg_bank;
+
+ reg_bank = (reg) ? REG_BANK(reg) : 0;
+
+ b = cur_bank ^ reg_bank;
//fprintf(stderr, "Cool! can switch banks\n");
- cur_bank = REG_BANK(reg);
+ cur_bank = reg_bank;
switch(b & 3) {
case 0:
break;
} else
insertBankSwitch(0, pc, -1, -1);
break;
- /*
- new_pc = newpCode(((cur_bank&1) ? POC_BSF : POC_BCF),
- popCopyGPR2Bit(PCOP(&pc_status),PIC_RP0_BIT));
- pCodeInsertAfter(pc->prev, new_pc);
- if(PCI(pc)->label) {
- PCI(new_pc)->label = PCI(pc)->label;
- PCI(pc)->label = NULL;
- }
- */
- /*
- new_pc = newpCode(((cur_bank&1) ? POC_BCF : POC_BSF),
- popCopyGPR2Bit(PCOP(&pc_status),PIC_RP0_BIT));
- pCodeInsertAfter(pc, new_pc);
- */
}
void exchangeLabels(pCodeLabel *pcl, pCode *pc)
{
+ char *s=NULL;
+
if(isPCI(pc) &&
(PCI(pc)->pcop) &&
(PCI(pc)->pcop->type == PO_LABEL)) {
if(pcol->pcop.name)
free(pcol->pcop.name);
- sprintf(buffer,"_%05d_DS_",pcl->key);
-
- pcol->pcop.name = Safe_strdup(buffer);
+ /* If the key is negative, then we (probably) have a label to
+ * a function and the name is already defined */
+
+ if(pcl->key>0)
+ sprintf(s=buffer,"_%05d_DS_",pcl->key);
+ else
+ s = pcl->label;
+
+ //sprintf(buffer,"_%05d_DS_",pcl->key);
+ if(!s) {
+ fprintf(stderr, "ERROR %s:%d function label is null\n",__FUNCTION__,__LINE__);
+ }
+ pcol->pcop.name = Safe_strdup(s);
pcol->key = pcl->key;
//pc->print(stderr,pc);
}
#endif
- if(reg && REG_BANK(reg)!=cur_bank) {
- //fprintf(stderr,"need to switch banks\n");
+
+ if((reg && REG_BANK(reg)!=cur_bank) ||
+ ((PCI(pc)->op == POC_CALL) && (cur_bank != 0) )) {
+
/* Examine the instruction before this one to make sure it is
* not a skip type instruction */
pcprev = findPrevpCode(pc->prev, PC_OPCODE);
+
if(!pcprev || (pcprev && !isPCI_SKIP(pcprev))) {
- int b = cur_bank ^ REG_BANK(reg);
+ int b;
+ int reg_bank;
- cur_bank = REG_BANK(reg);
+ reg_bank = (reg) ? REG_BANK(reg) : 0;
+
+ b = cur_bank ^ reg_bank;
+ cur_bank = reg_bank;
switch(b & 3) {
case 0:
break;
}
-
}else {
//fprintf(stderr, "Bummer can't switch banks\n");
;
}
+
+
+
+#if 0
+ if(reg && REG_BANK(reg)!=cur_bank) {
+ //fprintf(stderr,"need to switch banks\n");
+ /* Examine the instruction before this one to make sure it is
+ * not a skip type instruction */
+ pcprev = findPrevpCode(pc->prev, PC_OPCODE);
+ if(!pcprev || (pcprev && !isPCI_SKIP(pcprev))) {
+ int b = cur_bank ^ REG_BANK(reg);
+
+ cur_bank = REG_BANK(reg);
+
+ switch(b & 3) {
+ case 0:
+ break;
+ case 1:
+ insertBankSwitch(0, pc, cur_bank&1, PIC_RP0_BIT);
+ break;
+ case 2:
+ insertBankSwitch(0, pc, cur_bank&2, PIC_RP1_BIT);
+ insertBankSwitch(0, pc, cur_bank&2, PIC_RP1_BIT);
+ break;
+ case 3:
+ if(cur_bank & 3) {
+ insertBankSwitch(0, pc, cur_bank&1, PIC_RP0_BIT);
+ insertBankSwitch(0, pc, cur_bank&2, PIC_RP1_BIT);
+ } else
+ insertBankSwitch(0, pc, -1, -1);
+ break;
+
+ }
+#endif
+
+
+
+
void pBlockDestruct(pBlock *pb)
{
#endif
pCodeOp *popCopyGPR2Bit(pCodeOpReg *pc, int bitval);
-
+pCodeOp *popRegFromString(char *str, int size, int offset);
pCodeOp *newpCodeOpWild(int id, pCodeWildBlock *pcwb, pCodeOp *subtype);
pCode *newpCodeWild(int pCodeID, pCodeOp *optional_operand, pCodeOp *optional_label);
}
/*-----------------------------------------------------------------*/
+/* cvt_altpat_mnem2 */
+/* */
+/* pp[0] - mnem */
+/* pp[1] - var */
+/* pp[2] - comma */
+/* pp[3] - destination */
/*-----------------------------------------------------------------*/
static void * cvt_altpat_mnem2(void *pp,pCodeWildBlock *pcwb)
{
set *dynInternalRegs=NULL;
static hTab *dynDirectRegNames= NULL;
+static hTab *regHash = NULL; /* a hash table containing ALL registers */
static int dynrIdx=0x20;
static int rDirectIdx=0;
name, SPEC_ADDR ( OP_SYM_ETYPE(op)));
*/
} else {
- //fprintf(stderr,"ralloc %s \n", name);
+ //fprintf(stderr,"ralloc:%d %s \n", __LINE__,name);
reg = dirregWithName(name);
}
/* if this is at an absolute address, then get the address. */
if (SPEC_ABSA ( OP_SYM_ETYPE(op)) ) {
address = SPEC_ADDR ( OP_SYM_ETYPE(op));
+ //fprintf(stderr,"reg %s is at an absolute address: 0x%03x\n",name,address);
}
/* Register wasn't found in hash, so let's create
}
+/*-----------------------------------------------------------------*/
+/* some debug code to print the symbol S_TYPE. Note that
+ * the function checkSClass in src/SDCCsymt.c dinks with
+ * the S_TYPE in ways the PIC port doesn't fully like...*/
+/*-----------------------------------------------------------------*/
+void isData(sym_link *sl)
+{
+ FILE *of = stderr;
+
+ if(!sl)
+ return;
+
+ if(debugF)
+ of = debugF;
+
+ for ( ; sl; sl=sl->next) {
+ if(!IS_DECL(sl) ) {
+ switch (SPEC_SCLS(sl)) {
+
+ case S_DATA: fprintf (of, "data "); break;
+ case S_XDATA: fprintf (of, "xdata "); break;
+ case S_SFR: fprintf (of, "sfr "); break;
+ case S_SBIT: fprintf (of, "sbit "); break;
+ case S_CODE: fprintf (of, "code "); break;
+ case S_IDATA: fprintf (of, "idata "); break;
+ case S_PDATA: fprintf (of, "pdata "); break;
+ case S_LITERAL: fprintf (of, "literal "); break;
+ case S_STACK: fprintf (of, "stack "); break;
+ case S_XSTACK: fprintf (of, "xstack "); break;
+ case S_BIT: fprintf (of, "bit "); break;
+ case S_EEPROM: fprintf (of, "eeprom "); break;
+ default: break;
+ }
+
+ }
+
+ }
+
+}
/*-----------------------------------------------------------------*/
/* packRegisters - does some transformations to reduce register */
/* pressure */
for (ic = ebp->sch; ic; ic = ic->next) {
if(IS_SYMOP ( IC_LEFT(ic))) {
- //sym_link *etype = getSpec (operandType (IC_LEFT (ic)));
+ sym_link *etype = getSpec (operandType (IC_LEFT (ic)));
debugAopGet (" left:", IC_LEFT (ic));
if(IS_PTR_CONST(OP_SYMBOL(IC_LEFT(ic))->type))
- debugLog (" is a pointer");
+ debugLog (" is a pointer\n");
+
+ if(IS_OP_VOLATILE(IC_LEFT(ic)))
+ debugLog (" is volatile\n");
+
+ isData(etype);
printSymType(" ", OP_SYMBOL(IC_LEFT(ic))->type);
}
add3.c \
and1.c \
bool1.c \
+ bool2.c \
+ bool3.c \
call1.c \
compare.c \
compare2.c \
--- /dev/null
+#define __16F873
+#include "p16f873.h"
+//#include "p16c84.h"
+
+unsigned char success=0;
+unsigned char failures=0;
+unsigned char dummy=0;
+
+bit bit0 = 0;
+bit bit1 = 0;
+unsigned int aint0 = 0;
+unsigned int aint1 = 0;
+unsigned char achar0 = 0;
+unsigned char achar1 = 0;
+
+void done()
+{
+
+ dummy++;
+
+}
+
+
+
+void bit_invert(void)
+{
+
+ bit0 = !bit0;
+ bit1 = !bit1;
+
+ if((bit0 != bit1) || (bit0 == 0))
+ failures++;
+
+}
+
+void bit_copy(void)
+{
+
+ bit0 = !bit0;
+ bit1 = bit0;
+}
+
+void main(void)
+{
+
+ bit_invert();
+ bit_copy();
+
+ success = failures;
+ done();
+}
--- /dev/null
+#define __16F873
+#include "p16f873.h"
+
+
+/* Compound comparisons */
+
+
+unsigned char success=0;
+unsigned char failures=0;
+unsigned char dummy=0;
+
+bit bit0 = 0;
+bit bit1 = 0;
+unsigned int ui0 = 0;
+unsigned int ui1 = 0;
+unsigned char uc0 = 0;
+unsigned char uc1 = 0;
+unsigned long uL0 = 0;
+unsigned long uL1 = 0;
+
+void done()
+{
+
+ dummy++;
+
+}
+
+
+
+void compound_compare_uc(void)
+{
+
+ failures += (uc0 != uc1);
+
+}
+
+
+void compound_compare_ui(void)
+{
+
+ failures += (ui0 != ui1);
+
+}
+
+void compound_compare_ul(void)
+{
+
+ failures += (uL0 != uL1);
+
+}
+
+void compound_compare_uc_lit(void)
+{
+
+ failures += (uc0 != 0xff);
+ failures += (uc0 != 0xff);
+ failures += (uc0 == 0);
+
+}
+
+void main(void)
+{
+
+ compound_compare_uc();
+ compound_compare_ui();
+ compound_compare_ul();
+
+ uc0 = 0xff;
+ compound_compare_uc_lit();
+
+ success = failures;
+ done();
+}
void lcd1(const unsigned char *str)
{
- const char *p = "hellow world!\r\n";
+ const char *p = "hello world!\r\n";
if(!str)
failures++;