/* * instruction.c * * This program reads in an instruction definition file and builds the * m68000DecodeTable.hxx file. It checks the input to make sure that all * instruction entries are distinguishable (if not an error is reported). * * Usage: instruction * * Sim68000 "Motorola 68000 Simulator" * Copyright (c) 1993 * By: Bradford W. Mott * November 3,1993 * * Adapted to 68360 - DJ - 11/1996 * - OUTFILE renamed cpu32DecodeTable.hxx * - m68000 renamed cpu32 */ #include #include #include #define INFILE "instruction.list" #define OUTFILE "cpu32DecodeTable.hxx" typedef struct { int mask; int signature; char *name; char *gen; } Entry; Entry table[4096]; int Compare(const void *a,const void *b) { /* return( strcmp( ((Entry*)a)->name, ((Entry*)b)->name ) ); */ return( ((Entry*)a)->signature - ((Entry*)b)->signature ); } unsigned int BinaryToInt(char *binary) { int t,v; v=0; for(t=0;t0) { printf("Input Error: %d (%s)\n",t,input); exit(-1); } } fclose(fp); /* Compute the mask and signature values from the generator string */ printf("Computing mask and signature values...\n"); for(t=0;t