comparison 68kinst.c @ 5:85699517043f

More bit and immediate instructions
author Mike Pavone <pavone@retrodev.com>
date Tue, 06 Nov 2012 02:04:42 -0800
parents 6f6a2d7cc889
children 23b83d94c633
comparison
equal deleted inserted replaced
4:6f6a2d7cc889 5:85699517043f
166 #endif 166 #endif
167 } 167 }
168 } 168 }
169 break; 169 break;
170 case 1: 170 case 1:
171 //ANDI, ANDI to CCR, ANDI to SR, CMP2.w CHK2.w
172 if ((*istream & 0xFF) == 0x3C) {
173 decoded->op = M68K_ANDI_CCR;
174 decoded->extra.size = OPSIZE_BYTE;
175 decoded->src.addr_mode = MODE_IMMEDIATE;
176 decoded->src.params.u8 = *(++istream);
177 } else if((*istream & 0xFF) == 0x7C) {
178 decoded->op = M68K_ANDI_SR;
179 decoded->extra.size = OPSIZE_WORD;
180 decoded->src.addr_mode = MODE_IMMEDIATE;
181 decoded->src.params.u16 = *(++istream);
182 } else {
183 //ANDI, CMP2.w, CHK2.w
184 if ((*istream & 0xC0) != 0xC0) {
185 decoded->op = M68K_AND;
186 decoded->src.addr_mode = MODE_IMMEDIATE;
187 decoded->extra.size = size = (*istream >> 6) & 3;
188 reg = *istream & 0x7;
189 opmode = (*istream >> 3) & 0x7;
190 switch (size)
191 {
192 case OPSIZE_BYTE:
193 decoded->src.params.u8 = *(++istream);
194 break;
195 case OPSIZE_WORD:
196 decoded->src.params.16 = *(++istream);
197 break;
198 case OPSIZE_LONG:
199 immed = *(++istream);
200 decoded->src.params.u32 = immed << 16 | *(++istream);
201 break;
202 }
203 istream = m68k_decode_op_ex(istream, opmode, reg, size, &(decoded->dst));
204 } else {
205 #ifdef M68020
206 //TODO: Implement me for 68020 support
207 #endif
208 }
209 }
171 break; 210 break;
172 case 2: 211 case 2:
212 //SUBI, CMP2.l, CHK2.l
213 if ((*istream & 0xC0) != 0xC0) {
214 decoded->op = M68K_SUB;
215 decoded->src.addr_mode = MODE_IMMEDIATE;
216 decoded->extra.size = size = (*istream >> 6) & 3;
217 reg = *istream & 0x7;
218 opmode = (*istream >> 3) & 0x7;
219 switch (size)
220 {
221 case OPSIZE_BYTE:
222 decoded->src.params.u8 = *(++istream);
223 break;
224 case OPSIZE_WORD:
225 decoded->src.params.16 = *(++istream);
226 break;
227 case OPSIZE_LONG:
228 immed = *(++istream);
229 decoded->src.params.u32 = immed << 16 | *(++istream);
230 break;
231 }
232 istream = m68k_decode_op_ex(istream, opmode, reg, size, &(decoded->dst));
233 } else {
234 #ifdef M68020
235 //TODO: Implement me for 68020 support
236 #endif
237 }
173 break; 238 break;
174 case 3: 239 case 3:
240 //RTM, CALLM, ADDI
241 if ((*istream & 0xC0) != 0xC0) {
242 decoded->op = M68K_ADD;
243 decoded->src.addr_mode = MODE_IMMEDIATE;
244 decoded->extra.size = size = (*istream >> 6) & 3;
245 reg = *istream & 0x7;
246 opmode = (*istream >> 3) & 0x7;
247 switch (size)
248 {
249 case OPSIZE_BYTE:
250 decoded->src.params.u8 = *(++istream);
251 break;
252 case OPSIZE_WORD:
253 decoded->src.params.16 = *(++istream);
254 break;
255 case OPSIZE_LONG:
256 immed = *(++istream);
257 decoded->src.params.u32 = immed << 16 | *(++istream);
258 break;
259 }
260 istream = m68k_decode_op_ex(istream, opmode, reg, size, &(decoded->dst));
261 } else {
262 #ifdef M68020
263 //TODO: Implement me for 68020 support
264 #endif
265 }
175 break; 266 break;
176 case 4: 267 case 4:
268 //BTST, BCHG, BCLR, BSET
269 switch ((*istream >> 6) & 0x3)
270 {
271 case 0:
272 decoded->op = M68K_BTST;
273 break;
274 case 1:
275 decoded->op = M68K_BCHG;
276 break;
277 case 2:
278 decoded->op = M68K_BCLR;
279 break;
280 case 3:
281 decoded->op = M68K_BSET;
282 break;
283 }
284 decoded->src.addr_mode = MODE_IMMEDIATE;
285 decoded->src.params.u8 = *(++istream);
286 istream = m68k_decode_op(istream, OPSIZE_BYTE, &(decoded->dst));
177 break; 287 break;
178 case 5: 288 case 5:
289 //EORI, EORI to CCR, EORI to SR
290 if ((*istream & 0xFF) == 0x3C) {
291 decoded->op = M68K_EORI_CCR;
292 decoded->extra.size = OPSIZE_BYTE;
293 decoded->src.addr_mode = MODE_IMMEDIATE;
294 decoded->src.params.u8 = *(++istream);
295 } else if((*istream & 0xFF) == 0x7C) {
296 decoded->op = M68K_EORI_SR;
297 decoded->extra.size = OPSIZE_WORD;
298 decoded->src.addr_mode = MODE_IMMEDIATE;
299 decoded->src.params.u16 = *(++istream);
300 } else {
301 //EORI, CMP2.w, CHK2.w
302 if ((*istream & 0xC0) != 0xC0) {
303 decoded->op = M68K_EOR;
304 decoded->src.addr_mode = MODE_IMMEDIATE;
305 decoded->extra.size = size = (*istream >> 6) & 3;
306 reg = *istream & 0x7;
307 opmode = (*istream >> 3) & 0x7;
308 switch (size)
309 {
310 case OPSIZE_BYTE:
311 decoded->src.params.u8 = *(++istream);
312 break;
313 case OPSIZE_WORD:
314 decoded->src.params.16 = *(++istream);
315 break;
316 case OPSIZE_LONG:
317 immed = *(++istream);
318 decoded->src.params.u32 = immed << 16 | *(++istream);
319 break;
320 }
321 istream = m68k_decode_op_ex(istream, opmode, reg, size, &(decoded->dst));
322 }
323 }
179 break; 324 break;
180 case 6: 325 case 6:
326
181 break; 327 break;
182 case 7: 328 case 7:
183 break; 329 break;
184 } 330 }
185 } 331 }