📄 disio.cpp
字号:
{ dta-=2;
loc.assign(inst->addr.segm,((word *)dta)[0]);
if(inst->flags&FLAGS_8BIT)
LastPrintBuff("byte ptr ");
if(inst->flags&FLAGS_ADDRPREFIX)
LastPrintBuff("dword ptr");
else
LastPrintBuff("word ptr");
LastPrintBuff("[");
if(name.isname(loc))
name.printname(loc);
else if(import.isname(loc))
import.printname(loc);
else if(expt.isname(loc))
expt.printname(loc);
else
LastPrintBuffLongHexValue(loc.offs);
LastPrintBuff("]");
}
break;
case ARG_MEMLOC16:
if(inst->flags&FLAGS_SEGPREFIX)
outprefix(pbyte);
dta=inst->data+inst->length-2;
if(options.processor==PROC_Z80)
{ loc.assign(inst->addr.segm,((dword *)dta)[0]);
LastPrintBuff("[");
if(name.isname(loc))
name.printname(loc);
else if(import.isname(loc))
import.printname(loc);
else if(expt.isname(loc))
expt.printname(loc);
else
LastPrintBuffLongHexValue(loc.offs);
LastPrintBuff("]");
}
else
{ loc.assign(inst->addr.segm,((word *)dta)[0]);
LastPrintBuff("[");
if(name.isname(loc))
name.printname(loc);
else if(import.isname(loc))
import.printname(loc);
else if(expt.isname(loc))
expt.printname(loc);
else
LastPrintBuffLongHexValue(loc.offs);
LastPrintBuff("]");
}
break;
case ARG_SIMM8:
dta=inst->data+inst->length-1;
if(inst->override==over_char)
{ LastPrintBuff("\"");
for(i=0;i>=0;i--)
if(dta[i])
LastPrintBuff("%c",dta[i]);
LastPrintBuff("\"");
}
else if(dta[0]&0x80)
{ if(inst->override==over_decimal)
LastPrintBuff("%02lu",(word)(0x100-dta[0]));
else
{ LastPrintBuff("-");
LastPrintBuffLongHexValue((word)(0x100-dta[0]));
}
}
else
{ if(inst->override==over_decimal)
LastPrintBuff("%02lu",(word)(dta[0]));
else
LastPrintBuffLongHexValue((word)(dta[0]));
}
break;
case ARG_IMM8:
dta=inst->data+inst->length-1;
if(inst->override==over_decimal)
{ if(inst->displayflags&DISPFLAG_NEGATE)
LastPrintBuff("-%02lu",0x100-(word)(dta[0]));
else
LastPrintBuff("%02lu",(word)(dta[0]));
}
else if(inst->override==over_char)
{ LastPrintBuff("\"");
for(i=0;i>=0;i--)
if(dta[i])
LastPrintBuff("%c",dta[i]);
LastPrintBuff("\"");
}
else
{ if(inst->displayflags&DISPFLAG_NEGATE)
{ LastPrintBuff("-");
LastPrintBuffLongHexValue(0x100-(word)(dta[0]));
}
else
LastPrintBuffLongHexValue((word)(dta[0]));
}
break;
case ARG_IMM8_IND:
dta=inst->data+inst->length-1;
LastPrintBuff("(");
LastPrintBuffLongHexValue((word)(dta[0]));
LastPrintBuff(")");
break;
case ARG_IMM16:
dta=inst->data+inst->length-2;
if(inst->override==over_decimal)
{ if(inst->displayflags&DISPFLAG_NEGATE)
LastPrintBuff("-%02lu",0x10000-((word *)dta)[0]);
else
LastPrintBuff("%02lu",((word *)dta)[0]);
}
else if(inst->override==over_char)
{ LastPrintBuff("\"");
for(i=1;i>=0;i--)
if(dta[i])
LastPrintBuff("%c",dta[i]);
LastPrintBuff("\"");
}
else
{ if(inst->displayflags&DISPFLAG_NEGATE)
{ LastPrintBuff("-");
LastPrintBuffLongHexValue(0x10000-((word *)dta)[0]);
}
else
LastPrintBuffLongHexValue(((word *)dta)[0]);
}
break;
case ARG_IMM16_A:
dta=inst->data+inst->length-3;
LastPrintBuffLongHexValue(((word *)dta)[0]);
break;
case ARG_RELIMM8:
dta=inst->data+inst->length-1;
if(inst->mode32)
{ if(dta[0]&0x80)
targetd=(dword)(dta[0]+0xffffff00+inst->addr.offs+inst->length);
else
targetd=(dword)(dta[0]+inst->addr.offs+inst->length);
loc.assign(inst->addr.segm,targetd);
if(name.isname(loc))
name.printname(loc);
else if(import.isname(loc))
import.printname(loc);
else if(expt.isname(loc))
expt.printname(loc);
else
LastPrintBuffLongHexValue(loc.offs);
}
else
{ if(dta[0]&0x80)
targetw=(word)(dta[0]+0xff00+inst->addr.offs+inst->length);
else
targetw=(word)(dta[0]+inst->addr.offs+inst->length);
loc.assign(inst->addr.segm,targetw);
if(name.isname(loc))
name.printname(loc);
else if(import.isname(loc))
import.printname(loc);
else if(expt.isname(loc))
expt.printname(loc);
else
LastPrintBuffLongHexValue(loc.offs);
}
break;
case ARG_RELIMM:
dta=inst->data+inst->length;
if(inst->mode32)
{ dta-=4;
targetd=((dword *)dta)[0]+inst->addr.offs+inst->length;
loc.assign(inst->addr.segm,targetd);
if(name.isname(loc))
name.printname(loc);
else if(import.isname(loc))
import.printname(loc);
else if(expt.isname(loc))
expt.printname(loc);
else
LastPrintBuffLongHexValue(loc.offs);
}
else
{ dta-=2;
targetw=(word)(((word *)dta)[0]+inst->addr.offs+inst->length);
loc.assign(inst->addr.segm,targetw);
if(name.isname(loc))
name.printname(loc);
else if(import.isname(loc))
import.printname(loc);
else if(expt.isname(loc))
expt.printname(loc);
else
LastPrintBuffLongHexValue(loc.offs);
}
break;
case ARG_REG:
dta=inst->data+inst->modrm;
if(options.processor==PROC_Z80)
LastPrintBuff(regzascii[dta[0]&0x07]);
else if(((asminstdata *)(inst->tptr))->flags&FLAGS_8BIT)
LastPrintBuff(reg8ascii[(dta[0]>>3)&0x07]);
else if(inst->mode32)
LastPrintBuff(reg32ascii[(dta[0]>>3)&0x07]);
else
LastPrintBuff(reg16ascii[(dta[0]>>3)&0x07]);
break;
case ARG_MREG:
dta=inst->data+inst->modrm;
LastPrintBuff(regmascii[(dta[0]>>3)&0x07]);
break;
case ARG_XREG:
dta=inst->data+inst->modrm;
LastPrintBuff(regxascii[(dta[0]>>3)&0x07]);
break;
case ARG_FREG:
dta=inst->data+inst->modrm;
LastPrintBuff(regfascii[dta[0]&0x07]);
break;
case ARG_SREG:
dta=inst->data+inst->modrm;
LastPrintBuff(regsascii[(dta[0]>>3)&0x07]);
break;
case ARG_CREG:
dta=inst->data+inst->modrm;
LastPrintBuff(regcascii[(dta[0]>>3)&0x07]);
break;
case ARG_DREG:
dta=inst->data+inst->modrm;
LastPrintBuff(regdascii[(dta[0]>>3)&0x07]);
break;
case ARG_TREG:
case ARG_TREG_67:
dta=inst->data+inst->modrm;
LastPrintBuff(regtascii[(dta[0]>>3)&0x07]);
break;
case ARG_MODREG:
case ARG_MMXMODRM:
case ARG_XMMMODRM:
case ARG_MODRM8:
case ARG_MODRM16:
case ARG_MODRM_S:
case ARG_MODRMM512:
case ARG_MODRMQ:
case ARG_MODRM_SREAL:
case ARG_MODRM_PTR:
case ARG_MODRM_WORD:
case ARG_MODRM_BCD:
case ARG_MODRM_SINT:
case ARG_MODRM_EREAL:
case ARG_MODRM_DREAL:
case ARG_MODRM_WINT:
case ARG_MODRM_LINT:
case ARG_MODRM_FPTR:
case ARG_MODRM:
dta=inst->data+inst->modrm;
rm=(byte)((dta[0]&0xc0)>>6);
modrm=(byte)(dta[0]&0x07);
a1=DSMITEM_ARG1(inst);
a2=DSMITEM_ARG2(inst);
sib=dta[1];
if((a1==ARG_IMM)||(a2==ARG_IMM)||(a1==ARG_IMM8)||(a2==ARG_IMM8)||(a2==ARG_NONE)
||(a1==ARG_SIMM8)||(a2==ARG_SIMM8)||((modrm==5)&&(rm==0))||((modrm==4)&&(rm==2)&&(((sib)&0x07)==5))
||((modrm==4)&&(rm==0)&&(((sib)&0x07)==5)))
{ if(rm<3)
{ switch(a)
{ case ARG_MODRM8:
LastPrintBuff("byte ptr ");
break;
case ARG_MODRM16:
case ARG_MODRM_WORD:
LastPrintBuff("word ptr ");
break;
case ARG_MMXMODRM:
case ARG_XMMMODRM:
LastPrintBuff("dword ptr ");
break;
case ARG_MODRMQ:
LastPrintBuff("qword ptr ");
break;
case ARG_MODRM_S:
// 6 bytes=fword
LastPrintBuff("fword ptr ");
break;
case ARG_MODRM_SREAL:
// single real=4 bytes=dword
LastPrintBuff("dword ptr ");
break;
case ARG_MODRM_BCD:
// packed bcd=10 bytes=tbyte
LastPrintBuff("tbyte ptr ");
break;
case ARG_MODRM_SINT:
// short int=4 bytes
LastPrintBuff("dword ptr ");
break;
case ARG_MODRM_WINT:
// word int =2 bytes
LastPrintBuff("word ptr ");
break;
case ARG_MODRM_LINT:
// long int = 8 bytes
LastPrintBuff("qword ptr ");
break;
case ARG_MODRMM512:
// points to 512 bits=64 bytes of memory......
LastPrintBuff("byte ptr ");
break;
case ARG_MODRM_EREAL:
// extended real=10 bytes
LastPrintBuff("tbyte ptr ");
break;
case ARG_MODRM_DREAL:
// double real=8 bytes
LastPrintBuff("qword ptr ");
break;
case ARG_MODRM:
if(inst->flags&FLAGS_8BIT)
LastPrintBuff("byte ptr ");
else if(inst->mode32)
LastPrintBuff("dword ptr ");
else
LastPrintBuff("word ptr ");
break;
default:
break;
}
}
}
else if ((a1==ARG_REG)||(a2==ARG_REG))
{ if(rm<3)
{ switch(a) // re movzx, movsx type instructions
{ case ARG_MODRM8:
LastPrintBuff("byte ptr ");
break;
case ARG_MODRM16:
LastPrintBuff("word ptr ");
break;
default:
break;
}
}
}
switch(rm)
{ case 0:
if(inst->flags&FLAGS_SEGPREFIX)
outprefix(pbyte);
if(options.mode32)
{ if(modrm==5)
{ loc.assign(inst->addr.segm,((dword *)(&dta[1]))[0]);
LastPrintBuff("[");
if(name.isname(loc))
name.printname(loc);
else if(import.isname(loc))
import.printname(loc);
else if(expt.isname(loc))
expt.printname(loc);
else
LastPrintBuffLongHexValue(loc.offs);
LastPrintBuff("]");
}
else if(modrm==4) // case 4=sib
{ sib=dta[1];
if((sib&0x07)==5) // disp32
{ loc.assign(inst->addr.segm,((dword *)(&dta[2]))[0]);
LastPrintBuff("[");
if(name.isname(loc))
{ name.printname(loc);
}
else if(import.isname(loc))
{ import.printname(loc);
}
else if(expt.isname(loc))
{ expt.printname(loc);
}
else
{ LastPrintBuffLongHexValue(loc.offs);
}
LastPrintBuff("]");
}
else
{ LastPrintBuff("[%s]",reg32ascii[sib&0x07]);
}
if(((sib>>3)&0x07)==4) // no scaled index reg
{
}
else
{ LastPrintBuff("[%s",reg32ascii[(sib>>3)&0x07]);
switch(sib>>6)
{ case 0:
LastPrintBuff("]");
break;
case 1:
LastPrintBuff("*2]");
break;
case 2:
LastPrintBuff("*4]");
break;
case 3:
LastPrintBuff("*8]");
break;
}
}
}
else
LastPrintBuff("[%s]",reg32ascii[dta[0]&0x07]);
}
else
{ if(modrm==6)
{ loc.assign(inst->addr.segm,((word *)(&dta[1]))[0]);
LastPrintBuff("[");
if(name.isname(loc))
name.printname(loc);
else if(import.isname(loc))
import.printname(loc);
else if(expt.isname(loc))
expt.printname(loc);
else
LastPrintBuffLongHexValue(loc.offs);
LastPrintBuff("]");
}
else
LastPrintBuff("[%s]",regind16ascii[dta[0]&0x07]);
}
break;
case 1:
if(inst->flags&FLAGS_SEGPREFIX)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -