1*38102Sbostic /* 2*38102Sbostic * Copyright (c) 1983 The Regents of the University of California. 3*38102Sbostic * All rights reserved. 4*38102Sbostic * 5*38102Sbostic * Redistribution and use in source and binary forms are permitted 6*38102Sbostic * provided that the above copyright notice and this paragraph are 7*38102Sbostic * duplicated in all such forms and that any documentation, 8*38102Sbostic * advertising materials, and other materials related to such 9*38102Sbostic * distribution and use acknowledge that the software was developed 10*38102Sbostic * by the University of California, Berkeley. The name of the 11*38102Sbostic * University may not be used to endorse or promote products derived 12*38102Sbostic * from this software without specific prior written permission. 13*38102Sbostic * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 14*38102Sbostic * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 15*38102Sbostic * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 16*38102Sbostic */ 17*38102Sbostic 18*38102Sbostic #ifndef lint 19*38102Sbostic static char sccsid[] = "@(#)ops.sun.c 5.1 (Berkeley) 05/23/89"; 20*38102Sbostic #endif /* not lint */ 21*38102Sbostic 22*38102Sbostic /* 23*38102Sbostic * Machine operators. 24*38102Sbostic */ 25*38102Sbostic 26*38102Sbostic #include "defs.h" 27*38102Sbostic #include "ops.h" 28*38102Sbostic #include "machine.h" 29*38102Sbostic 30*38102Sbostic #ifndef public 31*38102Sbostic 32*38102Sbostic /* 33*38102Sbostic * 68000 opcodes. 34*38102Sbostic */ 35*38102Sbostic 36*38102Sbostic #define IMDF "#0x%x" /* immediate data format */ 37*38102Sbostic 38*38102Sbostic typedef struct { 39*38102Sbostic unsigned short mask, match; 40*38102Sbostic int (*opfun)(); 41*38102Sbostic char *farg; 42*38102Sbostic } Optab; 43*38102Sbostic 44*38102Sbostic #endif 45*38102Sbostic 46*38102Sbostic public String bname[16] = { 47*38102Sbostic "ra", "sr", "hi", "ls", "cc", "cs", "ne", 48*38102Sbostic "eq", "vc", "vs", "pl", "mi", "ge", "lt", "gt", "le" 49*38102Sbostic }; 50*38102Sbostic 51*38102Sbostic public String cname[16] = { 52*38102Sbostic "ra", "f", "hi", "ls", "cc", "cs", "ne", 53*38102Sbostic "eq", "vc", "vs", "pl", "mi", "ge", "lt", "gt", "le" 54*38102Sbostic }; 55*38102Sbostic 56*38102Sbostic public String dbname[16] = { 57*38102Sbostic "t", "ra", "hi", "ls", "cc", "cs", "ne", 58*38102Sbostic "eq", "vc", "vs", "pl", "mi", "ge", "lt", "gt", "le" 59*38102Sbostic }; 60*38102Sbostic 61*38102Sbostic public String shro[4] = { "as", "ls", "rox", "ro" }; 62*38102Sbostic 63*38102Sbostic public String bit[4] = { "btst", "bchg", "bclr", "bset" }; 64*38102Sbostic 65*38102Sbostic /* 66*38102Sbostic * order is important here 67*38102Sbostic */ 68*38102Sbostic 69*38102Sbostic public Optab optab[] = { 70*38102Sbostic 0xF000, 0x1000, omove, "b", /* move instructions */ 71*38102Sbostic 0xF000, 0x2000, omove, "l", 72*38102Sbostic 0xF000, 0x3000, omove, "w", 73*38102Sbostic 0xF000, 0x6000, obranch, 0, /* branches */ 74*38102Sbostic 0xFF00, 0x0000, oimmed, "or", /* op class 0 */ 75*38102Sbostic 0xFF00, 0x0200, oimmed, "and", 76*38102Sbostic 0xFF00, 0x0400, oimmed, "sub", 77*38102Sbostic 0xFF00, 0x0600, oimmed, "add", 78*38102Sbostic 0xFF00, 0x0A00, oimmed, "eor", 79*38102Sbostic 0xFF00, 0x0C00, oimmed, "cmp", 80*38102Sbostic 0xFF00, 0x0E00, omovs, "movs", 81*38102Sbostic 0xF100, 0x0100, biti, 0, 82*38102Sbostic 0xF800, 0x0800, biti, 0, 83*38102Sbostic 0xFFC0, 0x40C0, oneop, "move_from_sr\t", /* op class 4 */ 84*38102Sbostic 0xFF00, 0x4000, soneop, "negx", 85*38102Sbostic 0xFFC0, 0x42C0, oneop, "movw cc,", 86*38102Sbostic 0xFF00, 0x4200, soneop, "clr", 87*38102Sbostic 0xFFC0, 0x44C0, oneop, "move_to_ccr ", 88*38102Sbostic 0xFF00, 0x4400, soneop, "neg", 89*38102Sbostic 0xFFC0, 0x46C0, oneop, "move_to_sr ", 90*38102Sbostic 0xFF00, 0x4600, soneop, "not", 91*38102Sbostic 0xFFC0, 0x4800, oneop, "nbcd ", 92*38102Sbostic 0xFFF8, 0x4840, oreg, "\tswap\td%D", 93*38102Sbostic 0xFFC0, 0x4840, oneop, "pea ", 94*38102Sbostic 0xFFF8, 0x4880, oreg, "\textw\td%D", 95*38102Sbostic 0xFFF8, 0x48C0, oreg, "\textl\td%D", 96*38102Sbostic 0xFB80, 0x4880, omovem, 0, 97*38102Sbostic 0xFFC0, 0x4AC0, oneop, "tas ", 98*38102Sbostic 0xFF00, 0x4A00, soneop, "tst", 99*38102Sbostic 0xFFF0, 0x4E40, otrap, 0, 100*38102Sbostic 0xFFF8, 0x4E50, olink, 0, 101*38102Sbostic 0xFFFE, 0x4E7A, omovc, "\tmovc\t", 102*38102Sbostic 0xFFF8, 0x4880, oreg, "\textw\td%D", 103*38102Sbostic 0xFFF8, 0x48C0, oreg, "\textl\td%D", 104*38102Sbostic 0xFFF8, 0x4E58, oreg, "\tunlk\ta%D", 105*38102Sbostic 0xFFF8, 0x4E60, oreg, "\tmove\ta%D,usp", 106*38102Sbostic 0xFFF8, 0x4E68, oreg, "\tmove\tusp,a%D", 107*38102Sbostic 0xFFFF, 0x4E70, oprint, "reset", 108*38102Sbostic 0xFFFF, 0x4E71, oprint, "nop", 109*38102Sbostic 0xFFFF, 0x4E72, ostop, "\tstop\t0x%x", 110*38102Sbostic 0xFFFF, 0x4E73, oprint, "rte", 111*38102Sbostic 0xFFFF, 0x4E74, ortspop, "\trts\t0x%x", 112*38102Sbostic 0xFFFF, 0x4E75, orts, "rts", 113*38102Sbostic 0xFFFF, 0x4E76, oprint, "trapv", 114*38102Sbostic 0xFFFF, 0x4E77, oprint, "rtr", 115*38102Sbostic 0xFFC0, 0x4E80, jsrop, "jsr ", 116*38102Sbostic 0xFFC0, 0x4EC0, jmpop, "jmp ", 117*38102Sbostic 0xF1C0, 0x4180, ochk, "chk", 118*38102Sbostic 0xF1C0, 0x41C0, ochk, "lea", 119*38102Sbostic 0xF0F8, 0x50C8, odbcc, "\tdb%s\td%D,", 120*38102Sbostic 0xF0C0, 0x50C0, oscc, 0, 121*38102Sbostic 0xF100, 0x5000, oquick, "addq", 122*38102Sbostic 0xF100, 0x5100, oquick, "subq", 123*38102Sbostic 0xF000, 0x7000, omoveq, 0, 124*38102Sbostic 0xF1C0, 0x80C0, ochk, "divu", 125*38102Sbostic 0xF1C0, 0x81C0, ochk, "divs", 126*38102Sbostic 0xF1F0, 0x8100, extend, "sbcd", 127*38102Sbostic 0xF000, 0x8000, opmode, "or", 128*38102Sbostic 0xF1C0, 0x91C0, opmode, "sub", 129*38102Sbostic 0xF130, 0x9100, extend, "subx", 130*38102Sbostic 0xF000, 0x9000, opmode, "sub", 131*38102Sbostic 0xF1C0, 0xB1C0, opmode, "cmp", 132*38102Sbostic 0xF138, 0xB108, extend, "cmpm", 133*38102Sbostic 0xF100, 0xB000, opmode, "cmp", 134*38102Sbostic 0xF100, 0xB100, opmode, "eor", 135*38102Sbostic 0xF1C0, 0xC0C0, ochk, "mulu", 136*38102Sbostic 0xF1C0, 0xC1C0, ochk, "muls", 137*38102Sbostic 0xF1F8, 0xC188, extend, "exg", 138*38102Sbostic 0xF1F8, 0xC148, extend, "exg", 139*38102Sbostic 0xF1F8, 0xC140, extend, "exg", 140*38102Sbostic 0xF1F0, 0xC100, extend, "abcd", 141*38102Sbostic 0xF000, 0xC000, opmode, "and", 142*38102Sbostic 0xF1C0, 0xD1C0, opmode, "add", 143*38102Sbostic 0xF130, 0xD100, extend, "addx", 144*38102Sbostic 0xF000, 0xD000, opmode, "add", 145*38102Sbostic 0xF100, 0xE000, shroi, "r", 146*38102Sbostic 0xF100, 0xE100, shroi, "l", 147*38102Sbostic 0, 0, 0, 0 148*38102Sbostic }; 149*38102Sbostic 150