//---------------------------------------------------------------------- bool outop(op_t &x) { ea_t ea; char buf[MAXSTR]; if ( x.type == o_imm ) out_symbol('#'); switch ( x.type ) { case o_void: return 0; case o_imm: if ( x.amode & amode_signed ) OutValue(x, OOF_SIGNED|OOFW_IMM); else OutValue(x, OOFS_IFSIGN|OOFW_IMM); break; case o_reg: outreg(x.reg); break; case o_mem: // no break; ea = calc_mem(x); if ( ea != BADADDR ) out_address(ea, x); else { out_tagon(COLOR_ERROR); OutValue(x, OOFW_IMM|OOF_ADDR|OOFW_16); out_tagoff(COLOR_ERROR); } break; case o_near: { ea_t ea = calc_mem(x); // xmem ioports if ( x.amode & (amode_x) && out_port_address(x.addr) ) { char nbuf[MAXSTR]; const char *pnam = find_port(x.addr); const char *name = get_true_name(BADADDR, ea, nbuf, sizeof(nbuf)); if ( name == NULL || strcmp(name, pnam) != 0 ) set_name(ea, pnam); break; } 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: { if ( x.phtype < 4 ) { qsnprintf(buf, sizeof(buf), formats[x.phtype], x.phrase); out_colored_register_line(buf); } if ( x.phtype == 4 ) { out_symbol('('); outreg(x.reg); out_symbol(')'); } } break; case o_local: { out_colored_register_line(formats2[x.phtype]); OutValue(x, OOF_SIGNED|OOF_ADDR); if ( x.phtype == 0 ) out_symbol(')'); break; } case o_textphrase: { char buf[MAXSTR]; switch ( x.textphtype ) { case text_swap: out_line(swap_formats[x.phrase], COLOR_REG); break; case text_banke: int comma; char r0[10], r1[10], r4[10], cfgi[10]; comma = 0; r0[0]=r1[0]=r4[0]=cfgi[0]='\0'; if ( x.phrase & 0x01 ) //cfgi { qsnprintf(cfgi, sizeof(cfgi), "cfgi"); comma = 1; } if ( x.phrase & 0x02 ) //r4 { qsnprintf(r4, sizeof(r4), "r4%s", (comma?", ":"")); comma = 1; } if ( x.phrase & 0x04 ) //r1 { qsnprintf(r1, sizeof(r1), "r1%s", (comma?", ":"")); comma = 1; } if ( x.phrase & 0x08 ) //r0 qsnprintf(r0, sizeof(r0), "r0%s", (comma?", ":"")); qsnprintf(buf, sizeof(buf), "%s%s%s%s", r0, r1, r4, cfgi ); out_line(buf, COLOR_REG); break; case text_cntx: out_symbol( (x.phrase ? 'r': 's') ); break; case text_dmod: if ( x.phrase ) qsnprintf(buf, sizeof(buf), " no modulo"); else qsnprintf(buf, sizeof(buf), " modulo"); out_line(buf, COLOR_REG); break; case text_eu: qsnprintf(buf, sizeof(buf), " eu"); out_line(buf, COLOR_REG); break; } } break; default: interr("out"); break; } return 1; }
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; }