#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
◆ DECL_SPEC
◆ build_opcode_table()
static void build_opcode_table |
( |
void |
| ) |
|
|
static |
Definition at line 411 of file M68KInstructionTblGen.c.
416 unsigned int opcode_info_length = 0;
417 const unsigned int total_count = 0x10000;
420 opcode_info_length++;
424 printf(
"/* This table is auto-generated. DO NOT MANUALLY EDIT! Look in M68KInstructionTblGen.c for more info */\n");
425 printf(
"static instruction_struct g_instruction_table[] = {\n");
427 for(
i=0;
i<0x10000;
i++) {
428 const char *
name =
"d68000_invalid";
435 if ((opcode & ostruct->
mask) == ostruct->
match) {
437 if ((!strcmp(ostruct->
name,
"d68000_move_8") ||
438 !strcmp(ostruct->
name,
"d68000_move_16") ||
439 !strcmp(ostruct->
name,
"d68000_move_32")) &&
440 !
valid_ea(((opcode>>9)&7) | ((opcode>>3)&0x38), 0xbf8))
444 word2_mask = ostruct->
mask2;
445 word2_match = ostruct->
match2;
452 if (
i != total_count - 1) {
453 printf(
"\t{ %s, 0x%x, 0x%x },\n",
name, word2_mask, word2_match);
455 printf(
"\t{ %s, 0x%x, 0x%x }\n",
name, word2_mask, word2_match);
static opcode_struct g_opcode_info[]
static int valid_ea(unsigned int opcode, unsigned int mask)
static int DECL_SPEC compare_nof_true_bits(const void *aptr, const void *bptr)
_Use_decl_annotations_ int __cdecl printf(const char *const _Format,...)
void qsort(void *a, size_t n, size_t es, int(*cmp)(const void *, const void *))
References compare_nof_true_bits(), opcode_struct::ea_mask, g_opcode_info, i, opcode_struct::mask, opcode_struct::mask2, opcode_struct::match, opcode_struct::match2, opcode_struct::name, printf(), qsort(), and valid_ea().
Referenced by main().
◆ compare_nof_true_bits()
Definition at line 392 of file M68KInstructionTblGen.c.
397 a = ((
a & 0xAAAA) >> 1) + (
a & 0x5555);
398 a = ((
a & 0xCCCC) >> 2) + (
a & 0x3333);
399 a = ((
a & 0xF0F0) >> 4) + (
a & 0x0F0F);
400 a = ((
a & 0xFF00) >> 8) + (
a & 0x00FF);
402 b = ((
b & 0xAAAA) >> 1) + (
b & 0x5555);
403 b = ((
b & 0xCCCC) >> 2) + (
b & 0x3333);
404 b = ((
b & 0xF0F0) >> 4) + (
b & 0x0F0F);
405 b = ((
b & 0xFF00) >> 8) + (
b & 0x00FF);
References a, and b.
Referenced by build_opcode_table().
◆ main()
◆ valid_ea()
Definition at line 341 of file M68KInstructionTblGen.c.
346 switch(opcode & 0x3f) {
347 case 0x00:
case 0x01:
case 0x02:
case 0x03:
348 case 0x04:
case 0x05:
case 0x06:
case 0x07:
349 return (
mask & 0x800) != 0;
350 case 0x08:
case 0x09:
case 0x0a:
case 0x0b:
351 case 0x0c:
case 0x0d:
case 0x0e:
case 0x0f:
352 return (
mask & 0x400) != 0;
353 case 0x10:
case 0x11:
case 0x12:
case 0x13:
354 case 0x14:
case 0x15:
case 0x16:
case 0x17:
355 return (
mask & 0x200) != 0;
356 case 0x18:
case 0x19:
case 0x1a:
case 0x1b:
357 case 0x1c:
case 0x1d:
case 0x1e:
case 0x1f:
358 return (
mask & 0x100) != 0;
359 case 0x20:
case 0x21:
case 0x22:
case 0x23:
360 case 0x24:
case 0x25:
case 0x26:
case 0x27:
361 return (
mask & 0x080) != 0;
362 case 0x28:
case 0x29:
case 0x2a:
case 0x2b:
363 case 0x2c:
case 0x2d:
case 0x2e:
case 0x2f:
364 return (
mask & 0x040) != 0;
365 case 0x30:
case 0x31:
case 0x32:
case 0x33:
366 case 0x34:
case 0x35:
case 0x36:
case 0x37:
367 return (
mask & 0x020) != 0;
369 return (
mask & 0x010) != 0;
371 return (
mask & 0x008) != 0;
373 return (
mask & 0x002) != 0;
375 return (
mask & 0x001) != 0;
377 return (
mask & 0x004) != 0;
References mask.
Referenced by build_opcode_table().
◆ g_opcode_info