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