cpu_mvi.h

Go to the documentation of this file.
00001 /* ES40 emulator.
00002  * Copyright (C) 2007-2008 by the ES40 Emulator Project
00003  *
00004  * Website: http://sourceforge.net/projects/es40
00005  * E-mail : camiel@camicom.com
00006  * 
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  * 
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00020  * 
00021  * Although this is not required, the author would appreciate being notified of, 
00022  * and receiving any modifications you may make to the source code that might serve
00023  * the general public.
00024  */
00025 
00048 #define DO_MINUB8 temp_64 = 0;                                                  \
00049   temp_64_1 = state.r[REG_1];                                                   \
00050   temp_64_2 = V_2;                                                              \
00051   for(i = 0; i < 64; i += 8)                                                    \
00052   {                                                                             \
00053     if((u8) ((temp_64_1 >> i) & X64_BYTE) > (u8) ((temp_64_2 >> i) & X64_BYTE)) \
00054       temp_64 |= (((temp_64_2 >> i) & X64_BYTE) << i);                          \
00055     else                                                                        \
00056       temp_64 |= (((temp_64_1 >> i) & X64_BYTE) << i);                          \
00057   }                                                                             \
00058   state.r[REG_3] = temp_64;
00059 
00060 #define DO_MINSB8 temp_64 = 0;                                                  \
00061   temp_64_1 = state.r[REG_1];                                                   \
00062   temp_64_2 = V_2;                                                              \
00063   for(i = 0; i < 64; i += 8)                                                    \
00064   {                                                                             \
00065     if((s8) ((temp_64_1 >> i) & X64_BYTE) > (s8) ((temp_64_2 >> i) & X64_BYTE)) \
00066       temp_64 |= (((temp_64_2 >> i) & X64_BYTE) << i);                          \
00067     else                                                                        \
00068       temp_64 |= (((temp_64_1 >> i) & X64_BYTE) << i);                          \
00069   }                                                                             \
00070   state.r[REG_3] = temp_64;
00071 
00072 #define DO_MINUW4 temp_64 = 0;                                                    \
00073   temp_64_1 = state.r[REG_1];                                                     \
00074   temp_64_2 = V_2;                                                                \
00075   for(i = 0; i < 64; i += 16)                                                     \
00076   {                                                                               \
00077     if((u16) ((temp_64_1 >> i) & X64_WORD) > (u16) ((temp_64_2 >> i) & X64_WORD)) \
00078       temp_64 |= (((temp_64_2 >> i) & X64_WORD) << i);                            \
00079     else                                                                          \
00080       temp_64 |= (((temp_64_1 >> i) & X64_WORD) << i);                            \
00081   }                                                                               \
00082   state.r[REG_3] = temp_64;
00083 
00084 #define DO_MINSW4 temp_64 = 0;                                                    \
00085   temp_64_1 = state.r[REG_1];                                                     \
00086   temp_64_2 = V_2;                                                                \
00087   for(i = 0; i < 64; i += 16)                                                     \
00088   {                                                                               \
00089     if((s16) ((temp_64_1 >> i) & X64_WORD) > (s16) ((temp_64_2 >> i) & X64_WORD)) \
00090       temp_64 |= (((temp_64_2 >> i) & X64_WORD) << i);                            \
00091     else                                                                          \
00092       temp_64 |= (((temp_64_1 >> i) & X64_WORD) << i);                            \
00093   }                                                                               \
00094   state.r[REG_3] = temp_64;
00095 
00096 #define DO_MAXUB8 temp_64 = 0;                                                  \
00097   temp_64_1 = state.r[REG_1];                                                   \
00098   temp_64_2 = V_2;                                                              \
00099   for(i = 0; i < 64; i += 8)                                                    \
00100   {                                                                             \
00101     if((u8) ((temp_64_1 >> i) & X64_BYTE) > (u8) ((temp_64_2 >> i) & X64_BYTE)) \
00102       temp_64 |= (((temp_64_1 >> i) & X64_BYTE) << i);                          \
00103     else                                                                        \
00104       temp_64 |= (((temp_64_2 >> i) & X64_BYTE) << i);                          \
00105   }                                                                             \
00106   state.r[REG_3] = temp_64;
00107 
00108 #define DO_MAXSB8 temp_64 = 0;                                                  \
00109   temp_64_1 = state.r[REG_1];                                                   \
00110   temp_64_2 = V_2;                                                              \
00111   for(i = 0; i < 64; i += 8)                                                    \
00112   {                                                                             \
00113     if((s8) ((temp_64_1 >> i) & X64_BYTE) > (s8) ((temp_64_2 >> i) & X64_BYTE)) \
00114       temp_64 |= (((temp_64_1 >> i) & X64_BYTE) << i);                          \
00115     else                                                                        \
00116       temp_64 |= (((temp_64_2 >> i) & X64_BYTE) << i);                          \
00117   }                                                                             \
00118   state.r[REG_3] = temp_64;
00119 
00120 #define DO_MAXUW4 temp_64 = 0;                                                    \
00121   temp_64_1 = state.r[REG_1];                                                     \
00122   temp_64_2 = V_2;                                                                \
00123   for(i = 0; i < 64; i += 16)                                                     \
00124   {                                                                               \
00125     if((u16) ((temp_64_1 >> i) & X64_WORD) > (u16) ((temp_64_2 >> i) & X64_WORD)) \
00126       temp_64 |= (((temp_64_1 >> i) & X64_WORD) << i);                            \
00127     else                                                                          \
00128       temp_64 |= (((temp_64_2 >> i) & X64_WORD) << i);                            \
00129   }                                                                               \
00130   state.r[REG_3] = temp_64;
00131 
00132 #define DO_MAXSW4 temp_64 = 0;                                                    \
00133   temp_64_1 = state.r[REG_1];                                                     \
00134   temp_64_2 = V_2;                                                                \
00135   for(i = 0; i < 64; i += 16)                                                     \
00136   {                                                                               \
00137     if((s16) ((temp_64_1 >> i) & X64_WORD) > (s16) ((temp_64_2 >> i) & X64_WORD)) \
00138       temp_64 |= (((temp_64_1 >> i) & X64_WORD) << i);                            \
00139     else                                                                          \
00140       temp_64 |= (((temp_64_2 >> i) & X64_WORD) << i);                            \
00141   }                                                                               \
00142   state.r[REG_3] = temp_64;
00143 
00144 #define DO_PERR   temp_64 = 0;                                                  \
00145   temp_64_1 = state.r[REG_1];                                                   \
00146   temp_64_2 = V_2;                                                              \
00147   for(i = 0; i < 64; i += 8)                                                    \
00148   {                                                                             \
00149     if((s8) ((temp_64_1 >> i) & X64_BYTE) > (s8) ((temp_64_2 >> i) & X64_BYTE)) \
00150       temp_64 |=                                                                \
00151         (                                                                       \
00152           (u64)                                                                 \
00153             (                                                                   \
00154               (s8) ((temp_64_1 >> i) & X64_BYTE) - (s8)                         \
00155                 ((temp_64_2 >> i) & X64_BYTE)                                   \
00156             ) <<                                                                \
00157           i                                                                     \
00158         );                                                                      \
00159     else                                                                        \
00160       temp_64 |=                                                                \
00161         (                                                                       \
00162           (u64)                                                                 \
00163             (                                                                   \
00164               (s8) ((temp_64_2 >> i) & X64_BYTE) - (s8)                         \
00165                 ((temp_64_1 >> i) & X64_BYTE)                                   \
00166             ) <<                                                                \
00167           i                                                                     \
00168         );                                                                      \
00169   }                                                                             \
00170   state.r[REG_3] = temp_64;
00171 
00172 #define DO_PKLB   temp_64_2 = V_2; \
00173   state.r[REG_3] = (temp_64_2 & U64(0x00000000000000ff)) | ((temp_64_2 & U64(0x000000ff00000000)) >> 24);
00174 
00175 #define DO_PKWB   temp_64_2 = V_2;                         \
00176   state.r[REG_3] = (temp_64_2 & U64(0x00000000000000ff)) | \
00177     ((temp_64_2 & U64(0x0000000000ff0000)) >> 8) |         \
00178       ((temp_64_2 & U64(0x000000ff00000000)) >> 16) |      \
00179         ((temp_64_2 & U64(0x00ff000000000000)) >> 24);
00180 
00181 #define DO_UNPKBL temp_64_2 = V_2; \
00182   state.r[REG_3] = (temp_64_2 & U64(0x000000ff)) | ((temp_64_2 & U64(0x0000ff00)) << 24);
00183 
00184 #define DO_UNPKBW temp_64_2 = V_2;                 \
00185   state.r[REG_3] = (temp_64_2 & U64(0x000000ff)) | \
00186     (                                              \
00187       (temp_64_2 & U64(0x0000ff00)) <<             \
00188       8                                            \
00189     ) |                                            \
00190         ((temp_64_2 & U64(0x00ff0000)) << 16) |    \
00191         ((temp_64_2 & U64(0xff000000)) << 24);

SourceForge.net Logo
Project space on SourceForge.net