DOSBox-X
|
00001 /* 00002 * Copyright (C) 2002-2020 The DOSBox Team 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License along 00015 * with this program; if not, write to the Free Software Foundation, Inc., 00016 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 */ 00018 00019 char * RegTable_16[8]= {"ax","cx","dx","bx","sp","bp","si","di"}; 00020 char * RegTable_8[8]= {"al","cl","dl","bl","ah","ch","dh","bh"}; 00021 char * SegTable[8]= {"es","cs","ss","ds","fs","gs","iseg","iseg"}; 00022 00023 00024 #define MAX_INFO 3 00025 00026 enum { 00027 Eb,Ev,Ew,Ep, 00028 Gb,Gv, 00029 Rb,Rw,Rv, 00030 Ob,Ov, 00031 Sw, 00032 Mp, 00033 Ib,Ibs,Iw,Iv,Ap, 00034 Jb,Jv, 00035 Bd,Bw, 00036 XBnd,Xlea, 00037 /* specials */ 00038 b2,p_es,p_ss,p_cs,p_ds,p_fs,p_gs,p_size,p_addr,p_rep, 00039 s_ax,s_cx,s_dx,s_bx,s_sp,s_bp,s_si,s_di, 00040 s_al,s_cl,s_dl,s_bl,s_ah,s_ch,s_dh,s_bh, 00041 s_1, 00042 Cj, 00043 G1,G2,G3b,G3v,G4,G5, 00044 no=0xff 00045 }; 00046 00047 enum { 00048 s_jo, s_jno, s_jc, s_jnc, s_je, s_jne, s_jbe, s_jnbe, 00049 s_js, s_jns, s_jp, s_jnp, s_jl, s_jnl, s_jle, s_jnle 00050 }; 00051 00052 00053 struct Dentry { 00054 char * start; 00055 Bit8u info[MAX_INFO]; 00056 }; 00057 00058 static char * G1_Table[8]={"add ","or ","adc ","sbb ","and ","sub ","xor ","cmp "}; 00059 static char * G2_Table[8]={"rol ","ror ","rcl ","rcr ","shl ","shr ","sal ","sar "}; 00060 00061 static Dentry G3b_Table[8]={ 00062 "test ",Eb,Ib,no, 00063 "test ",Eb,Ib,no, 00064 "not ",Eb,no,no, 00065 "neg ",Eb,no,no, 00066 "mul al,",Eb,no,no, 00067 "imul al,",Eb,no,no, 00068 "div ax,",Eb,no,no, 00069 "idiv ax,",Eb,no,no 00070 }; 00071 00072 static Dentry G3v_Table[8]={ 00073 "test ",Ev,Iv,no, 00074 "test ",Ev,Iv,no, 00075 "not ",Ev,no,no, 00076 "neg ",Ev,no,no, 00077 "mul ax,",Ev,no,no, 00078 "imul ax,",Ev,no,no, 00079 "div dx:ax,",Ev,no,no, 00080 "idiv dx:ax,",Ev,no,no 00081 }; 00082 00083 static char * G4_Table[8]={ 00084 "inc ", 00085 "dec ", 00086 "illegal", 00087 "illegal", 00088 "illegal", 00089 "illegal", 00090 "illegal", 00091 "illegal" 00092 }; 00093 00094 static Dentry G5_Table[8]={ 00095 "inc ",Ev,no,no, 00096 "dec ",Ev,no,no, 00097 "call ",Ev,no,no, 00098 "call ",Ep,no,no, 00099 "jmp ",Ev,no,no, 00100 "jmp ",Ep,no,no, 00101 "push ,",Ev,no,no, 00102 "illegal",no,no,no 00103 }; 00104 00105 00106 00107 static Dentry DTable[256]={ 00108 /* 0 */ 00109 "add ",Eb,Gb,no, "add ",Ev,Gv,no, "add ",Gb,Eb,no, "add ",Gv,Ev,no, 00110 "add ",s_al,Ib,no, "add ",s_ax,Iv,no, "push es",no,no,no, "pop es",no,no,no, 00111 "or ",Eb,Gb,no, "or ",Ev,Gv,no, "or ",Gb,Eb,no, "or ",Gv,Ev,no, 00112 "or ",s_al,Ib,no, "or ",s_ax,Iv,no, "push cs",no,no,no, "",b2,no,no, 00113 /* 1 */ 00114 "adc ",Eb,Gb,no, "adc ",Ev,Gv,no, "adc ",Gb,Eb,no, "adc ",Gv,Ev,no, 00115 "adc ",s_al,Ib,no, "adc ",s_ax,Iv,no, "push ss",no,no,no, "pop ss",no,no,no, 00116 "sbb ",Eb,Gb,no, "sbb ",Ev,Gv,no, "sbb ",Gb,Eb,no, "sbb ",Gv,Ev,no, 00117 "sbb ",s_al,Ib,no, "sbb ",s_ax,Iv,no, "push ds",no,no,no, "pop ds",no,no,no, 00118 /* 2 */ 00119 "and ",Eb,Gb,no, "and ",Ev,Gv,no, "and ",Gb,Eb,no, "and ",Gv,Ev,no, 00120 "and ",s_al,Ib,no, "and ",s_ax,Iv,no, "",p_es,no,no, "daa",no,no,no, 00121 "sub ",Eb,Gb,no, "sub ",Ev,Gv,no, "sub ",Gb,Eb,no, "sub ",Gv,Ev,no, 00122 "sub ",s_al,Ib,no, "sub ",s_ax,Iv,no, "",p_ss,no,no, "das",no,no,no, 00123 /* 3 */ 00124 "xor ",Eb,Gb,no, "xor ",Ev,Gv,no, "xor ",Gb,Eb,no, "xor ",Gv,Ev,no, 00125 "xor ",s_al,Ib,no, "xor ",s_ax,Iv,no, "",p_ss,no,no, "aaa",no,no,no, 00126 "cmp ",Eb,Gb,no, "cmp ",Ev,Gv,no, "cmp ",Gb,Eb,no, "cmp ",Gv,Ev,no, 00127 "cmp ",s_al,Ib,no, "cmp ",s_ax,Iv,no, "",p_ds,no,no, "aas",no,no,no, 00128 /* 4 */ 00129 "inc ",s_ax,no,no, "inc ",s_cx,no,no, "inc ",s_dx,no,no, "inc ",s_bx,no,no, 00130 "inc ",s_sp,no,no, "inc ",s_bp,no,no, "inc ",s_si,no,no, "inc ",s_di,no,no, 00131 "dec ",s_ax,no,no, "dec ",s_cx,no,no, "dec ",s_dx,no,no, "dec ",s_bx,no,no, 00132 "dec ",s_sp,no,no, "dec ",s_bp,no,no, "dec ",s_si,no,no, "dec ",s_di,no,no, 00133 /* 5 */ 00134 "push ",s_ax,no,no, "push ",s_cx,no,no, "push ",s_dx,no,no, "push ",s_bx,no,no, 00135 "push ",s_sp,no,no, "push ",s_bp,no,no, "push ",s_si,no,no, "push ",s_di,no,no, 00136 "pop ",s_ax,no,no, "pop ",s_cx,no,no, "pop ",s_dx,no,no, "pop ",s_bx,no,no, 00137 "pop ",s_sp,no,no, "pop ",s_bp,no,no, "pop ",s_si,no,no, "pop ",s_di,no,no, 00138 /* 6 */ 00139 "pusha",Bd,no,no, "popa",Bd,no,no, "bound",XBnd,no,no, "arpl",Ew,Rw,no, 00140 "",p_fs,no,no, "",p_gs,no,no, "",p_size,no,no, "",p_addr,no,no, 00141 "push ",Iv,no,no, "imul ",Gv,Ev,Iv, "push ",Ibs,no,no, "imul ",Gv,Ev,Ib, 00142 "insb",no,no,no, "ins",Bw,no,no, "oustb",no,no,no, "outs",Bw,no,no, 00143 /* 7 */ 00144 "jo ",Cj,s_jo,no, "jno ",Cj,s_jno,no, "jc ",Cj,s_jc,no, "jnc ",Cj,s_jnc,no, 00145 "je ",Cj,s_je,no, "jne ",Cj,s_jne,no, "jbe ",Cj,s_jbe,no, "jnbe ",Cj,s_jnbe,no, 00146 "js ",Cj,s_js,no, "jns ",Cj,s_jns,no, "jp ",Cj,s_jp,no, "jnp ",Cj,s_jnp,no, 00147 "jl ",Cj,s_jl,no, "jnl ",Cj,s_jnl,no, "jle ",Cj,s_jle,no, "jnle ",Cj,s_jnle,no, 00148 /* 8 */ 00149 "",G1,Eb,Ib, "",G1,Ev,Iv, "",G1,Eb,Ib, "",G1,Ev,Ibs, 00150 "test ",Eb,Gb,no, "test ",Ev,Gv,no, "xchg ",Eb,Gb,no, "xchg ",Ev,Gv,no, 00151 "mov ",Eb,Gb,no, "mov ",Ev,Gv,no, "mov ",Gb,Eb,no, "mov ",Gv,Ev,no, 00152 "mov ",Ew,Sw,no, "lea ",Gv,Xlea,no, "mov ",Sw,Ew,no, "pop ",Ev,no,no, 00153 /* 9 */ 00154 "nop",no,no,no, "xchg ",s_ax,s_cx,no,"xchg ",s_ax,s_dx,no,"xchg ",s_ax,s_bx,no, 00155 "xchg ",s_ax,s_sp,no,"xchg ",s_ax,s_bp,no,"xchg ",s_ax,s_si,no,"xchg ",s_ax,s_di,no, 00156 "cbw",no,no,no, "cwd",no,no,no, "call ",Ap,no,no, "fwait",no,no,no, 00157 "pushf",Bd,no,no, "popf",Bd,no,no, "sahf",no,no,no, "lahf",no,no,no, 00158 /* a */ 00159 "mov ",s_al,Ob,no, "mov ",s_ax,Ov,no, "mov ",Ob,s_al,no, "mov ",Ov,s_ax,no, 00160 "movsb",no,no,no, "movs",Bw,no,no, "cmpsb",no,no,no, "cmps",Bw,no,no, 00161 "test ",s_al,Ib,no, "test ",s_ax,Iv,no, "stosb",no,no,no, "stos",Bw,no,no, 00162 "lodsb",no,no,no, "lods",Bw,no,no, "scasb",no,no,no, "scas",Bw,no,no, 00163 /* b */ 00164 "mov ",s_al,Ib,no, "mov ",s_cl,Ib,no, "mov ",s_dl,Ib,no, "mov ",s_bl,Ib,no, 00165 "mov ",s_ah,Ib,no, "mov ",s_ch,Ib,no, "mov ",s_dh,Ib,no, "mov ",s_bh,Ib,no, 00166 "mov ",s_ax,Iv,no, "mov ",s_cx,Iv,no, "mov ",s_dx,Iv,no, "mov ",s_bx,Iv,no, 00167 "mov ",s_sp,Iv,no, "mov ",s_bp,Iv,no, "mov ",s_si,Iv,no, "mov ",s_di,Iv,no, 00168 /* c */ 00169 "",G2,Eb,Ib, "",G2,Ev,Ib, "ret ",Iw,no,no, "ret",no,no,no, 00170 "les ",Gv,Mp,no, "lds ",Gv,Mp,no, "mov ",Eb,Ib,no, "mov ",Ev,Iv,no, 00171 "enter ",Iw,Ib,no, "leave",no,no,no, "retf ",Iw,no,no, "retf",no,no,no, 00172 "int 03",no,no,no, "int ",Ib,no,no, "into",no,no,no, "iret",Bd,no,no, 00173 /* d */ 00174 "",G2,Eb,s_1, "",G2,Ev,s_1, "",G2,Eb,s_cl, "",G2,Ev,s_cl, 00175 "aam",no,no,no, "aad",no,no,no, "setalc",no,no,no, "xlat",no,no,no, 00176 "esc 0",Ib,no,no, "esc 1",Ib,no,no, "esc 2",Ib,no,no, "esc 3",Ib,no,no, 00177 "esc 4",Ib,no,no, "esc 5",Ib,no,no, "esc 6",Ib,no,no, "esc 7",Ib,no,no, 00178 /* e */ 00179 "loopne ",Jb,no,no, "loope ",Jb,no,no, "loop ",Jb,no,no, "jcxz ",Jb,no,no, 00180 "in ",s_al,Ib,no, "in ",s_ax,Ib,no, "out ",Ib,s_al,no, "out ",Ib,s_ax,no, 00181 "call ",Jv,no,no, "jmp ",Jv,no,no, "jmp",Ap,no,no, "jmp ",Jb,no,no, 00182 "in ",s_al,s_dx,no, "in ",s_ax,s_dx,no, "out ",s_dx,s_al,no,"out ",s_dx,s_ax,no, 00183 /* f */ 00184 "lock",no,no,no, "cb ",Iw,no,no, "repne ",p_rep,no,no,"repe ",p_rep,no,no, 00185 "hlt",no,no,no, "cmc",no,no,no, "",G3b,no,no, "",G3v,no,no, 00186 "clc",no,no,no, "stc",no,no,no, "cli",no,no,no, "sti",no,no,no, 00187 "cld",no,no,no, "std",no,no,no, "",G4,Eb,no, "",G5,no,no, 00188 }; 00189 00190 00191