- regs *r;
- static char b[128];
- char *s;
- int use_buffer = 1; // copy the string to the passed buffer pointer
-
- if(!buffer) {
- buffer = b;
- size = sizeof(b);
- use_buffer = 0; // Don't bother copying the string to the buffer.
- }
-
-#if 0
- fprintf(stderr, "%s:%d second operand %s is %d\tPO_DIR(%d) PO_GPR_TEMP(%d) PO_IMMEDIATE(%d) PO_INDF0(%d) PO_FSR0(%d)\n",
- __FUNCTION__, __LINE__, PCOR(PCOR2(pcop)->pcop2)->r->name, PCOR2(pcop)->pcop2->type,
- PO_DIR, PO_GPR_TEMP, PO_IMMEDIATE, PO_INDF0, PO_FSR0);
-#endif
-
- if(pcop) {
- switch(PCOR2(pcop)->pcop2->type) {
- case PO_W:
- case PO_WREG:
- case PO_PRODL:
- case PO_PRODH:
- case PO_INDF0:
- case PO_FSR0:
- if(use_buffer) {
- SAFE_snprintf(&buffer,&size,"%s",PCOR(PCOR2(pcop)->pcop2)->r->name);
- return buffer;
- }
- return PCOR(PCOR2(pcop)->pcop2)->r->name;
- break;
- case PO_GPR_TEMP:
- r = pic16_regWithIdx(PCOR(PCOR2(pcop)->pcop2)->r->rIdx);
-
- if(use_buffer) {
- SAFE_snprintf(&buffer,&size,"%s",r->name);
- return buffer;
- }
- return r->name;
-
- case PO_IMMEDIATE:
- assert( 0 );
- break;
-#if 0
- s = buffer;
-
- if(PCOI(pcop)->_const) {
- if( PCOI(pcop)->offset && PCOI(pcop)->offset<4) {
- SAFE_snprintf(&s,&size,"(((%s+%d) >> %d)&0xff)",
- pcop->name,
- PCOI(pcop)->index,
- 8 * PCOI(pcop)->offset );
- } else
- SAFE_snprintf(&s,&size,"LOW(%s+%d)",pcop->name,PCOI(pcop)->index);
- } else {
- if( PCOI(pcop)->index) {
- SAFE_snprintf(&s,&size,"(%s + %d)",
- pcop->name,
- PCOI(pcop)->index );
- } else {
- if(PCOI(pcop)->offset)
- SAFE_snprintf(&s,&size,"(%s >> %d)&0xff",pcop->name, 8*PCOI(pcop)->offset);
- else
- SAFE_snprintf(&s,&size,"%s",pcop->name);
- }
- }
- return buffer;
-#endif
- case PO_DIR:
- s = buffer;
- if( PCOR(PCOR2(pcop)->pcop2)->instance) {
- SAFE_snprintf(&s,&size,"(%s + %d)",
- PCOR(PCOR2(pcop)->pcop2)->r->name,
- PCOR(PCOR2(pcop)->pcop2)->instance );
- } else {
- SAFE_snprintf(&s,&size,"%s",PCOR(PCOR2(pcop)->pcop2)->r->name);
- }
- return buffer;