X-Git-Url: https://pd.if.org/git/?p=mmurtl;a=blobdiff_plain;f=msamples%2Fdasmm%2Fdasmdbg.c;fp=msamples%2Fdasmm%2Fdasmdbg.c;h=f3e5fe3de6f5a77235532c83a54af9a983beedd6;hp=0000000000000000000000000000000000000000;hb=562ad2bf1e836da09d3b2bc8ceffe3d21b7ca17e;hpb=0a0353feba474e5f4cc4228821f59accb89da529 diff --git a/msamples/dasmm/dasmdbg.c b/msamples/dasmm/dasmdbg.c new file mode 100644 index 0000000..f3e5fe3 --- /dev/null +++ b/msamples/dasmm/dasmdbg.c @@ -0,0 +1,83 @@ +/* Used only for debugging the operand evaluator + This prints the OpType, OpMtype (hex byte), and + if it is a memory operand, it also prints the Base, + Indx, Disp, and size if they exist. + THIS IS NOT INCLUDED IN DELIVERED DASM.EXE +*/ + +void print_Oper(int op) +{ +switch (rgOpType[op]) { + case r32: + fputs("r32= ", lst_fp); + put_num(rgOpReg[op], lst_fp); + break; + case r16: + fputs("r16= ", lst_fp); + put_num(rgOpReg[op], lst_fp); + break; + case r8: + fputs("r8= ", lst_fp); + put_num(rgOpReg[op], lst_fp); + break; + case rCRG: + fputs("rCRG= ", lst_fp); + put_num(rgOpReg[op], lst_fp); + break; + case rDRG: + fputs("rDRG= ", lst_fp); + put_num(rgOpReg[op], lst_fp); + break; + case rTRG: + fputs("rTRG= ", lst_fp); + put_num(rgOpReg[op], lst_fp); + break; + case rSEG: + fputs("rSEG= ", lst_fp); + put_num(rgOpReg[op], lst_fp); + break; + + case mem: /* memory operand */ + fputs("MemOp- ", lst_fp); + if (OpMType & fBase) { /* Base register */ + fputs(" Base-", lst_fp); + put_num(rgOpBase[op], lst_fp); + } + if (OpMType & fIndx) { /* Index Register */ + fputs(" Indx-", lst_fp); + put_num(rgOpIndx[op], lst_fp); + if (OpMType & fScale2) { /* scale value 2 */ + fputs(" Scale2 ", lst_fp); + } + if (OpMType & fScale4) { /* scale value 4 */ + fputs(" Scale4 ", lst_fp); + } + if (OpMType & fScale8) { /* scale value 8 */ + fputs(" Scale8 ", lst_fp); + } + } + if (OpMType & fDisp8) { /* Disp 8 value */ + fputs(" Disp8-", lst_fp); + put_hex(rgOpDisp[op], 2, lst_fp); + } + if (OpMType & fDisp32) { /* Disp 32 value */ + fputs(" Disp32-", lst_fp); + put_hex(rgOpDisp[op], 8, lst_fp); + } + break; + case val8: + fputs("Val8=", lst_fp); + put_num(rgOpDisp[op], lst_fp); + break; + case val16: + fputs("Val16=", lst_fp); + put_num(rgOpDisp[op], lst_fp); + break; + case val32: + fputs("Val32=", lst_fp); + put_num(rgOpDisp[op], lst_fp); + break; + default: + fputs(" UNK Operand ", lst_fp); +} +}