diff options
author | Christian Groessler <chris@groessler.org> | 2003-11-28 20:12:17 +0000 |
---|---|---|
committer | Christian Groessler <chris@groessler.org> | 2003-11-28 20:12:17 +0000 |
commit | c8fd013cc2751a893e84a9f9766361b643ea1b84 (patch) | |
tree | 55a534dee2d4c8bf1c9286937dd39c2f15a1572a | |
parent | 464800cafe864f4b672c1cf80096a1b304e86221 (diff) | |
download | gdb-c8fd013cc2751a893e84a9f9766361b643ea1b84.zip gdb-c8fd013cc2751a893e84a9f9766361b643ea1b84.tar.gz gdb-c8fd013cc2751a893e84a9f9766361b643ea1b84.tar.bz2 |
* z8k-dis.c: Convert to ISO C90.
* z8kgen.c: Convert to ISO C90.
(opt): Move long opcode for "ldb rdb,imm8" after short one, now
the short one is created when assembling.
* z8k-opc.h: Regenerate with new z8kgen.c.
-rw-r--r-- | opcodes/ChangeLog | 8 | ||||
-rw-r--r-- | opcodes/z8k-dis.c | 53 | ||||
-rw-r--r-- | opcodes/z8k-opc.h | 226 | ||||
-rw-r--r-- | opcodes/z8kgen.c | 274 |
4 files changed, 266 insertions, 295 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index d322f4a..2884151 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,11 @@ +2003-11-28 Christian Groessler <chris@groessler.org> + + * z8k-dis.c: Convert to ISO C90. + * z8kgen.c: Convert to ISO C90. + (opt): Move long opcode for "ldb rdb,imm8" after short one, now + the short one is created when assembling. + * z8k-opc.h: Regenerate with new z8kgen.c. + 2003-11-19 Kazu Hirata <kazu@cs.umass.edu> * h8300-dis.c (print_colon_thingie): Remove. diff --git a/opcodes/z8k-dis.c b/opcodes/z8k-dis.c index 5d15ee8..02f5dcb 100644 --- a/opcodes/z8k-dis.c +++ b/opcodes/z8k-dis.c @@ -24,7 +24,7 @@ #define DEFINE_TABLE #include "z8k-opc.h" - + #include <setjmp.h> typedef struct @@ -53,9 +53,6 @@ typedef struct } instr_data_s; -static int fetch_data PARAMS ((struct disassemble_info *, int)); - - /* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive) to ADDR (exclusive) are valid. Returns 1 for success, longjmps on error. */ @@ -64,9 +61,7 @@ static int fetch_data PARAMS ((struct disassemble_info *, int)); ? 1 : fetch_data ((info), (nibble))) static int -fetch_data (info, nibble) - struct disassemble_info *info; - int nibble; +fetch_data (struct disassemble_info *info, int nibble) { unsigned char mybuf[20]; int status; @@ -142,18 +137,13 @@ static char *ctrl_names[8] = }; static int seg_length; -static int print_insn_z8k PARAMS ((bfd_vma, disassemble_info *, int)); -int z8k_lookup_instr PARAMS ((unsigned char *, disassemble_info *)); -static void output_instr - PARAMS ((instr_data_s *, unsigned long, disassemble_info *)); -static void unpack_instr PARAMS ((instr_data_s *, int, disassemble_info *)); -static void unparse_instr PARAMS ((instr_data_s *, int)); +int z8k_lookup_instr (unsigned char *, disassemble_info *); +static void output_instr (instr_data_s *, unsigned long, disassemble_info *); +static void unpack_instr (instr_data_s *, int, disassemble_info *); +static void unparse_instr (instr_data_s *, int); static int -print_insn_z8k (addr, info, is_segmented) - bfd_vma addr; - disassemble_info *info; - int is_segmented; +print_insn_z8k (bfd_vma addr, disassemble_info *info, int is_segmented) { instr_data_s instr_data; @@ -186,27 +176,20 @@ print_insn_z8k (addr, info, is_segmented) } int -print_insn_z8001 (addr, info) - bfd_vma addr; - disassemble_info *info; +print_insn_z8001 (bfd_vma addr, disassemble_info *info) { return print_insn_z8k (addr, info, 1); } int -print_insn_z8002 (addr, info) - bfd_vma addr; - disassemble_info *info; +print_insn_z8002 (bfd_vma addr, disassemble_info *info) { return print_insn_z8k (addr, info, 0); } int -z8k_lookup_instr (nibbles, info) - unsigned char *nibbles; - disassemble_info *info; +z8k_lookup_instr (unsigned char *nibbles, disassemble_info *info) { - int nibl_index, tabl_index; int nibl_matched; int need_fetch = 0; @@ -295,10 +278,9 @@ z8k_lookup_instr (nibbles, info) } static void -output_instr (instr_data, addr, info) - instr_data_s *instr_data; - unsigned long addr ATTRIBUTE_UNUSED; - disassemble_info *info; +output_instr (instr_data_s *instr_data, + unsigned long addr ATTRIBUTE_UNUSED, + disassemble_info *info) { int num_bytes; char out_str[100]; @@ -314,10 +296,7 @@ output_instr (instr_data, addr, info) } static void -unpack_instr (instr_data, is_segmented, info) - instr_data_s *instr_data; - int is_segmented; - disassemble_info *info; +unpack_instr (instr_data_s *instr_data, int is_segmented, disassemble_info *info) { int nibl_count, loop; unsigned short instr_nibl, instr_byte, instr_word; @@ -501,9 +480,7 @@ static char *intr_names[] = { }; static void -unparse_instr (instr_data, is_segmented) - instr_data_s *instr_data; - int is_segmented; +unparse_instr (instr_data_s *instr_data, int is_segmented) { unsigned short datum_value; unsigned int tabl_datum, datum_class; diff --git a/opcodes/z8k-opc.h b/opcodes/z8k-opc.h index c714bde..4caedd4 100644 --- a/opcodes/z8k-opc.h +++ b/opcodes/z8k-opc.h @@ -1,117 +1,117 @@ /* DO NOT EDIT! -*- buffer-read-only: t -*- This file is automatically generated by z8kgen. */ -#define ARG_MASK 0x0f -#define ARG_SRC 0x01 -#define ARG_DST 0x02 -#define ARG_RS 0x01 -#define ARG_RD 0x02 -#define ARG_RA 0x03 -#define ARG_RB 0x04 -#define ARG_RR 0x05 -#define ARG_RX 0x06 -#define ARG_IMM4 0x01 -#define ARG_IMM8 0x02 -#define ARG_IMM16 0x03 -#define ARG_IMM32 0x04 -#define ARG_IMMN 0x05 -#define ARG_IMMNMINUS1 0x05 -#define ARG_IMM_1 0x06 -#define ARG_IMM_2 0x07 -#define ARG_DISP16 0x08 -#define ARG_NIM8 0x09 -#define ARG_IMM2 0x0a -#define ARG_IMM1OR2 0x0b -#define ARG_DISP12 0x0b -#define ARG_NIM4 0x0c -#define ARG_DISP8 0x0c -#define ARG_IMM4M1 0x0d -#define CLASS_X 0x10 -#define CLASS_BA 0x20 -#define CLASS_DA 0x30 -#define CLASS_BX 0x40 -#define CLASS_DISP 0x50 -#define CLASS_IMM 0x60 -#define CLASS_CC 0x70 -#define CLASS_CTRL 0x80 -#define CLASS_IGNORE 0x90 -#define CLASS_ADDRESS 0xd0 -#define CLASS_0CCC 0xe0 -#define CLASS_1CCC 0xf0 -#define CLASS_0DISP7 0x100 -#define CLASS_1DISP7 0x200 -#define CLASS_01II 0x300 -#define CLASS_00II 0x400 -#define CLASS_BIT 0x500 -#define CLASS_FLAGS 0x600 -#define CLASS_IR 0x700 +#define ARG_MASK 0x0f +#define ARG_SRC 0x01 +#define ARG_DST 0x02 +#define ARG_RS 0x01 +#define ARG_RD 0x02 +#define ARG_RA 0x03 +#define ARG_RB 0x04 +#define ARG_RR 0x05 +#define ARG_RX 0x06 +#define ARG_IMM4 0x01 +#define ARG_IMM8 0x02 +#define ARG_IMM16 0x03 +#define ARG_IMM32 0x04 +#define ARG_IMMN 0x05 +#define ARG_IMMNMINUS1 0x05 +#define ARG_IMM_1 0x06 +#define ARG_IMM_2 0x07 +#define ARG_DISP16 0x08 +#define ARG_NIM8 0x09 +#define ARG_IMM2 0x0a +#define ARG_IMM1OR2 0x0b +#define ARG_DISP12 0x0b +#define ARG_NIM4 0x0c +#define ARG_DISP8 0x0c +#define ARG_IMM4M1 0x0d +#define CLASS_X 0x10 +#define CLASS_BA 0x20 +#define CLASS_DA 0x30 +#define CLASS_BX 0x40 +#define CLASS_DISP 0x50 +#define CLASS_IMM 0x60 +#define CLASS_CC 0x70 +#define CLASS_CTRL 0x80 +#define CLASS_IGNORE 0x90 +#define CLASS_ADDRESS 0xd0 +#define CLASS_0CCC 0xe0 +#define CLASS_1CCC 0xf0 +#define CLASS_0DISP7 0x100 +#define CLASS_1DISP7 0x200 +#define CLASS_01II 0x300 +#define CLASS_00II 0x400 +#define CLASS_BIT 0x500 +#define CLASS_FLAGS 0x600 +#define CLASS_IR 0x700 #define CLASS_IRO 0x800 #define CLASS_DISP8 0x900 #define CLASS_BIT_1OR2 0xa00 -#define CLASS_REG 0x7000 -#define CLASS_REG_BYTE 0x2000 -#define CLASS_REG_WORD 0x3000 -#define CLASS_REG_QUAD 0x4000 -#define CLASS_REG_LONG 0x5000 -#define CLASS_REGN0 0x8000 -#define CLASS_PR 0x10000 +#define CLASS_REG 0x7000 +#define CLASS_REG_BYTE 0x2000 +#define CLASS_REG_WORD 0x3000 +#define CLASS_REG_QUAD 0x4000 +#define CLASS_REG_LONG 0x5000 +#define CLASS_REGN0 0x8000 +#define CLASS_PR 0x10000 #define CLASS_MASK 0x1fff0 -#define OPC_adc 0 -#define OPC_adcb 1 -#define OPC_add 2 -#define OPC_addb 3 -#define OPC_addl 4 -#define OPC_and 5 -#define OPC_andb 6 -#define OPC_bit 7 -#define OPC_bitb 8 -#define OPC_call 9 -#define OPC_calr 10 -#define OPC_clr 11 -#define OPC_clrb 12 -#define OPC_com 13 -#define OPC_comb 14 -#define OPC_comflg 15 -#define OPC_cp 16 -#define OPC_cpb 17 -#define OPC_cpd 18 -#define OPC_cpdb 19 -#define OPC_cpdr 20 -#define OPC_cpdrb 21 -#define OPC_cpi 22 -#define OPC_cpib 23 -#define OPC_cpir 24 -#define OPC_cpirb 25 -#define OPC_cpl 26 -#define OPC_cpsd 27 -#define OPC_cpsdb 28 -#define OPC_cpsdr 29 -#define OPC_cpsdrb 30 -#define OPC_cpsi 31 -#define OPC_cpsib 32 -#define OPC_cpsir 33 -#define OPC_cpsirb 34 -#define OPC_dab 35 -#define OPC_dbjnz 36 -#define OPC_dec 37 -#define OPC_decb 38 -#define OPC_di 39 -#define OPC_div 40 -#define OPC_divl 41 -#define OPC_djnz 42 -#define OPC_ei 43 -#define OPC_ex 44 -#define OPC_exb 45 -#define OPC_exts 46 -#define OPC_extsb 47 -#define OPC_extsl 48 -#define OPC_halt 49 -#define OPC_in 50 -#define OPC_inb 51 -#define OPC_inc 52 -#define OPC_incb 53 -#define OPC_ind 54 -#define OPC_indb 55 +#define OPC_adc 0 +#define OPC_adcb 1 +#define OPC_add 2 +#define OPC_addb 3 +#define OPC_addl 4 +#define OPC_and 5 +#define OPC_andb 6 +#define OPC_bit 7 +#define OPC_bitb 8 +#define OPC_call 9 +#define OPC_calr 10 +#define OPC_clr 11 +#define OPC_clrb 12 +#define OPC_com 13 +#define OPC_comb 14 +#define OPC_comflg 15 +#define OPC_cp 16 +#define OPC_cpb 17 +#define OPC_cpd 18 +#define OPC_cpdb 19 +#define OPC_cpdr 20 +#define OPC_cpdrb 21 +#define OPC_cpi 22 +#define OPC_cpib 23 +#define OPC_cpir 24 +#define OPC_cpirb 25 +#define OPC_cpl 26 +#define OPC_cpsd 27 +#define OPC_cpsdb 28 +#define OPC_cpsdr 29 +#define OPC_cpsdrb 30 +#define OPC_cpsi 31 +#define OPC_cpsib 32 +#define OPC_cpsir 33 +#define OPC_cpsirb 34 +#define OPC_dab 35 +#define OPC_dbjnz 36 +#define OPC_dec 37 +#define OPC_decb 38 +#define OPC_di 39 +#define OPC_div 40 +#define OPC_divl 41 +#define OPC_djnz 42 +#define OPC_ei 43 +#define OPC_ex 44 +#define OPC_exb 45 +#define OPC_exts 46 +#define OPC_extsb 47 +#define OPC_extsl 48 +#define OPC_halt 49 +#define OPC_in 50 +#define OPC_inb 51 +#define OPC_inc 52 +#define OPC_incb 53 +#define OPC_ind 54 +#define OPC_indb 55 #define OPC_indr 56 #define OPC_indrb 57 #define OPC_ini 58 @@ -1801,21 +1801,21 @@ const opcode_entry_type z8k_table[] = { "ldb",OPC_ldb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_X+(ARG_RS),}, {CLASS_BIT+6,CLASS_BIT+0,CLASS_REGN0+(ARG_RS),CLASS_REG+(ARG_RD),CLASS_ADDRESS+(ARG_SRC),0,0,0,0,},2,4,74}, -/* 0010 0000 0000 dddd imm8 imm8 *** ldb rbd,imm8 */ +/* 1100 dddd imm8 *** ldb rbd,imm8 */ { #ifdef NICENAMES -"ldb rbd,imm8",8,7,0x00, +"ldb rbd,imm8",8,5,0x00, #endif "ldb",OPC_ldb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+2,CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,74}, + {CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},2,2,74}, -/* 1100 dddd imm8 *** ldb rbd,imm8 */ +/* 0010 0000 0000 dddd imm8 imm8 *** ldb rbd,imm8 */ { #ifdef NICENAMES -"ldb rbd,imm8",8,5,0x00, +"ldb rbd,imm8",8,7,0x00, #endif "ldb",OPC_ldb,0,{CLASS_REG_BYTE+(ARG_RD),CLASS_IMM+(ARG_IMM8),}, - {CLASS_BIT+0xc,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),0,0,0,0,0,0,},2,2,74}, + {CLASS_BIT+2,CLASS_BIT+0,CLASS_BIT+0,CLASS_REG+(ARG_RD),CLASS_IMM+(ARG_IMM8),CLASS_IMM+(ARG_IMM8),0,0,0,},2,4,74}, /* 1010 0000 ssss dddd *** ldb rbd,rbs */ { diff --git a/opcodes/z8kgen.c b/opcodes/z8kgen.c index df72791..9e46809 100644 --- a/opcodes/z8kgen.c +++ b/opcodes/z8kgen.c @@ -36,7 +36,7 @@ struct op }; #define iswhite(x) ((x) == ' ' || (x) == '\t') -struct op opt[] = +static struct op opt[] = { {"------", 2, 8, "0011 0110 0000 0000", "bpt", 0}, /* Breakpoint used by the simulator. */ {"------", 10, 8, "0000 1111 0000 1100", "brk", 0}, /* Breakpoint used by real hardware. @@ -265,8 +265,8 @@ struct op opt[] = {"------", 7, 8, "0010 0000 ssN0 dddd", "ldb rbd,@rs", 0}, {"------", 9, 8, "0110 0000 0000 dddd address_src", "ldb rbd,address_src", 0}, {"------", 10, 8, "0110 0000 ssN0 dddd address_src", "ldb rbd,address_src(rs)", 0}, - {"------", 7, 8, "0010 0000 0000 dddd imm8 imm8", "ldb rbd,imm8", 0}, {"------", 5, 8, "1100 dddd imm8", "ldb rbd,imm8", 0}, + {"------", 7, 8, "0010 0000 0000 dddd imm8 imm8", "ldb rbd,imm8", 0}, {"------", 3, 8, "1010 0000 ssss dddd", "ldb rbd,rbs", 0}, {"------", 14, 8, "0011 0000 ssN0 dddd imm16", "ldb rbd,rs(imm16)", 0}, {"------", 14, 8, "0111 0000 ssN0 dddd 0000 xxxx 0000 0000", "ldb rbd,rs(rx)", 0}, @@ -552,7 +552,7 @@ struct op opt[] = }; static int -count () +count (void) { struct op *p = opt; int r = 0; @@ -567,9 +567,7 @@ count () } static int -func (a, b) - struct op *a; - struct op *b; +func (struct op *a, struct op *b) { return strcmp ((a)->name, (b)->name); } @@ -588,7 +586,7 @@ struct tok_struct int length; }; -struct tok_struct args[] = +static struct tok_struct args[] = { {"address_src(rs)", "CLASS_X+(ARG_RS)",}, {"address_dst(rd)", "CLASS_X+(ARG_RD)",}, @@ -649,7 +647,7 @@ struct tok_struct args[] = {0, 0} }; -struct tok_struct toks[] = +static struct tok_struct toks[] = { {"0000", "CLASS_BIT+0", 1}, {"0001", "CLASS_BIT+1", 1}, @@ -728,11 +726,8 @@ struct tok_struct toks[] = {0, 0} }; -char * -translate (table, x, length) - struct tok_struct *table; - char *x; - int *length; +static char * +translate (struct tok_struct *table, char *x, int *length) { int found; @@ -760,9 +755,7 @@ translate (table, x, length) } static void -chewbits (bits, length) - char *bits; - int *length; +chewbits (char *bits, int *length) { int n = 0; @@ -788,8 +781,7 @@ chewbits (bits, length) } static int -chewname (name) - char **name; +chewname (char **name) { char *n; int nargs = 0; @@ -830,9 +822,7 @@ chewname (name) } static void -sub (x, c) - char *x; - char c; +sub (char *x, char c) { while (*x) { @@ -851,8 +841,7 @@ sub (x, c) #define D(x) ((x) == '1' || (x) =='0') #define M(y) (strncmp(y,x,4)==0) static void -printmangled (x) - char *x; +printmangled (char *x) { return; while (*x) @@ -886,8 +875,7 @@ printmangled (x) /*#define WORK_TYPE*/ static void -print_type (n) - struct op *n; +print_type (struct op *n) { #ifdef WORK_TYPE while (*s && !iswhite (*s)) @@ -913,7 +901,7 @@ print_type (n) } static void -internal () +internal (void) { int c = count (); struct op *new = (struct op *) xmalloc (sizeof (struct op) * c); @@ -921,7 +909,7 @@ internal () memcpy (new, p, c * sizeof (struct op)); /* Sort all names in table alphabetically. */ - qsort (new, c, sizeof (struct op), func); + qsort (new, c, sizeof (struct op), (int (*)(const void *, const void *))func); p = new; while (p->flags && p->flags[0] != '*') @@ -966,7 +954,7 @@ internal () } static void -gas () +gas (void) { int c = count (); struct op *p = opt; @@ -977,129 +965,129 @@ gas () memcpy (new, p, c * sizeof (struct op)); /* Sort all names in table alphabetically. */ - qsort (new, c, sizeof (struct op), func); + qsort (new, c, sizeof (struct op), (int (*)(const void *, const void *))func); printf ("/* DO NOT EDIT! -*- buffer-read-only: t -*-\n"); printf (" This file is automatically generated by z8kgen. */\n\n"); - printf ("#define ARG_MASK 0x0f\n"); - - printf ("#define ARG_SRC 0x01\n"); - printf ("#define ARG_DST 0x02\n"); - - printf ("#define ARG_RS 0x01\n"); - printf ("#define ARG_RD 0x02\n"); - printf ("#define ARG_RA 0x03\n"); - printf ("#define ARG_RB 0x04\n"); - printf ("#define ARG_RR 0x05\n"); - printf ("#define ARG_RX 0x06\n"); - - printf ("#define ARG_IMM4 0x01\n"); - printf ("#define ARG_IMM8 0x02\n"); - printf ("#define ARG_IMM16 0x03\n"); - printf ("#define ARG_IMM32 0x04\n"); - printf ("#define ARG_IMMN 0x05\n"); - printf ("#define ARG_IMMNMINUS1 0x05\n"); - printf ("#define ARG_IMM_1 0x06\n"); - printf ("#define ARG_IMM_2 0x07\n"); - printf ("#define ARG_DISP16 0x08\n"); - printf ("#define ARG_NIM8 0x09\n"); - printf ("#define ARG_IMM2 0x0a\n"); - printf ("#define ARG_IMM1OR2 0x0b\n"); - - printf ("#define ARG_DISP12 0x0b\n"); - printf ("#define ARG_NIM4 0x0c\n"); - printf ("#define ARG_DISP8 0x0c\n"); - printf ("#define ARG_IMM4M1 0x0d\n"); - - printf ("#define CLASS_X 0x10\n"); - printf ("#define CLASS_BA 0x20\n"); - printf ("#define CLASS_DA 0x30\n"); - printf ("#define CLASS_BX 0x40\n"); - printf ("#define CLASS_DISP 0x50\n"); - printf ("#define CLASS_IMM 0x60\n"); - printf ("#define CLASS_CC 0x70\n"); - printf ("#define CLASS_CTRL 0x80\n"); - printf ("#define CLASS_IGNORE 0x90\n"); - printf ("#define CLASS_ADDRESS 0xd0\n"); - printf ("#define CLASS_0CCC 0xe0\n"); - printf ("#define CLASS_1CCC 0xf0\n"); - printf ("#define CLASS_0DISP7 0x100\n"); - printf ("#define CLASS_1DISP7 0x200\n"); - printf ("#define CLASS_01II 0x300\n"); - printf ("#define CLASS_00II 0x400\n"); - printf ("#define CLASS_BIT 0x500\n"); - printf ("#define CLASS_FLAGS 0x600\n"); - printf ("#define CLASS_IR 0x700\n"); + printf ("#define ARG_MASK 0x0f\n"); + + printf ("#define ARG_SRC 0x01\n"); + printf ("#define ARG_DST 0x02\n"); + + printf ("#define ARG_RS 0x01\n"); + printf ("#define ARG_RD 0x02\n"); + printf ("#define ARG_RA 0x03\n"); + printf ("#define ARG_RB 0x04\n"); + printf ("#define ARG_RR 0x05\n"); + printf ("#define ARG_RX 0x06\n"); + + printf ("#define ARG_IMM4 0x01\n"); + printf ("#define ARG_IMM8 0x02\n"); + printf ("#define ARG_IMM16 0x03\n"); + printf ("#define ARG_IMM32 0x04\n"); + printf ("#define ARG_IMMN 0x05\n"); + printf ("#define ARG_IMMNMINUS1 0x05\n"); + printf ("#define ARG_IMM_1 0x06\n"); + printf ("#define ARG_IMM_2 0x07\n"); + printf ("#define ARG_DISP16 0x08\n"); + printf ("#define ARG_NIM8 0x09\n"); + printf ("#define ARG_IMM2 0x0a\n"); + printf ("#define ARG_IMM1OR2 0x0b\n"); + + printf ("#define ARG_DISP12 0x0b\n"); + printf ("#define ARG_NIM4 0x0c\n"); + printf ("#define ARG_DISP8 0x0c\n"); + printf ("#define ARG_IMM4M1 0x0d\n"); + + printf ("#define CLASS_X 0x10\n"); + printf ("#define CLASS_BA 0x20\n"); + printf ("#define CLASS_DA 0x30\n"); + printf ("#define CLASS_BX 0x40\n"); + printf ("#define CLASS_DISP 0x50\n"); + printf ("#define CLASS_IMM 0x60\n"); + printf ("#define CLASS_CC 0x70\n"); + printf ("#define CLASS_CTRL 0x80\n"); + printf ("#define CLASS_IGNORE 0x90\n"); + printf ("#define CLASS_ADDRESS 0xd0\n"); + printf ("#define CLASS_0CCC 0xe0\n"); + printf ("#define CLASS_1CCC 0xf0\n"); + printf ("#define CLASS_0DISP7 0x100\n"); + printf ("#define CLASS_1DISP7 0x200\n"); + printf ("#define CLASS_01II 0x300\n"); + printf ("#define CLASS_00II 0x400\n"); + printf ("#define CLASS_BIT 0x500\n"); + printf ("#define CLASS_FLAGS 0x600\n"); + printf ("#define CLASS_IR 0x700\n"); printf ("#define CLASS_IRO 0x800\n"); printf ("#define CLASS_DISP8 0x900\n"); printf ("#define CLASS_BIT_1OR2 0xa00\n"); - printf ("#define CLASS_REG 0x7000\n"); - printf ("#define CLASS_REG_BYTE 0x2000\n"); - printf ("#define CLASS_REG_WORD 0x3000\n"); - printf ("#define CLASS_REG_QUAD 0x4000\n"); - printf ("#define CLASS_REG_LONG 0x5000\n"); - printf ("#define CLASS_REGN0 0x8000\n"); - printf ("#define CLASS_PR 0x10000\n"); + printf ("#define CLASS_REG 0x7000\n"); + printf ("#define CLASS_REG_BYTE 0x2000\n"); + printf ("#define CLASS_REG_WORD 0x3000\n"); + printf ("#define CLASS_REG_QUAD 0x4000\n"); + printf ("#define CLASS_REG_LONG 0x5000\n"); + printf ("#define CLASS_REGN0 0x8000\n"); + printf ("#define CLASS_PR 0x10000\n"); printf ("#define CLASS_MASK 0x1fff0\n"); - printf ("#define OPC_adc 0\n"); - printf ("#define OPC_adcb 1\n"); - printf ("#define OPC_add 2\n"); - printf ("#define OPC_addb 3\n"); - printf ("#define OPC_addl 4\n"); - printf ("#define OPC_and 5\n"); - printf ("#define OPC_andb 6\n"); - printf ("#define OPC_bit 7\n"); - printf ("#define OPC_bitb 8\n"); - printf ("#define OPC_call 9\n"); - printf ("#define OPC_calr 10\n"); - printf ("#define OPC_clr 11\n"); - printf ("#define OPC_clrb 12\n"); - printf ("#define OPC_com 13\n"); - printf ("#define OPC_comb 14\n"); - printf ("#define OPC_comflg 15\n"); - printf ("#define OPC_cp 16\n"); - printf ("#define OPC_cpb 17\n"); - printf ("#define OPC_cpd 18\n"); - printf ("#define OPC_cpdb 19\n"); - printf ("#define OPC_cpdr 20\n"); - printf ("#define OPC_cpdrb 21\n"); - printf ("#define OPC_cpi 22\n"); - printf ("#define OPC_cpib 23\n"); - printf ("#define OPC_cpir 24\n"); - printf ("#define OPC_cpirb 25\n"); - printf ("#define OPC_cpl 26\n"); - printf ("#define OPC_cpsd 27\n"); - printf ("#define OPC_cpsdb 28\n"); - printf ("#define OPC_cpsdr 29\n"); - printf ("#define OPC_cpsdrb 30\n"); - printf ("#define OPC_cpsi 31\n"); - printf ("#define OPC_cpsib 32\n"); - printf ("#define OPC_cpsir 33\n"); - printf ("#define OPC_cpsirb 34\n"); - printf ("#define OPC_dab 35\n"); - printf ("#define OPC_dbjnz 36\n"); - printf ("#define OPC_dec 37\n"); - printf ("#define OPC_decb 38\n"); - printf ("#define OPC_di 39\n"); - printf ("#define OPC_div 40\n"); - printf ("#define OPC_divl 41\n"); - printf ("#define OPC_djnz 42\n"); - printf ("#define OPC_ei 43\n"); - printf ("#define OPC_ex 44\n"); - printf ("#define OPC_exb 45\n"); - printf ("#define OPC_exts 46\n"); - printf ("#define OPC_extsb 47\n"); - printf ("#define OPC_extsl 48\n"); - printf ("#define OPC_halt 49\n"); - printf ("#define OPC_in 50\n"); - printf ("#define OPC_inb 51\n"); - printf ("#define OPC_inc 52\n"); - printf ("#define OPC_incb 53\n"); - printf ("#define OPC_ind 54\n"); - printf ("#define OPC_indb 55\n"); + printf ("#define OPC_adc 0\n"); + printf ("#define OPC_adcb 1\n"); + printf ("#define OPC_add 2\n"); + printf ("#define OPC_addb 3\n"); + printf ("#define OPC_addl 4\n"); + printf ("#define OPC_and 5\n"); + printf ("#define OPC_andb 6\n"); + printf ("#define OPC_bit 7\n"); + printf ("#define OPC_bitb 8\n"); + printf ("#define OPC_call 9\n"); + printf ("#define OPC_calr 10\n"); + printf ("#define OPC_clr 11\n"); + printf ("#define OPC_clrb 12\n"); + printf ("#define OPC_com 13\n"); + printf ("#define OPC_comb 14\n"); + printf ("#define OPC_comflg 15\n"); + printf ("#define OPC_cp 16\n"); + printf ("#define OPC_cpb 17\n"); + printf ("#define OPC_cpd 18\n"); + printf ("#define OPC_cpdb 19\n"); + printf ("#define OPC_cpdr 20\n"); + printf ("#define OPC_cpdrb 21\n"); + printf ("#define OPC_cpi 22\n"); + printf ("#define OPC_cpib 23\n"); + printf ("#define OPC_cpir 24\n"); + printf ("#define OPC_cpirb 25\n"); + printf ("#define OPC_cpl 26\n"); + printf ("#define OPC_cpsd 27\n"); + printf ("#define OPC_cpsdb 28\n"); + printf ("#define OPC_cpsdr 29\n"); + printf ("#define OPC_cpsdrb 30\n"); + printf ("#define OPC_cpsi 31\n"); + printf ("#define OPC_cpsib 32\n"); + printf ("#define OPC_cpsir 33\n"); + printf ("#define OPC_cpsirb 34\n"); + printf ("#define OPC_dab 35\n"); + printf ("#define OPC_dbjnz 36\n"); + printf ("#define OPC_dec 37\n"); + printf ("#define OPC_decb 38\n"); + printf ("#define OPC_di 39\n"); + printf ("#define OPC_div 40\n"); + printf ("#define OPC_divl 41\n"); + printf ("#define OPC_djnz 42\n"); + printf ("#define OPC_ei 43\n"); + printf ("#define OPC_ex 44\n"); + printf ("#define OPC_exb 45\n"); + printf ("#define OPC_exts 46\n"); + printf ("#define OPC_extsb 47\n"); + printf ("#define OPC_extsl 48\n"); + printf ("#define OPC_halt 49\n"); + printf ("#define OPC_in 50\n"); + printf ("#define OPC_inb 51\n"); + printf ("#define OPC_inc 52\n"); + printf ("#define OPC_incb 53\n"); + printf ("#define OPC_ind 54\n"); + printf ("#define OPC_indb 55\n"); printf ("#define OPC_indr 56\n"); printf ("#define OPC_indrb 57\n"); printf ("#define OPC_ini 58\n"); @@ -1322,9 +1310,7 @@ gas () } int -main (ac, av) - int ac; - char **av; +main (int ac, char **av) { struct op *p = opt; |