//---------------------------------------------------------------------- static void outmem(op_t &x, ea_t ea) { char buf[MAXSTR]; if ( get_name_expr(cmd.ea+x.offb, x.n, ea, BADADDR, buf, sizeof(buf)) <= 0 ) { const ioport_t *p = find_sym(x.addr); if ( p == NULL ) { out_tagon(COLOR_ERROR); OutLong(x.addr, 16); out_tagoff(COLOR_ERROR); QueueMark(Q_noName,cmd.ea); } else { out_line(p->name, COLOR_IMPNAME); } } else { bool complex = strchr(buf, '+') || strchr(buf, '-'); if ( complex ) out_symbol(ash.lbrace); OutLine(buf); if ( complex ) out_symbol(ash.rbrace); } }
//---------------------------------------------------------------------- static void out_address(ea_t ea, op_t &x, bool mapping, bool at) { regnum_t reg = get_mapped_register(ea); if ( mapping && reg != rnone) out_register(ph.regNames[reg] ); else { #ifndef TMS320C54_NO_NAME_NO_REF char buf[MAXSTR]; // since tms320c54 uses memory mapping, we turn off verification // of name expression values (3d arg of get_name_expr is BADADDR) if ( get_name_expr(cmd.ea+x.offb, x.n, ea, BADADDR, buf, sizeof(buf)) > 0 ) { if ( at) out_symbol('@' ); OutLine(buf); } else #endif { out_tagon(COLOR_ERROR); OutValue(x, OOFW_IMM|OOF_ADDR); out_tagoff(COLOR_ERROR); QueueMark(Q_noName, cmd.ea); } } }
//---------------------------------------------------------------------- uchar chkOutLine(const char *str, size_t len) { if ( !checkLine(len)) return(1 ); outcnt += len; OutLine(str); return(0); }
//---------------------------------------------------------------------- bool chkOutLine(const char *str, size_t len) { if ( !checkLine(len) ) return true; outcnt += len; OutLine(str); return false; }
static void OutVarNameVal(op_t &x) { ushort addr = x.value; ulong toea = toEA(codeSeg(addr,x.n), addr); #if IDP_INTERFACE_VERSION > 37 if(out_name_expr(x,toea,addr))return; #else const char *ptr; if((ptr=get_name_expr(cmd.ea+x.offb, toea, addr)) != NULL){ //вывод имен переменных и меток перехода OutLine(ptr); } #endif else OutValue(x, OOFW_16); }
void CBfDrawButton::DrawButton(Color OutR, Color UpBegin, Color UpEnd, Color DownBegin, Color DownEnd, Color BRColor, Color SRColor, COLORREF PtColor) { CRect WndRect = m_WndRect; // 填充背景色 SolidBrush FillBrush(Color(255, 255, 255)); m_pDoGrap->FillRectangle(&FillBrush, WndRect.left, WndRect.top, WndRect.Width(), WndRect.Height()); // 按钮外圈 Pen OutLine(OutR); CRect OutRect(WndRect); OutRect.right--; OutRect.bottom--; RectF GRt = CUiMethod::CRect2RectF(OutRect); m_pDoGrap->DrawRectangle(&OutLine, GRt); // 上半部分高光 CRect UpHRect(WndRect); UpHRect.left += 2; UpHRect.top += 2; UpHRect.right -= 2; UpHRect.bottom = (WndRect.Height() / 2) + WndRect.top; Point Pt1 = Point(UpHRect.left, UpHRect.top - 1), Pt2 = Point(UpHRect.left, UpHRect.bottom); LinearGradientBrush lgBrush1(Pt1, Pt2, UpBegin, UpEnd); m_pDoGrap->FillRectangle(&lgBrush1, UpHRect.left, UpHRect.top, UpHRect.Width(), UpHRect.Height()); // 下半部分高光 CRect DownHRect(WndRect); DownHRect.top = UpHRect.bottom; DownHRect.left += 2; DownHRect.right -= 2; DownHRect.bottom -= 2; Pt1 = Point(DownHRect.left, DownHRect.top - 1); Pt2 = Point(DownHRect.left, DownHRect.bottom); LinearGradientBrush lgBrush2(Pt1, Pt2, DownBegin, DownEnd); m_pDoGrap->FillRectangle(&lgBrush2, DownHRect.left, DownHRect.top, DownHRect.Width(), DownHRect.Height()); // 四角高光 Draw4Corner(BRColor, SRColor, PtColor); // 画焦点 DrawFocus(); // 文字 DrawBtnText(); }
static void OutVarName(op_t &x) { ea_t addr = x.addr; ea_t toea = toEA(codeSeg(addr,x.n), addr); #if IDP_INTERFACE_VERSION > 37 // msg("AT:%a target=%lx, segm=%lx, Result=%lx\n", // cmd.ea,addr, codeSeg(addr,x.n),toea); if ( out_name_expr(x,toea,addr) )return; #else const char *ptr; if ( (ptr=get_name_expr(cmd.ea+x.offb, toea, addr)) != NULL ){ //вывод имен переменных и меток перехода OutLine(ptr); } #endif else{ OutValue(x, OOF_ADDR | OOF_NUMBER | OOFS_NOSIGN | OOFW_32); // пометим проблему - нет имени QueueMark(Q_noName,cmd.ea); } }
//---------------------------------------------------------------------- void out(void) { char buf[MAXSTR]; static const char *const postfix[] = { "", "b"}; init_output_buffer(buf, sizeof(buf)); OutMnem(8, postfix[cmd.bytecmd]); if(cmd.itype == pdp_compcc) { uint i = 0, code, first = 0; static uint tabcc[8] = {pdp_clc, pdp_clv, pdp_clz, pdp_cln, pdp_sec, pdp_sev, pdp_sez, pdp_sen}; code = cmd.Op1.phrase; out_symbol('<'); if(code >= 020) { if((code ^= 020) == 0) OutLine(COLSTR("nop!^O20", SCOLOR_INSN)); i = 4; } for( ; code; i++, code >>= 1) if(code & 1) { if(first++) out_symbol('!'); out_line(ph.instruc[tabcc[i]].name, COLOR_INSN); } out_symbol('>'); }
//---------------------------------------------------------------------- bool outop(op_t &x) { switch(x.type) { case o_void: return 0; case o_reg: if(x.prepost) out_symbol('['); //Вывод регистра по номеру в регистре OutReg(x.reg); if(x.xmode) { out_symbol('+'); OutValue(x, OOF_ADDR | OOF_NUMBER | OOFW_8); } if(x.prepost) out_symbol(']'); break; case o_phrase: OutLine(ph.regNames[x.reg]); break; case o_bit: { switch(x.reg) { case rPSW: { OutLine("PSW."); switch(x.value) { case 0: OutLine("CY");break; case 4: OutLine("AC");break; case 6: OutLine("Z");break; case 7: OutLine("IE");break; default:OutValue(x, OOFW_IMM); } break; } case rA: { OutLine( "A." ); OutChar(char('0'+x.value)); } break; default: { if(!OutVarName(x, 1, 0) ) OutValue(x, OOF_ADDR | OOFW_16); out_symbol('.'); //Ичем название бита по указанному адрессу if(!nec_find_ioport_bit((int)x.addr, (int)x.value)) { //Вывод данных(тип o_imm) OutChar(char('0'+x.value)); } }// switch(x.regmode) } // end switch(x.reg) } break; case o_imm: { if(!x.regmode) { out_symbol('#'); //Вывод данных(тип o_imm) OutValue(x, OOFW_IMM ); } else { out_symbol('1'); } } break; case o_mem: { if(x.addr16) out_symbol('!'); //выводит имя переменной из памяти(например byte_98) //Вывод имени переменной if(!OutVarName(x, 1, 0) ) //Вывод данных OutValue(x, OOF_ADDR | OOFW_16); } break; case o_near: { if(x.addr16) out_symbol('!'); if(x.form) out_symbol('['); //Получить линейный адресс ea_t v = toEA(cmd.cs,x.addr); if(!out_name_expr(x, v, x.addr)) { //Вывести значение OutValue(x, OOF_ADDR | OOF_NUMBER | OOFW_16); QueueMark(Q_noName, cmd.ea); } if(x.form) out_symbol(']'); } break; default: warning("out: %a: bad optype %d", cmd.ip, x.type); break; } return(1); }
//---------------------------------------------------------------------- // вывод одного операнда bool N78K_outop(op_t &x) { #if IDP_INTERFACE_VERSION <= 37 uFlag = getFlags(cmd.ea); #endif switch(x.type){ case o_void: return 0; case o_reg: if(x.FormOut & FORM_OUT_SKOBA) out_symbol('['); OutReg(x.reg); if(x.FormOut & FORM_OUT_PLUS) out_symbol('+'); if(x.FormOut & FORM_OUT_DISP){ if(isOff(uFlag, x.n)){ OutVarNameVal(x); } else OutValue(x, OOFW_IMM ); } if(x.FormOut & FORM_OUT_REG){ out_keyword( ph.regNames[x.SecondReg] ); } if(x.FormOut & FORM_OUT_SKOBA) out_symbol(']'); break; case o_bit: switch(x.FormOut){ case FORM_OUT_S_ADDR: case FORM_OUT_SFR: OutVarName(x); out_symbol('.'); #if IDP_INTERFACE_VERSION > 37 if( !nec_find_ioport_bit(x.addr, x.value) ) #endif { OutValue(x, OOFW_IMM); } break; case FORM_OUT_A: OutLine("A."); OutValue(x, OOFW_IMM); break; case FORM_OUT_PSW: OutLine("PSW."); switch(x.value){ case 0: OutLine("CY");break; case 1: OutLine("ISP");break; case 3: OutLine("RBS0");break; case 4: OutLine("AC");break; case 5: OutLine("RBS1");break; case 6: OutLine("Z");break; case 7: OutLine("IE");break; default:OutValue(x, OOFW_IMM); } break; case FORM_OUT_HL: out_symbol('['); OutReg(rHL); out_symbol(']'); out_symbol('.'); if(isOff(uFlag, x.n)){ OutVarNameVal(x); } else OutValue(x, OOFW_IMM ); break; } break; case o_imm: out_symbol('#'); if(isOff(uFlag, x.n)){ OutVarNameVal(x); } else OutValue(x, OOFW_IMM ); break; case o_mem: //выводит имя переменной из памяти(например byte_98) if(x.FormOut & FORM_OUT_VSK) out_symbol('!'); if(x.FormOut & FORM_OUT_SKOBA) out_symbol('['); //Вывод имени переменной OutVarName(x); if(x.FormOut & FORM_OUT_SKOBA) out_symbol(']'); break; case o_near: if(x.FormOut & FORM_OUT_VSK) out_symbol('!'); if(x.FormOut & FORM_OUT_SKOBA) out_symbol('['); { ulong adr; adr = toEA(codeSeg(x.addr,x.n),x.addr); #if IDP_INTERFACE_VERSION > 37 if( !out_name_expr(x, adr, x.addr)){ OutValue(x, OOF_ADDR | OOF_NUMBER | OOFW_16); QueueMark(Q_noName, cmd.ea); } #else {const char *ptr; ptr=get_name_expr(cmd.ea+x.offb, adr, x.addr); if( ptr == NULL ){ OutValue(x, OOF_ADDR | OOF_NUMBER | OOFW_16); QueueMark(Q_noName, cmd.ea); } else OutLine(ptr); } #endif } if(x.FormOut & FORM_OUT_SKOBA) out_symbol(']'); break; // неизвестный операнд default: warning("out: %lx: bad optype",cmd.ea,x.type); break; } return(1); }
static inline void outLine(const char *str, unsigned len) { outcnt += len; OutLine(str); }
bool outop(op_t &x) { uval_t v; int dir, bit; char buf[MAXSTR]; switch ( x.type ) { case o_reg: OutReg(x.reg); break; case o_phrase: if ( x.phrase == fRi ) { out_symbol('@'); OutReg(x.indreg); break; } out_colored_register_line(phrases[x.phrase]); break; case o_displ: out_symbol('@'); OutReg(x.reg); out_symbol('+'); OutValue(x, OOF_ADDR | OOFS_IFSIGN | OOFW_16); break; case o_imm: out_symbol('#'); if ( cmd.auxpref & aux_0ext ) out_symbol('0'); if ( cmd.auxpref & aux_1ext ) out_symbol('1'); OutValue(x, OOFS_IFSIGN | OOFW_IMM); break; case o_mem: case o_near: v = map_addr(x.addr, x.n, x.type==o_mem); if ( get_name_expr(cmd.ea+x.offb, x.n, v, x.addr, buf, sizeof(buf)) <= 0 ) { /* int nbit; if ( cmd.itype == I51_ecall || cmd.itype == I51_ejmp ) nbit = OOFW_32; else nbit = OOFW_16;*/ OutValue(x, OOF_ADDR | OOF_NUMBER | OOFS_NOSIGN | OOFW_32); QueueMark(Q_noName, cmd.ea); break; } // we want to output SFR register names always in COLOR_REG, // so remove the color tags and output it manually: if ( x.type == o_mem && x.addr >= 0x80 ) { tag_remove(buf, buf, sizeof(buf)); out_register(buf); break; } OutLine(buf); break; case o_void: return false; case o_bit251: if ( x.b251_bitneg ) out_symbol('/'); dir = x.addr; bit = x.b251_bit; goto OUTBIT; case o_bitnot: out_symbol('/'); case o_bit: dir = (x.reg & 0xF8); bit = x.reg & 7; if ( (dir & 0x80) == 0 ) dir = dir/8 + 0x20; OUTBIT: if(ash.uflag & UAS_PBIT) { const ioport_bit_t *predef = find_bit( dir, bit); if ( predef != NULL ) { out_line(predef->name, COLOR_REG); break; } } { v = map_addr(dir, x.n, true); ssize_t len = get_name_expr(cmd.ea+x.offb, x.n, v, dir, buf, sizeof(buf)); if ( len > 0 && strchr(buf, '+') == NULL ) { // we want to output the bit names always in COLOR_REG, // so remove the color tags and output it manually: if ( dir < 0x80 ) { OutLine(buf); } else { tag_remove(buf, buf, sizeof(buf)); out_register(buf); } } else { out_long(dir, 16); } out_symbol(ash.uflag & UAS_NOBIT ? '_' : '.'); out_symbol('0'+bit); } break; default: warning("out: %a: bad optype",cmd.ea,x.type); break; } return true; }