+{
+ if(!pc || !of)
+ return;
+
+ switch(pc->type) {
+ case PC_COMMENT:
+ fprintf(of,";%s\n", ((pCodeComment *)pc)->comment);
+ break;
+
+ case PC_INLINE:
+ fprintf(of,"%s\n", ((pCodeComment *)pc)->comment);
+ break;
+
+ case PC_OPCODE:
+ // If the opcode has a label, print that first
+ {
+ char str[256];
+ pCodeInstruction *pci = PCI(pc);
+ pBranch *pbl = pci->label;
+ while(pbl && pbl->pc) {
+ if(pbl->pc->type == PC_LABEL)
+ pCodePrintLabel(of, pbl->pc);
+ pbl = pbl->next;
+ }
+
+ if(pci->cline)
+ genericPrint(of,PCODE(pci->cline));
+
+
+ pCode2str(str, 256, pc);
+
+ fprintf(of,"%s",str);
+
+ /* Debug */
+ if(debug_verbose) {
+ pCodeOpReg *pcor = PCOR(pci->pcop);
+ fprintf(of, "\t;id=%u,key=%03x,inCond:%x,outCond:%x",pc->id,pc->seq, pci->inCond, pci->outCond);
+ if(pci->pcflow)
+ fprintf(of,",flow seq=%03x",pci->pcflow->pc.seq);
+ if (pcor && pcor->pcop.type==PO_GPR_TEMP && !pcor->r->isFixed)
+ fprintf(of,",rIdx=r0x%X",pcor->rIdx);
+ }
+ }
+#if 0
+ {
+ pBranch *dpb = pc->to; // debug
+ while(dpb) {
+ switch ( dpb->pc->type) {
+ case PC_OPCODE:
+ fprintf(of, "\t;%s", PCI(dpb->pc)->mnemonic);
+ break;
+ case PC_LABEL:
+ fprintf(of, "\t;label %d", PCL(dpb->pc)->key);
+ break;
+ case PC_FUNCTION:
+ fprintf(of, "\t;function %s", ( (PCF(dpb->pc)->fname) ? (PCF(dpb->pc)->fname) : "[END]"));
+ break;
+ case PC_FLOW:
+ fprintf(of, "\t;flow");
+ break;
+ case PC_COMMENT:
+ case PC_WILD:
+ break;
+ }
+ dpb = dpb->next;
+ }
+ }
+#endif
+ fprintf(of,"\n");
+ break;
+
+ case PC_WILD:
+ fprintf(of,";\tWild opcode: id=%d\n",PCW(pc)->id);
+ if(PCW(pc)->pci.label)
+ pCodePrintLabel(of, PCW(pc)->pci.label->pc);
+
+ if(PCW(pc)->operand) {
+ fprintf(of,";\toperand ");
+ pCodeOpPrint(of,PCW(pc)->operand );
+ }
+ break;
+
+ case PC_FLOW:
+ if(debug_verbose) {
+ fprintf(of,";<>Start of new flow, seq=0x%x",pc->seq);
+ if(PCFL(pc)->ancestor)
+ fprintf(of," ancestor = 0x%x", PCODE(PCFL(pc)->ancestor)->seq);
+ fprintf(of,"\n");
+ fprintf(of,"; from: ");
+ {
+ pCodeFlowLink *link;
+ for (link = setFirstItem(PCFL(pc)->from); link; link = setNextItem (PCFL(pc)->from))
+ {
+ fprintf(of,"%03x ",link->pcflow->pc.seq);
+ }
+ }
+ fprintf(of,"; to: ");
+ {
+ pCodeFlowLink *link;
+ for (link = setFirstItem(PCFL(pc)->to); link; link = setNextItem (PCFL(pc)->to))
+ {
+ fprintf(of,"%03x ",link->pcflow->pc.seq);
+ }
+ }
+ fprintf(of,"\n");
+ }
+ break;
+
+ case PC_CSOURCE:
+// fprintf(of,";#CSRC\t%s %d\n; %s\n", PCCS(pc)->file_name, PCCS(pc)->line_number, PCCS(pc)->line);
+ fprintf(of,"%s\t.line\t%d; \"%s\"\t%s\n", (options.debug?"":";"), PCCS(pc)->line_number, PCCS(pc)->file_name, PCCS(pc)->line);
+ break;
+
+ case PC_ASMDIR:
+ {
+ pBranch *pbl = PCAD(pc)->pci.label;
+ while(pbl && pbl->pc) {
+ if(pbl->pc->type == PC_LABEL)
+ pCodePrintLabel(of, pbl->pc);
+ pbl = pbl->next;
+ }
+ }
+ if(PCAD(pc)->directive) {
+ fprintf(of, "\t%s%s%s\n", PCAD(pc)->directive, PCAD(pc)->arg?"\t":"", PCAD(pc)->arg?PCAD(pc)->arg:"");
+ } else
+ if(PCAD(pc)->arg) {
+ /* special case to handle inline labels without tab */
+ fprintf(of, "%s\n", PCAD(pc)->arg);
+ }
+ break;
+
+ case PC_LABEL:
+ default:
+ fprintf(of,"unknown pCode type %d\n",pc->type);
+ }
+}
+
+/*-----------------------------------------------------------------*/
+/* pCodePrintFunction - prints function begin/end */
+/*-----------------------------------------------------------------*/
+
+static void pCodePrintFunction(FILE *of, pCode *pc)