/* outputs an operand 'x' */ bool outop(op_t &x) { // const char *ptr; ea_t v; switch (x.type) { case o_reg: out_register(ph.regNames[x.reg]); break; case o_imm: OutValue(x, OOFS_IFSIGN | OOFW_IMM); break; case o_mem: case o_near: v=toEA(cmd.cs, x.addr); if ( !out_name_expr(x, v, x.addr) ) { OutValue(x, OOF_ADDR | OOF_NUMBER | OOFS_NOSIGN | OOFW_32); QueueMark(Q_noName, cmd.ea); break; } break; default: out_symbol('?'); break; } return 1; }
//---------------------------------------------------------------------- bool outop(op_t &op) { switch ( op.type ) { case o_void: return 0; case o_reg: out_operators_begin(op); out_reg(op); out_symbol_shift(op, false); out_operators_end(op); out_symbol_shift(op, true); break; case o_relop: out_relop(op); break; case o_shift: out_shift(op.value); break; case o_imm: if (op.tms_prefix == 0) out_symbol('#'); else out_symbol(op.tms_prefix); if (op.tms_signed) OutValue(op, OOFS_IFSIGN|OOF_SIGNED|OOFW_IMM); else OutValue(op, OOFW_IMM); out_symbol_shift(op); break; case o_near: out_address(op); break; case o_mem: case o_io: out_operators_begin(op); out_address(op); out_symbol_shift(op, false); out_operators_end(op); out_symbol_shift(op, true); break; case o_cond: out_cond(op); break; default: error("interr: out"); break; } return 1; }
//---------------------------------------------------------------------- bool outop( op_t &x ) { uval_t v, v1; // const char *ptr; switch( x.type ) { case o_imm: out_symbol( '#' ); OutValue( x, OOF_SIGNED | OOFW_IMM ); break; case o_indexed: OutValue( x, OOF_ADDR|OOF_SIGNED|(is_ext_insn() ? OOFW_32 : OOFW_16) ); //.addr v = x.value; out_symbol( '[' ); if ( v != 0 ) goto OUTPHRASE; out_symbol( ']' ); break; case o_indirect: case o_indirect_inc: out_symbol( '[' ); case o_mem: case o_near: v = x.addr; OUTPHRASE: v1 = toEA( getSR(cmd.ea, (x.type == o_near) ? rVcs : rVds), v); if( !out_name_expr( x, v1, v ) ) { OutValue( x, (x.type == o_indexed ? 0 : OOF_ADDR) | OOF_NUMBER|OOFS_NOSIGN| ((x.type == o_near) ? (is_ext_insn() ? OOFW_32 : OOFW_16) : OOFW_8) ); QueueMark( Q_noName, cmd.ea ); } if( x.type == o_indirect || x.type == o_indirect_inc || x.type == o_indexed ) { out_symbol( ']' ); if( x.type == o_indirect_inc ) out_symbol( '+' ); } break; case o_void: return 0; case o_bit: out_symbol( char('0' + x.reg) ); break; default: warning( "out: %a: bad optype %d", cmd.ea, x.type ); } return 1; }
//---------------------------------------------------------------------- // вывод одного операнда bool idaapi mn102_outop(op_t &x) { switch ( x.type ){ // ссылка на память с использованием регистра (регистров) // (disp,Ri) case o_displ: // открывающая скобка есть всегда // регистр пристуствует? out_symbol('('); OutValue(x); out_symbol(','); out_register(ph.regNames[x.reg]); out_symbol(')'); break; // регистр case o_reg: if ( x.reg&0x80)out_symbol('(' ); if ( x.reg&0x10 ){ out_register(ph.regNames[((x.reg>>5)&3)+rD0]); out_symbol(','); } out_register(ph.regNames[x.reg&0x0F]); if ( x.reg&0x80)out_symbol(')' ); break; // непосредственные данные case o_imm: #if IDP_INTERFACE_VERSION > 37 refinfo_t ri; // micro bug-fix if ( get_refinfo(cmd.ea, x.n, &ri) ){ if ( ri.flags==REF_OFF16 ) set_refinfo(cmd.ea, x.n, REF_OFF32, ri.target, ri.base, ri.tdelta); } #endif OutValue(x, /*OOFS_NOSIGN | */ OOF_SIGNED | OOFW_IMM); break; // ссылка на программу case o_near: OutVarName(x); break; // прямая ссылка на память case o_mem: out_symbol('('); OutVarName(x); out_symbol(')'); break; // пустыка не выводится case o_void: return 0; // неизвестный операнд default: warning("out: %a: bad optype %d",cmd.ea,x.type); break; }
static void out_relop(op_t &op) { out_register(ph.regNames[op.reg]); char *relop; switch(op.tms_relop) { case 0: relop = " == "; break; case 1: relop = " < "; break; case 2: relop = " >= "; break; case 3: relop = " != "; break; default: error("interr: out: o_relop"); } out_line(relop, COLOR_SYMBOL); switch(op.tms_relop_type) { case TMS_RELOP_REG: out_register(ph.regNames[int(op.value)]); break; case TMS_RELOP_IMM: out_symbol('#'); OutValue(op, OOFS_IFSIGN|OOF_SIGNED|OOF_NUMBER|OOFW_IMM); break; } }
// output an operand bool idaapi outop(op_t &op) { switch ( op.type ) { // register case o_reg: outreg(op.reg); break; // immediate case o_imm: if ( (op.specflag1 & OP_IMM_BIT) == 0 ) out_symbol('#'); OutValue(op, OOFW_IMM); break; // data / code memory address case o_near: case o_mem: outaddr(op); break; // displ case o_displ: outdispl(); break; // ignore void operands case o_void: break; default: INTERR(10024); } return 1; }
//--------------------------------------------------------------------------- uchar putVal(op_t &x, uchar mode, uchar warn) { char str[MAXSTR]; uint32 sv_bufsize = bufsize; char *sv_bufbeg = bufbeg, *sv_ptr = get_output_ptr(); init_output_buffer(str, sizeof(str)); { flags_t sv_uFlag = uFlag; uFlag = 0; OutValue(x, mode); uFlag = sv_uFlag; } out_zero(); init_output_buffer(sv_bufbeg, sv_bufsize); set_output_ptr(sv_ptr); if ( warn) out_tagon(COLOR_ERROR ); { register size_t i; if ( !warn) i = tag_strlen(str ); else i = tag_remove(str, str, 0); if ( chkOutLine(str, i)) return(0 ); } if ( warn) out_tagoff(COLOR_ERROR ); return(1); }
void SetDac(void) { if (Event == EV_FUNC_FIRST) { LcdBlank(); /* Clear screen */ LcdChr(X_POSITION*0+Y_POSITION*1+14, Text); LcdChr(X_POSITION*0+Y_POSITION*2+14, "Set Out"); EncCounter = Cur->Dac; goto redraw; } if ( (Event & EV_MASK) == EV_KEY_PRESSED ) { switch (Event & KEY_MASK) { case KEY_UP: case KEY_DOWN: Cur->Dac = EncCounter; goto redraw; case KEY_ENTER: CurrentFunc(WaitMeasure); } } return; redraw: OutValue(3, 1, Cur->Dac, 4, 0xFF); *CurDac = Cur->Dac; OutValueSmall(5,0, EncStep, 4, 0); }
void SelectDot(void) { if (Event == EV_FUNC_FIRST) { LcdBlank(); /* Clear screen */ goto redraw; } if ( (Event & EV_MASK) == EV_KEY_PRESSED ) { switch (Event & KEY_MASK) { case KEY_UP: Cur->DotPosition++; if (Cur->DotPosition>4) Cur->DotPosition = 4; goto redraw; case KEY_DOWN: Cur->DotPosition--; if (Cur->DotPosition<0) Cur->DotPosition = 0; goto redraw; case KEY_ENTER: CurrentFunc(SetDac); } } return; redraw: LcdChr(X_POSITION*0+Y_POSITION*1+14, Text); LcdChr(X_POSITION*0+Y_POSITION*2+14, "Set Dot"); OutValue(3, 1, Cur->Out, Cur->DotPosition, 0xFF); }
//---------------------------------------------------------------------- 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 putVal(const op_t &x, uchar mode, uchar warn) { char *ptr = get_output_ptr(); { flags_t sv_uFlag = uFlag; uFlag = 0; OutValue(x, mode); uFlag = sv_uFlag; } char str[MAXSTR]; char *end = set_output_ptr(ptr); size_t len = end - ptr; qstrncpy(str, ptr, qmin(len+1, sizeof(str))); if ( warn ) out_tagon(COLOR_ERROR); if ( warn ) len = tag_remove(str, str, 0); else len = tag_strlen(str); if ( chkOutLine(str, len) ) return 0; if ( warn ) out_tagoff(COLOR_ERROR); return 1; }
/* #<pydoc> def OutValue(op, outflags = 0): """ Output immediate value @param op: operand (of type op_t) @return: flags of the output value -1: value is output with COLOR_ERROR 0: value is output as a number or character or segment """ pass #</pydoc> */ flags_t py_OutValue(PyObject *x, int outflags=0) { op_t *op = op_t_get_clink(x); if ( op == NULL ) return 0; return OutValue(*op, outflags); }
void out_print_address(op_t &x, ea_t /*pc*/) { if (!out_name_expr(x, x.addr)) { OutValue(x, OOF_ADDR | OOF_NUMBER | OOFS_NOSIGN); QueueSet(Q_noName, cmd.ea); } }
//---------------------------------------------------------------------- bool idaapi outop(op_t &x) { ea_t ea; if ( x.type == o_imm ) out_symbol('#'); char buf[MAXSTR]; switch ( x.type ) { case o_void: return 0; case o_imm: OutValue(x, OOFS_IFSIGN|OOFW_IMM); break; case o_reg: outreg(x.reg); break; case o_mem: // no break; case o_near: { ea = calc_mem(x); if ( ea == cmd.ea+cmd.size ) out_ip_rel(cmd.size); else if ( !out_name_expr(x, ea, x.addr) ) out_bad_address(x.addr); } break; case o_phrase: { qsnprintf(buf, sizeof(buf), "%%%c%" FMT_EA "x", 'a' + x.reg, x.value); ea = calc_data_mem(x, as + x.reg); if ( ( ea != BADADDR ) && ( ( x.reg != SR3 ) || ( x.value < 6 ) ) ) { out_line(buf, COLOR_AUTOCMT); out_symbol(' '); out_address(ea, x); } else out_line(buf, COLOR_REG); } break; default: interr("out"); break; } return 1; }
//---------------------------------------------------------------------- // вывод одного операнда bool idaapi C39_outop(op_t &x) { switch ( x.type ){ // только регистр case o_reg: out_register(ph.regNames[x.reg]); break; // непосредственные данные (8 бит) case o_imm: out_symbol('#'); #if IDP_INTERFACE_VERSION > 37 refinfo_t ri; // micro bug-fix if(get_refinfo(cmd.ea, x.n, &ri)){ if(ri.flags==REF_OFF16) set_refinfo(cmd.ea, x.n, REF_OFF32, ri.target, ri.base, ri.tdelta); msg("Exec OFF16_Op Fix AT:%a Flags=%lx, Target=%lx, Base=%lx, Delta=%lx\n", cmd.ea, ri.flags,ri.target,ri.base,ri.tdelta); } #endif OutValue(x, /*OOFS_NOSIGN | */ OOF_SIGNED | OOFW_IMM); break; // прямая ссылка на программу (реально - относительно PC) case o_near: OutVarName(x); break; // обращение к ячейке памяти case o_mem: if(x.specflag1&URR_IND) out_symbol('('); OutValue(x, OOFS_NOSIGN | OOFW_IMM); if(x.specflag1&URR_IND) out_symbol(')'); break; // пустыка не выводится case o_void: return 0; // неизвестный операнд default: warning("out: %lx: bad optype",cmd.ea,x.type); break; } return 1; }
//---------------------------------------------------------------------- static void out_address(ea_t ea, op_t &x) { if ( !out_name_expr(x, ea,/* ea */ BADADDR) ) { out_tagon(COLOR_ERROR); OutValue(x, OOFW_IMM|OOF_ADDR|OOFW_16); out_snprintf(" (ea = %a)", ea); out_tagoff(COLOR_ERROR); QueueMark(Q_noName, cmd.ea); } }
//---------------------------------------------------------------------- void OutAddr(op_t& x, ea_t ea, ea_t off, bool isSigned = false) { // try and find the real name expression if ( !out_name_expr(x, ea, off) ) { // work out flags correctly uint32 flags = OOF_ADDR | OOFW_16; if (isSigned) flags |= OOF_SIGNED; else flags |= OOFS_NOSIGN; // if name wasn't found, just output the value & add to noname queue OutValue(x, flags); QueueMark(Q_noName, cmd.ea); } }
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); }
// output an address static void outaddr(op_t &op, const bool replace_with_label = true) { bool ind = is_addr_ind(op); // is operand indirect ? bool sp = is_addr_sp(op); // is operand special page ? int size = 16; // operand is 16 bits long if ( ind) out_symbol('(' ); if ( sp) { out_symbol('\\' ); size = 8; /* just display the first 8 bits */ } if ( !out_name_expr(op, toEA(cmd.cs, op.addr), op.addr) || !replace_with_label) { if ( replace_with_label) out_tagon(COLOR_ERROR ); OutValue(op, OOF_ADDR | OOFS_NOSIGN | (size < 16 ? OOFW_8 : OOFW_16) ); if ( replace_with_label) out_tagoff(COLOR_ERROR ); } if ( ind) out_symbol(')' ); }
//---------------------------------------------------------------------- static int outnum(ushort type, const ConstOpis *co) { char str[40]; op_t x; x.value = co->value; x.addr = co->value2; #ifdef __EA64__ x.value = make_ulonglong((uint32)x.value, (uint32)x.addr); #endif x.type = o_imm; x.dtyp = (uchar)(type - 3); x.offb = 0; init_output_buffer(str, sizeof(str)); OutValue(x, OOF_NUMBER | OOF_SIGNED | OOFW_IMM); term_output_buffer(); tag_remove(str, str, 0); qfprintf(myFile, "value = %s\n", str); return(1); }
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); } }
bool clWAVDataEncoder::ResetEncoder( int NumChannels, int NumSamplesPerSec, int BitsPerSample, float Quality ) { m_OutputData.clear(); m_OutputData.reserve( 1024*1024 ); OutString( "RIFF----WAVEfmt " ); // write WAVEfmt header OutValue( 16, 4 ); OutValue( 1, 2 ); // PCM OutValue( NumChannels, 2 ); OutValue( NumSamplesPerSec, 4 ); OutValue( NumSamplesPerSec * BitsPerSample * NumChannels / 8, 4 ); OutValue( NumChannels * sizeof( uint16_t ), 2 ); // data block size OutValue( 16, 2 ); // bits per sample m_DataChunkPos = m_OutputData.size(); OutString( "data----" ); return false; }
bool __stdcall outop( op_t &x ) { char buf[MAXSTR]; switch( x.type ) { case o_imm: { switch(cmd.insnpref) { case SWFACTION_GETURL2: { switch(x.specflag1) { case 'M': if (x.value == 2) out_keyword("method:POST"); else x.value?out_keyword("method:GET"):out_keyword("method:none"); break; case 'T': x.value?out_keyword("target:sprite"):out_keyword("target:browser"); break; case 'V': x.value?out_keyword("vars:load"):out_keyword("vars:no"); } } break; case SWFACTION_CONSTANTPOOL: OutValue( x, OOFW_IMM ); break; case SWFACTION_GOTOFRAME2: if (x.n == 0) { x.value?out_keyword("play:yes"):out_keyword("play:no"); } else { OutValue( x, OOFW_IMM ); } break; case SWFACTION_DEFINEFUNCTION2: if (x.n == 5) { //output the parameters first uint16 p = cmd.auxpref, i = 0; uint16 param_length = get_word(cmd.ea + 1) - p -2; out_char('{', COLOR_SYMBOL); while (i < param_length) { uint8 reg = get_byte(cmd.ea + 3 + p + i); char* reg_name = buf; *reg_name = 0; while ((i++ < param_length) && ((*(reg_name++) = get_byte(cmd.ea + 3 + p + i))!= 0)) {;} i++; if (reg_name > buf && *(--reg_name) == 0) { char r[6]; out_char('{', COLOR_SYMBOL); if (reg) { qsnprintf(r, 5, "r%u", reg); out_register( r ); } else { out_char('0', COLOR_NUMBER); } out_line(",\"", COLOR_SYMBOL); out_line(buf, COLOR_CHAR); out_line("\"}, ", COLOR_SYMBOL); }//if }//while out_line("}, ", COLOR_SYMBOL); } OutValue( x, OOFW_IMM ); break; default: OutValue( x, OOFW_IMM ); } } break; case o_reg: qsnprintf(buf, MAXSTR, "r%u", x.reg); out_register( buf ); break; case o_near: if( !out_name_expr(x, x.addr, x.addr) ) { // if we could not create and output a name expression from the address OutValue(x, OOF_ADDR | OOF_NUMBER | OOFW_32); // instead output a raw value QueueMark(Q_noName, cmd.ea); //and mark this as a problem } break; case o_null: out_keyword("null"); break; case o_undefined: out_keyword("undefined"); break; case o_bool: x.value?out_keyword("true"):out_keyword("false"); break; case o_const: out_keyword("constant:"); OutValue( x, OOFW_IMM ); break; case o_string: { uint16 p = 0; char c; out_char('"', COLOR_SYMBOL); while ((c = get_byte(x.addr+p)) != 0) { if (is_printable(c)) { out_char(c, COLOR_CHAR); } else { qsnprintf(buf, MAXSTR, "\\x%02X", c); out_line(buf, COLOR_STRING); } p++; } out_char('"', COLOR_SYMBOL); } break; case o_void: return 0; default: warning( "out: %lx: bad optype %d", cmd.ea, x.type ); } return 1; }
bool idaapi outop(op_t &x) { // output operands switch(x.type) { case o_reg: OutRegString(x.fl_workingReg, x.fl_regPair, x.reg); break; case o_reg_bit: OutRegString(x.fl_workingReg, x.fl_regPair, x.reg, (int)x.v_bit); break; case o_imm: out_symbol('#'); OutValue(x, OOFS_IFSIGN | OOFW_IMM); break; case o_cmem_ind: // this needs special treatment... has to have a # in front of it out_symbol('#'); OutAddr(x, x.addr, x.addr); break; case o_near: case o_cmem: OutAddr(x, x.addr, x.addr); break; case o_emem: OutAddr(x, SAM8_EDATASEG_START + x.addr, x.addr); break; case o_phrase: switch(x.phrase) { case fIndReg: out_symbol('@'); OutRegString(x.fl_workingReg, x.fl_regPair, x.v_phrase_reg); break; case fIdxReg: out_symbol('#'); OutRegString(false, false, x.v_phrase_reg); out_symbol('['); OutRegString(true, false, x.v_phrase_idxreg); out_symbol(']'); break; } break; case o_displ: switch(x.phrase) { case fIdxCAddr: out_symbol('#'); OutAddr(x, x.addr, x.addr, (x.addr > 0xffff)); out_symbol('['); OutRegString(true, true, x.v_phrase_idxreg); out_symbol(']'); break; case fIdxEAddr: out_symbol('#'); OutAddr(x, SAM8_EDATASEG_START + x.addr, x.addr, (x.addr > 0xffff)); out_symbol('['); OutRegString(true, true, x.v_phrase_idxreg); out_symbol(']'); break; } break; } // OK return 1; }
//---------------------------------------------------------------------- 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); }
//---------------------------------------------------------------------- bool idaapi outop(op_t &x) { ea_t ea; switch ( x.type ) { case o_void: return 0; case o_reg: out_register(ph.regNames[x.reg]); break; case o_near: case o_far: out_address(calc_code_mem(x.addr, x.type == o_near), x, false, false); break; case o_imm: { const char *name = NULL; if ( idpflags & TMS320C54_IO && x.IOimm ) name = find_sym(x.value); if ( !x.NoCardinal ) out_symbol('#'); if ( name != NULL ) { out_line(name, COLOR_IMPNAME); } else { if ( !x.Signed ) OutValue(x, OOFW_IMM); else OutValue(x, OOFS_IFSIGN|OOF_SIGNED|OOF_NUMBER|OOFW_IMM); } break; } case o_local: OutValue(x, OOFW_IMM|OOF_ADDR); break; case o_mmr: case o_mem: case o_farmem: if ( x.IndirectAddressingMOD == ABSOLUTE_INDIRECT_ADRESSING ) { out_symbol('*'); out_symbol('('); } ea = calc_data_mem(x.addr, x.type == o_mem); if ( ea != BADADDR ) out_address(ea, x, true, x.IndirectAddressingMOD != ABSOLUTE_INDIRECT_ADRESSING); // no '@' if absolute "indirect" adressing else OutValue(x, OOFW_IMM|OOF_ADDR); if ( x.IndirectAddressingMOD == ABSOLUTE_INDIRECT_ADRESSING ) out_symbol(')'); break; case o_displ: // Indirect addressing mode { const char *reg = ph.regNames[x.reg]; char buf[8]; switch ( x.IndirectAddressingMOD ) { case 0: qsnprintf(buf, sizeof(buf), "*%s",reg); out_register(buf); break; case 1: qsnprintf(buf, sizeof(buf), "*%s-",reg); out_register(buf); break; case 2: qsnprintf(buf, sizeof(buf), "*%s+",reg); out_register(buf); break; case 3: qsnprintf(buf, sizeof(buf), "*+%s",reg); out_register(buf); break; case 4: qsnprintf(buf, sizeof(buf), "*%s-0B",reg); out_register(buf); break; case 5: qsnprintf(buf, sizeof(buf), "*%s-0",reg); out_register(buf); break; case 6: qsnprintf(buf, sizeof(buf), "*%s+0",reg); out_register(buf); break; case 7: qsnprintf(buf, sizeof(buf), "*%s+0B",reg); out_register(buf); break; case 8: qsnprintf(buf, sizeof(buf), "*%s-%%",reg); out_register(buf); break; case 9: qsnprintf(buf, sizeof(buf), "*%s-0%%",reg); out_register(buf); break; case 0xA: qsnprintf(buf, sizeof(buf), "*%s+%%",reg); out_register(buf); break; case 0xB: qsnprintf(buf, sizeof(buf), "*%s+0%%",reg); out_register(buf); break; case 0xC: qsnprintf(buf, sizeof(buf), "*%s(",reg); out_register(buf); OutValue(x, OOF_ADDR|OOF_SIGNED|OOFW_16); out_symbol(')'); break; case 0xD: qsnprintf(buf, sizeof(buf), "*+%s(",reg); out_register(buf); OutValue(x, OOF_ADDR|OOF_SIGNED|OOFW_16); out_symbol(')'); break; case 0xE: qsnprintf(buf, sizeof(buf), "*+%s(",reg); out_register(buf); OutValue(x, OOF_ADDR|OOF_SIGNED|OOFW_16); out_symbol(')'); out_symbol('%'); break; // this special adressing mode is now defined as o_farmem ! // case ABSOLUTE_INDIRECT_ADRESSING: // out_symbol('*'); // out_symbol('('); // OutValue(x, OOF_ADDR|OOF_SIGNED|OOFW_16); // out_symbol(')'); // break; default: error("interr: out: o_displ"); } break; } case o_bit: { if ( !x.NoCardinal ) out_symbol('#'); char buf[20]; qsnprintf(buf, sizeof(buf), "%d", int(x.value)); out_line(buf,COLOR_REG); break; } case o_cond8: out_cond8((uchar)x.value); break; case o_cond2: { const char *cond = ""; switch ( x.value ) { case 0: cond = "eq"; break; case 1: cond = "lt"; break; case 2: cond = "gt"; break; case 3: cond = "neq"; break; default: warning("interr: out 2-bit condition"); } out_line(cond, COLOR_REG); break; } default: error("interr: out"); break; } return 1; }
// Output an operand as an immediate value static void out_imm(op_t &op, bool no_shift = false) { if ( !is_imm_no_shift(op) && !no_shift ) out_symbol('#'); OutValue(op, OOFW_IMM); }
// Output an operand as an address inline void out_addr(op_t &op, bool find_label = true) { if ( !find_label || !out_name_expr(op, toEA(cmd.cs, op.addr), op.addr) ) OutValue(op, OOF_ADDR | OOFS_NOSIGN); }
bool idaapi cr16c_outop(op_t& x) { switch(x.type) { case o_reg: out_register(ph.regNames[x.reg]); break; case o_displ: OutValue(x,OOF_SIGNED|OOFW_32); break; case o_phrase: out_symbol('('); switch(x.specflag1) { default: case PAR_ind_reg: out_register(ph.regNames[x.reg]); break; case PAR_ind_rp: out_register(ph.regNames[x.reg+16]); break; /* case PAR_ind_prp: out_register(ph.regNames[x.reg+16]); break;*/ case PAR_ind_rrp: out_register(ph.regNames[x.reg+32]); break; } out_symbol(')'); break; case o_mem: OutValue(x,OOF_SIGNED|OOFW_32); break; case o_imm: out_symbol('$'); OutValue(x,OOF_SIGNED|OOFW_32); break; case o_idpspec0: out_symbol('['); if(x.specval&0x4) OutChar('d'); if((x.specval&0x4)&&((x.specval&0x2)||(x.specval&0x1))) out_symbol(','); if(x.specval&0x2) OutChar('i'); if((x.specval&0x2)&&(x.specval&0x1)) out_symbol(','); if(x.specval&0x1) OutChar('u'); out_symbol(']'); break; default:; } //out_name_expr(x, x.addr, x.addr); /* if (cmd.itype == COMPARE_OP) { //For comparisons, the argument indicates the type of comparison to be //performed. Print a symbolic representation of the comparison rather //than a number. if (x.value < qnumber(compare_ops)) { OutLine(compare_ops[x.value]); } else { OutLine("BAD OPERAND"); } } else if (cmd.auxpref & HAS_JREL) { //we don't test for x.type == o_near here because we need to distinguish //between relative jumps and absolute jumps. In our case, HAS_JREL //implies o_near out_name_expr(x, x.addr, x.addr); } else { //otherwise just print the operand value OutValue(x); }*/ return true; }