DOSBox-X
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
src/cpu/core_normal/table_ea_8086.h
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 typedef PhysPt (*EA_LookupHandler)(void);
00020 
00021 /* The MOD/RM Decoder for EA for this decoder's addressing modes */
00022 static PhysPt EA_16_00_n(void) { return BaseDS+(last_ea86_offset=((Bit16u)(reg_bx+(Bit16s)reg_si))); }
00023 static PhysPt EA_16_01_n(void) { return BaseDS+(last_ea86_offset=((Bit16u)(reg_bx+(Bit16s)reg_di))); }
00024 static PhysPt EA_16_02_n(void) { return BaseSS+(last_ea86_offset=((Bit16u)(reg_bp+(Bit16s)reg_si))); }
00025 static PhysPt EA_16_03_n(void) { return BaseSS+(last_ea86_offset=((Bit16u)(reg_bp+(Bit16s)reg_di))); }
00026 static PhysPt EA_16_04_n(void) { return BaseDS+(last_ea86_offset=((Bit16u)(reg_si))); }
00027 static PhysPt EA_16_05_n(void) { return BaseDS+(last_ea86_offset=((Bit16u)(reg_di))); }
00028 static PhysPt EA_16_06_n(void) { return BaseDS+(last_ea86_offset=((Bit16u)(Fetchw())));}
00029 static PhysPt EA_16_07_n(void) { return BaseDS+(last_ea86_offset=((Bit16u)(reg_bx))); }
00030 
00031 static PhysPt EA_16_40_n(void) { return BaseDS+(last_ea86_offset=((Bit16u)(reg_bx+(Bit16s)reg_si+Fetchbs()))); }
00032 static PhysPt EA_16_41_n(void) { return BaseDS+(last_ea86_offset=((Bit16u)(reg_bx+(Bit16s)reg_di+Fetchbs()))); }
00033 static PhysPt EA_16_42_n(void) { return BaseSS+(last_ea86_offset=((Bit16u)(reg_bp+(Bit16s)reg_si+Fetchbs()))); }
00034 static PhysPt EA_16_43_n(void) { return BaseSS+(last_ea86_offset=((Bit16u)(reg_bp+(Bit16s)reg_di+Fetchbs()))); }
00035 static PhysPt EA_16_44_n(void) { return BaseDS+(last_ea86_offset=((Bit16u)(reg_si+Fetchbs()))); }
00036 static PhysPt EA_16_45_n(void) { return BaseDS+(last_ea86_offset=((Bit16u)(reg_di+Fetchbs()))); }
00037 static PhysPt EA_16_46_n(void) { return BaseSS+(last_ea86_offset=((Bit16u)(reg_bp+Fetchbs()))); }
00038 static PhysPt EA_16_47_n(void) { return BaseDS+(last_ea86_offset=((Bit16u)(reg_bx+Fetchbs()))); }
00039 
00040 static PhysPt EA_16_80_n(void) { return BaseDS+(last_ea86_offset=((Bit16u)(reg_bx+(Bit16s)reg_si+Fetchws()))); }
00041 static PhysPt EA_16_81_n(void) { return BaseDS+(last_ea86_offset=((Bit16u)(reg_bx+(Bit16s)reg_di+Fetchws()))); }
00042 static PhysPt EA_16_82_n(void) { return BaseSS+(last_ea86_offset=((Bit16u)(reg_bp+(Bit16s)reg_si+Fetchws()))); }
00043 static PhysPt EA_16_83_n(void) { return BaseSS+(last_ea86_offset=((Bit16u)(reg_bp+(Bit16s)reg_di+Fetchws()))); }
00044 static PhysPt EA_16_84_n(void) { return BaseDS+(last_ea86_offset=((Bit16u)(reg_si+Fetchws()))); }
00045 static PhysPt EA_16_85_n(void) { return BaseDS+(last_ea86_offset=((Bit16u)(reg_di+Fetchws()))); }
00046 static PhysPt EA_16_86_n(void) { return BaseSS+(last_ea86_offset=((Bit16u)(reg_bp+Fetchws()))); }
00047 static PhysPt EA_16_87_n(void) { return BaseDS+(last_ea86_offset=((Bit16u)(reg_bx+Fetchws()))); }
00048 
00049 static GetEAHandler EATable[512]={
00050 /* 00 */
00051         EA_16_00_n,EA_16_01_n,EA_16_02_n,EA_16_03_n,EA_16_04_n,EA_16_05_n,EA_16_06_n,EA_16_07_n,
00052         EA_16_00_n,EA_16_01_n,EA_16_02_n,EA_16_03_n,EA_16_04_n,EA_16_05_n,EA_16_06_n,EA_16_07_n,
00053         EA_16_00_n,EA_16_01_n,EA_16_02_n,EA_16_03_n,EA_16_04_n,EA_16_05_n,EA_16_06_n,EA_16_07_n,
00054         EA_16_00_n,EA_16_01_n,EA_16_02_n,EA_16_03_n,EA_16_04_n,EA_16_05_n,EA_16_06_n,EA_16_07_n,
00055         EA_16_00_n,EA_16_01_n,EA_16_02_n,EA_16_03_n,EA_16_04_n,EA_16_05_n,EA_16_06_n,EA_16_07_n,
00056         EA_16_00_n,EA_16_01_n,EA_16_02_n,EA_16_03_n,EA_16_04_n,EA_16_05_n,EA_16_06_n,EA_16_07_n,
00057         EA_16_00_n,EA_16_01_n,EA_16_02_n,EA_16_03_n,EA_16_04_n,EA_16_05_n,EA_16_06_n,EA_16_07_n,
00058         EA_16_00_n,EA_16_01_n,EA_16_02_n,EA_16_03_n,EA_16_04_n,EA_16_05_n,EA_16_06_n,EA_16_07_n,
00059 /* 01 */
00060         EA_16_40_n,EA_16_41_n,EA_16_42_n,EA_16_43_n,EA_16_44_n,EA_16_45_n,EA_16_46_n,EA_16_47_n,
00061         EA_16_40_n,EA_16_41_n,EA_16_42_n,EA_16_43_n,EA_16_44_n,EA_16_45_n,EA_16_46_n,EA_16_47_n,
00062         EA_16_40_n,EA_16_41_n,EA_16_42_n,EA_16_43_n,EA_16_44_n,EA_16_45_n,EA_16_46_n,EA_16_47_n,
00063         EA_16_40_n,EA_16_41_n,EA_16_42_n,EA_16_43_n,EA_16_44_n,EA_16_45_n,EA_16_46_n,EA_16_47_n,
00064         EA_16_40_n,EA_16_41_n,EA_16_42_n,EA_16_43_n,EA_16_44_n,EA_16_45_n,EA_16_46_n,EA_16_47_n,
00065         EA_16_40_n,EA_16_41_n,EA_16_42_n,EA_16_43_n,EA_16_44_n,EA_16_45_n,EA_16_46_n,EA_16_47_n,
00066         EA_16_40_n,EA_16_41_n,EA_16_42_n,EA_16_43_n,EA_16_44_n,EA_16_45_n,EA_16_46_n,EA_16_47_n,
00067         EA_16_40_n,EA_16_41_n,EA_16_42_n,EA_16_43_n,EA_16_44_n,EA_16_45_n,EA_16_46_n,EA_16_47_n,
00068 /* 10 */
00069         EA_16_80_n,EA_16_81_n,EA_16_82_n,EA_16_83_n,EA_16_84_n,EA_16_85_n,EA_16_86_n,EA_16_87_n,
00070         EA_16_80_n,EA_16_81_n,EA_16_82_n,EA_16_83_n,EA_16_84_n,EA_16_85_n,EA_16_86_n,EA_16_87_n,
00071         EA_16_80_n,EA_16_81_n,EA_16_82_n,EA_16_83_n,EA_16_84_n,EA_16_85_n,EA_16_86_n,EA_16_87_n,
00072         EA_16_80_n,EA_16_81_n,EA_16_82_n,EA_16_83_n,EA_16_84_n,EA_16_85_n,EA_16_86_n,EA_16_87_n,
00073         EA_16_80_n,EA_16_81_n,EA_16_82_n,EA_16_83_n,EA_16_84_n,EA_16_85_n,EA_16_86_n,EA_16_87_n,
00074         EA_16_80_n,EA_16_81_n,EA_16_82_n,EA_16_83_n,EA_16_84_n,EA_16_85_n,EA_16_86_n,EA_16_87_n,
00075         EA_16_80_n,EA_16_81_n,EA_16_82_n,EA_16_83_n,EA_16_84_n,EA_16_85_n,EA_16_86_n,EA_16_87_n,
00076         EA_16_80_n,EA_16_81_n,EA_16_82_n,EA_16_83_n,EA_16_84_n,EA_16_85_n,EA_16_86_n,EA_16_87_n,
00077 /* 11 These are illegal so make em 0 */
00078         0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
00079         0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
00080         0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
00081         0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
00082 /* 00 */
00083         0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
00084         0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
00085         0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
00086         0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
00087 /* 01 */
00088         0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
00089         0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
00090         0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
00091         0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
00092 /* 10 */
00093         0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
00094         0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
00095         0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
00096         0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
00097 /* 11 These are illegal so make em 0 */
00098         0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
00099         0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
00100         0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,
00101         0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0,      0
00102 };
00103 
00104 #define GetEADirect(sz)                                                 \
00105         PhysPt eaa;                                                             \
00106         eaa=BaseDS+Fetchw();                            \
00107