133329Sdonn /* 2*38105Sbostic * Copyright (c) 1983 The Regents of the University of California. 3*38105Sbostic * All rights reserved. 4*38105Sbostic * 5*38105Sbostic * Redistribution and use in source and binary forms are permitted 6*38105Sbostic * provided that the above copyright notice and this paragraph are 7*38105Sbostic * duplicated in all such forms and that any documentation, 8*38105Sbostic * advertising materials, and other materials related to such 9*38105Sbostic * distribution and use acknowledge that the software was developed 10*38105Sbostic * by the University of California, Berkeley. The name of the 11*38105Sbostic * University may not be used to endorse or promote products derived 12*38105Sbostic * from this software without specific prior written permission. 13*38105Sbostic * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 14*38105Sbostic * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 15*38105Sbostic * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 1633329Sdonn */ 1733329Sdonn 1833329Sdonn #ifndef lint 19*38105Sbostic static char sccsid[] = "@(#)ops.iris.c 5.2 (Berkeley) 05/23/89"; 20*38105Sbostic #endif /* not lint */ 2133329Sdonn 2233329Sdonn /* 2333329Sdonn * Machine operators. 2433329Sdonn */ 2533329Sdonn 2633329Sdonn #include "defs.h" 2733329Sdonn #include "ops.h" 2833329Sdonn #include "machine.h" 2933329Sdonn 3033329Sdonn #ifndef public 3133329Sdonn 3233329Sdonn /* 3333329Sdonn * 68000 opcodes. 3433329Sdonn */ 3533329Sdonn 3633329Sdonn #define IMDF "#0x%x" /* immediate data format */ 3733329Sdonn 3833329Sdonn typedef struct { 3933329Sdonn unsigned short mask, match; 4033329Sdonn int (*opfun)(); 4133329Sdonn char *farg; 4233329Sdonn } Optab; 4333329Sdonn 4433329Sdonn #endif 4533329Sdonn 4633329Sdonn public String bname[16] = { 4733329Sdonn "ra", "sr", "hi", "ls", "cc", "cs", "ne", 4833329Sdonn "eq", "vc", "vs", "pl", "mi", "ge", "lt", "gt", "le" 4933329Sdonn }; 5033329Sdonn 5133329Sdonn public String cname[16] = { 5233329Sdonn "ra", "f", "hi", "ls", "cc", "cs", "ne", 5333329Sdonn "eq", "vc", "vs", "pl", "mi", "ge", "lt", "gt", "le" 5433329Sdonn }; 5533329Sdonn 5633329Sdonn public String dbname[16] = { 5733329Sdonn "t", "ra", "hi", "ls", "cc", "cs", "ne", 5833329Sdonn "eq", "vc", "vs", "pl", "mi", "ge", "lt", "gt", "le" 5933329Sdonn }; 6033329Sdonn 6133329Sdonn public String shro[4] = { "as", "ls", "rox", "ro" }; 6233329Sdonn 6333329Sdonn public String bit[4] = { "btst", "bchg", "bclr", "bset" }; 6433329Sdonn 6533329Sdonn /* 6633329Sdonn * order is important here 6733329Sdonn */ 6833329Sdonn 6933329Sdonn public Optab optab[] = { 7033329Sdonn 0xF000, 0x1000, omove, "b", /* move instructions */ 7133329Sdonn 0xF000, 0x2000, omove, "l", 7233329Sdonn 0xF000, 0x3000, omove, "w", 7333329Sdonn 0xF000, 0x6000, obranch, 0, /* branches */ 7433329Sdonn 0xFF00, 0x0000, oimmed, "or", /* op class 0 */ 7533329Sdonn 0xFF00, 0x0200, oimmed, "and", 7633329Sdonn 0xFF00, 0x0400, oimmed, "sub", 7733329Sdonn 0xFF00, 0x0600, oimmed, "add", 7833329Sdonn 0xFF00, 0x0A00, oimmed, "eor", 7933329Sdonn 0xFF00, 0x0C00, oimmed, "cmp", 8033329Sdonn 0xFF00, 0x0E00, omovs, "movs", 8133329Sdonn 0xF100, 0x0100, biti, 0, 8233329Sdonn 0xF800, 0x0800, biti, 0, 8333329Sdonn 0xFFC0, 0x40C0, oneop, "move_from_sr\t", /* op class 4 */ 8433329Sdonn 0xFF00, 0x4000, soneop, "negx", 8533329Sdonn 0xFFC0, 0x42C0, oneop, "movw cc,", 8633329Sdonn 0xFF00, 0x4200, soneop, "clr", 8733329Sdonn 0xFFC0, 0x44C0, oneop, "move_to_ccr ", 8833329Sdonn 0xFF00, 0x4400, soneop, "neg", 8933329Sdonn 0xFFC0, 0x46C0, oneop, "move_to_sr ", 9033329Sdonn 0xFF00, 0x4600, soneop, "not", 9133329Sdonn 0xFFC0, 0x4800, oneop, "nbcd ", 9233329Sdonn 0xFFF8, 0x4840, oreg, "\tswap\td%D", 9333329Sdonn 0xFFC0, 0x4840, oneop, "pea ", 9433329Sdonn 0xFFF8, 0x4880, oreg, "\textw\td%D", 9533329Sdonn 0xFFF8, 0x48C0, oreg, "\textl\td%D", 9633329Sdonn 0xFB80, 0x4880, omovem, 0, 9733329Sdonn 0xFFC0, 0x4AC0, oneop, "tas ", 9833329Sdonn 0xFF00, 0x4A00, soneop, "tst", 9933329Sdonn 0xFFF0, 0x4E40, otrap, 0, 10033329Sdonn 0xFFF8, 0x4E50, olink, 0, 10133329Sdonn 0xFFFE, 0x4E7A, omovc, "\tmovc\t", 10233329Sdonn 0xFFF8, 0x4880, oreg, "\textw\td%D", 10333329Sdonn 0xFFF8, 0x48C0, oreg, "\textl\td%D", 10433329Sdonn 0xFFF8, 0x4E58, oreg, "\tunlk\ta%D", 10533329Sdonn 0xFFF8, 0x4E60, oreg, "\tmove\ta%D,usp", 10633329Sdonn 0xFFF8, 0x4E68, oreg, "\tmove\tusp,a%D", 10733329Sdonn 0xFFFF, 0x4E70, oprint, "reset", 10833329Sdonn 0xFFFF, 0x4E71, oprint, "nop", 10933329Sdonn 0xFFFF, 0x4E72, ostop, "\tstop\t0x%x", 11033329Sdonn 0xFFFF, 0x4E73, oprint, "rte", 11133329Sdonn 0xFFFF, 0x4E74, ortspop, "\trts\t0x%x", 11233329Sdonn 0xFFFF, 0x4E75, orts, "rts", 11333329Sdonn 0xFFFF, 0x4E76, oprint, "trapv", 11433329Sdonn 0xFFFF, 0x4E77, oprint, "rtr", 11533329Sdonn 0xFFC0, 0x4E80, jsrop, "jsr ", 11633329Sdonn 0xFFC0, 0x4EC0, jmpop, "jmp ", 11733329Sdonn 0xF1C0, 0x4180, ochk, "chk", 11833329Sdonn 0xF1C0, 0x41C0, ochk, "lea", 11933329Sdonn 0xF0F8, 0x50C8, odbcc, "\tdb%s\td%D,", 12033329Sdonn 0xF0C0, 0x50C0, oscc, 0, 12133329Sdonn 0xF100, 0x5000, oquick, "addq", 12233329Sdonn 0xF100, 0x5100, oquick, "subq", 12333329Sdonn 0xF000, 0x7000, omoveq, 0, 12433329Sdonn 0xF1C0, 0x80C0, ochk, "divu", 12533329Sdonn 0xF1C0, 0x81C0, ochk, "divs", 12633329Sdonn 0xF1F0, 0x8100, extend, "sbcd", 12733329Sdonn 0xF000, 0x8000, opmode, "or", 12833329Sdonn 0xF1C0, 0x91C0, opmode, "sub", 12933329Sdonn 0xF130, 0x9100, extend, "subx", 13033329Sdonn 0xF000, 0x9000, opmode, "sub", 13133329Sdonn 0xF1C0, 0xB1C0, opmode, "cmp", 13233329Sdonn 0xF138, 0xB108, extend, "cmpm", 13333329Sdonn 0xF100, 0xB000, opmode, "cmp", 13433329Sdonn 0xF100, 0xB100, opmode, "eor", 13533329Sdonn 0xF1C0, 0xC0C0, ochk, "mulu", 13633329Sdonn 0xF1C0, 0xC1C0, ochk, "muls", 13733329Sdonn 0xF1F8, 0xC188, extend, "exg", 13833329Sdonn 0xF1F8, 0xC148, extend, "exg", 13933329Sdonn 0xF1F8, 0xC140, extend, "exg", 14033329Sdonn 0xF1F0, 0xC100, extend, "abcd", 14133329Sdonn 0xF000, 0xC000, opmode, "and", 14233329Sdonn 0xF1C0, 0xD1C0, opmode, "add", 14333329Sdonn 0xF130, 0xD100, extend, "addx", 14433329Sdonn 0xF000, 0xD000, opmode, "add", 14533329Sdonn 0xF100, 0xE000, shroi, "r", 14633329Sdonn 0xF100, 0xE100, shroi, "l", 14733329Sdonn 0, 0, 0, 0 14833329Sdonn }; 14933329Sdonn 150