1: //======================================================================================== 2: // MC68000.java 3: // en:MC68000 core 4: // ja:MC68000コア 5: // Copyright (C) 2003-2024 Makoto Kamada 6: // 7: // This file is part of the XEiJ (X68000 Emulator in Java). 8: // You can use, modify and redistribute the XEiJ if the conditions are met. 9: // Read the XEiJ License for more details. 10: // https://stdkmd.net/xeij/ 11: //======================================================================================== 12: 13: package xeij; 14: 15: import java.lang.*; //Boolean,Character,Class,Comparable,Double,Exception,Float,IllegalArgumentException,Integer,Long,Math,Number,Object,Runnable,SecurityException,String,StringBuilder,System 16: 17: public class MC68000 { 18: 19: public static void mpuCore () { 20: 21: //例外ループ 22: // 別のメソッドで検出された例外を命令ループの外側でcatchすることで命令ループを高速化する 23: errorLoop: 24: while (XEiJ.mpuClockTime < XEiJ.mpuClockLimit) { 25: try { 26: //命令ループ 27: while (XEiJ.mpuClockTime < XEiJ.mpuClockLimit) { 28: int t; 29: //命令を実行する 30: XEiJ.mpuTraceFlag = XEiJ.regSRT1; //命令実行前のsrT1 31: XEiJ.mpuCycleCount = 0; //第1オペコードからROMのアクセスウエイトを有効にする。命令のサイクル数はすべてXEiJ.mpuCycleCount+=~で加えること 32: XEiJ.regPC0 = t = XEiJ.regPC; //命令の先頭アドレス 33: XEiJ.regPC = t + 2; 34: XEiJ.regOC = (InstructionBreakPoint.IBP_ON ? InstructionBreakPoint.ibpOp1MemoryMap : DataBreakPoint.DBP_ON ? XEiJ.regSRS != 0 ? XEiJ.busSuperMap : XEiJ.busUserMap : XEiJ.busMemoryMap)[t >>> XEiJ.BUS_PAGE_BITS].mmdRwz (t); //第1オペコード。必ずゼロ拡張すること。pcに奇数が入っていることはないのでアドレスエラーのチェックを省略する 35: 36: //命令の処理 37: // 第1オペコードの上位10bitで分岐する 38: // 分岐方法 39: // XEiJ.IRP_STATIC 40: // 手順 41: // 命令の処理をstaticメソッドに書く 42: // switch(XEiJ.regOC>>>6)で分岐してirpXXX()で呼び出す 43: // Javaはメソッドのサイズに制限があるためswitch(XEiJ.regOC>>>6)の中にすべての命令の処理を書くことができない 44: // C言語のときはswitchの中にすべての命令の処理を書くことができる 45: // 利点 46: // 速い 47: // XEiJ.IRP_ENUM_DIRECT 48: // 手順 49: // 命令の処理をenum bodyのメソッドに書く 50: // switch(XEiJ.regOC>>>6)で分岐してIRP.XXX.exec()で呼び出す 51: // 欠点 52: // XEiJ.IRP_STATICよりも遅い 53: // staticなメソッドを直接呼び出せることに変わりないはずだが、インライン展開などの最適化が弱くなるのかも知れない 54: // XEiJ.IRP_STATICと共存させようとすると命令の処理を2回書かなければならず管理が面倒になる 55: // XEiJ.IRP_ENUM_INDIRECT 56: // 手順 57: // 命令の処理をenum bodyのメソッドに書く 58: // XEiJ.regOCの上位10bit→enum値の配列を用意する 59: // IRPMAP.IRPMAP0[XEiJ.regOC>>>6].exec()で呼び出す 60: // C言語のときは関数を指すポインタの配列が使えるのでIRPMAP0[XEiJ.regOC>>>6]()で済む 61: // 利点 62: // 命令の処理を動的に組み替えることができる 63: // 欠点 64: // XEiJ.IRP_ENUM_DIRECTよりも遅い 65: // 配列参照による多分岐とenum bodyのメソッドの動的呼び出しによる多分岐の2段階になる 66: // XEiJ.IRP_STATICと共存させようとすると命令の処理を2回書かなければならず管理が面倒になる 67: // enum値の配列の初期化コードが大きくなるのでクラスを分ける必要がある 68: irpSwitch: 69: switch (XEiJ.regOC >>> 6) { //第1オペコードの上位10ビット。XEiJ.regOCはゼロ拡張されているので0b1111_111_111&を省略 70: 71: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 72: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 73: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 74: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 75: //ORI.B #<data>,<ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0000_000_000_mmm_rrr-{data} 76: //OR.B #<data>,<ea> |A|012346|-|-UUUU|-**00| M+-WXZ |0000_000_000_mmm_rrr-{data} [ORI.B #<data>,<ea>] 77: //ORI.B #<data>,CCR |-|012346|-|*****|*****| |0000_000_000_111_100-{data} 78: case 0b0000_000_000: 79: irpOriByte (); 80: break irpSwitch; 81: 82: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 83: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 84: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 85: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 86: //ORI.W #<data>,<ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0000_000_001_mmm_rrr-{data} 87: //OR.W #<data>,<ea> |A|012346|-|-UUUU|-**00| M+-WXZ |0000_000_001_mmm_rrr-{data} [ORI.W #<data>,<ea>] 88: //ORI.W #<data>,SR |-|012346|P|*****|*****| |0000_000_001_111_100-{data} 89: case 0b0000_000_001: 90: irpOriWord (); 91: break irpSwitch; 92: 93: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 94: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 95: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 96: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 97: //ORI.L #<data>,<ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0000_000_010_mmm_rrr-{data} 98: //OR.L #<data>,<ea> |A|012346|-|-UUUU|-**00| M+-WXZ |0000_000_010_mmm_rrr-{data} [ORI.L #<data>,<ea>] 99: case 0b0000_000_010: 100: irpOriLong (); 101: break irpSwitch; 102: 103: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 104: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 105: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 106: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 107: //BITREV.L Dr |-|------|-|-----|-----|D |0000_000_011_000_rrr (ISA_C) 108: case 0b0000_000_011: 109: irpCmp2Chk2Byte (); 110: break irpSwitch; 111: 112: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 113: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 114: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 115: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 116: //BTST.L Dq,Dr |-|012346|-|--U--|--*--|D |0000_qqq_100_000_rrr 117: //MOVEP.W (d16,Ar),Dq |-|01234S|-|-----|-----| |0000_qqq_100_001_rrr-{data} 118: //BTST.B Dq,<ea> |-|012346|-|--U--|--*--| M+-WXZPI|0000_qqq_100_mmm_rrr 119: case 0b0000_000_100: 120: case 0b0000_001_100: 121: case 0b0000_010_100: 122: case 0b0000_011_100: 123: case 0b0000_100_100: 124: case 0b0000_101_100: 125: case 0b0000_110_100: 126: case 0b0000_111_100: 127: irpBtstReg (); 128: break irpSwitch; 129: 130: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 131: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 132: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 133: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 134: //BCHG.L Dq,Dr |-|012346|-|--U--|--*--|D |0000_qqq_101_000_rrr 135: //MOVEP.L (d16,Ar),Dq |-|01234S|-|-----|-----| |0000_qqq_101_001_rrr-{data} 136: //BCHG.B Dq,<ea> |-|012346|-|--U--|--*--| M+-WXZ |0000_qqq_101_mmm_rrr 137: case 0b0000_000_101: 138: case 0b0000_001_101: 139: case 0b0000_010_101: 140: case 0b0000_011_101: 141: case 0b0000_100_101: 142: case 0b0000_101_101: 143: case 0b0000_110_101: 144: case 0b0000_111_101: 145: irpBchgReg (); 146: break irpSwitch; 147: 148: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 149: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 150: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 151: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 152: //BCLR.L Dq,Dr |-|012346|-|--U--|--*--|D |0000_qqq_110_000_rrr 153: //MOVEP.W Dq,(d16,Ar) |-|01234S|-|-----|-----| |0000_qqq_110_001_rrr-{data} 154: //BCLR.B Dq,<ea> |-|012346|-|--U--|--*--| M+-WXZ |0000_qqq_110_mmm_rrr 155: case 0b0000_000_110: 156: case 0b0000_001_110: 157: case 0b0000_010_110: 158: case 0b0000_011_110: 159: case 0b0000_100_110: 160: case 0b0000_101_110: 161: case 0b0000_110_110: 162: case 0b0000_111_110: 163: irpBclrReg (); 164: break irpSwitch; 165: 166: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 167: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 168: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 169: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 170: //BSET.L Dq,Dr |-|012346|-|--U--|--*--|D |0000_qqq_111_000_rrr 171: //MOVEP.L Dq,(d16,Ar) |-|01234S|-|-----|-----| |0000_qqq_111_001_rrr-{data} 172: //BSET.B Dq,<ea> |-|012346|-|--U--|--*--| M+-WXZ |0000_qqq_111_mmm_rrr 173: case 0b0000_000_111: 174: case 0b0000_001_111: 175: case 0b0000_010_111: 176: case 0b0000_011_111: 177: case 0b0000_100_111: 178: case 0b0000_101_111: 179: case 0b0000_110_111: 180: case 0b0000_111_111: 181: irpBsetReg (); 182: break irpSwitch; 183: 184: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 185: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 186: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 187: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 188: //ANDI.B #<data>,<ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0000_001_000_mmm_rrr-{data} 189: //AND.B #<data>,<ea> |A|012346|-|-UUUU|-**00| M+-WXZ |0000_001_000_mmm_rrr-{data} [ANDI.B #<data>,<ea>] 190: //ANDI.B #<data>,CCR |-|012346|-|*****|*****| |0000_001_000_111_100-{data} 191: case 0b0000_001_000: 192: irpAndiByte (); 193: break irpSwitch; 194: 195: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 196: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 197: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 198: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 199: //ANDI.W #<data>,<ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0000_001_001_mmm_rrr-{data} 200: //AND.W #<data>,<ea> |A|012346|-|-UUUU|-**00| M+-WXZ |0000_001_001_mmm_rrr-{data} [ANDI.W #<data>,<ea>] 201: //ANDI.W #<data>,SR |-|012346|P|*****|*****| |0000_001_001_111_100-{data} 202: case 0b0000_001_001: 203: irpAndiWord (); 204: break irpSwitch; 205: 206: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 207: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 208: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 209: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 210: //ANDI.L #<data>,<ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0000_001_010_mmm_rrr-{data} 211: //AND.L #<data>,<ea> |A|012346|-|-UUUU|-**00| M+-WXZ |0000_001_010_mmm_rrr-{data} [ANDI.L #<data>,<ea>] 212: case 0b0000_001_010: 213: irpAndiLong (); 214: break irpSwitch; 215: 216: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 217: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 218: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 219: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 220: //BYTEREV.L Dr |-|------|-|-----|-----|D |0000_001_011_000_rrr (ISA_C) 221: case 0b0000_001_011: 222: irpCmp2Chk2Word (); 223: break irpSwitch; 224: 225: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 226: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 227: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 228: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 229: //SUBI.B #<data>,<ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0000_010_000_mmm_rrr-{data} 230: //SUB.B #<data>,<ea> |A|012346|-|UUUUU|*****| M+-WXZ |0000_010_000_mmm_rrr-{data} [SUBI.B #<data>,<ea>] 231: case 0b0000_010_000: 232: irpSubiByte (); 233: break irpSwitch; 234: 235: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 236: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 237: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 238: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 239: //SUBI.W #<data>,<ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0000_010_001_mmm_rrr-{data} 240: //SUB.W #<data>,<ea> |A|012346|-|UUUUU|*****| M+-WXZ |0000_010_001_mmm_rrr-{data} [SUBI.W #<data>,<ea>] 241: case 0b0000_010_001: 242: irpSubiWord (); 243: break irpSwitch; 244: 245: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 246: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 247: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 248: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 249: //SUBI.L #<data>,<ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0000_010_010_mmm_rrr-{data} 250: //SUB.L #<data>,<ea> |A|012346|-|UUUUU|*****| M+-WXZ |0000_010_010_mmm_rrr-{data} [SUBI.L #<data>,<ea>] 251: case 0b0000_010_010: 252: irpSubiLong (); 253: break irpSwitch; 254: 255: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 256: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 257: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 258: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 259: //FF1.L Dr |-|------|-|-UUUU|-**00|D |0000_010_011_000_rrr (ISA_C) 260: case 0b0000_010_011: 261: irpCmp2Chk2Long (); 262: break irpSwitch; 263: 264: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 265: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 266: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 267: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 268: //ADDI.B #<data>,<ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0000_011_000_mmm_rrr-{data} 269: case 0b0000_011_000: 270: irpAddiByte (); 271: break irpSwitch; 272: 273: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 274: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 275: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 276: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 277: //ADDI.W #<data>,<ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0000_011_001_mmm_rrr-{data} 278: case 0b0000_011_001: 279: irpAddiWord (); 280: break irpSwitch; 281: 282: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 283: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 284: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 285: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 286: //ADDI.L #<data>,<ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0000_011_010_mmm_rrr-{data} 287: case 0b0000_011_010: 288: irpAddiLong (); 289: break irpSwitch; 290: 291: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 292: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 293: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 294: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 295: //BTST.L #<data>,Dr |-|012346|-|--U--|--*--|D |0000_100_000_000_rrr-{data} 296: //BTST.B #<data>,<ea> |-|012346|-|--U--|--*--| M+-WXZP |0000_100_000_mmm_rrr-{data} 297: case 0b0000_100_000: 298: irpBtstImm (); 299: break irpSwitch; 300: 301: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 302: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 303: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 304: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 305: //BCHG.L #<data>,Dr |-|012346|-|--U--|--*--|D |0000_100_001_000_rrr-{data} 306: //BCHG.B #<data>,<ea> |-|012346|-|--U--|--*--| M+-WXZ |0000_100_001_mmm_rrr-{data} 307: case 0b0000_100_001: 308: irpBchgImm (); 309: break irpSwitch; 310: 311: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 312: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 313: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 314: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 315: //BCLR.L #<data>,Dr |-|012346|-|--U--|--*--|D |0000_100_010_000_rrr-{data} 316: //BCLR.B #<data>,<ea> |-|012346|-|--U--|--*--| M+-WXZ |0000_100_010_mmm_rrr-{data} 317: case 0b0000_100_010: 318: irpBclrImm (); 319: break irpSwitch; 320: 321: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 322: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 323: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 324: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 325: //BSET.L #<data>,Dr |-|012346|-|--U--|--*--|D |0000_100_011_000_rrr-{data} 326: //BSET.B #<data>,<ea> |-|012346|-|--U--|--*--| M+-WXZ |0000_100_011_mmm_rrr-{data} 327: case 0b0000_100_011: 328: irpBsetImm (); 329: break irpSwitch; 330: 331: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 332: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 333: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 334: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 335: //EORI.B #<data>,<ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0000_101_000_mmm_rrr-{data} 336: //EOR.B #<data>,<ea> |A|012346|-|-UUUU|-**00|D M+-WXZ |0000_101_000_mmm_rrr-{data} [EORI.B #<data>,<ea>] 337: //EORI.B #<data>,CCR |-|012346|-|*****|*****| |0000_101_000_111_100-{data} 338: case 0b0000_101_000: 339: irpEoriByte (); 340: break irpSwitch; 341: 342: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 343: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 344: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 345: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 346: //EORI.W #<data>,<ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0000_101_001_mmm_rrr-{data} 347: //EOR.W #<data>,<ea> |A|012346|-|-UUUU|-**00|D M+-WXZ |0000_101_001_mmm_rrr-{data} [EORI.W #<data>,<ea>] 348: //EORI.W #<data>,SR |-|012346|P|*****|*****| |0000_101_001_111_100-{data} 349: case 0b0000_101_001: 350: irpEoriWord (); 351: break irpSwitch; 352: 353: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 354: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 355: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 356: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 357: //EORI.L #<data>,<ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0000_101_010_mmm_rrr-{data} 358: //EOR.L #<data>,<ea> |A|012346|-|-UUUU|-**00|D M+-WXZ |0000_101_010_mmm_rrr-{data} [EORI.L #<data>,<ea>] 359: case 0b0000_101_010: 360: irpEoriLong (); 361: break irpSwitch; 362: 363: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 364: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 365: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 366: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 367: //CMPI.B #<data>,<ea> |-|01----|-|-UUUU|-****|D M+-WXZ |0000_110_000_mmm_rrr-{data} 368: //CMP.B #<data>,<ea> |A|01----|-|-UUUU|-****| M+-WXZ |0000_110_000_mmm_rrr-{data} [CMPI.B #<data>,<ea>] 369: case 0b0000_110_000: 370: irpCmpiByte (); 371: break irpSwitch; 372: 373: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 374: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 375: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 376: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 377: //CMPI.W #<data>,<ea> |-|01----|-|-UUUU|-****|D M+-WXZ |0000_110_001_mmm_rrr-{data} 378: //CMP.W #<data>,<ea> |A|01----|-|-UUUU|-****| M+-WXZ |0000_110_001_mmm_rrr-{data} [CMPI.W #<data>,<ea>] 379: case 0b0000_110_001: 380: irpCmpiWord (); 381: break irpSwitch; 382: 383: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 384: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 385: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 386: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 387: //CMPI.L #<data>,<ea> |-|01----|-|-UUUU|-****|D M+-WXZ |0000_110_010_mmm_rrr-{data} 388: //CMP.L #<data>,<ea> |A|01----|-|-UUUU|-****| M+-WXZ |0000_110_010_mmm_rrr-{data} [CMPI.L #<data>,<ea>] 389: case 0b0000_110_010: 390: irpCmpiLong (); 391: break irpSwitch; 392: 393: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 394: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 395: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 396: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 397: //MOVE.B <ea>,Dq |-|012346|-|-UUUU|-**00|D M+-WXZPI|0001_qqq_000_mmm_rrr 398: case 0b0001_000_000: 399: case 0b0001_001_000: 400: case 0b0001_010_000: 401: case 0b0001_011_000: 402: case 0b0001_100_000: 403: case 0b0001_101_000: 404: case 0b0001_110_000: 405: case 0b0001_111_000: 406: irpMoveToDRByte (); 407: break irpSwitch; 408: 409: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 410: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 411: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 412: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 413: //MOVE.B <ea>,(Aq) |-|012346|-|-UUUU|-**00|D M+-WXZPI|0001_qqq_010_mmm_rrr 414: case 0b0001_000_010: 415: case 0b0001_001_010: 416: case 0b0001_010_010: 417: case 0b0001_011_010: 418: case 0b0001_100_010: 419: case 0b0001_101_010: 420: case 0b0001_110_010: 421: case 0b0001_111_010: 422: irpMoveToMMByte (); 423: break irpSwitch; 424: 425: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 426: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 427: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 428: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 429: //MOVE.B <ea>,(Aq)+ |-|012346|-|-UUUU|-**00|D M+-WXZPI|0001_qqq_011_mmm_rrr 430: case 0b0001_000_011: 431: case 0b0001_001_011: 432: case 0b0001_010_011: 433: case 0b0001_011_011: 434: case 0b0001_100_011: 435: case 0b0001_101_011: 436: case 0b0001_110_011: 437: case 0b0001_111_011: 438: irpMoveToMPByte (); 439: break irpSwitch; 440: 441: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 442: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 443: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 444: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 445: //MOVE.B <ea>,-(Aq) |-|012346|-|-UUUU|-**00|D M+-WXZPI|0001_qqq_100_mmm_rrr 446: case 0b0001_000_100: 447: case 0b0001_001_100: 448: case 0b0001_010_100: 449: case 0b0001_011_100: 450: case 0b0001_100_100: 451: case 0b0001_101_100: 452: case 0b0001_110_100: 453: case 0b0001_111_100: 454: irpMoveToMNByte (); 455: break irpSwitch; 456: 457: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 458: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 459: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 460: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 461: //MOVE.B <ea>,(d16,Aq) |-|012346|-|-UUUU|-**00|D M+-WXZPI|0001_qqq_101_mmm_rrr 462: case 0b0001_000_101: 463: case 0b0001_001_101: 464: case 0b0001_010_101: 465: case 0b0001_011_101: 466: case 0b0001_100_101: 467: case 0b0001_101_101: 468: case 0b0001_110_101: 469: case 0b0001_111_101: 470: irpMoveToMWByte (); 471: break irpSwitch; 472: 473: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 474: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 475: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 476: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 477: //MOVE.B <ea>,(d8,Aq,Rn.wl) |-|012346|-|-UUUU|-**00|D M+-WXZPI|0001_qqq_110_mmm_rrr 478: case 0b0001_000_110: 479: case 0b0001_001_110: 480: case 0b0001_010_110: 481: case 0b0001_011_110: 482: case 0b0001_100_110: 483: case 0b0001_101_110: 484: case 0b0001_110_110: 485: case 0b0001_111_110: 486: irpMoveToMXByte (); 487: break irpSwitch; 488: 489: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 490: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 491: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 492: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 493: //MOVE.B <ea>,(xxx).W |-|012346|-|-UUUU|-**00|D M+-WXZPI|0001_000_111_mmm_rrr 494: case 0b0001_000_111: 495: irpMoveToZWByte (); 496: break irpSwitch; 497: 498: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 499: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 500: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 501: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 502: //MOVE.B <ea>,(xxx).L |-|012346|-|-UUUU|-**00|D M+-WXZPI|0001_001_111_mmm_rrr 503: case 0b0001_001_111: 504: irpMoveToZLByte (); 505: break irpSwitch; 506: 507: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 508: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 509: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 510: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 511: //MOVE.L <ea>,Dq |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0010_qqq_000_mmm_rrr 512: case 0b0010_000_000: 513: case 0b0010_001_000: 514: case 0b0010_010_000: 515: case 0b0010_011_000: 516: case 0b0010_100_000: 517: case 0b0010_101_000: 518: case 0b0010_110_000: 519: case 0b0010_111_000: 520: irpMoveToDRLong (); 521: break irpSwitch; 522: 523: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 524: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 525: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 526: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 527: //MOVEA.L <ea>,Aq |-|012346|-|-----|-----|DAM+-WXZPI|0010_qqq_001_mmm_rrr 528: //MOVE.L <ea>,Aq |A|012346|-|-----|-----|DAM+-WXZPI|0010_qqq_001_mmm_rrr [MOVEA.L <ea>,Aq] 529: case 0b0010_000_001: 530: case 0b0010_001_001: 531: case 0b0010_010_001: 532: case 0b0010_011_001: 533: case 0b0010_100_001: 534: case 0b0010_101_001: 535: case 0b0010_110_001: 536: case 0b0010_111_001: 537: irpMoveaLong (); 538: break irpSwitch; 539: 540: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 541: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 542: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 543: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 544: //MOVE.L <ea>,(Aq) |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0010_qqq_010_mmm_rrr 545: case 0b0010_000_010: 546: case 0b0010_001_010: 547: case 0b0010_010_010: 548: case 0b0010_011_010: 549: case 0b0010_100_010: 550: case 0b0010_101_010: 551: case 0b0010_110_010: 552: case 0b0010_111_010: 553: irpMoveToMMLong (); 554: break irpSwitch; 555: 556: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 557: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 558: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 559: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 560: //MOVE.L <ea>,(Aq)+ |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0010_qqq_011_mmm_rrr 561: case 0b0010_000_011: 562: case 0b0010_001_011: 563: case 0b0010_010_011: 564: case 0b0010_011_011: 565: case 0b0010_100_011: 566: case 0b0010_101_011: 567: case 0b0010_110_011: 568: case 0b0010_111_011: 569: irpMoveToMPLong (); 570: break irpSwitch; 571: 572: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 573: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 574: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 575: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 576: //MOVE.L <ea>,-(Aq) |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0010_qqq_100_mmm_rrr 577: case 0b0010_000_100: 578: case 0b0010_001_100: 579: case 0b0010_010_100: 580: case 0b0010_011_100: 581: case 0b0010_100_100: 582: case 0b0010_101_100: 583: case 0b0010_110_100: 584: case 0b0010_111_100: 585: irpMoveToMNLong (); 586: break irpSwitch; 587: 588: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 589: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 590: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 591: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 592: //MOVE.L <ea>,(d16,Aq) |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0010_qqq_101_mmm_rrr 593: case 0b0010_000_101: 594: case 0b0010_001_101: 595: case 0b0010_010_101: 596: case 0b0010_011_101: 597: case 0b0010_100_101: 598: case 0b0010_101_101: 599: case 0b0010_110_101: 600: case 0b0010_111_101: 601: irpMoveToMWLong (); 602: break irpSwitch; 603: 604: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 605: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 606: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 607: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 608: //MOVE.L <ea>,(d8,Aq,Rn.wl) |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0010_qqq_110_mmm_rrr 609: case 0b0010_000_110: 610: case 0b0010_001_110: 611: case 0b0010_010_110: 612: case 0b0010_011_110: 613: case 0b0010_100_110: 614: case 0b0010_101_110: 615: case 0b0010_110_110: 616: case 0b0010_111_110: 617: irpMoveToMXLong (); 618: break irpSwitch; 619: 620: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 621: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 622: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 623: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 624: //MOVE.L <ea>,(xxx).W |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0010_000_111_mmm_rrr 625: case 0b0010_000_111: 626: irpMoveToZWLong (); 627: break irpSwitch; 628: 629: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 630: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 631: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 632: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 633: //MOVE.L <ea>,(xxx).L |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0010_001_111_mmm_rrr 634: case 0b0010_001_111: 635: irpMoveToZLLong (); 636: break irpSwitch; 637: 638: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 639: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 640: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 641: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 642: //MOVE.W <ea>,Dq |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0011_qqq_000_mmm_rrr 643: case 0b0011_000_000: 644: case 0b0011_001_000: 645: case 0b0011_010_000: 646: case 0b0011_011_000: 647: case 0b0011_100_000: 648: case 0b0011_101_000: 649: case 0b0011_110_000: 650: case 0b0011_111_000: 651: irpMoveToDRWord (); 652: break irpSwitch; 653: 654: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 655: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 656: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 657: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 658: //MOVEA.W <ea>,Aq |-|012346|-|-----|-----|DAM+-WXZPI|0011_qqq_001_mmm_rrr 659: //MOVE.W <ea>,Aq |A|012346|-|-----|-----|DAM+-WXZPI|0011_qqq_001_mmm_rrr [MOVEA.W <ea>,Aq] 660: case 0b0011_000_001: 661: case 0b0011_001_001: 662: case 0b0011_010_001: 663: case 0b0011_011_001: 664: case 0b0011_100_001: 665: case 0b0011_101_001: 666: case 0b0011_110_001: 667: case 0b0011_111_001: 668: irpMoveaWord (); 669: break irpSwitch; 670: 671: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 672: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 673: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 674: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 675: //MOVE.W <ea>,(Aq) |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0011_qqq_010_mmm_rrr 676: case 0b0011_000_010: 677: case 0b0011_001_010: 678: case 0b0011_010_010: 679: case 0b0011_011_010: 680: case 0b0011_100_010: 681: case 0b0011_101_010: 682: case 0b0011_110_010: 683: case 0b0011_111_010: 684: irpMoveToMMWord (); 685: break irpSwitch; 686: 687: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 688: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 689: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 690: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 691: //MOVE.W <ea>,(Aq)+ |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0011_qqq_011_mmm_rrr 692: case 0b0011_000_011: 693: case 0b0011_001_011: 694: case 0b0011_010_011: 695: case 0b0011_011_011: 696: case 0b0011_100_011: 697: case 0b0011_101_011: 698: case 0b0011_110_011: 699: case 0b0011_111_011: 700: irpMoveToMPWord (); 701: break irpSwitch; 702: 703: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 704: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 705: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 706: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 707: //MOVE.W <ea>,-(Aq) |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0011_qqq_100_mmm_rrr 708: case 0b0011_000_100: 709: case 0b0011_001_100: 710: case 0b0011_010_100: 711: case 0b0011_011_100: 712: case 0b0011_100_100: 713: case 0b0011_101_100: 714: case 0b0011_110_100: 715: case 0b0011_111_100: 716: irpMoveToMNWord (); 717: break irpSwitch; 718: 719: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 720: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 721: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 722: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 723: //MOVE.W <ea>,(d16,Aq) |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0011_qqq_101_mmm_rrr 724: case 0b0011_000_101: 725: case 0b0011_001_101: 726: case 0b0011_010_101: 727: case 0b0011_011_101: 728: case 0b0011_100_101: 729: case 0b0011_101_101: 730: case 0b0011_110_101: 731: case 0b0011_111_101: 732: irpMoveToMWWord (); 733: break irpSwitch; 734: 735: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 736: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 737: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 738: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 739: //MOVE.W <ea>,(d8,Aq,Rn.wl) |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0011_qqq_110_mmm_rrr 740: case 0b0011_000_110: 741: case 0b0011_001_110: 742: case 0b0011_010_110: 743: case 0b0011_011_110: 744: case 0b0011_100_110: 745: case 0b0011_101_110: 746: case 0b0011_110_110: 747: case 0b0011_111_110: 748: irpMoveToMXWord (); 749: break irpSwitch; 750: 751: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 752: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 753: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 754: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 755: //MOVE.W <ea>,(xxx).W |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0011_000_111_mmm_rrr 756: case 0b0011_000_111: 757: irpMoveToZWWord (); 758: break irpSwitch; 759: 760: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 761: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 762: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 763: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 764: //MOVE.W <ea>,(xxx).L |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0011_001_111_mmm_rrr 765: case 0b0011_001_111: 766: irpMoveToZLWord (); 767: break irpSwitch; 768: 769: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 770: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 771: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 772: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 773: //NEGX.B <ea> |-|012346|-|*UUUU|*****|D M+-WXZ |0100_000_000_mmm_rrr 774: case 0b0100_000_000: 775: irpNegxByte (); 776: break irpSwitch; 777: 778: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 779: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 780: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 781: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 782: //NEGX.W <ea> |-|012346|-|*UUUU|*****|D M+-WXZ |0100_000_001_mmm_rrr 783: case 0b0100_000_001: 784: irpNegxWord (); 785: break irpSwitch; 786: 787: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 788: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 789: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 790: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 791: //NEGX.L <ea> |-|012346|-|*UUUU|*****|D M+-WXZ |0100_000_010_mmm_rrr 792: case 0b0100_000_010: 793: irpNegxLong (); 794: break irpSwitch; 795: 796: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 797: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 798: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 799: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 800: //MOVE.W SR,<ea> |-|0-----|-|*****|-----|D M+-WXZ |0100_000_011_mmm_rrr (68000 and 68008 read before move) 801: case 0b0100_000_011: 802: irpMoveFromSR (); 803: break irpSwitch; 804: 805: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 806: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 807: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 808: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 809: //CHK.W <ea>,Dq |-|012346|-|-UUUU|-*UUU|D M+-WXZPI|0100_qqq_110_mmm_rrr 810: case 0b0100_000_110: 811: case 0b0100_001_110: 812: case 0b0100_010_110: 813: case 0b0100_011_110: 814: case 0b0100_100_110: 815: case 0b0100_101_110: 816: case 0b0100_110_110: 817: case 0b0100_111_110: 818: irpChkWord (); 819: break irpSwitch; 820: 821: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 822: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 823: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 824: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 825: //LEA.L <ea>,Aq |-|012346|-|-----|-----| M WXZP |0100_qqq_111_mmm_rrr 826: case 0b0100_000_111: 827: case 0b0100_001_111: 828: case 0b0100_010_111: 829: case 0b0100_011_111: 830: case 0b0100_100_111: 831: case 0b0100_101_111: 832: case 0b0100_110_111: 833: case 0b0100_111_111: 834: irpLea (); 835: break irpSwitch; 836: 837: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 838: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 839: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 840: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 841: //CLR.B <ea> |-|012346|-|-UUUU|-0100|D M+-WXZ |0100_001_000_mmm_rrr (68000 and 68008 read before clear) 842: case 0b0100_001_000: 843: irpClrByte (); 844: break irpSwitch; 845: 846: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 847: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 848: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 849: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 850: //CLR.W <ea> |-|012346|-|-UUUU|-0100|D M+-WXZ |0100_001_001_mmm_rrr (68000 and 68008 read before clear) 851: case 0b0100_001_001: 852: irpClrWord (); 853: break irpSwitch; 854: 855: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 856: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 857: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 858: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 859: //CLR.L <ea> |-|012346|-|-UUUU|-0100|D M+-WXZ |0100_001_010_mmm_rrr (68000 and 68008 read before clear) 860: case 0b0100_001_010: 861: irpClrLong (); 862: break irpSwitch; 863: 864: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 865: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 866: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 867: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 868: //NEG.B <ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0100_010_000_mmm_rrr 869: case 0b0100_010_000: 870: irpNegByte (); 871: break irpSwitch; 872: 873: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 874: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 875: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 876: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 877: //NEG.W <ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0100_010_001_mmm_rrr 878: case 0b0100_010_001: 879: irpNegWord (); 880: break irpSwitch; 881: 882: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 883: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 884: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 885: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 886: //NEG.L <ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0100_010_010_mmm_rrr 887: case 0b0100_010_010: 888: irpNegLong (); 889: break irpSwitch; 890: 891: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 892: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 893: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 894: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 895: //MOVE.W <ea>,CCR |-|012346|-|UUUUU|*****|D M+-WXZPI|0100_010_011_mmm_rrr 896: case 0b0100_010_011: 897: irpMoveToCCR (); 898: break irpSwitch; 899: 900: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 901: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 902: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 903: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 904: //NOT.B <ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0100_011_000_mmm_rrr 905: case 0b0100_011_000: 906: irpNotByte (); 907: break irpSwitch; 908: 909: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 910: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 911: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 912: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 913: //NOT.W <ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0100_011_001_mmm_rrr 914: case 0b0100_011_001: 915: irpNotWord (); 916: break irpSwitch; 917: 918: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 919: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 920: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 921: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 922: //NOT.L <ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0100_011_010_mmm_rrr 923: case 0b0100_011_010: 924: irpNotLong (); 925: break irpSwitch; 926: 927: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 928: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 929: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 930: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 931: //MOVE.W <ea>,SR |-|012346|P|UUUUU|*****|D M+-WXZPI|0100_011_011_mmm_rrr 932: case 0b0100_011_011: 933: irpMoveToSR (); 934: break irpSwitch; 935: 936: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 937: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 938: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 939: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 940: //NBCD.B <ea> |-|012346|-|UUUUU|*U*U*|D M+-WXZ |0100_100_000_mmm_rrr 941: case 0b0100_100_000: 942: irpNbcd (); 943: break irpSwitch; 944: 945: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 946: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 947: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 948: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 949: //SWAP.W Dr |-|012346|-|-UUUU|-**00|D |0100_100_001_000_rrr 950: //PEA.L <ea> |-|012346|-|-----|-----| M WXZP |0100_100_001_mmm_rrr 951: case 0b0100_100_001: 952: irpPea (); 953: break irpSwitch; 954: 955: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 956: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 957: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 958: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 959: //EXT.W Dr |-|012346|-|-UUUU|-**00|D |0100_100_010_000_rrr 960: //MOVEM.W <list>,<ea> |-|012346|-|-----|-----| M -WXZ |0100_100_010_mmm_rrr-llllllllllllllll 961: case 0b0100_100_010: 962: irpMovemToMemWord (); 963: break irpSwitch; 964: 965: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 966: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 967: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 968: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 969: //EXT.L Dr |-|012346|-|-UUUU|-**00|D |0100_100_011_000_rrr 970: //MOVEM.L <list>,<ea> |-|012346|-|-----|-----| M -WXZ |0100_100_011_mmm_rrr-llllllllllllllll 971: case 0b0100_100_011: 972: irpMovemToMemLong (); 973: break irpSwitch; 974: 975: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 976: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 977: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 978: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 979: //TST.B <ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0100_101_000_mmm_rrr 980: case 0b0100_101_000: 981: irpTstByte (); 982: break irpSwitch; 983: 984: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 985: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 986: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 987: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 988: //TST.W <ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0100_101_001_mmm_rrr 989: case 0b0100_101_001: 990: irpTstWord (); 991: break irpSwitch; 992: 993: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 994: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 995: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 996: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 997: //TST.L <ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0100_101_010_mmm_rrr 998: case 0b0100_101_010: 999: irpTstLong (); 1000: break irpSwitch; 1001: 1002: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1003: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1004: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1005: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1006: //TAS.B <ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0100_101_011_mmm_rrr 1007: //ILLEGAL |-|012346|-|-----|-----| |0100_101_011_111_100 1008: case 0b0100_101_011: 1009: irpTas (); 1010: break irpSwitch; 1011: 1012: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1013: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1014: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1015: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1016: //SATS.L Dr |-|------|-|-UUUU|-**00|D |0100_110_010_000_rrr (ISA_B) 1017: //MOVEM.W <ea>,<list> |-|012346|-|-----|-----| M+ WXZP |0100_110_010_mmm_rrr-llllllllllllllll 1018: case 0b0100_110_010: 1019: irpMovemToRegWord (); 1020: break irpSwitch; 1021: 1022: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1023: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1024: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1025: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1026: //MOVEM.L <ea>,<list> |-|012346|-|-----|-----| M+ WXZP |0100_110_011_mmm_rrr-llllllllllllllll 1027: case 0b0100_110_011: 1028: irpMovemToRegLong (); 1029: break irpSwitch; 1030: 1031: case 0b0100_111_001: 1032: switch (XEiJ.regOC & 0b111_111) { 1033: 1034: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1035: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1036: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1037: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1038: //TRAP #<vector> |-|012346|-|-----|-----| |0100_111_001_00v_vvv 1039: case 0b000_000: 1040: case 0b000_001: 1041: case 0b000_010: 1042: case 0b000_011: 1043: case 0b000_100: 1044: case 0b000_101: 1045: case 0b000_110: 1046: case 0b000_111: 1047: case 0b001_000: 1048: case 0b001_001: 1049: case 0b001_010: 1050: case 0b001_011: 1051: case 0b001_100: 1052: case 0b001_101: 1053: case 0b001_110: 1054: irpTrap (); 1055: break irpSwitch; 1056: case 0b001_111: 1057: irpTrap15 (); 1058: break irpSwitch; 1059: 1060: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1061: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1062: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1063: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1064: //LINK.W Ar,#<data> |-|012346|-|-----|-----| |0100_111_001_010_rrr-{data} 1065: case 0b010_000: 1066: case 0b010_001: 1067: case 0b010_010: 1068: case 0b010_011: 1069: case 0b010_100: 1070: case 0b010_101: 1071: case 0b010_110: 1072: case 0b010_111: 1073: irpLinkWord (); 1074: break irpSwitch; 1075: 1076: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1077: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1078: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1079: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1080: //UNLK Ar |-|012346|-|-----|-----| |0100_111_001_011_rrr 1081: case 0b011_000: 1082: case 0b011_001: 1083: case 0b011_010: 1084: case 0b011_011: 1085: case 0b011_100: 1086: case 0b011_101: 1087: case 0b011_110: 1088: case 0b011_111: 1089: irpUnlk (); 1090: break irpSwitch; 1091: 1092: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1093: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1094: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1095: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1096: //MOVE.L Ar,USP |-|012346|P|-----|-----| |0100_111_001_100_rrr 1097: case 0b100_000: 1098: case 0b100_001: 1099: case 0b100_010: 1100: case 0b100_011: 1101: case 0b100_100: 1102: case 0b100_101: 1103: case 0b100_110: 1104: case 0b100_111: 1105: irpMoveToUsp (); 1106: break irpSwitch; 1107: 1108: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1109: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1110: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1111: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1112: //MOVE.L USP,Ar |-|012346|P|-----|-----| |0100_111_001_101_rrr 1113: case 0b101_000: 1114: case 0b101_001: 1115: case 0b101_010: 1116: case 0b101_011: 1117: case 0b101_100: 1118: case 0b101_101: 1119: case 0b101_110: 1120: case 0b101_111: 1121: irpMoveFromUsp (); 1122: break irpSwitch; 1123: 1124: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1125: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1126: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1127: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1128: //RESET |-|012346|P|-----|-----| |0100_111_001_110_000 1129: case 0b110_000: 1130: irpReset (); 1131: break irpSwitch; 1132: 1133: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1134: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1135: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1136: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1137: //NOP |-|012346|-|-----|-----| |0100_111_001_110_001 1138: case 0b110_001: 1139: irpNop (); 1140: break irpSwitch; 1141: 1142: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1143: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1144: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1145: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1146: //STOP #<data> |-|012346|P|UUUUU|*****| |0100_111_001_110_010-{data} 1147: case 0b110_010: 1148: irpStop (); 1149: break irpSwitch; 1150: 1151: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1152: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1153: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1154: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1155: //RTE |-|012346|P|UUUUU|*****| |0100_111_001_110_011 1156: case 0b110_011: 1157: irpRte (); 1158: break irpSwitch; 1159: 1160: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1161: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1162: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1163: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1164: //RTS |-|012346|-|-----|-----| |0100_111_001_110_101 1165: case 0b110_101: 1166: irpRts (); 1167: break irpSwitch; 1168: 1169: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1170: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1171: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1172: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1173: //TRAPV |-|012346|-|---*-|-----| |0100_111_001_110_110 1174: case 0b110_110: 1175: irpTrapv (); 1176: break irpSwitch; 1177: 1178: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1179: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1180: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1181: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1182: //RTR |-|012346|-|UUUUU|*****| |0100_111_001_110_111 1183: case 0b110_111: 1184: irpRtr (); 1185: break irpSwitch; 1186: 1187: default: 1188: irpIllegal (); 1189: 1190: } //switch XEiJ.regOC & 0b111_111 1191: break irpSwitch; 1192: 1193: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1194: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1195: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1196: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1197: //JSR <ea> |-|012346|-|-----|-----| M WXZP |0100_111_010_mmm_rrr 1198: //JBSR.L <label> |A|012346|-|-----|-----| |0100_111_010_111_001-{address} [JSR <label>] 1199: case 0b0100_111_010: 1200: irpJsr (); 1201: break irpSwitch; 1202: 1203: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1204: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1205: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1206: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1207: //JMP <ea> |-|012346|-|-----|-----| M WXZP |0100_111_011_mmm_rrr 1208: //JBRA.L <label> |A|012346|-|-----|-----| |0100_111_011_111_001-{address} [JMP <label>] 1209: case 0b0100_111_011: 1210: irpJmp (); 1211: break irpSwitch; 1212: 1213: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1214: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1215: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1216: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1217: //ADDQ.B #<data>,<ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0101_qqq_000_mmm_rrr 1218: //INC.B <ea> |A|012346|-|UUUUU|*****|D M+-WXZ |0101_001_000_mmm_rrr [ADDQ.B #1,<ea>] 1219: case 0b0101_000_000: 1220: case 0b0101_001_000: 1221: case 0b0101_010_000: 1222: case 0b0101_011_000: 1223: case 0b0101_100_000: 1224: case 0b0101_101_000: 1225: case 0b0101_110_000: 1226: case 0b0101_111_000: 1227: irpAddqByte (); 1228: break irpSwitch; 1229: 1230: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1231: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1232: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1233: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1234: //ADDQ.W #<data>,<ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0101_qqq_001_mmm_rrr 1235: //ADDQ.W #<data>,Ar |-|012346|-|-----|-----| A |0101_qqq_001_001_rrr 1236: //INC.W <ea> |A|012346|-|UUUUU|*****|D M+-WXZ |0101_001_001_mmm_rrr [ADDQ.W #1,<ea>] 1237: //INC.W Ar |A|012346|-|-----|-----| A |0101_001_001_001_rrr [ADDQ.W #1,Ar] 1238: case 0b0101_000_001: 1239: case 0b0101_001_001: 1240: case 0b0101_010_001: 1241: case 0b0101_011_001: 1242: case 0b0101_100_001: 1243: case 0b0101_101_001: 1244: case 0b0101_110_001: 1245: case 0b0101_111_001: 1246: irpAddqWord (); 1247: break irpSwitch; 1248: 1249: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1250: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1251: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1252: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1253: //ADDQ.L #<data>,<ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0101_qqq_010_mmm_rrr 1254: //ADDQ.L #<data>,Ar |-|012346|-|-----|-----| A |0101_qqq_010_001_rrr 1255: //INC.L <ea> |A|012346|-|UUUUU|*****|D M+-WXZ |0101_001_010_mmm_rrr [ADDQ.L #1,<ea>] 1256: //INC.L Ar |A|012346|-|-----|-----| A |0101_001_010_001_rrr [ADDQ.L #1,Ar] 1257: case 0b0101_000_010: 1258: case 0b0101_001_010: 1259: case 0b0101_010_010: 1260: case 0b0101_011_010: 1261: case 0b0101_100_010: 1262: case 0b0101_101_010: 1263: case 0b0101_110_010: 1264: case 0b0101_111_010: 1265: irpAddqLong (); 1266: break irpSwitch; 1267: 1268: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1269: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1270: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1271: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1272: //ST.B <ea> |-|012346|-|-----|-----|D M+-WXZ |0101_000_011_mmm_rrr 1273: //SNF.B <ea> |A|012346|-|-----|-----|D M+-WXZ |0101_000_011_mmm_rrr [ST.B <ea>] 1274: //DBT.W Dr,<label> |-|012346|-|-----|-----| |0101_000_011_001_rrr-{offset} 1275: //DBNF.W Dr,<label> |A|012346|-|-----|-----| |0101_000_011_001_rrr-{offset} [DBT.W Dr,<label>] 1276: case 0b0101_000_011: 1277: irpSt (); 1278: break irpSwitch; 1279: 1280: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1281: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1282: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1283: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1284: //SUBQ.B #<data>,<ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0101_qqq_100_mmm_rrr 1285: //DEC.B <ea> |A|012346|-|UUUUU|*****|D M+-WXZ |0101_001_100_mmm_rrr [SUBQ.B #1,<ea>] 1286: case 0b0101_000_100: 1287: case 0b0101_001_100: 1288: case 0b0101_010_100: 1289: case 0b0101_011_100: 1290: case 0b0101_100_100: 1291: case 0b0101_101_100: 1292: case 0b0101_110_100: 1293: case 0b0101_111_100: 1294: irpSubqByte (); 1295: break irpSwitch; 1296: 1297: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1298: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1299: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1300: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1301: //SUBQ.W #<data>,<ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0101_qqq_101_mmm_rrr 1302: //SUBQ.W #<data>,Ar |-|012346|-|-----|-----| A |0101_qqq_101_001_rrr 1303: //DEC.W <ea> |A|012346|-|UUUUU|*****|D M+-WXZ |0101_001_101_mmm_rrr [SUBQ.W #1,<ea>] 1304: //DEC.W Ar |A|012346|-|-----|-----| A |0101_001_101_001_rrr [SUBQ.W #1,Ar] 1305: case 0b0101_000_101: 1306: case 0b0101_001_101: 1307: case 0b0101_010_101: 1308: case 0b0101_011_101: 1309: case 0b0101_100_101: 1310: case 0b0101_101_101: 1311: case 0b0101_110_101: 1312: case 0b0101_111_101: 1313: irpSubqWord (); 1314: break irpSwitch; 1315: 1316: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1317: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1318: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1319: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1320: //SUBQ.L #<data>,<ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0101_qqq_110_mmm_rrr 1321: //SUBQ.L #<data>,Ar |-|012346|-|-----|-----| A |0101_qqq_110_001_rrr 1322: //DEC.L <ea> |A|012346|-|UUUUU|*****|D M+-WXZ |0101_001_110_mmm_rrr [SUBQ.L #1,<ea>] 1323: //DEC.L Ar |A|012346|-|-----|-----| A |0101_001_110_001_rrr [SUBQ.L #1,Ar] 1324: case 0b0101_000_110: 1325: case 0b0101_001_110: 1326: case 0b0101_010_110: 1327: case 0b0101_011_110: 1328: case 0b0101_100_110: 1329: case 0b0101_101_110: 1330: case 0b0101_110_110: 1331: case 0b0101_111_110: 1332: irpSubqLong (); 1333: break irpSwitch; 1334: 1335: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1336: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1337: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1338: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1339: //SF.B <ea> |-|012346|-|-----|-----|D M+-WXZ |0101_000_111_mmm_rrr 1340: //SNT.B <ea> |A|012346|-|-----|-----|D M+-WXZ |0101_000_111_mmm_rrr [SF.B <ea>] 1341: //DBF.W Dr,<label> |-|012346|-|-----|-----| |0101_000_111_001_rrr-{offset} 1342: //DBNT.W Dr,<label> |A|012346|-|-----|-----| |0101_000_111_001_rrr-{offset} [DBF.W Dr,<label>] 1343: //DBRA.W Dr,<label> |A|012346|-|-----|-----| |0101_000_111_001_rrr-{offset} [DBF.W Dr,<label>] 1344: case 0b0101_000_111: 1345: irpSf (); 1346: break irpSwitch; 1347: 1348: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1349: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1350: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1351: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1352: //SHI.B <ea> |-|012346|-|--*-*|-----|D M+-WXZ |0101_001_011_mmm_rrr 1353: //SNLS.B <ea> |A|012346|-|--*-*|-----|D M+-WXZ |0101_001_011_mmm_rrr [SHI.B <ea>] 1354: //DBHI.W Dr,<label> |-|012346|-|--*-*|-----| |0101_001_011_001_rrr-{offset} 1355: //DBNLS.W Dr,<label> |A|012346|-|--*-*|-----| |0101_001_011_001_rrr-{offset} [DBHI.W Dr,<label>] 1356: case 0b0101_001_011: 1357: irpShi (); 1358: break irpSwitch; 1359: 1360: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1361: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1362: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1363: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1364: //SLS.B <ea> |-|012346|-|--*-*|-----|D M+-WXZ |0101_001_111_mmm_rrr 1365: //SNHI.B <ea> |A|012346|-|--*-*|-----|D M+-WXZ |0101_001_111_mmm_rrr [SLS.B <ea>] 1366: //DBLS.W Dr,<label> |-|012346|-|--*-*|-----| |0101_001_111_001_rrr-{offset} 1367: //DBNHI.W Dr,<label> |A|012346|-|--*-*|-----| |0101_001_111_001_rrr-{offset} [DBLS.W Dr,<label>] 1368: case 0b0101_001_111: 1369: irpSls (); 1370: break irpSwitch; 1371: 1372: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1373: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1374: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1375: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1376: //SCC.B <ea> |-|012346|-|----*|-----|D M+-WXZ |0101_010_011_mmm_rrr 1377: //SHS.B <ea> |A|012346|-|----*|-----|D M+-WXZ |0101_010_011_mmm_rrr [SCC.B <ea>] 1378: //SNCS.B <ea> |A|012346|-|----*|-----|D M+-WXZ |0101_010_011_mmm_rrr [SCC.B <ea>] 1379: //SNLO.B <ea> |A|012346|-|----*|-----|D M+-WXZ |0101_010_011_mmm_rrr [SCC.B <ea>] 1380: //DBCC.W Dr,<label> |-|012346|-|----*|-----| |0101_010_011_001_rrr-{offset} 1381: //DBHS.W Dr,<label> |A|012346|-|----*|-----| |0101_010_011_001_rrr-{offset} [DBCC.W Dr,<label>] 1382: //DBNCS.W Dr,<label> |A|012346|-|----*|-----| |0101_010_011_001_rrr-{offset} [DBCC.W Dr,<label>] 1383: //DBNLO.W Dr,<label> |A|012346|-|----*|-----| |0101_010_011_001_rrr-{offset} [DBCC.W Dr,<label>] 1384: case 0b0101_010_011: 1385: irpShs (); 1386: break irpSwitch; 1387: 1388: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1389: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1390: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1391: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1392: //SCS.B <ea> |-|012346|-|----*|-----|D M+-WXZ |0101_010_111_mmm_rrr 1393: //SLO.B <ea> |A|012346|-|----*|-----|D M+-WXZ |0101_010_111_mmm_rrr [SCS.B <ea>] 1394: //SNCC.B <ea> |A|012346|-|----*|-----|D M+-WXZ |0101_010_111_mmm_rrr [SCS.B <ea>] 1395: //SNHS.B <ea> |A|012346|-|----*|-----|D M+-WXZ |0101_010_111_mmm_rrr [SCS.B <ea>] 1396: //DBCS.W Dr,<label> |-|012346|-|----*|-----| |0101_010_111_001_rrr-{offset} 1397: //DBLO.W Dr,<label> |A|012346|-|----*|-----| |0101_010_111_001_rrr-{offset} [DBCS.W Dr,<label>] 1398: //DBNCC.W Dr,<label> |A|012346|-|----*|-----| |0101_010_111_001_rrr-{offset} [DBCS.W Dr,<label>] 1399: //DBNHS.W Dr,<label> |A|012346|-|----*|-----| |0101_010_111_001_rrr-{offset} [DBCS.W Dr,<label>] 1400: case 0b0101_010_111: 1401: irpSlo (); 1402: break irpSwitch; 1403: 1404: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1405: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1406: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1407: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1408: //SNE.B <ea> |-|012346|-|--*--|-----|D M+-WXZ |0101_011_011_mmm_rrr 1409: //SNEQ.B <ea> |A|012346|-|--*--|-----|D M+-WXZ |0101_011_011_mmm_rrr [SNE.B <ea>] 1410: //SNZ.B <ea> |A|012346|-|--*--|-----|D M+-WXZ |0101_011_011_mmm_rrr [SNE.B <ea>] 1411: //SNZE.B <ea> |A|012346|-|--*--|-----|D M+-WXZ |0101_011_011_mmm_rrr [SNE.B <ea>] 1412: //DBNE.W Dr,<label> |-|012346|-|--*--|-----| |0101_011_011_001_rrr-{offset} 1413: //DBNEQ.W Dr,<label> |A|012346|-|--*--|-----| |0101_011_011_001_rrr-{offset} [DBNE.W Dr,<label>] 1414: //DBNZ.W Dr,<label> |A|012346|-|--*--|-----| |0101_011_011_001_rrr-{offset} [DBNE.W Dr,<label>] 1415: //DBNZE.W Dr,<label> |A|012346|-|--*--|-----| |0101_011_011_001_rrr-{offset} [DBNE.W Dr,<label>] 1416: case 0b0101_011_011: 1417: irpSne (); 1418: break irpSwitch; 1419: 1420: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1421: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1422: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1423: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1424: //SEQ.B <ea> |-|012346|-|--*--|-----|D M+-WXZ |0101_011_111_mmm_rrr 1425: //SNNE.B <ea> |A|012346|-|--*--|-----|D M+-WXZ |0101_011_111_mmm_rrr [SEQ.B <ea>] 1426: //SNNZ.B <ea> |A|012346|-|--*--|-----|D M+-WXZ |0101_011_111_mmm_rrr [SEQ.B <ea>] 1427: //SZE.B <ea> |A|012346|-|--*--|-----|D M+-WXZ |0101_011_111_mmm_rrr [SEQ.B <ea>] 1428: //DBEQ.W Dr,<label> |-|012346|-|--*--|-----| |0101_011_111_001_rrr-{offset} 1429: //DBNNE.W Dr,<label> |A|012346|-|--*--|-----| |0101_011_111_001_rrr-{offset} [DBEQ.W Dr,<label>] 1430: //DBNNZ.W Dr,<label> |A|012346|-|--*--|-----| |0101_011_111_001_rrr-{offset} [DBEQ.W Dr,<label>] 1431: //DBZE.W Dr,<label> |A|012346|-|--*--|-----| |0101_011_111_001_rrr-{offset} [DBEQ.W Dr,<label>] 1432: case 0b0101_011_111: 1433: irpSeq (); 1434: break irpSwitch; 1435: 1436: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1437: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1438: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1439: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1440: //SVC.B <ea> |-|012346|-|---*-|-----|D M+-WXZ |0101_100_011_mmm_rrr 1441: //SNVS.B <ea> |A|012346|-|---*-|-----|D M+-WXZ |0101_100_011_mmm_rrr [SVC.B <ea>] 1442: //DBVC.W Dr,<label> |-|012346|-|---*-|-----| |0101_100_011_001_rrr-{offset} 1443: //DBNVS.W Dr,<label> |A|012346|-|---*-|-----| |0101_100_011_001_rrr-{offset} [DBVC.W Dr,<label>] 1444: case 0b0101_100_011: 1445: irpSvc (); 1446: break irpSwitch; 1447: 1448: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1449: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1450: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1451: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1452: //SVS.B <ea> |-|012346|-|---*-|-----|D M+-WXZ |0101_100_111_mmm_rrr 1453: //SNVC.B <ea> |A|012346|-|---*-|-----|D M+-WXZ |0101_100_111_mmm_rrr [SVS.B <ea>] 1454: //DBVS.W Dr,<label> |-|012346|-|---*-|-----| |0101_100_111_001_rrr-{offset} 1455: //DBNVC.W Dr,<label> |A|012346|-|---*-|-----| |0101_100_111_001_rrr-{offset} [DBVS.W Dr,<label>] 1456: case 0b0101_100_111: 1457: irpSvs (); 1458: break irpSwitch; 1459: 1460: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1461: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1462: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1463: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1464: //SPL.B <ea> |-|012346|-|-*---|-----|D M+-WXZ |0101_101_011_mmm_rrr 1465: //SNMI.B <ea> |A|012346|-|-*---|-----|D M+-WXZ |0101_101_011_mmm_rrr [SPL.B <ea>] 1466: //DBPL.W Dr,<label> |-|012346|-|-*---|-----| |0101_101_011_001_rrr-{offset} 1467: //DBNMI.W Dr,<label> |A|012346|-|-*---|-----| |0101_101_011_001_rrr-{offset} [DBPL.W Dr,<label>] 1468: case 0b0101_101_011: 1469: irpSpl (); 1470: break irpSwitch; 1471: 1472: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1473: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1474: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1475: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1476: //SMI.B <ea> |-|012346|-|-*---|-----|D M+-WXZ |0101_101_111_mmm_rrr 1477: //SNPL.B <ea> |A|012346|-|-*---|-----|D M+-WXZ |0101_101_111_mmm_rrr [SMI.B <ea>] 1478: //DBMI.W Dr,<label> |-|012346|-|-*---|-----| |0101_101_111_001_rrr-{offset} 1479: //DBNPL.W Dr,<label> |A|012346|-|-*---|-----| |0101_101_111_001_rrr-{offset} [DBMI.W Dr,<label>] 1480: case 0b0101_101_111: 1481: irpSmi (); 1482: break irpSwitch; 1483: 1484: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1485: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1486: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1487: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1488: //SGE.B <ea> |-|012346|-|-*-*-|-----|D M+-WXZ |0101_110_011_mmm_rrr 1489: //SNLT.B <ea> |A|012346|-|-*-*-|-----|D M+-WXZ |0101_110_011_mmm_rrr [SGE.B <ea>] 1490: //DBGE.W Dr,<label> |-|012346|-|-*-*-|-----| |0101_110_011_001_rrr-{offset} 1491: //DBNLT.W Dr,<label> |A|012346|-|-*-*-|-----| |0101_110_011_001_rrr-{offset} [DBGE.W Dr,<label>] 1492: case 0b0101_110_011: 1493: irpSge (); 1494: break irpSwitch; 1495: 1496: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1497: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1498: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1499: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1500: //SLT.B <ea> |-|012346|-|-*-*-|-----|D M+-WXZ |0101_110_111_mmm_rrr 1501: //SNGE.B <ea> |A|012346|-|-*-*-|-----|D M+-WXZ |0101_110_111_mmm_rrr [SLT.B <ea>] 1502: //DBLT.W Dr,<label> |-|012346|-|-*-*-|-----| |0101_110_111_001_rrr-{offset} 1503: //DBNGE.W Dr,<label> |A|012346|-|-*-*-|-----| |0101_110_111_001_rrr-{offset} [DBLT.W Dr,<label>] 1504: case 0b0101_110_111: 1505: irpSlt (); 1506: break irpSwitch; 1507: 1508: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1509: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1510: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1511: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1512: //SGT.B <ea> |-|012346|-|-***-|-----|D M+-WXZ |0101_111_011_mmm_rrr 1513: //SNLE.B <ea> |A|012346|-|-***-|-----|D M+-WXZ |0101_111_011_mmm_rrr [SGT.B <ea>] 1514: //DBGT.W Dr,<label> |-|012346|-|-***-|-----| |0101_111_011_001_rrr-{offset} 1515: //DBNLE.W Dr,<label> |A|012346|-|-***-|-----| |0101_111_011_001_rrr-{offset} [DBGT.W Dr,<label>] 1516: case 0b0101_111_011: 1517: irpSgt (); 1518: break irpSwitch; 1519: 1520: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1521: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1522: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1523: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1524: //SLE.B <ea> |-|012346|-|-***-|-----|D M+-WXZ |0101_111_111_mmm_rrr 1525: //SNGT.B <ea> |A|012346|-|-***-|-----|D M+-WXZ |0101_111_111_mmm_rrr [SLE.B <ea>] 1526: //DBLE.W Dr,<label> |-|012346|-|-***-|-----| |0101_111_111_001_rrr-{offset} 1527: //DBNGT.W Dr,<label> |A|012346|-|-***-|-----| |0101_111_111_001_rrr-{offset} [DBLE.W Dr,<label>] 1528: case 0b0101_111_111: 1529: irpSle (); 1530: break irpSwitch; 1531: 1532: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1533: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1534: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1535: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1536: //BRA.W <label> |-|012346|-|-----|-----| |0110_000_000_000_000-{offset} 1537: //JBRA.W <label> |A|012346|-|-----|-----| |0110_000_000_000_000-{offset} [BRA.W <label>] 1538: //BRA.S <label> |-|012346|-|-----|-----| |0110_000_000_sss_sss (s is not equal to 0) 1539: //JBRA.S <label> |A|012346|-|-----|-----| |0110_000_000_sss_sss (s is not equal to 0) [BRA.S <label>] 1540: case 0b0110_000_000: 1541: irpBrasw (); 1542: break irpSwitch; 1543: 1544: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1545: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1546: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1547: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1548: //BRA.S <label> |-|012346|-|-----|-----| |0110_000_001_sss_sss 1549: //JBRA.S <label> |A|012346|-|-----|-----| |0110_000_001_sss_sss [BRA.S <label>] 1550: case 0b0110_000_001: 1551: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1552: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1553: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1554: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1555: //BRA.S <label> |-|012346|-|-----|-----| |0110_000_010_sss_sss 1556: //JBRA.S <label> |A|012346|-|-----|-----| |0110_000_010_sss_sss [BRA.S <label>] 1557: case 0b0110_000_010: 1558: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1559: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1560: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1561: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1562: //BRA.S <label> |-|01----|-|-----|-----| |0110_000_011_sss_sss 1563: //JBRA.S <label> |A|01----|-|-----|-----| |0110_000_011_sss_sss [BRA.S <label>] 1564: case 0b0110_000_011: 1565: irpBras (); 1566: break irpSwitch; 1567: 1568: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1569: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1570: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1571: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1572: //BSR.W <label> |-|012346|-|-----|-----| |0110_000_100_000_000-{offset} 1573: //JBSR.W <label> |A|012346|-|-----|-----| |0110_000_100_000_000-{offset} [BSR.W <label>] 1574: //BSR.S <label> |-|012346|-|-----|-----| |0110_000_100_sss_sss (s is not equal to 0) 1575: //JBSR.S <label> |A|012346|-|-----|-----| |0110_000_100_sss_sss (s is not equal to 0) [BSR.S <label>] 1576: case 0b0110_000_100: 1577: irpBsrsw (); 1578: break irpSwitch; 1579: 1580: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1581: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1582: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1583: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1584: //BSR.S <label> |-|012346|-|-----|-----| |0110_000_101_sss_sss 1585: //JBSR.S <label> |A|012346|-|-----|-----| |0110_000_101_sss_sss [BSR.S <label>] 1586: case 0b0110_000_101: 1587: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1588: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1589: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1590: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1591: //BSR.S <label> |-|012346|-|-----|-----| |0110_000_110_sss_sss 1592: //JBSR.S <label> |A|012346|-|-----|-----| |0110_000_110_sss_sss [BSR.S <label>] 1593: case 0b0110_000_110: 1594: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1595: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1596: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1597: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1598: //BSR.S <label> |-|01----|-|-----|-----| |0110_000_111_sss_sss 1599: //JBSR.S <label> |A|01----|-|-----|-----| |0110_000_111_sss_sss [BSR.S <label>] 1600: case 0b0110_000_111: 1601: irpBsrs (); 1602: break irpSwitch; 1603: 1604: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1605: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1606: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1607: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1608: //BHI.W <label> |-|012346|-|--*-*|-----| |0110_001_000_000_000-{offset} 1609: //BNLS.W <label> |A|012346|-|--*-*|-----| |0110_001_000_000_000-{offset} [BHI.W <label>] 1610: //JBHI.W <label> |A|012346|-|--*-*|-----| |0110_001_000_000_000-{offset} [BHI.W <label>] 1611: //JBNLS.W <label> |A|012346|-|--*-*|-----| |0110_001_000_000_000-{offset} [BHI.W <label>] 1612: //BHI.S <label> |-|012346|-|--*-*|-----| |0110_001_000_sss_sss (s is not equal to 0) 1613: //BNLS.S <label> |A|012346|-|--*-*|-----| |0110_001_000_sss_sss (s is not equal to 0) [BHI.S <label>] 1614: //JBHI.S <label> |A|012346|-|--*-*|-----| |0110_001_000_sss_sss (s is not equal to 0) [BHI.S <label>] 1615: //JBNLS.S <label> |A|012346|-|--*-*|-----| |0110_001_000_sss_sss (s is not equal to 0) [BHI.S <label>] 1616: //JBLS.L <label> |A|012346|-|--*-*|-----| |0110_001_000_000_110-0100111011111001-{address} [BHI.S (*)+8;JMP <label>] 1617: //JBNHI.L <label> |A|012346|-|--*-*|-----| |0110_001_000_000_110-0100111011111001-{address} [BHI.S (*)+8;JMP <label>] 1618: case 0b0110_001_000: 1619: irpBhisw (); 1620: break irpSwitch; 1621: 1622: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1623: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1624: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1625: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1626: //BHI.S <label> |-|012346|-|--*-*|-----| |0110_001_001_sss_sss 1627: //BNLS.S <label> |A|012346|-|--*-*|-----| |0110_001_001_sss_sss [BHI.S <label>] 1628: //JBHI.S <label> |A|012346|-|--*-*|-----| |0110_001_001_sss_sss [BHI.S <label>] 1629: //JBNLS.S <label> |A|012346|-|--*-*|-----| |0110_001_001_sss_sss [BHI.S <label>] 1630: case 0b0110_001_001: 1631: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1632: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1633: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1634: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1635: //BHI.S <label> |-|012346|-|--*-*|-----| |0110_001_010_sss_sss 1636: //BNLS.S <label> |A|012346|-|--*-*|-----| |0110_001_010_sss_sss [BHI.S <label>] 1637: //JBHI.S <label> |A|012346|-|--*-*|-----| |0110_001_010_sss_sss [BHI.S <label>] 1638: //JBNLS.S <label> |A|012346|-|--*-*|-----| |0110_001_010_sss_sss [BHI.S <label>] 1639: case 0b0110_001_010: 1640: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1641: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1642: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1643: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1644: //BHI.S <label> |-|01----|-|--*-*|-----| |0110_001_011_sss_sss 1645: //BNLS.S <label> |A|01----|-|--*-*|-----| |0110_001_011_sss_sss [BHI.S <label>] 1646: //JBHI.S <label> |A|01----|-|--*-*|-----| |0110_001_011_sss_sss [BHI.S <label>] 1647: //JBNLS.S <label> |A|01----|-|--*-*|-----| |0110_001_011_sss_sss [BHI.S <label>] 1648: case 0b0110_001_011: 1649: irpBhis (); 1650: break irpSwitch; 1651: 1652: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1653: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1654: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1655: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1656: //BLS.W <label> |-|012346|-|--*-*|-----| |0110_001_100_000_000-{offset} 1657: //BNHI.W <label> |A|012346|-|--*-*|-----| |0110_001_100_000_000-{offset} [BLS.W <label>] 1658: //JBLS.W <label> |A|012346|-|--*-*|-----| |0110_001_100_000_000-{offset} [BLS.W <label>] 1659: //JBNHI.W <label> |A|012346|-|--*-*|-----| |0110_001_100_000_000-{offset} [BLS.W <label>] 1660: //BLS.S <label> |-|012346|-|--*-*|-----| |0110_001_100_sss_sss (s is not equal to 0) 1661: //BNHI.S <label> |A|012346|-|--*-*|-----| |0110_001_100_sss_sss (s is not equal to 0) [BLS.S <label>] 1662: //JBLS.S <label> |A|012346|-|--*-*|-----| |0110_001_100_sss_sss (s is not equal to 0) [BLS.S <label>] 1663: //JBNHI.S <label> |A|012346|-|--*-*|-----| |0110_001_100_sss_sss (s is not equal to 0) [BLS.S <label>] 1664: //JBHI.L <label> |A|012346|-|--*-*|-----| |0110_001_100_000_110-0100111011111001-{address} [BLS.S (*)+8;JMP <label>] 1665: //JBNLS.L <label> |A|012346|-|--*-*|-----| |0110_001_100_000_110-0100111011111001-{address} [BLS.S (*)+8;JMP <label>] 1666: case 0b0110_001_100: 1667: irpBlssw (); 1668: break irpSwitch; 1669: 1670: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1671: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1672: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1673: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1674: //BLS.S <label> |-|012346|-|--*-*|-----| |0110_001_101_sss_sss 1675: //BNHI.S <label> |A|012346|-|--*-*|-----| |0110_001_101_sss_sss [BLS.S <label>] 1676: //JBLS.S <label> |A|012346|-|--*-*|-----| |0110_001_101_sss_sss [BLS.S <label>] 1677: //JBNHI.S <label> |A|012346|-|--*-*|-----| |0110_001_101_sss_sss [BLS.S <label>] 1678: case 0b0110_001_101: 1679: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1680: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1681: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1682: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1683: //BLS.S <label> |-|012346|-|--*-*|-----| |0110_001_110_sss_sss 1684: //BNHI.S <label> |A|012346|-|--*-*|-----| |0110_001_110_sss_sss [BLS.S <label>] 1685: //JBLS.S <label> |A|012346|-|--*-*|-----| |0110_001_110_sss_sss [BLS.S <label>] 1686: //JBNHI.S <label> |A|012346|-|--*-*|-----| |0110_001_110_sss_sss [BLS.S <label>] 1687: case 0b0110_001_110: 1688: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1689: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1690: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1691: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1692: //BLS.S <label> |-|01----|-|--*-*|-----| |0110_001_111_sss_sss 1693: //BNHI.S <label> |A|01----|-|--*-*|-----| |0110_001_111_sss_sss [BLS.S <label>] 1694: //JBLS.S <label> |A|01----|-|--*-*|-----| |0110_001_111_sss_sss [BLS.S <label>] 1695: //JBNHI.S <label> |A|01----|-|--*-*|-----| |0110_001_111_sss_sss [BLS.S <label>] 1696: case 0b0110_001_111: 1697: irpBlss (); 1698: break irpSwitch; 1699: 1700: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1701: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1702: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1703: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1704: //BCC.W <label> |-|012346|-|----*|-----| |0110_010_000_000_000-{offset} 1705: //BHS.W <label> |A|012346|-|----*|-----| |0110_010_000_000_000-{offset} [BCC.W <label>] 1706: //BNCS.W <label> |A|012346|-|----*|-----| |0110_010_000_000_000-{offset} [BCC.W <label>] 1707: //BNLO.W <label> |A|012346|-|----*|-----| |0110_010_000_000_000-{offset} [BCC.W <label>] 1708: //JBCC.W <label> |A|012346|-|----*|-----| |0110_010_000_000_000-{offset} [BCC.W <label>] 1709: //JBHS.W <label> |A|012346|-|----*|-----| |0110_010_000_000_000-{offset} [BCC.W <label>] 1710: //JBNCS.W <label> |A|012346|-|----*|-----| |0110_010_000_000_000-{offset} [BCC.W <label>] 1711: //JBNLO.W <label> |A|012346|-|----*|-----| |0110_010_000_000_000-{offset} [BCC.W <label>] 1712: //BCC.S <label> |-|012346|-|----*|-----| |0110_010_000_sss_sss (s is not equal to 0) 1713: //BHS.S <label> |A|012346|-|----*|-----| |0110_010_000_sss_sss (s is not equal to 0) [BCC.S <label>] 1714: //BNCS.S <label> |A|012346|-|----*|-----| |0110_010_000_sss_sss (s is not equal to 0) [BCC.S <label>] 1715: //BNLO.S <label> |A|012346|-|----*|-----| |0110_010_000_sss_sss (s is not equal to 0) [BCC.S <label>] 1716: //JBCC.S <label> |A|012346|-|----*|-----| |0110_010_000_sss_sss (s is not equal to 0) [BCC.S <label>] 1717: //JBHS.S <label> |A|012346|-|----*|-----| |0110_010_000_sss_sss (s is not equal to 0) [BCC.S <label>] 1718: //JBNCS.S <label> |A|012346|-|----*|-----| |0110_010_000_sss_sss (s is not equal to 0) [BCC.S <label>] 1719: //JBNLO.S <label> |A|012346|-|----*|-----| |0110_010_000_sss_sss (s is not equal to 0) [BCC.S <label>] 1720: //JBCS.L <label> |A|012346|-|----*|-----| |0110_010_000_000_110-0100111011111001-{address} [BCC.S (*)+8;JMP <label>] 1721: //JBLO.L <label> |A|012346|-|----*|-----| |0110_010_000_000_110-0100111011111001-{address} [BCC.S (*)+8;JMP <label>] 1722: //JBNCC.L <label> |A|012346|-|----*|-----| |0110_010_000_000_110-0100111011111001-{address} [BCC.S (*)+8;JMP <label>] 1723: //JBNHS.L <label> |A|012346|-|----*|-----| |0110_010_000_000_110-0100111011111001-{address} [BCC.S (*)+8;JMP <label>] 1724: case 0b0110_010_000: 1725: irpBhssw (); 1726: break irpSwitch; 1727: 1728: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1729: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1730: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1731: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1732: //BCC.S <label> |-|012346|-|----*|-----| |0110_010_001_sss_sss 1733: //BHS.S <label> |A|012346|-|----*|-----| |0110_010_001_sss_sss [BCC.S <label>] 1734: //BNCS.S <label> |A|012346|-|----*|-----| |0110_010_001_sss_sss [BCC.S <label>] 1735: //BNLO.S <label> |A|012346|-|----*|-----| |0110_010_001_sss_sss [BCC.S <label>] 1736: //JBCC.S <label> |A|012346|-|----*|-----| |0110_010_001_sss_sss [BCC.S <label>] 1737: //JBHS.S <label> |A|012346|-|----*|-----| |0110_010_001_sss_sss [BCC.S <label>] 1738: //JBNCS.S <label> |A|012346|-|----*|-----| |0110_010_001_sss_sss [BCC.S <label>] 1739: //JBNLO.S <label> |A|012346|-|----*|-----| |0110_010_001_sss_sss [BCC.S <label>] 1740: case 0b0110_010_001: 1741: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1742: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1743: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1744: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1745: //BCC.S <label> |-|012346|-|----*|-----| |0110_010_010_sss_sss 1746: //BHS.S <label> |A|012346|-|----*|-----| |0110_010_010_sss_sss [BCC.S <label>] 1747: //BNCS.S <label> |A|012346|-|----*|-----| |0110_010_010_sss_sss [BCC.S <label>] 1748: //BNLO.S <label> |A|012346|-|----*|-----| |0110_010_010_sss_sss [BCC.S <label>] 1749: //JBCC.S <label> |A|012346|-|----*|-----| |0110_010_010_sss_sss [BCC.S <label>] 1750: //JBHS.S <label> |A|012346|-|----*|-----| |0110_010_010_sss_sss [BCC.S <label>] 1751: //JBNCS.S <label> |A|012346|-|----*|-----| |0110_010_010_sss_sss [BCC.S <label>] 1752: //JBNLO.S <label> |A|012346|-|----*|-----| |0110_010_010_sss_sss [BCC.S <label>] 1753: case 0b0110_010_010: 1754: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1755: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1756: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1757: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1758: //BCC.S <label> |-|01----|-|----*|-----| |0110_010_011_sss_sss 1759: //BHS.S <label> |A|01----|-|----*|-----| |0110_010_011_sss_sss [BCC.S <label>] 1760: //BNCS.S <label> |A|01----|-|----*|-----| |0110_010_011_sss_sss [BCC.S <label>] 1761: //BNLO.S <label> |A|01----|-|----*|-----| |0110_010_011_sss_sss [BCC.S <label>] 1762: //JBCC.S <label> |A|01----|-|----*|-----| |0110_010_011_sss_sss [BCC.S <label>] 1763: //JBHS.S <label> |A|01----|-|----*|-----| |0110_010_011_sss_sss [BCC.S <label>] 1764: //JBNCS.S <label> |A|01----|-|----*|-----| |0110_010_011_sss_sss [BCC.S <label>] 1765: //JBNLO.S <label> |A|01----|-|----*|-----| |0110_010_011_sss_sss [BCC.S <label>] 1766: case 0b0110_010_011: 1767: irpBhss (); 1768: break irpSwitch; 1769: 1770: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1771: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1772: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1773: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1774: //BCS.W <label> |-|012346|-|----*|-----| |0110_010_100_000_000-{offset} 1775: //BLO.W <label> |A|012346|-|----*|-----| |0110_010_100_000_000-{offset} [BCS.W <label>] 1776: //BNCC.W <label> |A|012346|-|----*|-----| |0110_010_100_000_000-{offset} [BCS.W <label>] 1777: //BNHS.W <label> |A|012346|-|----*|-----| |0110_010_100_000_000-{offset} [BCS.W <label>] 1778: //JBCS.W <label> |A|012346|-|----*|-----| |0110_010_100_000_000-{offset} [BCS.W <label>] 1779: //JBLO.W <label> |A|012346|-|----*|-----| |0110_010_100_000_000-{offset} [BCS.W <label>] 1780: //JBNCC.W <label> |A|012346|-|----*|-----| |0110_010_100_000_000-{offset} [BCS.W <label>] 1781: //JBNHS.W <label> |A|012346|-|----*|-----| |0110_010_100_000_000-{offset} [BCS.W <label>] 1782: //BCS.S <label> |-|012346|-|----*|-----| |0110_010_100_sss_sss (s is not equal to 0) 1783: //BLO.S <label> |A|012346|-|----*|-----| |0110_010_100_sss_sss (s is not equal to 0) [BCS.S <label>] 1784: //BNCC.S <label> |A|012346|-|----*|-----| |0110_010_100_sss_sss (s is not equal to 0) [BCS.S <label>] 1785: //BNHS.S <label> |A|012346|-|----*|-----| |0110_010_100_sss_sss (s is not equal to 0) [BCS.S <label>] 1786: //JBCS.S <label> |A|012346|-|----*|-----| |0110_010_100_sss_sss (s is not equal to 0) [BCS.S <label>] 1787: //JBLO.S <label> |A|012346|-|----*|-----| |0110_010_100_sss_sss (s is not equal to 0) [BCS.S <label>] 1788: //JBNCC.S <label> |A|012346|-|----*|-----| |0110_010_100_sss_sss (s is not equal to 0) [BCS.S <label>] 1789: //JBNHS.S <label> |A|012346|-|----*|-----| |0110_010_100_sss_sss (s is not equal to 0) [BCS.S <label>] 1790: //JBCC.L <label> |A|012346|-|----*|-----| |0110_010_100_000_110-0100111011111001-{address} [BCS.S (*)+8;JMP <label>] 1791: //JBHS.L <label> |A|012346|-|----*|-----| |0110_010_100_000_110-0100111011111001-{address} [BCS.S (*)+8;JMP <label>] 1792: //JBNCS.L <label> |A|012346|-|----*|-----| |0110_010_100_000_110-0100111011111001-{address} [BCS.S (*)+8;JMP <label>] 1793: //JBNLO.L <label> |A|012346|-|----*|-----| |0110_010_100_000_110-0100111011111001-{address} [BCS.S (*)+8;JMP <label>] 1794: case 0b0110_010_100: 1795: irpBlosw (); 1796: break irpSwitch; 1797: 1798: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1799: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1800: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1801: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1802: //BCS.S <label> |-|012346|-|----*|-----| |0110_010_101_sss_sss 1803: //BLO.S <label> |A|012346|-|----*|-----| |0110_010_101_sss_sss [BCS.S <label>] 1804: //BNCC.S <label> |A|012346|-|----*|-----| |0110_010_101_sss_sss [BCS.S <label>] 1805: //BNHS.S <label> |A|012346|-|----*|-----| |0110_010_101_sss_sss [BCS.S <label>] 1806: //JBCS.S <label> |A|012346|-|----*|-----| |0110_010_101_sss_sss [BCS.S <label>] 1807: //JBLO.S <label> |A|012346|-|----*|-----| |0110_010_101_sss_sss [BCS.S <label>] 1808: //JBNCC.S <label> |A|012346|-|----*|-----| |0110_010_101_sss_sss [BCS.S <label>] 1809: //JBNHS.S <label> |A|012346|-|----*|-----| |0110_010_101_sss_sss [BCS.S <label>] 1810: case 0b0110_010_101: 1811: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1812: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1813: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1814: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1815: //BCS.S <label> |-|012346|-|----*|-----| |0110_010_110_sss_sss 1816: //BLO.S <label> |A|012346|-|----*|-----| |0110_010_110_sss_sss [BCS.S <label>] 1817: //BNCC.S <label> |A|012346|-|----*|-----| |0110_010_110_sss_sss [BCS.S <label>] 1818: //BNHS.S <label> |A|012346|-|----*|-----| |0110_010_110_sss_sss [BCS.S <label>] 1819: //JBCS.S <label> |A|012346|-|----*|-----| |0110_010_110_sss_sss [BCS.S <label>] 1820: //JBLO.S <label> |A|012346|-|----*|-----| |0110_010_110_sss_sss [BCS.S <label>] 1821: //JBNCC.S <label> |A|012346|-|----*|-----| |0110_010_110_sss_sss [BCS.S <label>] 1822: //JBNHS.S <label> |A|012346|-|----*|-----| |0110_010_110_sss_sss [BCS.S <label>] 1823: case 0b0110_010_110: 1824: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1825: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1826: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1827: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1828: //BCS.S <label> |-|01----|-|----*|-----| |0110_010_111_sss_sss 1829: //BLO.S <label> |A|01----|-|----*|-----| |0110_010_111_sss_sss [BCS.S <label>] 1830: //BNCC.S <label> |A|01----|-|----*|-----| |0110_010_111_sss_sss [BCS.S <label>] 1831: //BNHS.S <label> |A|01----|-|----*|-----| |0110_010_111_sss_sss [BCS.S <label>] 1832: //JBCS.S <label> |A|01----|-|----*|-----| |0110_010_111_sss_sss [BCS.S <label>] 1833: //JBLO.S <label> |A|01----|-|----*|-----| |0110_010_111_sss_sss [BCS.S <label>] 1834: //JBNCC.S <label> |A|01----|-|----*|-----| |0110_010_111_sss_sss [BCS.S <label>] 1835: //JBNHS.S <label> |A|01----|-|----*|-----| |0110_010_111_sss_sss [BCS.S <label>] 1836: case 0b0110_010_111: 1837: irpBlos (); 1838: break irpSwitch; 1839: 1840: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1841: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1842: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1843: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1844: //BNE.W <label> |-|012346|-|--*--|-----| |0110_011_000_000_000-{offset} 1845: //BNEQ.W <label> |A|012346|-|--*--|-----| |0110_011_000_000_000-{offset} [BNE.W <label>] 1846: //BNZ.W <label> |A|012346|-|--*--|-----| |0110_011_000_000_000-{offset} [BNE.W <label>] 1847: //BNZE.W <label> |A|012346|-|--*--|-----| |0110_011_000_000_000-{offset} [BNE.W <label>] 1848: //JBNE.W <label> |A|012346|-|--*--|-----| |0110_011_000_000_000-{offset} [BNE.W <label>] 1849: //JBNEQ.W <label> |A|012346|-|--*--|-----| |0110_011_000_000_000-{offset} [BNE.W <label>] 1850: //JBNZ.W <label> |A|012346|-|--*--|-----| |0110_011_000_000_000-{offset} [BNE.W <label>] 1851: //JBNZE.W <label> |A|012346|-|--*--|-----| |0110_011_000_000_000-{offset} [BNE.W <label>] 1852: //BNE.S <label> |-|012346|-|--*--|-----| |0110_011_000_sss_sss (s is not equal to 0) 1853: //BNEQ.S <label> |A|012346|-|--*--|-----| |0110_011_000_sss_sss (s is not equal to 0) [BNE.S <label>] 1854: //BNZ.S <label> |A|012346|-|--*--|-----| |0110_011_000_sss_sss (s is not equal to 0) [BNE.S <label>] 1855: //BNZE.S <label> |A|012346|-|--*--|-----| |0110_011_000_sss_sss (s is not equal to 0) [BNE.S <label>] 1856: //JBNE.S <label> |A|012346|-|--*--|-----| |0110_011_000_sss_sss (s is not equal to 0) [BNE.S <label>] 1857: //JBNEQ.S <label> |A|012346|-|--*--|-----| |0110_011_000_sss_sss (s is not equal to 0) [BNE.S <label>] 1858: //JBNZ.S <label> |A|012346|-|--*--|-----| |0110_011_000_sss_sss (s is not equal to 0) [BNE.S <label>] 1859: //JBNZE.S <label> |A|012346|-|--*--|-----| |0110_011_000_sss_sss (s is not equal to 0) [BNE.S <label>] 1860: //JBEQ.L <label> |A|012346|-|--*--|-----| |0110_011_000_000_110-0100111011111001-{address} [BNE.S (*)+8;JMP <label>] 1861: //JBNEQ.L <label> |A|012346|-|--*--|-----| |0110_011_000_000_110-0100111011111001-{address} [BNE.S (*)+8;JMP <label>] 1862: //JBNNE.L <label> |A|012346|-|--*--|-----| |0110_011_000_000_110-0100111011111001-{address} [BNE.S (*)+8;JMP <label>] 1863: //JBNNZ.L <label> |A|012346|-|--*--|-----| |0110_011_000_000_110-0100111011111001-{address} [BNE.S (*)+8;JMP <label>] 1864: //JBNZ.L <label> |A|012346|-|--*--|-----| |0110_011_000_000_110-0100111011111001-{address} [BNE.S (*)+8;JMP <label>] 1865: //JBNZE.L <label> |A|012346|-|--*--|-----| |0110_011_000_000_110-0100111011111001-{address} [BNE.S (*)+8;JMP <label>] 1866: //JBZE.L <label> |A|012346|-|--*--|-----| |0110_011_000_000_110-0100111011111001-{address} [BNE.S (*)+8;JMP <label>] 1867: case 0b0110_011_000: 1868: irpBnesw (); 1869: break irpSwitch; 1870: 1871: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1872: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1873: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1874: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1875: //BNE.S <label> |-|012346|-|--*--|-----| |0110_011_001_sss_sss 1876: //BNEQ.S <label> |A|012346|-|--*--|-----| |0110_011_001_sss_sss [BNE.S <label>] 1877: //BNZ.S <label> |A|012346|-|--*--|-----| |0110_011_001_sss_sss [BNE.S <label>] 1878: //BNZE.S <label> |A|012346|-|--*--|-----| |0110_011_001_sss_sss [BNE.S <label>] 1879: //JBNE.S <label> |A|012346|-|--*--|-----| |0110_011_001_sss_sss [BNE.S <label>] 1880: //JBNEQ.S <label> |A|012346|-|--*--|-----| |0110_011_001_sss_sss [BNE.S <label>] 1881: //JBNZ.S <label> |A|012346|-|--*--|-----| |0110_011_001_sss_sss [BNE.S <label>] 1882: //JBNZE.S <label> |A|012346|-|--*--|-----| |0110_011_001_sss_sss [BNE.S <label>] 1883: case 0b0110_011_001: 1884: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1885: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1886: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1887: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1888: //BNE.S <label> |-|012346|-|--*--|-----| |0110_011_010_sss_sss 1889: //BNEQ.S <label> |A|012346|-|--*--|-----| |0110_011_010_sss_sss [BNE.S <label>] 1890: //BNZ.S <label> |A|012346|-|--*--|-----| |0110_011_010_sss_sss [BNE.S <label>] 1891: //BNZE.S <label> |A|012346|-|--*--|-----| |0110_011_010_sss_sss [BNE.S <label>] 1892: //JBNE.S <label> |A|012346|-|--*--|-----| |0110_011_010_sss_sss [BNE.S <label>] 1893: //JBNEQ.S <label> |A|012346|-|--*--|-----| |0110_011_010_sss_sss [BNE.S <label>] 1894: //JBNZ.S <label> |A|012346|-|--*--|-----| |0110_011_010_sss_sss [BNE.S <label>] 1895: //JBNZE.S <label> |A|012346|-|--*--|-----| |0110_011_010_sss_sss [BNE.S <label>] 1896: case 0b0110_011_010: 1897: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1898: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1899: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1900: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1901: //BNE.S <label> |-|01----|-|--*--|-----| |0110_011_011_sss_sss 1902: //BNEQ.S <label> |A|01----|-|--*--|-----| |0110_011_011_sss_sss [BNE.S <label>] 1903: //BNZ.S <label> |A|01----|-|--*--|-----| |0110_011_011_sss_sss [BNE.S <label>] 1904: //BNZE.S <label> |A|01----|-|--*--|-----| |0110_011_011_sss_sss [BNE.S <label>] 1905: //JBNE.S <label> |A|01----|-|--*--|-----| |0110_011_011_sss_sss [BNE.S <label>] 1906: //JBNEQ.S <label> |A|01----|-|--*--|-----| |0110_011_011_sss_sss [BNE.S <label>] 1907: //JBNZ.S <label> |A|01----|-|--*--|-----| |0110_011_011_sss_sss [BNE.S <label>] 1908: //JBNZE.S <label> |A|01----|-|--*--|-----| |0110_011_011_sss_sss [BNE.S <label>] 1909: case 0b0110_011_011: 1910: irpBnes (); 1911: break irpSwitch; 1912: 1913: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1914: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1915: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1916: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1917: //BEQ.W <label> |-|012346|-|--*--|-----| |0110_011_100_000_000-{offset} 1918: //BNNE.W <label> |A|012346|-|--*--|-----| |0110_011_100_000_000-{offset} [BEQ.W <label>] 1919: //BNNZ.W <label> |A|012346|-|--*--|-----| |0110_011_100_000_000-{offset} [BEQ.W <label>] 1920: //BZE.W <label> |A|012346|-|--*--|-----| |0110_011_100_000_000-{offset} [BEQ.W <label>] 1921: //JBEQ.W <label> |A|012346|-|--*--|-----| |0110_011_100_000_000-{offset} [BEQ.W <label>] 1922: //JBNNE.W <label> |A|012346|-|--*--|-----| |0110_011_100_000_000-{offset} [BEQ.W <label>] 1923: //JBNNZ.W <label> |A|012346|-|--*--|-----| |0110_011_100_000_000-{offset} [BEQ.W <label>] 1924: //JBZE.W <label> |A|012346|-|--*--|-----| |0110_011_100_000_000-{offset} [BEQ.W <label>] 1925: //BEQ.S <label> |-|012346|-|--*--|-----| |0110_011_100_sss_sss (s is not equal to 0) 1926: //BNNE.S <label> |A|012346|-|--*--|-----| |0110_011_100_sss_sss (s is not equal to 0) [BEQ.S <label>] 1927: //BNNZ.S <label> |A|012346|-|--*--|-----| |0110_011_100_sss_sss (s is not equal to 0) [BEQ.S <label>] 1928: //BZE.S <label> |A|012346|-|--*--|-----| |0110_011_100_sss_sss (s is not equal to 0) [BEQ.S <label>] 1929: //JBEQ.S <label> |A|012346|-|--*--|-----| |0110_011_100_sss_sss (s is not equal to 0) [BEQ.S <label>] 1930: //JBNNE.S <label> |A|012346|-|--*--|-----| |0110_011_100_sss_sss (s is not equal to 0) [BEQ.S <label>] 1931: //JBNNZ.S <label> |A|012346|-|--*--|-----| |0110_011_100_sss_sss (s is not equal to 0) [BEQ.S <label>] 1932: //JBZE.S <label> |A|012346|-|--*--|-----| |0110_011_100_sss_sss (s is not equal to 0) [BEQ.S <label>] 1933: //JBNE.L <label> |A|012346|-|--*--|-----| |0110_011_100_000_110-0100111011111001-{address} [BEQ.S (*)+8;JMP <label>] 1934: case 0b0110_011_100: 1935: irpBeqsw (); 1936: break irpSwitch; 1937: 1938: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1939: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1940: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1941: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1942: //BEQ.S <label> |-|012346|-|--*--|-----| |0110_011_101_sss_sss 1943: //BNNE.S <label> |A|012346|-|--*--|-----| |0110_011_101_sss_sss [BEQ.S <label>] 1944: //BNNZ.S <label> |A|012346|-|--*--|-----| |0110_011_101_sss_sss [BEQ.S <label>] 1945: //BZE.S <label> |A|012346|-|--*--|-----| |0110_011_101_sss_sss [BEQ.S <label>] 1946: //JBEQ.S <label> |A|012346|-|--*--|-----| |0110_011_101_sss_sss [BEQ.S <label>] 1947: //JBNNE.S <label> |A|012346|-|--*--|-----| |0110_011_101_sss_sss [BEQ.S <label>] 1948: //JBNNZ.S <label> |A|012346|-|--*--|-----| |0110_011_101_sss_sss [BEQ.S <label>] 1949: //JBZE.S <label> |A|012346|-|--*--|-----| |0110_011_101_sss_sss [BEQ.S <label>] 1950: case 0b0110_011_101: 1951: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1952: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1953: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1954: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1955: //BEQ.S <label> |-|012346|-|--*--|-----| |0110_011_110_sss_sss 1956: //BNNE.S <label> |A|012346|-|--*--|-----| |0110_011_110_sss_sss [BEQ.S <label>] 1957: //BNNZ.S <label> |A|012346|-|--*--|-----| |0110_011_110_sss_sss [BEQ.S <label>] 1958: //BZE.S <label> |A|012346|-|--*--|-----| |0110_011_110_sss_sss [BEQ.S <label>] 1959: //JBEQ.S <label> |A|012346|-|--*--|-----| |0110_011_110_sss_sss [BEQ.S <label>] 1960: //JBNNE.S <label> |A|012346|-|--*--|-----| |0110_011_110_sss_sss [BEQ.S <label>] 1961: //JBNNZ.S <label> |A|012346|-|--*--|-----| |0110_011_110_sss_sss [BEQ.S <label>] 1962: //JBZE.S <label> |A|012346|-|--*--|-----| |0110_011_110_sss_sss [BEQ.S <label>] 1963: case 0b0110_011_110: 1964: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1965: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1966: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1967: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1968: //BEQ.S <label> |-|01----|-|--*--|-----| |0110_011_111_sss_sss 1969: //BNNE.S <label> |A|01----|-|--*--|-----| |0110_011_111_sss_sss [BEQ.S <label>] 1970: //BNNZ.S <label> |A|01----|-|--*--|-----| |0110_011_111_sss_sss [BEQ.S <label>] 1971: //BZE.S <label> |A|01----|-|--*--|-----| |0110_011_111_sss_sss [BEQ.S <label>] 1972: //JBEQ.S <label> |A|01----|-|--*--|-----| |0110_011_111_sss_sss [BEQ.S <label>] 1973: //JBNNE.S <label> |A|01----|-|--*--|-----| |0110_011_111_sss_sss [BEQ.S <label>] 1974: //JBNNZ.S <label> |A|01----|-|--*--|-----| |0110_011_111_sss_sss [BEQ.S <label>] 1975: //JBZE.S <label> |A|01----|-|--*--|-----| |0110_011_111_sss_sss [BEQ.S <label>] 1976: case 0b0110_011_111: 1977: irpBeqs (); 1978: break irpSwitch; 1979: 1980: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1981: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 1982: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 1983: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1984: //BVC.W <label> |-|012346|-|---*-|-----| |0110_100_000_000_000-{offset} 1985: //BNVS.W <label> |A|012346|-|---*-|-----| |0110_100_000_000_000-{offset} [BVC.W <label>] 1986: //JBNVS.W <label> |A|012346|-|---*-|-----| |0110_100_000_000_000-{offset} [BVC.W <label>] 1987: //JBVC.W <label> |A|012346|-|---*-|-----| |0110_100_000_000_000-{offset} [BVC.W <label>] 1988: //BVC.S <label> |-|012346|-|---*-|-----| |0110_100_000_sss_sss (s is not equal to 0) 1989: //BNVS.S <label> |A|012346|-|---*-|-----| |0110_100_000_sss_sss (s is not equal to 0) [BVC.S <label>] 1990: //JBNVS.S <label> |A|012346|-|---*-|-----| |0110_100_000_sss_sss (s is not equal to 0) [BVC.S <label>] 1991: //JBVC.S <label> |A|012346|-|---*-|-----| |0110_100_000_sss_sss (s is not equal to 0) [BVC.S <label>] 1992: //JBNVC.L <label> |A|012346|-|---*-|-----| |0110_100_000_000_110-0100111011111001-{address} [BVC.S (*)+8;JMP <label>] 1993: //JBVS.L <label> |A|012346|-|---*-|-----| |0110_100_000_000_110-0100111011111001-{address} [BVC.S (*)+8;JMP <label>] 1994: case 0b0110_100_000: 1995: irpBvcsw (); 1996: break irpSwitch; 1997: 1998: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 1999: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2000: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2001: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2002: //BVC.S <label> |-|012346|-|---*-|-----| |0110_100_001_sss_sss 2003: //BNVS.S <label> |A|012346|-|---*-|-----| |0110_100_001_sss_sss [BVC.S <label>] 2004: //JBNVS.S <label> |A|012346|-|---*-|-----| |0110_100_001_sss_sss [BVC.S <label>] 2005: //JBVC.S <label> |A|012346|-|---*-|-----| |0110_100_001_sss_sss [BVC.S <label>] 2006: case 0b0110_100_001: 2007: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2008: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2009: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2010: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2011: //BVC.S <label> |-|012346|-|---*-|-----| |0110_100_010_sss_sss 2012: //BNVS.S <label> |A|012346|-|---*-|-----| |0110_100_010_sss_sss [BVC.S <label>] 2013: //JBNVS.S <label> |A|012346|-|---*-|-----| |0110_100_010_sss_sss [BVC.S <label>] 2014: //JBVC.S <label> |A|012346|-|---*-|-----| |0110_100_010_sss_sss [BVC.S <label>] 2015: case 0b0110_100_010: 2016: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2017: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2018: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2019: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2020: //BVC.S <label> |-|01----|-|---*-|-----| |0110_100_011_sss_sss 2021: //BNVS.S <label> |A|01----|-|---*-|-----| |0110_100_011_sss_sss [BVC.S <label>] 2022: //JBNVS.S <label> |A|01----|-|---*-|-----| |0110_100_011_sss_sss [BVC.S <label>] 2023: //JBVC.S <label> |A|01----|-|---*-|-----| |0110_100_011_sss_sss [BVC.S <label>] 2024: case 0b0110_100_011: 2025: irpBvcs (); 2026: break irpSwitch; 2027: 2028: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2029: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2030: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2031: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2032: //BVS.W <label> |-|012346|-|---*-|-----| |0110_100_100_000_000-{offset} 2033: //BNVC.W <label> |A|012346|-|---*-|-----| |0110_100_100_000_000-{offset} [BVS.W <label>] 2034: //JBNVC.W <label> |A|012346|-|---*-|-----| |0110_100_100_000_000-{offset} [BVS.W <label>] 2035: //JBVS.W <label> |A|012346|-|---*-|-----| |0110_100_100_000_000-{offset} [BVS.W <label>] 2036: //BVS.S <label> |-|012346|-|---*-|-----| |0110_100_100_sss_sss (s is not equal to 0) 2037: //BNVC.S <label> |A|012346|-|---*-|-----| |0110_100_100_sss_sss (s is not equal to 0) [BVS.S <label>] 2038: //JBNVC.S <label> |A|012346|-|---*-|-----| |0110_100_100_sss_sss (s is not equal to 0) [BVS.S <label>] 2039: //JBVS.S <label> |A|012346|-|---*-|-----| |0110_100_100_sss_sss (s is not equal to 0) [BVS.S <label>] 2040: //JBNVS.L <label> |A|012346|-|---*-|-----| |0110_100_100_000_110-0100111011111001-{address} [BVS.S (*)+8;JMP <label>] 2041: //JBVC.L <label> |A|012346|-|---*-|-----| |0110_100_100_000_110-0100111011111001-{address} [BVS.S (*)+8;JMP <label>] 2042: case 0b0110_100_100: 2043: irpBvssw (); 2044: break irpSwitch; 2045: 2046: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2047: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2048: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2049: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2050: //BVS.S <label> |-|012346|-|---*-|-----| |0110_100_101_sss_sss 2051: //BNVC.S <label> |A|012346|-|---*-|-----| |0110_100_101_sss_sss [BVS.S <label>] 2052: //JBNVC.S <label> |A|012346|-|---*-|-----| |0110_100_101_sss_sss [BVS.S <label>] 2053: //JBVS.S <label> |A|012346|-|---*-|-----| |0110_100_101_sss_sss [BVS.S <label>] 2054: case 0b0110_100_101: 2055: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2056: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2057: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2058: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2059: //BVS.S <label> |-|012346|-|---*-|-----| |0110_100_110_sss_sss 2060: //BNVC.S <label> |A|012346|-|---*-|-----| |0110_100_110_sss_sss [BVS.S <label>] 2061: //JBNVC.S <label> |A|012346|-|---*-|-----| |0110_100_110_sss_sss [BVS.S <label>] 2062: //JBVS.S <label> |A|012346|-|---*-|-----| |0110_100_110_sss_sss [BVS.S <label>] 2063: case 0b0110_100_110: 2064: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2065: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2066: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2067: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2068: //BVS.S <label> |-|01----|-|---*-|-----| |0110_100_111_sss_sss 2069: //BNVC.S <label> |A|01----|-|---*-|-----| |0110_100_111_sss_sss [BVS.S <label>] 2070: //JBNVC.S <label> |A|01----|-|---*-|-----| |0110_100_111_sss_sss [BVS.S <label>] 2071: //JBVS.S <label> |A|01----|-|---*-|-----| |0110_100_111_sss_sss [BVS.S <label>] 2072: case 0b0110_100_111: 2073: irpBvss (); 2074: break irpSwitch; 2075: 2076: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2077: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2078: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2079: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2080: //BPL.W <label> |-|012346|-|-*---|-----| |0110_101_000_000_000-{offset} 2081: //BNMI.W <label> |A|012346|-|-*---|-----| |0110_101_000_000_000-{offset} [BPL.W <label>] 2082: //JBNMI.W <label> |A|012346|-|-*---|-----| |0110_101_000_000_000-{offset} [BPL.W <label>] 2083: //JBPL.W <label> |A|012346|-|-*---|-----| |0110_101_000_000_000-{offset} [BPL.W <label>] 2084: //BPL.S <label> |-|012346|-|-*---|-----| |0110_101_000_sss_sss (s is not equal to 0) 2085: //BNMI.S <label> |A|012346|-|-*---|-----| |0110_101_000_sss_sss (s is not equal to 0) [BPL.S <label>] 2086: //JBNMI.S <label> |A|012346|-|-*---|-----| |0110_101_000_sss_sss (s is not equal to 0) [BPL.S <label>] 2087: //JBPL.S <label> |A|012346|-|-*---|-----| |0110_101_000_sss_sss (s is not equal to 0) [BPL.S <label>] 2088: //JBMI.L <label> |A|012346|-|-*---|-----| |0110_101_000_000_110-0100111011111001-{address} [BPL.S (*)+8;JMP <label>] 2089: //JBNPL.L <label> |A|012346|-|-*---|-----| |0110_101_000_000_110-0100111011111001-{address} [BPL.S (*)+8;JMP <label>] 2090: case 0b0110_101_000: 2091: irpBplsw (); 2092: break irpSwitch; 2093: 2094: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2095: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2096: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2097: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2098: //BPL.S <label> |-|012346|-|-*---|-----| |0110_101_001_sss_sss 2099: //BNMI.S <label> |A|012346|-|-*---|-----| |0110_101_001_sss_sss [BPL.S <label>] 2100: //JBNMI.S <label> |A|012346|-|-*---|-----| |0110_101_001_sss_sss [BPL.S <label>] 2101: //JBPL.S <label> |A|012346|-|-*---|-----| |0110_101_001_sss_sss [BPL.S <label>] 2102: case 0b0110_101_001: 2103: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2104: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2105: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2106: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2107: //BPL.S <label> |-|012346|-|-*---|-----| |0110_101_010_sss_sss 2108: //BNMI.S <label> |A|012346|-|-*---|-----| |0110_101_010_sss_sss [BPL.S <label>] 2109: //JBNMI.S <label> |A|012346|-|-*---|-----| |0110_101_010_sss_sss [BPL.S <label>] 2110: //JBPL.S <label> |A|012346|-|-*---|-----| |0110_101_010_sss_sss [BPL.S <label>] 2111: case 0b0110_101_010: 2112: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2113: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2114: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2115: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2116: //BPL.S <label> |-|01----|-|-*---|-----| |0110_101_011_sss_sss 2117: //BNMI.S <label> |A|01----|-|-*---|-----| |0110_101_011_sss_sss [BPL.S <label>] 2118: //JBNMI.S <label> |A|01----|-|-*---|-----| |0110_101_011_sss_sss [BPL.S <label>] 2119: //JBPL.S <label> |A|01----|-|-*---|-----| |0110_101_011_sss_sss [BPL.S <label>] 2120: case 0b0110_101_011: 2121: irpBpls (); 2122: break irpSwitch; 2123: 2124: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2125: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2126: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2127: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2128: //BMI.W <label> |-|012346|-|-*---|-----| |0110_101_100_000_000-{offset} 2129: //BNPL.W <label> |A|012346|-|-*---|-----| |0110_101_100_000_000-{offset} [BMI.W <label>] 2130: //JBMI.W <label> |A|012346|-|-*---|-----| |0110_101_100_000_000-{offset} [BMI.W <label>] 2131: //JBNPL.W <label> |A|012346|-|-*---|-----| |0110_101_100_000_000-{offset} [BMI.W <label>] 2132: //BMI.S <label> |-|012346|-|-*---|-----| |0110_101_100_sss_sss (s is not equal to 0) 2133: //BNPL.S <label> |A|012346|-|-*---|-----| |0110_101_100_sss_sss (s is not equal to 0) [BMI.S <label>] 2134: //JBMI.S <label> |A|012346|-|-*---|-----| |0110_101_100_sss_sss (s is not equal to 0) [BMI.S <label>] 2135: //JBNPL.S <label> |A|012346|-|-*---|-----| |0110_101_100_sss_sss (s is not equal to 0) [BMI.S <label>] 2136: //JBNMI.L <label> |A|012346|-|-*---|-----| |0110_101_100_000_110-0100111011111001-{address} [BMI.S (*)+8;JMP <label>] 2137: //JBPL.L <label> |A|012346|-|-*---|-----| |0110_101_100_000_110-0100111011111001-{address} [BMI.S (*)+8;JMP <label>] 2138: case 0b0110_101_100: 2139: irpBmisw (); 2140: break irpSwitch; 2141: 2142: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2143: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2144: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2145: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2146: //BMI.S <label> |-|012346|-|-*---|-----| |0110_101_101_sss_sss 2147: //BNPL.S <label> |A|012346|-|-*---|-----| |0110_101_101_sss_sss [BMI.S <label>] 2148: //JBMI.S <label> |A|012346|-|-*---|-----| |0110_101_101_sss_sss [BMI.S <label>] 2149: //JBNPL.S <label> |A|012346|-|-*---|-----| |0110_101_101_sss_sss [BMI.S <label>] 2150: case 0b0110_101_101: 2151: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2152: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2153: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2154: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2155: //BMI.S <label> |-|012346|-|-*---|-----| |0110_101_110_sss_sss 2156: //BNPL.S <label> |A|012346|-|-*---|-----| |0110_101_110_sss_sss [BMI.S <label>] 2157: //JBMI.S <label> |A|012346|-|-*---|-----| |0110_101_110_sss_sss [BMI.S <label>] 2158: //JBNPL.S <label> |A|012346|-|-*---|-----| |0110_101_110_sss_sss [BMI.S <label>] 2159: case 0b0110_101_110: 2160: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2161: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2162: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2163: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2164: //BMI.S <label> |-|01----|-|-*---|-----| |0110_101_111_sss_sss 2165: //BNPL.S <label> |A|01----|-|-*---|-----| |0110_101_111_sss_sss [BMI.S <label>] 2166: //JBMI.S <label> |A|01----|-|-*---|-----| |0110_101_111_sss_sss [BMI.S <label>] 2167: //JBNPL.S <label> |A|01----|-|-*---|-----| |0110_101_111_sss_sss [BMI.S <label>] 2168: case 0b0110_101_111: 2169: irpBmis (); 2170: break irpSwitch; 2171: 2172: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2173: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2174: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2175: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2176: //BGE.W <label> |-|012346|-|-*-*-|-----| |0110_110_000_000_000-{offset} 2177: //BNLT.W <label> |A|012346|-|-*-*-|-----| |0110_110_000_000_000-{offset} [BGE.W <label>] 2178: //JBGE.W <label> |A|012346|-|-*-*-|-----| |0110_110_000_000_000-{offset} [BGE.W <label>] 2179: //JBNLT.W <label> |A|012346|-|-*-*-|-----| |0110_110_000_000_000-{offset} [BGE.W <label>] 2180: //BGE.S <label> |-|012346|-|-*-*-|-----| |0110_110_000_sss_sss (s is not equal to 0) 2181: //BNLT.S <label> |A|012346|-|-*-*-|-----| |0110_110_000_sss_sss (s is not equal to 0) [BGE.S <label>] 2182: //JBGE.S <label> |A|012346|-|-*-*-|-----| |0110_110_000_sss_sss (s is not equal to 0) [BGE.S <label>] 2183: //JBNLT.S <label> |A|012346|-|-*-*-|-----| |0110_110_000_sss_sss (s is not equal to 0) [BGE.S <label>] 2184: //JBLT.L <label> |A|012346|-|-*-*-|-----| |0110_110_000_000_110-0100111011111001-{address} [BGE.S (*)+8;JMP <label>] 2185: //JBNGE.L <label> |A|012346|-|-*-*-|-----| |0110_110_000_000_110-0100111011111001-{address} [BGE.S (*)+8;JMP <label>] 2186: case 0b0110_110_000: 2187: irpBgesw (); 2188: break irpSwitch; 2189: 2190: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2191: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2192: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2193: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2194: //BGE.S <label> |-|012346|-|-*-*-|-----| |0110_110_001_sss_sss 2195: //BNLT.S <label> |A|012346|-|-*-*-|-----| |0110_110_001_sss_sss [BGE.S <label>] 2196: //JBGE.S <label> |A|012346|-|-*-*-|-----| |0110_110_001_sss_sss [BGE.S <label>] 2197: //JBNLT.S <label> |A|012346|-|-*-*-|-----| |0110_110_001_sss_sss [BGE.S <label>] 2198: case 0b0110_110_001: 2199: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2200: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2201: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2202: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2203: //BGE.S <label> |-|012346|-|-*-*-|-----| |0110_110_010_sss_sss 2204: //BNLT.S <label> |A|012346|-|-*-*-|-----| |0110_110_010_sss_sss [BGE.S <label>] 2205: //JBGE.S <label> |A|012346|-|-*-*-|-----| |0110_110_010_sss_sss [BGE.S <label>] 2206: //JBNLT.S <label> |A|012346|-|-*-*-|-----| |0110_110_010_sss_sss [BGE.S <label>] 2207: case 0b0110_110_010: 2208: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2209: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2210: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2211: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2212: //BGE.S <label> |-|01----|-|-*-*-|-----| |0110_110_011_sss_sss 2213: //BNLT.S <label> |A|01----|-|-*-*-|-----| |0110_110_011_sss_sss [BGE.S <label>] 2214: //JBGE.S <label> |A|01----|-|-*-*-|-----| |0110_110_011_sss_sss [BGE.S <label>] 2215: //JBNLT.S <label> |A|01----|-|-*-*-|-----| |0110_110_011_sss_sss [BGE.S <label>] 2216: case 0b0110_110_011: 2217: irpBges (); 2218: break irpSwitch; 2219: 2220: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2221: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2222: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2223: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2224: //BLT.W <label> |-|012346|-|-*-*-|-----| |0110_110_100_000_000-{offset} 2225: //BNGE.W <label> |A|012346|-|-*-*-|-----| |0110_110_100_000_000-{offset} [BLT.W <label>] 2226: //JBLT.W <label> |A|012346|-|-*-*-|-----| |0110_110_100_000_000-{offset} [BLT.W <label>] 2227: //JBNGE.W <label> |A|012346|-|-*-*-|-----| |0110_110_100_000_000-{offset} [BLT.W <label>] 2228: //BLT.S <label> |-|012346|-|-*-*-|-----| |0110_110_100_sss_sss (s is not equal to 0) 2229: //BNGE.S <label> |A|012346|-|-*-*-|-----| |0110_110_100_sss_sss (s is not equal to 0) [BLT.S <label>] 2230: //JBLT.S <label> |A|012346|-|-*-*-|-----| |0110_110_100_sss_sss (s is not equal to 0) [BLT.S <label>] 2231: //JBNGE.S <label> |A|012346|-|-*-*-|-----| |0110_110_100_sss_sss (s is not equal to 0) [BLT.S <label>] 2232: //JBGE.L <label> |A|012346|-|-*-*-|-----| |0110_110_100_000_110-0100111011111001-{address} [BLT.S (*)+8;JMP <label>] 2233: //JBNLT.L <label> |A|012346|-|-*-*-|-----| |0110_110_100_000_110-0100111011111001-{address} [BLT.S (*)+8;JMP <label>] 2234: case 0b0110_110_100: 2235: irpBltsw (); 2236: break irpSwitch; 2237: 2238: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2239: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2240: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2241: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2242: //BLT.S <label> |-|012346|-|-*-*-|-----| |0110_110_101_sss_sss 2243: //BNGE.S <label> |A|012346|-|-*-*-|-----| |0110_110_101_sss_sss [BLT.S <label>] 2244: //JBLT.S <label> |A|012346|-|-*-*-|-----| |0110_110_101_sss_sss [BLT.S <label>] 2245: //JBNGE.S <label> |A|012346|-|-*-*-|-----| |0110_110_101_sss_sss [BLT.S <label>] 2246: case 0b0110_110_101: 2247: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2248: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2249: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2250: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2251: //BLT.S <label> |-|012346|-|-*-*-|-----| |0110_110_110_sss_sss 2252: //BNGE.S <label> |A|012346|-|-*-*-|-----| |0110_110_110_sss_sss [BLT.S <label>] 2253: //JBLT.S <label> |A|012346|-|-*-*-|-----| |0110_110_110_sss_sss [BLT.S <label>] 2254: //JBNGE.S <label> |A|012346|-|-*-*-|-----| |0110_110_110_sss_sss [BLT.S <label>] 2255: case 0b0110_110_110: 2256: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2257: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2258: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2259: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2260: //BLT.S <label> |-|01----|-|-*-*-|-----| |0110_110_111_sss_sss 2261: //BNGE.S <label> |A|01----|-|-*-*-|-----| |0110_110_111_sss_sss [BLT.S <label>] 2262: //JBLT.S <label> |A|01----|-|-*-*-|-----| |0110_110_111_sss_sss [BLT.S <label>] 2263: //JBNGE.S <label> |A|01----|-|-*-*-|-----| |0110_110_111_sss_sss [BLT.S <label>] 2264: case 0b0110_110_111: 2265: irpBlts (); 2266: break irpSwitch; 2267: 2268: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2269: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2270: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2271: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2272: //BGT.W <label> |-|012346|-|-***-|-----| |0110_111_000_000_000-{offset} 2273: //BNLE.W <label> |A|012346|-|-***-|-----| |0110_111_000_000_000-{offset} [BGT.W <label>] 2274: //JBGT.W <label> |A|012346|-|-***-|-----| |0110_111_000_000_000-{offset} [BGT.W <label>] 2275: //JBNLE.W <label> |A|012346|-|-***-|-----| |0110_111_000_000_000-{offset} [BGT.W <label>] 2276: //BGT.S <label> |-|012346|-|-***-|-----| |0110_111_000_sss_sss (s is not equal to 0) 2277: //BNLE.S <label> |A|012346|-|-***-|-----| |0110_111_000_sss_sss (s is not equal to 0) [BGT.S <label>] 2278: //JBGT.S <label> |A|012346|-|-***-|-----| |0110_111_000_sss_sss (s is not equal to 0) [BGT.S <label>] 2279: //JBNLE.S <label> |A|012346|-|-***-|-----| |0110_111_000_sss_sss (s is not equal to 0) [BGT.S <label>] 2280: //JBLE.L <label> |A|012346|-|-***-|-----| |0110_111_000_000_110-0100111011111001-{address} [BGT.S (*)+8;JMP <label>] 2281: //JBNGT.L <label> |A|012346|-|-***-|-----| |0110_111_000_000_110-0100111011111001-{address} [BGT.S (*)+8;JMP <label>] 2282: case 0b0110_111_000: 2283: irpBgtsw (); 2284: break irpSwitch; 2285: 2286: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2287: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2288: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2289: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2290: //BGT.S <label> |-|012346|-|-***-|-----| |0110_111_001_sss_sss 2291: //BNLE.S <label> |A|012346|-|-***-|-----| |0110_111_001_sss_sss [BGT.S <label>] 2292: //JBGT.S <label> |A|012346|-|-***-|-----| |0110_111_001_sss_sss [BGT.S <label>] 2293: //JBNLE.S <label> |A|012346|-|-***-|-----| |0110_111_001_sss_sss [BGT.S <label>] 2294: case 0b0110_111_001: 2295: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2296: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2297: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2298: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2299: //BGT.S <label> |-|012346|-|-***-|-----| |0110_111_010_sss_sss 2300: //BNLE.S <label> |A|012346|-|-***-|-----| |0110_111_010_sss_sss [BGT.S <label>] 2301: //JBGT.S <label> |A|012346|-|-***-|-----| |0110_111_010_sss_sss [BGT.S <label>] 2302: //JBNLE.S <label> |A|012346|-|-***-|-----| |0110_111_010_sss_sss [BGT.S <label>] 2303: case 0b0110_111_010: 2304: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2305: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2306: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2307: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2308: //BGT.S <label> |-|01----|-|-***-|-----| |0110_111_011_sss_sss 2309: //BNLE.S <label> |A|01----|-|-***-|-----| |0110_111_011_sss_sss [BGT.S <label>] 2310: //JBGT.S <label> |A|01----|-|-***-|-----| |0110_111_011_sss_sss [BGT.S <label>] 2311: //JBNLE.S <label> |A|01----|-|-***-|-----| |0110_111_011_sss_sss [BGT.S <label>] 2312: case 0b0110_111_011: 2313: irpBgts (); 2314: break irpSwitch; 2315: 2316: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2317: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2318: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2319: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2320: //BLE.W <label> |-|012346|-|-***-|-----| |0110_111_100_000_000-{offset} 2321: //BNGT.W <label> |A|012346|-|-***-|-----| |0110_111_100_000_000-{offset} [BLE.W <label>] 2322: //JBLE.W <label> |A|012346|-|-***-|-----| |0110_111_100_000_000-{offset} [BLE.W <label>] 2323: //JBNGT.W <label> |A|012346|-|-***-|-----| |0110_111_100_000_000-{offset} [BLE.W <label>] 2324: //BLE.S <label> |-|012346|-|-***-|-----| |0110_111_100_sss_sss (s is not equal to 0) 2325: //BNGT.S <label> |A|012346|-|-***-|-----| |0110_111_100_sss_sss (s is not equal to 0) [BLE.S <label>] 2326: //JBLE.S <label> |A|012346|-|-***-|-----| |0110_111_100_sss_sss (s is not equal to 0) [BLE.S <label>] 2327: //JBNGT.S <label> |A|012346|-|-***-|-----| |0110_111_100_sss_sss (s is not equal to 0) [BLE.S <label>] 2328: //JBGT.L <label> |A|012346|-|-***-|-----| |0110_111_100_000_110-0100111011111001-{address} [BLE.S (*)+8;JMP <label>] 2329: //JBNLE.L <label> |A|012346|-|-***-|-----| |0110_111_100_000_110-0100111011111001-{address} [BLE.S (*)+8;JMP <label>] 2330: case 0b0110_111_100: 2331: irpBlesw (); 2332: break irpSwitch; 2333: 2334: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2335: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2336: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2337: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2338: //BLE.S <label> |-|012346|-|-***-|-----| |0110_111_101_sss_sss 2339: //BNGT.S <label> |A|012346|-|-***-|-----| |0110_111_101_sss_sss [BLE.S <label>] 2340: //JBLE.S <label> |A|012346|-|-***-|-----| |0110_111_101_sss_sss [BLE.S <label>] 2341: //JBNGT.S <label> |A|012346|-|-***-|-----| |0110_111_101_sss_sss [BLE.S <label>] 2342: case 0b0110_111_101: 2343: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2344: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2345: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2346: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2347: //BLE.S <label> |-|012346|-|-***-|-----| |0110_111_110_sss_sss 2348: //BNGT.S <label> |A|012346|-|-***-|-----| |0110_111_110_sss_sss [BLE.S <label>] 2349: //JBLE.S <label> |A|012346|-|-***-|-----| |0110_111_110_sss_sss [BLE.S <label>] 2350: //JBNGT.S <label> |A|012346|-|-***-|-----| |0110_111_110_sss_sss [BLE.S <label>] 2351: case 0b0110_111_110: 2352: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2353: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2354: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2355: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2356: //BLE.S <label> |-|01----|-|-***-|-----| |0110_111_111_sss_sss 2357: //BNGT.S <label> |A|01----|-|-***-|-----| |0110_111_111_sss_sss [BLE.S <label>] 2358: //JBLE.S <label> |A|01----|-|-***-|-----| |0110_111_111_sss_sss [BLE.S <label>] 2359: //JBNGT.S <label> |A|01----|-|-***-|-----| |0110_111_111_sss_sss [BLE.S <label>] 2360: case 0b0110_111_111: 2361: irpBles (); 2362: break irpSwitch; 2363: 2364: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2365: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2366: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2367: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2368: //IOCS <name> |A|012346|-|UUUUU|UUUUU| |0111_000_0dd_ddd_ddd-0100111001001111 [MOVEQ.L #<data>,D0;TRAP #15] 2369: //MOVEQ.L #<data>,Dq |-|012346|-|-UUUU|-**00| |0111_qqq_0dd_ddd_ddd 2370: case 0b0111_000_000: 2371: case 0b0111_000_001: 2372: case 0b0111_000_010: 2373: case 0b0111_000_011: 2374: case 0b0111_001_000: 2375: case 0b0111_001_001: 2376: case 0b0111_001_010: 2377: case 0b0111_001_011: 2378: case 0b0111_010_000: 2379: case 0b0111_010_001: 2380: case 0b0111_010_010: 2381: case 0b0111_010_011: 2382: case 0b0111_011_000: 2383: case 0b0111_011_001: 2384: case 0b0111_011_010: 2385: case 0b0111_011_011: 2386: case 0b0111_100_000: 2387: case 0b0111_100_001: 2388: case 0b0111_100_010: 2389: case 0b0111_100_011: 2390: case 0b0111_101_000: 2391: case 0b0111_101_001: 2392: case 0b0111_101_010: 2393: case 0b0111_101_011: 2394: case 0b0111_110_000: 2395: case 0b0111_110_001: 2396: case 0b0111_110_010: 2397: case 0b0111_110_011: 2398: case 0b0111_111_000: 2399: case 0b0111_111_001: 2400: case 0b0111_111_010: 2401: case 0b0111_111_011: 2402: irpMoveq (); 2403: break irpSwitch; 2404: 2405: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2406: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2407: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2408: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2409: //MVS.B <ea>,Dq |-|------|-|-UUUU|-**00|D M+-WXZPI|0111_qqq_100_mmm_rrr (ISA_B) 2410: case 0b0111_000_100: 2411: case 0b0111_001_100: 2412: case 0b0111_010_100: 2413: case 0b0111_011_100: 2414: case 0b0111_100_100: 2415: case 0b0111_101_100: 2416: case 0b0111_110_100: 2417: case 0b0111_111_100: 2418: irpMvsByte (); 2419: break irpSwitch; 2420: 2421: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2422: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2423: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2424: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2425: //MVS.W <ea>,Dq |-|------|-|-UUUU|-**00|D M+-WXZPI|0111_qqq_101_mmm_rrr (ISA_B) 2426: case 0b0111_000_101: 2427: case 0b0111_001_101: 2428: case 0b0111_010_101: 2429: case 0b0111_011_101: 2430: case 0b0111_100_101: 2431: case 0b0111_101_101: 2432: case 0b0111_110_101: 2433: case 0b0111_111_101: 2434: irpMvsWord (); 2435: break irpSwitch; 2436: 2437: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2438: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2439: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2440: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2441: //MVZ.B <ea>,Dq |-|------|-|-UUUU|-0*00|D M+-WXZPI|0111_qqq_110_mmm_rrr (ISA_B) 2442: case 0b0111_000_110: 2443: case 0b0111_001_110: 2444: case 0b0111_010_110: 2445: case 0b0111_011_110: 2446: case 0b0111_100_110: 2447: case 0b0111_101_110: 2448: case 0b0111_110_110: 2449: case 0b0111_111_110: 2450: irpMvzByte (); 2451: break irpSwitch; 2452: 2453: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2454: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2455: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2456: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2457: //MVZ.W <ea>,Dq |-|------|-|-UUUU|-0*00|D M+-WXZPI|0111_qqq_111_mmm_rrr (ISA_B) 2458: case 0b0111_000_111: 2459: case 0b0111_001_111: 2460: case 0b0111_010_111: 2461: case 0b0111_011_111: 2462: case 0b0111_100_111: 2463: case 0b0111_101_111: 2464: case 0b0111_110_111: 2465: case 0b0111_111_111: 2466: irpMvzWord (); 2467: break irpSwitch; 2468: 2469: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2470: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2471: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2472: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2473: //OR.B <ea>,Dq |-|012346|-|-UUUU|-**00|D M+-WXZPI|1000_qqq_000_mmm_rrr 2474: case 0b1000_000_000: 2475: case 0b1000_001_000: 2476: case 0b1000_010_000: 2477: case 0b1000_011_000: 2478: case 0b1000_100_000: 2479: case 0b1000_101_000: 2480: case 0b1000_110_000: 2481: case 0b1000_111_000: 2482: irpOrToRegByte (); 2483: break irpSwitch; 2484: 2485: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2486: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2487: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2488: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2489: //OR.W <ea>,Dq |-|012346|-|-UUUU|-**00|D M+-WXZPI|1000_qqq_001_mmm_rrr 2490: case 0b1000_000_001: 2491: case 0b1000_001_001: 2492: case 0b1000_010_001: 2493: case 0b1000_011_001: 2494: case 0b1000_100_001: 2495: case 0b1000_101_001: 2496: case 0b1000_110_001: 2497: case 0b1000_111_001: 2498: irpOrToRegWord (); 2499: break irpSwitch; 2500: 2501: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2502: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2503: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2504: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2505: //OR.L <ea>,Dq |-|012346|-|-UUUU|-**00|D M+-WXZPI|1000_qqq_010_mmm_rrr 2506: case 0b1000_000_010: 2507: case 0b1000_001_010: 2508: case 0b1000_010_010: 2509: case 0b1000_011_010: 2510: case 0b1000_100_010: 2511: case 0b1000_101_010: 2512: case 0b1000_110_010: 2513: case 0b1000_111_010: 2514: irpOrToRegLong (); 2515: break irpSwitch; 2516: 2517: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2518: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2519: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2520: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2521: //DIVU.W <ea>,Dq |-|012346|-|-UUUU|-***0|D M+-WXZPI|1000_qqq_011_mmm_rrr 2522: case 0b1000_000_011: 2523: case 0b1000_001_011: 2524: case 0b1000_010_011: 2525: case 0b1000_011_011: 2526: case 0b1000_100_011: 2527: case 0b1000_101_011: 2528: case 0b1000_110_011: 2529: case 0b1000_111_011: 2530: irpDivuWord (); 2531: break irpSwitch; 2532: 2533: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2534: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2535: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2536: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2537: //SBCD.B Dr,Dq |-|012346|-|UUUUU|*U*U*| |1000_qqq_100_000_rrr 2538: //SBCD.B -(Ar),-(Aq) |-|012346|-|UUUUU|*U*U*| |1000_qqq_100_001_rrr 2539: //OR.B Dq,<ea> |-|012346|-|-UUUU|-**00| M+-WXZ |1000_qqq_100_mmm_rrr 2540: case 0b1000_000_100: 2541: case 0b1000_001_100: 2542: case 0b1000_010_100: 2543: case 0b1000_011_100: 2544: case 0b1000_100_100: 2545: case 0b1000_101_100: 2546: case 0b1000_110_100: 2547: case 0b1000_111_100: 2548: irpOrToMemByte (); 2549: break irpSwitch; 2550: 2551: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2552: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2553: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2554: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2555: //OR.W Dq,<ea> |-|012346|-|-UUUU|-**00| M+-WXZ |1000_qqq_101_mmm_rrr 2556: case 0b1000_000_101: 2557: case 0b1000_001_101: 2558: case 0b1000_010_101: 2559: case 0b1000_011_101: 2560: case 0b1000_100_101: 2561: case 0b1000_101_101: 2562: case 0b1000_110_101: 2563: case 0b1000_111_101: 2564: irpOrToMemWord (); 2565: break irpSwitch; 2566: 2567: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2568: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2569: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2570: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2571: //OR.L Dq,<ea> |-|012346|-|-UUUU|-**00| M+-WXZ |1000_qqq_110_mmm_rrr 2572: case 0b1000_000_110: 2573: case 0b1000_001_110: 2574: case 0b1000_010_110: 2575: case 0b1000_011_110: 2576: case 0b1000_100_110: 2577: case 0b1000_101_110: 2578: case 0b1000_110_110: 2579: case 0b1000_111_110: 2580: irpOrToMemLong (); 2581: break irpSwitch; 2582: 2583: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2584: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2585: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2586: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2587: //DIVS.W <ea>,Dq |-|012346|-|-UUUU|-***0|D M+-WXZPI|1000_qqq_111_mmm_rrr 2588: case 0b1000_000_111: 2589: case 0b1000_001_111: 2590: case 0b1000_010_111: 2591: case 0b1000_011_111: 2592: case 0b1000_100_111: 2593: case 0b1000_101_111: 2594: case 0b1000_110_111: 2595: case 0b1000_111_111: 2596: irpDivsWord (); 2597: break irpSwitch; 2598: 2599: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2600: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2601: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2602: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2603: //SUB.B <ea>,Dq |-|012346|-|UUUUU|*****|D M+-WXZPI|1001_qqq_000_mmm_rrr 2604: case 0b1001_000_000: 2605: case 0b1001_001_000: 2606: case 0b1001_010_000: 2607: case 0b1001_011_000: 2608: case 0b1001_100_000: 2609: case 0b1001_101_000: 2610: case 0b1001_110_000: 2611: case 0b1001_111_000: 2612: irpSubToRegByte (); 2613: break irpSwitch; 2614: 2615: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2616: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2617: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2618: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2619: //SUB.W <ea>,Dq |-|012346|-|UUUUU|*****|DAM+-WXZPI|1001_qqq_001_mmm_rrr 2620: case 0b1001_000_001: 2621: case 0b1001_001_001: 2622: case 0b1001_010_001: 2623: case 0b1001_011_001: 2624: case 0b1001_100_001: 2625: case 0b1001_101_001: 2626: case 0b1001_110_001: 2627: case 0b1001_111_001: 2628: irpSubToRegWord (); 2629: break irpSwitch; 2630: 2631: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2632: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2633: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2634: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2635: //SUB.L <ea>,Dq |-|012346|-|UUUUU|*****|DAM+-WXZPI|1001_qqq_010_mmm_rrr 2636: case 0b1001_000_010: 2637: case 0b1001_001_010: 2638: case 0b1001_010_010: 2639: case 0b1001_011_010: 2640: case 0b1001_100_010: 2641: case 0b1001_101_010: 2642: case 0b1001_110_010: 2643: case 0b1001_111_010: 2644: irpSubToRegLong (); 2645: break irpSwitch; 2646: 2647: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2648: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2649: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2650: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2651: //SUBA.W <ea>,Aq |-|012346|-|-----|-----|DAM+-WXZPI|1001_qqq_011_mmm_rrr 2652: //SUB.W <ea>,Aq |A|012346|-|-----|-----|DAM+-WXZPI|1001_qqq_011_mmm_rrr [SUBA.W <ea>,Aq] 2653: //CLR.W Ar |A|012346|-|-----|-----| A |1001_rrr_011_001_rrr [SUBA.W Ar,Ar] 2654: case 0b1001_000_011: 2655: case 0b1001_001_011: 2656: case 0b1001_010_011: 2657: case 0b1001_011_011: 2658: case 0b1001_100_011: 2659: case 0b1001_101_011: 2660: case 0b1001_110_011: 2661: case 0b1001_111_011: 2662: irpSubaWord (); 2663: break irpSwitch; 2664: 2665: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2666: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2667: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2668: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2669: //SUBX.B Dr,Dq |-|012346|-|*UUUU|*****| |1001_qqq_100_000_rrr 2670: //SUBX.B -(Ar),-(Aq) |-|012346|-|*UUUU|*****| |1001_qqq_100_001_rrr 2671: //SUB.B Dq,<ea> |-|012346|-|UUUUU|*****| M+-WXZ |1001_qqq_100_mmm_rrr 2672: case 0b1001_000_100: 2673: case 0b1001_001_100: 2674: case 0b1001_010_100: 2675: case 0b1001_011_100: 2676: case 0b1001_100_100: 2677: case 0b1001_101_100: 2678: case 0b1001_110_100: 2679: case 0b1001_111_100: 2680: irpSubToMemByte (); 2681: break irpSwitch; 2682: 2683: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2684: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2685: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2686: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2687: //SUBX.W Dr,Dq |-|012346|-|*UUUU|*****| |1001_qqq_101_000_rrr 2688: //SUBX.W -(Ar),-(Aq) |-|012346|-|*UUUU|*****| |1001_qqq_101_001_rrr 2689: //SUB.W Dq,<ea> |-|012346|-|UUUUU|*****| M+-WXZ |1001_qqq_101_mmm_rrr 2690: case 0b1001_000_101: 2691: case 0b1001_001_101: 2692: case 0b1001_010_101: 2693: case 0b1001_011_101: 2694: case 0b1001_100_101: 2695: case 0b1001_101_101: 2696: case 0b1001_110_101: 2697: case 0b1001_111_101: 2698: irpSubToMemWord (); 2699: break irpSwitch; 2700: 2701: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2702: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2703: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2704: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2705: //SUBX.L Dr,Dq |-|012346|-|*UUUU|*****| |1001_qqq_110_000_rrr 2706: //SUBX.L -(Ar),-(Aq) |-|012346|-|*UUUU|*****| |1001_qqq_110_001_rrr 2707: //SUB.L Dq,<ea> |-|012346|-|UUUUU|*****| M+-WXZ |1001_qqq_110_mmm_rrr 2708: case 0b1001_000_110: 2709: case 0b1001_001_110: 2710: case 0b1001_010_110: 2711: case 0b1001_011_110: 2712: case 0b1001_100_110: 2713: case 0b1001_101_110: 2714: case 0b1001_110_110: 2715: case 0b1001_111_110: 2716: irpSubToMemLong (); 2717: break irpSwitch; 2718: 2719: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2720: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2721: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2722: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2723: //SUBA.L <ea>,Aq |-|012346|-|-----|-----|DAM+-WXZPI|1001_qqq_111_mmm_rrr 2724: //SUB.L <ea>,Aq |A|012346|-|-----|-----|DAM+-WXZPI|1001_qqq_111_mmm_rrr [SUBA.L <ea>,Aq] 2725: //CLR.L Ar |A|012346|-|-----|-----| A |1001_rrr_111_001_rrr [SUBA.L Ar,Ar] 2726: case 0b1001_000_111: 2727: case 0b1001_001_111: 2728: case 0b1001_010_111: 2729: case 0b1001_011_111: 2730: case 0b1001_100_111: 2731: case 0b1001_101_111: 2732: case 0b1001_110_111: 2733: case 0b1001_111_111: 2734: irpSubaLong (); 2735: break irpSwitch; 2736: 2737: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2738: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2739: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2740: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2741: //SXCALL <name> |A|012346|-|UUUUU|*****| |1010_0dd_ddd_ddd_ddd [ALINE #<data>] 2742: case 0b1010_000_000: 2743: case 0b1010_000_001: 2744: case 0b1010_000_010: 2745: case 0b1010_000_011: 2746: case 0b1010_000_100: 2747: case 0b1010_000_101: 2748: case 0b1010_000_110: 2749: case 0b1010_000_111: 2750: case 0b1010_001_000: 2751: case 0b1010_001_001: 2752: case 0b1010_001_010: 2753: case 0b1010_001_011: 2754: case 0b1010_001_100: 2755: case 0b1010_001_101: 2756: case 0b1010_001_110: 2757: case 0b1010_001_111: 2758: case 0b1010_010_000: 2759: case 0b1010_010_001: 2760: case 0b1010_010_010: 2761: case 0b1010_010_011: 2762: case 0b1010_010_100: 2763: case 0b1010_010_101: 2764: case 0b1010_010_110: 2765: case 0b1010_010_111: 2766: case 0b1010_011_000: 2767: case 0b1010_011_001: 2768: case 0b1010_011_010: 2769: case 0b1010_011_011: 2770: case 0b1010_011_100: 2771: case 0b1010_011_101: 2772: case 0b1010_011_110: 2773: case 0b1010_011_111: 2774: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2775: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2776: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2777: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2778: //ALINE #<data> |-|012346|-|UUUUU|*****| |1010_ddd_ddd_ddd_ddd (line 1010 emulator) 2779: case 0b1010_100_000: 2780: case 0b1010_100_001: 2781: case 0b1010_100_010: 2782: case 0b1010_100_011: 2783: case 0b1010_100_100: 2784: case 0b1010_100_101: 2785: case 0b1010_100_110: 2786: case 0b1010_100_111: 2787: case 0b1010_101_000: 2788: case 0b1010_101_001: 2789: case 0b1010_101_010: 2790: case 0b1010_101_011: 2791: case 0b1010_101_100: 2792: case 0b1010_101_101: 2793: case 0b1010_101_110: 2794: case 0b1010_101_111: 2795: case 0b1010_110_000: 2796: case 0b1010_110_001: 2797: case 0b1010_110_010: 2798: case 0b1010_110_011: 2799: case 0b1010_110_100: 2800: case 0b1010_110_101: 2801: case 0b1010_110_110: 2802: case 0b1010_110_111: 2803: case 0b1010_111_000: 2804: case 0b1010_111_001: 2805: case 0b1010_111_010: 2806: case 0b1010_111_011: 2807: case 0b1010_111_100: 2808: case 0b1010_111_101: 2809: case 0b1010_111_110: 2810: case 0b1010_111_111: 2811: irpAline (); 2812: break irpSwitch; 2813: 2814: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2815: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2816: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2817: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2818: //CMP.B <ea>,Dq |-|012346|-|-UUUU|-****|D M+-WXZPI|1011_qqq_000_mmm_rrr 2819: case 0b1011_000_000: 2820: case 0b1011_001_000: 2821: case 0b1011_010_000: 2822: case 0b1011_011_000: 2823: case 0b1011_100_000: 2824: case 0b1011_101_000: 2825: case 0b1011_110_000: 2826: case 0b1011_111_000: 2827: irpCmpByte (); 2828: break irpSwitch; 2829: 2830: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2831: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2832: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2833: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2834: //CMP.W <ea>,Dq |-|012346|-|-UUUU|-****|DAM+-WXZPI|1011_qqq_001_mmm_rrr 2835: case 0b1011_000_001: 2836: case 0b1011_001_001: 2837: case 0b1011_010_001: 2838: case 0b1011_011_001: 2839: case 0b1011_100_001: 2840: case 0b1011_101_001: 2841: case 0b1011_110_001: 2842: case 0b1011_111_001: 2843: irpCmpWord (); 2844: break irpSwitch; 2845: 2846: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2847: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2848: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2849: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2850: //CMP.L <ea>,Dq |-|012346|-|-UUUU|-****|DAM+-WXZPI|1011_qqq_010_mmm_rrr 2851: case 0b1011_000_010: 2852: case 0b1011_001_010: 2853: case 0b1011_010_010: 2854: case 0b1011_011_010: 2855: case 0b1011_100_010: 2856: case 0b1011_101_010: 2857: case 0b1011_110_010: 2858: case 0b1011_111_010: 2859: irpCmpLong (); 2860: break irpSwitch; 2861: 2862: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2863: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2864: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2865: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2866: //CMPA.W <ea>,Aq |-|012346|-|-UUUU|-****|DAM+-WXZPI|1011_qqq_011_mmm_rrr 2867: //CMP.W <ea>,Aq |A|012346|-|-UUUU|-****|DAM+-WXZPI|1011_qqq_011_mmm_rrr [CMPA.W <ea>,Aq] 2868: case 0b1011_000_011: 2869: case 0b1011_001_011: 2870: case 0b1011_010_011: 2871: case 0b1011_011_011: 2872: case 0b1011_100_011: 2873: case 0b1011_101_011: 2874: case 0b1011_110_011: 2875: case 0b1011_111_011: 2876: irpCmpaWord (); 2877: break irpSwitch; 2878: 2879: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2880: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2881: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2882: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2883: //EOR.B Dq,<ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |1011_qqq_100_mmm_rrr 2884: //CMPM.B (Ar)+,(Aq)+ |-|012346|-|-UUUU|-****| |1011_qqq_100_001_rrr 2885: case 0b1011_000_100: 2886: case 0b1011_001_100: 2887: case 0b1011_010_100: 2888: case 0b1011_011_100: 2889: case 0b1011_100_100: 2890: case 0b1011_101_100: 2891: case 0b1011_110_100: 2892: case 0b1011_111_100: 2893: irpEorByte (); 2894: break irpSwitch; 2895: 2896: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2897: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2898: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2899: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2900: //EOR.W Dq,<ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |1011_qqq_101_mmm_rrr 2901: //CMPM.W (Ar)+,(Aq)+ |-|012346|-|-UUUU|-****| |1011_qqq_101_001_rrr 2902: case 0b1011_000_101: 2903: case 0b1011_001_101: 2904: case 0b1011_010_101: 2905: case 0b1011_011_101: 2906: case 0b1011_100_101: 2907: case 0b1011_101_101: 2908: case 0b1011_110_101: 2909: case 0b1011_111_101: 2910: irpEorWord (); 2911: break irpSwitch; 2912: 2913: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2914: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2915: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2916: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2917: //EOR.L Dq,<ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |1011_qqq_110_mmm_rrr 2918: //CMPM.L (Ar)+,(Aq)+ |-|012346|-|-UUUU|-****| |1011_qqq_110_001_rrr 2919: case 0b1011_000_110: 2920: case 0b1011_001_110: 2921: case 0b1011_010_110: 2922: case 0b1011_011_110: 2923: case 0b1011_100_110: 2924: case 0b1011_101_110: 2925: case 0b1011_110_110: 2926: case 0b1011_111_110: 2927: irpEorLong (); 2928: break irpSwitch; 2929: 2930: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2931: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2932: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2933: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2934: //CMPA.L <ea>,Aq |-|012346|-|-UUUU|-****|DAM+-WXZPI|1011_qqq_111_mmm_rrr 2935: //CMP.L <ea>,Aq |A|012346|-|-UUUU|-****|DAM+-WXZPI|1011_qqq_111_mmm_rrr [CMPA.L <ea>,Aq] 2936: case 0b1011_000_111: 2937: case 0b1011_001_111: 2938: case 0b1011_010_111: 2939: case 0b1011_011_111: 2940: case 0b1011_100_111: 2941: case 0b1011_101_111: 2942: case 0b1011_110_111: 2943: case 0b1011_111_111: 2944: irpCmpaLong (); 2945: break irpSwitch; 2946: 2947: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2948: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2949: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2950: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2951: //AND.B <ea>,Dq |-|012346|-|-UUUU|-**00|D M+-WXZPI|1100_qqq_000_mmm_rrr 2952: case 0b1100_000_000: 2953: case 0b1100_001_000: 2954: case 0b1100_010_000: 2955: case 0b1100_011_000: 2956: case 0b1100_100_000: 2957: case 0b1100_101_000: 2958: case 0b1100_110_000: 2959: case 0b1100_111_000: 2960: irpAndToRegByte (); 2961: break irpSwitch; 2962: 2963: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2964: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2965: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2966: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2967: //AND.W <ea>,Dq |-|012346|-|-UUUU|-**00|D M+-WXZPI|1100_qqq_001_mmm_rrr 2968: case 0b1100_000_001: 2969: case 0b1100_001_001: 2970: case 0b1100_010_001: 2971: case 0b1100_011_001: 2972: case 0b1100_100_001: 2973: case 0b1100_101_001: 2974: case 0b1100_110_001: 2975: case 0b1100_111_001: 2976: irpAndToRegWord (); 2977: break irpSwitch; 2978: 2979: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2980: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2981: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2982: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2983: //AND.L <ea>,Dq |-|012346|-|-UUUU|-**00|D M+-WXZPI|1100_qqq_010_mmm_rrr 2984: case 0b1100_000_010: 2985: case 0b1100_001_010: 2986: case 0b1100_010_010: 2987: case 0b1100_011_010: 2988: case 0b1100_100_010: 2989: case 0b1100_101_010: 2990: case 0b1100_110_010: 2991: case 0b1100_111_010: 2992: irpAndToRegLong (); 2993: break irpSwitch; 2994: 2995: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2996: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 2997: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 2998: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 2999: //MULU.W <ea>,Dq |-|012346|-|-UUUU|-***0|D M+-WXZPI|1100_qqq_011_mmm_rrr 3000: case 0b1100_000_011: 3001: case 0b1100_001_011: 3002: case 0b1100_010_011: 3003: case 0b1100_011_011: 3004: case 0b1100_100_011: 3005: case 0b1100_101_011: 3006: case 0b1100_110_011: 3007: case 0b1100_111_011: 3008: irpMuluWord (); 3009: break irpSwitch; 3010: 3011: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3012: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3013: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3014: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3015: //ABCD.B Dr,Dq |-|012346|-|UUUUU|*U*U*| |1100_qqq_100_000_rrr 3016: //ABCD.B -(Ar),-(Aq) |-|012346|-|UUUUU|*U*U*| |1100_qqq_100_001_rrr 3017: //AND.B Dq,<ea> |-|012346|-|-UUUU|-**00| M+-WXZ |1100_qqq_100_mmm_rrr 3018: case 0b1100_000_100: 3019: case 0b1100_001_100: 3020: case 0b1100_010_100: 3021: case 0b1100_011_100: 3022: case 0b1100_100_100: 3023: case 0b1100_101_100: 3024: case 0b1100_110_100: 3025: case 0b1100_111_100: 3026: irpAndToMemByte (); 3027: break irpSwitch; 3028: 3029: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3030: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3031: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3032: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3033: //EXG.L Dq,Dr |-|012346|-|-----|-----| |1100_qqq_101_000_rrr 3034: //EXG.L Aq,Ar |-|012346|-|-----|-----| |1100_qqq_101_001_rrr 3035: //AND.W Dq,<ea> |-|012346|-|-UUUU|-**00| M+-WXZ |1100_qqq_101_mmm_rrr 3036: case 0b1100_000_101: 3037: case 0b1100_001_101: 3038: case 0b1100_010_101: 3039: case 0b1100_011_101: 3040: case 0b1100_100_101: 3041: case 0b1100_101_101: 3042: case 0b1100_110_101: 3043: case 0b1100_111_101: 3044: irpAndToMemWord (); 3045: break irpSwitch; 3046: 3047: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3048: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3049: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3050: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3051: //EXG.L Dq,Ar |-|012346|-|-----|-----| |1100_qqq_110_001_rrr 3052: //AND.L Dq,<ea> |-|012346|-|-UUUU|-**00| M+-WXZ |1100_qqq_110_mmm_rrr 3053: case 0b1100_000_110: 3054: case 0b1100_001_110: 3055: case 0b1100_010_110: 3056: case 0b1100_011_110: 3057: case 0b1100_100_110: 3058: case 0b1100_101_110: 3059: case 0b1100_110_110: 3060: case 0b1100_111_110: 3061: irpAndToMemLong (); 3062: break irpSwitch; 3063: 3064: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3065: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3066: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3067: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3068: //MULS.W <ea>,Dq |-|012346|-|-UUUU|-***0|D M+-WXZPI|1100_qqq_111_mmm_rrr 3069: case 0b1100_000_111: 3070: case 0b1100_001_111: 3071: case 0b1100_010_111: 3072: case 0b1100_011_111: 3073: case 0b1100_100_111: 3074: case 0b1100_101_111: 3075: case 0b1100_110_111: 3076: case 0b1100_111_111: 3077: irpMulsWord (); 3078: break irpSwitch; 3079: 3080: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3081: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3082: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3083: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3084: //ADD.B <ea>,Dq |-|012346|-|UUUUU|*****|D M+-WXZPI|1101_qqq_000_mmm_rrr 3085: case 0b1101_000_000: 3086: case 0b1101_001_000: 3087: case 0b1101_010_000: 3088: case 0b1101_011_000: 3089: case 0b1101_100_000: 3090: case 0b1101_101_000: 3091: case 0b1101_110_000: 3092: case 0b1101_111_000: 3093: irpAddToRegByte (); 3094: break irpSwitch; 3095: 3096: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3097: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3098: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3099: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3100: //ADD.W <ea>,Dq |-|012346|-|UUUUU|*****|DAM+-WXZPI|1101_qqq_001_mmm_rrr 3101: case 0b1101_000_001: 3102: case 0b1101_001_001: 3103: case 0b1101_010_001: 3104: case 0b1101_011_001: 3105: case 0b1101_100_001: 3106: case 0b1101_101_001: 3107: case 0b1101_110_001: 3108: case 0b1101_111_001: 3109: irpAddToRegWord (); 3110: break irpSwitch; 3111: 3112: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3113: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3114: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3115: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3116: //ADD.L <ea>,Dq |-|012346|-|UUUUU|*****|DAM+-WXZPI|1101_qqq_010_mmm_rrr 3117: case 0b1101_000_010: 3118: case 0b1101_001_010: 3119: case 0b1101_010_010: 3120: case 0b1101_011_010: 3121: case 0b1101_100_010: 3122: case 0b1101_101_010: 3123: case 0b1101_110_010: 3124: case 0b1101_111_010: 3125: irpAddToRegLong (); 3126: break irpSwitch; 3127: 3128: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3129: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3130: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3131: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3132: //ADDA.W <ea>,Aq |-|012346|-|-----|-----|DAM+-WXZPI|1101_qqq_011_mmm_rrr 3133: //ADD.W <ea>,Aq |A|012346|-|-----|-----|DAM+-WXZPI|1101_qqq_011_mmm_rrr [ADDA.W <ea>,Aq] 3134: case 0b1101_000_011: 3135: case 0b1101_001_011: 3136: case 0b1101_010_011: 3137: case 0b1101_011_011: 3138: case 0b1101_100_011: 3139: case 0b1101_101_011: 3140: case 0b1101_110_011: 3141: case 0b1101_111_011: 3142: irpAddaWord (); 3143: break irpSwitch; 3144: 3145: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3146: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3147: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3148: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3149: //ADDX.B Dr,Dq |-|012346|-|*UUUU|*****| |1101_qqq_100_000_rrr 3150: //ADDX.B -(Ar),-(Aq) |-|012346|-|*UUUU|*****| |1101_qqq_100_001_rrr 3151: //ADD.B Dq,<ea> |-|012346|-|UUUUU|*****| M+-WXZ |1101_qqq_100_mmm_rrr 3152: case 0b1101_000_100: 3153: case 0b1101_001_100: 3154: case 0b1101_010_100: 3155: case 0b1101_011_100: 3156: case 0b1101_100_100: 3157: case 0b1101_101_100: 3158: case 0b1101_110_100: 3159: case 0b1101_111_100: 3160: irpAddToMemByte (); 3161: break irpSwitch; 3162: 3163: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3164: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3165: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3166: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3167: //ADDX.W Dr,Dq |-|012346|-|*UUUU|*****| |1101_qqq_101_000_rrr 3168: //ADDX.W -(Ar),-(Aq) |-|012346|-|*UUUU|*****| |1101_qqq_101_001_rrr 3169: //ADD.W Dq,<ea> |-|012346|-|UUUUU|*****| M+-WXZ |1101_qqq_101_mmm_rrr 3170: case 0b1101_000_101: 3171: case 0b1101_001_101: 3172: case 0b1101_010_101: 3173: case 0b1101_011_101: 3174: case 0b1101_100_101: 3175: case 0b1101_101_101: 3176: case 0b1101_110_101: 3177: case 0b1101_111_101: 3178: irpAddToMemWord (); 3179: break irpSwitch; 3180: 3181: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3182: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3183: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3184: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3185: //ADDX.L Dr,Dq |-|012346|-|*UUUU|*****| |1101_qqq_110_000_rrr 3186: //ADDX.L -(Ar),-(Aq) |-|012346|-|*UUUU|*****| |1101_qqq_110_001_rrr 3187: //ADD.L Dq,<ea> |-|012346|-|UUUUU|*****| M+-WXZ |1101_qqq_110_mmm_rrr 3188: case 0b1101_000_110: 3189: case 0b1101_001_110: 3190: case 0b1101_010_110: 3191: case 0b1101_011_110: 3192: case 0b1101_100_110: 3193: case 0b1101_101_110: 3194: case 0b1101_110_110: 3195: case 0b1101_111_110: 3196: irpAddToMemLong (); 3197: break irpSwitch; 3198: 3199: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3200: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3201: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3202: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3203: //ADDA.L <ea>,Aq |-|012346|-|-----|-----|DAM+-WXZPI|1101_qqq_111_mmm_rrr 3204: //ADD.L <ea>,Aq |A|012346|-|-----|-----|DAM+-WXZPI|1101_qqq_111_mmm_rrr [ADDA.L <ea>,Aq] 3205: case 0b1101_000_111: 3206: case 0b1101_001_111: 3207: case 0b1101_010_111: 3208: case 0b1101_011_111: 3209: case 0b1101_100_111: 3210: case 0b1101_101_111: 3211: case 0b1101_110_111: 3212: case 0b1101_111_111: 3213: irpAddaLong (); 3214: break irpSwitch; 3215: 3216: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3217: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3218: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3219: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3220: //ASR.B #<data>,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_000_000_rrr 3221: //LSR.B #<data>,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_000_001_rrr 3222: //ROXR.B #<data>,Dr |-|012346|-|*UUUU|***0*| |1110_qqq_000_010_rrr 3223: //ROR.B #<data>,Dr |-|012346|-|-UUUU|-**0*| |1110_qqq_000_011_rrr 3224: //ASR.B Dq,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_000_100_rrr 3225: //LSR.B Dq,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_000_101_rrr 3226: //ROXR.B Dq,Dr |-|012346|-|*UUUU|***0*| |1110_qqq_000_110_rrr 3227: //ROR.B Dq,Dr |-|012346|-|-UUUU|-**0*| |1110_qqq_000_111_rrr 3228: //ASR.B Dr |A|012346|-|UUUUU|***0*| |1110_001_000_000_rrr [ASR.B #1,Dr] 3229: //LSR.B Dr |A|012346|-|UUUUU|***0*| |1110_001_000_001_rrr [LSR.B #1,Dr] 3230: //ROXR.B Dr |A|012346|-|*UUUU|***0*| |1110_001_000_010_rrr [ROXR.B #1,Dr] 3231: //ROR.B Dr |A|012346|-|-UUUU|-**0*| |1110_001_000_011_rrr [ROR.B #1,Dr] 3232: case 0b1110_000_000: 3233: case 0b1110_001_000: 3234: case 0b1110_010_000: 3235: case 0b1110_011_000: 3236: case 0b1110_100_000: 3237: case 0b1110_101_000: 3238: case 0b1110_110_000: 3239: case 0b1110_111_000: 3240: irpXxrToRegByte (); 3241: break irpSwitch; 3242: 3243: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3244: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3245: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3246: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3247: //ASR.W #<data>,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_001_000_rrr 3248: //LSR.W #<data>,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_001_001_rrr 3249: //ROXR.W #<data>,Dr |-|012346|-|*UUUU|***0*| |1110_qqq_001_010_rrr 3250: //ROR.W #<data>,Dr |-|012346|-|-UUUU|-**0*| |1110_qqq_001_011_rrr 3251: //ASR.W Dq,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_001_100_rrr 3252: //LSR.W Dq,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_001_101_rrr 3253: //ROXR.W Dq,Dr |-|012346|-|*UUUU|***0*| |1110_qqq_001_110_rrr 3254: //ROR.W Dq,Dr |-|012346|-|-UUUU|-**0*| |1110_qqq_001_111_rrr 3255: //ASR.W Dr |A|012346|-|UUUUU|***0*| |1110_001_001_000_rrr [ASR.W #1,Dr] 3256: //LSR.W Dr |A|012346|-|UUUUU|***0*| |1110_001_001_001_rrr [LSR.W #1,Dr] 3257: //ROXR.W Dr |A|012346|-|*UUUU|***0*| |1110_001_001_010_rrr [ROXR.W #1,Dr] 3258: //ROR.W Dr |A|012346|-|-UUUU|-**0*| |1110_001_001_011_rrr [ROR.W #1,Dr] 3259: case 0b1110_000_001: 3260: case 0b1110_001_001: 3261: case 0b1110_010_001: 3262: case 0b1110_011_001: 3263: case 0b1110_100_001: 3264: case 0b1110_101_001: 3265: case 0b1110_110_001: 3266: case 0b1110_111_001: 3267: irpXxrToRegWord (); 3268: break irpSwitch; 3269: 3270: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3271: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3272: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3273: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3274: //ASR.L #<data>,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_010_000_rrr 3275: //LSR.L #<data>,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_010_001_rrr 3276: //ROXR.L #<data>,Dr |-|012346|-|*UUUU|***0*| |1110_qqq_010_010_rrr 3277: //ROR.L #<data>,Dr |-|012346|-|-UUUU|-**0*| |1110_qqq_010_011_rrr 3278: //ASR.L Dq,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_010_100_rrr 3279: //LSR.L Dq,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_010_101_rrr 3280: //ROXR.L Dq,Dr |-|012346|-|*UUUU|***0*| |1110_qqq_010_110_rrr 3281: //ROR.L Dq,Dr |-|012346|-|-UUUU|-**0*| |1110_qqq_010_111_rrr 3282: //ASR.L Dr |A|012346|-|UUUUU|***0*| |1110_001_010_000_rrr [ASR.L #1,Dr] 3283: //LSR.L Dr |A|012346|-|UUUUU|***0*| |1110_001_010_001_rrr [LSR.L #1,Dr] 3284: //ROXR.L Dr |A|012346|-|*UUUU|***0*| |1110_001_010_010_rrr [ROXR.L #1,Dr] 3285: //ROR.L Dr |A|012346|-|-UUUU|-**0*| |1110_001_010_011_rrr [ROR.L #1,Dr] 3286: case 0b1110_000_010: 3287: case 0b1110_001_010: 3288: case 0b1110_010_010: 3289: case 0b1110_011_010: 3290: case 0b1110_100_010: 3291: case 0b1110_101_010: 3292: case 0b1110_110_010: 3293: case 0b1110_111_010: 3294: irpXxrToRegLong (); 3295: break irpSwitch; 3296: 3297: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3298: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3299: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3300: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3301: //ASR.W <ea> |-|012346|-|UUUUU|***0*| M+-WXZ |1110_000_011_mmm_rrr 3302: case 0b1110_000_011: 3303: irpAsrToMem (); 3304: break irpSwitch; 3305: 3306: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3307: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3308: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3309: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3310: //ASL.B #<data>,Dr |-|012346|-|UUUUU|*****| |1110_qqq_100_000_rrr 3311: //LSL.B #<data>,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_100_001_rrr 3312: //ROXL.B #<data>,Dr |-|012346|-|*UUUU|***0*| |1110_qqq_100_010_rrr 3313: //ROL.B #<data>,Dr |-|012346|-|-UUUU|-**0*| |1110_qqq_100_011_rrr 3314: //ASL.B Dq,Dr |-|012346|-|UUUUU|*****| |1110_qqq_100_100_rrr 3315: //LSL.B Dq,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_100_101_rrr 3316: //ROXL.B Dq,Dr |-|012346|-|*UUUU|***0*| |1110_qqq_100_110_rrr 3317: //ROL.B Dq,Dr |-|012346|-|-UUUU|-**0*| |1110_qqq_100_111_rrr 3318: //ASL.B Dr |A|012346|-|UUUUU|*****| |1110_001_100_000_rrr [ASL.B #1,Dr] 3319: //LSL.B Dr |A|012346|-|UUUUU|***0*| |1110_001_100_001_rrr [LSL.B #1,Dr] 3320: //ROXL.B Dr |A|012346|-|*UUUU|***0*| |1110_001_100_010_rrr [ROXL.B #1,Dr] 3321: //ROL.B Dr |A|012346|-|-UUUU|-**0*| |1110_001_100_011_rrr [ROL.B #1,Dr] 3322: case 0b1110_000_100: 3323: case 0b1110_001_100: 3324: case 0b1110_010_100: 3325: case 0b1110_011_100: 3326: case 0b1110_100_100: 3327: case 0b1110_101_100: 3328: case 0b1110_110_100: 3329: case 0b1110_111_100: 3330: irpXxlToRegByte (); 3331: break irpSwitch; 3332: 3333: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3334: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3335: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3336: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3337: //ASL.W #<data>,Dr |-|012346|-|UUUUU|*****| |1110_qqq_101_000_rrr 3338: //LSL.W #<data>,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_101_001_rrr 3339: //ROXL.W #<data>,Dr |-|012346|-|*UUUU|***0*| |1110_qqq_101_010_rrr 3340: //ROL.W #<data>,Dr |-|012346|-|-UUUU|-**0*| |1110_qqq_101_011_rrr 3341: //ASL.W Dq,Dr |-|012346|-|UUUUU|*****| |1110_qqq_101_100_rrr 3342: //LSL.W Dq,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_101_101_rrr 3343: //ROXL.W Dq,Dr |-|012346|-|*UUUU|***0*| |1110_qqq_101_110_rrr 3344: //ROL.W Dq,Dr |-|012346|-|-UUUU|-**0*| |1110_qqq_101_111_rrr 3345: //ASL.W Dr |A|012346|-|UUUUU|*****| |1110_001_101_000_rrr [ASL.W #1,Dr] 3346: //LSL.W Dr |A|012346|-|UUUUU|***0*| |1110_001_101_001_rrr [LSL.W #1,Dr] 3347: //ROXL.W Dr |A|012346|-|*UUUU|***0*| |1110_001_101_010_rrr [ROXL.W #1,Dr] 3348: //ROL.W Dr |A|012346|-|-UUUU|-**0*| |1110_001_101_011_rrr [ROL.W #1,Dr] 3349: case 0b1110_000_101: 3350: case 0b1110_001_101: 3351: case 0b1110_010_101: 3352: case 0b1110_011_101: 3353: case 0b1110_100_101: 3354: case 0b1110_101_101: 3355: case 0b1110_110_101: 3356: case 0b1110_111_101: 3357: irpXxlToRegWord (); 3358: break irpSwitch; 3359: 3360: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3361: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3362: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3363: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3364: //ASL.L #<data>,Dr |-|012346|-|UUUUU|*****| |1110_qqq_110_000_rrr 3365: //LSL.L #<data>,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_110_001_rrr 3366: //ROXL.L #<data>,Dr |-|012346|-|*UUUU|***0*| |1110_qqq_110_010_rrr 3367: //ROL.L #<data>,Dr |-|012346|-|-UUUU|-**0*| |1110_qqq_110_011_rrr 3368: //ASL.L Dq,Dr |-|012346|-|UUUUU|*****| |1110_qqq_110_100_rrr 3369: //LSL.L Dq,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_110_101_rrr 3370: //ROXL.L Dq,Dr |-|012346|-|*UUUU|***0*| |1110_qqq_110_110_rrr 3371: //ROL.L Dq,Dr |-|012346|-|-UUUU|-**0*| |1110_qqq_110_111_rrr 3372: //ASL.L Dr |A|012346|-|UUUUU|*****| |1110_001_110_000_rrr [ASL.L #1,Dr] 3373: //LSL.L Dr |A|012346|-|UUUUU|***0*| |1110_001_110_001_rrr [LSL.L #1,Dr] 3374: //ROXL.L Dr |A|012346|-|*UUUU|***0*| |1110_001_110_010_rrr [ROXL.L #1,Dr] 3375: //ROL.L Dr |A|012346|-|-UUUU|-**0*| |1110_001_110_011_rrr [ROL.L #1,Dr] 3376: case 0b1110_000_110: 3377: case 0b1110_001_110: 3378: case 0b1110_010_110: 3379: case 0b1110_011_110: 3380: case 0b1110_100_110: 3381: case 0b1110_101_110: 3382: case 0b1110_110_110: 3383: case 0b1110_111_110: 3384: irpXxlToRegLong (); 3385: break irpSwitch; 3386: 3387: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3388: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3389: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3390: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3391: //ASL.W <ea> |-|012346|-|UUUUU|*****| M+-WXZ |1110_000_111_mmm_rrr 3392: case 0b1110_000_111: 3393: irpAslToMem (); 3394: break irpSwitch; 3395: 3396: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3397: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3398: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3399: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3400: //LSR.W <ea> |-|012346|-|UUUUU|*0*0*| M+-WXZ |1110_001_011_mmm_rrr 3401: case 0b1110_001_011: 3402: irpLsrToMem (); 3403: break irpSwitch; 3404: 3405: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3406: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3407: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3408: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3409: //LSL.W <ea> |-|012346|-|UUUUU|***0*| M+-WXZ |1110_001_111_mmm_rrr 3410: case 0b1110_001_111: 3411: irpLslToMem (); 3412: break irpSwitch; 3413: 3414: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3415: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3416: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3417: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3418: //ROXR.W <ea> |-|012346|-|*UUUU|***0*| M+-WXZ |1110_010_011_mmm_rrr 3419: case 0b1110_010_011: 3420: irpRoxrToMem (); 3421: break irpSwitch; 3422: 3423: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3424: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3425: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3426: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3427: //ROXL.W <ea> |-|012346|-|*UUUU|***0*| M+-WXZ |1110_010_111_mmm_rrr 3428: case 0b1110_010_111: 3429: irpRoxlToMem (); 3430: break irpSwitch; 3431: 3432: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3433: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3434: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3435: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3436: //ROR.W <ea> |-|012346|-|-UUUU|-**0*| M+-WXZ |1110_011_011_mmm_rrr 3437: case 0b1110_011_011: 3438: irpRorToMem (); 3439: break irpSwitch; 3440: 3441: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3442: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3443: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3444: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3445: //ROL.W <ea> |-|012346|-|-UUUU|-**0*| M+-WXZ |1110_011_111_mmm_rrr 3446: case 0b1110_011_111: 3447: irpRolToMem (); 3448: break irpSwitch; 3449: 3450: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3451: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3452: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3453: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3454: //FPACK <data> |A|012346|-|UUUUU|*****| |1111_111_0dd_ddd_ddd [FLINE #<data>] 3455: case 0b1111_111_000: 3456: case 0b1111_111_001: 3457: case 0b1111_111_010: 3458: case 0b1111_111_011: 3459: irpFpack (); 3460: break irpSwitch; 3461: 3462: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3463: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3464: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3465: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3466: //DOS <data> |A|012346|-|UUUUU|UUUUU| |1111_111_1dd_ddd_ddd [FLINE #<data>] 3467: case 0b1111_111_100: 3468: case 0b1111_111_101: 3469: case 0b1111_111_110: 3470: case 0b1111_111_111: 3471: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3472: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3473: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3474: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3475: //FLINE #<data> |-|012346|-|UUUUU|UUUUU| |1111_ddd_ddd_ddd_ddd (line 1111 emulator) 3476: case 0b1111_000_000: 3477: case 0b1111_000_001: 3478: case 0b1111_000_010: 3479: case 0b1111_000_011: 3480: case 0b1111_000_100: 3481: case 0b1111_000_101: 3482: case 0b1111_000_110: 3483: case 0b1111_000_111: 3484: case 0b1111_001_000: 3485: case 0b1111_001_001: 3486: case 0b1111_001_010: 3487: case 0b1111_001_011: 3488: case 0b1111_001_100: 3489: case 0b1111_001_101: 3490: case 0b1111_001_110: 3491: case 0b1111_001_111: 3492: case 0b1111_010_000: 3493: case 0b1111_010_001: 3494: case 0b1111_010_010: 3495: case 0b1111_010_011: 3496: case 0b1111_010_100: 3497: case 0b1111_010_101: 3498: case 0b1111_010_110: 3499: case 0b1111_010_111: 3500: case 0b1111_011_000: 3501: case 0b1111_011_001: 3502: case 0b1111_011_010: 3503: case 0b1111_011_011: 3504: case 0b1111_011_100: 3505: case 0b1111_011_101: 3506: case 0b1111_011_110: 3507: case 0b1111_011_111: 3508: case 0b1111_100_000: 3509: case 0b1111_100_001: 3510: case 0b1111_100_010: 3511: case 0b1111_100_011: 3512: case 0b1111_100_100: 3513: case 0b1111_100_101: 3514: case 0b1111_100_110: 3515: case 0b1111_100_111: 3516: case 0b1111_101_000: 3517: case 0b1111_101_001: 3518: case 0b1111_101_010: 3519: case 0b1111_101_011: 3520: case 0b1111_101_100: 3521: case 0b1111_101_101: 3522: case 0b1111_101_110: 3523: case 0b1111_101_111: 3524: case 0b1111_110_000: 3525: case 0b1111_110_001: 3526: case 0b1111_110_010: 3527: case 0b1111_110_011: 3528: case 0b1111_110_100: 3529: case 0b1111_110_101: 3530: case 0b1111_110_110: 3531: case 0b1111_110_111: 3532: irpFline (); 3533: break irpSwitch; 3534: 3535: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3536: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 3537: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 3538: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 3539: //HFSBOOT |-|012346|-|-----|-----| |0100_111_000_000_000 3540: //HFSINST |-|012346|-|-----|-----| |0100_111_000_000_001 3541: //HFSSTR |-|012346|-|-----|-----| |0100_111_000_000_010 3542: //HFSINT |-|012346|-|-----|-----| |0100_111_000_000_011 3543: //EMXNOP |-|012346|-|-----|-----| |0100_111_000_000_100 3544: case 0b0100_111_000: 3545: irpEmx (); 3546: break; 3547: 3548: default: 3549: irpIllegal (); 3550: 3551: } //switch XEiJ.regOC >>> 6 3552: 3553: //トレース例外 3554: // 命令実行前にsrのTビットがセットされていたとき命令実行後にトレース例外が発生する 3555: // トレース例外の発動は命令の機能拡張であり、他の例外処理で命令が中断されたときはトレース例外は発生しない 3556: // 命令例外はトレース例外の前に、割り込み例外はトレース例外の後に処理される 3557: // 未実装命令のエミュレーションルーチンはrteの直前にsrのTビットを復元することで未実装命令が1個の命令としてトレースされたように見せる 3558: // ;DOSコールの終了 3559: // ~008616: 3560: // btst.b #$07,(sp) 3561: // bne.s ~00861E 3562: // rte 3563: // ~00861E: 3564: // ori.w #$8000,sr 3565: // rte 3566: if (XEiJ.mpuTraceFlag != 0) { //命令実行前にsrのTビットがセットされていた 3567: XEiJ.mpuCycleCount += 34; 3568: irpException (M68kException.M6E_TRACE, XEiJ.regPC, XEiJ.regSRT1 | XEiJ.regSRS | XEiJ.regSRI | XEiJ.regCCR); //pcは次の命令 3569: } 3570: //クロックをカウントアップする 3571: // オペランドをアクセスした時点ではまだXEiJ.mpuClockTimeが更新されていないのでXEiJ.mpuClockTime<xxxClock 3572: // xxxTickを呼び出すときはXEiJ.mpuClockTime>=xxxClock 3573: XEiJ.mpuClockTime += XEiJ.mpuModifiedUnit * XEiJ.mpuCycleCount; 3574: //デバイスを呼び出す 3575: TickerQueue.tkqRun (XEiJ.mpuClockTime); 3576: //割り込みを受け付ける 3577: if ((t = XEiJ.mpuIMR & XEiJ.mpuIRR) != 0) { //マスクされているレベルよりも高くて受け付けていない割り込みがあるとき 3578: if (XEiJ.MPU_INTERRUPT_SWITCH) { 3579: switch (t) { 3580: case 0b00000001: 3581: case 0b00000011: 3582: case 0b00000101: 3583: case 0b00000111: 3584: case 0b00001001: 3585: case 0b00001011: 3586: case 0b00001101: 3587: case 0b00001111: 3588: case 0b00010001: 3589: case 0b00010011: 3590: case 0b00010101: 3591: case 0b00010111: 3592: case 0b00011001: 3593: case 0b00011011: 3594: case 0b00011101: 3595: case 0b00011111: 3596: case 0b00100001: 3597: case 0b00100011: 3598: case 0b00100101: 3599: case 0b00100111: 3600: case 0b00101001: 3601: case 0b00101011: 3602: case 0b00101101: 3603: case 0b00101111: 3604: case 0b00110001: 3605: case 0b00110011: 3606: case 0b00110101: 3607: case 0b00110111: 3608: case 0b00111001: 3609: case 0b00111011: 3610: case 0b00111101: 3611: case 0b00111111: 3612: case 0b01000001: 3613: case 0b01000011: 3614: case 0b01000101: 3615: case 0b01000111: 3616: case 0b01001001: 3617: case 0b01001011: 3618: case 0b01001101: 3619: case 0b01001111: 3620: case 0b01010001: 3621: case 0b01010011: 3622: case 0b01010101: 3623: case 0b01010111: 3624: case 0b01011001: 3625: case 0b01011011: 3626: case 0b01011101: 3627: case 0b01011111: 3628: case 0b01100001: 3629: case 0b01100011: 3630: case 0b01100101: 3631: case 0b01100111: 3632: case 0b01101001: 3633: case 0b01101011: 3634: case 0b01101101: 3635: case 0b01101111: 3636: case 0b01110001: 3637: case 0b01110011: 3638: case 0b01110101: 3639: case 0b01110111: 3640: case 0b01111001: 3641: case 0b01111011: 3642: case 0b01111101: 3643: case 0b01111111: 3644: case 0b10000001: 3645: case 0b10000011: 3646: case 0b10000101: 3647: case 0b10000111: 3648: case 0b10001001: 3649: case 0b10001011: 3650: case 0b10001101: 3651: case 0b10001111: 3652: case 0b10010001: 3653: case 0b10010011: 3654: case 0b10010101: 3655: case 0b10010111: 3656: case 0b10011001: 3657: case 0b10011011: 3658: case 0b10011101: 3659: case 0b10011111: 3660: case 0b10100001: 3661: case 0b10100011: 3662: case 0b10100101: 3663: case 0b10100111: 3664: case 0b10101001: 3665: case 0b10101011: 3666: case 0b10101101: 3667: case 0b10101111: 3668: case 0b10110001: 3669: case 0b10110011: 3670: case 0b10110101: 3671: case 0b10110111: 3672: case 0b10111001: 3673: case 0b10111011: 3674: case 0b10111101: 3675: case 0b10111111: 3676: case 0b11000001: 3677: case 0b11000011: 3678: case 0b11000101: 3679: case 0b11000111: 3680: case 0b11001001: 3681: case 0b11001011: 3682: case 0b11001101: 3683: case 0b11001111: 3684: case 0b11010001: 3685: case 0b11010011: 3686: case 0b11010101: 3687: case 0b11010111: 3688: case 0b11011001: 3689: case 0b11011011: 3690: case 0b11011101: 3691: case 0b11011111: 3692: case 0b11100001: 3693: case 0b11100011: 3694: case 0b11100101: 3695: case 0b11100111: 3696: case 0b11101001: 3697: case 0b11101011: 3698: case 0b11101101: 3699: case 0b11101111: 3700: case 0b11110001: 3701: case 0b11110011: 3702: case 0b11110101: 3703: case 0b11110111: 3704: case 0b11111001: 3705: case 0b11111011: 3706: case 0b11111101: 3707: case 0b11111111: 3708: //レベル7 3709: XEiJ.mpuIRR &= ~XEiJ.MPU_SYS_INTERRUPT_MASK; //割り込みを受け付ける 3710: if ((t = XEiJ.sysAcknowledge ()) != 0) { //デバイスにベクタ番号を要求して割り込み処理中の状態になったとき 3711: irpInterrupt (t, XEiJ.MPU_SYS_INTERRUPT_LEVEL); //割り込み処理を開始する 3712: } 3713: break; 3714: case 0b00000010: 3715: case 0b00000110: 3716: case 0b00001010: 3717: case 0b00001110: 3718: case 0b00010010: 3719: case 0b00010110: 3720: case 0b00011010: 3721: case 0b00011110: 3722: case 0b00100010: 3723: case 0b00100110: 3724: case 0b00101010: 3725: case 0b00101110: 3726: case 0b00110010: 3727: case 0b00110110: 3728: case 0b00111010: 3729: case 0b00111110: 3730: case 0b01000010: 3731: case 0b01000110: 3732: case 0b01001010: 3733: case 0b01001110: 3734: case 0b01010010: 3735: case 0b01010110: 3736: case 0b01011010: 3737: case 0b01011110: 3738: case 0b01100010: 3739: case 0b01100110: 3740: case 0b01101010: 3741: case 0b01101110: 3742: case 0b01110010: 3743: case 0b01110110: 3744: case 0b01111010: 3745: case 0b01111110: 3746: case 0b10000010: 3747: case 0b10000110: 3748: case 0b10001010: 3749: case 0b10001110: 3750: case 0b10010010: 3751: case 0b10010110: 3752: case 0b10011010: 3753: case 0b10011110: 3754: case 0b10100010: 3755: case 0b10100110: 3756: case 0b10101010: 3757: case 0b10101110: 3758: case 0b10110010: 3759: case 0b10110110: 3760: case 0b10111010: 3761: case 0b10111110: 3762: case 0b11000010: 3763: case 0b11000110: 3764: case 0b11001010: 3765: case 0b11001110: 3766: case 0b11010010: 3767: case 0b11010110: 3768: case 0b11011010: 3769: case 0b11011110: 3770: case 0b11100010: 3771: case 0b11100110: 3772: case 0b11101010: 3773: case 0b11101110: 3774: case 0b11110010: 3775: case 0b11110110: 3776: case 0b11111010: 3777: case 0b11111110: 3778: //レベル6 3779: XEiJ.mpuIRR &= ~XEiJ.MPU_MFP_INTERRUPT_MASK; //割り込みを受け付ける 3780: if ((t = MC68901.mfpAcknowledge ()) != 0) { //デバイスにベクタ番号を要求して割り込み処理中の状態になったとき 3781: irpInterrupt (t, XEiJ.MPU_MFP_INTERRUPT_LEVEL); //割り込み処理を開始する 3782: } 3783: break; 3784: case 0b00000100: 3785: case 0b00001100: 3786: case 0b00010100: 3787: case 0b00011100: 3788: case 0b00100100: 3789: case 0b00101100: 3790: case 0b00110100: 3791: case 0b00111100: 3792: case 0b01000100: 3793: case 0b01001100: 3794: case 0b01010100: 3795: case 0b01011100: 3796: case 0b01100100: 3797: case 0b01101100: 3798: case 0b01110100: 3799: case 0b01111100: 3800: case 0b10000100: 3801: case 0b10001100: 3802: case 0b10010100: 3803: case 0b10011100: 3804: case 0b10100100: 3805: case 0b10101100: 3806: case 0b10110100: 3807: case 0b10111100: 3808: case 0b11000100: 3809: case 0b11001100: 3810: case 0b11010100: 3811: case 0b11011100: 3812: case 0b11100100: 3813: case 0b11101100: 3814: case 0b11110100: 3815: case 0b11111100: 3816: //レベル5 3817: XEiJ.mpuIRR &= ~XEiJ.MPU_SCC_INTERRUPT_MASK; //割り込みを受け付ける 3818: if ((t = Z8530.sccAcknowledge ()) != 0) { //デバイスにベクタ番号を要求して割り込み処理中の状態になったとき 3819: irpInterrupt (t, XEiJ.MPU_SCC_INTERRUPT_LEVEL); //割り込み処理を開始する 3820: } 3821: break; 3822: case 0b00010000: 3823: case 0b00110000: 3824: case 0b01010000: 3825: case 0b01110000: 3826: case 0b10010000: 3827: case 0b10110000: 3828: case 0b11010000: 3829: case 0b11110000: 3830: //レベル3 3831: XEiJ.mpuIRR &= ~XEiJ.MPU_DMA_INTERRUPT_MASK; //割り込みを受け付ける 3832: if ((t = HD63450.dmaAcknowledge ()) != 0) { //デバイスにベクタ番号を要求して割り込み処理中の状態になったとき 3833: irpInterrupt (t, XEiJ.MPU_DMA_INTERRUPT_LEVEL); //割り込み処理を開始する 3834: } 3835: break; 3836: case 0b00100000: 3837: case 0b01100000: 3838: case 0b10100000: 3839: case 0b11100000: 3840: //レベル2 3841: XEiJ.mpuIRR &= ~XEiJ.MPU_EB2_INTERRUPT_MASK; //割り込みを受け付ける 3842: if ((t = XEiJ.eb2Acknowledge ()) != 0) { //デバイスにベクタ番号を要求して割り込み処理中の状態になったとき 3843: irpInterrupt (t, XEiJ.MPU_EB2_INTERRUPT_LEVEL); //割り込み処理を開始する 3844: } 3845: break; 3846: case 0b01000000: 3847: case 0b11000000: 3848: //レベル1 3849: XEiJ.mpuIRR &= ~XEiJ.MPU_IOI_INTERRUPT_MASK; //割り込みを受け付ける 3850: if ((t = IOInterrupt.ioiAcknowledge ()) != 0) { //デバイスにベクタ番号を要求して割り込み処理中の状態になったとき 3851: irpInterrupt (t, XEiJ.MPU_IOI_INTERRUPT_LEVEL); //割り込み処理を開始する 3852: } 3853: break; 3854: } 3855: } else { 3856: t &= -t; 3857: // x&=-xはxの最下位の1のビットだけを残す演算 3858: // すなわちマスクされているレベルよりも高くて受け付けていない割り込みの中で最高レベルの割り込みのビットだけが残る 3859: // 最高レベルの割り込みのビットしか残っていないので、割り込みの有無をレベルの高い順ではなく使用頻度の高い順に調べられる 3860: // MFPやDMAの割り込みがかかる度にそれより優先度の高いインタラプトスイッチが押されていないかどうかを確かめる必要がない 3861: if (t == XEiJ.MPU_MFP_INTERRUPT_MASK) { 3862: XEiJ.mpuIRR &= ~XEiJ.MPU_MFP_INTERRUPT_MASK; //割り込みを受け付ける 3863: if ((t = MC68901.mfpAcknowledge ()) != 0) { //デバイスにベクタ番号を要求して割り込み処理中の状態になったとき 3864: irpInterrupt (t, XEiJ.MPU_MFP_INTERRUPT_LEVEL); //割り込み処理を開始する 3865: } 3866: } else if (t == XEiJ.MPU_DMA_INTERRUPT_MASK) { 3867: XEiJ.mpuIRR &= ~XEiJ.MPU_DMA_INTERRUPT_MASK; //割り込みを受け付ける 3868: if ((t = HD63450.dmaAcknowledge ()) != 0) { //デバイスにベクタ番号を要求して割り込み処理中の状態になったとき 3869: irpInterrupt (t, XEiJ.MPU_DMA_INTERRUPT_LEVEL); //割り込み処理を開始する 3870: } 3871: } else if (t == XEiJ.MPU_SCC_INTERRUPT_MASK) { 3872: XEiJ.mpuIRR &= ~XEiJ.MPU_SCC_INTERRUPT_MASK; //割り込みを受け付ける 3873: if ((t = Z8530.sccAcknowledge ()) != 0) { //デバイスにベクタ番号を要求して割り込み処理中の状態になったとき 3874: irpInterrupt (t, XEiJ.MPU_SCC_INTERRUPT_LEVEL); //割り込み処理を開始する 3875: } 3876: } else if (t == XEiJ.MPU_IOI_INTERRUPT_MASK) { 3877: XEiJ.mpuIRR &= ~XEiJ.MPU_IOI_INTERRUPT_MASK; //割り込みを受け付ける 3878: if ((t = IOInterrupt.ioiAcknowledge ()) != 0) { //デバイスにベクタ番号を要求して割り込み処理中の状態になったとき 3879: irpInterrupt (t, XEiJ.MPU_IOI_INTERRUPT_LEVEL); //割り込み処理を開始する 3880: } 3881: } else if (t == XEiJ.MPU_EB2_INTERRUPT_MASK) { 3882: XEiJ.mpuIRR &= ~XEiJ.MPU_EB2_INTERRUPT_MASK; //割り込みを受け付ける 3883: if ((t = XEiJ.eb2Acknowledge ()) != 0) { //デバイスにベクタ番号を要求して割り込み処理中の状態になったとき 3884: irpInterrupt (t, XEiJ.MPU_EB2_INTERRUPT_LEVEL); //割り込み処理を開始する 3885: } 3886: } else if (t == XEiJ.MPU_SYS_INTERRUPT_MASK) { 3887: XEiJ.mpuIRR &= ~XEiJ.MPU_SYS_INTERRUPT_MASK; //割り込みを受け付ける 3888: if ((t = XEiJ.sysAcknowledge ()) != 0) { //デバイスにベクタ番号を要求して割り込み処理中の状態になったとき 3889: irpInterrupt (t, XEiJ.MPU_SYS_INTERRUPT_LEVEL); //割り込み処理を開始する 3890: } 3891: } 3892: } 3893: } //if t!=0 3894: if (MC68901.MFP_DELAYED_INTERRUPT) { 3895: XEiJ.mpuIRR |= XEiJ.mpuDIRR; //遅延割り込み要求 3896: XEiJ.mpuDIRR = 0; 3897: } 3898: } //命令ループ 3899: } catch (M68kException e) { 3900: if (M68kException.m6eNumber == M68kException.M6E_WAIT_EXCEPTION) { //待機例外 3901: if (irpWaitException ()) { 3902: continue; 3903: } else { 3904: break errorLoop; 3905: } 3906: } 3907: if (M68kException.m6eNumber == M68kException.M6E_INSTRUCTION_BREAK_POINT) { //命令ブレークポイントによる停止 3908: XEiJ.regPC = XEiJ.regPC0; 3909: XEiJ.mpuStop1 (null); //"Instruction Break Point" 3910: break errorLoop; 3911: } 3912: XEiJ.mpuClockTime += XEiJ.mpuModifiedUnit * XEiJ.mpuCycleCount; 3913: //例外処理 3914: // ここで処理するのはベクタ番号が2~31の例外に限る。TRAP #n命令はインライン展開する 3915: // 使用頻度が高いと思われる例外はインライン展開するのでここには来ない 3916: // 例外処理をインライン展開する場合はMC68000とMC68030のコードを分けなければならずコードが冗長になる 3917: // 使用頻度が低いと思われる例外はインライン展開しない 3918: // セーブされるpcは以下の例外は命令の先頭、これ以外は次の命令 3919: // 2 BUS_ERROR 3920: // 3 ADDRESS_ERROR 3921: // 4 ILLEGAL_INSTRUCTION 3922: // 8 PRIVILEGE_VIOLATION 3923: // 10 LINE_1010_EMULATOR 3924: // 11 LINE_1111_EMULATOR 3925: // fedcba9876543210fedcba9876543210 3926: //if ((1 << M68kException.m6eNumber & 0b00000000000000000000110100011100) != 0) { 3927: // 0123456789abcdef0123456789abcdef 3928: if (0b00111000101100000000000000000000 << M68kException.m6eNumber < 0) { 3929: XEiJ.regPC = XEiJ.regPC0; //セーブされるpcは命令の先頭 3930: } 3931: try { 3932: int save_sr = XEiJ.regSRT1 | XEiJ.regSRS | XEiJ.regSRI | XEiJ.regCCR; 3933: int sp = XEiJ.regRn[15]; 3934: XEiJ.regSRT1 = 0; //srのTビットを消す 3935: if (XEiJ.regSRS == 0) { //ユーザモードのとき 3936: XEiJ.regSRS = XEiJ.REG_SR_S; //スーパーバイザモードへ移行する 3937: XEiJ.mpuUSP = sp; //USPを保存 3938: sp = XEiJ.mpuISP; //SSPを復元 3939: if (DataBreakPoint.DBP_ON) { 3940: DataBreakPoint.dbpMemoryMap = DataBreakPoint.dbpSuperMap; //スーパーバイザメモリマップに切り替える 3941: } else { 3942: XEiJ.busMemoryMap = XEiJ.busSuperMap; //スーパーバイザメモリマップに切り替える 3943: } 3944: if (InstructionBreakPoint.IBP_ON) { 3945: InstructionBreakPoint.ibpOp1MemoryMap = InstructionBreakPoint.ibpOp1SuperMap; 3946: } 3947: } 3948: if (M68kException.m6eNumber <= M68kException.M6E_ADDRESS_ERROR) { //バスエラーまたはアドレスエラー 3949: //ホストファイルシステムのデバイスコマンドを強制終了させる 3950: HFS.hfsState = HFS.HFS_STATE_IDLE; 3951: XEiJ.mpuClockTime += 50 * XEiJ.mpuModifiedUnit; 3952: XEiJ.regRn[15] = sp -= 14; 3953: XEiJ.busWl (sp + 10, XEiJ.regPC); //pushl。pcをプッシュする 3954: XEiJ.busWw (sp + 8, save_sr); //pushw。srをプッシュする 3955: XEiJ.busWw (sp + 6, XEiJ.regOC); //instruction register。バスエラーまたはアドレスエラーを発生させた命令の命令コード。アドレスを特定するときに使う 3956: XEiJ.busWl (sp + 2, M68kException.m6eAddress); //access address 3957: XEiJ.busWw (sp, M68kException.m6eDirection << 4); //r/w,i/n,fc。r/wのみ 3958: } else { 3959: XEiJ.regRn[15] = sp -= 6; 3960: XEiJ.busWl (sp + 2, XEiJ.regPC); //pushl。pcをプッシュする 3961: XEiJ.busWw (sp, save_sr); //pushw。srをプッシュする 3962: } 3963: irpSetPC (XEiJ.busRlsf (M68kException.m6eNumber << 2)); //例外ベクタを取り出してジャンプする 3964: if (XEiJ.dbgStopOnError) { //エラーで停止する場合 3965: if (XEiJ.dbgDoStopOnError ()) { 3966: break errorLoop; 3967: } 3968: } 3969: } catch (M68kException ee) { //ダブルバスフォルト 3970: XEiJ.dbgDoubleBusFault (); 3971: break errorLoop; 3972: } 3973: } //catch M68kException 3974: } //例外ループ 3975: 3976: // 通常 3977: // pc0 最後に実行した命令 3978: // pc 次に実行する命令 3979: // バスエラー、アドレスエラー、不当命令、特権違反で停止したとき 3980: // pc0 エラーを発生させた命令 3981: // pc 例外処理ルーチンの先頭 3982: // ダブルバスフォルトで停止したとき 3983: // pc0 エラーを発生させた命令 3984: // pc エラーを発生させた命令 3985: // 命令ブレークポイントで停止したとき 3986: // pc0 命令ブレークポイントが設定された、次に実行する命令 3987: // pc 命令ブレークポイントが設定された、次に実行する命令 3988: // データブレークポイントで停止したとき 3989: // pc0 データを書き換えた、最後に実行した命令 3990: // pc 次に実行する命令 3991: 3992: //分岐ログに停止レコードを記録する 3993: if (BranchLog.BLG_ON) { 3994: //BranchLog.blgStop (); 3995: int i = (char) BranchLog.blgNewestRecord << BranchLog.BLG_RECORD_SHIFT; 3996: BranchLog.blgArray[i] = BranchLog.blgHead | BranchLog.blgSuper; 3997: BranchLog.blgArray[i + 1] = XEiJ.regPC; //次に実行する命令 3998: } 3999: 4000: } //mpuCore() 4001: 4002: 4003: 4004: //cont = irpWaitException () 4005: // 待機例外をキャッチしたとき 4006: public static boolean irpWaitException () { 4007: XEiJ.regPC = XEiJ.regPC0; //PCを巻き戻す 4008: XEiJ.regRn[8 + (XEiJ.regOC & 7)] += WaitInstruction.REWIND_AR[XEiJ.regOC >> 3]; //(Ar)+|-(Ar)で変化したArを巻き戻す 4009: try { 4010: //トレース例外を処理する 4011: if (XEiJ.mpuTraceFlag != 0) { //命令実行前にsrのTビットがセットされていた 4012: XEiJ.mpuCycleCount += 34; 4013: irpException (M68kException.M6E_TRACE, XEiJ.regPC, XEiJ.regSRT1 | XEiJ.regSRS | XEiJ.regSRI | XEiJ.regCCR); //pcは次の命令 4014: } 4015: //デバイスを呼び出す 4016: TickerQueue.tkqRun (XEiJ.mpuClockTime); 4017: //割り込みを受け付ける 4018: int t; 4019: if ((t = XEiJ.mpuIMR & XEiJ.mpuIRR) != 0) { //マスクされているレベルよりも高くて受け付けていない割り込みがあるとき 4020: t &= -t; 4021: // x&=-xはxの最下位の1のビットだけを残す演算 4022: // すなわちマスクされているレベルよりも高くて受け付けていない割り込みの中で最高レベルの割り込みのビットだけが残る 4023: // 最高レベルの割り込みのビットしか残っていないので、割り込みの有無をレベルの高い順ではなく使用頻度の高い順に調べられる 4024: // MFPやDMAの割り込みがかかる度にそれより優先度の高いインタラプトスイッチが押されていないかどうかを確かめる必要がない 4025: if (t == XEiJ.MPU_MFP_INTERRUPT_MASK) { 4026: XEiJ.mpuIRR &= ~XEiJ.MPU_MFP_INTERRUPT_MASK; //割り込みを受け付ける 4027: if ((t = MC68901.mfpAcknowledge ()) != 0) { //デバイスにベクタ番号を要求して割り込み処理中の状態になったとき 4028: irpInterrupt (t, XEiJ.MPU_MFP_INTERRUPT_LEVEL); //割り込み処理を開始する 4029: } 4030: } else if (t == XEiJ.MPU_DMA_INTERRUPT_MASK) { 4031: XEiJ.mpuIRR &= ~XEiJ.MPU_DMA_INTERRUPT_MASK; //割り込みを受け付ける 4032: if ((t = HD63450.dmaAcknowledge ()) != 0) { //デバイスにベクタ番号を要求して割り込み処理中の状態になったとき 4033: irpInterrupt (t, XEiJ.MPU_DMA_INTERRUPT_LEVEL); //割り込み処理を開始する 4034: } 4035: } else if (t == XEiJ.MPU_SCC_INTERRUPT_MASK) { 4036: XEiJ.mpuIRR &= ~XEiJ.MPU_SCC_INTERRUPT_MASK; //割り込みを受け付ける 4037: if ((t = Z8530.sccAcknowledge ()) != 0) { //デバイスにベクタ番号を要求して割り込み処理中の状態になったとき 4038: irpInterrupt (t, XEiJ.MPU_SCC_INTERRUPT_LEVEL); //割り込み処理を開始する 4039: } 4040: } else if (t == XEiJ.MPU_IOI_INTERRUPT_MASK) { 4041: XEiJ.mpuIRR &= ~XEiJ.MPU_IOI_INTERRUPT_MASK; //割り込みを受け付ける 4042: if ((t = IOInterrupt.ioiAcknowledge ()) != 0) { //デバイスにベクタ番号を要求して割り込み処理中の状態になったとき 4043: irpInterrupt (t, XEiJ.MPU_IOI_INTERRUPT_LEVEL); //割り込み処理を開始する 4044: } 4045: } else if (t == XEiJ.MPU_EB2_INTERRUPT_MASK) { 4046: XEiJ.mpuIRR &= ~XEiJ.MPU_EB2_INTERRUPT_MASK; //割り込みを受け付ける 4047: if ((t = XEiJ.eb2Acknowledge ()) != 0) { //デバイスにベクタ番号を要求して割り込み処理中の状態になったとき 4048: irpInterrupt (t, XEiJ.MPU_EB2_INTERRUPT_LEVEL); //割り込み処理を開始する 4049: } 4050: } else if (t == XEiJ.MPU_SYS_INTERRUPT_MASK) { 4051: XEiJ.mpuIRR &= ~XEiJ.MPU_SYS_INTERRUPT_MASK; //割り込みを受け付ける 4052: if ((t = XEiJ.sysAcknowledge ()) != 0) { //デバイスにベクタ番号を要求して割り込み処理中の状態になったとき 4053: irpInterrupt (t, XEiJ.MPU_SYS_INTERRUPT_LEVEL); //割り込み処理を開始する 4054: } 4055: } 4056: } //if t!=0 4057: if (MC68901.MFP_DELAYED_INTERRUPT) { 4058: XEiJ.mpuIRR |= XEiJ.mpuDIRR; //遅延割り込み要求 4059: XEiJ.mpuDIRR = 0; 4060: } 4061: } catch (M68kException e) { 4062: //!!! 待機例外処理中のバスエラーの処理は省略 4063: XEiJ.dbgDoubleBusFault (); 4064: return false; 4065: } //catch M68kException 4066: return true; 4067: } //irpWaitException 4068: 4069: 4070: 4071: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4072: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4073: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4074: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4075: //ORI.B #<data>,<ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0000_000_000_mmm_rrr-{data} 4076: //OR.B #<data>,<ea> |A|012346|-|-UUUU|-**00| M+-WXZ |0000_000_000_mmm_rrr-{data} [ORI.B #<data>,<ea>] 4077: //ORI.B #<data>,CCR |-|012346|-|*****|*****| |0000_000_000_111_100-{data} 4078: public static void irpOriByte () throws M68kException { 4079: int ea = XEiJ.regOC & 63; 4080: int z; 4081: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4082: z = XEiJ.busRbs ((XEiJ.regPC += 2) - 1); //pcbs 4083: } else { 4084: z = XEiJ.regPC; 4085: XEiJ.regPC = z + 2; 4086: z = XEiJ.busRbs (z + 1); //pcbs 4087: } 4088: if (ea < XEiJ.EA_AR) { //ORI.B #<data>,Dr 4089: if (XEiJ.DBG_ORI_BYTE_ZERO_D0) { 4090: if (z == 0 && ea == 0 && XEiJ.dbgOriByteZeroD0) { //ORI.B #$00,D0 4091: XEiJ.mpuCycleCount += 34; 4092: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 4093: throw M68kException.m6eSignal; 4094: } 4095: } 4096: XEiJ.mpuCycleCount += 8; 4097: z = XEiJ.regRn[ea] |= 255 & z; //0拡張してからOR 4098: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.MPU_TSTB_TABLE[255 & z]; //ccr_tst_byte 4099: } else if (ea == XEiJ.EA_IM) { //ORI.B #<data>,CCR 4100: XEiJ.mpuCycleCount += 20; 4101: XEiJ.regCCR |= XEiJ.REG_CCR_MASK & z; 4102: } else { //ORI.B #<data>,<mem> 4103: XEiJ.mpuCycleCount += 12; 4104: int a = efaMltByte (ea); 4105: XEiJ.busWb (a, z |= XEiJ.busRbs (a)); 4106: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.MPU_TSTB_TABLE[255 & z]; //ccr_tst_byte 4107: } 4108: } //irpOriByte 4109: 4110: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4111: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4112: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4113: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4114: //ORI.W #<data>,<ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0000_000_001_mmm_rrr-{data} 4115: //OR.W #<data>,<ea> |A|012346|-|-UUUU|-**00| M+-WXZ |0000_000_001_mmm_rrr-{data} [ORI.W #<data>,<ea>] 4116: //ORI.W #<data>,SR |-|012346|P|*****|*****| |0000_000_001_111_100-{data} 4117: public static void irpOriWord () throws M68kException { 4118: int ea = XEiJ.regOC & 63; 4119: if (ea < XEiJ.EA_AR) { //ORI.W #<data>,Dr 4120: int z; 4121: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4122: z = XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 4123: } else { 4124: z = XEiJ.regPC; 4125: XEiJ.regPC = z + 2; 4126: z = XEiJ.busRwse (z); //pcws 4127: } 4128: XEiJ.mpuCycleCount += 8; 4129: z = XEiJ.regRn[ea] |= (char) z; //0拡張してからOR 4130: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | (char) z - 1 >> 31 & XEiJ.REG_CCR_Z | ((short) z < 0 ? XEiJ.REG_CCR_N : 0); //ccr_tst_word 4131: } else if (ea == XEiJ.EA_IM) { //ORI.W #<data>,SR 4132: if (XEiJ.regSRS == 0) { //ユーザモードのとき 4133: XEiJ.mpuCycleCount += 34; 4134: M68kException.m6eNumber = M68kException.M6E_PRIVILEGE_VIOLATION; 4135: throw M68kException.m6eSignal; 4136: } 4137: //以下はスーパーバイザモード 4138: XEiJ.mpuCycleCount += 20; 4139: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4140: irpSetSR (XEiJ.regSRT1 | XEiJ.regSRS | XEiJ.regSRI | XEiJ.regCCR | XEiJ.busRwse ((XEiJ.regPC += 2) - 2)); //pcws。特権違反チェックが先 4141: } else { 4142: int t = XEiJ.regPC; 4143: XEiJ.regPC = t + 2; 4144: irpSetSR (XEiJ.regSRT1 | XEiJ.regSRS | XEiJ.regSRI | XEiJ.regCCR | XEiJ.busRwse (t)); //pcws。特権違反チェックが先 4145: } 4146: } else { //ORI.W #<data>,<mem> 4147: int z; 4148: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4149: z = XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 4150: } else { 4151: z = XEiJ.regPC; 4152: XEiJ.regPC = z + 2; 4153: z = XEiJ.busRwse (z); //pcws 4154: } 4155: XEiJ.mpuCycleCount += 12; 4156: int a = efaMltWord (ea); 4157: XEiJ.busWw (a, z |= XEiJ.busRws (a)); 4158: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | (char) z - 1 >> 31 & XEiJ.REG_CCR_Z | ((short) z < 0 ? XEiJ.REG_CCR_N : 0); //ccr_tst_word 4159: } 4160: } //irpOriWord 4161: 4162: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4163: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4164: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4165: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4166: //ORI.L #<data>,<ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0000_000_010_mmm_rrr-{data} 4167: //OR.L #<data>,<ea> |A|012346|-|-UUUU|-**00| M+-WXZ |0000_000_010_mmm_rrr-{data} [ORI.L #<data>,<ea>] 4168: public static void irpOriLong () throws M68kException { 4169: int ea = XEiJ.regOC & 63; 4170: int y; 4171: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4172: y = XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 4173: } else { 4174: y = XEiJ.regPC; 4175: XEiJ.regPC = y + 4; 4176: y = XEiJ.busRlse (y); //pcls 4177: } 4178: int z; 4179: if (ea < XEiJ.EA_AR) { //ORI.L #<data>,Dr 4180: XEiJ.mpuCycleCount += 16; 4181: z = XEiJ.regRn[ea] |= y; 4182: } else { //ORI.L #<data>,<mem> 4183: XEiJ.mpuCycleCount += 20; 4184: int a = efaMltLong (ea); 4185: XEiJ.busWl (a, z = XEiJ.busRls (a) | y); 4186: } 4187: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 4188: } //irpOriLong 4189: 4190: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4191: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4192: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4193: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4194: //BITREV.L Dr |-|------|-|-----|-----|D |0000_000_011_000_rrr (ISA_C) 4195: // 4196: //BITREV.L Dr 4197: // Drのビットの並びを逆順にする。CCRは変化しない 4198: public static void irpCmp2Chk2Byte () throws M68kException { 4199: int ea = XEiJ.regOC & 63; 4200: if (ea < XEiJ.EA_AR) { //BITREV.L Dr 4201: XEiJ.mpuCycleCount += 4; 4202: if (XEiJ.IRP_BITREV_REVERSE) { //2.83ns 0x0f801f3c 4203: XEiJ.regRn[ea] = Integer.reverse (XEiJ.regRn[ea]); 4204: } else if (XEiJ.IRP_BITREV_SHIFT) { //2.57ns 0x0f801f3c 4205: int x = XEiJ.regRn[ea]; 4206: x = x << 16 | x >>> 16; 4207: x = x << 8 & 0xff00ff00 | x >>> 8 & 0x00ff00ff; 4208: x = x << 4 & 0xf0f0f0f0 | x >>> 4 & 0x0f0f0f0f; 4209: x = x << 2 & 0xcccccccc | x >>> 2 & 0x33333333; 4210: XEiJ.regRn[ea] = x << 1 & 0xaaaaaaaa | x >>> 1 & 0x55555555; 4211: } else if (XEiJ.IRP_BITREV_TABLE) { //1.57ns 0x0f801f3c 4212: int x = XEiJ.regRn[ea]; 4213: XEiJ.regRn[ea] = XEiJ.MPU_BITREV_TABLE_0[x & 2047] | XEiJ.MPU_BITREV_TABLE_1[x << 10 >>> 21] | XEiJ.MPU_BITREV_TABLE_2[x >>> 22]; 4214: } 4215: } else { //CMP2/CHK2.B <ea>,Rn 4216: //プロセッサの判別に使われることがあるのでMC68000ではCMP2/CHK2をエラーにしなければならない 4217: XEiJ.mpuCycleCount += 34; 4218: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 4219: throw M68kException.m6eSignal; 4220: } 4221: } //irpCmp2Chk2Byte 4222: 4223: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4224: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4225: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4226: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4227: //BTST.L Dq,Dr |-|012346|-|--U--|--*--|D |0000_qqq_100_000_rrr 4228: //MOVEP.W (d16,Ar),Dq |-|01234S|-|-----|-----| |0000_qqq_100_001_rrr-{data} 4229: //BTST.B Dq,<ea> |-|012346|-|--U--|--*--| M+-WXZPI|0000_qqq_100_mmm_rrr 4230: public static void irpBtstReg () throws M68kException { 4231: int ea = XEiJ.regOC & 63; 4232: int qqq = XEiJ.regOC >> 9; //qqq 4233: if (ea >> 3 == XEiJ.MMM_AR) { //MOVEP.W (d16,Ar),Dq 4234: XEiJ.mpuCycleCount += 16; 4235: int a; 4236: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4237: a = XEiJ.regRn[ea] + XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws。このr[ea]はアドレスレジスタ 4238: } else { 4239: a = XEiJ.regPC; 4240: XEiJ.regPC = a + 2; 4241: a = XEiJ.regRn[ea] + XEiJ.busRwse (a); //pcws。このr[ea]はアドレスレジスタ 4242: } 4243: XEiJ.regRn[qqq] = ~0xffff & XEiJ.regRn[qqq] | XEiJ.busRbz (a) << 8 | XEiJ.busRbz (a + 2); //Javaは評価順序が保証されている 4244: } else { //BTST.L Dq,Dr/<ea> 4245: int y = XEiJ.regRn[qqq]; 4246: if (ea < XEiJ.EA_AR) { //BTST.L Dq,Dr 4247: XEiJ.mpuCycleCount += 6; 4248: XEiJ.regCCR = XEiJ.regCCR & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_N | XEiJ.REG_CCR_V | XEiJ.REG_CCR_C) | (~XEiJ.regRn[ea] >>> y & 1) << 2; //ccr_btst。intのシフトは5bitでマスクされるので&31を省略 4249: } else { //BTST.B Dq,<ea> 4250: XEiJ.mpuCycleCount += 4; 4251: XEiJ.regCCR = XEiJ.regCCR & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_N | XEiJ.REG_CCR_V | XEiJ.REG_CCR_C) | (~XEiJ.busRbs (efaAnyByte (ea)) >>> (y & 7) & 1) << 2; //ccr_btst 4252: } 4253: } 4254: } //irpBtstReg 4255: 4256: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4257: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4258: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4259: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4260: //BCHG.L Dq,Dr |-|012346|-|--U--|--*--|D |0000_qqq_101_000_rrr 4261: //MOVEP.L (d16,Ar),Dq |-|01234S|-|-----|-----| |0000_qqq_101_001_rrr-{data} 4262: //BCHG.B Dq,<ea> |-|012346|-|--U--|--*--| M+-WXZ |0000_qqq_101_mmm_rrr 4263: public static void irpBchgReg () throws M68kException { 4264: int ea = XEiJ.regOC & 63; 4265: int qqq = XEiJ.regOC >> 9; //qqq 4266: if (ea >> 3 == XEiJ.MMM_AR) { //MOVEP.L (d16,Ar),Dq 4267: XEiJ.mpuCycleCount += 24; 4268: int a; 4269: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4270: a = XEiJ.regRn[ea] + XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws。このr[ea]はアドレスレジスタ 4271: } else { 4272: a = XEiJ.regPC; 4273: XEiJ.regPC = a + 2; 4274: a = XEiJ.regRn[ea] + XEiJ.busRwse (a); //pcws。このr[ea]はアドレスレジスタ 4275: } 4276: XEiJ.regRn[qqq] = XEiJ.busRbs (a) << 24 | XEiJ.busRbz (a + 2) << 16 | XEiJ.busRbz (a + 4) << 8 | XEiJ.busRbz (a + 6); //Javaは評価順序が保証されている 4277: } else { //BCHG.L Dq,Dr/<ea> 4278: int x; 4279: int y = XEiJ.regRn[qqq]; 4280: if (ea < XEiJ.EA_AR) { //BCHG.L Dq,Dr 4281: XEiJ.regRn[ea] = (x = XEiJ.regRn[ea]) ^ (y = 1 << y); //intのシフトは5bitでマスクされるので1<<(y&0x1f)の&0x1fを省略 4282: XEiJ.mpuCycleCount += (char) y != 0 ? 6 : 8; //(0xffff&y)!=0 4283: } else { //BCHG.B Dq,<ea> 4284: XEiJ.mpuCycleCount += 8; 4285: int a = efaMltByte (ea); 4286: XEiJ.busWb (a, (x = XEiJ.busRbs (a)) ^ (y = 1 << (y & 7))); 4287: } 4288: XEiJ.regCCR = XEiJ.regCCR & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_N | XEiJ.REG_CCR_V | XEiJ.REG_CCR_C) | (x & y) - 1 >>> 31 << 2; //ccr_btst 4289: } 4290: } //irpBchgReg 4291: 4292: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4293: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4294: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4295: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4296: //BCLR.L Dq,Dr |-|012346|-|--U--|--*--|D |0000_qqq_110_000_rrr 4297: //MOVEP.W Dq,(d16,Ar) |-|01234S|-|-----|-----| |0000_qqq_110_001_rrr-{data} 4298: //BCLR.B Dq,<ea> |-|012346|-|--U--|--*--| M+-WXZ |0000_qqq_110_mmm_rrr 4299: public static void irpBclrReg () throws M68kException { 4300: int ea = XEiJ.regOC & 63; 4301: int y = XEiJ.regRn[XEiJ.regOC >> 9]; //qqq 4302: if (ea >> 3 == XEiJ.MMM_AR) { //MOVEP.W Dq,(d16,Ar) 4303: XEiJ.mpuCycleCount += 16; 4304: int a; 4305: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4306: a = XEiJ.regRn[ea] + XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws。このr[ea]はアドレスレジスタ 4307: } else { 4308: a = XEiJ.regPC; 4309: XEiJ.regPC = a + 2; 4310: a = XEiJ.regRn[ea] + XEiJ.busRwse (a); //pcws。このr[ea]はアドレスレジスタ 4311: } 4312: XEiJ.busWb (a, y >> 8); 4313: XEiJ.busWb (a + 2, y); 4314: } else { //BCLR.L Dq,Dr/<ea> 4315: int x; 4316: if (ea < XEiJ.EA_AR) { //BCLR.L Dq,Dr 4317: XEiJ.regRn[ea] = (x = XEiJ.regRn[ea]) & ~(y = 1 << y); //intのシフトは5bitでマスクされるので1<<(y&0x1f)の&0x1fを省略 4318: XEiJ.mpuCycleCount += (char) y != 0 ? 8 : 10; //(0xffff&y)!=0 4319: } else { //BCLR.B Dq,<ea> 4320: XEiJ.mpuCycleCount += 8; 4321: int a = efaMltByte (ea); 4322: XEiJ.busWb (a, (x = XEiJ.busRbs (a)) & ~(y = 1 << (y & 7))); 4323: } 4324: XEiJ.regCCR = XEiJ.regCCR & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_N | XEiJ.REG_CCR_V | XEiJ.REG_CCR_C) | (x & y) - 1 >>> 31 << 2; //ccr_btst 4325: } 4326: } //irpBclrReg 4327: 4328: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4329: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4330: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4331: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4332: //BSET.L Dq,Dr |-|012346|-|--U--|--*--|D |0000_qqq_111_000_rrr 4333: //MOVEP.L Dq,(d16,Ar) |-|01234S|-|-----|-----| |0000_qqq_111_001_rrr-{data} 4334: //BSET.B Dq,<ea> |-|012346|-|--U--|--*--| M+-WXZ |0000_qqq_111_mmm_rrr 4335: public static void irpBsetReg () throws M68kException { 4336: int ea = XEiJ.regOC & 63; 4337: int y = XEiJ.regRn[XEiJ.regOC >> 9]; //qqq 4338: if (ea >> 3 == XEiJ.MMM_AR) { //MOVEP.L Dq,(d16,Ar) 4339: XEiJ.mpuCycleCount += 24; 4340: int a; 4341: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4342: a = XEiJ.regRn[ea] + XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws。このr[ea]はアドレスレジスタ 4343: } else { 4344: a = XEiJ.regPC; 4345: XEiJ.regPC = a + 2; 4346: a = XEiJ.regRn[ea] + XEiJ.busRwse (a); //pcws。このr[ea]はアドレスレジスタ 4347: } 4348: XEiJ.busWb (a, y >> 24); 4349: XEiJ.busWb (a + 2, y >> 16); 4350: XEiJ.busWb (a + 4, y >> 8); 4351: XEiJ.busWb (a + 6, y); 4352: } else { //BSET.L Dq,Dr/<ea> 4353: int x; 4354: if (ea < XEiJ.EA_AR) { //BSET.L Dq,Dr 4355: XEiJ.regRn[ea] = (x = XEiJ.regRn[ea]) | (y = 1 << y); //intのシフトは5bitでマスクされるので1<<(y&0x1f)の&0x1fを省略 4356: XEiJ.mpuCycleCount += (char) y != 0 ? 6 : 8; //(0xffff&y)!=0 4357: } else { //BSET.B Dq,<ea> 4358: XEiJ.mpuCycleCount += 8; 4359: int a = efaMltByte (ea); 4360: XEiJ.busWb (a, (x = XEiJ.busRbs (a)) | (y = 1 << (y & 7))); 4361: } 4362: XEiJ.regCCR = XEiJ.regCCR & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_N | XEiJ.REG_CCR_V | XEiJ.REG_CCR_C) | (x & y) - 1 >>> 31 << 2; //ccr_btst 4363: } 4364: } //irpBsetReg 4365: 4366: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4367: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4368: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4369: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4370: //ANDI.B #<data>,<ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0000_001_000_mmm_rrr-{data} 4371: //AND.B #<data>,<ea> |A|012346|-|-UUUU|-**00| M+-WXZ |0000_001_000_mmm_rrr-{data} [ANDI.B #<data>,<ea>] 4372: //ANDI.B #<data>,CCR |-|012346|-|*****|*****| |0000_001_000_111_100-{data} 4373: public static void irpAndiByte () throws M68kException { 4374: int ea = XEiJ.regOC & 63; 4375: int z; 4376: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4377: z = XEiJ.busRbs ((XEiJ.regPC += 2) - 1); //pcbs 4378: } else { 4379: z = XEiJ.regPC; 4380: XEiJ.regPC = z + 2; 4381: z = XEiJ.busRbs (z + 1); //pcbs 4382: } 4383: if (ea < XEiJ.EA_AR) { //ANDI.B #<data>,Dr 4384: XEiJ.mpuCycleCount += 8; 4385: z = XEiJ.regRn[ea] &= ~255 | z; //1拡張してからAND 4386: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.MPU_TSTB_TABLE[255 & z]; //ccr_tst_byte 4387: } else if (ea == XEiJ.EA_IM) { //ANDI.B #<data>,CCR 4388: XEiJ.mpuCycleCount += 20; 4389: XEiJ.regCCR &= z; 4390: } else { //ANDI.B #<data>,<mem> 4391: XEiJ.mpuCycleCount += 12; 4392: int a = efaMltByte (ea); 4393: XEiJ.busWb (a, z &= XEiJ.busRbs (a)); 4394: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.MPU_TSTB_TABLE[255 & z]; //ccr_tst_byte 4395: } 4396: } //irpAndiByte 4397: 4398: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4399: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4400: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4401: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4402: //ANDI.W #<data>,<ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0000_001_001_mmm_rrr-{data} 4403: //AND.W #<data>,<ea> |A|012346|-|-UUUU|-**00| M+-WXZ |0000_001_001_mmm_rrr-{data} [ANDI.W #<data>,<ea>] 4404: //ANDI.W #<data>,SR |-|012346|P|*****|*****| |0000_001_001_111_100-{data} 4405: public static void irpAndiWord () throws M68kException { 4406: int ea = XEiJ.regOC & 63; 4407: if (ea < XEiJ.EA_AR) { //ANDI.W #<data>,Dr 4408: int z; 4409: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4410: z = XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 4411: } else { 4412: z = XEiJ.regPC; 4413: XEiJ.regPC = z + 2; 4414: z = XEiJ.busRwse (z); //pcws 4415: } 4416: XEiJ.mpuCycleCount += 8; 4417: z = XEiJ.regRn[ea] &= ~65535 | z; //1拡張してからAND 4418: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | (char) z - 1 >> 31 & XEiJ.REG_CCR_Z | ((short) z < 0 ? XEiJ.REG_CCR_N : 0); //ccr_tst_word 4419: } else if (ea == XEiJ.EA_IM) { //ANDI.W #<data>,SR 4420: if (XEiJ.regSRS == 0) { //ユーザモードのとき 4421: XEiJ.mpuCycleCount += 34; 4422: M68kException.m6eNumber = M68kException.M6E_PRIVILEGE_VIOLATION; 4423: throw M68kException.m6eSignal; 4424: } 4425: //以下はスーパーバイザモード 4426: XEiJ.mpuCycleCount += 20; 4427: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4428: irpSetSR ((XEiJ.regSRT1 | XEiJ.regSRS | XEiJ.regSRI | XEiJ.regCCR) & XEiJ.busRwse ((XEiJ.regPC += 2) - 2)); //pcws。特権違反チェックが先 4429: } else { 4430: int t = XEiJ.regPC; 4431: XEiJ.regPC = t + 2; 4432: irpSetSR ((XEiJ.regSRT1 | XEiJ.regSRS | XEiJ.regSRI | XEiJ.regCCR) & XEiJ.busRwse (t)); //pcws。特権違反チェックが先 4433: } 4434: } else { //ANDI.W #<data>,<mem> 4435: int z; 4436: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4437: z = XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 4438: } else { 4439: z = XEiJ.regPC; 4440: XEiJ.regPC = z + 2; 4441: z = XEiJ.busRwse (z); //pcws 4442: } 4443: XEiJ.mpuCycleCount += 12; 4444: int a = efaMltWord (ea); 4445: XEiJ.busWw (a, z &= XEiJ.busRws (a)); 4446: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | (char) z - 1 >> 31 & XEiJ.REG_CCR_Z | ((short) z < 0 ? XEiJ.REG_CCR_N : 0); //ccr_tst_word 4447: } 4448: } //irpAndiWord 4449: 4450: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4451: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4452: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4453: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4454: //ANDI.L #<data>,<ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0000_001_010_mmm_rrr-{data} 4455: //AND.L #<data>,<ea> |A|012346|-|-UUUU|-**00| M+-WXZ |0000_001_010_mmm_rrr-{data} [ANDI.L #<data>,<ea>] 4456: public static void irpAndiLong () throws M68kException { 4457: int ea = XEiJ.regOC & 63; 4458: int y; 4459: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4460: y = XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 4461: } else { 4462: y = XEiJ.regPC; 4463: XEiJ.regPC = y + 4; 4464: y = XEiJ.busRlse (y); //pcls 4465: } 4466: int z; 4467: if (ea < XEiJ.EA_AR) { //ANDI.L #<data>,Dr 4468: XEiJ.mpuCycleCount += 16; 4469: z = XEiJ.regRn[ea] &= y; 4470: } else { //ANDI.L #<data>,<mem> 4471: XEiJ.mpuCycleCount += 20; 4472: int a = efaMltLong (ea); 4473: XEiJ.busWl (a, z = XEiJ.busRls (a) & y); 4474: } 4475: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 4476: } //irpAndiLong 4477: 4478: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4479: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4480: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4481: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4482: //BYTEREV.L Dr |-|------|-|-----|-----|D |0000_001_011_000_rrr (ISA_C) 4483: // 4484: //BYTEREV.L Dr 4485: // Drのバイトの並びを逆順にする。CCRは変化しない 4486: public static void irpCmp2Chk2Word () throws M68kException { 4487: int ea = XEiJ.regOC & 63; 4488: if (ea < XEiJ.EA_AR) { //BYTEREV.L Dr 4489: XEiJ.mpuCycleCount += 4; 4490: if (true) { //0.10ns-0.18ns 0x782750ec 4491: XEiJ.regRn[ea] = Integer.reverseBytes (XEiJ.regRn[ea]); 4492: } else { //1.06ns 0x782750ec 4493: int x = XEiJ.regRn[ea]; 4494: XEiJ.regRn[ea] = x << 24 | x << 8 & 0x00ff0000 | x >>> 8 & 0x0000ff00 | x >>> 24; 4495: } 4496: } else { //CMP2/CHK2.W <ea>,Rn 4497: //プロセッサの判別に使われることがあるのでMC68000ではCMP2/CHK2をエラーにしなければならない 4498: XEiJ.mpuCycleCount += 34; 4499: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 4500: throw M68kException.m6eSignal; 4501: } 4502: } //irpCmp2Chk2Word 4503: 4504: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4505: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4506: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4507: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4508: //SUBI.B #<data>,<ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0000_010_000_mmm_rrr-{data} 4509: //SUB.B #<data>,<ea> |A|012346|-|UUUUU|*****| M+-WXZ |0000_010_000_mmm_rrr-{data} [SUBI.B #<data>,<ea>] 4510: public static void irpSubiByte () throws M68kException { 4511: int ea = XEiJ.regOC & 63; 4512: int x; 4513: int y; 4514: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4515: y = XEiJ.busRbs ((XEiJ.regPC += 2) - 1); //pcbs 4516: } else { 4517: y = XEiJ.regPC; 4518: XEiJ.regPC = y + 2; 4519: y = XEiJ.busRbs (y + 1); //pcbs 4520: } 4521: int z; 4522: if (ea < XEiJ.EA_AR) { //SUBI.B #<data>,Dr 4523: XEiJ.mpuCycleCount += 8; 4524: z = (byte) (XEiJ.regRn[ea] = ~0xff & (x = XEiJ.regRn[ea]) | 0xff & (x = (byte) x) - y); 4525: } else { //SUBI.B #<data>,<mem> 4526: XEiJ.mpuCycleCount += 12; 4527: int a = efaMltByte (ea); 4528: XEiJ.busWb (a, z = (byte) ((x = XEiJ.busRbs (a)) - y)); 4529: } 4530: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | 4531: ((x ^ y) & (x ^ z)) >>> 31 << 1 | 4532: (x & (y ^ z) ^ (y | z)) >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_sub 4533: } //irpSubiByte 4534: 4535: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4536: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4537: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4538: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4539: //SUBI.W #<data>,<ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0000_010_001_mmm_rrr-{data} 4540: //SUB.W #<data>,<ea> |A|012346|-|UUUUU|*****| M+-WXZ |0000_010_001_mmm_rrr-{data} [SUBI.W #<data>,<ea>] 4541: public static void irpSubiWord () throws M68kException { 4542: int ea = XEiJ.regOC & 63; 4543: int x; 4544: int y; 4545: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4546: y = XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 4547: } else { 4548: y = XEiJ.regPC; 4549: XEiJ.regPC = y + 2; 4550: y = XEiJ.busRwse (y); //pcws 4551: } 4552: int z; 4553: if (ea < XEiJ.EA_AR) { //SUBI.W #<data>,Dr 4554: XEiJ.mpuCycleCount += 8; 4555: z = (short) (XEiJ.regRn[ea] = ~0xffff & (x = XEiJ.regRn[ea]) | (char) ((x = (short) x) - y)); 4556: } else { //SUBI.W #<data>,<mem> 4557: XEiJ.mpuCycleCount += 12; 4558: int a = efaMltWord (ea); 4559: XEiJ.busWw (a, z = (short) ((x = XEiJ.busRws (a)) - y)); 4560: } 4561: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | 4562: ((x ^ y) & (x ^ z)) >>> 31 << 1 | 4563: (x & (y ^ z) ^ (y | z)) >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_sub 4564: } //irpSubiWord 4565: 4566: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4567: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4568: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4569: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4570: //SUBI.L #<data>,<ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0000_010_010_mmm_rrr-{data} 4571: //SUB.L #<data>,<ea> |A|012346|-|UUUUU|*****| M+-WXZ |0000_010_010_mmm_rrr-{data} [SUBI.L #<data>,<ea>] 4572: public static void irpSubiLong () throws M68kException { 4573: int ea = XEiJ.regOC & 63; 4574: int x; 4575: int y; 4576: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4577: y = XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 4578: } else { 4579: y = XEiJ.regPC; 4580: XEiJ.regPC = y + 4; 4581: y = XEiJ.busRlse (y); //pcls 4582: } 4583: int z; 4584: if (ea < XEiJ.EA_AR) { //SUBI.L #<data>,Dr 4585: XEiJ.mpuCycleCount += 16; 4586: XEiJ.regRn[ea] = z = (x = XEiJ.regRn[ea]) - y; 4587: } else { //SUBI.L #<data>,<mem> 4588: XEiJ.mpuCycleCount += 20; 4589: int a = efaMltLong (ea); 4590: XEiJ.busWl (a, z = (x = XEiJ.busRls (a)) - y); 4591: } 4592: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | 4593: ((x ^ y) & (x ^ z)) >>> 31 << 1 | 4594: (x & (y ^ z) ^ (y | z)) >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_sub 4595: } //irpSubiLong 4596: 4597: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4598: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4599: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4600: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4601: //FF1.L Dr |-|------|-|-UUUU|-**00|D |0000_010_011_000_rrr (ISA_C) 4602: // 4603: //FF1.L Dr 4604: // Drの最上位の1のbit31からのオフセットをDrに格納する 4605: // Drが0のときは32になる 4606: public static void irpCmp2Chk2Long () throws M68kException { 4607: int ea = XEiJ.regOC & 63; 4608: if (ea < XEiJ.EA_AR) { //FF1.L Dr 4609: XEiJ.mpuCycleCount += 4; 4610: int z = XEiJ.regRn[ea]; 4611: if (true) { 4612: XEiJ.regRn[ea] = Integer.numberOfLeadingZeros (z); 4613: } else { 4614: if (z == 0) { 4615: XEiJ.regRn[ea] = 32; 4616: } else { 4617: int k = -(z >>> 16) >> 16 & 16; 4618: k += -(z >>> k + 8) >> 8 & 8; 4619: k += -(z >>> k + 4) >> 4 & 4; 4620: // bit3 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 4621: // bit2 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 4622: // bit1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 4623: // bit0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 4624: XEiJ.regRn[ea] = ((0b11_11_11_11_11_11_11_11_10_10_10_10_01_01_00_00 >>> (z >>> k << 1)) & 3) + k; //intのシフトカウントは下位5bitだけが使用される 4625: } 4626: } 4627: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 4628: } else { //CMP2/CHK2.L <ea>,Rn 4629: //プロセッサの判別に使われることがあるのでMC68000ではCMP2/CHK2をエラーにしなければならない 4630: XEiJ.mpuCycleCount += 34; 4631: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 4632: throw M68kException.m6eSignal; 4633: } 4634: } //irpCmp2Chk2Long 4635: 4636: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4637: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4638: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4639: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4640: //ADDI.B #<data>,<ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0000_011_000_mmm_rrr-{data} 4641: public static void irpAddiByte () throws M68kException { 4642: int ea = XEiJ.regOC & 63; 4643: int x; 4644: int y; 4645: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4646: y = XEiJ.busRbs ((XEiJ.regPC += 2) - 1); //pcbs 4647: } else { 4648: y = XEiJ.regPC; 4649: XEiJ.regPC = y + 2; 4650: y = XEiJ.busRbs (y + 1); //pcbs 4651: } 4652: int z; 4653: if (ea < XEiJ.EA_AR) { //ADDI.B #<data>,Dr 4654: XEiJ.mpuCycleCount += 8; 4655: z = (byte) (XEiJ.regRn[ea] = ~0xff & (x = XEiJ.regRn[ea]) | 0xff & (x = (byte) x) + y); 4656: } else { //ADDI.B #<data>,<mem> 4657: XEiJ.mpuCycleCount += 12; 4658: int a = efaMltByte (ea); 4659: XEiJ.busWb (a, z = (byte) ((x = XEiJ.busRbs (a)) + y)); 4660: } 4661: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | 4662: ((x ^ z) & (y ^ z)) >>> 31 << 1 | 4663: ((x | y) ^ (x ^ y) & z) >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_add 4664: } //irpAddiByte 4665: 4666: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4667: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4668: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4669: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4670: //ADDI.W #<data>,<ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0000_011_001_mmm_rrr-{data} 4671: public static void irpAddiWord () throws M68kException { 4672: int ea = XEiJ.regOC & 63; 4673: int x; 4674: int y; 4675: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4676: y = XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 4677: } else { 4678: y = XEiJ.regPC; 4679: XEiJ.regPC = y + 2; 4680: y = XEiJ.busRwse (y); //pcws 4681: } 4682: int z; 4683: if (ea < XEiJ.EA_AR) { //ADDI.W #<data>,Dr 4684: XEiJ.mpuCycleCount += 8; 4685: z = (short) (XEiJ.regRn[ea] = ~0xffff & (x = XEiJ.regRn[ea]) | (char) ((x = (short) x) + y)); 4686: } else { //ADDI.W #<data>,<mem> 4687: XEiJ.mpuCycleCount += 12; 4688: int a = efaMltWord (ea); 4689: XEiJ.busWw (a, z = (short) ((x = XEiJ.busRws (a)) + y)); 4690: } 4691: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | 4692: ((x ^ z) & (y ^ z)) >>> 31 << 1 | 4693: ((x | y) ^ (x ^ y) & z) >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_add 4694: } //irpAddiWord 4695: 4696: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4697: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4698: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4699: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4700: //ADDI.L #<data>,<ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0000_011_010_mmm_rrr-{data} 4701: public static void irpAddiLong () throws M68kException { 4702: int ea = XEiJ.regOC & 63; 4703: int x; 4704: int y; 4705: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4706: y = XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 4707: } else { 4708: y = XEiJ.regPC; 4709: XEiJ.regPC = y + 4; 4710: y = XEiJ.busRlse (y); //pcls 4711: } 4712: int z; 4713: if (ea < XEiJ.EA_AR) { //ADDI.L #<data>,Dr 4714: XEiJ.mpuCycleCount += 16; 4715: XEiJ.regRn[ea] = z = (x = XEiJ.regRn[ea]) + y; 4716: } else { //ADDI.L #<data>,<mem> 4717: XEiJ.mpuCycleCount += 20; 4718: int a = efaMltLong (ea); 4719: XEiJ.busWl (a, z = (x = XEiJ.busRls (a)) + y); 4720: } 4721: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | 4722: ((x ^ z) & (y ^ z)) >>> 31 << 1 | 4723: ((x | y) ^ (x ^ y) & z) >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_add 4724: } //irpAddiLong 4725: 4726: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4727: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4728: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4729: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4730: //BTST.L #<data>,Dr |-|012346|-|--U--|--*--|D |0000_100_000_000_rrr-{data} 4731: //BTST.B #<data>,<ea> |-|012346|-|--U--|--*--| M+-WXZP |0000_100_000_mmm_rrr-{data} 4732: public static void irpBtstImm () throws M68kException { 4733: int ea = XEiJ.regOC & 63; 4734: int y; 4735: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4736: y = XEiJ.busRbs ((XEiJ.regPC += 2) - 1); //pcbs 4737: } else { 4738: y = XEiJ.regPC; 4739: XEiJ.regPC = y + 2; 4740: y = XEiJ.busRbs (y + 1); //pcbs 4741: } 4742: if (ea < XEiJ.EA_AR) { //BTST.L #<data>,Dr 4743: XEiJ.mpuCycleCount += 10; 4744: XEiJ.regCCR = XEiJ.regCCR & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_N | XEiJ.REG_CCR_V | XEiJ.REG_CCR_C) | (~XEiJ.regRn[ea] >>> y & 1) << 2; //ccr_btst。intのシフトは5bitでマスクされるので&31を省略 4745: } else { //BTST.B #<data>,<ea> 4746: XEiJ.mpuCycleCount += 8; 4747: XEiJ.regCCR = XEiJ.regCCR & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_N | XEiJ.REG_CCR_V | XEiJ.REG_CCR_C) | (~XEiJ.busRbs (efaMemByte (ea)) >>> (y & 7) & 1) << 2; //ccr_btst 4748: } 4749: } //irpBtstImm 4750: 4751: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4752: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4753: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4754: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4755: //BCHG.L #<data>,Dr |-|012346|-|--U--|--*--|D |0000_100_001_000_rrr-{data} 4756: //BCHG.B #<data>,<ea> |-|012346|-|--U--|--*--| M+-WXZ |0000_100_001_mmm_rrr-{data} 4757: public static void irpBchgImm () throws M68kException { 4758: int ea = XEiJ.regOC & 63; 4759: int x; 4760: int y; 4761: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4762: y = XEiJ.busRbs ((XEiJ.regPC += 2) - 1); //pcbs 4763: } else { 4764: y = XEiJ.regPC; 4765: XEiJ.regPC = y + 2; 4766: y = XEiJ.busRbs (y + 1); //pcbs 4767: } 4768: if (ea < XEiJ.EA_AR) { //BCHG.L #<data>,Dr 4769: XEiJ.regRn[ea] = (x = XEiJ.regRn[ea]) ^ (y = 1 << y); //intのシフトは5bitでマスクされるので1<<(y&0x1f)の&0x1fを省略 4770: XEiJ.mpuCycleCount += (char) y != 0 ? 10 : 12; //(0xffff&y)!=0 4771: } else { //BCHG.B #<data>,<ea> 4772: XEiJ.mpuCycleCount += 12; 4773: int a = efaMltByte (ea); 4774: XEiJ.busWb (a, (x = XEiJ.busRbs (a)) ^ (y = 1 << (y & 7))); 4775: } 4776: XEiJ.regCCR = XEiJ.regCCR & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_N | XEiJ.REG_CCR_V | XEiJ.REG_CCR_C) | (x & y) - 1 >>> 31 << 2; //ccr_btst 4777: } //irpBchgImm 4778: 4779: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4780: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4781: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4782: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4783: //BCLR.L #<data>,Dr |-|012346|-|--U--|--*--|D |0000_100_010_000_rrr-{data} 4784: //BCLR.B #<data>,<ea> |-|012346|-|--U--|--*--| M+-WXZ |0000_100_010_mmm_rrr-{data} 4785: public static void irpBclrImm () throws M68kException { 4786: int ea = XEiJ.regOC & 63; 4787: int x; 4788: int y; 4789: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4790: y = XEiJ.busRbs ((XEiJ.regPC += 2) - 1); //pcbs 4791: } else { 4792: y = XEiJ.regPC; 4793: XEiJ.regPC = y + 2; 4794: y = XEiJ.busRbs (y + 1); //pcbs 4795: } 4796: if (ea < XEiJ.EA_AR) { //BCLR.L #<data>,Dr 4797: XEiJ.regRn[ea] = (x = XEiJ.regRn[ea]) & ~(y = 1 << y); //intのシフトは5bitでマスクされるので1<<(y&0x1f)の&0x1fを省略 4798: XEiJ.mpuCycleCount += (char) y != 0 ? 12 : 14; //(0xffff&y)!=0 4799: } else { //BCLR.B #<data>,<ea> 4800: XEiJ.mpuCycleCount += 12; 4801: int a = efaMltByte (ea); 4802: XEiJ.busWb (a, (x = XEiJ.busRbs (a)) & ~(y = 1 << (y & 7))); 4803: } 4804: XEiJ.regCCR = XEiJ.regCCR & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_N | XEiJ.REG_CCR_V | XEiJ.REG_CCR_C) | (x & y) - 1 >>> 31 << 2; //ccr_btst 4805: } //irpBclrImm 4806: 4807: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4808: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4809: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4810: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4811: //BSET.L #<data>,Dr |-|012346|-|--U--|--*--|D |0000_100_011_000_rrr-{data} 4812: //BSET.B #<data>,<ea> |-|012346|-|--U--|--*--| M+-WXZ |0000_100_011_mmm_rrr-{data} 4813: public static void irpBsetImm () throws M68kException { 4814: int ea = XEiJ.regOC & 63; 4815: int x; 4816: int y; 4817: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4818: y = XEiJ.busRbs ((XEiJ.regPC += 2) - 1); //pcbs 4819: } else { 4820: y = XEiJ.regPC; 4821: XEiJ.regPC = y + 2; 4822: y = XEiJ.busRbs (y + 1); //pcbs 4823: } 4824: if (ea < XEiJ.EA_AR) { //BSET.L #<data>,Dr 4825: XEiJ.regRn[ea] = (x = XEiJ.regRn[ea]) | (y = 1 << y); //intのシフトは5bitでマスクされるので1<<(y&0x1f)の&0x1fを省略 4826: XEiJ.mpuCycleCount += (char) y != 0 ? 10 : 12; //(0xffff&y)!=0 4827: } else { //BSET.B #<data>,<ea> 4828: XEiJ.mpuCycleCount += 12; 4829: int a = efaMltByte (ea); 4830: XEiJ.busWb (a, (x = XEiJ.busRbs (a)) | (y = 1 << (y & 7))); 4831: } 4832: XEiJ.regCCR = XEiJ.regCCR & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_N | XEiJ.REG_CCR_V | XEiJ.REG_CCR_C) | (x & y) - 1 >>> 31 << 2; //ccr_btst 4833: } //irpBsetImm 4834: 4835: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4836: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4837: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4838: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4839: //EORI.B #<data>,<ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0000_101_000_mmm_rrr-{data} 4840: //EOR.B #<data>,<ea> |A|012346|-|-UUUU|-**00|D M+-WXZ |0000_101_000_mmm_rrr-{data} [EORI.B #<data>,<ea>] 4841: //EORI.B #<data>,CCR |-|012346|-|*****|*****| |0000_101_000_111_100-{data} 4842: public static void irpEoriByte () throws M68kException { 4843: int ea = XEiJ.regOC & 63; 4844: int z; 4845: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4846: z = XEiJ.busRbs ((XEiJ.regPC += 2) - 1); //pcbs 4847: } else { 4848: z = XEiJ.regPC; 4849: XEiJ.regPC = z + 2; 4850: z = XEiJ.busRbs (z + 1); //pcbs 4851: } 4852: if (ea < XEiJ.EA_AR) { //EORI.B #<data>,Dr 4853: XEiJ.mpuCycleCount += 8; 4854: z = XEiJ.regRn[ea] ^= 255 & z; //0拡張してからEOR 4855: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.MPU_TSTB_TABLE[255 & z]; //ccr_tst_byte 4856: } else if (ea == XEiJ.EA_IM) { //EORI.B #<data>,CCR 4857: XEiJ.mpuCycleCount += 20; 4858: XEiJ.regCCR ^= XEiJ.REG_CCR_MASK & z; 4859: } else { //EORI.B #<data>,<mem> 4860: XEiJ.mpuCycleCount += 12; 4861: int a = efaMltByte (ea); 4862: XEiJ.busWb (a, z ^= XEiJ.busRbs (a)); 4863: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.MPU_TSTB_TABLE[255 & z]; //ccr_tst_byte 4864: } 4865: } //irpEoriByte 4866: 4867: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4868: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4869: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4870: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4871: //EORI.W #<data>,<ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0000_101_001_mmm_rrr-{data} 4872: //EOR.W #<data>,<ea> |A|012346|-|-UUUU|-**00|D M+-WXZ |0000_101_001_mmm_rrr-{data} [EORI.W #<data>,<ea>] 4873: //EORI.W #<data>,SR |-|012346|P|*****|*****| |0000_101_001_111_100-{data} 4874: public static void irpEoriWord () throws M68kException { 4875: int ea = XEiJ.regOC & 63; 4876: if (ea < XEiJ.EA_AR) { //EORI.W #<data>,Dr 4877: int z; 4878: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4879: z = XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 4880: } else { 4881: z = XEiJ.regPC; 4882: XEiJ.regPC = z + 2; 4883: z = XEiJ.busRwse (z); //pcws 4884: } 4885: XEiJ.mpuCycleCount += 8; 4886: z = XEiJ.regRn[ea] ^= (char) z; //0拡張してからEOR 4887: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | (char) z - 1 >> 31 & XEiJ.REG_CCR_Z | ((short) z < 0 ? XEiJ.REG_CCR_N : 0); //ccr_tst_word 4888: } else if (ea == XEiJ.EA_IM) { //EORI.W #<data>,SR 4889: if (XEiJ.regSRS == 0) { //ユーザモードのとき 4890: XEiJ.mpuCycleCount += 34; 4891: M68kException.m6eNumber = M68kException.M6E_PRIVILEGE_VIOLATION; 4892: throw M68kException.m6eSignal; 4893: } 4894: //以下はスーパーバイザモード 4895: XEiJ.mpuCycleCount += 20; 4896: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4897: irpSetSR ((XEiJ.regSRT1 | XEiJ.regSRS | XEiJ.regSRI | XEiJ.regCCR) ^ XEiJ.busRwse ((XEiJ.regPC += 2) - 2)); //pcws。特権違反チェックが先 4898: } else { 4899: int t = XEiJ.regPC; 4900: XEiJ.regPC = t + 2; 4901: irpSetSR ((XEiJ.regSRT1 | XEiJ.regSRS | XEiJ.regSRI | XEiJ.regCCR) ^ XEiJ.busRwse (t)); //pcws。特権違反チェックが先 4902: } 4903: } else { //EORI.W #<data>,<mem> 4904: int z; 4905: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4906: z = XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 4907: } else { 4908: z = XEiJ.regPC; 4909: XEiJ.regPC = z + 2; 4910: z = XEiJ.busRwse (z); //pcws 4911: } 4912: XEiJ.mpuCycleCount += 12; 4913: int a = efaMltWord (ea); 4914: XEiJ.busWw (a, z ^= XEiJ.busRws (a)); 4915: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | (char) z - 1 >> 31 & XEiJ.REG_CCR_Z | ((short) z < 0 ? XEiJ.REG_CCR_N : 0); //ccr_tst_word 4916: } 4917: } //irpEoriWord 4918: 4919: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4920: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4921: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4922: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4923: //EORI.L #<data>,<ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0000_101_010_mmm_rrr-{data} 4924: //EOR.L #<data>,<ea> |A|012346|-|-UUUU|-**00|D M+-WXZ |0000_101_010_mmm_rrr-{data} [EORI.L #<data>,<ea>] 4925: public static void irpEoriLong () throws M68kException { 4926: int ea = XEiJ.regOC & 63; 4927: int y; 4928: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4929: y = XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 4930: } else { 4931: y = XEiJ.regPC; 4932: XEiJ.regPC = y + 4; 4933: y = XEiJ.busRlse (y); //pcls 4934: } 4935: int z; 4936: if (ea < XEiJ.EA_AR) { //EORI.L #<data>,Dr 4937: XEiJ.mpuCycleCount += 16; 4938: z = XEiJ.regRn[ea] ^= y; 4939: } else { //EORI.L #<data>,<mem> 4940: XEiJ.mpuCycleCount += 20; 4941: int a = efaMltLong (ea); 4942: XEiJ.busWl (a, z = XEiJ.busRls (a) ^ y); 4943: } 4944: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 4945: } //irpEoriLong 4946: 4947: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4948: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4949: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4950: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4951: //CMPI.B #<data>,<ea> |-|01----|-|-UUUU|-****|D M+-WXZ |0000_110_000_mmm_rrr-{data} 4952: //CMP.B #<data>,<ea> |A|01----|-|-UUUU|-****| M+-WXZ |0000_110_000_mmm_rrr-{data} [CMPI.B #<data>,<ea>] 4953: public static void irpCmpiByte () throws M68kException { 4954: XEiJ.mpuCycleCount += 8; 4955: int ea = XEiJ.regOC & 63; 4956: int x; 4957: int y; 4958: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4959: y = XEiJ.busRbs ((XEiJ.regPC += 2) - 1); //pcbs 4960: } else { 4961: y = XEiJ.regPC; 4962: XEiJ.regPC = y + 2; 4963: y = XEiJ.busRbs (y + 1); //pcbs 4964: } 4965: int z = (byte) ((x = ea < XEiJ.EA_AR ? (byte) XEiJ.regRn[ea] : XEiJ.busRbs (efaMltByte (ea))) - y); //アドレッシングモードに注意 4966: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X) | 4967: ((x ^ y) & (x ^ z)) >>> 31 << 1 | 4968: (x & (y ^ z) ^ (y | z)) >>> 31); //ccr_cmp 4969: } //irpCmpiByte 4970: 4971: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4972: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4973: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4974: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4975: //CMPI.W #<data>,<ea> |-|01----|-|-UUUU|-****|D M+-WXZ |0000_110_001_mmm_rrr-{data} 4976: //CMP.W #<data>,<ea> |A|01----|-|-UUUU|-****| M+-WXZ |0000_110_001_mmm_rrr-{data} [CMPI.W #<data>,<ea>] 4977: public static void irpCmpiWord () throws M68kException { 4978: XEiJ.mpuCycleCount += 8; 4979: int ea = XEiJ.regOC & 63; 4980: int x; 4981: int y; 4982: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 4983: y = XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 4984: } else { 4985: y = XEiJ.regPC; 4986: XEiJ.regPC = y + 2; 4987: y = XEiJ.busRwse (y); //pcws 4988: } 4989: int z = (short) ((x = ea < XEiJ.EA_AR ? (short) XEiJ.regRn[ea] : XEiJ.busRws (efaMltWord (ea))) - y); //アドレッシングモードに注意 4990: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X) | 4991: ((x ^ y) & (x ^ z)) >>> 31 << 1 | 4992: (x & (y ^ z) ^ (y | z)) >>> 31); //ccr_cmp 4993: } //irpCmpiWord 4994: 4995: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4996: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 4997: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 4998: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 4999: //CMPI.L #<data>,<ea> |-|01----|-|-UUUU|-****|D M+-WXZ |0000_110_010_mmm_rrr-{data} 5000: //CMP.L #<data>,<ea> |A|01----|-|-UUUU|-****| M+-WXZ |0000_110_010_mmm_rrr-{data} [CMPI.L #<data>,<ea>] 5001: public static void irpCmpiLong () throws M68kException { 5002: int ea = XEiJ.regOC & 63; 5003: int x; 5004: int y; 5005: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 5006: y = XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 5007: } else { 5008: y = XEiJ.regPC; 5009: XEiJ.regPC = y + 4; 5010: y = XEiJ.busRlse (y); //pcls 5011: } 5012: int z; 5013: if (ea < XEiJ.EA_AR) { //CMPI.L #<data>,Dr 5014: XEiJ.mpuCycleCount += 14; 5015: z = (x = XEiJ.regRn[ea]) - y; 5016: } else { //CMPI.L #<data>,<mem> 5017: XEiJ.mpuCycleCount += 12; 5018: z = (x = XEiJ.busRls (efaMltLong (ea))) - y; //アドレッシングモードに注意 5019: } 5020: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X) | 5021: ((x ^ y) & (x ^ z)) >>> 31 << 1 | 5022: (x & (y ^ z) ^ (y | z)) >>> 31); //ccr_cmp 5023: } //irpCmpiLong 5024: 5025: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5026: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5027: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5028: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5029: //MOVE.B <ea>,Dq |-|012346|-|-UUUU|-**00|D M+-WXZPI|0001_qqq_000_mmm_rrr 5030: public static void irpMoveToDRByte () throws M68kException { 5031: XEiJ.mpuCycleCount += 4; 5032: int ea = XEiJ.regOC & 63; 5033: int qqq = XEiJ.regOC >> 9 & 7; 5034: int z = ea < XEiJ.EA_AR ? XEiJ.regRn[ea] : XEiJ.busRbs (efaAnyByte (ea)); 5035: XEiJ.regRn[qqq] = ~255 & XEiJ.regRn[qqq] | 255 & z; 5036: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.MPU_TSTB_TABLE[255 & z]; //ccr_tst_byte 5037: } //irpMoveToDRByte 5038: 5039: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5040: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5041: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5042: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5043: //MOVE.B <ea>,(Aq) |-|012346|-|-UUUU|-**00|D M+-WXZPI|0001_qqq_010_mmm_rrr 5044: public static void irpMoveToMMByte () throws M68kException { 5045: XEiJ.mpuCycleCount += 8; 5046: int ea = XEiJ.regOC & 63; 5047: int z = ea < XEiJ.EA_AR ? XEiJ.regRn[ea] : XEiJ.busRbs (efaAnyByte (ea)); //ここでAqが変化する可能性があることに注意 5048: XEiJ.busWb (XEiJ.regRn[XEiJ.regOC >> 9], z); //1qqq=aqq 5049: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.MPU_TSTB_TABLE[255 & z]; //ccr_tst_byte 5050: } //irpMoveToMMByte 5051: 5052: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5053: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5054: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5055: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5056: //MOVE.B <ea>,(Aq)+ |-|012346|-|-UUUU|-**00|D M+-WXZPI|0001_qqq_011_mmm_rrr 5057: public static void irpMoveToMPByte () throws M68kException { 5058: XEiJ.mpuCycleCount += 8; 5059: int ea = XEiJ.regOC & 63; 5060: int aqq = XEiJ.regOC >> 9; //1qqq=aqq 5061: int z = ea < XEiJ.EA_AR ? XEiJ.regRn[ea] : XEiJ.busRbs (efaAnyByte (ea)); //ここでAqが変化する可能性があることに注意 5062: XEiJ.busWb (aqq < 15 ? XEiJ.regRn[aqq]++ : (XEiJ.regRn[15] += 2) - 2, z); 5063: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.MPU_TSTB_TABLE[255 & z]; //ccr_tst_byte 5064: } //irpMoveToMPByte 5065: 5066: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5067: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5068: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5069: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5070: //MOVE.B <ea>,-(Aq) |-|012346|-|-UUUU|-**00|D M+-WXZPI|0001_qqq_100_mmm_rrr 5071: public static void irpMoveToMNByte () throws M68kException { 5072: XEiJ.mpuCycleCount += 8; 5073: int ea = XEiJ.regOC & 63; 5074: int aqq = XEiJ.regOC >> 9; //1qqq=aqq 5075: int z = ea < XEiJ.EA_AR ? XEiJ.regRn[ea] : XEiJ.busRbs (efaAnyByte (ea)); //ここでAqが変化する可能性があることに注意 5076: XEiJ.busWb (aqq < 15 ? --XEiJ.regRn[aqq] : (XEiJ.regRn[15] -= 2), z); 5077: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.MPU_TSTB_TABLE[255 & z]; //ccr_tst_byte 5078: } //irpMoveToMNByte 5079: 5080: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5081: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5082: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5083: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5084: //MOVE.B <ea>,(d16,Aq) |-|012346|-|-UUUU|-**00|D M+-WXZPI|0001_qqq_101_mmm_rrr 5085: public static void irpMoveToMWByte () throws M68kException { 5086: XEiJ.mpuCycleCount += 12; 5087: int ea = XEiJ.regOC & 63; 5088: int aqq = XEiJ.regOC >> 9; //1qqq=aqq 5089: int z = ea < XEiJ.EA_AR ? XEiJ.regRn[ea] : XEiJ.busRbs (efaAnyByte (ea)); //ここでAqが変化する可能性があることに注意 5090: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 5091: XEiJ.busWb (XEiJ.regRn[aqq] //ベースレジスタ 5092: + XEiJ.busRwse ((XEiJ.regPC += 2) - 2), //pcws。ワードディスプレースメント 5093: z); 5094: } else { 5095: int t = XEiJ.regPC; 5096: XEiJ.regPC = t + 2; 5097: XEiJ.busWb (XEiJ.regRn[aqq] //ベースレジスタ 5098: + XEiJ.busRwse (t), //pcws。ワードディスプレースメント 5099: z); 5100: } 5101: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.MPU_TSTB_TABLE[255 & z]; //ccr_tst_byte 5102: } //irpMoveToMWByte 5103: 5104: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5105: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5106: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5107: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5108: //MOVE.B <ea>,(d8,Aq,Rn.wl) |-|012346|-|-UUUU|-**00|D M+-WXZPI|0001_qqq_110_mmm_rrr 5109: public static void irpMoveToMXByte () throws M68kException { 5110: XEiJ.mpuCycleCount += 14; 5111: int ea = XEiJ.regOC & 63; 5112: int aqq = XEiJ.regOC >> 9; //1qqq=aqq 5113: int z = ea < XEiJ.EA_AR ? XEiJ.regRn[ea] : XEiJ.busRbs (efaAnyByte (ea)); //ここでAqが変化する可能性があることに注意 5114: int w; 5115: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 5116: w = XEiJ.busRwze ((XEiJ.regPC += 2) - 2); //pcwz。拡張ワード 5117: } else { 5118: w = XEiJ.regPC; 5119: XEiJ.regPC = w + 2; 5120: w = XEiJ.busRwze (w); //pcwz。拡張ワード 5121: } 5122: XEiJ.busWb (XEiJ.regRn[aqq] //ベースレジスタ 5123: + (byte) w //バイトディスプレースメント 5124: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 5125: XEiJ.regRn[w >> 12]), //ロングインデックス 5126: z); 5127: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.MPU_TSTB_TABLE[255 & z]; //ccr_tst_byte 5128: } //irpMoveToMXByte 5129: 5130: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5131: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5132: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5133: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5134: //MOVE.B <ea>,(xxx).W |-|012346|-|-UUUU|-**00|D M+-WXZPI|0001_000_111_mmm_rrr 5135: public static void irpMoveToZWByte () throws M68kException { 5136: XEiJ.mpuCycleCount += 12; 5137: int ea = XEiJ.regOC & 63; 5138: int z = ea < XEiJ.EA_AR ? XEiJ.regRn[ea] : XEiJ.busRbs (efaAnyByte (ea)); 5139: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 5140: XEiJ.busWb (XEiJ.busRwse ((XEiJ.regPC += 2) - 2), //pcws 5141: z); 5142: } else { 5143: int t = XEiJ.regPC; 5144: XEiJ.regPC = t + 2; 5145: XEiJ.busWb (XEiJ.busRwse (t), //pcws 5146: z); 5147: } 5148: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.MPU_TSTB_TABLE[255 & z]; //ccr_tst_byte 5149: } //irpMoveToZWByte 5150: 5151: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5152: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5153: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5154: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5155: //MOVE.B <ea>,(xxx).L |-|012346|-|-UUUU|-**00|D M+-WXZPI|0001_001_111_mmm_rrr 5156: public static void irpMoveToZLByte () throws M68kException { 5157: XEiJ.mpuCycleCount += 16; 5158: int ea = XEiJ.regOC & 63; 5159: int z = ea < XEiJ.EA_AR ? XEiJ.regRn[ea] : XEiJ.busRbs (efaAnyByte (ea)); 5160: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 5161: XEiJ.busWb (XEiJ.busRlse ((XEiJ.regPC += 4) - 4), //pcls 5162: z); 5163: } else { 5164: int t = XEiJ.regPC; 5165: XEiJ.regPC = t + 4; 5166: XEiJ.busWb (XEiJ.busRlse (t), //pcls 5167: z); 5168: } 5169: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.MPU_TSTB_TABLE[255 & z]; //ccr_tst_byte 5170: } //irpMoveToZLByte 5171: 5172: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5173: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5174: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5175: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5176: //MOVE.L <ea>,Dq |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0010_qqq_000_mmm_rrr 5177: public static void irpMoveToDRLong () throws M68kException { 5178: XEiJ.mpuCycleCount += 4; 5179: int ea = XEiJ.regOC & 63; 5180: int z; 5181: XEiJ.regRn[XEiJ.regOC >> 9 & 7] = z = ea < XEiJ.EA_MM ? XEiJ.regRn[ea] : XEiJ.busRls (efaAnyLong (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ 5182: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 5183: } //irpMoveToDRLong 5184: 5185: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5186: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5187: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5188: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5189: //MOVEA.L <ea>,Aq |-|012346|-|-----|-----|DAM+-WXZPI|0010_qqq_001_mmm_rrr 5190: //MOVE.L <ea>,Aq |A|012346|-|-----|-----|DAM+-WXZPI|0010_qqq_001_mmm_rrr [MOVEA.L <ea>,Aq] 5191: public static void irpMoveaLong () throws M68kException { 5192: XEiJ.mpuCycleCount += 4; 5193: int ea = XEiJ.regOC & 63; 5194: XEiJ.regRn[(XEiJ.regOC >> 9) - (16 - 8)] = ea < XEiJ.EA_MM ? XEiJ.regRn[ea] : XEiJ.busRls (efaAnyLong (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ。右辺でAqが変化する可能性があることに注意 5195: } //irpMoveaLong 5196: 5197: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5198: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5199: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5200: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5201: //MOVE.L <ea>,(Aq) |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0010_qqq_010_mmm_rrr 5202: public static void irpMoveToMMLong () throws M68kException { 5203: XEiJ.mpuCycleCount += 12; 5204: int ea = XEiJ.regOC & 63; 5205: int z = ea < XEiJ.EA_MM ? XEiJ.regRn[ea] : XEiJ.busRls (efaAnyLong (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ。ここでAqが変化する可能性があることに注意 5206: XEiJ.busWl (XEiJ.regRn[(XEiJ.regOC >> 9) - (16 - 8)], z); 5207: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 5208: } //irpMoveToMMLong 5209: 5210: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5211: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5212: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5213: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5214: //MOVE.L <ea>,(Aq)+ |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0010_qqq_011_mmm_rrr 5215: public static void irpMoveToMPLong () throws M68kException { 5216: XEiJ.mpuCycleCount += 12; 5217: int ea = XEiJ.regOC & 63; 5218: int z = ea < XEiJ.EA_MM ? XEiJ.regRn[ea] : XEiJ.busRls (efaAnyLong (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ。ここでAqが変化する可能性があることに注意 5219: XEiJ.busWl ((XEiJ.regRn[(XEiJ.regOC >> 9) - (16 - 8)] += 4) - 4, z); 5220: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 5221: } //irpMoveToMPLong 5222: 5223: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5224: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5225: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5226: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5227: //MOVE.L <ea>,-(Aq) |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0010_qqq_100_mmm_rrr 5228: public static void irpMoveToMNLong () throws M68kException { 5229: XEiJ.mpuCycleCount += 12; 5230: int ea = XEiJ.regOC & 63; 5231: int z = ea < XEiJ.EA_MM ? XEiJ.regRn[ea] : XEiJ.busRls (efaAnyLong (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ。ここでAqが変化する可能性があることに注意 5232: XEiJ.busWl ((XEiJ.regRn[(XEiJ.regOC >> 9) - (16 - 8)] -= 4), z); 5233: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 5234: } //irpMoveToMNLong 5235: 5236: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5237: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5238: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5239: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5240: //MOVE.L <ea>,(d16,Aq) |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0010_qqq_101_mmm_rrr 5241: public static void irpMoveToMWLong () throws M68kException { 5242: XEiJ.mpuCycleCount += 16; 5243: int ea = XEiJ.regOC & 63; 5244: int z = ea < XEiJ.EA_MM ? XEiJ.regRn[ea] : XEiJ.busRls (efaAnyLong (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ。ここでAqが変化する可能性があることに注意 5245: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 5246: XEiJ.busWl (XEiJ.regRn[(XEiJ.regOC >> 9) - (16 - 8)] //ベースレジスタ 5247: + XEiJ.busRwse ((XEiJ.regPC += 2) - 2), //pcws。ワードディスプレースメント 5248: z); 5249: } else { 5250: int t = XEiJ.regPC; 5251: XEiJ.regPC = t + 2; 5252: XEiJ.busWl (XEiJ.regRn[(XEiJ.regOC >> 9) - (16 - 8)] //ベースレジスタ 5253: + XEiJ.busRwse (t), //pcws。ワードディスプレースメント 5254: z); 5255: } 5256: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 5257: } //irpMoveToMWLong 5258: 5259: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5260: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5261: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5262: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5263: //MOVE.L <ea>,(d8,Aq,Rn.wl) |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0010_qqq_110_mmm_rrr 5264: public static void irpMoveToMXLong () throws M68kException { 5265: XEiJ.mpuCycleCount += 18; 5266: int ea = XEiJ.regOC & 63; 5267: int aqq = (XEiJ.regOC >> 9) - (16 - 8); 5268: int z = ea < XEiJ.EA_MM ? XEiJ.regRn[ea] : XEiJ.busRls (efaAnyLong (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ。ここでAqが変化する可能性があることに注意 5269: int w; 5270: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 5271: w = XEiJ.busRwze ((XEiJ.regPC += 2) - 2); //pcwz。拡張ワード 5272: } else { 5273: w = XEiJ.regPC; 5274: XEiJ.regPC = w + 2; 5275: w = XEiJ.busRwze (w); //pcwz。拡張ワード 5276: } 5277: XEiJ.busWl (XEiJ.regRn[aqq] //ベースレジスタ 5278: + (byte) w //バイトディスプレースメント 5279: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 5280: XEiJ.regRn[w >> 12]), //ロングインデックス 5281: z); 5282: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 5283: } //irpMoveToMXLong 5284: 5285: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5286: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5287: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5288: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5289: //MOVE.L <ea>,(xxx).W |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0010_000_111_mmm_rrr 5290: public static void irpMoveToZWLong () throws M68kException { 5291: XEiJ.mpuCycleCount += 16; 5292: int ea = XEiJ.regOC & 63; 5293: int z = ea < XEiJ.EA_MM ? XEiJ.regRn[ea] : XEiJ.busRls (efaAnyLong (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ 5294: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 5295: XEiJ.busWl (XEiJ.busRwse ((XEiJ.regPC += 2) - 2), //pcws 5296: z); 5297: } else { 5298: int t = XEiJ.regPC; 5299: XEiJ.regPC = t + 2; 5300: XEiJ.busWl (XEiJ.busRwse (t), //pcws 5301: z); 5302: } 5303: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 5304: } //irpMoveToZWLong 5305: 5306: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5307: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5308: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5309: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5310: //MOVE.L <ea>,(xxx).L |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0010_001_111_mmm_rrr 5311: public static void irpMoveToZLLong () throws M68kException { 5312: XEiJ.mpuCycleCount += 20; 5313: int ea = XEiJ.regOC & 63; 5314: int z = ea < XEiJ.EA_MM ? XEiJ.regRn[ea] : XEiJ.busRls (efaAnyLong (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ 5315: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 5316: XEiJ.busWl (XEiJ.busRlse ((XEiJ.regPC += 4) - 4), //pcls 5317: z); 5318: } else { 5319: int t = XEiJ.regPC; 5320: XEiJ.regPC = t + 4; 5321: XEiJ.busWl (XEiJ.busRlse (t), //pcls 5322: z); 5323: } 5324: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 5325: } //irpMoveToZLLong 5326: 5327: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5328: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5329: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5330: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5331: //MOVE.W <ea>,Dq |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0011_qqq_000_mmm_rrr 5332: public static void irpMoveToDRWord () throws M68kException { 5333: XEiJ.mpuCycleCount += 4; 5334: int ea = XEiJ.regOC & 63; 5335: int qqq = XEiJ.regOC >> 9 & 7; 5336: int z = ea < XEiJ.EA_MM ? XEiJ.regRn[ea] : XEiJ.busRws (efaAnyWord (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ 5337: XEiJ.regRn[qqq] = ~65535 & XEiJ.regRn[qqq] | (char) z; 5338: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | (char) z - 1 >> 31 & XEiJ.REG_CCR_Z | ((short) z < 0 ? XEiJ.REG_CCR_N : 0); //ccr_tst_word 5339: } //irpMoveToDRWord 5340: 5341: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5342: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5343: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5344: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5345: //MOVEA.W <ea>,Aq |-|012346|-|-----|-----|DAM+-WXZPI|0011_qqq_001_mmm_rrr 5346: //MOVE.W <ea>,Aq |A|012346|-|-----|-----|DAM+-WXZPI|0011_qqq_001_mmm_rrr [MOVEA.W <ea>,Aq] 5347: // 5348: //MOVEA.W <ea>,Aq 5349: // ワードデータをロングに符号拡張してAqの全体を更新する 5350: public static void irpMoveaWord () throws M68kException { 5351: XEiJ.mpuCycleCount += 4; 5352: int ea = XEiJ.regOC & 63; 5353: XEiJ.regRn[XEiJ.regOC >> 9 & 15] = ea < XEiJ.EA_MM ? (short) XEiJ.regRn[ea] : XEiJ.busRws (efaAnyWord (ea)); //符号拡張して32bit全部書き換える。このr[ea]はデータレジスタまたはアドレスレジスタ。右辺でAqが変化する可能性があることに注意 5354: } //irpMoveaWord 5355: 5356: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5357: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5358: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5359: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5360: //MOVE.W <ea>,(Aq) |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0011_qqq_010_mmm_rrr 5361: public static void irpMoveToMMWord () throws M68kException { 5362: XEiJ.mpuCycleCount += 8; 5363: int ea = XEiJ.regOC & 63; 5364: int z = ea < XEiJ.EA_MM ? XEiJ.regRn[ea] : XEiJ.busRws (efaAnyWord (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ。ここでAqが変化する可能性があることに注意 5365: XEiJ.busWw (XEiJ.regRn[XEiJ.regOC >> 9 & 15], z); 5366: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | (char) z - 1 >> 31 & XEiJ.REG_CCR_Z | ((short) z < 0 ? XEiJ.REG_CCR_N : 0); //ccr_tst_word 5367: } //irpMoveToMMWord 5368: 5369: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5370: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5371: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5372: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5373: //MOVE.W <ea>,(Aq)+ |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0011_qqq_011_mmm_rrr 5374: public static void irpMoveToMPWord () throws M68kException { 5375: XEiJ.mpuCycleCount += 8; 5376: int ea = XEiJ.regOC & 63; 5377: int z = ea < XEiJ.EA_MM ? XEiJ.regRn[ea] : XEiJ.busRws (efaAnyWord (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ。ここでAqが変化する可能性があることに注意 5378: XEiJ.busWw ((XEiJ.regRn[XEiJ.regOC >> 9 & 15] += 2) - 2, z); 5379: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | (char) z - 1 >> 31 & XEiJ.REG_CCR_Z | ((short) z < 0 ? XEiJ.REG_CCR_N : 0); //ccr_tst_word 5380: } //irpMoveToMPWord 5381: 5382: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5383: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5384: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5385: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5386: //MOVE.W <ea>,-(Aq) |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0011_qqq_100_mmm_rrr 5387: public static void irpMoveToMNWord () throws M68kException { 5388: XEiJ.mpuCycleCount += 8; 5389: int ea = XEiJ.regOC & 63; 5390: int z = ea < XEiJ.EA_MM ? XEiJ.regRn[ea] : XEiJ.busRws (efaAnyWord (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ。ここでAqが変化する可能性があることに注意 5391: XEiJ.busWw ((XEiJ.regRn[XEiJ.regOC >> 9 & 15] -= 2), z); 5392: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | (char) z - 1 >> 31 & XEiJ.REG_CCR_Z | ((short) z < 0 ? XEiJ.REG_CCR_N : 0); //ccr_tst_word 5393: } //irpMoveToMNWord 5394: 5395: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5396: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5397: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5398: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5399: //MOVE.W <ea>,(d16,Aq) |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0011_qqq_101_mmm_rrr 5400: public static void irpMoveToMWWord () throws M68kException { 5401: XEiJ.mpuCycleCount += 12; 5402: int ea = XEiJ.regOC & 63; 5403: int aqq = XEiJ.regOC >> 9 & 15; 5404: int z = ea < XEiJ.EA_MM ? XEiJ.regRn[ea] : XEiJ.busRws (efaAnyWord (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ。ここでAqが変化する可能性があることに注意 5405: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 5406: XEiJ.busWw (XEiJ.regRn[aqq] //ベースレジスタ 5407: + XEiJ.busRwse ((XEiJ.regPC += 2) - 2), //pcws。ワードディスプレースメント 5408: z); 5409: } else { 5410: int t = XEiJ.regPC; 5411: XEiJ.regPC = t + 2; 5412: XEiJ.busWw (XEiJ.regRn[aqq] //ベースレジスタ 5413: + XEiJ.busRwse (t), //pcws。ワードディスプレースメント 5414: z); 5415: } 5416: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | (char) z - 1 >> 31 & XEiJ.REG_CCR_Z | ((short) z < 0 ? XEiJ.REG_CCR_N : 0); //ccr_tst_word 5417: } //irpMoveToMWWord 5418: 5419: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5420: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5421: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5422: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5423: //MOVE.W <ea>,(d8,Aq,Rn.wl) |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0011_qqq_110_mmm_rrr 5424: public static void irpMoveToMXWord () throws M68kException { 5425: XEiJ.mpuCycleCount += 14; 5426: int ea = XEiJ.regOC & 63; 5427: int aqq = XEiJ.regOC >> 9 & 15; 5428: int z = ea < XEiJ.EA_MM ? XEiJ.regRn[ea] : XEiJ.busRws (efaAnyWord (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ。ここでAqが変化する可能性があることに注意 5429: int w; 5430: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 5431: w = XEiJ.busRwze ((XEiJ.regPC += 2) - 2); //pcwz。拡張ワード 5432: } else { 5433: w = XEiJ.regPC; 5434: XEiJ.regPC = w + 2; 5435: w = XEiJ.busRwze (w); //pcwz。拡張ワード 5436: } 5437: XEiJ.busWw (XEiJ.regRn[aqq] //ベースレジスタ 5438: + (byte) w //バイトディスプレースメント 5439: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 5440: XEiJ.regRn[w >> 12]), //ロングインデックス 5441: z); 5442: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | (char) z - 1 >> 31 & XEiJ.REG_CCR_Z | ((short) z < 0 ? XEiJ.REG_CCR_N : 0); //ccr_tst_word 5443: } //irpMoveToMXWord 5444: 5445: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5446: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5447: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5448: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5449: //MOVE.W <ea>,(xxx).W |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0011_000_111_mmm_rrr 5450: public static void irpMoveToZWWord () throws M68kException { 5451: XEiJ.mpuCycleCount += 12; 5452: int ea = XEiJ.regOC & 63; 5453: int z = ea < XEiJ.EA_MM ? XEiJ.regRn[ea] : XEiJ.busRws (efaAnyWord (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ 5454: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 5455: XEiJ.busWw (XEiJ.busRwse ((XEiJ.regPC += 2) - 2), //pcws 5456: z); 5457: } else { 5458: int t = XEiJ.regPC; 5459: XEiJ.regPC = t + 2; 5460: XEiJ.busWw (XEiJ.busRwse (t), //pcws 5461: z); 5462: } 5463: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | (char) z - 1 >> 31 & XEiJ.REG_CCR_Z | ((short) z < 0 ? XEiJ.REG_CCR_N : 0); //ccr_tst_word 5464: } //irpMoveToZWWord 5465: 5466: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5467: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5468: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5469: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5470: //MOVE.W <ea>,(xxx).L |-|012346|-|-UUUU|-**00|DAM+-WXZPI|0011_001_111_mmm_rrr 5471: public static void irpMoveToZLWord () throws M68kException { 5472: XEiJ.mpuCycleCount += 16; 5473: int ea = XEiJ.regOC & 63; 5474: int z = ea < XEiJ.EA_MM ? XEiJ.regRn[ea] : XEiJ.busRws (efaAnyWord (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ 5475: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 5476: XEiJ.busWw (XEiJ.busRlse ((XEiJ.regPC += 4) - 4), //pcls 5477: z); 5478: } else { 5479: int t = XEiJ.regPC; 5480: XEiJ.regPC = t + 4; 5481: XEiJ.busWw (XEiJ.busRlse (t), //pcls 5482: z); 5483: } 5484: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | (char) z - 1 >> 31 & XEiJ.REG_CCR_Z | ((short) z < 0 ? XEiJ.REG_CCR_N : 0); //ccr_tst_word 5485: } //irpMoveToZLWord 5486: 5487: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5488: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5489: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5490: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5491: //NEGX.B <ea> |-|012346|-|*UUUU|*****|D M+-WXZ |0100_000_000_mmm_rrr 5492: public static void irpNegxByte () throws M68kException { 5493: int ea = XEiJ.regOC & 63; 5494: int y; 5495: int z; 5496: if (ea < XEiJ.EA_AR) { //NEGX.B Dr 5497: XEiJ.mpuCycleCount += 4; 5498: z = (byte) (XEiJ.regRn[ea] = ~0xff & (y = XEiJ.regRn[ea]) | 0xff & -(y = (byte) y) - (XEiJ.regCCR >> 4)); //Xの左側はすべて0なのでCCR_X&を省略 5499: } else { //NEGX.B <mem> 5500: XEiJ.mpuCycleCount += 8; 5501: int a = efaMltByte (ea); 5502: XEiJ.busWb (a, z = (byte) (-(y = XEiJ.busRbs (a)) - (XEiJ.regCCR >> 4))); //Xの左側はすべて0なのでCCR_X&を省略 5503: } 5504: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_Z : 0) | 5505: (y & z) >>> 31 << 1 | 5506: (y | z) >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_negx 5507: } //irpNegxByte 5508: 5509: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5510: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5511: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5512: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5513: //NEGX.W <ea> |-|012346|-|*UUUU|*****|D M+-WXZ |0100_000_001_mmm_rrr 5514: public static void irpNegxWord () throws M68kException { 5515: int ea = XEiJ.regOC & 63; 5516: int y; 5517: int z; 5518: if (ea < XEiJ.EA_AR) { //NEGX.W Dr 5519: XEiJ.mpuCycleCount += 4; 5520: z = (short) (XEiJ.regRn[ea] = ~0xffff & (y = XEiJ.regRn[ea]) | (char) (-(y = (short) y) - (XEiJ.regCCR >> 4))); //Xの左側はすべて0なのでCCR_X&を省略 5521: } else { //NEGX.W <mem> 5522: XEiJ.mpuCycleCount += 8; 5523: int a = efaMltWord (ea); 5524: XEiJ.busWw (a, z = (short) (-(y = XEiJ.busRws (a)) - (XEiJ.regCCR >> 4))); //Xの左側はすべて0なのでCCR_X&を省略 5525: } 5526: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_Z : 0) | 5527: (y & z) >>> 31 << 1 | 5528: (y | z) >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_negx 5529: } //irpNegxWord 5530: 5531: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5532: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5533: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5534: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5535: //NEGX.L <ea> |-|012346|-|*UUUU|*****|D M+-WXZ |0100_000_010_mmm_rrr 5536: public static void irpNegxLong () throws M68kException { 5537: int ea = XEiJ.regOC & 63; 5538: int y; 5539: int z; 5540: if (ea < XEiJ.EA_AR) { //NEGX.L Dr 5541: XEiJ.mpuCycleCount += 6; 5542: XEiJ.regRn[ea] = z = -(y = XEiJ.regRn[ea]) - (XEiJ.regCCR >> 4); //Xの左側はすべて0なのでCCR_X&を省略 5543: } else { //NEGX.L <mem> 5544: XEiJ.mpuCycleCount += 12; 5545: int a = efaMltLong (ea); 5546: XEiJ.busWl (a, z = -(y = XEiJ.busRls (a)) - (XEiJ.regCCR >> 4)); //Xの左側はすべて0なのでCCR_X&を省略 5547: } 5548: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_Z : 0) | 5549: (y & z) >>> 31 << 1 | 5550: (y | z) >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_negx 5551: } //irpNegxLong 5552: 5553: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5554: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5555: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5556: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5557: //MOVE.W SR,<ea> |-|0-----|-|*****|-----|D M+-WXZ |0100_000_011_mmm_rrr (68000 and 68008 read before move) 5558: public static void irpMoveFromSR () throws M68kException { 5559: //MC68000では特権命令ではない 5560: int ea = XEiJ.regOC & 63; 5561: if (ea < XEiJ.EA_AR) { //MOVE.W SR,Dr 5562: XEiJ.mpuCycleCount += 6; 5563: XEiJ.regRn[ea] = ~0xffff & XEiJ.regRn[ea] | XEiJ.regSRT1 | XEiJ.regSRS | XEiJ.regSRI | XEiJ.regCCR; 5564: } else { //MOVE.W SR,<mem> 5565: //! 軽量化。MOVE from SRによる直後の命令のイミディエイトオペランドの自己書き換えが直後に反映されてしまう 5566: // MC68000でFEファンクションコールやSXコールのようなCCRを変化させる例外処理ルーチンの出口を次のように書くと、 5567: // 自己書き換えが直後に反映されずイミディエイトオペランドの領域がバッファになって前回の結果を返すことになるので期待通りに動作しない 5568: // move.w sr,@f+2 5569: // @@: move.b #0,(1,sp) 5570: // rte 5571: // これが期待通りに動作してしまったらMC68000を正しくエミュレートできていないということになる 5572: // https://stdkmd.net/bbs/page2.htm#comment134 5573: XEiJ.mpuCycleCount += 8; 5574: int a = efaMltWord (ea); 5575: if (XEiJ.MPU_OMIT_EXTRA_READ) { 5576: //! 軽量化。MC68000では書き込む前にリードが入るが省略する 5577: } else { 5578: XEiJ.busRws (a); 5579: } 5580: XEiJ.busWw (a, XEiJ.regSRT1 | XEiJ.regSRS | XEiJ.regSRI | XEiJ.regCCR); 5581: } 5582: } //irpMoveFromSR 5583: 5584: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5585: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5586: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5587: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5588: //CHK.W <ea>,Dq |-|012346|-|-UUUU|-*UUU|D M+-WXZPI|0100_qqq_110_mmm_rrr 5589: public static void irpChkWord () throws M68kException { 5590: XEiJ.mpuCycleCount += 10; 5591: int ea = XEiJ.regOC & 63; 5592: int x = ea < XEiJ.EA_AR ? (short) XEiJ.regRn[ea] : XEiJ.busRws (efaAnyWord (ea)); 5593: int y = (short) XEiJ.regRn[XEiJ.regOC >> 9 & 7]; 5594: int z = (short) (x - y); 5595: XEiJ.regCCR = (XEiJ.regCCR & XEiJ.REG_CCR_X | 5596: (y < 0 ? XEiJ.REG_CCR_N : 0) | 5597: (y == 0 ? XEiJ.REG_CCR_Z : 0) | 5598: ((x ^ y) & (x ^ z)) >>> 31 << 1 | 5599: (x & (y ^ z) ^ (y | z)) >>> 31); 5600: if (y < 0 || x < y) { 5601: XEiJ.mpuCycleCount += 38 - 10; 5602: M68kException.m6eNumber = M68kException.M6E_CHK_INSTRUCTION; 5603: throw M68kException.m6eSignal; 5604: } 5605: } //irpChkWord 5606: 5607: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5608: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5609: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5610: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5611: //LEA.L <ea>,Aq |-|012346|-|-----|-----| M WXZP |0100_qqq_111_mmm_rrr 5612: public static void irpLea () throws M68kException { 5613: //XEiJ.mpuCycleCount += 4 - 4; 5614: XEiJ.regRn[(XEiJ.regOC >> 9) - (32 - 8)] = efaLeaPea (XEiJ.regOC & 63); 5615: } //irpLea 5616: 5617: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5618: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5619: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5620: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5621: //CLR.B <ea> |-|012346|-|-UUUU|-0100|D M+-WXZ |0100_001_000_mmm_rrr (68000 and 68008 read before clear) 5622: public static void irpClrByte () throws M68kException { 5623: int ea = XEiJ.regOC & 63; 5624: if (ea < XEiJ.EA_AR) { //CLR.B Dr 5625: XEiJ.mpuCycleCount += 4; 5626: XEiJ.regRn[ea] &= ~0xff; 5627: } else { //CLR.B <mem> 5628: XEiJ.mpuCycleCount += 8; 5629: //MC68000のCLRはリードしてからライトする 5630: if (XEiJ.MPU_OMIT_EXTRA_READ) { 5631: //! 軽量化。リードを省略する 5632: XEiJ.busWb (efaMltByte (ea), 0); 5633: } else { 5634: int a = efaMltByte (ea); 5635: XEiJ.busRbs (a); 5636: XEiJ.busWb (a, 0); 5637: } 5638: } 5639: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z; //ccr_clr 5640: } //irpClrByte 5641: 5642: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5643: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5644: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5645: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5646: //CLR.W <ea> |-|012346|-|-UUUU|-0100|D M+-WXZ |0100_001_001_mmm_rrr (68000 and 68008 read before clear) 5647: public static void irpClrWord () throws M68kException { 5648: int ea = XEiJ.regOC & 63; 5649: if (ea < XEiJ.EA_AR) { //CLR.W Dr 5650: XEiJ.mpuCycleCount += 4; 5651: XEiJ.regRn[ea] &= ~0xffff; 5652: } else { //CLR.W <mem> 5653: XEiJ.mpuCycleCount += 8; 5654: //MC68000のCLRはリードしてからライトする 5655: if (XEiJ.MPU_OMIT_EXTRA_READ) { 5656: //! 軽量化。リードを省略する 5657: XEiJ.busWw (efaMltWord (ea), 0); 5658: } else { 5659: int a = efaMltWord (ea); 5660: XEiJ.busRws (a); 5661: XEiJ.busWw (a, 0); 5662: } 5663: } 5664: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z; //ccr_clr 5665: } //irpClrWord 5666: 5667: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5668: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5669: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5670: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5671: //CLR.L <ea> |-|012346|-|-UUUU|-0100|D M+-WXZ |0100_001_010_mmm_rrr (68000 and 68008 read before clear) 5672: public static void irpClrLong () throws M68kException { 5673: int ea = XEiJ.regOC & 63; 5674: if (ea < XEiJ.EA_AR) { //CLR.L Dr 5675: XEiJ.mpuCycleCount += 6; 5676: XEiJ.regRn[ea] = 0; 5677: } else { //CLR.L <mem> 5678: XEiJ.mpuCycleCount += 12; 5679: //MC68000のCLRはリードしてからライトする 5680: if (XEiJ.MPU_OMIT_EXTRA_READ) { 5681: //! 軽量化。リードを省略する 5682: XEiJ.busWl (efaMltLong (ea), 0); 5683: } else { 5684: int a = efaMltLong (ea); 5685: XEiJ.busRls (a); 5686: XEiJ.busWl (a, 0); 5687: } 5688: } 5689: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z; //ccr_clr 5690: } //irpClrLong 5691: 5692: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5693: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5694: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5695: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5696: //NEG.B <ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0100_010_000_mmm_rrr 5697: public static void irpNegByte () throws M68kException { 5698: int ea = XEiJ.regOC & 63; 5699: int y; 5700: int z; 5701: if (ea < XEiJ.EA_AR) { //NEG.B Dr 5702: XEiJ.mpuCycleCount += 4; 5703: z = (byte) (XEiJ.regRn[ea] = ~0xff & (y = XEiJ.regRn[ea]) | 0xff & -(y = (byte) y)); 5704: } else { //NEG.B <mem> 5705: XEiJ.mpuCycleCount += 8; 5706: int a = efaMltByte (ea); 5707: XEiJ.busWb (a, z = (byte) -(y = XEiJ.busRbs (a))); 5708: } 5709: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | 5710: (y & z) >>> 31 << 1 | 5711: (y | z) >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_neg 5712: } //irpNegByte 5713: 5714: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5715: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5716: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5717: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5718: //NEG.W <ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0100_010_001_mmm_rrr 5719: public static void irpNegWord () throws M68kException { 5720: int ea = XEiJ.regOC & 63; 5721: int y; 5722: int z; 5723: if (ea < XEiJ.EA_AR) { //NEG.W Dr 5724: XEiJ.mpuCycleCount += 4; 5725: z = (short) (XEiJ.regRn[ea] = ~0xffff & (y = XEiJ.regRn[ea]) | (char) -(y = (short) y)); 5726: } else { //NEG.W <mem> 5727: XEiJ.mpuCycleCount += 8; 5728: int a = efaMltWord (ea); 5729: XEiJ.busWw (a, z = (short) -(y = XEiJ.busRws (a))); 5730: } 5731: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | 5732: (y & z) >>> 31 << 1 | 5733: (y | z) >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_neg 5734: } //irpNegWord 5735: 5736: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5737: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5738: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5739: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5740: //NEG.L <ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0100_010_010_mmm_rrr 5741: public static void irpNegLong () throws M68kException { 5742: int ea = XEiJ.regOC & 63; 5743: int y; 5744: int z; 5745: if (ea < XEiJ.EA_AR) { //NEG.L Dr 5746: XEiJ.mpuCycleCount += 6; 5747: XEiJ.regRn[ea] = z = -(y = XEiJ.regRn[ea]); 5748: } else { //NEG.L <mem> 5749: XEiJ.mpuCycleCount += 12; 5750: int a = efaMltLong (ea); 5751: XEiJ.busWl (a, z = -(y = XEiJ.busRls (a))); 5752: } 5753: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | 5754: (y & z) >>> 31 << 1 | 5755: (y | z) >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_neg 5756: } //irpNegLong 5757: 5758: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5759: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5760: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5761: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5762: //MOVE.W <ea>,CCR |-|012346|-|UUUUU|*****|D M+-WXZPI|0100_010_011_mmm_rrr 5763: public static void irpMoveToCCR () throws M68kException { 5764: XEiJ.mpuCycleCount += 12; 5765: int ea = XEiJ.regOC & 63; 5766: XEiJ.regCCR = XEiJ.REG_CCR_MASK & (ea < XEiJ.EA_AR ? XEiJ.regRn[ea] : XEiJ.busRws (efaAnyWord (ea))); 5767: } //irpMoveToCCR 5768: 5769: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5770: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5771: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5772: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5773: //NOT.B <ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0100_011_000_mmm_rrr 5774: public static void irpNotByte () throws M68kException { 5775: int ea = XEiJ.regOC & 63; 5776: int z; 5777: if (ea < XEiJ.EA_AR) { //NOT.B Dr 5778: XEiJ.mpuCycleCount += 4; 5779: z = XEiJ.regRn[ea] ^= 255; //0拡張してからEOR 5780: } else { //NOT.B <mem> 5781: XEiJ.mpuCycleCount += 8; 5782: int a = efaMltByte (ea); 5783: XEiJ.busWb (a, z = ~XEiJ.busRbs (a)); 5784: } 5785: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.MPU_TSTB_TABLE[255 & z]; //ccr_tst_byte 5786: } //irpNotByte 5787: 5788: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5789: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5790: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5791: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5792: //NOT.W <ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0100_011_001_mmm_rrr 5793: public static void irpNotWord () throws M68kException { 5794: int ea = XEiJ.regOC & 63; 5795: int z; 5796: if (ea < XEiJ.EA_AR) { //NOT.W Dr 5797: XEiJ.mpuCycleCount += 4; 5798: z = XEiJ.regRn[ea] ^= 65535; //0拡張してからEOR 5799: } else { //NOT.W <mem> 5800: XEiJ.mpuCycleCount += 8; 5801: int a = efaMltWord (ea); 5802: XEiJ.busWw (a, z = ~XEiJ.busRws (a)); 5803: } 5804: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | (char) z - 1 >> 31 & XEiJ.REG_CCR_Z | ((short) z < 0 ? XEiJ.REG_CCR_N : 0); //ccr_tst_word 5805: } //irpNotWord 5806: 5807: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5808: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5809: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5810: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5811: //NOT.L <ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0100_011_010_mmm_rrr 5812: public static void irpNotLong () throws M68kException { 5813: int ea = XEiJ.regOC & 63; 5814: int z; 5815: if (ea < XEiJ.EA_AR) { //NOT.L Dr 5816: XEiJ.mpuCycleCount += 6; 5817: z = XEiJ.regRn[ea] ^= 0xffffffff; 5818: } else { //NOT.L <mem> 5819: XEiJ.mpuCycleCount += 12; 5820: int a = efaMltLong (ea); 5821: XEiJ.busWl (a, z = ~XEiJ.busRls (a)); 5822: } 5823: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 5824: } //irpNotLong 5825: 5826: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5827: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5828: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5829: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5830: //MOVE.W <ea>,SR |-|012346|P|UUUUU|*****|D M+-WXZPI|0100_011_011_mmm_rrr 5831: public static void irpMoveToSR () throws M68kException { 5832: if (XEiJ.regSRS == 0) { //ユーザモードのとき 5833: XEiJ.mpuCycleCount += 34; 5834: M68kException.m6eNumber = M68kException.M6E_PRIVILEGE_VIOLATION; 5835: throw M68kException.m6eSignal; 5836: } 5837: //以下はスーパーバイザモード 5838: XEiJ.mpuCycleCount += 12; 5839: int ea = XEiJ.regOC & 63; 5840: irpSetSR (ea < XEiJ.EA_AR ? XEiJ.regRn[ea] : XEiJ.busRwz (efaAnyWord (ea))); //特権違反チェックが先 5841: } //irpMoveToSR 5842: 5843: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5844: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5845: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5846: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5847: //NBCD.B <ea> |-|012346|-|UUUUU|*U*U*|D M+-WXZ |0100_100_000_mmm_rrr 5848: public static void irpNbcd () throws M68kException { 5849: int ea = XEiJ.regOC & 63; 5850: if (ea < XEiJ.EA_AR) { //NBCD.B Dr 5851: XEiJ.mpuCycleCount += 6; 5852: XEiJ.regRn[ea] = ~0xff & XEiJ.regRn[ea] | irpSbcd (0, XEiJ.regRn[ea]); 5853: } else { //NBCD.B <mem> 5854: XEiJ.mpuCycleCount += 8; 5855: int a = efaMltByte (ea); 5856: XEiJ.busWb (a, irpSbcd (0, XEiJ.busRbs (a))); 5857: } 5858: } //irpNbcd 5859: 5860: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5861: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5862: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5863: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5864: //SWAP.W Dr |-|012346|-|-UUUU|-**00|D |0100_100_001_000_rrr 5865: //PEA.L <ea> |-|012346|-|-----|-----| M WXZP |0100_100_001_mmm_rrr 5866: public static void irpPea () throws M68kException { 5867: int ea = XEiJ.regOC & 63; 5868: if (ea < XEiJ.EA_AR) { //SWAP.W Dr 5869: XEiJ.mpuCycleCount += 4; 5870: int x; 5871: int z; 5872: XEiJ.regRn[ea] = z = (x = XEiJ.regRn[ea]) << 16 | x >>> 16; 5873: //上位ワードと下位ワードを入れ替えた後のDrをロングでテストする 5874: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 5875: } else { //PEA.L <ea> 5876: XEiJ.mpuCycleCount += 12 - 4; 5877: int a = efaLeaPea (ea); //BKPT #<data>はここでillegal instructionになる 5878: XEiJ.busWl (XEiJ.regRn[15] -= 4, a); //pushl。評価順序に注意。wl(r[15]-=4,eaz_leapea(ea))は不可 5879: } 5880: } //irpPea 5881: 5882: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5883: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 5884: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 5885: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 5886: //EXT.W Dr |-|012346|-|-UUUU|-**00|D |0100_100_010_000_rrr 5887: //MOVEM.W <list>,<ea> |-|012346|-|-----|-----| M -WXZ |0100_100_010_mmm_rrr-llllllllllllllll 5888: public static void irpMovemToMemWord () throws M68kException { 5889: int ea = XEiJ.regOC & 63; 5890: if (ea < XEiJ.EA_AR) { //EXT.W Dr 5891: XEiJ.mpuCycleCount += 4; 5892: int z; 5893: XEiJ.regRn[ea] = ~0xffff & (z = XEiJ.regRn[ea]) | (char) (z = (byte) z); 5894: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 5895: } else { //MOVEM.W <list>,<ea> 5896: int l = XEiJ.busRwze (XEiJ.regPC); //pcwze。レジスタリスト。ゼロ拡張 5897: XEiJ.regPC += 2; 5898: if (ea >> 3 == XEiJ.MMM_MN) { //-(Ar) 5899: //MOVEM.wl <list>,-(Ar)で<list>にArが含まれているとき、000/010は命令開始時のArを、020/030/040/060は命令開始時のAr-オペレーションサイズをメモリに書き込む 5900: //転送するレジスタが0個のときArは変化しない 5901: int arr = ea - (XEiJ.EA_MN - 8); 5902: int a = XEiJ.regRn[arr]; 5903: if ((a & 1) != 0 && l != 0) { //奇数アドレスで1ワード以上転送する 5904: M68kException.m6eNumber = M68kException.M6E_ADDRESS_ERROR; 5905: M68kException.m6eAddress = a; 5906: M68kException.m6eDirection = XEiJ.MPU_WR_WRITE; 5907: M68kException.m6eSize = XEiJ.MPU_SS_WORD; 5908: throw M68kException.m6eSignal; 5909: } 5910: int t = a; 5911: if (XEiJ.IRP_MOVEM_MAINMEMORY && //000のときMOVEMでメインメモリを特別扱いにする 5912: (DataBreakPoint.DBP_ON ? DataBreakPoint.dbpSuperMap : XEiJ.busSuperMap)[a - 2 >>> XEiJ.BUS_PAGE_BITS] == MemoryMappedDevice.MMD_MMR && //メインメモリ 5913: 2 * 16 <= (a & XEiJ.BUS_PAGE_SIZE - 1)) { //16個転送してもページを跨がない 5914: a &= XEiJ.BUS_MOTHER_MASK; 5915: if (XEiJ.IRP_MOVEM_EXPAND) { //16回展開する 5916: if ((l & 0x0001) != 0) { 5917: a -= 2; 5918: int x = XEiJ.regRn[15]; 5919: MainMemory.mmrM8[a ] = (byte) (x >> 8); 5920: MainMemory.mmrM8[a + 1] = (byte) x; 5921: } 5922: if ((l & 0x0002) != 0) { 5923: a -= 2; 5924: int x = XEiJ.regRn[14]; 5925: MainMemory.mmrM8[a ] = (byte) (x >> 8); 5926: MainMemory.mmrM8[a + 1] = (byte) x; 5927: } 5928: if ((l & 0x0004) != 0) { 5929: a -= 2; 5930: int x = XEiJ.regRn[13]; 5931: MainMemory.mmrM8[a ] = (byte) (x >> 8); 5932: MainMemory.mmrM8[a + 1] = (byte) x; 5933: } 5934: if ((l & 0x0008) != 0) { 5935: a -= 2; 5936: int x = XEiJ.regRn[12]; 5937: MainMemory.mmrM8[a ] = (byte) (x >> 8); 5938: MainMemory.mmrM8[a + 1] = (byte) x; 5939: } 5940: if ((l & 0x0010) != 0) { 5941: a -= 2; 5942: int x = XEiJ.regRn[11]; 5943: MainMemory.mmrM8[a ] = (byte) (x >> 8); 5944: MainMemory.mmrM8[a + 1] = (byte) x; 5945: } 5946: if ((l & 0x0020) != 0) { 5947: a -= 2; 5948: int x = XEiJ.regRn[10]; 5949: MainMemory.mmrM8[a ] = (byte) (x >> 8); 5950: MainMemory.mmrM8[a + 1] = (byte) x; 5951: } 5952: if ((l & 0x0040) != 0) { 5953: a -= 2; 5954: int x = XEiJ.regRn[ 9]; 5955: MainMemory.mmrM8[a ] = (byte) (x >> 8); 5956: MainMemory.mmrM8[a + 1] = (byte) x; 5957: } 5958: if ((byte) l < 0) { //(l & 0x0080) != 0 5959: a -= 2; 5960: int x = XEiJ.regRn[ 8]; 5961: MainMemory.mmrM8[a ] = (byte) (x >> 8); 5962: MainMemory.mmrM8[a + 1] = (byte) x; 5963: } 5964: if ((l & 0x0100) != 0) { 5965: a -= 2; 5966: int x = XEiJ.regRn[ 7]; 5967: MainMemory.mmrM8[a ] = (byte) (x >> 8); 5968: MainMemory.mmrM8[a + 1] = (byte) x; 5969: } 5970: if ((l & 0x0200) != 0) { 5971: a -= 2; 5972: int x = XEiJ.regRn[ 6]; 5973: MainMemory.mmrM8[a ] = (byte) (x >> 8); 5974: MainMemory.mmrM8[a + 1] = (byte) x; 5975: } 5976: if ((l & 0x0400) != 0) { 5977: a -= 2; 5978: int x = XEiJ.regRn[ 5]; 5979: MainMemory.mmrM8[a ] = (byte) (x >> 8); 5980: MainMemory.mmrM8[a + 1] = (byte) x; 5981: } 5982: if ((l & 0x0800) != 0) { 5983: a -= 2; 5984: int x = XEiJ.regRn[ 4]; 5985: MainMemory.mmrM8[a ] = (byte) (x >> 8); 5986: MainMemory.mmrM8[a + 1] = (byte) x; 5987: } 5988: if ((l & 0x1000) != 0) { 5989: a -= 2; 5990: int x = XEiJ.regRn[ 3]; 5991: MainMemory.mmrM8[a ] = (byte) (x >> 8); 5992: MainMemory.mmrM8[a + 1] = (byte) x; 5993: } 5994: if ((l & 0x2000) != 0) { 5995: a -= 2; 5996: int x = XEiJ.regRn[ 2]; 5997: MainMemory.mmrM8[a ] = (byte) (x >> 8); 5998: MainMemory.mmrM8[a + 1] = (byte) x; 5999: } 6000: if ((l & 0x4000) != 0) { 6001: a -= 2; 6002: int x = XEiJ.regRn[ 1]; 6003: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6004: MainMemory.mmrM8[a + 1] = (byte) x; 6005: } 6006: if ((short) l < 0) { //(l & 0x8000) != 0 6007: a -= 2; 6008: int x = XEiJ.regRn[ 0]; 6009: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6010: MainMemory.mmrM8[a + 1] = (byte) x; 6011: } 6012: } else if (XEiJ.IRP_MOVEM_LOOP) { //16回ループする。コンパイラが展開する 6013: for (int i = 15; i >= 0; i--) { 6014: if ((l & 0x8000 >>> i) != 0) { 6015: a -= 2; 6016: int x = XEiJ.regRn[i]; 6017: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6018: MainMemory.mmrM8[a + 1] = (byte) x; 6019: } 6020: } 6021: } else if (XEiJ.IRP_MOVEM_SHIFT_LEFT) { //0になるまで左にシフトする 6022: l = XEiJ.MPU_BITREV_TABLE_0[l & 2047] | XEiJ.MPU_BITREV_TABLE_1[l << 10 >>> 21]; //Integer.reverse(l) 6023: for (int i = 15; l != 0; i--, l <<= 1) { 6024: if (l < 0) { 6025: a -= 2; 6026: int x = XEiJ.regRn[i]; 6027: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6028: MainMemory.mmrM8[a + 1] = (byte) x; 6029: } 6030: } 6031: } else if (XEiJ.IRP_MOVEM_SHIFT_RIGHT) { //0になるまで右にシフトする 6032: for (int i = 15; l != 0; i--, l >>>= 1) { 6033: if ((l & 1) != 0) { 6034: a -= 2; 6035: int x = XEiJ.regRn[i]; 6036: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6037: MainMemory.mmrM8[a + 1] = (byte) x; 6038: } 6039: } 6040: } else if (XEiJ.IRP_MOVEM_ZEROS) { //Integer.numberOfTrailingZerosを使う 6041: for (int i = 15; l != 0; ) { 6042: int k = Integer.numberOfTrailingZeros (l); 6043: a -= 2; 6044: int x = XEiJ.regRn[i -= k]; 6045: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6046: MainMemory.mmrM8[a + 1] = (byte) x; 6047: l = l >>> k & ~1; 6048: } 6049: } 6050: a = t - (short) (t - a); 6051: } else { //メインメモリでないかページを跨ぐ可能性がある 6052: if (XEiJ.IRP_MOVEM_EXPAND) { //16回展開する 6053: if ((l & 0x0001) != 0) { 6054: XEiJ.busWwe (a -= 2, XEiJ.regRn[15]); 6055: } 6056: if ((l & 0x0002) != 0) { 6057: XEiJ.busWwe (a -= 2, XEiJ.regRn[14]); 6058: } 6059: if ((l & 0x0004) != 0) { 6060: XEiJ.busWwe (a -= 2, XEiJ.regRn[13]); 6061: } 6062: if ((l & 0x0008) != 0) { 6063: XEiJ.busWwe (a -= 2, XEiJ.regRn[12]); 6064: } 6065: if ((l & 0x0010) != 0) { 6066: XEiJ.busWwe (a -= 2, XEiJ.regRn[11]); 6067: } 6068: if ((l & 0x0020) != 0) { 6069: XEiJ.busWwe (a -= 2, XEiJ.regRn[10]); 6070: } 6071: if ((l & 0x0040) != 0) { 6072: XEiJ.busWwe (a -= 2, XEiJ.regRn[ 9]); 6073: } 6074: if ((byte) l < 0) { //(l & 0x0080) != 0 6075: XEiJ.busWwe (a -= 2, XEiJ.regRn[ 8]); 6076: } 6077: if ((l & 0x0100) != 0) { 6078: XEiJ.busWwe (a -= 2, XEiJ.regRn[ 7]); 6079: } 6080: if ((l & 0x0200) != 0) { 6081: XEiJ.busWwe (a -= 2, XEiJ.regRn[ 6]); 6082: } 6083: if ((l & 0x0400) != 0) { 6084: XEiJ.busWwe (a -= 2, XEiJ.regRn[ 5]); 6085: } 6086: if ((l & 0x0800) != 0) { 6087: XEiJ.busWwe (a -= 2, XEiJ.regRn[ 4]); 6088: } 6089: if ((l & 0x1000) != 0) { 6090: XEiJ.busWwe (a -= 2, XEiJ.regRn[ 3]); 6091: } 6092: if ((l & 0x2000) != 0) { 6093: XEiJ.busWwe (a -= 2, XEiJ.regRn[ 2]); 6094: } 6095: if ((l & 0x4000) != 0) { 6096: XEiJ.busWwe (a -= 2, XEiJ.regRn[ 1]); 6097: } 6098: if ((short) l < 0) { //(l & 0x8000) != 0 6099: XEiJ.busWwe (a -= 2, XEiJ.regRn[ 0]); 6100: } 6101: } else if (XEiJ.IRP_MOVEM_LOOP) { //16回ループする。コンパイラが展開する 6102: for (int i = 15; i >= 0; i--) { 6103: if ((l & 0x8000 >>> i) != 0) { 6104: XEiJ.busWwe (a -= 2, XEiJ.regRn[i]); 6105: } 6106: } 6107: } else if (XEiJ.IRP_MOVEM_SHIFT_LEFT) { //0になるまで左にシフトする 6108: l = XEiJ.MPU_BITREV_TABLE_0[l & 2047] | XEiJ.MPU_BITREV_TABLE_1[l << 10 >>> 21]; //Integer.reverse(l) 6109: for (int i = 15; l != 0; i--, l <<= 1) { 6110: if (l < 0) { 6111: XEiJ.busWwe (a -= 2, XEiJ.regRn[i]); 6112: } 6113: } 6114: } else if (XEiJ.IRP_MOVEM_SHIFT_RIGHT) { //0になるまで右にシフトする 6115: for (int i = 15; l != 0; i--, l >>>= 1) { 6116: if ((l & 1) != 0) { 6117: XEiJ.busWwe (a -= 2, XEiJ.regRn[i]); 6118: } 6119: } 6120: } else if (XEiJ.IRP_MOVEM_ZEROS) { //Integer.numberOfTrailingZerosを使う 6121: for (int i = 15; l != 0; ) { 6122: int k = Integer.numberOfTrailingZeros (l); 6123: XEiJ.busWwe (a -= 2, XEiJ.regRn[i -= k]); 6124: l = l >>> k & ~1; 6125: } 6126: } 6127: } 6128: XEiJ.regRn[arr] = a; 6129: XEiJ.mpuCycleCount += 8 + (t - a << 1); //2バイト/個→4サイクル/個 6130: } else { //-(Ar)以外 6131: int a = efaCltWord (ea); 6132: if ((a & 1) != 0 && l != 0) { //奇数アドレスで1ワード以上転送する 6133: M68kException.m6eNumber = M68kException.M6E_ADDRESS_ERROR; 6134: M68kException.m6eAddress = a; 6135: M68kException.m6eDirection = XEiJ.MPU_WR_WRITE; 6136: M68kException.m6eSize = XEiJ.MPU_SS_WORD; 6137: throw M68kException.m6eSignal; 6138: } 6139: int t = a; 6140: if (XEiJ.IRP_MOVEM_MAINMEMORY && //000のときMOVEMでメインメモリを特別扱いにする 6141: (DataBreakPoint.DBP_ON ? DataBreakPoint.dbpSuperMap : XEiJ.busSuperMap)[a >>> XEiJ.BUS_PAGE_BITS] == MemoryMappedDevice.MMD_MMR && //メインメモリ 6142: (a & XEiJ.BUS_PAGE_SIZE - 1) <= XEiJ.BUS_PAGE_SIZE - 2 * 16) { //16個転送してもページを跨がない 6143: a &= XEiJ.BUS_MOTHER_MASK; 6144: if (XEiJ.IRP_MOVEM_EXPAND) { //16回展開する 6145: if ((l & 0x0001) != 0) { 6146: int x = XEiJ.regRn[ 0]; 6147: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6148: MainMemory.mmrM8[a + 1] = (byte) x; 6149: a += 2; 6150: } 6151: if ((l & 0x0002) != 0) { 6152: int x = XEiJ.regRn[ 1]; 6153: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6154: MainMemory.mmrM8[a + 1] = (byte) x; 6155: a += 2; 6156: } 6157: if ((l & 0x0004) != 0) { 6158: int x = XEiJ.regRn[ 2]; 6159: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6160: MainMemory.mmrM8[a + 1] = (byte) x; 6161: a += 2; 6162: } 6163: if ((l & 0x0008) != 0) { 6164: int x = XEiJ.regRn[ 3]; 6165: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6166: MainMemory.mmrM8[a + 1] = (byte) x; 6167: a += 2; 6168: } 6169: if ((l & 0x0010) != 0) { 6170: int x = XEiJ.regRn[ 4]; 6171: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6172: MainMemory.mmrM8[a + 1] = (byte) x; 6173: a += 2; 6174: } 6175: if ((l & 0x0020) != 0) { 6176: int x = XEiJ.regRn[ 5]; 6177: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6178: MainMemory.mmrM8[a + 1] = (byte) x; 6179: a += 2; 6180: } 6181: if ((l & 0x0040) != 0) { 6182: int x = XEiJ.regRn[ 6]; 6183: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6184: MainMemory.mmrM8[a + 1] = (byte) x; 6185: a += 2; 6186: } 6187: if ((byte) l < 0) { //(l & 0x0080) != 0 6188: int x = XEiJ.regRn[ 7]; 6189: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6190: MainMemory.mmrM8[a + 1] = (byte) x; 6191: a += 2; 6192: } 6193: if ((l & 0x0100) != 0) { 6194: int x = XEiJ.regRn[ 8]; 6195: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6196: MainMemory.mmrM8[a + 1] = (byte) x; 6197: a += 2; 6198: } 6199: if ((l & 0x0200) != 0) { 6200: int x = XEiJ.regRn[ 9]; 6201: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6202: MainMemory.mmrM8[a + 1] = (byte) x; 6203: a += 2; 6204: } 6205: if ((l & 0x0400) != 0) { 6206: int x = XEiJ.regRn[10]; 6207: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6208: MainMemory.mmrM8[a + 1] = (byte) x; 6209: a += 2; 6210: } 6211: if ((l & 0x0800) != 0) { 6212: int x = XEiJ.regRn[11]; 6213: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6214: MainMemory.mmrM8[a + 1] = (byte) x; 6215: a += 2; 6216: } 6217: if ((l & 0x1000) != 0) { 6218: int x = XEiJ.regRn[12]; 6219: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6220: MainMemory.mmrM8[a + 1] = (byte) x; 6221: a += 2; 6222: } 6223: if ((l & 0x2000) != 0) { 6224: int x = XEiJ.regRn[13]; 6225: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6226: MainMemory.mmrM8[a + 1] = (byte) x; 6227: a += 2; 6228: } 6229: if ((l & 0x4000) != 0) { 6230: int x = XEiJ.regRn[14]; 6231: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6232: MainMemory.mmrM8[a + 1] = (byte) x; 6233: a += 2; 6234: } 6235: if ((short) l < 0) { //(l & 0x8000) != 0 6236: int x = XEiJ.regRn[15]; 6237: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6238: MainMemory.mmrM8[a + 1] = (byte) x; 6239: a += 2; 6240: } 6241: } else if (XEiJ.IRP_MOVEM_LOOP) { //16回ループする。コンパイラが展開する 6242: for (int i = 0; i <= 15; i++) { 6243: if ((l & 0x0001 << i) != 0) { 6244: int x = XEiJ.regRn[i]; 6245: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6246: MainMemory.mmrM8[a + 1] = (byte) x; 6247: a += 2; 6248: } 6249: } 6250: } else if (XEiJ.IRP_MOVEM_SHIFT_LEFT) { //0になるまで左にシフトする 6251: l = XEiJ.MPU_BITREV_TABLE_0[l & 2047] | XEiJ.MPU_BITREV_TABLE_1[l << 10 >>> 21]; //Integer.reverse(l) 6252: for (int i = 0; l != 0; i++, l <<= 1) { 6253: if (l < 0) { 6254: int x = XEiJ.regRn[i]; 6255: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6256: MainMemory.mmrM8[a + 1] = (byte) x; 6257: a += 2; 6258: } 6259: } 6260: } else if (XEiJ.IRP_MOVEM_SHIFT_RIGHT) { //0になるまで右にシフトする 6261: for (int i = 0; l != 0; i++, l >>>= 1) { 6262: if ((l & 1) != 0) { 6263: int x = XEiJ.regRn[i]; 6264: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6265: MainMemory.mmrM8[a + 1] = (byte) x; 6266: a += 2; 6267: } 6268: } 6269: } else if (XEiJ.IRP_MOVEM_ZEROS) { //Integer.numberOfTrailingZerosを使う 6270: for (int i = 0; l != 0; ) { 6271: int k = Integer.numberOfTrailingZeros (l); 6272: int x = XEiJ.regRn[i += k]; 6273: MainMemory.mmrM8[a ] = (byte) (x >> 8); 6274: MainMemory.mmrM8[a + 1] = (byte) x; 6275: a += 2; 6276: l = l >>> k & ~1; 6277: } 6278: } 6279: a = t + (short) (a - t); 6280: } else { //メインメモリでないかページを跨ぐ可能性がある 6281: if (XEiJ.IRP_MOVEM_EXPAND) { //16回展開する 6282: if ((l & 0x0001) != 0) { 6283: XEiJ.busWwe (a, XEiJ.regRn[ 0]); 6284: a += 2; 6285: } 6286: if ((l & 0x0002) != 0) { 6287: XEiJ.busWwe (a, XEiJ.regRn[ 1]); 6288: a += 2; 6289: } 6290: if ((l & 0x0004) != 0) { 6291: XEiJ.busWwe (a, XEiJ.regRn[ 2]); 6292: a += 2; 6293: } 6294: if ((l & 0x0008) != 0) { 6295: XEiJ.busWwe (a, XEiJ.regRn[ 3]); 6296: a += 2; 6297: } 6298: if ((l & 0x0010) != 0) { 6299: XEiJ.busWwe (a, XEiJ.regRn[ 4]); 6300: a += 2; 6301: } 6302: if ((l & 0x0020) != 0) { 6303: XEiJ.busWwe (a, XEiJ.regRn[ 5]); 6304: a += 2; 6305: } 6306: if ((l & 0x0040) != 0) { 6307: XEiJ.busWwe (a, XEiJ.regRn[ 6]); 6308: a += 2; 6309: } 6310: if ((byte) l < 0) { //(l & 0x0080) != 0 6311: XEiJ.busWwe (a, XEiJ.regRn[ 7]); 6312: a += 2; 6313: } 6314: if ((l & 0x0100) != 0) { 6315: XEiJ.busWwe (a, XEiJ.regRn[ 8]); 6316: a += 2; 6317: } 6318: if ((l & 0x0200) != 0) { 6319: XEiJ.busWwe (a, XEiJ.regRn[ 9]); 6320: a += 2; 6321: } 6322: if ((l & 0x0400) != 0) { 6323: XEiJ.busWwe (a, XEiJ.regRn[10]); 6324: a += 2; 6325: } 6326: if ((l & 0x0800) != 0) { 6327: XEiJ.busWwe (a, XEiJ.regRn[11]); 6328: a += 2; 6329: } 6330: if ((l & 0x1000) != 0) { 6331: XEiJ.busWwe (a, XEiJ.regRn[12]); 6332: a += 2; 6333: } 6334: if ((l & 0x2000) != 0) { 6335: XEiJ.busWwe (a, XEiJ.regRn[13]); 6336: a += 2; 6337: } 6338: if ((l & 0x4000) != 0) { 6339: XEiJ.busWwe (a, XEiJ.regRn[14]); 6340: a += 2; 6341: } 6342: if ((short) l < 0) { //(l & 0x8000) != 0 6343: XEiJ.busWwe (a, XEiJ.regRn[15]); 6344: a += 2; 6345: } 6346: } else if (XEiJ.IRP_MOVEM_LOOP) { //16回ループする。コンパイラが展開する 6347: for (int i = 0; i <= 15; i++) { 6348: if ((l & 0x0001 << i) != 0) { 6349: XEiJ.busWwe (a, XEiJ.regRn[i]); 6350: a += 2; 6351: } 6352: } 6353: } else if (XEiJ.IRP_MOVEM_SHIFT_LEFT) { //0になるまで左にシフトする 6354: l = XEiJ.MPU_BITREV_TABLE_0[l & 2047] | XEiJ.MPU_BITREV_TABLE_1[l << 10 >>> 21]; //Integer.reverse(l) 6355: for (int i = 0; l != 0; i++, l <<= 1) { 6356: if (l < 0) { 6357: XEiJ.busWwe (a, XEiJ.regRn[i]); 6358: a += 2; 6359: } 6360: } 6361: } else if (XEiJ.IRP_MOVEM_SHIFT_RIGHT) { //0になるまで右にシフトする 6362: for (int i = 0; l != 0; i++, l >>>= 1) { 6363: if ((l & 1) != 0) { 6364: XEiJ.busWwe (a, XEiJ.regRn[i]); 6365: a += 2; 6366: } 6367: } 6368: } else if (XEiJ.IRP_MOVEM_ZEROS) { //Integer.numberOfTrailingZerosを使う 6369: for (int i = 0; l != 0; ) { 6370: int k = Integer.numberOfTrailingZeros (l); 6371: XEiJ.busWwe (a, XEiJ.regRn[i += k]); 6372: a += 2; 6373: l = l >>> k & ~1; 6374: } 6375: } 6376: } 6377: XEiJ.mpuCycleCount += 4 + (a - t << 1); //2バイト/個→4サイクル/個 6378: } 6379: } 6380: } //irpMovemToMemWord 6381: 6382: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 6383: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 6384: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 6385: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 6386: //EXT.L Dr |-|012346|-|-UUUU|-**00|D |0100_100_011_000_rrr 6387: //MOVEM.L <list>,<ea> |-|012346|-|-----|-----| M -WXZ |0100_100_011_mmm_rrr-llllllllllllllll 6388: public static void irpMovemToMemLong () throws M68kException { 6389: int ea = XEiJ.regOC & 63; 6390: if (ea < XEiJ.EA_AR) { //EXT.L Dr 6391: XEiJ.mpuCycleCount += 4; 6392: int z; 6393: XEiJ.regRn[ea] = z = (short) XEiJ.regRn[ea]; 6394: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 6395: } else { //MOVEM.L <list>,<ea> 6396: int l = XEiJ.busRwze (XEiJ.regPC); //pcwze。レジスタリスト。ゼロ拡張 6397: XEiJ.regPC += 2; 6398: if (ea >> 3 == XEiJ.MMM_MN) { //-(Ar) 6399: //MOVEM.wl <list>,-(Ar)で<list>にArが含まれているとき、000/010は命令開始時のArを、020/030/040/060は命令開始時のAr-オペレーションサイズをメモリに書き込む 6400: //転送するレジスタが0個のときArは変化しない 6401: int arr = ea - (XEiJ.EA_MN - 8); 6402: int a = XEiJ.regRn[arr]; 6403: if ((a & 1) != 0 && l != 0) { //奇数アドレスで1ワード以上転送する 6404: M68kException.m6eNumber = M68kException.M6E_ADDRESS_ERROR; 6405: M68kException.m6eAddress = a; 6406: M68kException.m6eDirection = XEiJ.MPU_WR_WRITE; 6407: M68kException.m6eSize = XEiJ.MPU_SS_LONG; 6408: throw M68kException.m6eSignal; 6409: } 6410: int t = a; 6411: if (XEiJ.IRP_MOVEM_MAINMEMORY && //000のときMOVEMでメインメモリを特別扱いにする 6412: (DataBreakPoint.DBP_ON ? DataBreakPoint.dbpSuperMap : XEiJ.busSuperMap)[a - 4 >>> XEiJ.BUS_PAGE_BITS] == MemoryMappedDevice.MMD_MMR && //メインメモリ 6413: 4 * 16 <= (a & XEiJ.BUS_PAGE_SIZE - 1)) { //16個転送してもページを跨がない 6414: a &= XEiJ.BUS_MOTHER_MASK; 6415: if (XEiJ.IRP_MOVEM_EXPAND) { //16回展開する 6416: if ((l & 0x0001) != 0) { 6417: a -= 4; 6418: int x = XEiJ.regRn[15]; 6419: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6420: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6421: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6422: MainMemory.mmrM8[a + 3] = (byte) x; 6423: } 6424: if ((l & 0x0002) != 0) { 6425: a -= 4; 6426: int x = XEiJ.regRn[14]; 6427: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6428: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6429: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6430: MainMemory.mmrM8[a + 3] = (byte) x; 6431: } 6432: if ((l & 0x0004) != 0) { 6433: a -= 4; 6434: int x = XEiJ.regRn[13]; 6435: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6436: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6437: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6438: MainMemory.mmrM8[a + 3] = (byte) x; 6439: } 6440: if ((l & 0x0008) != 0) { 6441: a -= 4; 6442: int x = XEiJ.regRn[12]; 6443: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6444: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6445: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6446: MainMemory.mmrM8[a + 3] = (byte) x; 6447: } 6448: if ((l & 0x0010) != 0) { 6449: a -= 4; 6450: int x = XEiJ.regRn[11]; 6451: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6452: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6453: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6454: MainMemory.mmrM8[a + 3] = (byte) x; 6455: } 6456: if ((l & 0x0020) != 0) { 6457: a -= 4; 6458: int x = XEiJ.regRn[10]; 6459: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6460: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6461: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6462: MainMemory.mmrM8[a + 3] = (byte) x; 6463: } 6464: if ((l & 0x0040) != 0) { 6465: a -= 4; 6466: int x = XEiJ.regRn[ 9]; 6467: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6468: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6469: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6470: MainMemory.mmrM8[a + 3] = (byte) x; 6471: } 6472: if ((byte) l < 0) { //(l & 0x0080) != 0 6473: a -= 4; 6474: int x = XEiJ.regRn[ 8]; 6475: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6476: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6477: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6478: MainMemory.mmrM8[a + 3] = (byte) x; 6479: } 6480: if ((l & 0x0100) != 0) { 6481: a -= 4; 6482: int x = XEiJ.regRn[ 7]; 6483: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6484: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6485: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6486: MainMemory.mmrM8[a + 3] = (byte) x; 6487: } 6488: if ((l & 0x0200) != 0) { 6489: a -= 4; 6490: int x = XEiJ.regRn[ 6]; 6491: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6492: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6493: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6494: MainMemory.mmrM8[a + 3] = (byte) x; 6495: } 6496: if ((l & 0x0400) != 0) { 6497: a -= 4; 6498: int x = XEiJ.regRn[ 5]; 6499: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6500: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6501: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6502: MainMemory.mmrM8[a + 3] = (byte) x; 6503: } 6504: if ((l & 0x0800) != 0) { 6505: a -= 4; 6506: int x = XEiJ.regRn[ 4]; 6507: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6508: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6509: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6510: MainMemory.mmrM8[a + 3] = (byte) x; 6511: } 6512: if ((l & 0x1000) != 0) { 6513: a -= 4; 6514: int x = XEiJ.regRn[ 3]; 6515: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6516: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6517: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6518: MainMemory.mmrM8[a + 3] = (byte) x; 6519: } 6520: if ((l & 0x2000) != 0) { 6521: a -= 4; 6522: int x = XEiJ.regRn[ 2]; 6523: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6524: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6525: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6526: MainMemory.mmrM8[a + 3] = (byte) x; 6527: } 6528: if ((l & 0x4000) != 0) { 6529: a -= 4; 6530: int x = XEiJ.regRn[ 1]; 6531: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6532: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6533: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6534: MainMemory.mmrM8[a + 3] = (byte) x; 6535: } 6536: if ((short) l < 0) { //(l & 0x8000) != 0 6537: a -= 4; 6538: int x = XEiJ.regRn[ 0]; 6539: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6540: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6541: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6542: MainMemory.mmrM8[a + 3] = (byte) x; 6543: } 6544: } else if (XEiJ.IRP_MOVEM_LOOP) { //16回ループする。コンパイラが展開する 6545: for (int i = 15; i >= 0; i--) { 6546: if ((l & 0x8000 >>> i) != 0) { 6547: a -= 4; 6548: int x = XEiJ.regRn[i]; 6549: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6550: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6551: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6552: MainMemory.mmrM8[a + 3] = (byte) x; 6553: } 6554: } 6555: } else if (XEiJ.IRP_MOVEM_SHIFT_LEFT) { //0になるまで左にシフトする 6556: l = XEiJ.MPU_BITREV_TABLE_0[l & 2047] | XEiJ.MPU_BITREV_TABLE_1[l << 10 >>> 21]; //Integer.reverse(l) 6557: for (int i = 15; l != 0; i--, l <<= 1) { 6558: if (l < 0) { 6559: a -= 4; 6560: int x = XEiJ.regRn[i]; 6561: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6562: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6563: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6564: MainMemory.mmrM8[a + 3] = (byte) x; 6565: } 6566: } 6567: } else if (XEiJ.IRP_MOVEM_SHIFT_RIGHT) { //0になるまで右にシフトする 6568: for (int i = 15; l != 0; i--, l >>>= 1) { 6569: if ((l & 1) != 0) { 6570: a -= 4; 6571: int x = XEiJ.regRn[i]; 6572: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6573: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6574: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6575: MainMemory.mmrM8[a + 3] = (byte) x; 6576: } 6577: } 6578: } else if (XEiJ.IRP_MOVEM_ZEROS) { //Integer.numberOfTrailingZerosを使う 6579: for (int i = 15; l != 0; ) { 6580: int k = Integer.numberOfTrailingZeros (l); 6581: a -= 4; 6582: int x = XEiJ.regRn[i -= k]; 6583: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6584: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6585: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6586: MainMemory.mmrM8[a + 3] = (byte) x; 6587: l = l >>> k & ~1; 6588: } 6589: } 6590: a = t - (short) (t - a); 6591: } else { //メインメモリでないかページを跨ぐ可能性がある 6592: if (XEiJ.IRP_MOVEM_EXPAND) { //16回展開する 6593: if ((l & 0x0001) != 0) { 6594: XEiJ.busWle (a -= 4, XEiJ.regRn[15]); 6595: } 6596: if ((l & 0x0002) != 0) { 6597: XEiJ.busWle (a -= 4, XEiJ.regRn[14]); 6598: } 6599: if ((l & 0x0004) != 0) { 6600: XEiJ.busWle (a -= 4, XEiJ.regRn[13]); 6601: } 6602: if ((l & 0x0008) != 0) { 6603: XEiJ.busWle (a -= 4, XEiJ.regRn[12]); 6604: } 6605: if ((l & 0x0010) != 0) { 6606: XEiJ.busWle (a -= 4, XEiJ.regRn[11]); 6607: } 6608: if ((l & 0x0020) != 0) { 6609: XEiJ.busWle (a -= 4, XEiJ.regRn[10]); 6610: } 6611: if ((l & 0x0040) != 0) { 6612: XEiJ.busWle (a -= 4, XEiJ.regRn[ 9]); 6613: } 6614: if ((byte) l < 0) { //(l & 0x0080) != 0 6615: XEiJ.busWle (a -= 4, XEiJ.regRn[ 8]); 6616: } 6617: if ((l & 0x0100) != 0) { 6618: XEiJ.busWle (a -= 4, XEiJ.regRn[ 7]); 6619: } 6620: if ((l & 0x0200) != 0) { 6621: XEiJ.busWle (a -= 4, XEiJ.regRn[ 6]); 6622: } 6623: if ((l & 0x0400) != 0) { 6624: XEiJ.busWle (a -= 4, XEiJ.regRn[ 5]); 6625: } 6626: if ((l & 0x0800) != 0) { 6627: XEiJ.busWle (a -= 4, XEiJ.regRn[ 4]); 6628: } 6629: if ((l & 0x1000) != 0) { 6630: XEiJ.busWle (a -= 4, XEiJ.regRn[ 3]); 6631: } 6632: if ((l & 0x2000) != 0) { 6633: XEiJ.busWle (a -= 4, XEiJ.regRn[ 2]); 6634: } 6635: if ((l & 0x4000) != 0) { 6636: XEiJ.busWle (a -= 4, XEiJ.regRn[ 1]); 6637: } 6638: if ((short) l < 0) { //(l & 0x8000) != 0 6639: XEiJ.busWle (a -= 4, XEiJ.regRn[ 0]); 6640: } 6641: } else if (XEiJ.IRP_MOVEM_LOOP) { //16回ループする。コンパイラが展開する 6642: for (int i = 15; i >= 0; i--) { 6643: if ((l & 0x8000 >>> i) != 0) { 6644: XEiJ.busWle (a -= 4, XEiJ.regRn[i]); 6645: } 6646: } 6647: } else if (XEiJ.IRP_MOVEM_SHIFT_LEFT) { //0になるまで左にシフトする 6648: l = XEiJ.MPU_BITREV_TABLE_0[l & 2047] | XEiJ.MPU_BITREV_TABLE_1[l << 10 >>> 21]; //Integer.reverse(l) 6649: for (int i = 15; l != 0; i--, l <<= 1) { 6650: if (l < 0) { 6651: XEiJ.busWle (a -= 4, XEiJ.regRn[i]); 6652: } 6653: } 6654: } else if (XEiJ.IRP_MOVEM_SHIFT_RIGHT) { //0になるまで右にシフトする 6655: for (int i = 15; l != 0; i--, l >>>= 1) { 6656: if ((l & 1) != 0) { 6657: XEiJ.busWle (a -= 4, XEiJ.regRn[i]); 6658: } 6659: } 6660: } else if (XEiJ.IRP_MOVEM_ZEROS) { //Integer.numberOfTrailingZerosを使う 6661: for (int i = 15; l != 0; ) { 6662: int k = Integer.numberOfTrailingZeros (l); 6663: XEiJ.busWle (a -= 4, XEiJ.regRn[i -= k]); 6664: l = l >>> k & ~1; 6665: } 6666: } 6667: } 6668: XEiJ.regRn[arr] = a; 6669: XEiJ.mpuCycleCount += 8 + (t - a << 1); //4バイト/個→8サイクル/個 6670: } else { //-(Ar)以外 6671: int a = efaCltLong (ea); 6672: if ((a & 1) != 0 && l != 0) { //奇数アドレスで1ワード以上転送する 6673: M68kException.m6eNumber = M68kException.M6E_ADDRESS_ERROR; 6674: M68kException.m6eAddress = a; 6675: M68kException.m6eDirection = XEiJ.MPU_WR_WRITE; 6676: M68kException.m6eSize = XEiJ.MPU_SS_LONG; 6677: throw M68kException.m6eSignal; 6678: } 6679: int t = a; 6680: if (XEiJ.IRP_MOVEM_MAINMEMORY && //000のときMOVEMでメインメモリを特別扱いにする 6681: (DataBreakPoint.DBP_ON ? DataBreakPoint.dbpSuperMap : XEiJ.busSuperMap)[a >>> XEiJ.BUS_PAGE_BITS] == MemoryMappedDevice.MMD_MMR && //メインメモリ 6682: (a & XEiJ.BUS_PAGE_SIZE - 1) <= XEiJ.BUS_PAGE_SIZE - 4 * 16) { //16個転送してもページを跨がない 6683: a &= XEiJ.BUS_MOTHER_MASK; 6684: if (XEiJ.IRP_MOVEM_EXPAND) { //16回展開する 6685: if ((l & 0x0001) != 0) { 6686: int x = XEiJ.regRn[ 0]; 6687: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6688: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6689: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6690: MainMemory.mmrM8[a + 3] = (byte) x; 6691: a += 4; 6692: } 6693: if ((l & 0x0002) != 0) { 6694: int x = XEiJ.regRn[ 1]; 6695: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6696: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6697: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6698: MainMemory.mmrM8[a + 3] = (byte) x; 6699: a += 4; 6700: } 6701: if ((l & 0x0004) != 0) { 6702: int x = XEiJ.regRn[ 2]; 6703: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6704: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6705: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6706: MainMemory.mmrM8[a + 3] = (byte) x; 6707: a += 4; 6708: } 6709: if ((l & 0x0008) != 0) { 6710: int x = XEiJ.regRn[ 3]; 6711: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6712: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6713: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6714: MainMemory.mmrM8[a + 3] = (byte) x; 6715: a += 4; 6716: } 6717: if ((l & 0x0010) != 0) { 6718: int x = XEiJ.regRn[ 4]; 6719: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6720: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6721: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6722: MainMemory.mmrM8[a + 3] = (byte) x; 6723: a += 4; 6724: } 6725: if ((l & 0x0020) != 0) { 6726: int x = XEiJ.regRn[ 5]; 6727: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6728: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6729: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6730: MainMemory.mmrM8[a + 3] = (byte) x; 6731: a += 4; 6732: } 6733: if ((l & 0x0040) != 0) { 6734: int x = XEiJ.regRn[ 6]; 6735: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6736: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6737: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6738: MainMemory.mmrM8[a + 3] = (byte) x; 6739: a += 4; 6740: } 6741: if ((byte) l < 0) { //(l & 0x0080) != 0 6742: int x = XEiJ.regRn[ 7]; 6743: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6744: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6745: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6746: MainMemory.mmrM8[a + 3] = (byte) x; 6747: a += 4; 6748: } 6749: if ((l & 0x0100) != 0) { 6750: int x = XEiJ.regRn[ 8]; 6751: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6752: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6753: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6754: MainMemory.mmrM8[a + 3] = (byte) x; 6755: a += 4; 6756: } 6757: if ((l & 0x0200) != 0) { 6758: int x = XEiJ.regRn[ 9]; 6759: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6760: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6761: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6762: MainMemory.mmrM8[a + 3] = (byte) x; 6763: a += 4; 6764: } 6765: if ((l & 0x0400) != 0) { 6766: int x = XEiJ.regRn[10]; 6767: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6768: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6769: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6770: MainMemory.mmrM8[a + 3] = (byte) x; 6771: a += 4; 6772: } 6773: if ((l & 0x0800) != 0) { 6774: int x = XEiJ.regRn[11]; 6775: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6776: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6777: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6778: MainMemory.mmrM8[a + 3] = (byte) x; 6779: a += 4; 6780: } 6781: if ((l & 0x1000) != 0) { 6782: int x = XEiJ.regRn[12]; 6783: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6784: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6785: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6786: MainMemory.mmrM8[a + 3] = (byte) x; 6787: a += 4; 6788: } 6789: if ((l & 0x2000) != 0) { 6790: int x = XEiJ.regRn[13]; 6791: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6792: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6793: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6794: MainMemory.mmrM8[a + 3] = (byte) x; 6795: a += 4; 6796: } 6797: if ((l & 0x4000) != 0) { 6798: int x = XEiJ.regRn[14]; 6799: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6800: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6801: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6802: MainMemory.mmrM8[a + 3] = (byte) x; 6803: a += 4; 6804: } 6805: if ((short) l < 0) { //(l & 0x8000) != 0 6806: int x = XEiJ.regRn[15]; 6807: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6808: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6809: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6810: MainMemory.mmrM8[a + 3] = (byte) x; 6811: a += 4; 6812: } 6813: } else if (XEiJ.IRP_MOVEM_LOOP) { //16回ループする。コンパイラが展開する 6814: for (int i = 0; i <= 15; i++) { 6815: if ((l & 0x0001 << i) != 0) { 6816: int x = XEiJ.regRn[i]; 6817: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6818: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6819: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6820: MainMemory.mmrM8[a + 3] = (byte) x; 6821: a += 4; 6822: } 6823: } 6824: } else if (XEiJ.IRP_MOVEM_SHIFT_LEFT) { //0になるまで左にシフトする 6825: l = XEiJ.MPU_BITREV_TABLE_0[l & 2047] | XEiJ.MPU_BITREV_TABLE_1[l << 10 >>> 21]; //Integer.reverse(l) 6826: for (int i = 0; l != 0; i++, l <<= 1) { 6827: if (l < 0) { 6828: int x = XEiJ.regRn[i]; 6829: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6830: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6831: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6832: MainMemory.mmrM8[a + 3] = (byte) x; 6833: a += 4; 6834: } 6835: } 6836: } else if (XEiJ.IRP_MOVEM_SHIFT_RIGHT) { //0になるまで右にシフトする 6837: for (int i = 0; l != 0; i++, l >>>= 1) { 6838: if ((l & 1) != 0) { 6839: int x = XEiJ.regRn[i]; 6840: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6841: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6842: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6843: MainMemory.mmrM8[a + 3] = (byte) x; 6844: a += 4; 6845: } 6846: } 6847: } else if (XEiJ.IRP_MOVEM_ZEROS) { //Integer.numberOfTrailingZerosを使う 6848: for (int i = 0; l != 0; ) { 6849: int k = Integer.numberOfTrailingZeros (l); 6850: int x = XEiJ.regRn[i += k]; 6851: MainMemory.mmrM8[a ] = (byte) (x >> 24); 6852: MainMemory.mmrM8[a + 1] = (byte) (x >> 16); 6853: MainMemory.mmrM8[a + 2] = (byte) (x >> 8); 6854: MainMemory.mmrM8[a + 3] = (byte) x; 6855: a += 4; 6856: l = l >>> k & ~1; 6857: } 6858: } 6859: a = t + (short) (a - t); 6860: } else { //メインメモリでないかページを跨ぐ可能性がある 6861: if (XEiJ.IRP_MOVEM_EXPAND) { //16回展開する 6862: if ((l & 0x0001) != 0) { 6863: XEiJ.busWle (a, XEiJ.regRn[ 0]); 6864: a += 4; 6865: } 6866: if ((l & 0x0002) != 0) { 6867: XEiJ.busWle (a, XEiJ.regRn[ 1]); 6868: a += 4; 6869: } 6870: if ((l & 0x0004) != 0) { 6871: XEiJ.busWle (a, XEiJ.regRn[ 2]); 6872: a += 4; 6873: } 6874: if ((l & 0x0008) != 0) { 6875: XEiJ.busWle (a, XEiJ.regRn[ 3]); 6876: a += 4; 6877: } 6878: if ((l & 0x0010) != 0) { 6879: XEiJ.busWle (a, XEiJ.regRn[ 4]); 6880: a += 4; 6881: } 6882: if ((l & 0x0020) != 0) { 6883: XEiJ.busWle (a, XEiJ.regRn[ 5]); 6884: a += 4; 6885: } 6886: if ((l & 0x0040) != 0) { 6887: XEiJ.busWle (a, XEiJ.regRn[ 6]); 6888: a += 4; 6889: } 6890: if ((byte) l < 0) { //(l & 0x0080) != 0 6891: XEiJ.busWle (a, XEiJ.regRn[ 7]); 6892: a += 4; 6893: } 6894: if ((l & 0x0100) != 0) { 6895: XEiJ.busWle (a, XEiJ.regRn[ 8]); 6896: a += 4; 6897: } 6898: if ((l & 0x0200) != 0) { 6899: XEiJ.busWle (a, XEiJ.regRn[ 9]); 6900: a += 4; 6901: } 6902: if ((l & 0x0400) != 0) { 6903: XEiJ.busWle (a, XEiJ.regRn[10]); 6904: a += 4; 6905: } 6906: if ((l & 0x0800) != 0) { 6907: XEiJ.busWle (a, XEiJ.regRn[11]); 6908: a += 4; 6909: } 6910: if ((l & 0x1000) != 0) { 6911: XEiJ.busWle (a, XEiJ.regRn[12]); 6912: a += 4; 6913: } 6914: if ((l & 0x2000) != 0) { 6915: XEiJ.busWle (a, XEiJ.regRn[13]); 6916: a += 4; 6917: } 6918: if ((l & 0x4000) != 0) { 6919: XEiJ.busWle (a, XEiJ.regRn[14]); 6920: a += 4; 6921: } 6922: if ((short) l < 0) { //(l & 0x8000) != 0 6923: XEiJ.busWle (a, XEiJ.regRn[15]); 6924: a += 4; 6925: } 6926: } else if (XEiJ.IRP_MOVEM_LOOP) { //16回ループする。コンパイラが展開する 6927: for (int i = 0; i <= 15; i++) { 6928: if ((l & 0x0001 << i) != 0) { 6929: XEiJ.busWle (a, XEiJ.regRn[i]); 6930: a += 4; 6931: } 6932: } 6933: } else if (XEiJ.IRP_MOVEM_SHIFT_LEFT) { //0になるまで左にシフトする 6934: l = XEiJ.MPU_BITREV_TABLE_0[l & 2047] | XEiJ.MPU_BITREV_TABLE_1[l << 10 >>> 21]; //Integer.reverse(l) 6935: for (int i = 0; l != 0; i++, l <<= 1) { 6936: if (l < 0) { 6937: XEiJ.busWle (a, XEiJ.regRn[i]); 6938: a += 4; 6939: } 6940: } 6941: } else if (XEiJ.IRP_MOVEM_SHIFT_RIGHT) { //0になるまで右にシフトする 6942: for (int i = 0; l != 0; i++, l >>>= 1) { 6943: if ((l & 1) != 0) { 6944: XEiJ.busWle (a, XEiJ.regRn[i]); 6945: a += 4; 6946: } 6947: } 6948: } else if (XEiJ.IRP_MOVEM_ZEROS) { //Integer.numberOfTrailingZerosを使う 6949: for (int i = 0; l != 0; ) { 6950: int k = Integer.numberOfTrailingZeros (l); 6951: XEiJ.busWle (a, XEiJ.regRn[i += k]); 6952: a += 4; 6953: l = l >>> k & ~1; 6954: } 6955: } 6956: } 6957: XEiJ.mpuCycleCount += 0 + (a - t << 1); //4バイト/個→8サイクル/個 6958: } 6959: } 6960: } //irpMovemToMemLong 6961: 6962: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 6963: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 6964: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 6965: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 6966: //TST.B <ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0100_101_000_mmm_rrr 6967: public static void irpTstByte () throws M68kException { 6968: XEiJ.mpuCycleCount += 4; 6969: int ea = XEiJ.regOC & 63; 6970: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.MPU_TSTB_TABLE[255 & (ea < XEiJ.EA_AR ? XEiJ.regRn[ea] : XEiJ.busRbs (efaMltByte (ea)))]; //ccr_tst_byte。アドレッシングモードに注意 6971: } //irpTstByte 6972: 6973: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 6974: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 6975: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 6976: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 6977: //TST.W <ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0100_101_001_mmm_rrr 6978: public static void irpTstWord () throws M68kException { 6979: XEiJ.mpuCycleCount += 4; 6980: int ea = XEiJ.regOC & 63; 6981: int z = ea < XEiJ.EA_AR ? XEiJ.regRn[ea] : XEiJ.busRws (efaMltWord (ea)); //アドレッシングモードに注意 6982: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | (char) z - 1 >> 31 & XEiJ.REG_CCR_Z | ((short) z < 0 ? XEiJ.REG_CCR_N : 0); //ccr_tst_word 6983: } //irpTstWord 6984: 6985: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 6986: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 6987: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 6988: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 6989: //TST.L <ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0100_101_010_mmm_rrr 6990: public static void irpTstLong () throws M68kException { 6991: XEiJ.mpuCycleCount += 4; 6992: int ea = XEiJ.regOC & 63; 6993: int z = ea < XEiJ.EA_AR ? XEiJ.regRn[ea] : XEiJ.busRls (efaMltLong (ea)); //アドレッシングモードに注意 6994: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 6995: } //irpTstLong 6996: 6997: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 6998: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 6999: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 7000: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7001: //TAS.B <ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |0100_101_011_mmm_rrr 7002: //ILLEGAL |-|012346|-|-----|-----| |0100_101_011_111_100 7003: public static void irpTas () throws M68kException { 7004: int ea = XEiJ.regOC & 63; 7005: int z; 7006: if (ea < XEiJ.EA_AR) { //TAS.B Dr 7007: XEiJ.mpuCycleCount += 4; 7008: XEiJ.regRn[ea] = 0x80 | (z = XEiJ.regRn[ea]); 7009: } else if (ea == XEiJ.EA_IM) { //ILLEGAL 7010: XEiJ.mpuCycleCount += 34; 7011: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 7012: throw M68kException.m6eSignal; 7013: } else { //TAS.B <mem> 7014: XEiJ.mpuCycleCount += 10; 7015: int a = efaMltByte (ea); 7016: XEiJ.busWb (a, 0x80 | (z = XEiJ.busRbs (a))); 7017: } 7018: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.MPU_TSTB_TABLE[255 & z]; //ccr_tst_byte 7019: } //irpTas 7020: 7021: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7022: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 7023: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 7024: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7025: //SATS.L Dr |-|------|-|-UUUU|-**00|D |0100_110_010_000_rrr (ISA_B) 7026: //MOVEM.W <ea>,<list> |-|012346|-|-----|-----| M+ WXZP |0100_110_010_mmm_rrr-llllllllllllllll 7027: // 7028: //SATS.L Dr 7029: // VがセットされていたらDrを符号が逆で絶対値が最大の値にする(直前のDrに対する演算を飽和演算にする) 7030: public static void irpMovemToRegWord () throws M68kException { 7031: int ea = XEiJ.regOC & 63; 7032: if (ea < XEiJ.EA_AR) { //SATS.L Dr 7033: XEiJ.mpuCycleCount += 4; 7034: int z = XEiJ.regRn[ea]; 7035: if (XEiJ.TEST_BIT_1_SHIFT ? XEiJ.regCCR << 31 - 1 < 0 : (XEiJ.regCCR & XEiJ.REG_CCR_V) != 0) { //Vがセットされているとき 7036: XEiJ.regRn[ea] = z = z >> 31 ^ 0x80000000; //符号が逆で絶対値が最大の値にする 7037: } 7038: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 7039: } else { //MOVEM.W <ea>,<list> 7040: int l = XEiJ.busRwze (XEiJ.regPC); //pcwze。レジスタリスト。ゼロ拡張 7041: XEiJ.regPC += 2; 7042: int arr, a; 7043: if (ea >> 3 == XEiJ.MMM_MP) { //(Ar)+ 7044: XEiJ.mpuCycleCount += 12; 7045: arr = ea - (XEiJ.EA_MP - 8); 7046: a = XEiJ.regRn[arr]; 7047: } else { //(Ar)+以外 7048: XEiJ.mpuCycleCount += 8; 7049: arr = 16; 7050: a = efaCntWord (ea); 7051: } 7052: if ((a & 1) != 0 && l != 0) { //奇数アドレスで1ワード以上転送する 7053: M68kException.m6eNumber = M68kException.M6E_ADDRESS_ERROR; 7054: M68kException.m6eAddress = a; 7055: M68kException.m6eDirection = XEiJ.MPU_WR_READ; 7056: M68kException.m6eSize = XEiJ.MPU_SS_WORD; 7057: throw M68kException.m6eSignal; 7058: } 7059: int t = a; 7060: if (XEiJ.IRP_MOVEM_MAINMEMORY && //000のときMOVEMでメインメモリを特別扱いにする 7061: (DataBreakPoint.DBP_ON ? DataBreakPoint.dbpSuperMap : XEiJ.busSuperMap)[a >>> XEiJ.BUS_PAGE_BITS] == MemoryMappedDevice.MMD_MMR && //メインメモリ 7062: (a & XEiJ.BUS_PAGE_SIZE - 1) <= XEiJ.BUS_PAGE_SIZE - 2 * 16) { //16個転送してもページを跨がない 7063: a &= XEiJ.BUS_MOTHER_MASK; 7064: if (XEiJ.IRP_MOVEM_EXPAND) { //16回展開する 7065: if ((l & 0x0001) != 0) { 7066: XEiJ.regRn[ 0] = MainMemory.mmrM8[a] << 8 | MainMemory.mmrM8[a + 1] & 255; //データレジスタも符号拡張して32bit全部書き換える 7067: a += 2; 7068: } 7069: if ((l & 0x0002) != 0) { 7070: XEiJ.regRn[ 1] = MainMemory.mmrM8[a] << 8 | MainMemory.mmrM8[a + 1] & 255; //データレジスタも符号拡張して32bit全部書き換える 7071: a += 2; 7072: } 7073: if ((l & 0x0004) != 0) { 7074: XEiJ.regRn[ 2] = MainMemory.mmrM8[a] << 8 | MainMemory.mmrM8[a + 1] & 255; //データレジスタも符号拡張して32bit全部書き換える 7075: a += 2; 7076: } 7077: if ((l & 0x0008) != 0) { 7078: XEiJ.regRn[ 3] = MainMemory.mmrM8[a] << 8 | MainMemory.mmrM8[a + 1] & 255; //データレジスタも符号拡張して32bit全部書き換える 7079: a += 2; 7080: } 7081: if ((l & 0x0010) != 0) { 7082: XEiJ.regRn[ 4] = MainMemory.mmrM8[a] << 8 | MainMemory.mmrM8[a + 1] & 255; //データレジスタも符号拡張して32bit全部書き換える 7083: a += 2; 7084: } 7085: if ((l & 0x0020) != 0) { 7086: XEiJ.regRn[ 5] = MainMemory.mmrM8[a] << 8 | MainMemory.mmrM8[a + 1] & 255; //データレジスタも符号拡張して32bit全部書き換える 7087: a += 2; 7088: } 7089: if ((l & 0x0040) != 0) { 7090: XEiJ.regRn[ 6] = MainMemory.mmrM8[a] << 8 | MainMemory.mmrM8[a + 1] & 255; //データレジスタも符号拡張して32bit全部書き換える 7091: a += 2; 7092: } 7093: if ((byte) l < 0) { //(l & 0x0080) != 0 7094: XEiJ.regRn[ 7] = MainMemory.mmrM8[a] << 8 | MainMemory.mmrM8[a + 1] & 255; //データレジスタも符号拡張して32bit全部書き換える 7095: a += 2; 7096: } 7097: if ((l & 0x0100) != 0) { 7098: XEiJ.regRn[ 8] = MainMemory.mmrM8[a] << 8 | MainMemory.mmrM8[a + 1] & 255; //符号拡張して32bit全部書き換える 7099: a += 2; 7100: } 7101: if ((l & 0x0200) != 0) { 7102: XEiJ.regRn[ 9] = MainMemory.mmrM8[a] << 8 | MainMemory.mmrM8[a + 1] & 255; //符号拡張して32bit全部書き換える 7103: a += 2; 7104: } 7105: if ((l & 0x0400) != 0) { 7106: XEiJ.regRn[10] = MainMemory.mmrM8[a] << 8 | MainMemory.mmrM8[a + 1] & 255; //符号拡張して32bit全部書き換える 7107: a += 2; 7108: } 7109: if ((l & 0x0800) != 0) { 7110: XEiJ.regRn[11] = MainMemory.mmrM8[a] << 8 | MainMemory.mmrM8[a + 1] & 255; //符号拡張して32bit全部書き換える 7111: a += 2; 7112: } 7113: if ((l & 0x1000) != 0) { 7114: XEiJ.regRn[12] = MainMemory.mmrM8[a] << 8 | MainMemory.mmrM8[a + 1] & 255; //符号拡張して32bit全部書き換える 7115: a += 2; 7116: } 7117: if ((l & 0x2000) != 0) { 7118: XEiJ.regRn[13] = MainMemory.mmrM8[a] << 8 | MainMemory.mmrM8[a + 1] & 255; //符号拡張して32bit全部書き換える 7119: a += 2; 7120: } 7121: if ((l & 0x4000) != 0) { 7122: XEiJ.regRn[14] = MainMemory.mmrM8[a] << 8 | MainMemory.mmrM8[a + 1] & 255; //符号拡張して32bit全部書き換える 7123: a += 2; 7124: } 7125: if ((short) l < 0) { //(l & 0x8000) != 0 7126: XEiJ.regRn[15] = MainMemory.mmrM8[a] << 8 | MainMemory.mmrM8[a + 1] & 255; //符号拡張して32bit全部書き換える 7127: a += 2; 7128: } 7129: } else if (XEiJ.IRP_MOVEM_LOOP) { //16回ループする。コンパイラが展開する 7130: for (int i = 0; i <= 15; i++) { 7131: if ((l & 0x0001 << i) != 0) { 7132: XEiJ.regRn[i] = MainMemory.mmrM8[a] << 8 | MainMemory.mmrM8[a + 1] & 255; //(データレジスタも)符号拡張して32bit全部書き換える 7133: a += 2; 7134: } 7135: } 7136: } else if (XEiJ.IRP_MOVEM_SHIFT_LEFT) { //0になるまで左にシフトする 7137: l = XEiJ.MPU_BITREV_TABLE_0[l & 2047] | XEiJ.MPU_BITREV_TABLE_1[l << 10 >>> 21]; //Integer.reverse(l) 7138: for (int i = 0; l != 0; i++, l <<= 1) { 7139: if (l < 0) { 7140: XEiJ.regRn[i] = MainMemory.mmrM8[a] << 8 | MainMemory.mmrM8[a + 1] & 255; //(データレジスタも)符号拡張して32bit全部書き換える 7141: a += 2; 7142: } 7143: } 7144: } else if (XEiJ.IRP_MOVEM_SHIFT_RIGHT) { //0になるまで右にシフトする 7145: for (int i = 0; l != 0; i++, l >>>= 1) { 7146: if ((l & 1) != 0) { 7147: XEiJ.regRn[i] = MainMemory.mmrM8[a] << 8 | MainMemory.mmrM8[a + 1] & 255; //(データレジスタも)符号拡張して32bit全部書き換える 7148: a += 2; 7149: } 7150: } 7151: } else if (XEiJ.IRP_MOVEM_ZEROS) { //Integer.numberOfTrailingZerosを使う 7152: for (int i = 0; l != 0; ) { 7153: int k = Integer.numberOfTrailingZeros (l); 7154: XEiJ.regRn[i += k] = MainMemory.mmrM8[a] << 8 | MainMemory.mmrM8[a + 1] & 255; //(データレジスタも)符号拡張して32bit全部書き換える 7155: a += 2; 7156: l = l >>> k & ~1; 7157: } 7158: } 7159: a = t + (short) (a - t); 7160: } else { //メインメモリでないかページを跨ぐ可能性がある 7161: if (XEiJ.IRP_MOVEM_EXPAND) { //16回展開する 7162: if ((l & 0x0001) != 0) { 7163: XEiJ.regRn[ 0] = XEiJ.busRwse (a); //データレジスタも符号拡張して32bit全部書き換える 7164: a += 2; 7165: } 7166: if ((l & 0x0002) != 0) { 7167: XEiJ.regRn[ 1] = XEiJ.busRwse (a); //データレジスタも符号拡張して32bit全部書き換える 7168: a += 2; 7169: } 7170: if ((l & 0x0004) != 0) { 7171: XEiJ.regRn[ 2] = XEiJ.busRwse (a); //データレジスタも符号拡張して32bit全部書き換える 7172: a += 2; 7173: } 7174: if ((l & 0x0008) != 0) { 7175: XEiJ.regRn[ 3] = XEiJ.busRwse (a); //データレジスタも符号拡張して32bit全部書き換える 7176: a += 2; 7177: } 7178: if ((l & 0x0010) != 0) { 7179: XEiJ.regRn[ 4] = XEiJ.busRwse (a); //データレジスタも符号拡張して32bit全部書き換える 7180: a += 2; 7181: } 7182: if ((l & 0x0020) != 0) { 7183: XEiJ.regRn[ 5] = XEiJ.busRwse (a); //データレジスタも符号拡張して32bit全部書き換える 7184: a += 2; 7185: } 7186: if ((l & 0x0040) != 0) { 7187: XEiJ.regRn[ 6] = XEiJ.busRwse (a); //データレジスタも符号拡張して32bit全部書き換える 7188: a += 2; 7189: } 7190: if ((byte) l < 0) { //(l & 0x0080) != 0 7191: XEiJ.regRn[ 7] = XEiJ.busRwse (a); //データレジスタも符号拡張して32bit全部書き換える 7192: a += 2; 7193: } 7194: if ((l & 0x0100) != 0) { 7195: XEiJ.regRn[ 8] = XEiJ.busRwse (a); //符号拡張して32bit全部書き換える 7196: a += 2; 7197: } 7198: if ((l & 0x0200) != 0) { 7199: XEiJ.regRn[ 9] = XEiJ.busRwse (a); //符号拡張して32bit全部書き換える 7200: a += 2; 7201: } 7202: if ((l & 0x0400) != 0) { 7203: XEiJ.regRn[10] = XEiJ.busRwse (a); //符号拡張して32bit全部書き換える 7204: a += 2; 7205: } 7206: if ((l & 0x0800) != 0) { 7207: XEiJ.regRn[11] = XEiJ.busRwse (a); //符号拡張して32bit全部書き換える 7208: a += 2; 7209: } 7210: if ((l & 0x1000) != 0) { 7211: XEiJ.regRn[12] = XEiJ.busRwse (a); //符号拡張して32bit全部書き換える 7212: a += 2; 7213: } 7214: if ((l & 0x2000) != 0) { 7215: XEiJ.regRn[13] = XEiJ.busRwse (a); //符号拡張して32bit全部書き換える 7216: a += 2; 7217: } 7218: if ((l & 0x4000) != 0) { 7219: XEiJ.regRn[14] = XEiJ.busRwse (a); //符号拡張して32bit全部書き換える 7220: a += 2; 7221: } 7222: if ((short) l < 0) { //(l & 0x8000) != 0 7223: XEiJ.regRn[15] = XEiJ.busRwse (a); //符号拡張して32bit全部書き換える 7224: a += 2; 7225: } 7226: } else if (XEiJ.IRP_MOVEM_LOOP) { //16回ループする。コンパイラが展開する 7227: for (int i = 0; i <= 15; i++) { 7228: if ((l & 0x0001 << i) != 0) { 7229: XEiJ.regRn[i] = XEiJ.busRwse (a); //(データレジスタも)符号拡張して32bit全部書き換える 7230: a += 2; 7231: } 7232: } 7233: } else if (XEiJ.IRP_MOVEM_SHIFT_LEFT) { //0になるまで左にシフトする 7234: l = XEiJ.MPU_BITREV_TABLE_0[l & 2047] | XEiJ.MPU_BITREV_TABLE_1[l << 10 >>> 21]; //Integer.reverse(l) 7235: for (int i = 0; l != 0; i++, l <<= 1) { 7236: if (l < 0) { 7237: XEiJ.regRn[i] = XEiJ.busRwse (a); //(データレジスタも)符号拡張して32bit全部書き換える 7238: a += 2; 7239: } 7240: } 7241: } else if (XEiJ.IRP_MOVEM_SHIFT_RIGHT) { //0になるまで右にシフトする 7242: for (int i = 0; l != 0; i++, l >>>= 1) { 7243: if ((l & 1) != 0) { 7244: XEiJ.regRn[i] = XEiJ.busRwse (a); //(データレジスタも)符号拡張して32bit全部書き換える 7245: a += 2; 7246: } 7247: } 7248: } else if (XEiJ.IRP_MOVEM_ZEROS) { //Integer.numberOfTrailingZerosを使う 7249: for (int i = 0; l != 0; ) { 7250: int k = Integer.numberOfTrailingZeros (l); 7251: XEiJ.regRn[i += k] = XEiJ.busRwse (a); //(データレジスタも)符号拡張して32bit全部書き換える 7252: a += 2; 7253: l = l >>> k & ~1; 7254: } 7255: } 7256: } 7257: if (XEiJ.MPU_OMIT_EXTRA_READ) { 7258: //! 軽量化。MC68000のMOVEM.W <ea>,<list>は1ワード余分にリードするが省略する 7259: // MC68000のMOVEM.W <ea>,<list>は1ワード余分にリードするため転送する領域の直後にアクセスできない領域があるとバスエラーが発生する 7260: // RAMDISK.SYSを高速化しようとしてデータ転送ルーチンの転送命令をすべてMOVEMに変更してしまうと、 7261: // 12MBフル実装でないX68000の実機で最後のセクタをアクセスしたときだけバスエラーが出て動かなくなるのはこれが原因 7262: } else { 7263: XEiJ.busRws (a); 7264: } 7265: //MOVEM.W (Ar)+,<list>で<list>にArが含まれているとき、メモリから読み出したデータを捨ててArをインクリメントする 7266: XEiJ.regRn[arr] = a; 7267: XEiJ.mpuCycleCount += a - t << 1; //2バイト/個→4サイクル/個 7268: } 7269: } //irpMovemToRegWord 7270: 7271: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7272: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 7273: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 7274: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7275: //MOVEM.L <ea>,<list> |-|012346|-|-----|-----| M+ WXZP |0100_110_011_mmm_rrr-llllllllllllllll 7276: public static void irpMovemToRegLong () throws M68kException { 7277: int ea = XEiJ.regOC & 63; 7278: { 7279: int l = XEiJ.busRwze (XEiJ.regPC); //pcwze。レジスタリスト。ゼロ拡張 7280: XEiJ.regPC += 2; 7281: int arr, a; 7282: if (ea >> 3 == XEiJ.MMM_MP) { //(Ar)+ 7283: XEiJ.mpuCycleCount += 8; 7284: arr = ea - (XEiJ.EA_MP - 8); 7285: a = XEiJ.regRn[arr]; 7286: } else { //(Ar)+以外 7287: XEiJ.mpuCycleCount += 4; 7288: arr = 16; 7289: a = efaCntLong (ea); 7290: } 7291: if ((a & 1) != 0 && l != 0) { //奇数アドレスで1ワード以上転送する 7292: M68kException.m6eNumber = M68kException.M6E_ADDRESS_ERROR; 7293: M68kException.m6eAddress = a; 7294: M68kException.m6eDirection = XEiJ.MPU_WR_READ; 7295: M68kException.m6eSize = XEiJ.MPU_SS_LONG; 7296: throw M68kException.m6eSignal; 7297: } 7298: int t = a; 7299: if (XEiJ.IRP_MOVEM_MAINMEMORY && //000のときMOVEMでメインメモリを特別扱いにする 7300: (DataBreakPoint.DBP_ON ? DataBreakPoint.dbpSuperMap : XEiJ.busSuperMap)[a >>> XEiJ.BUS_PAGE_BITS] == MemoryMappedDevice.MMD_MMR && //メインメモリ 7301: (a & XEiJ.BUS_PAGE_SIZE - 1) <= XEiJ.BUS_PAGE_SIZE - 4 * 16) { //16個転送してもページを跨がない 7302: a &= XEiJ.BUS_MOTHER_MASK; 7303: if (XEiJ.IRP_MOVEM_EXPAND) { //16回展開する 7304: if ((l & 0x0001) != 0) { 7305: XEiJ.regRn[ 0] = MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 255) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | MainMemory.mmrM8[a + 3] & 255); 7306: a += 4; 7307: } 7308: if ((l & 0x0002) != 0) { 7309: XEiJ.regRn[ 1] = MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 255) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | MainMemory.mmrM8[a + 3] & 255); 7310: a += 4; 7311: } 7312: if ((l & 0x0004) != 0) { 7313: XEiJ.regRn[ 2] = MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 255) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | MainMemory.mmrM8[a + 3] & 255); 7314: a += 4; 7315: } 7316: if ((l & 0x0008) != 0) { 7317: XEiJ.regRn[ 3] = MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 255) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | MainMemory.mmrM8[a + 3] & 255); 7318: a += 4; 7319: } 7320: if ((l & 0x0010) != 0) { 7321: XEiJ.regRn[ 4] = MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 255) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | MainMemory.mmrM8[a + 3] & 255); 7322: a += 4; 7323: } 7324: if ((l & 0x0020) != 0) { 7325: XEiJ.regRn[ 5] = MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 255) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | MainMemory.mmrM8[a + 3] & 255); 7326: a += 4; 7327: } 7328: if ((l & 0x0040) != 0) { 7329: XEiJ.regRn[ 6] = MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 255) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | MainMemory.mmrM8[a + 3] & 255); 7330: a += 4; 7331: } 7332: if ((byte) l < 0) { //(l & 0x0080) != 0 7333: XEiJ.regRn[ 7] = MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 255) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | MainMemory.mmrM8[a + 3] & 255); 7334: a += 4; 7335: } 7336: if ((l & 0x0100) != 0) { 7337: XEiJ.regRn[ 8] = MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 255) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | MainMemory.mmrM8[a + 3] & 255); 7338: a += 4; 7339: } 7340: if ((l & 0x0200) != 0) { 7341: XEiJ.regRn[ 9] = MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 255) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | MainMemory.mmrM8[a + 3] & 255); 7342: a += 4; 7343: } 7344: if ((l & 0x0400) != 0) { 7345: XEiJ.regRn[10] = MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 255) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | MainMemory.mmrM8[a + 3] & 255); 7346: a += 4; 7347: } 7348: if ((l & 0x0800) != 0) { 7349: XEiJ.regRn[11] = MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 255) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | MainMemory.mmrM8[a + 3] & 255); 7350: a += 4; 7351: } 7352: if ((l & 0x1000) != 0) { 7353: XEiJ.regRn[12] = MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 255) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | MainMemory.mmrM8[a + 3] & 255); 7354: a += 4; 7355: } 7356: if ((l & 0x2000) != 0) { 7357: XEiJ.regRn[13] = MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 255) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | MainMemory.mmrM8[a + 3] & 255); 7358: a += 4; 7359: } 7360: if ((l & 0x4000) != 0) { 7361: XEiJ.regRn[14] = MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 255) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | MainMemory.mmrM8[a + 3] & 255); 7362: a += 4; 7363: } 7364: if ((short) l < 0) { //(l & 0x8000) != 0 7365: XEiJ.regRn[15] = MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 255) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | MainMemory.mmrM8[a + 3] & 255); 7366: a += 4; 7367: } 7368: } else if (XEiJ.IRP_MOVEM_LOOP) { //16回ループする。コンパイラが展開する 7369: for (int i = 0; i <= 15; i++) { 7370: if ((l & 0x0001 << i) != 0) { 7371: XEiJ.regRn[i] = MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 255) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | MainMemory.mmrM8[a + 3] & 255); 7372: a += 4; 7373: } 7374: } 7375: } else if (XEiJ.IRP_MOVEM_SHIFT_LEFT) { //0になるまで左にシフトする 7376: l = XEiJ.MPU_BITREV_TABLE_0[l & 2047] | XEiJ.MPU_BITREV_TABLE_1[l << 10 >>> 21]; //Integer.reverse(l) 7377: for (int i = 0; l != 0; i++, l <<= 1) { 7378: if (l < 0) { 7379: XEiJ.regRn[i] = MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 255) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | MainMemory.mmrM8[a + 3] & 255); 7380: a += 4; 7381: } 7382: } 7383: } else if (XEiJ.IRP_MOVEM_SHIFT_RIGHT) { //0になるまで右にシフトする 7384: for (int i = 0; l != 0; i++, l >>>= 1) { 7385: if ((l & 1) != 0) { 7386: XEiJ.regRn[i] = MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 255) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | MainMemory.mmrM8[a + 3] & 255); 7387: a += 4; 7388: } 7389: } 7390: } else if (XEiJ.IRP_MOVEM_ZEROS) { //Integer.numberOfTrailingZerosを使う 7391: for (int i = 0; l != 0; ) { 7392: int k = Integer.numberOfTrailingZeros (l); 7393: XEiJ.regRn[i += k] = MainMemory.mmrM8[a] << 24 | (MainMemory.mmrM8[a + 1] & 255) << 16 | (char) (MainMemory.mmrM8[a + 2] << 8 | MainMemory.mmrM8[a + 3] & 255); 7394: a += 4; 7395: l = l >>> k & ~1; 7396: } 7397: } 7398: a = t + (short) (a - t); 7399: } else { //メインメモリでないかページを跨ぐ可能性がある 7400: if (XEiJ.IRP_MOVEM_EXPAND) { //16回展開する 7401: if ((l & 0x0001) != 0) { 7402: XEiJ.regRn[ 0] = XEiJ.busRlse (a); 7403: a += 4; 7404: } 7405: if ((l & 0x0002) != 0) { 7406: XEiJ.regRn[ 1] = XEiJ.busRlse (a); 7407: a += 4; 7408: } 7409: if ((l & 0x0004) != 0) { 7410: XEiJ.regRn[ 2] = XEiJ.busRlse (a); 7411: a += 4; 7412: } 7413: if ((l & 0x0008) != 0) { 7414: XEiJ.regRn[ 3] = XEiJ.busRlse (a); 7415: a += 4; 7416: } 7417: if ((l & 0x0010) != 0) { 7418: XEiJ.regRn[ 4] = XEiJ.busRlse (a); 7419: a += 4; 7420: } 7421: if ((l & 0x0020) != 0) { 7422: XEiJ.regRn[ 5] = XEiJ.busRlse (a); 7423: a += 4; 7424: } 7425: if ((l & 0x0040) != 0) { 7426: XEiJ.regRn[ 6] = XEiJ.busRlse (a); 7427: a += 4; 7428: } 7429: if ((byte) l < 0) { //(l & 0x0080) != 0 7430: XEiJ.regRn[ 7] = XEiJ.busRlse (a); 7431: a += 4; 7432: } 7433: if ((l & 0x0100) != 0) { 7434: XEiJ.regRn[ 8] = XEiJ.busRlse (a); 7435: a += 4; 7436: } 7437: if ((l & 0x0200) != 0) { 7438: XEiJ.regRn[ 9] = XEiJ.busRlse (a); 7439: a += 4; 7440: } 7441: if ((l & 0x0400) != 0) { 7442: XEiJ.regRn[10] = XEiJ.busRlse (a); 7443: a += 4; 7444: } 7445: if ((l & 0x0800) != 0) { 7446: XEiJ.regRn[11] = XEiJ.busRlse (a); 7447: a += 4; 7448: } 7449: if ((l & 0x1000) != 0) { 7450: XEiJ.regRn[12] = XEiJ.busRlse (a); 7451: a += 4; 7452: } 7453: if ((l & 0x2000) != 0) { 7454: XEiJ.regRn[13] = XEiJ.busRlse (a); 7455: a += 4; 7456: } 7457: if ((l & 0x4000) != 0) { 7458: XEiJ.regRn[14] = XEiJ.busRlse (a); 7459: a += 4; 7460: } 7461: if ((short) l < 0) { //(l & 0x8000) != 0 7462: XEiJ.regRn[15] = XEiJ.busRlse (a); 7463: a += 4; 7464: } 7465: } else if (XEiJ.IRP_MOVEM_LOOP) { //16回ループする。コンパイラが展開する 7466: for (int i = 0; i <= 15; i++) { 7467: if ((l & 0x0001 << i) != 0) { 7468: XEiJ.regRn[i] = XEiJ.busRlse (a); 7469: a += 4; 7470: } 7471: } 7472: } else if (XEiJ.IRP_MOVEM_SHIFT_LEFT) { //0になるまで左にシフトする 7473: l = XEiJ.MPU_BITREV_TABLE_0[l & 2047] | XEiJ.MPU_BITREV_TABLE_1[l << 10 >>> 21]; //Integer.reverse(l) 7474: for (int i = 0; l != 0; i++, l <<= 1) { 7475: if (l < 0) { 7476: XEiJ.regRn[i] = XEiJ.busRlse (a); 7477: a += 4; 7478: } 7479: } 7480: } else if (XEiJ.IRP_MOVEM_SHIFT_RIGHT) { //0になるまで右にシフトする 7481: for (int i = 0; l != 0; i++, l >>>= 1) { 7482: if ((l & 1) != 0) { 7483: XEiJ.regRn[i] = XEiJ.busRlse (a); 7484: a += 4; 7485: } 7486: } 7487: } else if (XEiJ.IRP_MOVEM_ZEROS) { //Integer.numberOfTrailingZerosを使う 7488: for (int i = 0; l != 0; ) { 7489: int k = Integer.numberOfTrailingZeros (l); 7490: XEiJ.regRn[i += k] = XEiJ.busRlse (a); 7491: a += 4; 7492: l = l >>> k & ~1; 7493: } 7494: } 7495: } 7496: if (XEiJ.MPU_OMIT_EXTRA_READ) { 7497: //! 軽量化。MC68000のMOVEM.L <ea>,<list>は1ワード余分にリードするが省略する 7498: // MC68000のMOVEM.L <ea>,<list>は1ワード余分にリードするため転送する領域の直後にアクセスできない領域があるとバスエラーが発生する 7499: // RAMDISK.SYSを高速化しようとしてデータ転送ルーチンの転送命令をすべてMOVEMに変更してしまうと、 7500: // 12MBフル実装でないX68000の実機で最後のセクタをアクセスしたときだけバスエラーが出て動かなくなるのはこれが原因 7501: } else { 7502: XEiJ.busRws (a); 7503: } 7504: //MOVEM.L (Ar)+,<list>で<list>にArが含まれているとき、メモリから読み出したデータを捨ててArをインクリメントする 7505: XEiJ.regRn[arr] = a; //XEiJ.regRn[arr]は破壊されているのでXEiJ.regRn[arr]+=a-=tは不可 7506: XEiJ.mpuCycleCount += a - t << 1; //4バイト/個→8サイクル/個 7507: } 7508: } //irpMovemToRegLong 7509: 7510: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7511: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 7512: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 7513: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7514: //TRAP #<vector> |-|012346|-|-----|-----| |0100_111_001_00v_vvv 7515: public static void irpTrap () throws M68kException { 7516: XEiJ.mpuCycleCount += 34; 7517: if (XEiJ.MPU_INLINE_EXCEPTION) { 7518: int save_sr = XEiJ.regSRT1 | XEiJ.regSRS | XEiJ.regSRI | XEiJ.regCCR; 7519: int sp = XEiJ.regRn[15]; 7520: XEiJ.regSRT1 = XEiJ.mpuTraceFlag = 0; //srのTビットを消す 7521: if (XEiJ.regSRS == 0) { //ユーザモードのとき 7522: XEiJ.regSRS = XEiJ.REG_SR_S; //スーパーバイザモードへ移行する 7523: XEiJ.mpuUSP = sp; //USPを保存 7524: sp = XEiJ.mpuISP; //SSPを復元 7525: if (DataBreakPoint.DBP_ON) { 7526: DataBreakPoint.dbpMemoryMap = DataBreakPoint.dbpSuperMap; //スーパーバイザメモリマップに切り替える 7527: } else { 7528: XEiJ.busMemoryMap = XEiJ.busSuperMap; //スーパーバイザメモリマップに切り替える 7529: } 7530: if (InstructionBreakPoint.IBP_ON) { 7531: InstructionBreakPoint.ibpOp1MemoryMap = InstructionBreakPoint.ibpOp1SuperMap; 7532: } 7533: } 7534: XEiJ.regRn[15] = sp -= 6; 7535: XEiJ.busWl (sp + 2, XEiJ.regPC); //pushl。pcをプッシュする 7536: XEiJ.busWw (sp, save_sr); //pushw。srをプッシュする 7537: irpSetPC (XEiJ.busRlsf (XEiJ.regOC - (0x4e40 - M68kException.M6E_TRAP_0_INSTRUCTION_VECTOR) << 2)); //例外ベクタを取り出してジャンプする 7538: } else { 7539: irpException (XEiJ.regOC - (0x4e40 - M68kException.M6E_TRAP_0_INSTRUCTION_VECTOR), XEiJ.regPC, XEiJ.regSRT1 | XEiJ.regSRS | XEiJ.regSRI | XEiJ.regCCR); //pcは次の命令 7540: } 7541: } //irpTrap 7542: public static void irpTrap15 () throws M68kException { 7543: if ((XEiJ.regRn[0] & 255) == 0x8e) { //IOCS _BOOTINF 7544: MainMemory.mmrCheckHuman (); 7545: } 7546: XEiJ.mpuCycleCount += 34; 7547: if (XEiJ.MPU_INLINE_EXCEPTION) { 7548: int save_sr = XEiJ.regSRT1 | XEiJ.regSRS | XEiJ.regSRI | XEiJ.regCCR; 7549: int sp = XEiJ.regRn[15]; 7550: XEiJ.regSRT1 = XEiJ.mpuTraceFlag = 0; //srのTビットを消す 7551: if (XEiJ.regSRS == 0) { //ユーザモードのとき 7552: XEiJ.regSRS = XEiJ.REG_SR_S; //スーパーバイザモードへ移行する 7553: XEiJ.mpuUSP = sp; //USPを保存 7554: sp = XEiJ.mpuISP; //SSPを復元 7555: if (DataBreakPoint.DBP_ON) { 7556: DataBreakPoint.dbpMemoryMap = DataBreakPoint.dbpSuperMap; //スーパーバイザメモリマップに切り替える 7557: } else { 7558: XEiJ.busMemoryMap = XEiJ.busSuperMap; //スーパーバイザメモリマップに切り替える 7559: } 7560: if (InstructionBreakPoint.IBP_ON) { 7561: InstructionBreakPoint.ibpOp1MemoryMap = InstructionBreakPoint.ibpOp1SuperMap; 7562: } 7563: } 7564: XEiJ.regRn[15] = sp -= 6; 7565: XEiJ.busWl (sp + 2, XEiJ.regPC); //pushl。pcをプッシュする 7566: XEiJ.busWw (sp, save_sr); //pushw。srをプッシュする 7567: irpSetPC (XEiJ.busRlsf (M68kException.M6E_TRAP_15_INSTRUCTION_VECTOR << 2)); //例外ベクタを取り出してジャンプする 7568: } else { 7569: irpException (M68kException.M6E_TRAP_15_INSTRUCTION_VECTOR, XEiJ.regPC, XEiJ.regSRT1 | XEiJ.regSRS | XEiJ.regSRI | XEiJ.regCCR); //pcは次の命令 7570: } 7571: } //irpTrap15 7572: 7573: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7574: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 7575: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 7576: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7577: //LINK.W Ar,#<data> |-|012346|-|-----|-----| |0100_111_001_010_rrr-{data} 7578: // 7579: //LINK.W Ar,#<data> 7580: // PEA.L (Ar);MOVEA.L A7,Ar;ADDA.W #<data>,A7と同じ 7581: // LINK.W A7,#<data>はA7をデクリメントする前の値がプッシュされ、A7に#<data>が加算される 7582: public static void irpLinkWord () throws M68kException { 7583: XEiJ.mpuCycleCount += 16; 7584: int arr = XEiJ.regOC - (0b0100_111_001_010_000 - 8); 7585: //評価順序に注意 7586: // wl(r[15]-=4,r[8+rrr])は不可 7587: int sp = XEiJ.regRn[15] - 4; 7588: XEiJ.busWl (sp, XEiJ.regRn[arr]); //pushl 7589: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 7590: XEiJ.regRn[15] = (XEiJ.regRn[arr] = sp) + XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 7591: } else { 7592: int t = XEiJ.regPC; 7593: XEiJ.regPC = t + 2; 7594: XEiJ.regRn[15] = (XEiJ.regRn[arr] = sp) + XEiJ.busRwse (t); //pcws 7595: } 7596: } //irpLinkWord 7597: 7598: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7599: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 7600: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 7601: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7602: //UNLK Ar |-|012346|-|-----|-----| |0100_111_001_011_rrr 7603: // 7604: //UNLK Ar 7605: // MOVEA.L Ar,A7;MOVEA.L (A7)+,Arと同じ 7606: // UNLK A7はMOVEA.L A7,A7;MOVEA.L (A7)+,A7すなわちMOVEA.L (A7),A7と同じ 7607: // ソースオペランドのポストインクリメントはデスティネーションオペランドが評価される前に完了しているとみなされる 7608: // 例えばMOVE.L (A0)+,(A0)+はMOVE.L (A0),(4,A0);ADDQ.L #8,A0と同じ 7609: // MOVEA.L (A0)+,A0はポストインクリメントされたA0が(A0)から読み出された値で上書きされるのでMOVEA.L (A0),A0と同じ 7610: // M68000PRMにUNLK Anの動作はAn→SP;(SP)→An;SP+4→SPだと書かれているがこれはn=7の場合に当てはまらない 7611: // 余談だが68040の初期のマスクセットはUNLK A7を実行すると固まるらしい 7612: public static void irpUnlk () throws M68kException { 7613: XEiJ.mpuCycleCount += 12; 7614: int arr = XEiJ.regOC - (0b0100_111_001_011_000 - 8); 7615: //評価順序に注意 7616: int sp = XEiJ.regRn[arr]; 7617: XEiJ.regRn[15] = sp + 4; 7618: XEiJ.regRn[arr] = XEiJ.busRls (sp); //popls 7619: } //irpUnlk 7620: 7621: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7622: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 7623: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 7624: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7625: //MOVE.L Ar,USP |-|012346|P|-----|-----| |0100_111_001_100_rrr 7626: public static void irpMoveToUsp () throws M68kException { 7627: if (XEiJ.regSRS == 0) { //ユーザモードのとき 7628: XEiJ.mpuCycleCount += 34; 7629: M68kException.m6eNumber = M68kException.M6E_PRIVILEGE_VIOLATION; 7630: throw M68kException.m6eSignal; 7631: } 7632: //以下はスーパーバイザモード 7633: XEiJ.mpuCycleCount += 4; 7634: XEiJ.mpuUSP = XEiJ.regRn[XEiJ.regOC - (0b0100_111_001_100_000 - 8)]; 7635: } //irpMoveToUsp 7636: 7637: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7638: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 7639: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 7640: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7641: //MOVE.L USP,Ar |-|012346|P|-----|-----| |0100_111_001_101_rrr 7642: public static void irpMoveFromUsp () throws M68kException { 7643: if (XEiJ.regSRS == 0) { //ユーザモードのとき 7644: XEiJ.mpuCycleCount += 34; 7645: M68kException.m6eNumber = M68kException.M6E_PRIVILEGE_VIOLATION; 7646: throw M68kException.m6eSignal; 7647: } 7648: //以下はスーパーバイザモード 7649: XEiJ.mpuCycleCount += 4; 7650: XEiJ.regRn[XEiJ.regOC - (0b0100_111_001_101_000 - 8)] = XEiJ.mpuUSP; 7651: } //irpMoveFromUsp 7652: 7653: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7654: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 7655: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 7656: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7657: //RESET |-|012346|P|-----|-----| |0100_111_001_110_000 7658: public static void irpReset () throws M68kException { 7659: if (XEiJ.regSRS == 0) { //ユーザモードのとき 7660: XEiJ.mpuCycleCount += 34; 7661: M68kException.m6eNumber = M68kException.M6E_PRIVILEGE_VIOLATION; 7662: throw M68kException.m6eSignal; 7663: } 7664: //以下はスーパーバイザモード 7665: XEiJ.mpuCycleCount += 132; 7666: XEiJ.irpReset (); 7667: } //irpReset 7668: 7669: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7670: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 7671: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 7672: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7673: //NOP |-|012346|-|-----|-----| |0100_111_001_110_001 7674: public static void irpNop () throws M68kException { 7675: XEiJ.mpuCycleCount += 4; 7676: //何もしない 7677: } //irpNop 7678: 7679: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7680: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 7681: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 7682: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7683: //STOP #<data> |-|012346|P|UUUUU|*****| |0100_111_001_110_010-{data} 7684: // 7685: //STOP #<data> 7686: // 1. #<data>をsrに設定する 7687: // 2. pcを進める 7688: // 3. 以下のいずれかの条件が成立するまで停止する 7689: // 3a. トレース 7690: // 3b. マスクされているレベルよりも高い割り込み要求 7691: // 3c. リセット 7692: // コアと一緒にデバイスを止めるわけにいかないので、ここでは条件が成立するまで同じ命令を繰り返すループ命令として実装する 7693: public static void irpStop () throws M68kException { 7694: if (XEiJ.regSRS == 0) { //ユーザモードのとき 7695: XEiJ.mpuCycleCount += 34; 7696: M68kException.m6eNumber = M68kException.M6E_PRIVILEGE_VIOLATION; 7697: throw M68kException.m6eSignal; 7698: } 7699: //以下はスーパーバイザモード 7700: XEiJ.mpuCycleCount += 4; 7701: irpSetSR (XEiJ.busRwse ((XEiJ.regPC += 2) - 2)); //pcws。特権違反チェックが先 7702: if (XEiJ.mpuTraceFlag == 0) { //トレースまたはマスクされているレベルよりも高い割り込み要求がない 7703: XEiJ.regPC = XEiJ.regPC0; //ループ 7704: //任意の負荷率を100%に設定しているときSTOP命令が軽すぎると動作周波数が大きくなりすぎて割り込みがかかったとき次に進めなくなる 7705: //負荷率の計算にSTOP命令で止まっていた時間を含めないことにする 7706: XEiJ.mpuClockTime += XEiJ.TMR_FREQ * 4 / 1000000; //4μs。10MHzのとき40clk 7707: XEiJ.mpuLastNano += 4000L; 7708: } 7709: } //irpStop 7710: 7711: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7712: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 7713: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 7714: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7715: //RTE |-|012346|P|UUUUU|*****| |0100_111_001_110_011 7716: public static void irpRte () throws M68kException { 7717: if (XEiJ.regSRS == 0) { //ユーザモードのとき 7718: XEiJ.mpuCycleCount += 34; 7719: M68kException.m6eNumber = M68kException.M6E_PRIVILEGE_VIOLATION; 7720: throw M68kException.m6eSignal; 7721: } 7722: //以下はスーパーバイザモード 7723: XEiJ.mpuCycleCount += 20; 7724: int sp = XEiJ.regRn[15]; 7725: XEiJ.regRn[15] = sp + 6; 7726: int newSR = XEiJ.busRwz (sp); //popwz。ここでバスエラーが生じる可能性がある 7727: int newPC = XEiJ.busRlse (sp + 2); //popls。srを読めたのだからspは奇数ではない 7728: //irpSetSRでモードが切り替わる場合があるのでその前にr[15]を更新しておくこと 7729: irpSetSR (newSR); //ここでユーザモードに戻る場合がある。特権違反チェックが先 7730: irpSetPC (newPC); //分岐ログが新しいsrを使う。順序に注意 7731: } //irpRte 7732: 7733: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7734: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 7735: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 7736: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7737: //RTS |-|012346|-|-----|-----| |0100_111_001_110_101 7738: public static void irpRts () throws M68kException { 7739: XEiJ.mpuCycleCount += 16; 7740: int sp = XEiJ.regRn[15]; 7741: XEiJ.regRn[15] = sp + 4; 7742: irpSetPC (XEiJ.busRls (sp)); //popls 7743: } //irpRts 7744: 7745: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7746: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 7747: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 7748: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7749: //TRAPV |-|012346|-|---*-|-----| |0100_111_001_110_110 7750: public static void irpTrapv () throws M68kException { 7751: if (XEiJ.TEST_BIT_1_SHIFT ? XEiJ.regCCR << 31 - 1 >= 0 : (XEiJ.regCCR & XEiJ.REG_CCR_V) == 0) { //通過 7752: XEiJ.mpuCycleCount += 4; 7753: } else { 7754: XEiJ.mpuCycleCount += 34; 7755: M68kException.m6eNumber = M68kException.M6E_TRAPV_INSTRUCTION; 7756: throw M68kException.m6eSignal; 7757: } 7758: } //irpTrapv 7759: 7760: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7761: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 7762: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 7763: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7764: //RTR |-|012346|-|UUUUU|*****| |0100_111_001_110_111 7765: public static void irpRtr () throws M68kException { 7766: XEiJ.mpuCycleCount += 20; 7767: int sp = XEiJ.regRn[15]; 7768: XEiJ.regRn[15] = sp + 6; 7769: XEiJ.regCCR = XEiJ.REG_CCR_MASK & XEiJ.busRwz (sp); //popwz 7770: irpSetPC (XEiJ.busRlse (sp + 2)); //popls。ccrを読めたのだからspは奇数ではない 7771: } //irpRtr 7772: 7773: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7774: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 7775: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 7776: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7777: //JSR <ea> |-|012346|-|-----|-----| M WXZP |0100_111_010_mmm_rrr 7778: //JBSR.L <label> |A|012346|-|-----|-----| |0100_111_010_111_001-{address} [JSR <label>] 7779: public static void irpJsr () throws M68kException { 7780: XEiJ.mpuCycleCount += 16 - 8; 7781: int a = efaJmpJsr (XEiJ.regOC & 63); //プッシュする前に実効アドレスを計算する 7782: XEiJ.busWl (XEiJ.regRn[15] -= 4, XEiJ.regPC); //pushl 7783: irpSetPC (a); 7784: } //irpJsr 7785: 7786: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7787: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 7788: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 7789: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7790: //JMP <ea> |-|012346|-|-----|-----| M WXZP |0100_111_011_mmm_rrr 7791: //JBRA.L <label> |A|012346|-|-----|-----| |0100_111_011_111_001-{address} [JMP <label>] 7792: public static void irpJmp () throws M68kException { 7793: //XEiJ.mpuCycleCount += 8 - 8; 7794: irpSetPC (efaJmpJsr (XEiJ.regOC & 63)); 7795: } //irpJmp 7796: 7797: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7798: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 7799: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 7800: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7801: //ADDQ.B #<data>,<ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0101_qqq_000_mmm_rrr 7802: //INC.B <ea> |A|012346|-|UUUUU|*****|D M+-WXZ |0101_001_000_mmm_rrr [ADDQ.B #1,<ea>] 7803: public static void irpAddqByte () throws M68kException { 7804: int ea = XEiJ.regOC & 63; 7805: int x; 7806: int y = ((XEiJ.regOC >> 9) - 1 & 7) + 1; //qqq==0?8:qqq 7807: int z; 7808: if (ea < XEiJ.EA_AR) { //ADDQ.B #<data>,Dr 7809: XEiJ.mpuCycleCount += 4; 7810: z = (byte) (XEiJ.regRn[ea] = ~0xff & (x = XEiJ.regRn[ea]) | 0xff & (x = (byte) x) + y); 7811: } else { //ADDQ.B #<data>,<mem> 7812: XEiJ.mpuCycleCount += 8; 7813: int a = efaMltByte (ea); 7814: XEiJ.busWb (a, z = (byte) ((x = XEiJ.busRbs (a)) + y)); 7815: } 7816: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | 7817: (~x & z) >>> 31 << 1 | 7818: (x & ~z) >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_addq 7819: } //irpAddqByte 7820: 7821: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7822: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 7823: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 7824: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7825: //ADDQ.W #<data>,<ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0101_qqq_001_mmm_rrr 7826: //ADDQ.W #<data>,Ar |-|012346|-|-----|-----| A |0101_qqq_001_001_rrr 7827: //INC.W <ea> |A|012346|-|UUUUU|*****|D M+-WXZ |0101_001_001_mmm_rrr [ADDQ.W #1,<ea>] 7828: //INC.W Ar |A|012346|-|-----|-----| A |0101_001_001_001_rrr [ADDQ.W #1,Ar] 7829: // 7830: //ADDQ.W #<data>,Ar 7831: // ソースを符号拡張してロングで加算する 7832: public static void irpAddqWord () throws M68kException { 7833: int ea = XEiJ.regOC & 63; 7834: int y = ((XEiJ.regOC >> 9) - 1 & 7) + 1; //qqq==0?8:qqq 7835: if (ea >> 3 == XEiJ.MMM_AR) { //ADDQ.W #<data>,Ar 7836: XEiJ.mpuCycleCount += 8; //MC68000 User's Manualに4と書いてあるのは8の間違い 7837: XEiJ.regRn[ea] += y; //ロングで計算する。このr[ea]はアドレスレジスタ 7838: //ccrは操作しない 7839: } else { 7840: int x; 7841: int z; 7842: if (ea < XEiJ.EA_AR) { //ADDQ.W #<data>,Dr 7843: XEiJ.mpuCycleCount += 4; 7844: z = (short) (XEiJ.regRn[ea] = ~0xffff & (x = XEiJ.regRn[ea]) | (char) ((x = (short) x) + y)); 7845: } else { //ADDQ.W #<data>,<mem> 7846: XEiJ.mpuCycleCount += 8; 7847: int a = efaMltWord (ea); 7848: XEiJ.busWw (a, z = (short) ((x = XEiJ.busRws (a)) + y)); 7849: } 7850: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | 7851: (~x & z) >>> 31 << 1 | 7852: (x & ~z) >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_addq 7853: } 7854: } //irpAddqWord 7855: 7856: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7857: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 7858: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 7859: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7860: //ADDQ.L #<data>,<ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0101_qqq_010_mmm_rrr 7861: //ADDQ.L #<data>,Ar |-|012346|-|-----|-----| A |0101_qqq_010_001_rrr 7862: //INC.L <ea> |A|012346|-|UUUUU|*****|D M+-WXZ |0101_001_010_mmm_rrr [ADDQ.L #1,<ea>] 7863: //INC.L Ar |A|012346|-|-----|-----| A |0101_001_010_001_rrr [ADDQ.L #1,Ar] 7864: public static void irpAddqLong () throws M68kException { 7865: int ea = XEiJ.regOC & 63; 7866: int y = ((XEiJ.regOC >> 9) - 1 & 7) + 1; //qqq==0?8:qqq 7867: if (ea >> 3 == XEiJ.MMM_AR) { //ADDQ.L #<data>,Ar 7868: XEiJ.mpuCycleCount += 8; 7869: XEiJ.regRn[ea] += y; //このr[ea]はアドレスレジスタ 7870: //ccrは操作しない 7871: } else { 7872: int x; 7873: int z; 7874: if (ea < XEiJ.EA_AR) { //ADDQ.L #<data>,Dr 7875: XEiJ.mpuCycleCount += 8; 7876: XEiJ.regRn[ea] = z = (x = XEiJ.regRn[ea]) + y; 7877: } else { //ADDQ.L #<data>,<mem> 7878: XEiJ.mpuCycleCount += 12; 7879: int a = efaMltLong (ea); 7880: XEiJ.busWl (a, z = (x = XEiJ.busRls (a)) + y); 7881: } 7882: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | 7883: (~x & z) >>> 31 << 1 | 7884: (x & ~z) >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_addq 7885: } 7886: } //irpAddqLong 7887: 7888: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7889: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 7890: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 7891: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7892: //ST.B <ea> |-|012346|-|-----|-----|D M+-WXZ |0101_000_011_mmm_rrr 7893: //SNF.B <ea> |A|012346|-|-----|-----|D M+-WXZ |0101_000_011_mmm_rrr [ST.B <ea>] 7894: //DBT.W Dr,<label> |-|012346|-|-----|-----| |0101_000_011_001_rrr-{offset} 7895: //DBNF.W Dr,<label> |A|012346|-|-----|-----| |0101_000_011_001_rrr-{offset} [DBT.W Dr,<label>] 7896: public static void irpSt () throws M68kException { 7897: int ea = XEiJ.regOC & 63; 7898: //DBT.W Dr,<label>よりもST.B Drを優先する 7899: if (ea < XEiJ.EA_AR) { //ST.B Dr 7900: XEiJ.mpuCycleCount += 6; 7901: XEiJ.regRn[ea] |= 0xff; 7902: } else if (ea < XEiJ.EA_MM) { //DBT.W Dr,<label> 7903: //条件が成立しているので通過 7904: XEiJ.mpuCycleCount += 12; 7905: if (XEiJ.MPU_OMIT_OFFSET_READ) { 7906: //リードを省略する 7907: } else { 7908: XEiJ.busRws (XEiJ.regPC); 7909: } 7910: XEiJ.regPC += 2; 7911: } else { //ST.B <mem> 7912: XEiJ.mpuCycleCount += 8; 7913: //MC68000のSccはリードしてからライトする 7914: if (XEiJ.MPU_OMIT_EXTRA_READ) { 7915: //! 軽量化。リードを省略する 7916: XEiJ.busWb (efaMltByte (ea), 0xff); 7917: } else { 7918: int a = efaMltByte (ea); 7919: XEiJ.busRbs (a); 7920: XEiJ.busWb (a, 0xff); 7921: } 7922: } 7923: } //irpSt 7924: 7925: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7926: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 7927: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 7928: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7929: //SUBQ.B #<data>,<ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0101_qqq_100_mmm_rrr 7930: //DEC.B <ea> |A|012346|-|UUUUU|*****|D M+-WXZ |0101_001_100_mmm_rrr [SUBQ.B #1,<ea>] 7931: public static void irpSubqByte () throws M68kException { 7932: int ea = XEiJ.regOC & 63; 7933: int x; 7934: int y = ((XEiJ.regOC >> 9) - 1 & 7) + 1; //qqq==0?8:qqq 7935: int z; 7936: if (ea < XEiJ.EA_AR) { //SUBQ.B #<data>,Dr 7937: XEiJ.mpuCycleCount += 4; 7938: z = (byte) (XEiJ.regRn[ea] = ~0xff & (x = XEiJ.regRn[ea]) | 0xff & (x = (byte) x) - y); 7939: } else { //SUBQ.B #<data>,<mem> 7940: XEiJ.mpuCycleCount += 8; 7941: int a = efaMltByte (ea); 7942: XEiJ.busWb (a, z = (byte) ((x = XEiJ.busRbs (a)) - y)); 7943: } 7944: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | 7945: (x & ~z) >>> 31 << 1 | 7946: (~x & z) >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_subq 7947: } //irpSubqByte 7948: 7949: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7950: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 7951: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 7952: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7953: //SUBQ.W #<data>,<ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0101_qqq_101_mmm_rrr 7954: //SUBQ.W #<data>,Ar |-|012346|-|-----|-----| A |0101_qqq_101_001_rrr 7955: //DEC.W <ea> |A|012346|-|UUUUU|*****|D M+-WXZ |0101_001_101_mmm_rrr [SUBQ.W #1,<ea>] 7956: //DEC.W Ar |A|012346|-|-----|-----| A |0101_001_101_001_rrr [SUBQ.W #1,Ar] 7957: // 7958: //SUBQ.W #<data>,Ar 7959: // ソースを符号拡張してロングで減算する 7960: public static void irpSubqWord () throws M68kException { 7961: int ea = XEiJ.regOC & 63; 7962: int y = ((XEiJ.regOC >> 9) - 1 & 7) + 1; //qqq==0?8:qqq 7963: if (ea >> 3 == XEiJ.MMM_AR) { //SUBQ.W #<data>,Ar 7964: XEiJ.mpuCycleCount += 8; 7965: XEiJ.regRn[ea] -= y; //ロングで計算する。このr[ea]はアドレスレジスタ 7966: //ccrは操作しない 7967: } else { 7968: int x; 7969: int z; 7970: if (ea < XEiJ.EA_AR) { //SUBQ.W #<data>,Dr 7971: XEiJ.mpuCycleCount += 4; 7972: z = (short) (XEiJ.regRn[ea] = ~0xffff & (x = XEiJ.regRn[ea]) | (char) ((x = (short) x) - y)); 7973: } else { //SUBQ.W #<data>,<mem> 7974: XEiJ.mpuCycleCount += 8; 7975: int a = efaMltWord (ea); 7976: XEiJ.busWw (a, z = (short) ((x = XEiJ.busRws (a)) - y)); 7977: } 7978: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | 7979: (x & ~z) >>> 31 << 1 | 7980: (~x & z) >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_subq 7981: } 7982: } //irpSubqWord 7983: 7984: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7985: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 7986: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 7987: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 7988: //SUBQ.L #<data>,<ea> |-|012346|-|UUUUU|*****|D M+-WXZ |0101_qqq_110_mmm_rrr 7989: //SUBQ.L #<data>,Ar |-|012346|-|-----|-----| A |0101_qqq_110_001_rrr 7990: //DEC.L <ea> |A|012346|-|UUUUU|*****|D M+-WXZ |0101_001_110_mmm_rrr [SUBQ.L #1,<ea>] 7991: //DEC.L Ar |A|012346|-|-----|-----| A |0101_001_110_001_rrr [SUBQ.L #1,Ar] 7992: public static void irpSubqLong () throws M68kException { 7993: int ea = XEiJ.regOC & 63; 7994: int y = ((XEiJ.regOC >> 9) - 1 & 7) + 1; //qqq==0?8:qqq 7995: if (ea >> 3 == XEiJ.MMM_AR) { //SUBQ.L #<data>,Ar 7996: XEiJ.mpuCycleCount += 8; 7997: XEiJ.regRn[ea] -= y; //このr[ea]はアドレスレジスタ 7998: //ccrは操作しない 7999: } else { 8000: int x; 8001: int z; 8002: if (ea < XEiJ.EA_AR) { //SUBQ.L #<data>,Dr 8003: XEiJ.mpuCycleCount += 8; 8004: XEiJ.regRn[ea] = z = (x = XEiJ.regRn[ea]) - y; 8005: } else { //SUBQ.L #<data>,<mem> 8006: XEiJ.mpuCycleCount += 12; 8007: int a = efaMltLong (ea); 8008: XEiJ.busWl (a, z = (x = XEiJ.busRls (a)) - y); 8009: } 8010: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | 8011: (x & ~z) >>> 31 << 1 | 8012: (~x & z) >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_subq 8013: } 8014: } //irpSubqLong 8015: 8016: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8017: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 8018: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 8019: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8020: //SF.B <ea> |-|012346|-|-----|-----|D M+-WXZ |0101_000_111_mmm_rrr 8021: //SNT.B <ea> |A|012346|-|-----|-----|D M+-WXZ |0101_000_111_mmm_rrr [SF.B <ea>] 8022: //DBF.W Dr,<label> |-|012346|-|-----|-----| |0101_000_111_001_rrr-{offset} 8023: //DBNT.W Dr,<label> |A|012346|-|-----|-----| |0101_000_111_001_rrr-{offset} [DBF.W Dr,<label>] 8024: //DBRA.W Dr,<label> |A|012346|-|-----|-----| |0101_000_111_001_rrr-{offset} [DBF.W Dr,<label>] 8025: public static void irpSf () throws M68kException { 8026: int ea = XEiJ.regOC & 63; 8027: //DBRA.W Dr,<label>よりもSF.B Drを優先する 8028: if (ea < XEiJ.EA_AR) { //SF.B Dr 8029: XEiJ.mpuCycleCount += 4; 8030: XEiJ.regRn[ea] &= ~0xff; 8031: } else if (ea < XEiJ.EA_MM) { //DBRA.W Dr,<label> 8032: //条件が成立していないのでデクリメント 8033: int rrr = XEiJ.regOC & 7; 8034: int t = XEiJ.regRn[rrr]; 8035: if ((short) t == 0) { //Drの下位16bitが0なので通過 8036: XEiJ.mpuCycleCount += 14; 8037: XEiJ.regRn[rrr] = t + 65535; 8038: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8039: //リードを省略する 8040: } else { 8041: XEiJ.busRws (XEiJ.regPC); 8042: } 8043: XEiJ.regPC += 2; 8044: } else { //Drの下位16bitが0でないのでジャンプ 8045: XEiJ.mpuCycleCount += 10; 8046: XEiJ.regRn[rrr] = t - 1; //下位16bitが0でないので上位16bitは変化しない 8047: irpSetPC (XEiJ.regPC + XEiJ.busRws (XEiJ.regPC)); //pc==pc0+2 8048: } 8049: } else { //SF.B <mem> 8050: XEiJ.mpuCycleCount += 8; 8051: //MC68000のSccはリードしてからライトする 8052: if (XEiJ.MPU_OMIT_EXTRA_READ) { 8053: //! 軽量化。リードを省略する 8054: XEiJ.busWb (efaMltByte (ea), 0x00); 8055: } else { 8056: int a = efaMltByte (ea); 8057: XEiJ.busRbs (a); 8058: XEiJ.busWb (a, 0x00); 8059: } 8060: } 8061: } //irpSf 8062: 8063: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8064: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 8065: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 8066: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8067: //SHI.B <ea> |-|012346|-|--*-*|-----|D M+-WXZ |0101_001_011_mmm_rrr 8068: //SNLS.B <ea> |A|012346|-|--*-*|-----|D M+-WXZ |0101_001_011_mmm_rrr [SHI.B <ea>] 8069: //DBHI.W Dr,<label> |-|012346|-|--*-*|-----| |0101_001_011_001_rrr-{offset} 8070: //DBNLS.W Dr,<label> |A|012346|-|--*-*|-----| |0101_001_011_001_rrr-{offset} [DBHI.W Dr,<label>] 8071: public static void irpShi () throws M68kException { 8072: int ea = XEiJ.regOC & 63; 8073: if (ea >> 3 == XEiJ.MMM_AR) { //DBHI.W Dr,<label> 8074: if (XEiJ.MPU_CC_HI << XEiJ.regCCR < 0) { 8075: //条件が成立しているので通過 8076: XEiJ.mpuCycleCount += 12; 8077: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8078: //リードを省略する 8079: } else { 8080: XEiJ.busRws (XEiJ.regPC); 8081: } 8082: XEiJ.regPC += 2; 8083: } else { 8084: //条件が成立していないのでデクリメント 8085: int rrr = XEiJ.regOC & 7; 8086: int t = XEiJ.regRn[rrr]; 8087: if ((short) t == 0) { //Drの下位16bitが0なので通過 8088: XEiJ.mpuCycleCount += 14; 8089: XEiJ.regRn[rrr] = t + 65535; 8090: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8091: //リードを省略する 8092: } else { 8093: XEiJ.busRws (XEiJ.regPC); 8094: } 8095: XEiJ.regPC += 2; 8096: } else { //Drの下位16bitが0でないのでジャンプ 8097: XEiJ.mpuCycleCount += 10; 8098: XEiJ.regRn[rrr] = t - 1; //下位16bitが0でないので上位16bitは変化しない 8099: irpSetPC (XEiJ.regPC + XEiJ.busRws (XEiJ.regPC)); //pc==pc0+2 8100: } 8101: } 8102: } else if (ea < XEiJ.EA_AR) { //SHI.B Dr 8103: if (XEiJ.MPU_CC_HI << XEiJ.regCCR < 0) { //セット 8104: XEiJ.mpuCycleCount += 6; 8105: XEiJ.regRn[ea] |= 0xff; 8106: } else { //クリア 8107: XEiJ.mpuCycleCount += 4; 8108: XEiJ.regRn[ea] &= ~0xff; 8109: } 8110: } else { //SHI.B <mem> 8111: XEiJ.mpuCycleCount += 8; 8112: //MC68000のSccはリードしてからライトする 8113: if (XEiJ.MPU_OMIT_EXTRA_READ) { 8114: //! 軽量化。リードを省略する 8115: XEiJ.busWb (efaMltByte (ea), XEiJ.MPU_CC_HI << XEiJ.regCCR >> 31); 8116: } else { 8117: int a = efaMltByte (ea); 8118: XEiJ.busRbs (a); 8119: XEiJ.busWb (a, XEiJ.MPU_CC_HI << XEiJ.regCCR >> 31); 8120: } 8121: } 8122: } //irpShi 8123: 8124: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8125: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 8126: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 8127: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8128: //SLS.B <ea> |-|012346|-|--*-*|-----|D M+-WXZ |0101_001_111_mmm_rrr 8129: //SNHI.B <ea> |A|012346|-|--*-*|-----|D M+-WXZ |0101_001_111_mmm_rrr [SLS.B <ea>] 8130: //DBLS.W Dr,<label> |-|012346|-|--*-*|-----| |0101_001_111_001_rrr-{offset} 8131: //DBNHI.W Dr,<label> |A|012346|-|--*-*|-----| |0101_001_111_001_rrr-{offset} [DBLS.W Dr,<label>] 8132: public static void irpSls () throws M68kException { 8133: int ea = XEiJ.regOC & 63; 8134: if (ea >> 3 == XEiJ.MMM_AR) { //DBLS.W Dr,<label> 8135: if (XEiJ.MPU_CC_LS << XEiJ.regCCR < 0) { 8136: //条件が成立しているので通過 8137: XEiJ.mpuCycleCount += 12; 8138: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8139: //リードを省略する 8140: } else { 8141: XEiJ.busRws (XEiJ.regPC); 8142: } 8143: XEiJ.regPC += 2; 8144: } else { 8145: //条件が成立していないのでデクリメント 8146: int rrr = XEiJ.regOC & 7; 8147: int t = XEiJ.regRn[rrr]; 8148: if ((short) t == 0) { //Drの下位16bitが0なので通過 8149: XEiJ.mpuCycleCount += 14; 8150: XEiJ.regRn[rrr] = t + 65535; 8151: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8152: //リードを省略する 8153: } else { 8154: XEiJ.busRws (XEiJ.regPC); 8155: } 8156: XEiJ.regPC += 2; 8157: } else { //Drの下位16bitが0でないのでジャンプ 8158: XEiJ.mpuCycleCount += 10; 8159: XEiJ.regRn[rrr] = t - 1; //下位16bitが0でないので上位16bitは変化しない 8160: irpSetPC (XEiJ.regPC + XEiJ.busRws (XEiJ.regPC)); //pc==pc0+2 8161: } 8162: } 8163: } else if (ea < XEiJ.EA_AR) { //SLS.B Dr 8164: if (XEiJ.MPU_CC_LS << XEiJ.regCCR < 0) { //セット 8165: XEiJ.mpuCycleCount += 6; 8166: XEiJ.regRn[ea] |= 0xff; 8167: } else { //クリア 8168: XEiJ.mpuCycleCount += 4; 8169: XEiJ.regRn[ea] &= ~0xff; 8170: } 8171: } else { //SLS.B <mem> 8172: XEiJ.mpuCycleCount += 8; 8173: //MC68000のSccはリードしてからライトする 8174: if (XEiJ.MPU_OMIT_EXTRA_READ) { 8175: //! 軽量化。リードを省略する 8176: XEiJ.busWb (efaMltByte (ea), XEiJ.MPU_CC_LS << XEiJ.regCCR >> 31); 8177: } else { 8178: int a = efaMltByte (ea); 8179: XEiJ.busRbs (a); 8180: XEiJ.busWb (a, XEiJ.MPU_CC_LS << XEiJ.regCCR >> 31); 8181: } 8182: } 8183: } //irpSls 8184: 8185: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8186: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 8187: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 8188: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8189: //SCC.B <ea> |-|012346|-|----*|-----|D M+-WXZ |0101_010_011_mmm_rrr 8190: //SHS.B <ea> |A|012346|-|----*|-----|D M+-WXZ |0101_010_011_mmm_rrr [SCC.B <ea>] 8191: //SNCS.B <ea> |A|012346|-|----*|-----|D M+-WXZ |0101_010_011_mmm_rrr [SCC.B <ea>] 8192: //SNLO.B <ea> |A|012346|-|----*|-----|D M+-WXZ |0101_010_011_mmm_rrr [SCC.B <ea>] 8193: //DBCC.W Dr,<label> |-|012346|-|----*|-----| |0101_010_011_001_rrr-{offset} 8194: //DBHS.W Dr,<label> |A|012346|-|----*|-----| |0101_010_011_001_rrr-{offset} [DBCC.W Dr,<label>] 8195: //DBNCS.W Dr,<label> |A|012346|-|----*|-----| |0101_010_011_001_rrr-{offset} [DBCC.W Dr,<label>] 8196: //DBNLO.W Dr,<label> |A|012346|-|----*|-----| |0101_010_011_001_rrr-{offset} [DBCC.W Dr,<label>] 8197: public static void irpShs () throws M68kException { 8198: int ea = XEiJ.regOC & 63; 8199: if (ea >> 3 == XEiJ.MMM_AR) { //DBHS.W Dr,<label> 8200: if (XEiJ.MPU_CC_HS << XEiJ.regCCR < 0) { 8201: //条件が成立しているので通過 8202: XEiJ.mpuCycleCount += 12; 8203: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8204: //リードを省略する 8205: } else { 8206: XEiJ.busRws (XEiJ.regPC); 8207: } 8208: XEiJ.regPC += 2; 8209: } else { 8210: //条件が成立していないのでデクリメント 8211: int rrr = XEiJ.regOC & 7; 8212: int t = XEiJ.regRn[rrr]; 8213: if ((short) t == 0) { //Drの下位16bitが0なので通過 8214: XEiJ.mpuCycleCount += 14; 8215: XEiJ.regRn[rrr] = t + 65535; 8216: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8217: //リードを省略する 8218: } else { 8219: XEiJ.busRws (XEiJ.regPC); 8220: } 8221: XEiJ.regPC += 2; 8222: } else { //Drの下位16bitが0でないのでジャンプ 8223: XEiJ.mpuCycleCount += 10; 8224: XEiJ.regRn[rrr] = t - 1; //下位16bitが0でないので上位16bitは変化しない 8225: irpSetPC (XEiJ.regPC + XEiJ.busRws (XEiJ.regPC)); //pc==pc0+2 8226: } 8227: } 8228: } else if (ea < XEiJ.EA_AR) { //SHS.B Dr 8229: if (XEiJ.MPU_CC_HS << XEiJ.regCCR < 0) { //セット 8230: XEiJ.mpuCycleCount += 6; 8231: XEiJ.regRn[ea] |= 0xff; 8232: } else { //クリア 8233: XEiJ.mpuCycleCount += 4; 8234: XEiJ.regRn[ea] &= ~0xff; 8235: } 8236: } else { //SHS.B <mem> 8237: XEiJ.mpuCycleCount += 8; 8238: //MC68000のSccはリードしてからライトする 8239: if (XEiJ.MPU_OMIT_EXTRA_READ) { 8240: //! 軽量化。リードを省略する 8241: XEiJ.busWb (efaMltByte (ea), XEiJ.MPU_CC_HS << XEiJ.regCCR >> 31); 8242: } else { 8243: int a = efaMltByte (ea); 8244: XEiJ.busRbs (a); 8245: XEiJ.busWb (a, XEiJ.MPU_CC_HS << XEiJ.regCCR >> 31); 8246: } 8247: } 8248: } //irpShs 8249: 8250: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8251: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 8252: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 8253: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8254: //SCS.B <ea> |-|012346|-|----*|-----|D M+-WXZ |0101_010_111_mmm_rrr 8255: //SLO.B <ea> |A|012346|-|----*|-----|D M+-WXZ |0101_010_111_mmm_rrr [SCS.B <ea>] 8256: //SNCC.B <ea> |A|012346|-|----*|-----|D M+-WXZ |0101_010_111_mmm_rrr [SCS.B <ea>] 8257: //SNHS.B <ea> |A|012346|-|----*|-----|D M+-WXZ |0101_010_111_mmm_rrr [SCS.B <ea>] 8258: //DBCS.W Dr,<label> |-|012346|-|----*|-----| |0101_010_111_001_rrr-{offset} 8259: //DBLO.W Dr,<label> |A|012346|-|----*|-----| |0101_010_111_001_rrr-{offset} [DBCS.W Dr,<label>] 8260: //DBNCC.W Dr,<label> |A|012346|-|----*|-----| |0101_010_111_001_rrr-{offset} [DBCS.W Dr,<label>] 8261: //DBNHS.W Dr,<label> |A|012346|-|----*|-----| |0101_010_111_001_rrr-{offset} [DBCS.W Dr,<label>] 8262: public static void irpSlo () throws M68kException { 8263: int ea = XEiJ.regOC & 63; 8264: if (ea >> 3 == XEiJ.MMM_AR) { //DBLO.W Dr,<label> 8265: if (XEiJ.MPU_CC_LO << XEiJ.regCCR < 0) { 8266: //条件が成立しているので通過 8267: XEiJ.mpuCycleCount += 12; 8268: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8269: //リードを省略する 8270: } else { 8271: XEiJ.busRws (XEiJ.regPC); 8272: } 8273: XEiJ.regPC += 2; 8274: } else { 8275: //条件が成立していないのでデクリメント 8276: int rrr = XEiJ.regOC & 7; 8277: int t = XEiJ.regRn[rrr]; 8278: if ((short) t == 0) { //Drの下位16bitが0なので通過 8279: XEiJ.mpuCycleCount += 14; 8280: XEiJ.regRn[rrr] = t + 65535; 8281: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8282: //リードを省略する 8283: } else { 8284: XEiJ.busRws (XEiJ.regPC); 8285: } 8286: XEiJ.regPC += 2; 8287: } else { //Drの下位16bitが0でないのでジャンプ 8288: XEiJ.mpuCycleCount += 10; 8289: XEiJ.regRn[rrr] = t - 1; //下位16bitが0でないので上位16bitは変化しない 8290: irpSetPC (XEiJ.regPC + XEiJ.busRws (XEiJ.regPC)); //pc==pc0+2 8291: } 8292: } 8293: } else if (ea < XEiJ.EA_AR) { //SLO.B Dr 8294: if (XEiJ.MPU_CC_LO << XEiJ.regCCR < 0) { //セット 8295: XEiJ.mpuCycleCount += 6; 8296: XEiJ.regRn[ea] |= 0xff; 8297: } else { //クリア 8298: XEiJ.mpuCycleCount += 4; 8299: XEiJ.regRn[ea] &= ~0xff; 8300: } 8301: } else { //SLO.B <mem> 8302: XEiJ.mpuCycleCount += 8; 8303: //MC68000のSccはリードしてからライトする 8304: if (XEiJ.MPU_OMIT_EXTRA_READ) { 8305: //! 軽量化。リードを省略する 8306: XEiJ.busWb (efaMltByte (ea), XEiJ.MPU_CC_LO << XEiJ.regCCR >> 31); 8307: } else { 8308: int a = efaMltByte (ea); 8309: XEiJ.busRbs (a); 8310: XEiJ.busWb (a, XEiJ.MPU_CC_LO << XEiJ.regCCR >> 31); 8311: } 8312: } 8313: } //irpSlo 8314: 8315: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8316: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 8317: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 8318: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8319: //SNE.B <ea> |-|012346|-|--*--|-----|D M+-WXZ |0101_011_011_mmm_rrr 8320: //SNEQ.B <ea> |A|012346|-|--*--|-----|D M+-WXZ |0101_011_011_mmm_rrr [SNE.B <ea>] 8321: //SNZ.B <ea> |A|012346|-|--*--|-----|D M+-WXZ |0101_011_011_mmm_rrr [SNE.B <ea>] 8322: //SNZE.B <ea> |A|012346|-|--*--|-----|D M+-WXZ |0101_011_011_mmm_rrr [SNE.B <ea>] 8323: //DBNE.W Dr,<label> |-|012346|-|--*--|-----| |0101_011_011_001_rrr-{offset} 8324: //DBNEQ.W Dr,<label> |A|012346|-|--*--|-----| |0101_011_011_001_rrr-{offset} [DBNE.W Dr,<label>] 8325: //DBNZ.W Dr,<label> |A|012346|-|--*--|-----| |0101_011_011_001_rrr-{offset} [DBNE.W Dr,<label>] 8326: //DBNZE.W Dr,<label> |A|012346|-|--*--|-----| |0101_011_011_001_rrr-{offset} [DBNE.W Dr,<label>] 8327: public static void irpSne () throws M68kException { 8328: int ea = XEiJ.regOC & 63; 8329: if (ea >> 3 == XEiJ.MMM_AR) { //DBNE.W Dr,<label> 8330: if (XEiJ.MPU_CC_NE << XEiJ.regCCR < 0) { 8331: //条件が成立しているので通過 8332: XEiJ.mpuCycleCount += 12; 8333: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8334: //リードを省略する 8335: } else { 8336: XEiJ.busRws (XEiJ.regPC); 8337: } 8338: XEiJ.regPC += 2; 8339: } else { 8340: //条件が成立していないのでデクリメント 8341: int rrr = XEiJ.regOC & 7; 8342: int t = XEiJ.regRn[rrr]; 8343: if ((short) t == 0) { //Drの下位16bitが0なので通過 8344: XEiJ.mpuCycleCount += 14; 8345: XEiJ.regRn[rrr] = t + 65535; 8346: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8347: //リードを省略する 8348: } else { 8349: XEiJ.busRws (XEiJ.regPC); 8350: } 8351: XEiJ.regPC += 2; 8352: } else { //Drの下位16bitが0でないのでジャンプ 8353: XEiJ.mpuCycleCount += 10; 8354: XEiJ.regRn[rrr] = t - 1; //下位16bitが0でないので上位16bitは変化しない 8355: irpSetPC (XEiJ.regPC + XEiJ.busRws (XEiJ.regPC)); //pc==pc0+2 8356: } 8357: } 8358: } else if (ea < XEiJ.EA_AR) { //SNE.B Dr 8359: if (XEiJ.MPU_CC_NE << XEiJ.regCCR < 0) { //セット 8360: XEiJ.mpuCycleCount += 6; 8361: XEiJ.regRn[ea] |= 0xff; 8362: } else { //クリア 8363: XEiJ.mpuCycleCount += 4; 8364: XEiJ.regRn[ea] &= ~0xff; 8365: } 8366: } else { //SNE.B <mem> 8367: XEiJ.mpuCycleCount += 8; 8368: //MC68000のSccはリードしてからライトする 8369: if (XEiJ.MPU_OMIT_EXTRA_READ) { 8370: //! 軽量化。リードを省略する 8371: XEiJ.busWb (efaMltByte (ea), XEiJ.MPU_CC_NE << XEiJ.regCCR >> 31); 8372: } else { 8373: int a = efaMltByte (ea); 8374: XEiJ.busRbs (a); 8375: XEiJ.busWb (a, XEiJ.MPU_CC_NE << XEiJ.regCCR >> 31); 8376: } 8377: } 8378: } //irpSne 8379: 8380: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8381: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 8382: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 8383: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8384: //SEQ.B <ea> |-|012346|-|--*--|-----|D M+-WXZ |0101_011_111_mmm_rrr 8385: //SNNE.B <ea> |A|012346|-|--*--|-----|D M+-WXZ |0101_011_111_mmm_rrr [SEQ.B <ea>] 8386: //SNNZ.B <ea> |A|012346|-|--*--|-----|D M+-WXZ |0101_011_111_mmm_rrr [SEQ.B <ea>] 8387: //SZE.B <ea> |A|012346|-|--*--|-----|D M+-WXZ |0101_011_111_mmm_rrr [SEQ.B <ea>] 8388: //DBEQ.W Dr,<label> |-|012346|-|--*--|-----| |0101_011_111_001_rrr-{offset} 8389: //DBNNE.W Dr,<label> |A|012346|-|--*--|-----| |0101_011_111_001_rrr-{offset} [DBEQ.W Dr,<label>] 8390: //DBNNZ.W Dr,<label> |A|012346|-|--*--|-----| |0101_011_111_001_rrr-{offset} [DBEQ.W Dr,<label>] 8391: //DBZE.W Dr,<label> |A|012346|-|--*--|-----| |0101_011_111_001_rrr-{offset} [DBEQ.W Dr,<label>] 8392: public static void irpSeq () throws M68kException { 8393: int ea = XEiJ.regOC & 63; 8394: if (ea >> 3 == XEiJ.MMM_AR) { //DBEQ.W Dr,<label> 8395: if (XEiJ.MPU_CC_EQ << XEiJ.regCCR < 0) { 8396: //条件が成立しているので通過 8397: XEiJ.mpuCycleCount += 12; 8398: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8399: //リードを省略する 8400: } else { 8401: XEiJ.busRws (XEiJ.regPC); 8402: } 8403: XEiJ.regPC += 2; 8404: } else { 8405: //条件が成立していないのでデクリメント 8406: int rrr = XEiJ.regOC & 7; 8407: int t = XEiJ.regRn[rrr]; 8408: if ((short) t == 0) { //Drの下位16bitが0なので通過 8409: XEiJ.mpuCycleCount += 14; 8410: XEiJ.regRn[rrr] = t + 65535; 8411: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8412: //リードを省略する 8413: } else { 8414: XEiJ.busRws (XEiJ.regPC); 8415: } 8416: XEiJ.regPC += 2; 8417: } else { //Drの下位16bitが0でないのでジャンプ 8418: XEiJ.mpuCycleCount += 10; 8419: XEiJ.regRn[rrr] = t - 1; //下位16bitが0でないので上位16bitは変化しない 8420: irpSetPC (XEiJ.regPC + XEiJ.busRws (XEiJ.regPC)); //pc==pc0+2 8421: } 8422: } 8423: } else if (ea < XEiJ.EA_AR) { //SEQ.B Dr 8424: if (XEiJ.MPU_CC_EQ << XEiJ.regCCR < 0) { //セット 8425: XEiJ.mpuCycleCount += 6; 8426: XEiJ.regRn[ea] |= 0xff; 8427: } else { //クリア 8428: XEiJ.mpuCycleCount += 4; 8429: XEiJ.regRn[ea] &= ~0xff; 8430: } 8431: } else { //SEQ.B <mem> 8432: XEiJ.mpuCycleCount += 8; 8433: //MC68000のSccはリードしてからライトする 8434: if (XEiJ.MPU_OMIT_EXTRA_READ) { 8435: //! 軽量化。リードを省略する 8436: XEiJ.busWb (efaMltByte (ea), XEiJ.MPU_CC_EQ << XEiJ.regCCR >> 31); 8437: } else { 8438: int a = efaMltByte (ea); 8439: XEiJ.busRbs (a); 8440: XEiJ.busWb (a, XEiJ.MPU_CC_EQ << XEiJ.regCCR >> 31); 8441: } 8442: } 8443: } //irpSeq 8444: 8445: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8446: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 8447: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 8448: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8449: //SVC.B <ea> |-|012346|-|---*-|-----|D M+-WXZ |0101_100_011_mmm_rrr 8450: //SNVS.B <ea> |A|012346|-|---*-|-----|D M+-WXZ |0101_100_011_mmm_rrr [SVC.B <ea>] 8451: //DBVC.W Dr,<label> |-|012346|-|---*-|-----| |0101_100_011_001_rrr-{offset} 8452: //DBNVS.W Dr,<label> |A|012346|-|---*-|-----| |0101_100_011_001_rrr-{offset} [DBVC.W Dr,<label>] 8453: public static void irpSvc () throws M68kException { 8454: int ea = XEiJ.regOC & 63; 8455: if (ea >> 3 == XEiJ.MMM_AR) { //DBVC.W Dr,<label> 8456: if (XEiJ.MPU_CC_VC << XEiJ.regCCR < 0) { 8457: //条件が成立しているので通過 8458: XEiJ.mpuCycleCount += 12; 8459: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8460: //リードを省略する 8461: } else { 8462: XEiJ.busRws (XEiJ.regPC); 8463: } 8464: XEiJ.regPC += 2; 8465: } else { 8466: //条件が成立していないのでデクリメント 8467: int rrr = XEiJ.regOC & 7; 8468: int t = XEiJ.regRn[rrr]; 8469: if ((short) t == 0) { //Drの下位16bitが0なので通過 8470: XEiJ.mpuCycleCount += 14; 8471: XEiJ.regRn[rrr] = t + 65535; 8472: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8473: //リードを省略する 8474: } else { 8475: XEiJ.busRws (XEiJ.regPC); 8476: } 8477: XEiJ.regPC += 2; 8478: } else { //Drの下位16bitが0でないのでジャンプ 8479: XEiJ.mpuCycleCount += 10; 8480: XEiJ.regRn[rrr] = t - 1; //下位16bitが0でないので上位16bitは変化しない 8481: irpSetPC (XEiJ.regPC + XEiJ.busRws (XEiJ.regPC)); //pc==pc0+2 8482: } 8483: } 8484: } else if (ea < XEiJ.EA_AR) { //SVC.B Dr 8485: if (XEiJ.MPU_CC_VC << XEiJ.regCCR < 0) { //セット 8486: XEiJ.mpuCycleCount += 6; 8487: XEiJ.regRn[ea] |= 0xff; 8488: } else { //クリア 8489: XEiJ.mpuCycleCount += 4; 8490: XEiJ.regRn[ea] &= ~0xff; 8491: } 8492: } else { //SVC.B <mem> 8493: XEiJ.mpuCycleCount += 8; 8494: //MC68000のSccはリードしてからライトする 8495: if (XEiJ.MPU_OMIT_EXTRA_READ) { 8496: //! 軽量化。リードを省略する 8497: XEiJ.busWb (efaMltByte (ea), XEiJ.MPU_CC_VC << XEiJ.regCCR >> 31); 8498: } else { 8499: int a = efaMltByte (ea); 8500: XEiJ.busRbs (a); 8501: XEiJ.busWb (a, XEiJ.MPU_CC_VC << XEiJ.regCCR >> 31); 8502: } 8503: } 8504: } //irpSvc 8505: 8506: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8507: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 8508: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 8509: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8510: //SVS.B <ea> |-|012346|-|---*-|-----|D M+-WXZ |0101_100_111_mmm_rrr 8511: //SNVC.B <ea> |A|012346|-|---*-|-----|D M+-WXZ |0101_100_111_mmm_rrr [SVS.B <ea>] 8512: //DBVS.W Dr,<label> |-|012346|-|---*-|-----| |0101_100_111_001_rrr-{offset} 8513: //DBNVC.W Dr,<label> |A|012346|-|---*-|-----| |0101_100_111_001_rrr-{offset} [DBVS.W Dr,<label>] 8514: public static void irpSvs () throws M68kException { 8515: int ea = XEiJ.regOC & 63; 8516: if (ea >> 3 == XEiJ.MMM_AR) { //DBVS.W Dr,<label> 8517: if (XEiJ.MPU_CC_VS << XEiJ.regCCR < 0) { 8518: //条件が成立しているので通過 8519: XEiJ.mpuCycleCount += 12; 8520: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8521: //リードを省略する 8522: } else { 8523: XEiJ.busRws (XEiJ.regPC); 8524: } 8525: XEiJ.regPC += 2; 8526: } else { 8527: //条件が成立していないのでデクリメント 8528: int rrr = XEiJ.regOC & 7; 8529: int t = XEiJ.regRn[rrr]; 8530: if ((short) t == 0) { //Drの下位16bitが0なので通過 8531: XEiJ.mpuCycleCount += 14; 8532: XEiJ.regRn[rrr] = t + 65535; 8533: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8534: //リードを省略する 8535: } else { 8536: XEiJ.busRws (XEiJ.regPC); 8537: } 8538: XEiJ.regPC += 2; 8539: } else { //Drの下位16bitが0でないのでジャンプ 8540: XEiJ.mpuCycleCount += 10; 8541: XEiJ.regRn[rrr] = t - 1; //下位16bitが0でないので上位16bitは変化しない 8542: irpSetPC (XEiJ.regPC + XEiJ.busRws (XEiJ.regPC)); //pc==pc0+2 8543: } 8544: } 8545: } else if (ea < XEiJ.EA_AR) { //SVS.B Dr 8546: if (XEiJ.MPU_CC_VS << XEiJ.regCCR < 0) { //セット 8547: XEiJ.mpuCycleCount += 6; 8548: XEiJ.regRn[ea] |= 0xff; 8549: } else { //クリア 8550: XEiJ.mpuCycleCount += 4; 8551: XEiJ.regRn[ea] &= ~0xff; 8552: } 8553: } else { //SVS.B <mem> 8554: XEiJ.mpuCycleCount += 8; 8555: //MC68000のSccはリードしてからライトする 8556: if (XEiJ.MPU_OMIT_EXTRA_READ) { 8557: //! 軽量化。リードを省略する 8558: XEiJ.busWb (efaMltByte (ea), XEiJ.MPU_CC_VS << XEiJ.regCCR >> 31); 8559: } else { 8560: int a = efaMltByte (ea); 8561: XEiJ.busRbs (a); 8562: XEiJ.busWb (a, XEiJ.MPU_CC_VS << XEiJ.regCCR >> 31); 8563: } 8564: } 8565: } //irpSvs 8566: 8567: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8568: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 8569: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 8570: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8571: //SPL.B <ea> |-|012346|-|-*---|-----|D M+-WXZ |0101_101_011_mmm_rrr 8572: //SNMI.B <ea> |A|012346|-|-*---|-----|D M+-WXZ |0101_101_011_mmm_rrr [SPL.B <ea>] 8573: //DBPL.W Dr,<label> |-|012346|-|-*---|-----| |0101_101_011_001_rrr-{offset} 8574: //DBNMI.W Dr,<label> |A|012346|-|-*---|-----| |0101_101_011_001_rrr-{offset} [DBPL.W Dr,<label>] 8575: public static void irpSpl () throws M68kException { 8576: int ea = XEiJ.regOC & 63; 8577: if (ea >> 3 == XEiJ.MMM_AR) { //DBPL.W Dr,<label> 8578: if (XEiJ.MPU_CC_PL << XEiJ.regCCR < 0) { 8579: //条件が成立しているので通過 8580: XEiJ.mpuCycleCount += 12; 8581: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8582: //リードを省略する 8583: } else { 8584: XEiJ.busRws (XEiJ.regPC); 8585: } 8586: XEiJ.regPC += 2; 8587: } else { 8588: //条件が成立していないのでデクリメント 8589: int rrr = XEiJ.regOC & 7; 8590: int t = XEiJ.regRn[rrr]; 8591: if ((short) t == 0) { //Drの下位16bitが0なので通過 8592: XEiJ.mpuCycleCount += 14; 8593: XEiJ.regRn[rrr] = t + 65535; 8594: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8595: //リードを省略する 8596: } else { 8597: XEiJ.busRws (XEiJ.regPC); 8598: } 8599: XEiJ.regPC += 2; 8600: } else { //Drの下位16bitが0でないのでジャンプ 8601: XEiJ.mpuCycleCount += 10; 8602: XEiJ.regRn[rrr] = t - 1; //下位16bitが0でないので上位16bitは変化しない 8603: irpSetPC (XEiJ.regPC + XEiJ.busRws (XEiJ.regPC)); //pc==pc0+2 8604: } 8605: } 8606: } else if (ea < XEiJ.EA_AR) { //SPL.B Dr 8607: if (XEiJ.MPU_CC_PL << XEiJ.regCCR < 0) { //セット 8608: XEiJ.mpuCycleCount += 6; 8609: XEiJ.regRn[ea] |= 0xff; 8610: } else { //クリア 8611: XEiJ.mpuCycleCount += 4; 8612: XEiJ.regRn[ea] &= ~0xff; 8613: } 8614: } else { //SPL.B <mem> 8615: XEiJ.mpuCycleCount += 8; 8616: //MC68000のSccはリードしてからライトする 8617: if (XEiJ.MPU_OMIT_EXTRA_READ) { 8618: //! 軽量化。リードを省略する 8619: XEiJ.busWb (efaMltByte (ea), XEiJ.MPU_CC_PL << XEiJ.regCCR >> 31); 8620: } else { 8621: int a = efaMltByte (ea); 8622: XEiJ.busRbs (a); 8623: XEiJ.busWb (a, XEiJ.MPU_CC_PL << XEiJ.regCCR >> 31); 8624: } 8625: } 8626: } //irpSpl 8627: 8628: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8629: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 8630: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 8631: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8632: //SMI.B <ea> |-|012346|-|-*---|-----|D M+-WXZ |0101_101_111_mmm_rrr 8633: //SNPL.B <ea> |A|012346|-|-*---|-----|D M+-WXZ |0101_101_111_mmm_rrr [SMI.B <ea>] 8634: //DBMI.W Dr,<label> |-|012346|-|-*---|-----| |0101_101_111_001_rrr-{offset} 8635: //DBNPL.W Dr,<label> |A|012346|-|-*---|-----| |0101_101_111_001_rrr-{offset} [DBMI.W Dr,<label>] 8636: public static void irpSmi () throws M68kException { 8637: int ea = XEiJ.regOC & 63; 8638: if (ea >> 3 == XEiJ.MMM_AR) { //DBMI.W Dr,<label> 8639: if (XEiJ.MPU_CC_MI << XEiJ.regCCR < 0) { 8640: //条件が成立しているので通過 8641: XEiJ.mpuCycleCount += 12; 8642: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8643: //リードを省略する 8644: } else { 8645: XEiJ.busRws (XEiJ.regPC); 8646: } 8647: XEiJ.regPC += 2; 8648: } else { 8649: //条件が成立していないのでデクリメント 8650: int rrr = XEiJ.regOC & 7; 8651: int t = XEiJ.regRn[rrr]; 8652: if ((short) t == 0) { //Drの下位16bitが0なので通過 8653: XEiJ.mpuCycleCount += 14; 8654: XEiJ.regRn[rrr] = t + 65535; 8655: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8656: //リードを省略する 8657: } else { 8658: XEiJ.busRws (XEiJ.regPC); 8659: } 8660: XEiJ.regPC += 2; 8661: } else { //Drの下位16bitが0でないのでジャンプ 8662: XEiJ.mpuCycleCount += 10; 8663: XEiJ.regRn[rrr] = t - 1; //下位16bitが0でないので上位16bitは変化しない 8664: irpSetPC (XEiJ.regPC + XEiJ.busRws (XEiJ.regPC)); //pc==pc0+2 8665: } 8666: } 8667: } else if (ea < XEiJ.EA_AR) { //SMI.B Dr 8668: if (XEiJ.MPU_CC_MI << XEiJ.regCCR < 0) { //セット 8669: XEiJ.mpuCycleCount += 6; 8670: XEiJ.regRn[ea] |= 0xff; 8671: } else { //クリア 8672: XEiJ.mpuCycleCount += 4; 8673: XEiJ.regRn[ea] &= ~0xff; 8674: } 8675: } else { //SMI.B <mem> 8676: XEiJ.mpuCycleCount += 8; 8677: //MC68000のSccはリードしてからライトする 8678: if (XEiJ.MPU_OMIT_EXTRA_READ) { 8679: //! 軽量化。リードを省略する 8680: XEiJ.busWb (efaMltByte (ea), XEiJ.MPU_CC_MI << XEiJ.regCCR >> 31); 8681: } else { 8682: int a = efaMltByte (ea); 8683: XEiJ.busRbs (a); 8684: XEiJ.busWb (a, XEiJ.MPU_CC_MI << XEiJ.regCCR >> 31); 8685: } 8686: } 8687: } //irpSmi 8688: 8689: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8690: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 8691: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 8692: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8693: //SGE.B <ea> |-|012346|-|-*-*-|-----|D M+-WXZ |0101_110_011_mmm_rrr 8694: //SNLT.B <ea> |A|012346|-|-*-*-|-----|D M+-WXZ |0101_110_011_mmm_rrr [SGE.B <ea>] 8695: //DBGE.W Dr,<label> |-|012346|-|-*-*-|-----| |0101_110_011_001_rrr-{offset} 8696: //DBNLT.W Dr,<label> |A|012346|-|-*-*-|-----| |0101_110_011_001_rrr-{offset} [DBGE.W Dr,<label>] 8697: public static void irpSge () throws M68kException { 8698: int ea = XEiJ.regOC & 63; 8699: if (ea >> 3 == XEiJ.MMM_AR) { //DBGE.W Dr,<label> 8700: if (XEiJ.MPU_CC_GE << XEiJ.regCCR < 0) { 8701: //条件が成立しているので通過 8702: XEiJ.mpuCycleCount += 12; 8703: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8704: //リードを省略する 8705: } else { 8706: XEiJ.busRws (XEiJ.regPC); 8707: } 8708: XEiJ.regPC += 2; 8709: } else { 8710: //条件が成立していないのでデクリメント 8711: int rrr = XEiJ.regOC & 7; 8712: int t = XEiJ.regRn[rrr]; 8713: if ((short) t == 0) { //Drの下位16bitが0なので通過 8714: XEiJ.mpuCycleCount += 14; 8715: XEiJ.regRn[rrr] = t + 65535; 8716: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8717: //リードを省略する 8718: } else { 8719: XEiJ.busRws (XEiJ.regPC); 8720: } 8721: XEiJ.regPC += 2; 8722: } else { //Drの下位16bitが0でないのでジャンプ 8723: XEiJ.mpuCycleCount += 10; 8724: XEiJ.regRn[rrr] = t - 1; //下位16bitが0でないので上位16bitは変化しない 8725: irpSetPC (XEiJ.regPC + XEiJ.busRws (XEiJ.regPC)); //pc==pc0+2 8726: } 8727: } 8728: } else if (ea < XEiJ.EA_AR) { //SGE.B Dr 8729: if (XEiJ.MPU_CC_GE << XEiJ.regCCR < 0) { //セット 8730: XEiJ.mpuCycleCount += 6; 8731: XEiJ.regRn[ea] |= 0xff; 8732: } else { //クリア 8733: XEiJ.mpuCycleCount += 4; 8734: XEiJ.regRn[ea] &= ~0xff; 8735: } 8736: } else { //SGE.B <mem> 8737: XEiJ.mpuCycleCount += 8; 8738: //MC68000のSccはリードしてからライトする 8739: if (XEiJ.MPU_OMIT_EXTRA_READ) { 8740: //! 軽量化。リードを省略する 8741: XEiJ.busWb (efaMltByte (ea), XEiJ.MPU_CC_GE << XEiJ.regCCR >> 31); 8742: } else { 8743: int a = efaMltByte (ea); 8744: XEiJ.busRbs (a); 8745: XEiJ.busWb (a, XEiJ.MPU_CC_GE << XEiJ.regCCR >> 31); 8746: } 8747: } 8748: } //irpSge 8749: 8750: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8751: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 8752: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 8753: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8754: //SLT.B <ea> |-|012346|-|-*-*-|-----|D M+-WXZ |0101_110_111_mmm_rrr 8755: //SNGE.B <ea> |A|012346|-|-*-*-|-----|D M+-WXZ |0101_110_111_mmm_rrr [SLT.B <ea>] 8756: //DBLT.W Dr,<label> |-|012346|-|-*-*-|-----| |0101_110_111_001_rrr-{offset} 8757: //DBNGE.W Dr,<label> |A|012346|-|-*-*-|-----| |0101_110_111_001_rrr-{offset} [DBLT.W Dr,<label>] 8758: public static void irpSlt () throws M68kException { 8759: int ea = XEiJ.regOC & 63; 8760: if (ea >> 3 == XEiJ.MMM_AR) { //DBLT.W Dr,<label> 8761: if (XEiJ.MPU_CC_LT << XEiJ.regCCR < 0) { 8762: //条件が成立しているので通過 8763: XEiJ.mpuCycleCount += 12; 8764: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8765: //リードを省略する 8766: } else { 8767: XEiJ.busRws (XEiJ.regPC); 8768: } 8769: XEiJ.regPC += 2; 8770: } else { 8771: //条件が成立していないのでデクリメント 8772: int rrr = XEiJ.regOC & 7; 8773: int t = XEiJ.regRn[rrr]; 8774: if ((short) t == 0) { //Drの下位16bitが0なので通過 8775: XEiJ.mpuCycleCount += 14; 8776: XEiJ.regRn[rrr] = t + 65535; 8777: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8778: //リードを省略する 8779: } else { 8780: XEiJ.busRws (XEiJ.regPC); 8781: } 8782: XEiJ.regPC += 2; 8783: } else { //Drの下位16bitが0でないのでジャンプ 8784: XEiJ.mpuCycleCount += 10; 8785: XEiJ.regRn[rrr] = t - 1; //下位16bitが0でないので上位16bitは変化しない 8786: irpSetPC (XEiJ.regPC + XEiJ.busRws (XEiJ.regPC)); //pc==pc0+2 8787: } 8788: } 8789: } else if (ea < XEiJ.EA_AR) { //SLT.B Dr 8790: if (XEiJ.MPU_CC_LT << XEiJ.regCCR < 0) { //セット 8791: XEiJ.mpuCycleCount += 6; 8792: XEiJ.regRn[ea] |= 0xff; 8793: } else { //クリア 8794: XEiJ.mpuCycleCount += 4; 8795: XEiJ.regRn[ea] &= ~0xff; 8796: } 8797: } else { //SLT.B <mem> 8798: XEiJ.mpuCycleCount += 8; 8799: //MC68000のSccはリードしてからライトする 8800: if (XEiJ.MPU_OMIT_EXTRA_READ) { 8801: //! 軽量化。リードを省略する 8802: XEiJ.busWb (efaMltByte (ea), XEiJ.MPU_CC_LT << XEiJ.regCCR >> 31); 8803: } else { 8804: int a = efaMltByte (ea); 8805: XEiJ.busRbs (a); 8806: XEiJ.busWb (a, XEiJ.MPU_CC_LT << XEiJ.regCCR >> 31); 8807: } 8808: } 8809: } //irpSlt 8810: 8811: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8812: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 8813: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 8814: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8815: //SGT.B <ea> |-|012346|-|-***-|-----|D M+-WXZ |0101_111_011_mmm_rrr 8816: //SNLE.B <ea> |A|012346|-|-***-|-----|D M+-WXZ |0101_111_011_mmm_rrr [SGT.B <ea>] 8817: //DBGT.W Dr,<label> |-|012346|-|-***-|-----| |0101_111_011_001_rrr-{offset} 8818: //DBNLE.W Dr,<label> |A|012346|-|-***-|-----| |0101_111_011_001_rrr-{offset} [DBGT.W Dr,<label>] 8819: public static void irpSgt () throws M68kException { 8820: int ea = XEiJ.regOC & 63; 8821: if (ea >> 3 == XEiJ.MMM_AR) { //DBGT.W Dr,<label> 8822: if (XEiJ.MPU_CC_GT << XEiJ.regCCR < 0) { 8823: //条件が成立しているので通過 8824: XEiJ.mpuCycleCount += 12; 8825: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8826: //リードを省略する 8827: } else { 8828: XEiJ.busRws (XEiJ.regPC); 8829: } 8830: XEiJ.regPC += 2; 8831: } else { 8832: //条件が成立していないのでデクリメント 8833: int rrr = XEiJ.regOC & 7; 8834: int t = XEiJ.regRn[rrr]; 8835: if ((short) t == 0) { //Drの下位16bitが0なので通過 8836: XEiJ.mpuCycleCount += 14; 8837: XEiJ.regRn[rrr] = t + 65535; 8838: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8839: //リードを省略する 8840: } else { 8841: XEiJ.busRws (XEiJ.regPC); 8842: } 8843: XEiJ.regPC += 2; 8844: } else { //Drの下位16bitが0でないのでジャンプ 8845: XEiJ.mpuCycleCount += 10; 8846: XEiJ.regRn[rrr] = t - 1; //下位16bitが0でないので上位16bitは変化しない 8847: irpSetPC (XEiJ.regPC + XEiJ.busRws (XEiJ.regPC)); //pc==pc0+2 8848: } 8849: } 8850: } else if (ea < XEiJ.EA_AR) { //SGT.B Dr 8851: if (XEiJ.MPU_CC_GT << XEiJ.regCCR < 0) { //セット 8852: XEiJ.mpuCycleCount += 6; 8853: XEiJ.regRn[ea] |= 0xff; 8854: } else { //クリア 8855: XEiJ.mpuCycleCount += 4; 8856: XEiJ.regRn[ea] &= ~0xff; 8857: } 8858: } else { //SGT.B <mem> 8859: XEiJ.mpuCycleCount += 8; 8860: //MC68000のSccはリードしてからライトする 8861: if (XEiJ.MPU_OMIT_EXTRA_READ) { 8862: //! 軽量化。リードを省略する 8863: XEiJ.busWb (efaMltByte (ea), XEiJ.MPU_CC_GT << XEiJ.regCCR >> 31); 8864: } else { 8865: int a = efaMltByte (ea); 8866: XEiJ.busRbs (a); 8867: XEiJ.busWb (a, XEiJ.MPU_CC_GT << XEiJ.regCCR >> 31); 8868: } 8869: } 8870: } //irpSgt 8871: 8872: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8873: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 8874: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 8875: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8876: //SLE.B <ea> |-|012346|-|-***-|-----|D M+-WXZ |0101_111_111_mmm_rrr 8877: //SNGT.B <ea> |A|012346|-|-***-|-----|D M+-WXZ |0101_111_111_mmm_rrr [SLE.B <ea>] 8878: //DBLE.W Dr,<label> |-|012346|-|-***-|-----| |0101_111_111_001_rrr-{offset} 8879: //DBNGT.W Dr,<label> |A|012346|-|-***-|-----| |0101_111_111_001_rrr-{offset} [DBLE.W Dr,<label>] 8880: public static void irpSle () throws M68kException { 8881: int ea = XEiJ.regOC & 63; 8882: if (ea >> 3 == XEiJ.MMM_AR) { //DBLE.W Dr,<label> 8883: if (XEiJ.MPU_CC_LE << XEiJ.regCCR < 0) { 8884: //条件が成立しているので通過 8885: XEiJ.mpuCycleCount += 12; 8886: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8887: //リードを省略する 8888: } else { 8889: XEiJ.busRws (XEiJ.regPC); 8890: } 8891: XEiJ.regPC += 2; 8892: } else { 8893: //条件が成立していないのでデクリメント 8894: int rrr = XEiJ.regOC & 7; 8895: int t = XEiJ.regRn[rrr]; 8896: if ((short) t == 0) { //Drの下位16bitが0なので通過 8897: XEiJ.mpuCycleCount += 14; 8898: XEiJ.regRn[rrr] = t + 65535; 8899: if (XEiJ.MPU_OMIT_OFFSET_READ) { 8900: //リードを省略する 8901: } else { 8902: XEiJ.busRws (XEiJ.regPC); 8903: } 8904: XEiJ.regPC += 2; 8905: } else { //Drの下位16bitが0でないのでジャンプ 8906: XEiJ.mpuCycleCount += 10; 8907: XEiJ.regRn[rrr] = t - 1; //下位16bitが0でないので上位16bitは変化しない 8908: irpSetPC (XEiJ.regPC + XEiJ.busRws (XEiJ.regPC)); //pc==pc0+2 8909: } 8910: } 8911: } else if (ea < XEiJ.EA_AR) { //SLE.B Dr 8912: if (XEiJ.MPU_CC_LE << XEiJ.regCCR < 0) { //セット 8913: XEiJ.mpuCycleCount += 6; 8914: XEiJ.regRn[ea] |= 0xff; 8915: } else { //クリア 8916: XEiJ.mpuCycleCount += 4; 8917: XEiJ.regRn[ea] &= ~0xff; 8918: } 8919: } else { //SLE.B <mem> 8920: XEiJ.mpuCycleCount += 8; 8921: //MC68000のSccはリードしてからライトする 8922: if (XEiJ.MPU_OMIT_EXTRA_READ) { 8923: //! 軽量化。リードを省略する 8924: XEiJ.busWb (efaMltByte (ea), XEiJ.MPU_CC_LE << XEiJ.regCCR >> 31); 8925: } else { 8926: int a = efaMltByte (ea); 8927: XEiJ.busRbs (a); 8928: XEiJ.busWb (a, XEiJ.MPU_CC_LE << XEiJ.regCCR >> 31); 8929: } 8930: } 8931: } //irpSle 8932: 8933: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8934: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 8935: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 8936: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8937: //BRA.W <label> |-|012346|-|-----|-----| |0110_000_000_000_000-{offset} 8938: //JBRA.W <label> |A|012346|-|-----|-----| |0110_000_000_000_000-{offset} [BRA.W <label>] 8939: //BRA.S <label> |-|012346|-|-----|-----| |0110_000_000_sss_sss (s is not equal to 0) 8940: //JBRA.S <label> |A|012346|-|-----|-----| |0110_000_000_sss_sss (s is not equal to 0) [BRA.S <label>] 8941: public static void irpBrasw () throws M68kException { 8942: XEiJ.mpuCycleCount += 10; 8943: int t = XEiJ.regPC; //pc0+2 8944: int s = (byte) XEiJ.regOC; //オフセット 8945: if (s == 0) { //BRA.W 8946: XEiJ.regPC = t + 2; 8947: s = XEiJ.busRwse (t); //pcws 8948: } else { //BRA.S 8949: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 8950: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 8951: if (XEiJ.MPU_OMIT_EXTRA_READ) { 8952: //! 軽量化。リードを省略する 8953: } else { 8954: XEiJ.busRwse (t); //pcws 8955: } 8956: } 8957: irpSetPC (t + s); //pc0+2+オフセット 8958: } //irpBrasw 8959: 8960: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8961: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 8962: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 8963: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8964: //BRA.S <label> |-|012346|-|-----|-----| |0110_000_001_sss_sss 8965: //JBRA.S <label> |A|012346|-|-----|-----| |0110_000_001_sss_sss [BRA.S <label>] 8966: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8967: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 8968: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 8969: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8970: //BRA.S <label> |-|012346|-|-----|-----| |0110_000_010_sss_sss 8971: //JBRA.S <label> |A|012346|-|-----|-----| |0110_000_010_sss_sss [BRA.S <label>] 8972: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8973: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 8974: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 8975: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8976: //BRA.S <label> |-|01----|-|-----|-----| |0110_000_011_sss_sss 8977: //JBRA.S <label> |A|01----|-|-----|-----| |0110_000_011_sss_sss [BRA.S <label>] 8978: public static void irpBras () throws M68kException { 8979: XEiJ.mpuCycleCount += 10; 8980: int t = XEiJ.regPC; //pc0+2 8981: int s = (byte) XEiJ.regOC; //オフセット 8982: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 8983: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 8984: if (XEiJ.MPU_OMIT_EXTRA_READ) { 8985: //! 軽量化。リードを省略する 8986: } else { 8987: XEiJ.busRwse (t); //pcws 8988: } 8989: irpSetPC (t + s); //pc0+2+オフセット 8990: } //irpBras 8991: 8992: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8993: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 8994: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 8995: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 8996: //BSR.W <label> |-|012346|-|-----|-----| |0110_000_100_000_000-{offset} 8997: //JBSR.W <label> |A|012346|-|-----|-----| |0110_000_100_000_000-{offset} [BSR.W <label>] 8998: //BSR.S <label> |-|012346|-|-----|-----| |0110_000_100_sss_sss (s is not equal to 0) 8999: //JBSR.S <label> |A|012346|-|-----|-----| |0110_000_100_sss_sss (s is not equal to 0) [BSR.S <label>] 9000: public static void irpBsrsw () throws M68kException { 9001: XEiJ.mpuCycleCount += 18; 9002: int t = XEiJ.regPC; //pc0+2 9003: int s = (byte) XEiJ.regOC; //オフセット 9004: if (s == 0) { //BSR.W 9005: XEiJ.regPC = t + 2; 9006: s = XEiJ.busRwse (t); //pcws 9007: } else { //BSR.S 9008: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 9009: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 9010: if (XEiJ.MPU_OMIT_EXTRA_READ) { 9011: //! 軽量化。リードを省略する 9012: } else { 9013: XEiJ.busRwse (t); //pcws 9014: } 9015: } 9016: XEiJ.busWl (XEiJ.regRn[15] -= 4, XEiJ.regPC); //pushl 9017: irpSetPC (t + s); //pc0+2+オフセット 9018: } //irpBsrsw 9019: 9020: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9021: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9022: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9023: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9024: //BSR.S <label> |-|012346|-|-----|-----| |0110_000_101_sss_sss 9025: //JBSR.S <label> |A|012346|-|-----|-----| |0110_000_101_sss_sss [BSR.S <label>] 9026: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9027: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9028: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9029: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9030: //BSR.S <label> |-|012346|-|-----|-----| |0110_000_110_sss_sss 9031: //JBSR.S <label> |A|012346|-|-----|-----| |0110_000_110_sss_sss [BSR.S <label>] 9032: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9033: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9034: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9035: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9036: //BSR.S <label> |-|01----|-|-----|-----| |0110_000_111_sss_sss 9037: //JBSR.S <label> |A|01----|-|-----|-----| |0110_000_111_sss_sss [BSR.S <label>] 9038: public static void irpBsrs () throws M68kException { 9039: XEiJ.mpuCycleCount += 18; 9040: int t = XEiJ.regPC; //pc0+2 9041: int s = (byte) XEiJ.regOC; //オフセット 9042: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 9043: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 9044: if (XEiJ.MPU_OMIT_EXTRA_READ) { 9045: //! 軽量化。リードを省略する 9046: } else { 9047: XEiJ.busRwse (t); //pcws 9048: } 9049: XEiJ.busWl (XEiJ.regRn[15] -= 4, XEiJ.regPC); //pushl 9050: irpSetPC (t + s); //pc0+2+オフセット 9051: } //irpBsrs 9052: 9053: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9054: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9055: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9056: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9057: //BHI.W <label> |-|012346|-|--*-*|-----| |0110_001_000_000_000-{offset} 9058: //BNLS.W <label> |A|012346|-|--*-*|-----| |0110_001_000_000_000-{offset} [BHI.W <label>] 9059: //JBHI.W <label> |A|012346|-|--*-*|-----| |0110_001_000_000_000-{offset} [BHI.W <label>] 9060: //JBNLS.W <label> |A|012346|-|--*-*|-----| |0110_001_000_000_000-{offset} [BHI.W <label>] 9061: //BHI.S <label> |-|012346|-|--*-*|-----| |0110_001_000_sss_sss (s is not equal to 0) 9062: //BNLS.S <label> |A|012346|-|--*-*|-----| |0110_001_000_sss_sss (s is not equal to 0) [BHI.S <label>] 9063: //JBHI.S <label> |A|012346|-|--*-*|-----| |0110_001_000_sss_sss (s is not equal to 0) [BHI.S <label>] 9064: //JBNLS.S <label> |A|012346|-|--*-*|-----| |0110_001_000_sss_sss (s is not equal to 0) [BHI.S <label>] 9065: //JBLS.L <label> |A|012346|-|--*-*|-----| |0110_001_000_000_110-0100111011111001-{address} [BHI.S (*)+8;JMP <label>] 9066: //JBNHI.L <label> |A|012346|-|--*-*|-----| |0110_001_000_000_110-0100111011111001-{address} [BHI.S (*)+8;JMP <label>] 9067: public static void irpBhisw () throws M68kException { 9068: if (XEiJ.MPU_CC_HI << XEiJ.regCCR < 0) { //Bccでジャンプ 9069: XEiJ.mpuCycleCount += 10; 9070: int t = XEiJ.regPC; //pc0+2 9071: int s = (byte) XEiJ.regOC; //オフセット 9072: if (s == 0) { //Bcc.Wでジャンプ 9073: XEiJ.regPC = t + 2; 9074: s = XEiJ.busRwse (t); //pcws 9075: } else { //Bcc.Sでジャンプ 9076: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 9077: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 9078: if (XEiJ.MPU_OMIT_EXTRA_READ) { 9079: //! 軽量化。リードを省略する 9080: } else { 9081: XEiJ.busRwse (t); //pcws 9082: } 9083: } 9084: irpSetPC (t + s); //pc0+2+オフセット 9085: } else if (XEiJ.regOC == 0x6200) { //Bcc.Wで通過 9086: XEiJ.mpuCycleCount += 12; 9087: if (XEiJ.MPU_OMIT_OFFSET_READ) { 9088: //リードを省略する 9089: } else { 9090: XEiJ.busRws (XEiJ.regPC); 9091: } 9092: XEiJ.regPC += 2; 9093: } else { //Bcc.Sで通過 9094: XEiJ.mpuCycleCount += 8; 9095: } 9096: } //irpBhisw 9097: 9098: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9099: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9100: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9101: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9102: //BHI.S <label> |-|012346|-|--*-*|-----| |0110_001_001_sss_sss 9103: //BNLS.S <label> |A|012346|-|--*-*|-----| |0110_001_001_sss_sss [BHI.S <label>] 9104: //JBHI.S <label> |A|012346|-|--*-*|-----| |0110_001_001_sss_sss [BHI.S <label>] 9105: //JBNLS.S <label> |A|012346|-|--*-*|-----| |0110_001_001_sss_sss [BHI.S <label>] 9106: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9107: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9108: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9109: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9110: //BHI.S <label> |-|012346|-|--*-*|-----| |0110_001_010_sss_sss 9111: //BNLS.S <label> |A|012346|-|--*-*|-----| |0110_001_010_sss_sss [BHI.S <label>] 9112: //JBHI.S <label> |A|012346|-|--*-*|-----| |0110_001_010_sss_sss [BHI.S <label>] 9113: //JBNLS.S <label> |A|012346|-|--*-*|-----| |0110_001_010_sss_sss [BHI.S <label>] 9114: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9115: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9116: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9117: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9118: //BHI.S <label> |-|01----|-|--*-*|-----| |0110_001_011_sss_sss 9119: //BNLS.S <label> |A|01----|-|--*-*|-----| |0110_001_011_sss_sss [BHI.S <label>] 9120: //JBHI.S <label> |A|01----|-|--*-*|-----| |0110_001_011_sss_sss [BHI.S <label>] 9121: //JBNLS.S <label> |A|01----|-|--*-*|-----| |0110_001_011_sss_sss [BHI.S <label>] 9122: public static void irpBhis () throws M68kException { 9123: if (XEiJ.MPU_CC_HI << XEiJ.regCCR < 0) { //Bcc.Sでジャンプ 9124: XEiJ.mpuCycleCount += 10; 9125: int t = XEiJ.regPC; //pc0+2 9126: int s = (byte) XEiJ.regOC; //オフセット 9127: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 9128: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 9129: if (XEiJ.MPU_OMIT_EXTRA_READ) { 9130: //! 軽量化。リードを省略する 9131: } else { 9132: XEiJ.busRwse (t); //pcws 9133: } 9134: irpSetPC (t + s); //pc0+2+オフセット 9135: } else { //Bcc.Sで通過 9136: XEiJ.mpuCycleCount += 8; 9137: } 9138: } //irpBhis 9139: 9140: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9141: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9142: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9143: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9144: //BLS.W <label> |-|012346|-|--*-*|-----| |0110_001_100_000_000-{offset} 9145: //BNHI.W <label> |A|012346|-|--*-*|-----| |0110_001_100_000_000-{offset} [BLS.W <label>] 9146: //JBLS.W <label> |A|012346|-|--*-*|-----| |0110_001_100_000_000-{offset} [BLS.W <label>] 9147: //JBNHI.W <label> |A|012346|-|--*-*|-----| |0110_001_100_000_000-{offset} [BLS.W <label>] 9148: //BLS.S <label> |-|012346|-|--*-*|-----| |0110_001_100_sss_sss (s is not equal to 0) 9149: //BNHI.S <label> |A|012346|-|--*-*|-----| |0110_001_100_sss_sss (s is not equal to 0) [BLS.S <label>] 9150: //JBLS.S <label> |A|012346|-|--*-*|-----| |0110_001_100_sss_sss (s is not equal to 0) [BLS.S <label>] 9151: //JBNHI.S <label> |A|012346|-|--*-*|-----| |0110_001_100_sss_sss (s is not equal to 0) [BLS.S <label>] 9152: //JBHI.L <label> |A|012346|-|--*-*|-----| |0110_001_100_000_110-0100111011111001-{address} [BLS.S (*)+8;JMP <label>] 9153: //JBNLS.L <label> |A|012346|-|--*-*|-----| |0110_001_100_000_110-0100111011111001-{address} [BLS.S (*)+8;JMP <label>] 9154: public static void irpBlssw () throws M68kException { 9155: if (XEiJ.MPU_CC_LS << XEiJ.regCCR < 0) { //Bccでジャンプ 9156: XEiJ.mpuCycleCount += 10; 9157: int t = XEiJ.regPC; //pc0+2 9158: int s = (byte) XEiJ.regOC; //オフセット 9159: if (s == 0) { //Bcc.Wでジャンプ 9160: XEiJ.regPC = t + 2; 9161: s = XEiJ.busRwse (t); //pcws 9162: } else { //Bcc.Sでジャンプ 9163: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 9164: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 9165: if (XEiJ.MPU_OMIT_EXTRA_READ) { 9166: //! 軽量化。リードを省略する 9167: } else { 9168: XEiJ.busRwse (t); //pcws 9169: } 9170: } 9171: irpSetPC (t + s); //pc0+2+オフセット 9172: } else if (XEiJ.regOC == 0x6300) { //Bcc.Wで通過 9173: XEiJ.mpuCycleCount += 12; 9174: if (XEiJ.MPU_OMIT_OFFSET_READ) { 9175: //リードを省略する 9176: } else { 9177: XEiJ.busRws (XEiJ.regPC); 9178: } 9179: XEiJ.regPC += 2; 9180: } else { //Bcc.Sで通過 9181: XEiJ.mpuCycleCount += 8; 9182: } 9183: } //irpBlssw 9184: 9185: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9186: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9187: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9188: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9189: //BLS.S <label> |-|012346|-|--*-*|-----| |0110_001_101_sss_sss 9190: //BNHI.S <label> |A|012346|-|--*-*|-----| |0110_001_101_sss_sss [BLS.S <label>] 9191: //JBLS.S <label> |A|012346|-|--*-*|-----| |0110_001_101_sss_sss [BLS.S <label>] 9192: //JBNHI.S <label> |A|012346|-|--*-*|-----| |0110_001_101_sss_sss [BLS.S <label>] 9193: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9194: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9195: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9196: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9197: //BLS.S <label> |-|012346|-|--*-*|-----| |0110_001_110_sss_sss 9198: //BNHI.S <label> |A|012346|-|--*-*|-----| |0110_001_110_sss_sss [BLS.S <label>] 9199: //JBLS.S <label> |A|012346|-|--*-*|-----| |0110_001_110_sss_sss [BLS.S <label>] 9200: //JBNHI.S <label> |A|012346|-|--*-*|-----| |0110_001_110_sss_sss [BLS.S <label>] 9201: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9202: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9203: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9204: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9205: //BLS.S <label> |-|01----|-|--*-*|-----| |0110_001_111_sss_sss 9206: //BNHI.S <label> |A|01----|-|--*-*|-----| |0110_001_111_sss_sss [BLS.S <label>] 9207: //JBLS.S <label> |A|01----|-|--*-*|-----| |0110_001_111_sss_sss [BLS.S <label>] 9208: //JBNHI.S <label> |A|01----|-|--*-*|-----| |0110_001_111_sss_sss [BLS.S <label>] 9209: public static void irpBlss () throws M68kException { 9210: if (XEiJ.MPU_CC_LS << XEiJ.regCCR < 0) { //Bcc.Sでジャンプ 9211: XEiJ.mpuCycleCount += 10; 9212: int t = XEiJ.regPC; //pc0+2 9213: int s = (byte) XEiJ.regOC; //オフセット 9214: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 9215: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 9216: if (XEiJ.MPU_OMIT_EXTRA_READ) { 9217: //! 軽量化。リードを省略する 9218: } else { 9219: XEiJ.busRwse (t); //pcws 9220: } 9221: irpSetPC (t + s); //pc0+2+オフセット 9222: } else { //Bcc.Sで通過 9223: XEiJ.mpuCycleCount += 8; 9224: } 9225: } //irpBlss 9226: 9227: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9228: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9229: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9230: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9231: //BCC.W <label> |-|012346|-|----*|-----| |0110_010_000_000_000-{offset} 9232: //BHS.W <label> |A|012346|-|----*|-----| |0110_010_000_000_000-{offset} [BCC.W <label>] 9233: //BNCS.W <label> |A|012346|-|----*|-----| |0110_010_000_000_000-{offset} [BCC.W <label>] 9234: //BNLO.W <label> |A|012346|-|----*|-----| |0110_010_000_000_000-{offset} [BCC.W <label>] 9235: //JBCC.W <label> |A|012346|-|----*|-----| |0110_010_000_000_000-{offset} [BCC.W <label>] 9236: //JBHS.W <label> |A|012346|-|----*|-----| |0110_010_000_000_000-{offset} [BCC.W <label>] 9237: //JBNCS.W <label> |A|012346|-|----*|-----| |0110_010_000_000_000-{offset} [BCC.W <label>] 9238: //JBNLO.W <label> |A|012346|-|----*|-----| |0110_010_000_000_000-{offset} [BCC.W <label>] 9239: //BCC.S <label> |-|012346|-|----*|-----| |0110_010_000_sss_sss (s is not equal to 0) 9240: //BHS.S <label> |A|012346|-|----*|-----| |0110_010_000_sss_sss (s is not equal to 0) [BCC.S <label>] 9241: //BNCS.S <label> |A|012346|-|----*|-----| |0110_010_000_sss_sss (s is not equal to 0) [BCC.S <label>] 9242: //BNLO.S <label> |A|012346|-|----*|-----| |0110_010_000_sss_sss (s is not equal to 0) [BCC.S <label>] 9243: //JBCC.S <label> |A|012346|-|----*|-----| |0110_010_000_sss_sss (s is not equal to 0) [BCC.S <label>] 9244: //JBHS.S <label> |A|012346|-|----*|-----| |0110_010_000_sss_sss (s is not equal to 0) [BCC.S <label>] 9245: //JBNCS.S <label> |A|012346|-|----*|-----| |0110_010_000_sss_sss (s is not equal to 0) [BCC.S <label>] 9246: //JBNLO.S <label> |A|012346|-|----*|-----| |0110_010_000_sss_sss (s is not equal to 0) [BCC.S <label>] 9247: //JBCS.L <label> |A|012346|-|----*|-----| |0110_010_000_000_110-0100111011111001-{address} [BCC.S (*)+8;JMP <label>] 9248: //JBLO.L <label> |A|012346|-|----*|-----| |0110_010_000_000_110-0100111011111001-{address} [BCC.S (*)+8;JMP <label>] 9249: //JBNCC.L <label> |A|012346|-|----*|-----| |0110_010_000_000_110-0100111011111001-{address} [BCC.S (*)+8;JMP <label>] 9250: //JBNHS.L <label> |A|012346|-|----*|-----| |0110_010_000_000_110-0100111011111001-{address} [BCC.S (*)+8;JMP <label>] 9251: public static void irpBhssw () throws M68kException { 9252: if (XEiJ.MPU_CC_HS << XEiJ.regCCR < 0) { //Bccでジャンプ 9253: XEiJ.mpuCycleCount += 10; 9254: int t = XEiJ.regPC; //pc0+2 9255: int s = (byte) XEiJ.regOC; //オフセット 9256: if (s == 0) { //Bcc.Wでジャンプ 9257: XEiJ.regPC = t + 2; 9258: s = XEiJ.busRwse (t); //pcws 9259: } else { //Bcc.Sでジャンプ 9260: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 9261: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 9262: if (XEiJ.MPU_OMIT_EXTRA_READ) { 9263: //! 軽量化。リードを省略する 9264: } else { 9265: XEiJ.busRwse (t); //pcws 9266: } 9267: } 9268: irpSetPC (t + s); //pc0+2+オフセット 9269: } else if (XEiJ.regOC == 0x6400) { //Bcc.Wで通過 9270: XEiJ.mpuCycleCount += 12; 9271: if (XEiJ.MPU_OMIT_OFFSET_READ) { 9272: //リードを省略する 9273: } else { 9274: XEiJ.busRws (XEiJ.regPC); 9275: } 9276: XEiJ.regPC += 2; 9277: } else { //Bcc.Sで通過 9278: XEiJ.mpuCycleCount += 8; 9279: } 9280: } //irpBhssw 9281: 9282: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9283: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9284: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9285: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9286: //BCC.S <label> |-|012346|-|----*|-----| |0110_010_001_sss_sss 9287: //BHS.S <label> |A|012346|-|----*|-----| |0110_010_001_sss_sss [BCC.S <label>] 9288: //BNCS.S <label> |A|012346|-|----*|-----| |0110_010_001_sss_sss [BCC.S <label>] 9289: //BNLO.S <label> |A|012346|-|----*|-----| |0110_010_001_sss_sss [BCC.S <label>] 9290: //JBCC.S <label> |A|012346|-|----*|-----| |0110_010_001_sss_sss [BCC.S <label>] 9291: //JBHS.S <label> |A|012346|-|----*|-----| |0110_010_001_sss_sss [BCC.S <label>] 9292: //JBNCS.S <label> |A|012346|-|----*|-----| |0110_010_001_sss_sss [BCC.S <label>] 9293: //JBNLO.S <label> |A|012346|-|----*|-----| |0110_010_001_sss_sss [BCC.S <label>] 9294: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9295: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9296: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9297: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9298: //BCC.S <label> |-|012346|-|----*|-----| |0110_010_010_sss_sss 9299: //BHS.S <label> |A|012346|-|----*|-----| |0110_010_010_sss_sss [BCC.S <label>] 9300: //BNCS.S <label> |A|012346|-|----*|-----| |0110_010_010_sss_sss [BCC.S <label>] 9301: //BNLO.S <label> |A|012346|-|----*|-----| |0110_010_010_sss_sss [BCC.S <label>] 9302: //JBCC.S <label> |A|012346|-|----*|-----| |0110_010_010_sss_sss [BCC.S <label>] 9303: //JBHS.S <label> |A|012346|-|----*|-----| |0110_010_010_sss_sss [BCC.S <label>] 9304: //JBNCS.S <label> |A|012346|-|----*|-----| |0110_010_010_sss_sss [BCC.S <label>] 9305: //JBNLO.S <label> |A|012346|-|----*|-----| |0110_010_010_sss_sss [BCC.S <label>] 9306: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9307: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9308: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9309: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9310: //BCC.S <label> |-|01----|-|----*|-----| |0110_010_011_sss_sss 9311: //BHS.S <label> |A|01----|-|----*|-----| |0110_010_011_sss_sss [BCC.S <label>] 9312: //BNCS.S <label> |A|01----|-|----*|-----| |0110_010_011_sss_sss [BCC.S <label>] 9313: //BNLO.S <label> |A|01----|-|----*|-----| |0110_010_011_sss_sss [BCC.S <label>] 9314: //JBCC.S <label> |A|01----|-|----*|-----| |0110_010_011_sss_sss [BCC.S <label>] 9315: //JBHS.S <label> |A|01----|-|----*|-----| |0110_010_011_sss_sss [BCC.S <label>] 9316: //JBNCS.S <label> |A|01----|-|----*|-----| |0110_010_011_sss_sss [BCC.S <label>] 9317: //JBNLO.S <label> |A|01----|-|----*|-----| |0110_010_011_sss_sss [BCC.S <label>] 9318: public static void irpBhss () throws M68kException { 9319: if (XEiJ.MPU_CC_HS << XEiJ.regCCR < 0) { //Bcc.Sでジャンプ 9320: XEiJ.mpuCycleCount += 10; 9321: int t = XEiJ.regPC; //pc0+2 9322: int s = (byte) XEiJ.regOC; //オフセット 9323: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 9324: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 9325: if (XEiJ.MPU_OMIT_EXTRA_READ) { 9326: //! 軽量化。リードを省略する 9327: } else { 9328: XEiJ.busRwse (t); //pcws 9329: } 9330: irpSetPC (t + s); //pc0+2+オフセット 9331: } else { //Bcc.Sで通過 9332: XEiJ.mpuCycleCount += 8; 9333: } 9334: } //irpBhss 9335: 9336: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9337: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9338: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9339: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9340: //BCS.W <label> |-|012346|-|----*|-----| |0110_010_100_000_000-{offset} 9341: //BLO.W <label> |A|012346|-|----*|-----| |0110_010_100_000_000-{offset} [BCS.W <label>] 9342: //BNCC.W <label> |A|012346|-|----*|-----| |0110_010_100_000_000-{offset} [BCS.W <label>] 9343: //BNHS.W <label> |A|012346|-|----*|-----| |0110_010_100_000_000-{offset} [BCS.W <label>] 9344: //JBCS.W <label> |A|012346|-|----*|-----| |0110_010_100_000_000-{offset} [BCS.W <label>] 9345: //JBLO.W <label> |A|012346|-|----*|-----| |0110_010_100_000_000-{offset} [BCS.W <label>] 9346: //JBNCC.W <label> |A|012346|-|----*|-----| |0110_010_100_000_000-{offset} [BCS.W <label>] 9347: //JBNHS.W <label> |A|012346|-|----*|-----| |0110_010_100_000_000-{offset} [BCS.W <label>] 9348: //BCS.S <label> |-|012346|-|----*|-----| |0110_010_100_sss_sss (s is not equal to 0) 9349: //BLO.S <label> |A|012346|-|----*|-----| |0110_010_100_sss_sss (s is not equal to 0) [BCS.S <label>] 9350: //BNCC.S <label> |A|012346|-|----*|-----| |0110_010_100_sss_sss (s is not equal to 0) [BCS.S <label>] 9351: //BNHS.S <label> |A|012346|-|----*|-----| |0110_010_100_sss_sss (s is not equal to 0) [BCS.S <label>] 9352: //JBCS.S <label> |A|012346|-|----*|-----| |0110_010_100_sss_sss (s is not equal to 0) [BCS.S <label>] 9353: //JBLO.S <label> |A|012346|-|----*|-----| |0110_010_100_sss_sss (s is not equal to 0) [BCS.S <label>] 9354: //JBNCC.S <label> |A|012346|-|----*|-----| |0110_010_100_sss_sss (s is not equal to 0) [BCS.S <label>] 9355: //JBNHS.S <label> |A|012346|-|----*|-----| |0110_010_100_sss_sss (s is not equal to 0) [BCS.S <label>] 9356: //JBCC.L <label> |A|012346|-|----*|-----| |0110_010_100_000_110-0100111011111001-{address} [BCS.S (*)+8;JMP <label>] 9357: //JBHS.L <label> |A|012346|-|----*|-----| |0110_010_100_000_110-0100111011111001-{address} [BCS.S (*)+8;JMP <label>] 9358: //JBNCS.L <label> |A|012346|-|----*|-----| |0110_010_100_000_110-0100111011111001-{address} [BCS.S (*)+8;JMP <label>] 9359: //JBNLO.L <label> |A|012346|-|----*|-----| |0110_010_100_000_110-0100111011111001-{address} [BCS.S (*)+8;JMP <label>] 9360: public static void irpBlosw () throws M68kException { 9361: if (XEiJ.MPU_CC_LO << XEiJ.regCCR < 0) { //Bccでジャンプ 9362: XEiJ.mpuCycleCount += 10; 9363: int t = XEiJ.regPC; //pc0+2 9364: int s = (byte) XEiJ.regOC; //オフセット 9365: if (s == 0) { //Bcc.Wでジャンプ 9366: XEiJ.regPC = t + 2; 9367: s = XEiJ.busRwse (t); //pcws 9368: } else { //Bcc.Sでジャンプ 9369: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 9370: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 9371: if (XEiJ.MPU_OMIT_EXTRA_READ) { 9372: //! 軽量化。リードを省略する 9373: } else { 9374: XEiJ.busRwse (t); //pcws 9375: } 9376: } 9377: irpSetPC (t + s); //pc0+2+オフセット 9378: } else if (XEiJ.regOC == 0x6500) { //Bcc.Wで通過 9379: XEiJ.mpuCycleCount += 12; 9380: if (XEiJ.MPU_OMIT_OFFSET_READ) { 9381: //リードを省略する 9382: } else { 9383: XEiJ.busRws (XEiJ.regPC); 9384: } 9385: XEiJ.regPC += 2; 9386: } else { //Bcc.Sで通過 9387: XEiJ.mpuCycleCount += 8; 9388: } 9389: } //irpBlosw 9390: 9391: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9392: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9393: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9394: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9395: //BCS.S <label> |-|012346|-|----*|-----| |0110_010_101_sss_sss 9396: //BLO.S <label> |A|012346|-|----*|-----| |0110_010_101_sss_sss [BCS.S <label>] 9397: //BNCC.S <label> |A|012346|-|----*|-----| |0110_010_101_sss_sss [BCS.S <label>] 9398: //BNHS.S <label> |A|012346|-|----*|-----| |0110_010_101_sss_sss [BCS.S <label>] 9399: //JBCS.S <label> |A|012346|-|----*|-----| |0110_010_101_sss_sss [BCS.S <label>] 9400: //JBLO.S <label> |A|012346|-|----*|-----| |0110_010_101_sss_sss [BCS.S <label>] 9401: //JBNCC.S <label> |A|012346|-|----*|-----| |0110_010_101_sss_sss [BCS.S <label>] 9402: //JBNHS.S <label> |A|012346|-|----*|-----| |0110_010_101_sss_sss [BCS.S <label>] 9403: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9404: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9405: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9406: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9407: //BCS.S <label> |-|012346|-|----*|-----| |0110_010_110_sss_sss 9408: //BLO.S <label> |A|012346|-|----*|-----| |0110_010_110_sss_sss [BCS.S <label>] 9409: //BNCC.S <label> |A|012346|-|----*|-----| |0110_010_110_sss_sss [BCS.S <label>] 9410: //BNHS.S <label> |A|012346|-|----*|-----| |0110_010_110_sss_sss [BCS.S <label>] 9411: //JBCS.S <label> |A|012346|-|----*|-----| |0110_010_110_sss_sss [BCS.S <label>] 9412: //JBLO.S <label> |A|012346|-|----*|-----| |0110_010_110_sss_sss [BCS.S <label>] 9413: //JBNCC.S <label> |A|012346|-|----*|-----| |0110_010_110_sss_sss [BCS.S <label>] 9414: //JBNHS.S <label> |A|012346|-|----*|-----| |0110_010_110_sss_sss [BCS.S <label>] 9415: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9416: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9417: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9418: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9419: //BCS.S <label> |-|01----|-|----*|-----| |0110_010_111_sss_sss 9420: //BLO.S <label> |A|01----|-|----*|-----| |0110_010_111_sss_sss [BCS.S <label>] 9421: //BNCC.S <label> |A|01----|-|----*|-----| |0110_010_111_sss_sss [BCS.S <label>] 9422: //BNHS.S <label> |A|01----|-|----*|-----| |0110_010_111_sss_sss [BCS.S <label>] 9423: //JBCS.S <label> |A|01----|-|----*|-----| |0110_010_111_sss_sss [BCS.S <label>] 9424: //JBLO.S <label> |A|01----|-|----*|-----| |0110_010_111_sss_sss [BCS.S <label>] 9425: //JBNCC.S <label> |A|01----|-|----*|-----| |0110_010_111_sss_sss [BCS.S <label>] 9426: //JBNHS.S <label> |A|01----|-|----*|-----| |0110_010_111_sss_sss [BCS.S <label>] 9427: public static void irpBlos () throws M68kException { 9428: if (XEiJ.MPU_CC_LO << XEiJ.regCCR < 0) { //Bccでジャンプ 9429: XEiJ.mpuCycleCount += 10; 9430: int t = XEiJ.regPC; //pc0+2 9431: int s = (byte) XEiJ.regOC; //オフセット 9432: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 9433: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 9434: if (XEiJ.MPU_OMIT_EXTRA_READ) { 9435: //! 軽量化。リードを省略する 9436: } else { 9437: XEiJ.busRwse (t); //pcws 9438: } 9439: irpSetPC (t + s); //pc0+2+オフセット 9440: } else { //Bcc.Sで通過 9441: XEiJ.mpuCycleCount += 8; 9442: } 9443: } //irpBlos 9444: 9445: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9446: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9447: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9448: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9449: //BNE.W <label> |-|012346|-|--*--|-----| |0110_011_000_000_000-{offset} 9450: //BNEQ.W <label> |A|012346|-|--*--|-----| |0110_011_000_000_000-{offset} [BNE.W <label>] 9451: //BNZ.W <label> |A|012346|-|--*--|-----| |0110_011_000_000_000-{offset} [BNE.W <label>] 9452: //BNZE.W <label> |A|012346|-|--*--|-----| |0110_011_000_000_000-{offset} [BNE.W <label>] 9453: //JBNE.W <label> |A|012346|-|--*--|-----| |0110_011_000_000_000-{offset} [BNE.W <label>] 9454: //JBNEQ.W <label> |A|012346|-|--*--|-----| |0110_011_000_000_000-{offset} [BNE.W <label>] 9455: //JBNZ.W <label> |A|012346|-|--*--|-----| |0110_011_000_000_000-{offset} [BNE.W <label>] 9456: //JBNZE.W <label> |A|012346|-|--*--|-----| |0110_011_000_000_000-{offset} [BNE.W <label>] 9457: //BNE.S <label> |-|012346|-|--*--|-----| |0110_011_000_sss_sss (s is not equal to 0) 9458: //BNEQ.S <label> |A|012346|-|--*--|-----| |0110_011_000_sss_sss (s is not equal to 0) [BNE.S <label>] 9459: //BNZ.S <label> |A|012346|-|--*--|-----| |0110_011_000_sss_sss (s is not equal to 0) [BNE.S <label>] 9460: //BNZE.S <label> |A|012346|-|--*--|-----| |0110_011_000_sss_sss (s is not equal to 0) [BNE.S <label>] 9461: //JBNE.S <label> |A|012346|-|--*--|-----| |0110_011_000_sss_sss (s is not equal to 0) [BNE.S <label>] 9462: //JBNEQ.S <label> |A|012346|-|--*--|-----| |0110_011_000_sss_sss (s is not equal to 0) [BNE.S <label>] 9463: //JBNZ.S <label> |A|012346|-|--*--|-----| |0110_011_000_sss_sss (s is not equal to 0) [BNE.S <label>] 9464: //JBNZE.S <label> |A|012346|-|--*--|-----| |0110_011_000_sss_sss (s is not equal to 0) [BNE.S <label>] 9465: //JBEQ.L <label> |A|012346|-|--*--|-----| |0110_011_000_000_110-0100111011111001-{address} [BNE.S (*)+8;JMP <label>] 9466: //JBNEQ.L <label> |A|012346|-|--*--|-----| |0110_011_000_000_110-0100111011111001-{address} [BNE.S (*)+8;JMP <label>] 9467: //JBNNE.L <label> |A|012346|-|--*--|-----| |0110_011_000_000_110-0100111011111001-{address} [BNE.S (*)+8;JMP <label>] 9468: //JBNNZ.L <label> |A|012346|-|--*--|-----| |0110_011_000_000_110-0100111011111001-{address} [BNE.S (*)+8;JMP <label>] 9469: //JBNZ.L <label> |A|012346|-|--*--|-----| |0110_011_000_000_110-0100111011111001-{address} [BNE.S (*)+8;JMP <label>] 9470: //JBNZE.L <label> |A|012346|-|--*--|-----| |0110_011_000_000_110-0100111011111001-{address} [BNE.S (*)+8;JMP <label>] 9471: //JBZE.L <label> |A|012346|-|--*--|-----| |0110_011_000_000_110-0100111011111001-{address} [BNE.S (*)+8;JMP <label>] 9472: public static void irpBnesw () throws M68kException { 9473: if (XEiJ.MPU_CC_NE << XEiJ.regCCR < 0) { //Bccでジャンプ 9474: XEiJ.mpuCycleCount += 10; 9475: int t = XEiJ.regPC; //pc0+2 9476: int s = (byte) XEiJ.regOC; //オフセット 9477: if (s == 0) { //Bcc.Wでジャンプ 9478: XEiJ.regPC = t + 2; 9479: s = XEiJ.busRwse (t); //pcws 9480: } else { //Bcc.Sでジャンプ 9481: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 9482: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 9483: if (XEiJ.MPU_OMIT_EXTRA_READ) { 9484: //! 軽量化。リードを省略する 9485: } else { 9486: XEiJ.busRwse (t); //pcws 9487: } 9488: } 9489: irpSetPC (t + s); //pc0+2+オフセット 9490: } else if (XEiJ.regOC == 0x6600) { //Bcc.Wで通過 9491: XEiJ.mpuCycleCount += 12; 9492: if (XEiJ.MPU_OMIT_OFFSET_READ) { 9493: //リードを省略する 9494: } else { 9495: XEiJ.busRws (XEiJ.regPC); 9496: } 9497: XEiJ.regPC += 2; 9498: } else { //Bcc.Sで通過 9499: XEiJ.mpuCycleCount += 8; 9500: } 9501: } //irpBnesw 9502: 9503: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9504: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9505: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9506: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9507: //BNE.S <label> |-|012346|-|--*--|-----| |0110_011_001_sss_sss 9508: //BNEQ.S <label> |A|012346|-|--*--|-----| |0110_011_001_sss_sss [BNE.S <label>] 9509: //BNZ.S <label> |A|012346|-|--*--|-----| |0110_011_001_sss_sss [BNE.S <label>] 9510: //BNZE.S <label> |A|012346|-|--*--|-----| |0110_011_001_sss_sss [BNE.S <label>] 9511: //JBNE.S <label> |A|012346|-|--*--|-----| |0110_011_001_sss_sss [BNE.S <label>] 9512: //JBNEQ.S <label> |A|012346|-|--*--|-----| |0110_011_001_sss_sss [BNE.S <label>] 9513: //JBNZ.S <label> |A|012346|-|--*--|-----| |0110_011_001_sss_sss [BNE.S <label>] 9514: //JBNZE.S <label> |A|012346|-|--*--|-----| |0110_011_001_sss_sss [BNE.S <label>] 9515: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9516: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9517: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9518: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9519: //BNE.S <label> |-|012346|-|--*--|-----| |0110_011_010_sss_sss 9520: //BNEQ.S <label> |A|012346|-|--*--|-----| |0110_011_010_sss_sss [BNE.S <label>] 9521: //BNZ.S <label> |A|012346|-|--*--|-----| |0110_011_010_sss_sss [BNE.S <label>] 9522: //BNZE.S <label> |A|012346|-|--*--|-----| |0110_011_010_sss_sss [BNE.S <label>] 9523: //JBNE.S <label> |A|012346|-|--*--|-----| |0110_011_010_sss_sss [BNE.S <label>] 9524: //JBNEQ.S <label> |A|012346|-|--*--|-----| |0110_011_010_sss_sss [BNE.S <label>] 9525: //JBNZ.S <label> |A|012346|-|--*--|-----| |0110_011_010_sss_sss [BNE.S <label>] 9526: //JBNZE.S <label> |A|012346|-|--*--|-----| |0110_011_010_sss_sss [BNE.S <label>] 9527: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9528: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9529: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9530: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9531: //BNE.S <label> |-|01----|-|--*--|-----| |0110_011_011_sss_sss 9532: //BNEQ.S <label> |A|01----|-|--*--|-----| |0110_011_011_sss_sss [BNE.S <label>] 9533: //BNZ.S <label> |A|01----|-|--*--|-----| |0110_011_011_sss_sss [BNE.S <label>] 9534: //BNZE.S <label> |A|01----|-|--*--|-----| |0110_011_011_sss_sss [BNE.S <label>] 9535: //JBNE.S <label> |A|01----|-|--*--|-----| |0110_011_011_sss_sss [BNE.S <label>] 9536: //JBNEQ.S <label> |A|01----|-|--*--|-----| |0110_011_011_sss_sss [BNE.S <label>] 9537: //JBNZ.S <label> |A|01----|-|--*--|-----| |0110_011_011_sss_sss [BNE.S <label>] 9538: //JBNZE.S <label> |A|01----|-|--*--|-----| |0110_011_011_sss_sss [BNE.S <label>] 9539: public static void irpBnes () throws M68kException { 9540: if (XEiJ.MPU_CC_NE << XEiJ.regCCR < 0) { //Bccでジャンプ 9541: XEiJ.mpuCycleCount += 10; 9542: int t = XEiJ.regPC; //pc0+2 9543: int s = (byte) XEiJ.regOC; //オフセット 9544: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 9545: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 9546: if (XEiJ.MPU_OMIT_EXTRA_READ) { 9547: //! 軽量化。リードを省略する 9548: } else { 9549: XEiJ.busRwse (t); //pcws 9550: } 9551: irpSetPC (t + s); //pc0+2+オフセット 9552: } else { //Bcc.Sで通過 9553: XEiJ.mpuCycleCount += 8; 9554: } 9555: } //irpBnes 9556: 9557: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9558: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9559: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9560: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9561: //BEQ.W <label> |-|012346|-|--*--|-----| |0110_011_100_000_000-{offset} 9562: //BNNE.W <label> |A|012346|-|--*--|-----| |0110_011_100_000_000-{offset} [BEQ.W <label>] 9563: //BNNZ.W <label> |A|012346|-|--*--|-----| |0110_011_100_000_000-{offset} [BEQ.W <label>] 9564: //BZE.W <label> |A|012346|-|--*--|-----| |0110_011_100_000_000-{offset} [BEQ.W <label>] 9565: //JBEQ.W <label> |A|012346|-|--*--|-----| |0110_011_100_000_000-{offset} [BEQ.W <label>] 9566: //JBNNE.W <label> |A|012346|-|--*--|-----| |0110_011_100_000_000-{offset} [BEQ.W <label>] 9567: //JBNNZ.W <label> |A|012346|-|--*--|-----| |0110_011_100_000_000-{offset} [BEQ.W <label>] 9568: //JBZE.W <label> |A|012346|-|--*--|-----| |0110_011_100_000_000-{offset} [BEQ.W <label>] 9569: //BEQ.S <label> |-|012346|-|--*--|-----| |0110_011_100_sss_sss (s is not equal to 0) 9570: //BNNE.S <label> |A|012346|-|--*--|-----| |0110_011_100_sss_sss (s is not equal to 0) [BEQ.S <label>] 9571: //BNNZ.S <label> |A|012346|-|--*--|-----| |0110_011_100_sss_sss (s is not equal to 0) [BEQ.S <label>] 9572: //BZE.S <label> |A|012346|-|--*--|-----| |0110_011_100_sss_sss (s is not equal to 0) [BEQ.S <label>] 9573: //JBEQ.S <label> |A|012346|-|--*--|-----| |0110_011_100_sss_sss (s is not equal to 0) [BEQ.S <label>] 9574: //JBNNE.S <label> |A|012346|-|--*--|-----| |0110_011_100_sss_sss (s is not equal to 0) [BEQ.S <label>] 9575: //JBNNZ.S <label> |A|012346|-|--*--|-----| |0110_011_100_sss_sss (s is not equal to 0) [BEQ.S <label>] 9576: //JBZE.S <label> |A|012346|-|--*--|-----| |0110_011_100_sss_sss (s is not equal to 0) [BEQ.S <label>] 9577: //JBNE.L <label> |A|012346|-|--*--|-----| |0110_011_100_000_110-0100111011111001-{address} [BEQ.S (*)+8;JMP <label>] 9578: public static void irpBeqsw () throws M68kException { 9579: if (XEiJ.MPU_CC_EQ << XEiJ.regCCR < 0) { //Bccでジャンプ 9580: XEiJ.mpuCycleCount += 10; 9581: int t = XEiJ.regPC; //pc0+2 9582: int s = (byte) XEiJ.regOC; //オフセット 9583: if (s == 0) { //Bcc.Wでジャンプ 9584: XEiJ.regPC = t + 2; 9585: s = XEiJ.busRwse (t); //pcws 9586: } else { //Bcc.Sでジャンプ 9587: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 9588: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 9589: if (XEiJ.MPU_OMIT_EXTRA_READ) { 9590: //! 軽量化。リードを省略する 9591: } else { 9592: XEiJ.busRwse (t); //pcws 9593: } 9594: } 9595: irpSetPC (t + s); //pc0+2+オフセット 9596: } else if (XEiJ.regOC == 0x6700) { //Bcc.Wで通過 9597: XEiJ.mpuCycleCount += 12; 9598: if (XEiJ.MPU_OMIT_OFFSET_READ) { 9599: //リードを省略する 9600: } else { 9601: XEiJ.busRws (XEiJ.regPC); 9602: } 9603: XEiJ.regPC += 2; 9604: } else { //Bcc.Sで通過 9605: XEiJ.mpuCycleCount += 8; 9606: } 9607: } //irpBeqsw 9608: 9609: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9610: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9611: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9612: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9613: //BEQ.S <label> |-|012346|-|--*--|-----| |0110_011_101_sss_sss 9614: //BNNE.S <label> |A|012346|-|--*--|-----| |0110_011_101_sss_sss [BEQ.S <label>] 9615: //BNNZ.S <label> |A|012346|-|--*--|-----| |0110_011_101_sss_sss [BEQ.S <label>] 9616: //BZE.S <label> |A|012346|-|--*--|-----| |0110_011_101_sss_sss [BEQ.S <label>] 9617: //JBEQ.S <label> |A|012346|-|--*--|-----| |0110_011_101_sss_sss [BEQ.S <label>] 9618: //JBNNE.S <label> |A|012346|-|--*--|-----| |0110_011_101_sss_sss [BEQ.S <label>] 9619: //JBNNZ.S <label> |A|012346|-|--*--|-----| |0110_011_101_sss_sss [BEQ.S <label>] 9620: //JBZE.S <label> |A|012346|-|--*--|-----| |0110_011_101_sss_sss [BEQ.S <label>] 9621: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9622: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9623: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9624: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9625: //BEQ.S <label> |-|012346|-|--*--|-----| |0110_011_110_sss_sss 9626: //BNNE.S <label> |A|012346|-|--*--|-----| |0110_011_110_sss_sss [BEQ.S <label>] 9627: //BNNZ.S <label> |A|012346|-|--*--|-----| |0110_011_110_sss_sss [BEQ.S <label>] 9628: //BZE.S <label> |A|012346|-|--*--|-----| |0110_011_110_sss_sss [BEQ.S <label>] 9629: //JBEQ.S <label> |A|012346|-|--*--|-----| |0110_011_110_sss_sss [BEQ.S <label>] 9630: //JBNNE.S <label> |A|012346|-|--*--|-----| |0110_011_110_sss_sss [BEQ.S <label>] 9631: //JBNNZ.S <label> |A|012346|-|--*--|-----| |0110_011_110_sss_sss [BEQ.S <label>] 9632: //JBZE.S <label> |A|012346|-|--*--|-----| |0110_011_110_sss_sss [BEQ.S <label>] 9633: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9634: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9635: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9636: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9637: //BEQ.S <label> |-|01----|-|--*--|-----| |0110_011_111_sss_sss 9638: //BNNE.S <label> |A|01----|-|--*--|-----| |0110_011_111_sss_sss [BEQ.S <label>] 9639: //BNNZ.S <label> |A|01----|-|--*--|-----| |0110_011_111_sss_sss [BEQ.S <label>] 9640: //BZE.S <label> |A|01----|-|--*--|-----| |0110_011_111_sss_sss [BEQ.S <label>] 9641: //JBEQ.S <label> |A|01----|-|--*--|-----| |0110_011_111_sss_sss [BEQ.S <label>] 9642: //JBNNE.S <label> |A|01----|-|--*--|-----| |0110_011_111_sss_sss [BEQ.S <label>] 9643: //JBNNZ.S <label> |A|01----|-|--*--|-----| |0110_011_111_sss_sss [BEQ.S <label>] 9644: //JBZE.S <label> |A|01----|-|--*--|-----| |0110_011_111_sss_sss [BEQ.S <label>] 9645: public static void irpBeqs () throws M68kException { 9646: if (XEiJ.MPU_CC_EQ << XEiJ.regCCR < 0) { //Bccでジャンプ 9647: XEiJ.mpuCycleCount += 10; 9648: int t = XEiJ.regPC; //pc0+2 9649: int s = (byte) XEiJ.regOC; //オフセット 9650: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 9651: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 9652: if (XEiJ.MPU_OMIT_EXTRA_READ) { 9653: //! 軽量化。リードを省略する 9654: } else { 9655: XEiJ.busRwse (t); //pcws 9656: } 9657: irpSetPC (t + s); //pc0+2+オフセット 9658: } else { //Bcc.Sで通過 9659: XEiJ.mpuCycleCount += 8; 9660: } 9661: } //irpBeqs 9662: 9663: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9664: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9665: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9666: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9667: //BVC.W <label> |-|012346|-|---*-|-----| |0110_100_000_000_000-{offset} 9668: //BNVS.W <label> |A|012346|-|---*-|-----| |0110_100_000_000_000-{offset} [BVC.W <label>] 9669: //JBNVS.W <label> |A|012346|-|---*-|-----| |0110_100_000_000_000-{offset} [BVC.W <label>] 9670: //JBVC.W <label> |A|012346|-|---*-|-----| |0110_100_000_000_000-{offset} [BVC.W <label>] 9671: //BVC.S <label> |-|012346|-|---*-|-----| |0110_100_000_sss_sss (s is not equal to 0) 9672: //BNVS.S <label> |A|012346|-|---*-|-----| |0110_100_000_sss_sss (s is not equal to 0) [BVC.S <label>] 9673: //JBNVS.S <label> |A|012346|-|---*-|-----| |0110_100_000_sss_sss (s is not equal to 0) [BVC.S <label>] 9674: //JBVC.S <label> |A|012346|-|---*-|-----| |0110_100_000_sss_sss (s is not equal to 0) [BVC.S <label>] 9675: //JBNVC.L <label> |A|012346|-|---*-|-----| |0110_100_000_000_110-0100111011111001-{address} [BVC.S (*)+8;JMP <label>] 9676: //JBVS.L <label> |A|012346|-|---*-|-----| |0110_100_000_000_110-0100111011111001-{address} [BVC.S (*)+8;JMP <label>] 9677: public static void irpBvcsw () throws M68kException { 9678: if (XEiJ.MPU_CC_VC << XEiJ.regCCR < 0) { //Bccでジャンプ 9679: XEiJ.mpuCycleCount += 10; 9680: int t = XEiJ.regPC; //pc0+2 9681: int s = (byte) XEiJ.regOC; //オフセット 9682: if (s == 0) { //Bcc.Wでジャンプ 9683: XEiJ.regPC = t + 2; 9684: s = XEiJ.busRwse (t); //pcws 9685: } else { //Bcc.Sでジャンプ 9686: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 9687: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 9688: if (XEiJ.MPU_OMIT_EXTRA_READ) { 9689: //! 軽量化。リードを省略する 9690: } else { 9691: XEiJ.busRwse (t); //pcws 9692: } 9693: } 9694: irpSetPC (t + s); //pc0+2+オフセット 9695: } else if (XEiJ.regOC == 0x6800) { //Bcc.Wで通過 9696: XEiJ.mpuCycleCount += 12; 9697: if (XEiJ.MPU_OMIT_OFFSET_READ) { 9698: //リードを省略する 9699: } else { 9700: XEiJ.busRws (XEiJ.regPC); 9701: } 9702: XEiJ.regPC += 2; 9703: } else { //Bcc.Sで通過 9704: XEiJ.mpuCycleCount += 8; 9705: } 9706: } //irpBvcsw 9707: 9708: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9709: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9710: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9711: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9712: //BVC.S <label> |-|012346|-|---*-|-----| |0110_100_001_sss_sss 9713: //BNVS.S <label> |A|012346|-|---*-|-----| |0110_100_001_sss_sss [BVC.S <label>] 9714: //JBNVS.S <label> |A|012346|-|---*-|-----| |0110_100_001_sss_sss [BVC.S <label>] 9715: //JBVC.S <label> |A|012346|-|---*-|-----| |0110_100_001_sss_sss [BVC.S <label>] 9716: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9717: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9718: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9719: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9720: //BVC.S <label> |-|012346|-|---*-|-----| |0110_100_010_sss_sss 9721: //BNVS.S <label> |A|012346|-|---*-|-----| |0110_100_010_sss_sss [BVC.S <label>] 9722: //JBNVS.S <label> |A|012346|-|---*-|-----| |0110_100_010_sss_sss [BVC.S <label>] 9723: //JBVC.S <label> |A|012346|-|---*-|-----| |0110_100_010_sss_sss [BVC.S <label>] 9724: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9725: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9726: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9727: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9728: //BVC.S <label> |-|01----|-|---*-|-----| |0110_100_011_sss_sss 9729: //BNVS.S <label> |A|01----|-|---*-|-----| |0110_100_011_sss_sss [BVC.S <label>] 9730: //JBNVS.S <label> |A|01----|-|---*-|-----| |0110_100_011_sss_sss [BVC.S <label>] 9731: //JBVC.S <label> |A|01----|-|---*-|-----| |0110_100_011_sss_sss [BVC.S <label>] 9732: public static void irpBvcs () throws M68kException { 9733: if (XEiJ.MPU_CC_VC << XEiJ.regCCR < 0) { //Bccでジャンプ 9734: XEiJ.mpuCycleCount += 10; 9735: int t = XEiJ.regPC; //pc0+2 9736: int s = (byte) XEiJ.regOC; //オフセット 9737: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 9738: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 9739: if (XEiJ.MPU_OMIT_EXTRA_READ) { 9740: //! 軽量化。リードを省略する 9741: } else { 9742: XEiJ.busRwse (t); //pcws 9743: } 9744: irpSetPC (t + s); //pc0+2+オフセット 9745: } else { //Bcc.Sで通過 9746: XEiJ.mpuCycleCount += 8; 9747: } 9748: } //irpBvcs 9749: 9750: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9751: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9752: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9753: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9754: //BVS.W <label> |-|012346|-|---*-|-----| |0110_100_100_000_000-{offset} 9755: //BNVC.W <label> |A|012346|-|---*-|-----| |0110_100_100_000_000-{offset} [BVS.W <label>] 9756: //JBNVC.W <label> |A|012346|-|---*-|-----| |0110_100_100_000_000-{offset} [BVS.W <label>] 9757: //JBVS.W <label> |A|012346|-|---*-|-----| |0110_100_100_000_000-{offset} [BVS.W <label>] 9758: //BVS.S <label> |-|012346|-|---*-|-----| |0110_100_100_sss_sss (s is not equal to 0) 9759: //BNVC.S <label> |A|012346|-|---*-|-----| |0110_100_100_sss_sss (s is not equal to 0) [BVS.S <label>] 9760: //JBNVC.S <label> |A|012346|-|---*-|-----| |0110_100_100_sss_sss (s is not equal to 0) [BVS.S <label>] 9761: //JBVS.S <label> |A|012346|-|---*-|-----| |0110_100_100_sss_sss (s is not equal to 0) [BVS.S <label>] 9762: //JBNVS.L <label> |A|012346|-|---*-|-----| |0110_100_100_000_110-0100111011111001-{address} [BVS.S (*)+8;JMP <label>] 9763: //JBVC.L <label> |A|012346|-|---*-|-----| |0110_100_100_000_110-0100111011111001-{address} [BVS.S (*)+8;JMP <label>] 9764: public static void irpBvssw () throws M68kException { 9765: if (XEiJ.MPU_CC_VS << XEiJ.regCCR < 0) { //Bccでジャンプ 9766: XEiJ.mpuCycleCount += 10; 9767: int t = XEiJ.regPC; //pc0+2 9768: int s = (byte) XEiJ.regOC; //オフセット 9769: if (s == 0) { //Bcc.Wでジャンプ 9770: XEiJ.regPC = t + 2; 9771: s = XEiJ.busRwse (t); //pcws 9772: } else { //Bcc.Sでジャンプ 9773: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 9774: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 9775: if (XEiJ.MPU_OMIT_EXTRA_READ) { 9776: //! 軽量化。リードを省略する 9777: } else { 9778: XEiJ.busRwse (t); //pcws 9779: } 9780: } 9781: irpSetPC (t + s); //pc0+2+オフセット 9782: } else if (XEiJ.regOC == 0x6900) { //Bcc.Wで通過 9783: XEiJ.mpuCycleCount += 12; 9784: if (XEiJ.MPU_OMIT_OFFSET_READ) { 9785: //リードを省略する 9786: } else { 9787: XEiJ.busRws (XEiJ.regPC); 9788: } 9789: XEiJ.regPC += 2; 9790: } else { //Bcc.Sで通過 9791: XEiJ.mpuCycleCount += 8; 9792: } 9793: } //irpBvssw 9794: 9795: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9796: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9797: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9798: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9799: //BVS.S <label> |-|012346|-|---*-|-----| |0110_100_101_sss_sss 9800: //BNVC.S <label> |A|012346|-|---*-|-----| |0110_100_101_sss_sss [BVS.S <label>] 9801: //JBNVC.S <label> |A|012346|-|---*-|-----| |0110_100_101_sss_sss [BVS.S <label>] 9802: //JBVS.S <label> |A|012346|-|---*-|-----| |0110_100_101_sss_sss [BVS.S <label>] 9803: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9804: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9805: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9806: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9807: //BVS.S <label> |-|012346|-|---*-|-----| |0110_100_110_sss_sss 9808: //BNVC.S <label> |A|012346|-|---*-|-----| |0110_100_110_sss_sss [BVS.S <label>] 9809: //JBNVC.S <label> |A|012346|-|---*-|-----| |0110_100_110_sss_sss [BVS.S <label>] 9810: //JBVS.S <label> |A|012346|-|---*-|-----| |0110_100_110_sss_sss [BVS.S <label>] 9811: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9812: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9813: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9814: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9815: //BVS.S <label> |-|01----|-|---*-|-----| |0110_100_111_sss_sss 9816: //BNVC.S <label> |A|01----|-|---*-|-----| |0110_100_111_sss_sss [BVS.S <label>] 9817: //JBNVC.S <label> |A|01----|-|---*-|-----| |0110_100_111_sss_sss [BVS.S <label>] 9818: //JBVS.S <label> |A|01----|-|---*-|-----| |0110_100_111_sss_sss [BVS.S <label>] 9819: public static void irpBvss () throws M68kException { 9820: if (XEiJ.MPU_CC_VS << XEiJ.regCCR < 0) { //Bccでジャンプ 9821: XEiJ.mpuCycleCount += 10; 9822: int t = XEiJ.regPC; //pc0+2 9823: int s = (byte) XEiJ.regOC; //オフセット 9824: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 9825: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 9826: if (XEiJ.MPU_OMIT_EXTRA_READ) { 9827: //! 軽量化。リードを省略する 9828: } else { 9829: XEiJ.busRwse (t); //pcws 9830: } 9831: irpSetPC (t + s); //pc0+2+オフセット 9832: } else { //Bcc.Sで通過 9833: XEiJ.mpuCycleCount += 8; 9834: } 9835: } //irpBvss 9836: 9837: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9838: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9839: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9840: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9841: //BPL.W <label> |-|012346|-|-*---|-----| |0110_101_000_000_000-{offset} 9842: //BNMI.W <label> |A|012346|-|-*---|-----| |0110_101_000_000_000-{offset} [BPL.W <label>] 9843: //JBNMI.W <label> |A|012346|-|-*---|-----| |0110_101_000_000_000-{offset} [BPL.W <label>] 9844: //JBPL.W <label> |A|012346|-|-*---|-----| |0110_101_000_000_000-{offset} [BPL.W <label>] 9845: //BPL.S <label> |-|012346|-|-*---|-----| |0110_101_000_sss_sss (s is not equal to 0) 9846: //BNMI.S <label> |A|012346|-|-*---|-----| |0110_101_000_sss_sss (s is not equal to 0) [BPL.S <label>] 9847: //JBNMI.S <label> |A|012346|-|-*---|-----| |0110_101_000_sss_sss (s is not equal to 0) [BPL.S <label>] 9848: //JBPL.S <label> |A|012346|-|-*---|-----| |0110_101_000_sss_sss (s is not equal to 0) [BPL.S <label>] 9849: //JBMI.L <label> |A|012346|-|-*---|-----| |0110_101_000_000_110-0100111011111001-{address} [BPL.S (*)+8;JMP <label>] 9850: //JBNPL.L <label> |A|012346|-|-*---|-----| |0110_101_000_000_110-0100111011111001-{address} [BPL.S (*)+8;JMP <label>] 9851: public static void irpBplsw () throws M68kException { 9852: if (XEiJ.MPU_CC_PL << XEiJ.regCCR < 0) { //Bccでジャンプ 9853: XEiJ.mpuCycleCount += 10; 9854: int t = XEiJ.regPC; //pc0+2 9855: int s = (byte) XEiJ.regOC; //オフセット 9856: if (s == 0) { //Bcc.Wでジャンプ 9857: XEiJ.regPC = t + 2; 9858: s = XEiJ.busRwse (t); //pcws 9859: } else { //Bcc.Sでジャンプ 9860: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 9861: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 9862: if (XEiJ.MPU_OMIT_EXTRA_READ) { 9863: //! 軽量化。リードを省略する 9864: } else { 9865: XEiJ.busRwse (t); //pcws 9866: } 9867: } 9868: irpSetPC (t + s); //pc0+2+オフセット 9869: } else if (XEiJ.regOC == 0x6a00) { //Bcc.Wで通過 9870: XEiJ.mpuCycleCount += 12; 9871: if (XEiJ.MPU_OMIT_OFFSET_READ) { 9872: //リードを省略する 9873: } else { 9874: XEiJ.busRws (XEiJ.regPC); 9875: } 9876: XEiJ.regPC += 2; 9877: } else { //Bcc.Sで通過 9878: XEiJ.mpuCycleCount += 8; 9879: } 9880: } //irpBplsw 9881: 9882: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9883: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9884: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9885: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9886: //BPL.S <label> |-|012346|-|-*---|-----| |0110_101_001_sss_sss 9887: //BNMI.S <label> |A|012346|-|-*---|-----| |0110_101_001_sss_sss [BPL.S <label>] 9888: //JBNMI.S <label> |A|012346|-|-*---|-----| |0110_101_001_sss_sss [BPL.S <label>] 9889: //JBPL.S <label> |A|012346|-|-*---|-----| |0110_101_001_sss_sss [BPL.S <label>] 9890: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9891: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9892: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9893: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9894: //BPL.S <label> |-|012346|-|-*---|-----| |0110_101_010_sss_sss 9895: //BNMI.S <label> |A|012346|-|-*---|-----| |0110_101_010_sss_sss [BPL.S <label>] 9896: //JBNMI.S <label> |A|012346|-|-*---|-----| |0110_101_010_sss_sss [BPL.S <label>] 9897: //JBPL.S <label> |A|012346|-|-*---|-----| |0110_101_010_sss_sss [BPL.S <label>] 9898: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9899: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9900: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9901: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9902: //BPL.S <label> |-|01----|-|-*---|-----| |0110_101_011_sss_sss 9903: //BNMI.S <label> |A|01----|-|-*---|-----| |0110_101_011_sss_sss [BPL.S <label>] 9904: //JBNMI.S <label> |A|01----|-|-*---|-----| |0110_101_011_sss_sss [BPL.S <label>] 9905: //JBPL.S <label> |A|01----|-|-*---|-----| |0110_101_011_sss_sss [BPL.S <label>] 9906: public static void irpBpls () throws M68kException { 9907: if (XEiJ.MPU_CC_PL << XEiJ.regCCR < 0) { //Bccでジャンプ 9908: XEiJ.mpuCycleCount += 10; 9909: int t = XEiJ.regPC; //pc0+2 9910: int s = (byte) XEiJ.regOC; //オフセット 9911: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 9912: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 9913: if (XEiJ.MPU_OMIT_EXTRA_READ) { 9914: //! 軽量化。リードを省略する 9915: } else { 9916: XEiJ.busRwse (t); //pcws 9917: } 9918: irpSetPC (t + s); //pc0+2+オフセット 9919: } else { //Bcc.Sで通過 9920: XEiJ.mpuCycleCount += 8; 9921: } 9922: } //irpBpls 9923: 9924: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9925: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9926: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9927: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9928: //BMI.W <label> |-|012346|-|-*---|-----| |0110_101_100_000_000-{offset} 9929: //BNPL.W <label> |A|012346|-|-*---|-----| |0110_101_100_000_000-{offset} [BMI.W <label>] 9930: //JBMI.W <label> |A|012346|-|-*---|-----| |0110_101_100_000_000-{offset} [BMI.W <label>] 9931: //JBNPL.W <label> |A|012346|-|-*---|-----| |0110_101_100_000_000-{offset} [BMI.W <label>] 9932: //BMI.S <label> |-|012346|-|-*---|-----| |0110_101_100_sss_sss (s is not equal to 0) 9933: //BNPL.S <label> |A|012346|-|-*---|-----| |0110_101_100_sss_sss (s is not equal to 0) [BMI.S <label>] 9934: //JBMI.S <label> |A|012346|-|-*---|-----| |0110_101_100_sss_sss (s is not equal to 0) [BMI.S <label>] 9935: //JBNPL.S <label> |A|012346|-|-*---|-----| |0110_101_100_sss_sss (s is not equal to 0) [BMI.S <label>] 9936: //JBNMI.L <label> |A|012346|-|-*---|-----| |0110_101_100_000_110-0100111011111001-{address} [BMI.S (*)+8;JMP <label>] 9937: //JBPL.L <label> |A|012346|-|-*---|-----| |0110_101_100_000_110-0100111011111001-{address} [BMI.S (*)+8;JMP <label>] 9938: public static void irpBmisw () throws M68kException { 9939: if (XEiJ.MPU_CC_MI << XEiJ.regCCR < 0) { //Bccでジャンプ 9940: XEiJ.mpuCycleCount += 10; 9941: int t = XEiJ.regPC; //pc0+2 9942: int s = (byte) XEiJ.regOC; //オフセット 9943: if (s == 0) { //Bcc.Wでジャンプ 9944: XEiJ.regPC = t + 2; 9945: s = XEiJ.busRwse (t); //pcws 9946: } else { //Bcc.Sでジャンプ 9947: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 9948: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 9949: if (XEiJ.MPU_OMIT_EXTRA_READ) { 9950: //! 軽量化。リードを省略する 9951: } else { 9952: XEiJ.busRwse (t); //pcws 9953: } 9954: } 9955: irpSetPC (t + s); //pc0+2+オフセット 9956: } else if (XEiJ.regOC == 0x6b00) { //Bcc.Wで通過 9957: XEiJ.mpuCycleCount += 12; 9958: if (XEiJ.MPU_OMIT_OFFSET_READ) { 9959: //リードを省略する 9960: } else { 9961: XEiJ.busRws (XEiJ.regPC); 9962: } 9963: XEiJ.regPC += 2; 9964: } else { //Bcc.Sで通過 9965: XEiJ.mpuCycleCount += 8; 9966: } 9967: } //irpBmisw 9968: 9969: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9970: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9971: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9972: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9973: //BMI.S <label> |-|012346|-|-*---|-----| |0110_101_101_sss_sss 9974: //BNPL.S <label> |A|012346|-|-*---|-----| |0110_101_101_sss_sss [BMI.S <label>] 9975: //JBMI.S <label> |A|012346|-|-*---|-----| |0110_101_101_sss_sss [BMI.S <label>] 9976: //JBNPL.S <label> |A|012346|-|-*---|-----| |0110_101_101_sss_sss [BMI.S <label>] 9977: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9978: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9979: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9980: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9981: //BMI.S <label> |-|012346|-|-*---|-----| |0110_101_110_sss_sss 9982: //BNPL.S <label> |A|012346|-|-*---|-----| |0110_101_110_sss_sss [BMI.S <label>] 9983: //JBMI.S <label> |A|012346|-|-*---|-----| |0110_101_110_sss_sss [BMI.S <label>] 9984: //JBNPL.S <label> |A|012346|-|-*---|-----| |0110_101_110_sss_sss [BMI.S <label>] 9985: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9986: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 9987: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 9988: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 9989: //BMI.S <label> |-|01----|-|-*---|-----| |0110_101_111_sss_sss 9990: //BNPL.S <label> |A|01----|-|-*---|-----| |0110_101_111_sss_sss [BMI.S <label>] 9991: //JBMI.S <label> |A|01----|-|-*---|-----| |0110_101_111_sss_sss [BMI.S <label>] 9992: //JBNPL.S <label> |A|01----|-|-*---|-----| |0110_101_111_sss_sss [BMI.S <label>] 9993: public static void irpBmis () throws M68kException { 9994: if (XEiJ.MPU_CC_MI << XEiJ.regCCR < 0) { //Bccでジャンプ 9995: XEiJ.mpuCycleCount += 10; 9996: int t = XEiJ.regPC; //pc0+2 9997: int s = (byte) XEiJ.regOC; //オフセット 9998: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 9999: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 10000: if (XEiJ.MPU_OMIT_EXTRA_READ) { 10001: //! 軽量化。リードを省略する 10002: } else { 10003: XEiJ.busRwse (t); //pcws 10004: } 10005: irpSetPC (t + s); //pc0+2+オフセット 10006: } else { //Bcc.Sで通過 10007: XEiJ.mpuCycleCount += 8; 10008: } 10009: } //irpBmis 10010: 10011: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10012: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10013: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10014: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10015: //BGE.W <label> |-|012346|-|-*-*-|-----| |0110_110_000_000_000-{offset} 10016: //BNLT.W <label> |A|012346|-|-*-*-|-----| |0110_110_000_000_000-{offset} [BGE.W <label>] 10017: //JBGE.W <label> |A|012346|-|-*-*-|-----| |0110_110_000_000_000-{offset} [BGE.W <label>] 10018: //JBNLT.W <label> |A|012346|-|-*-*-|-----| |0110_110_000_000_000-{offset} [BGE.W <label>] 10019: //BGE.S <label> |-|012346|-|-*-*-|-----| |0110_110_000_sss_sss (s is not equal to 0) 10020: //BNLT.S <label> |A|012346|-|-*-*-|-----| |0110_110_000_sss_sss (s is not equal to 0) [BGE.S <label>] 10021: //JBGE.S <label> |A|012346|-|-*-*-|-----| |0110_110_000_sss_sss (s is not equal to 0) [BGE.S <label>] 10022: //JBNLT.S <label> |A|012346|-|-*-*-|-----| |0110_110_000_sss_sss (s is not equal to 0) [BGE.S <label>] 10023: //JBLT.L <label> |A|012346|-|-*-*-|-----| |0110_110_000_000_110-0100111011111001-{address} [BGE.S (*)+8;JMP <label>] 10024: //JBNGE.L <label> |A|012346|-|-*-*-|-----| |0110_110_000_000_110-0100111011111001-{address} [BGE.S (*)+8;JMP <label>] 10025: public static void irpBgesw () throws M68kException { 10026: if (XEiJ.MPU_CC_GE << XEiJ.regCCR < 0) { //Bccでジャンプ 10027: XEiJ.mpuCycleCount += 10; 10028: int t = XEiJ.regPC; //pc0+2 10029: int s = (byte) XEiJ.regOC; //オフセット 10030: if (s == 0) { //Bcc.Wでジャンプ 10031: XEiJ.regPC = t + 2; 10032: s = XEiJ.busRwse (t); //pcws 10033: } else { //Bcc.Sでジャンプ 10034: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 10035: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 10036: if (XEiJ.MPU_OMIT_EXTRA_READ) { 10037: //! 軽量化。リードを省略する 10038: } else { 10039: XEiJ.busRwse (t); //pcws 10040: } 10041: } 10042: irpSetPC (t + s); //pc0+2+オフセット 10043: } else if (XEiJ.regOC == 0x6c00) { //Bcc.Wで通過 10044: XEiJ.mpuCycleCount += 12; 10045: if (XEiJ.MPU_OMIT_OFFSET_READ) { 10046: //リードを省略する 10047: } else { 10048: XEiJ.busRws (XEiJ.regPC); 10049: } 10050: XEiJ.regPC += 2; 10051: } else { //Bcc.Sで通過 10052: XEiJ.mpuCycleCount += 8; 10053: } 10054: } //irpBgesw 10055: 10056: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10057: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10058: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10059: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10060: //BGE.S <label> |-|012346|-|-*-*-|-----| |0110_110_001_sss_sss 10061: //BNLT.S <label> |A|012346|-|-*-*-|-----| |0110_110_001_sss_sss [BGE.S <label>] 10062: //JBGE.S <label> |A|012346|-|-*-*-|-----| |0110_110_001_sss_sss [BGE.S <label>] 10063: //JBNLT.S <label> |A|012346|-|-*-*-|-----| |0110_110_001_sss_sss [BGE.S <label>] 10064: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10065: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10066: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10067: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10068: //BGE.S <label> |-|012346|-|-*-*-|-----| |0110_110_010_sss_sss 10069: //BNLT.S <label> |A|012346|-|-*-*-|-----| |0110_110_010_sss_sss [BGE.S <label>] 10070: //JBGE.S <label> |A|012346|-|-*-*-|-----| |0110_110_010_sss_sss [BGE.S <label>] 10071: //JBNLT.S <label> |A|012346|-|-*-*-|-----| |0110_110_010_sss_sss [BGE.S <label>] 10072: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10073: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10074: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10075: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10076: //BGE.S <label> |-|01----|-|-*-*-|-----| |0110_110_011_sss_sss 10077: //BNLT.S <label> |A|01----|-|-*-*-|-----| |0110_110_011_sss_sss [BGE.S <label>] 10078: //JBGE.S <label> |A|01----|-|-*-*-|-----| |0110_110_011_sss_sss [BGE.S <label>] 10079: //JBNLT.S <label> |A|01----|-|-*-*-|-----| |0110_110_011_sss_sss [BGE.S <label>] 10080: public static void irpBges () throws M68kException { 10081: if (XEiJ.MPU_CC_GE << XEiJ.regCCR < 0) { //Bccでジャンプ 10082: XEiJ.mpuCycleCount += 10; 10083: int t = XEiJ.regPC; //pc0+2 10084: int s = (byte) XEiJ.regOC; //オフセット 10085: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 10086: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 10087: if (XEiJ.MPU_OMIT_EXTRA_READ) { 10088: //! 軽量化。リードを省略する 10089: } else { 10090: XEiJ.busRwse (t); //pcws 10091: } 10092: irpSetPC (t + s); //pc0+2+オフセット 10093: } else { //Bcc.Sで通過 10094: XEiJ.mpuCycleCount += 8; 10095: } 10096: } //irpBges 10097: 10098: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10099: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10100: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10101: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10102: //BLT.W <label> |-|012346|-|-*-*-|-----| |0110_110_100_000_000-{offset} 10103: //BNGE.W <label> |A|012346|-|-*-*-|-----| |0110_110_100_000_000-{offset} [BLT.W <label>] 10104: //JBLT.W <label> |A|012346|-|-*-*-|-----| |0110_110_100_000_000-{offset} [BLT.W <label>] 10105: //JBNGE.W <label> |A|012346|-|-*-*-|-----| |0110_110_100_000_000-{offset} [BLT.W <label>] 10106: //BLT.S <label> |-|012346|-|-*-*-|-----| |0110_110_100_sss_sss (s is not equal to 0) 10107: //BNGE.S <label> |A|012346|-|-*-*-|-----| |0110_110_100_sss_sss (s is not equal to 0) [BLT.S <label>] 10108: //JBLT.S <label> |A|012346|-|-*-*-|-----| |0110_110_100_sss_sss (s is not equal to 0) [BLT.S <label>] 10109: //JBNGE.S <label> |A|012346|-|-*-*-|-----| |0110_110_100_sss_sss (s is not equal to 0) [BLT.S <label>] 10110: //JBGE.L <label> |A|012346|-|-*-*-|-----| |0110_110_100_000_110-0100111011111001-{address} [BLT.S (*)+8;JMP <label>] 10111: //JBNLT.L <label> |A|012346|-|-*-*-|-----| |0110_110_100_000_110-0100111011111001-{address} [BLT.S (*)+8;JMP <label>] 10112: public static void irpBltsw () throws M68kException { 10113: if (XEiJ.MPU_CC_LT << XEiJ.regCCR < 0) { //Bccでジャンプ 10114: XEiJ.mpuCycleCount += 10; 10115: int t = XEiJ.regPC; //pc0+2 10116: int s = (byte) XEiJ.regOC; //オフセット 10117: if (s == 0) { //Bcc.Wでジャンプ 10118: XEiJ.regPC = t + 2; 10119: s = XEiJ.busRwse (t); //pcws 10120: } else { //Bcc.Sでジャンプ 10121: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 10122: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 10123: if (XEiJ.MPU_OMIT_EXTRA_READ) { 10124: //! 軽量化。リードを省略する 10125: } else { 10126: XEiJ.busRwse (t); //pcws 10127: } 10128: } 10129: irpSetPC (t + s); //pc0+2+オフセット 10130: } else if (XEiJ.regOC == 0x6d00) { //Bcc.Wで通過 10131: XEiJ.mpuCycleCount += 12; 10132: if (XEiJ.MPU_OMIT_OFFSET_READ) { 10133: //リードを省略する 10134: } else { 10135: XEiJ.busRws (XEiJ.regPC); 10136: } 10137: XEiJ.regPC += 2; 10138: } else { //Bcc.Sで通過 10139: XEiJ.mpuCycleCount += 8; 10140: } 10141: } //irpBltsw 10142: 10143: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10144: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10145: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10146: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10147: //BLT.S <label> |-|012346|-|-*-*-|-----| |0110_110_101_sss_sss 10148: //BNGE.S <label> |A|012346|-|-*-*-|-----| |0110_110_101_sss_sss [BLT.S <label>] 10149: //JBLT.S <label> |A|012346|-|-*-*-|-----| |0110_110_101_sss_sss [BLT.S <label>] 10150: //JBNGE.S <label> |A|012346|-|-*-*-|-----| |0110_110_101_sss_sss [BLT.S <label>] 10151: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10152: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10153: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10154: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10155: //BLT.S <label> |-|012346|-|-*-*-|-----| |0110_110_110_sss_sss 10156: //BNGE.S <label> |A|012346|-|-*-*-|-----| |0110_110_110_sss_sss [BLT.S <label>] 10157: //JBLT.S <label> |A|012346|-|-*-*-|-----| |0110_110_110_sss_sss [BLT.S <label>] 10158: //JBNGE.S <label> |A|012346|-|-*-*-|-----| |0110_110_110_sss_sss [BLT.S <label>] 10159: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10160: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10161: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10162: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10163: //BLT.S <label> |-|01----|-|-*-*-|-----| |0110_110_111_sss_sss 10164: //BNGE.S <label> |A|01----|-|-*-*-|-----| |0110_110_111_sss_sss [BLT.S <label>] 10165: //JBLT.S <label> |A|01----|-|-*-*-|-----| |0110_110_111_sss_sss [BLT.S <label>] 10166: //JBNGE.S <label> |A|01----|-|-*-*-|-----| |0110_110_111_sss_sss [BLT.S <label>] 10167: public static void irpBlts () throws M68kException { 10168: if (XEiJ.MPU_CC_LT << XEiJ.regCCR < 0) { //Bccでジャンプ 10169: XEiJ.mpuCycleCount += 10; 10170: int t = XEiJ.regPC; //pc0+2 10171: int s = (byte) XEiJ.regOC; //オフセット 10172: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 10173: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 10174: if (XEiJ.MPU_OMIT_EXTRA_READ) { 10175: //! 軽量化。リードを省略する 10176: } else { 10177: XEiJ.busRwse (t); //pcws 10178: } 10179: irpSetPC (t + s); //pc0+2+オフセット 10180: } else { //Bcc.Sで通過 10181: XEiJ.mpuCycleCount += 8; 10182: } 10183: } //irpBlts 10184: 10185: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10186: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10187: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10188: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10189: //BGT.W <label> |-|012346|-|-***-|-----| |0110_111_000_000_000-{offset} 10190: //BNLE.W <label> |A|012346|-|-***-|-----| |0110_111_000_000_000-{offset} [BGT.W <label>] 10191: //JBGT.W <label> |A|012346|-|-***-|-----| |0110_111_000_000_000-{offset} [BGT.W <label>] 10192: //JBNLE.W <label> |A|012346|-|-***-|-----| |0110_111_000_000_000-{offset} [BGT.W <label>] 10193: //BGT.S <label> |-|012346|-|-***-|-----| |0110_111_000_sss_sss (s is not equal to 0) 10194: //BNLE.S <label> |A|012346|-|-***-|-----| |0110_111_000_sss_sss (s is not equal to 0) [BGT.S <label>] 10195: //JBGT.S <label> |A|012346|-|-***-|-----| |0110_111_000_sss_sss (s is not equal to 0) [BGT.S <label>] 10196: //JBNLE.S <label> |A|012346|-|-***-|-----| |0110_111_000_sss_sss (s is not equal to 0) [BGT.S <label>] 10197: //JBLE.L <label> |A|012346|-|-***-|-----| |0110_111_000_000_110-0100111011111001-{address} [BGT.S (*)+8;JMP <label>] 10198: //JBNGT.L <label> |A|012346|-|-***-|-----| |0110_111_000_000_110-0100111011111001-{address} [BGT.S (*)+8;JMP <label>] 10199: public static void irpBgtsw () throws M68kException { 10200: if (XEiJ.MPU_CC_GT << XEiJ.regCCR < 0) { //Bccでジャンプ 10201: XEiJ.mpuCycleCount += 10; 10202: int t = XEiJ.regPC; //pc0+2 10203: int s = (byte) XEiJ.regOC; //オフセット 10204: if (s == 0) { //Bcc.Wでジャンプ 10205: XEiJ.regPC = t + 2; 10206: s = XEiJ.busRwse (t); //pcws 10207: } else { //Bcc.Sでジャンプ 10208: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 10209: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 10210: if (XEiJ.MPU_OMIT_EXTRA_READ) { 10211: //! 軽量化。リードを省略する 10212: } else { 10213: XEiJ.busRwse (t); //pcws 10214: } 10215: } 10216: irpSetPC (t + s); //pc0+2+オフセット 10217: } else if (XEiJ.regOC == 0x6e00) { //Bcc.Wで通過 10218: XEiJ.mpuCycleCount += 12; 10219: if (XEiJ.MPU_OMIT_OFFSET_READ) { 10220: //リードを省略する 10221: } else { 10222: XEiJ.busRws (XEiJ.regPC); 10223: } 10224: XEiJ.regPC += 2; 10225: } else { //Bcc.Sで通過 10226: XEiJ.mpuCycleCount += 8; 10227: } 10228: } //irpBgtsw 10229: 10230: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10231: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10232: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10233: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10234: //BGT.S <label> |-|012346|-|-***-|-----| |0110_111_001_sss_sss 10235: //BNLE.S <label> |A|012346|-|-***-|-----| |0110_111_001_sss_sss [BGT.S <label>] 10236: //JBGT.S <label> |A|012346|-|-***-|-----| |0110_111_001_sss_sss [BGT.S <label>] 10237: //JBNLE.S <label> |A|012346|-|-***-|-----| |0110_111_001_sss_sss [BGT.S <label>] 10238: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10239: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10240: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10241: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10242: //BGT.S <label> |-|012346|-|-***-|-----| |0110_111_010_sss_sss 10243: //BNLE.S <label> |A|012346|-|-***-|-----| |0110_111_010_sss_sss [BGT.S <label>] 10244: //JBGT.S <label> |A|012346|-|-***-|-----| |0110_111_010_sss_sss [BGT.S <label>] 10245: //JBNLE.S <label> |A|012346|-|-***-|-----| |0110_111_010_sss_sss [BGT.S <label>] 10246: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10247: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10248: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10249: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10250: //BGT.S <label> |-|01----|-|-***-|-----| |0110_111_011_sss_sss 10251: //BNLE.S <label> |A|01----|-|-***-|-----| |0110_111_011_sss_sss [BGT.S <label>] 10252: //JBGT.S <label> |A|01----|-|-***-|-----| |0110_111_011_sss_sss [BGT.S <label>] 10253: //JBNLE.S <label> |A|01----|-|-***-|-----| |0110_111_011_sss_sss [BGT.S <label>] 10254: public static void irpBgts () throws M68kException { 10255: if (XEiJ.MPU_CC_GT << XEiJ.regCCR < 0) { //Bccでジャンプ 10256: XEiJ.mpuCycleCount += 10; 10257: int t = XEiJ.regPC; //pc0+2 10258: int s = (byte) XEiJ.regOC; //オフセット 10259: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 10260: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 10261: if (XEiJ.MPU_OMIT_EXTRA_READ) { 10262: //! 軽量化。リードを省略する 10263: } else { 10264: XEiJ.busRwse (t); //pcws 10265: } 10266: irpSetPC (t + s); //pc0+2+オフセット 10267: } else { //Bcc.Sで通過 10268: XEiJ.mpuCycleCount += 8; 10269: } 10270: } //irpBgts 10271: 10272: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10273: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10274: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10275: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10276: //BLE.W <label> |-|012346|-|-***-|-----| |0110_111_100_000_000-{offset} 10277: //BNGT.W <label> |A|012346|-|-***-|-----| |0110_111_100_000_000-{offset} [BLE.W <label>] 10278: //JBLE.W <label> |A|012346|-|-***-|-----| |0110_111_100_000_000-{offset} [BLE.W <label>] 10279: //JBNGT.W <label> |A|012346|-|-***-|-----| |0110_111_100_000_000-{offset} [BLE.W <label>] 10280: //BLE.S <label> |-|012346|-|-***-|-----| |0110_111_100_sss_sss (s is not equal to 0) 10281: //BNGT.S <label> |A|012346|-|-***-|-----| |0110_111_100_sss_sss (s is not equal to 0) [BLE.S <label>] 10282: //JBLE.S <label> |A|012346|-|-***-|-----| |0110_111_100_sss_sss (s is not equal to 0) [BLE.S <label>] 10283: //JBNGT.S <label> |A|012346|-|-***-|-----| |0110_111_100_sss_sss (s is not equal to 0) [BLE.S <label>] 10284: //JBGT.L <label> |A|012346|-|-***-|-----| |0110_111_100_000_110-0100111011111001-{address} [BLE.S (*)+8;JMP <label>] 10285: //JBNLE.L <label> |A|012346|-|-***-|-----| |0110_111_100_000_110-0100111011111001-{address} [BLE.S (*)+8;JMP <label>] 10286: public static void irpBlesw () throws M68kException { 10287: if (XEiJ.MPU_CC_LE << XEiJ.regCCR < 0) { //Bccでジャンプ 10288: XEiJ.mpuCycleCount += 10; 10289: int t = XEiJ.regPC; //pc0+2 10290: int s = (byte) XEiJ.regOC; //オフセット 10291: if (s == 0) { //Bcc.Wでジャンプ 10292: XEiJ.regPC = t + 2; 10293: s = XEiJ.busRwse (t); //pcws 10294: } else { //Bcc.Sでジャンプ 10295: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 10296: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 10297: if (XEiJ.MPU_OMIT_EXTRA_READ) { 10298: //! 軽量化。リードを省略する 10299: } else { 10300: XEiJ.busRwse (t); //pcws 10301: } 10302: } 10303: irpSetPC (t + s); //pc0+2+オフセット 10304: } else if (XEiJ.regOC == 0x6f00) { //Bcc.Wで通過 10305: XEiJ.mpuCycleCount += 12; 10306: if (XEiJ.MPU_OMIT_OFFSET_READ) { 10307: //リードを省略する 10308: } else { 10309: XEiJ.busRws (XEiJ.regPC); 10310: } 10311: XEiJ.regPC += 2; 10312: } else { //Bcc.Sで通過 10313: XEiJ.mpuCycleCount += 8; 10314: } 10315: } //irpBlesw 10316: 10317: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10318: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10319: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10320: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10321: //BLE.S <label> |-|012346|-|-***-|-----| |0110_111_101_sss_sss 10322: //BNGT.S <label> |A|012346|-|-***-|-----| |0110_111_101_sss_sss [BLE.S <label>] 10323: //JBLE.S <label> |A|012346|-|-***-|-----| |0110_111_101_sss_sss [BLE.S <label>] 10324: //JBNGT.S <label> |A|012346|-|-***-|-----| |0110_111_101_sss_sss [BLE.S <label>] 10325: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10326: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10327: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10328: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10329: //BLE.S <label> |-|012346|-|-***-|-----| |0110_111_110_sss_sss 10330: //BNGT.S <label> |A|012346|-|-***-|-----| |0110_111_110_sss_sss [BLE.S <label>] 10331: //JBLE.S <label> |A|012346|-|-***-|-----| |0110_111_110_sss_sss [BLE.S <label>] 10332: //JBNGT.S <label> |A|012346|-|-***-|-----| |0110_111_110_sss_sss [BLE.S <label>] 10333: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10334: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10335: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10336: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10337: //BLE.S <label> |-|01----|-|-***-|-----| |0110_111_111_sss_sss 10338: //BNGT.S <label> |A|01----|-|-***-|-----| |0110_111_111_sss_sss [BLE.S <label>] 10339: //JBLE.S <label> |A|01----|-|-***-|-----| |0110_111_111_sss_sss [BLE.S <label>] 10340: //JBNGT.S <label> |A|01----|-|-***-|-----| |0110_111_111_sss_sss [BLE.S <label>] 10341: public static void irpBles () throws M68kException { 10342: if (XEiJ.MPU_CC_LE << XEiJ.regCCR < 0) { //Bccでジャンプ 10343: XEiJ.mpuCycleCount += 10; 10344: int t = XEiJ.regPC; //pc0+2 10345: int s = (byte) XEiJ.regOC; //オフセット 10346: //MC68000のBRA.S/BSR.S/Bcc.Sは分岐するとき分岐しない方の直後のワードをリードする 10347: // 2MB搭載機で$1FFFFEに無限ループ$60FE(BRA.S (*))を書いて飛び込むと$200000でバスエラーが出る 10348: if (XEiJ.MPU_OMIT_EXTRA_READ) { 10349: //! 軽量化。リードを省略する 10350: } else { 10351: XEiJ.busRwse (t); //pcws 10352: } 10353: irpSetPC (t + s); //pc0+2+オフセット 10354: } else { //Bcc.Sで通過 10355: XEiJ.mpuCycleCount += 8; 10356: } 10357: } //irpBles 10358: 10359: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10360: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10361: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10362: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10363: //IOCS <name> |A|012346|-|UUUUU|UUUUU| |0111_000_0dd_ddd_ddd-0100111001001111 [MOVEQ.L #<data>,D0;TRAP #15] 10364: //MOVEQ.L #<data>,Dq |-|012346|-|-UUUU|-**00| |0111_qqq_0dd_ddd_ddd 10365: public static void irpMoveq () throws M68kException { 10366: XEiJ.mpuCycleCount += 4; 10367: int z; 10368: XEiJ.regRn[XEiJ.regOC >> 9 & 7] = z = (byte) XEiJ.regOC; 10369: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 10370: } //irpMoveq 10371: 10372: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10373: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10374: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10375: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10376: //MVS.B <ea>,Dq |-|------|-|-UUUU|-**00|D M+-WXZPI|0111_qqq_100_mmm_rrr (ISA_B) 10377: // 10378: //MVS.B <ea>,Dq 10379: // バイトデータをロングに符号拡張してDqの全体を更新する 10380: public static void irpMvsByte () throws M68kException { 10381: XEiJ.mpuCycleCount += 4; 10382: int ea = XEiJ.regOC & 63; 10383: int z; 10384: XEiJ.regRn[XEiJ.regOC >> 9 & 7] = z = ea < XEiJ.EA_AR ? (byte) XEiJ.regRn[ea] : XEiJ.busRbs (efaAnyByte (ea)); 10385: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 10386: } //irpMvsByte 10387: 10388: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10389: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10390: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10391: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10392: //MVS.W <ea>,Dq |-|------|-|-UUUU|-**00|D M+-WXZPI|0111_qqq_101_mmm_rrr (ISA_B) 10393: // 10394: //MVS.W <ea>,Dq 10395: // ワードデータをロングに符号拡張してDqの全体を更新する 10396: public static void irpMvsWord () throws M68kException { 10397: XEiJ.mpuCycleCount += 4; 10398: int ea = XEiJ.regOC & 63; 10399: int z; 10400: XEiJ.regRn[XEiJ.regOC >> 9 & 7] = z = ea < XEiJ.EA_AR ? (short) XEiJ.regRn[ea] : XEiJ.busRws (efaAnyWord (ea)); 10401: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 10402: } //irpMvsWord 10403: 10404: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10405: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10406: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10407: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10408: //MVZ.B <ea>,Dq |-|------|-|-UUUU|-0*00|D M+-WXZPI|0111_qqq_110_mmm_rrr (ISA_B) 10409: // 10410: //MVZ.B <ea>,Dq 10411: // バイトデータをロングにゼロ拡張してDqの全体を更新する 10412: public static void irpMvzByte () throws M68kException { 10413: XEiJ.mpuCycleCount += 4; 10414: int ea = XEiJ.regOC & 63; 10415: int z; 10416: XEiJ.regRn[XEiJ.regOC >> 9 & 7] = z = ea < XEiJ.EA_AR ? 0xff & XEiJ.regRn[ea] : XEiJ.busRbz (efaAnyByte (ea)); 10417: XEiJ.regCCR = XEiJ.REG_CCR_X & XEiJ.regCCR | (z == 0 ? XEiJ.REG_CCR_Z : 0); 10418: } //irpMvzByte 10419: 10420: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10421: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10422: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10423: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10424: //MVZ.W <ea>,Dq |-|------|-|-UUUU|-0*00|D M+-WXZPI|0111_qqq_111_mmm_rrr (ISA_B) 10425: // 10426: //MVZ.W <ea>,Dq 10427: // ワードデータをロングにゼロ拡張してDqの全体を更新する 10428: public static void irpMvzWord () throws M68kException { 10429: XEiJ.mpuCycleCount += 4; 10430: int ea = XEiJ.regOC & 63; 10431: int z; 10432: XEiJ.regRn[XEiJ.regOC >> 9 & 7] = z = ea < XEiJ.EA_AR ? (char) XEiJ.regRn[ea] : XEiJ.busRwz (efaAnyWord (ea)); 10433: XEiJ.regCCR = XEiJ.REG_CCR_X & XEiJ.regCCR | (z == 0 ? XEiJ.REG_CCR_Z : 0); 10434: } //irpMvzWord 10435: 10436: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10437: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10438: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10439: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10440: //OR.B <ea>,Dq |-|012346|-|-UUUU|-**00|D M+-WXZPI|1000_qqq_000_mmm_rrr 10441: public static void irpOrToRegByte () throws M68kException { 10442: XEiJ.mpuCycleCount += 4; 10443: int ea = XEiJ.regOC & 63; 10444: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.MPU_TSTB_TABLE[255 & (XEiJ.regRn[XEiJ.regOC >> 9 & 7] |= 255 & (ea < XEiJ.EA_AR ? XEiJ.regRn[ea] : XEiJ.busRbs (efaAnyByte (ea))))]; //ccr_tst_byte。0拡張してからOR 10445: } //irpOrToRegByte 10446: 10447: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10448: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10449: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10450: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10451: //OR.W <ea>,Dq |-|012346|-|-UUUU|-**00|D M+-WXZPI|1000_qqq_001_mmm_rrr 10452: public static void irpOrToRegWord () throws M68kException { 10453: XEiJ.mpuCycleCount += 4; 10454: int ea = XEiJ.regOC & 63; 10455: int z = (short) (XEiJ.regRn[XEiJ.regOC >> 9 & 7] |= ea < XEiJ.EA_AR ? (char) XEiJ.regRn[ea] : XEiJ.busRwz (efaAnyWord (ea))); //0拡張してからOR 10456: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 10457: } //irpOrToRegWord 10458: 10459: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10460: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10461: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10462: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10463: //OR.L <ea>,Dq |-|012346|-|-UUUU|-**00|D M+-WXZPI|1000_qqq_010_mmm_rrr 10464: public static void irpOrToRegLong () throws M68kException { 10465: int ea = XEiJ.regOC & 63; 10466: int qqq = XEiJ.regOC >> 9 & 7; 10467: int z; 10468: if (ea < XEiJ.EA_AR) { //OR.L Dr,Dq 10469: XEiJ.mpuCycleCount += 8; 10470: XEiJ.regRn[qqq] = z = XEiJ.regRn[qqq] | XEiJ.regRn[ea]; 10471: } else { //OR.L <mem>,Dq 10472: XEiJ.mpuCycleCount += ea == XEiJ.EA_IM ? 8 : 6; //ソースが#<data>のとき2増やす 10473: XEiJ.regRn[qqq] = z = XEiJ.regRn[qqq] | XEiJ.busRls (efaAnyLong (ea)); 10474: } 10475: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 10476: } //irpOrToRegLong 10477: 10478: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10479: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10480: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10481: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10482: //DIVU.W <ea>,Dq |-|012346|-|-UUUU|-***0|D M+-WXZPI|1000_qqq_011_mmm_rrr 10483: // 10484: //DIVU.W <ea>,Dq 10485: // M68000PRMでDIVU.Wのオーバーフローの条件が16bit符号あり整数と書かれているのは16bit符号なし整数の間違い 10486: public static void irpDivuWord () throws M68kException { 10487: // X 変化しない 10488: // N ゼロ除算またはオーバーフローのとき不定。商が負のときセット。それ以外はクリア 10489: // Z ゼロ除算またはオーバーフローのとき不定。商が0のときセット。それ以外はクリア 10490: // V ゼロ除算のとき不定。オーバーフローのときセット。それ以外はクリア 10491: // C 常にクリア 10492: int ea = XEiJ.regOC & 63; 10493: int qqq = XEiJ.regOC >> 9 & 7; 10494: int y = ea < XEiJ.EA_AR ? (char) XEiJ.regRn[ea] : XEiJ.busRwz (efaAnyWord (ea)); //除数 10495: int x = XEiJ.regRn[qqq]; //被除数 10496: XEiJ.mpuCycleCount += irpDivuCyclesModified (x, y); 10497: if (y == 0) { //ゼロ除算 10498: //Dqは変化しない 10499: XEiJ.regCCR = (XEiJ.regCCR & XEiJ.REG_CCR_X | //Xは変化しない 10500: (x < 0 ? XEiJ.REG_CCR_N : 0) | //Nは被除数が負のときセット、さもなくばクリア 10501: (x >> 16 == 0 ? XEiJ.REG_CCR_Z : 0) | //Zは被除数が$0000xxxxのときセット、さもなくばクリア 10502: XEiJ.REG_CCR_V //Vは常にセット 10503: ); //Cは常にクリア 10504: M68kException.m6eNumber = M68kException.M6E_DIVIDE_BY_ZERO; 10505: throw M68kException.m6eSignal; 10506: } 10507: //無理にintで符号なし除算をやろうとするよりもdoubleにキャストしてから割ったほうが速い 10508: // intの除算をdoubleの除算器で行うプロセッサならばなおさら 10509: //被除数を符号なし32ビットとみなすためlongを経由してdoubleに変換する 10510: //doubleからlongやintへのキャストは小数点以下が切り捨てられ、オーバーフローは表現できる絶対値最大の値になる 10511: //doubleから直接intに戻しているので0xffffffff/0x0001=0xffffffffが絶対値最大の0x7fffffffになってしまうが、 10512: //DIVU.Wではオーバーフローになることに変わりはないのでよいことにする 10513: // 符号なし32ビットの0xffffffffにしたいときは戻すときもlongを経由すればよい 10514: int z = (int) ((double) ((long) x & 0xffffffffL) / (double) y); //商 10515: if (z >>> 16 != 0) { //オーバーフローあり 10516: //Dqは変化しない 10517: XEiJ.regCCR = (XEiJ.regCCR & XEiJ.REG_CCR_X | //Xは変化しない 10518: (x < 0 ? XEiJ.REG_CCR_N : 0) | //Nは被除数が負のときセット、さもなくばクリア 10519: //Zは常にクリア 10520: XEiJ.REG_CCR_V //Vは常にセット 10521: ); //Cは常にクリア 10522: } else { //オーバーフローなし 10523: XEiJ.regRn[qqq] = x - y * z << 16 | z; //余り<<16|商 10524: z = (short) z; 10525: XEiJ.regCCR = (XEiJ.regCCR & XEiJ.REG_CCR_X | //Xは変化しない 10526: (z < 0 ? XEiJ.REG_CCR_N : 0) | //Nは商が負のときセット、さもなくばクリア 10527: (z == 0 ? XEiJ.REG_CCR_Z : 0) //Zは商が0のときセット、さもなくばクリア 10528: //Vは常にクリア 10529: ); //Cは常にクリア 10530: } //if オーバーフローあり/オーバーフローなし 10531: } //irpDivuWord 10532: 10533: //DIVUの実行時間 10534: // 以下に実効アドレスの時間を加える 10535: // ゼロ除算のとき38 10536: // オーバーフローのとき10 10537: // 正常終了のとき76+ 10538: // 商のビット15~1について 10539: // 被除数のビット16が1で商が1のとき0 10540: // 被除数のビット16が0で商が1のとき2 10541: // 被除数のビット16が0で商が0のとき4 10542: // 補足 10543: // 商のビット0を計算に含めると最大140になりマニュアルと一致する 10544: // 参考 10545: // https://www.atari-forum.com/viewtopic.php?t=6484 10546: public static int irpDivuCyclesModified (int x, int y) { 10547: y &= 0xffff; //ゼロ拡張 10548: if (y == 0) { //ゼロ除算 10549: return 38; 10550: } 10551: int r = x >>> 16; //余り。符号なし右シフト 10552: if (y <= r) { //オーバーフロー 10553: return 10; 10554: } 10555: int c = 76; 10556: for (int i = 15; 0 < i; i--) { //ビット0を含まない 10557: r = r << 1 | ((x >> i) & 1); 10558: if (0x10000 <= r) { //被除数のビット16が1で商が1 10559: r -= y; 10560: } else if (y <= r) { //被除数のビット16が0で商が1 10561: r -= y; 10562: c += 2; 10563: } else { //被除数のビット16が0で商が0 10564: c += 4; 10565: } 10566: } 10567: return c; 10568: } 10569: 10570: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10571: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10572: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10573: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10574: //SBCD.B Dr,Dq |-|012346|-|UUUUU|*U*U*| |1000_qqq_100_000_rrr 10575: //SBCD.B -(Ar),-(Aq) |-|012346|-|UUUUU|*U*U*| |1000_qqq_100_001_rrr 10576: //OR.B Dq,<ea> |-|012346|-|-UUUU|-**00| M+-WXZ |1000_qqq_100_mmm_rrr 10577: public static void irpOrToMemByte () throws M68kException { 10578: int ea = XEiJ.regOC & 63; 10579: if (ea >= XEiJ.EA_MM) { //OR.B Dq,<ea> 10580: XEiJ.mpuCycleCount += 8; 10581: int a = efaMltByte (ea); 10582: int z = XEiJ.regRn[XEiJ.regOC >> 9 & 7] | XEiJ.busRbs (a); 10583: XEiJ.busWb (a, z); 10584: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.MPU_TSTB_TABLE[255 & z]; //ccr_tst_byte 10585: } else if (ea < XEiJ.EA_AR) { //SBCD.B Dr,Dq 10586: int qqq = XEiJ.regOC >> 9 & 7; 10587: XEiJ.mpuCycleCount += 6; 10588: int x; 10589: XEiJ.regRn[qqq] = ~0xff & (x = XEiJ.regRn[qqq]) | irpSbcd (x, XEiJ.regRn[ea]); 10590: } else { //SBCD.B -(Ar),-(Aq) 10591: XEiJ.mpuCycleCount += 18; 10592: int y = XEiJ.busRbz (--XEiJ.regRn[ea]); //このr[ea]はアドレスレジスタ 10593: int a = --XEiJ.regRn[(XEiJ.regOC >> 9) - (64 - 8)]; 10594: XEiJ.busWb (a, irpSbcd (XEiJ.busRbz (a), y)); 10595: } 10596: } //irpOrToMemByte 10597: 10598: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10599: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10600: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10601: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10602: //OR.W Dq,<ea> |-|012346|-|-UUUU|-**00| M+-WXZ |1000_qqq_101_mmm_rrr 10603: public static void irpOrToMemWord () throws M68kException { 10604: XEiJ.mpuCycleCount += 8; 10605: int ea = XEiJ.regOC & 63; 10606: int a = efaMltWord (ea); 10607: int z = XEiJ.regRn[XEiJ.regOC >> 9 & 7] | XEiJ.busRws (a); 10608: XEiJ.busWw (a, z); 10609: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | (char) z - 1 >> 31 & XEiJ.REG_CCR_Z | ((short) z < 0 ? XEiJ.REG_CCR_N : 0); //ccr_tst_word 10610: } //irpOrToMemWord 10611: 10612: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10613: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10614: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10615: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10616: //OR.L Dq,<ea> |-|012346|-|-UUUU|-**00| M+-WXZ |1000_qqq_110_mmm_rrr 10617: public static void irpOrToMemLong () throws M68kException { 10618: XEiJ.mpuCycleCount += 12; 10619: int ea = XEiJ.regOC & 63; 10620: int a = efaMltLong (ea); 10621: int z; 10622: XEiJ.busWl (a, z = XEiJ.regRn[XEiJ.regOC >> 9 & 7] | XEiJ.busRls (a)); 10623: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 10624: } //irpOrToMemLong 10625: 10626: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10627: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10628: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10629: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10630: //DIVS.W <ea>,Dq |-|012346|-|-UUUU|-***0|D M+-WXZPI|1000_qqq_111_mmm_rrr 10631: // 10632: //DIVS.W <ea>,Dq 10633: // DIVSの余りの符号は被除数と一致 10634: // M68000PRMでDIVS.Wのアドレッシングモードがデータ可変と書かれているのはデータの間違い 10635: public static void irpDivsWord () throws M68kException { 10636: // X 変化しない 10637: // N ゼロ除算またはオーバーフローのとき不定。商が負のときセット。それ以外はクリア 10638: // Z ゼロ除算またはオーバーフローのとき不定。商が0のときセット。それ以外はクリア 10639: // V ゼロ除算のとき不定。オーバーフローのときセット。それ以外はクリア 10640: // C 常にクリア 10641: //divsの余りの符号は被除数と一致 10642: //Javaの除算演算子の挙動 10643: // 10 / 3 == 3 10 % 3 == 1 10 = 3 * 3 + 1 10644: // 10 / -3 == -3 10 % -3 == 1 10 = -3 * -3 + 1 10645: // -10 / 3 == -3 -10 % 3 == -1 -10 = 3 * -3 + -1 10646: // -10 / -3 == 3 -10 % -3 == -1 -10 = -3 * 3 + -1 10647: int ea = XEiJ.regOC & 63; 10648: int qqq = XEiJ.regOC >> 9 & 7; 10649: int y = ea < XEiJ.EA_AR ? (short) XEiJ.regRn[ea] : XEiJ.busRws (efaAnyWord (ea)); //除数 10650: int x = XEiJ.regRn[qqq]; //被除数 10651: XEiJ.mpuCycleCount += irpDivsCycles (x, y); 10652: if (y == 0) { //ゼロ除算 10653: //Dqは変化しない 10654: //!!! MC68030はゼロ除算のときオペランド以外の要因でZとVが変化する。その要因がわからないとZとVを正確に再現することができない 10655: XEiJ.regCCR = (XEiJ.regCCR & XEiJ.REG_CCR_X | //Xは変化しない 10656: //Nは常にクリア 10657: XEiJ.REG_CCR_Z | //Zは常にセット 10658: (x == 0x00008000 ? ~XEiJ.regCCR & XEiJ.REG_CCR_V : (0 <= x && x != 0x7fffffff) || x == 0x80000000 ? XEiJ.REG_CCR_V : XEiJ.regCCR & XEiJ.REG_CCR_V) //Vは被除数が$00008000のとき反転、被除数が$7fffffffを除く正または$80000000のときセット、さもなくば変化しない 10659: ); //Cは常にクリア 10660: M68kException.m6eNumber = M68kException.M6E_DIVIDE_BY_ZERO; 10661: throw M68kException.m6eSignal; 10662: } 10663: int z = x / y; //商 10664: if ((short) z != z) { //オーバーフローあり 10665: //Dqは変化しない 10666: XEiJ.regCCR = (XEiJ.regCCR & XEiJ.REG_CCR_X | //Xは変化しない 10667: (x == 0x80000000 || (z & 0xffff0080) == 0x00000080 || (z & 0xffff0080) == 0xffff0080 ? XEiJ.REG_CCR_N : 0) | //Nは被除数が$80000000または商が$0000xxyyまたは$ffffxxyyでyyが負のときセット、さもなくばクリア 10668: (z == 0x00008000 || (((z & 0xffff00ff) == 0x00000000 || (z & 0xffff00ff) == 0xffff0000) && (z & 0x0000ff00) != 0) ? XEiJ.REG_CCR_Z : 0) | //Zは商が$00008000または商が$0000xxyyまたは$ffffxxyyでxxが0でなくてyyが0のときセット、さもなくばクリア 10669: XEiJ.REG_CCR_V //Vは常にセット 10670: ); //Cは常にクリア 10671: } else { //オーバーフローなし 10672: XEiJ.regRn[qqq] = x - y * z << 16 | (char) z; //Dqは余り<<16|商&$ffff 10673: XEiJ.regCCR = (XEiJ.regCCR & XEiJ.REG_CCR_X | //Xは変化しない 10674: (z < 0 ? XEiJ.REG_CCR_N : 0) | //Nは商が負のときセット、さもなくばクリア 10675: (z == 0 ? XEiJ.REG_CCR_Z : 0) //Zは商が0のときセット、さもなくばクリア 10676: //Vは常にクリア 10677: ); //Cは常にクリア 10678: } //if オーバーフローあり/オーバーフローなし 10679: } //irpDivsWord 10680: 10681: //DIVSの実行時間 10682: // 以下に実効アドレスの時間を加える 10683: // ゼロ除算のとき38 10684: // 符号なしオーバーフローのとき 10685: // 被除数が正のとき16 10686: // 被除数が負のとき18 10687: // 正常終了または符号ありオーバーフローのとき 10688: // 被除数が正で除数が正のとき120+ 10689: // 被除数が正で除数が負のとき122+ 10690: // 被除数が負で除数が正のとき126+ 10691: // 被除数が負で除数が負のとき124+ 10692: // 符号なし商のビット15~1について 10693: // 符号なし商が1のとき0 10694: // 符号なし商が0のとき2 10695: // 補足 10696: // 符号なし商のビット0を計算に含めると最大158になりマニュアルと一致する 10697: // 参考 10698: // https://www.atari-forum.com/viewtopic.php?t=6484 10699: public static int irpDivsCycles (int x, int y) { 10700: y = (short) y; //符号拡張 10701: if (y == 0) { //ゼロ除算 10702: return 38; 10703: } 10704: //符号あり除算だと0x80000000/0xffffffffが0x00000000になる環境があるので 10705: //符号なし除算を用いる。JavaはInteger.divideUnsigned 10706: //符号なし商に0x80000000が含まれることに注意 10707: int q = Integer.divideUnsigned ((x < 0 ? -x : x), (y < 0 ? -y : y)); 10708: if ((q & 0xffff0000) != 0) { //符号なしオーバーフロー。0xffff<qは不可 10709: return x < 0 ? 18 : 16; 10710: } 10711: int t = ~q; 10712: t = (t & 0x5554) + ((t >> 1) & 0x5555); //0x5554に注意。ビット0を含まない 10713: t = (t & 0x3333) + ((t >> 2) & 0x3333); 10714: t = (t & 0x0F0F) + ((t >> 4) & 0x0F0F); 10715: t = (t & 0x00FF) + ((t >> 8) & 0x00FF); 10716: return (x < 0 ? y < 0 ? 124 : 126 : y < 0 ? 122 : 120) + (t << 1); 10717: } 10718: 10719: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10720: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10721: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10722: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10723: //SUB.B <ea>,Dq |-|012346|-|UUUUU|*****|D M+-WXZPI|1001_qqq_000_mmm_rrr 10724: public static void irpSubToRegByte () throws M68kException { 10725: XEiJ.mpuCycleCount += 4; 10726: int ea = XEiJ.regOC & 63; 10727: int qqq = XEiJ.regOC >> 9 & 7; 10728: int x, y, z; 10729: y = ea < XEiJ.EA_AR ? XEiJ.regRn[ea] : XEiJ.busRbs (efaAnyByte (ea)); 10730: x = XEiJ.regRn[qqq]; 10731: z = x - y; 10732: XEiJ.regRn[qqq] = ~255 & x | 255 & z; 10733: XEiJ.regCCR = (XEiJ.MPU_TSTB_TABLE[255 & z] | 10734: ((x ^ y) & (x ^ z)) >> 6 & XEiJ.REG_CCR_V | 10735: (byte) (x & (y ^ z) ^ (y | z)) >> 7 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_sub_byte 10736: } //irpSubToRegByte 10737: 10738: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10739: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10740: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10741: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10742: //SUB.W <ea>,Dq |-|012346|-|UUUUU|*****|DAM+-WXZPI|1001_qqq_001_mmm_rrr 10743: public static void irpSubToRegWord () throws M68kException { 10744: XEiJ.mpuCycleCount += 4; 10745: int ea = XEiJ.regOC & 63; 10746: int qqq = XEiJ.regOC >> 9 & 7; 10747: int x, y, z; 10748: y = ea < XEiJ.EA_MM ? XEiJ.regRn[ea] : XEiJ.busRws (efaAnyWord (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ 10749: x = XEiJ.regRn[qqq]; 10750: z = x - y; 10751: XEiJ.regRn[qqq] = ~65535 & x | (char) z; 10752: XEiJ.regCCR = (z >> 12 & XEiJ.REG_CCR_N | (char) z - 1 >> 14 & XEiJ.REG_CCR_Z | 10753: ((x ^ y) & (x ^ z)) >> 14 & XEiJ.REG_CCR_V | 10754: (short) (x & (y ^ z) ^ (y | z)) >> 15 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_sub_word 10755: } //irpSubToRegWord 10756: 10757: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10758: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10759: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10760: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10761: //SUB.L <ea>,Dq |-|012346|-|UUUUU|*****|DAM+-WXZPI|1001_qqq_010_mmm_rrr 10762: public static void irpSubToRegLong () throws M68kException { 10763: int ea = XEiJ.regOC & 63; 10764: int qqq = XEiJ.regOC >> 9 & 7; 10765: XEiJ.mpuCycleCount += ea < XEiJ.EA_MM || ea == XEiJ.EA_IM ? 8 : 6; //ソースが#<data>のとき2増やす 10766: int x, y, z; 10767: y = ea < XEiJ.EA_MM ? XEiJ.regRn[ea] : XEiJ.busRls (efaAnyLong (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ 10768: x = XEiJ.regRn[qqq]; 10769: z = x - y; 10770: XEiJ.regRn[qqq] = z; 10771: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | 10772: ((x ^ y) & (x ^ z)) >> 30 & XEiJ.REG_CCR_V | 10773: (x & (y ^ z) ^ (y | z)) >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_sub 10774: } //irpSubToRegLong 10775: 10776: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10777: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10778: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10779: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10780: //SUBA.W <ea>,Aq |-|012346|-|-----|-----|DAM+-WXZPI|1001_qqq_011_mmm_rrr 10781: //SUB.W <ea>,Aq |A|012346|-|-----|-----|DAM+-WXZPI|1001_qqq_011_mmm_rrr [SUBA.W <ea>,Aq] 10782: //CLR.W Ar |A|012346|-|-----|-----| A |1001_rrr_011_001_rrr [SUBA.W Ar,Ar] 10783: // 10784: //SUBA.W <ea>,Aq 10785: // ソースを符号拡張してロングで減算する 10786: public static void irpSubaWord () throws M68kException { 10787: XEiJ.mpuCycleCount += 8; 10788: int ea = XEiJ.regOC & 63; 10789: int z = ea < XEiJ.EA_MM ? (short) XEiJ.regRn[ea] : XEiJ.busRws (efaAnyWord (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ。ここでAqが変化する可能性があることに注意 10790: XEiJ.regRn[XEiJ.regOC >> 9 & 15] -= z; //r[op >> 9 & 15] -= ea < XEiJ.EA_MM ? (short) r[ea] : rws (efaAnyWord (ea));は不可 10791: //ccrは変化しない 10792: } //irpSubaWord 10793: 10794: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10795: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10796: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10797: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10798: //SUBX.B Dr,Dq |-|012346|-|*UUUU|*****| |1001_qqq_100_000_rrr 10799: //SUBX.B -(Ar),-(Aq) |-|012346|-|*UUUU|*****| |1001_qqq_100_001_rrr 10800: //SUB.B Dq,<ea> |-|012346|-|UUUUU|*****| M+-WXZ |1001_qqq_100_mmm_rrr 10801: public static void irpSubToMemByte () throws M68kException { 10802: int ea = XEiJ.regOC & 63; 10803: int a, x, y, z; 10804: if (ea < XEiJ.EA_MM) { 10805: if (ea < XEiJ.EA_AR) { //SUBX.B Dr,Dq 10806: int qqq = XEiJ.regOC >> 9 & 7; 10807: XEiJ.mpuCycleCount += 4; 10808: y = XEiJ.regRn[ea]; 10809: x = XEiJ.regRn[qqq]; 10810: z = x - y - (XEiJ.regCCR >> 4); //Xの左側はすべて0なのでCCR_X&を省略 10811: XEiJ.regRn[qqq] = ~255 & x | 255 & z; 10812: } else { //SUBX.B -(Ar),-(Aq) 10813: XEiJ.mpuCycleCount += 18; 10814: y = XEiJ.busRbs (--XEiJ.regRn[ea]); //このr[ea]はアドレスレジスタ 10815: a = --XEiJ.regRn[XEiJ.regOC >> 9 & 15]; //1qqq=aqq 10816: x = XEiJ.busRbs (a); 10817: z = x - y - (XEiJ.regCCR >> 4); //Xの左側はすべて0なのでCCR_X&を省略 10818: XEiJ.busWb (a, z); 10819: } 10820: XEiJ.regCCR = (z >> 4 & XEiJ.REG_CCR_N | (255 & z) - 1 >> 6 & XEiJ.regCCR & XEiJ.REG_CCR_Z | //SUBXはZをクリアすることはあるがセットすることはない 10821: ((x ^ y) & (x ^ z)) >> 6 & XEiJ.REG_CCR_V | 10822: (byte) (x & (y ^ z) ^ (y | z)) >> 7 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_subx_byte 10823: } else { //SUB.B Dq,<ea> 10824: XEiJ.mpuCycleCount += 8; 10825: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7]; 10826: a = efaMltByte (ea); 10827: x = XEiJ.busRbs (a); 10828: z = x - y; 10829: XEiJ.busWb (a, z); 10830: XEiJ.regCCR = (XEiJ.MPU_TSTB_TABLE[255 & z] | 10831: ((x ^ y) & (x ^ z)) >> 6 & XEiJ.REG_CCR_V | 10832: (byte) (x & (y ^ z) ^ (y | z)) >> 7 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_sub_byte 10833: } 10834: } //irpSubToMemByte 10835: 10836: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10837: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10838: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10839: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10840: //SUBX.W Dr,Dq |-|012346|-|*UUUU|*****| |1001_qqq_101_000_rrr 10841: //SUBX.W -(Ar),-(Aq) |-|012346|-|*UUUU|*****| |1001_qqq_101_001_rrr 10842: //SUB.W Dq,<ea> |-|012346|-|UUUUU|*****| M+-WXZ |1001_qqq_101_mmm_rrr 10843: public static void irpSubToMemWord () throws M68kException { 10844: int ea = XEiJ.regOC & 63; 10845: int a, x, y, z; 10846: if (ea < XEiJ.EA_MM) { 10847: if (ea < XEiJ.EA_AR) { //SUBX.W Dr,Dq 10848: int qqq = XEiJ.regOC >> 9 & 7; 10849: XEiJ.mpuCycleCount += 4; 10850: y = XEiJ.regRn[ea]; 10851: x = XEiJ.regRn[qqq]; 10852: z = x - y - (XEiJ.regCCR >> 4); //Xの左側はすべて0なのでCCR_X&を省略 10853: XEiJ.regRn[qqq] = ~65535 & x | (char) z; 10854: } else { //SUBX.W -(Ar),-(Aq) 10855: XEiJ.mpuCycleCount += 18; 10856: y = XEiJ.busRws (XEiJ.regRn[ea] -= 2); //このr[ea]はアドレスレジスタ 10857: a = XEiJ.regRn[XEiJ.regOC >> 9 & 15] -= 2; 10858: x = XEiJ.busRws (a); 10859: z = x - y - (XEiJ.regCCR >> 4); //Xの左側はすべて0なのでCCR_X&を省略 10860: XEiJ.busWw (a, z); 10861: } 10862: XEiJ.regCCR = (z >> 12 & XEiJ.REG_CCR_N | (char) z - 1 >> 14 & XEiJ.regCCR & XEiJ.REG_CCR_Z | //ADDXはZをクリアすることはあるがセットすることはない 10863: ((x ^ y) & (x ^ z)) >> 14 & XEiJ.REG_CCR_V | 10864: (short) (x & (y ^ z) ^ (y | z)) >> 15 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_subx_word 10865: } else { //SUB.W Dq,<ea> 10866: XEiJ.mpuCycleCount += 8; 10867: y = (short) XEiJ.regRn[XEiJ.regOC >> 9 & 7]; 10868: a = efaMltWord (ea); 10869: x = XEiJ.busRws (a); 10870: z = x - y; 10871: XEiJ.busWw (a, z); 10872: XEiJ.regCCR = (z >> 12 & XEiJ.REG_CCR_N | (char) z - 1 >> 14 & XEiJ.REG_CCR_Z | 10873: ((x ^ y) & (x ^ z)) >> 14 & XEiJ.REG_CCR_V | 10874: (short) (x & (y ^ z) ^ (y | z)) >> 15 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_sub_word 10875: } 10876: } //irpSubToMemWord 10877: 10878: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10879: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10880: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10881: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10882: //SUBX.L Dr,Dq |-|012346|-|*UUUU|*****| |1001_qqq_110_000_rrr 10883: //SUBX.L -(Ar),-(Aq) |-|012346|-|*UUUU|*****| |1001_qqq_110_001_rrr 10884: //SUB.L Dq,<ea> |-|012346|-|UUUUU|*****| M+-WXZ |1001_qqq_110_mmm_rrr 10885: public static void irpSubToMemLong () throws M68kException { 10886: int ea = XEiJ.regOC & 63; 10887: if (ea < XEiJ.EA_MM) { 10888: int x; 10889: int y; 10890: int z; 10891: if (ea < XEiJ.EA_AR) { //SUBX.L Dr,Dq 10892: int qqq = XEiJ.regOC >> 9 & 7; 10893: XEiJ.mpuCycleCount += 8; 10894: XEiJ.regRn[qqq] = z = (x = XEiJ.regRn[qqq]) - (y = XEiJ.regRn[ea]) - (XEiJ.regCCR >> 4); //Xの左側はすべて0なのでCCR_X&を省略 10895: } else { //SUBX.L -(Ar),-(Aq) 10896: XEiJ.mpuCycleCount += 30; 10897: y = XEiJ.busRls (XEiJ.regRn[ea] -= 4); //このr[ea]はアドレスレジスタ 10898: int a = XEiJ.regRn[XEiJ.regOC >> 9 & 15] -= 4; 10899: XEiJ.busWl (a, z = (x = XEiJ.busRls (a)) - y - (XEiJ.regCCR >> 4)); //Xの左側はすべて0なのでCCR_X&を省略 10900: } 10901: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_Z : 0) | 10902: ((x ^ y) & (x ^ z)) >>> 31 << 1 | 10903: (x & (y ^ z) ^ (y | z)) >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_subx 10904: } else { //SUB.L Dq,<ea> 10905: XEiJ.mpuCycleCount += 12; 10906: int a = efaMltLong (ea); 10907: int x; 10908: int y; 10909: int z; 10910: XEiJ.busWl (a, z = (x = XEiJ.busRls (a)) - (y = XEiJ.regRn[XEiJ.regOC >> 9 & 7])); 10911: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | 10912: ((x ^ y) & (x ^ z)) >>> 31 << 1 | 10913: (x & (y ^ z) ^ (y | z)) >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_sub 10914: } 10915: } //irpSubToMemLong 10916: 10917: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10918: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10919: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10920: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10921: //SUBA.L <ea>,Aq |-|012346|-|-----|-----|DAM+-WXZPI|1001_qqq_111_mmm_rrr 10922: //SUB.L <ea>,Aq |A|012346|-|-----|-----|DAM+-WXZPI|1001_qqq_111_mmm_rrr [SUBA.L <ea>,Aq] 10923: //CLR.L Ar |A|012346|-|-----|-----| A |1001_rrr_111_001_rrr [SUBA.L Ar,Ar] 10924: public static void irpSubaLong () throws M68kException { 10925: int ea = XEiJ.regOC & 63; 10926: XEiJ.mpuCycleCount += ea < XEiJ.EA_MM || ea == XEiJ.EA_IM ? 8 : 6; //Dr/Ar/#<data>のとき8+、それ以外は6+ 10927: int z = ea < XEiJ.EA_MM ? XEiJ.regRn[ea] : XEiJ.busRls (efaAnyLong (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ。ここでAqが変化する可能性があることに注意 10928: XEiJ.regRn[XEiJ.regOC >> 9 & 15] -= z; //r[op >> 9 & 15] -= ea < XEiJ.EA_MM ? r[ea] : rls (efaAnyLong (ea));は不可 10929: //ccrは変化しない 10930: } //irpSubaLong 10931: 10932: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10933: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10934: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10935: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10936: //SXCALL <name> |A|012346|-|UUUUU|*****| |1010_0dd_ddd_ddd_ddd [ALINE #<data>] 10937: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10938: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10939: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10940: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10941: //ALINE #<data> |-|012346|-|UUUUU|*****| |1010_ddd_ddd_ddd_ddd (line 1010 emulator) 10942: public static void irpAline () throws M68kException { 10943: XEiJ.mpuCycleCount += 34; 10944: if (XEiJ.MPU_INLINE_EXCEPTION) { 10945: int save_sr = XEiJ.regSRT1 | XEiJ.regSRS | XEiJ.regSRI | XEiJ.regCCR; 10946: int sp = XEiJ.regRn[15]; 10947: XEiJ.regSRT1 = XEiJ.mpuTraceFlag = 0; //srのTビットを消す 10948: if (XEiJ.regSRS == 0) { //ユーザモードのとき 10949: XEiJ.regSRS = XEiJ.REG_SR_S; //スーパーバイザモードへ移行する 10950: XEiJ.mpuUSP = sp; //USPを保存 10951: sp = XEiJ.mpuISP; //SSPを復元 10952: if (DataBreakPoint.DBP_ON) { 10953: DataBreakPoint.dbpMemoryMap = DataBreakPoint.dbpSuperMap; //スーパーバイザメモリマップに切り替える 10954: } else { 10955: XEiJ.busMemoryMap = XEiJ.busSuperMap; //スーパーバイザメモリマップに切り替える 10956: } 10957: if (InstructionBreakPoint.IBP_ON) { 10958: InstructionBreakPoint.ibpOp1MemoryMap = InstructionBreakPoint.ibpOp1SuperMap; 10959: } 10960: } 10961: XEiJ.regRn[15] = sp -= 6; 10962: XEiJ.busWl (sp + 2, XEiJ.regPC0); //pushl。pcをプッシュする 10963: XEiJ.busWw (sp, save_sr); //pushw。srをプッシュする 10964: irpSetPC (XEiJ.busRlsf (M68kException.M6E_LINE_1010_EMULATOR << 2)); //例外ベクタを取り出してジャンプする 10965: } else { 10966: irpException (M68kException.M6E_LINE_1010_EMULATOR, XEiJ.regPC0, XEiJ.regSRT1 | XEiJ.regSRS | XEiJ.regSRI | XEiJ.regCCR); //pcは命令の先頭 10967: } 10968: } //irpAline 10969: 10970: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10971: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10972: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10973: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10974: //CMP.B <ea>,Dq |-|012346|-|-UUUU|-****|D M+-WXZPI|1011_qqq_000_mmm_rrr 10975: public static void irpCmpByte () throws M68kException { 10976: XEiJ.mpuCycleCount += 4; 10977: int ea = XEiJ.regOC & 63; 10978: int x; 10979: int y; 10980: int z = (byte) ((x = (byte) XEiJ.regRn[XEiJ.regOC >> 9 & 7]) - (y = ea < XEiJ.EA_AR ? (byte) XEiJ.regRn[ea] : XEiJ.busRbs (efaAnyByte (ea)))); 10981: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X) | 10982: ((x ^ y) & (x ^ z)) >>> 31 << 1 | 10983: (x & (y ^ z) ^ (y | z)) >>> 31); //ccr_cmp 10984: } //irpCmpByte 10985: 10986: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10987: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 10988: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 10989: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 10990: //CMP.W <ea>,Dq |-|012346|-|-UUUU|-****|DAM+-WXZPI|1011_qqq_001_mmm_rrr 10991: public static void irpCmpWord () throws M68kException { 10992: XEiJ.mpuCycleCount += 4; 10993: int ea = XEiJ.regOC & 63; 10994: int x; 10995: int y; 10996: int z = (short) ((x = (short) XEiJ.regRn[XEiJ.regOC >> 9 & 7]) - (y = ea < XEiJ.EA_MM ? (short) XEiJ.regRn[ea] : XEiJ.busRws (efaAnyWord (ea)))); //このr[ea]はデータレジスタまたはアドレスレジスタ 10997: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X) | 10998: ((x ^ y) & (x ^ z)) >>> 31 << 1 | 10999: (x & (y ^ z) ^ (y | z)) >>> 31); //ccr_cmp 11000: } //irpCmpWord 11001: 11002: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11003: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 11004: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 11005: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11006: //CMP.L <ea>,Dq |-|012346|-|-UUUU|-****|DAM+-WXZPI|1011_qqq_010_mmm_rrr 11007: public static void irpCmpLong () throws M68kException { 11008: XEiJ.mpuCycleCount += 6; 11009: int ea = XEiJ.regOC & 63; 11010: int x; 11011: int y; 11012: int z = (x = XEiJ.regRn[XEiJ.regOC >> 9 & 7]) - (y = ea < XEiJ.EA_MM ? XEiJ.regRn[ea] : XEiJ.busRls (efaAnyLong (ea))); //このr[ea]はデータレジスタまたはアドレスレジスタ 11013: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X) | 11014: ((x ^ y) & (x ^ z)) >>> 31 << 1 | 11015: (x & (y ^ z) ^ (y | z)) >>> 31); //ccr_cmp 11016: } //irpCmpLong 11017: 11018: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11019: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 11020: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 11021: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11022: //CMPA.W <ea>,Aq |-|012346|-|-UUUU|-****|DAM+-WXZPI|1011_qqq_011_mmm_rrr 11023: //CMP.W <ea>,Aq |A|012346|-|-UUUU|-****|DAM+-WXZPI|1011_qqq_011_mmm_rrr [CMPA.W <ea>,Aq] 11024: // 11025: //CMPA.W <ea>,Aq 11026: // ソースを符号拡張してロングで比較する 11027: public static void irpCmpaWord () throws M68kException { 11028: XEiJ.mpuCycleCount += 6; 11029: int ea = XEiJ.regOC & 63; 11030: //ソースを符号拡張してからロングで比較する 11031: int y = ea < XEiJ.EA_MM ? (short) XEiJ.regRn[ea] : XEiJ.busRws (efaAnyWord (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ。ここでAqが変化する可能性があることに注意 11032: int x; 11033: int z = (x = XEiJ.regRn[XEiJ.regOC >> 9 & 15]) - y; 11034: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X) | 11035: ((x ^ y) & (x ^ z)) >>> 31 << 1 | 11036: (x & (y ^ z) ^ (y | z)) >>> 31); //ccr_cmp 11037: } //irpCmpaWord 11038: 11039: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11040: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 11041: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 11042: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11043: //EOR.B Dq,<ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |1011_qqq_100_mmm_rrr 11044: //CMPM.B (Ar)+,(Aq)+ |-|012346|-|-UUUU|-****| |1011_qqq_100_001_rrr 11045: public static void irpEorByte () throws M68kException { 11046: int ea = XEiJ.regOC & 63; 11047: if (ea >> 3 == XEiJ.MMM_AR) { //CMPM.B (Ar)+,(Aq)+ 11048: XEiJ.mpuCycleCount += 12; 11049: int y = XEiJ.busRbs (XEiJ.regRn[ea]++); //このr[ea]はアドレスレジスタ 11050: int x; 11051: int z = (byte) ((x = XEiJ.busRbs (XEiJ.regRn[XEiJ.regOC >> 9 & 15]++)) - y); 11052: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X) | 11053: ((x ^ y) & (x ^ z)) >>> 31 << 1 | 11054: (x & (y ^ z) ^ (y | z)) >>> 31); //ccr_cmp 11055: } else { 11056: int qqq = XEiJ.regOC >> 9 & 7; 11057: int z; 11058: if (ea < XEiJ.EA_AR) { //EOR.B Dq,Dr 11059: XEiJ.mpuCycleCount += 4; 11060: z = XEiJ.regRn[ea] ^= 255 & XEiJ.regRn[qqq]; //0拡張してからEOR 11061: } else { //EOR.B Dq,<mem> 11062: XEiJ.mpuCycleCount += 8; 11063: int a = efaMltByte (ea); 11064: XEiJ.busWb (a, z = XEiJ.regRn[qqq] ^ XEiJ.busRbs (a)); 11065: } 11066: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.MPU_TSTB_TABLE[255 & z]; //ccr_tst_byte 11067: } 11068: } //irpEorByte 11069: 11070: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11071: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 11072: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 11073: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11074: //EOR.W Dq,<ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |1011_qqq_101_mmm_rrr 11075: //CMPM.W (Ar)+,(Aq)+ |-|012346|-|-UUUU|-****| |1011_qqq_101_001_rrr 11076: public static void irpEorWord () throws M68kException { 11077: int ea = XEiJ.regOC & 63; 11078: int rrr = XEiJ.regOC & 7; 11079: int mmm = ea >> 3; 11080: if (mmm == XEiJ.MMM_AR) { //CMPM.W (Ar)+,(Aq)+ 11081: XEiJ.mpuCycleCount += 12; 11082: int y = XEiJ.busRws ((XEiJ.regRn[ea] += 2) - 2); //このr[ea]はアドレスレジスタ 11083: int x; 11084: int z = (short) ((x = XEiJ.busRws ((XEiJ.regRn[XEiJ.regOC >> 9 & 15] += 2) - 2)) - y); 11085: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X) | 11086: ((x ^ y) & (x ^ z)) >>> 31 << 1 | 11087: (x & (y ^ z) ^ (y | z)) >>> 31); //ccr_cmp 11088: } else { 11089: int qqq = XEiJ.regOC >> 9 & 7; 11090: int z; 11091: if (ea < XEiJ.EA_AR) { //EOR.W Dq,Dr 11092: XEiJ.mpuCycleCount += 4; 11093: z = XEiJ.regRn[rrr] ^= (char) XEiJ.regRn[qqq]; //0拡張してからEOR 11094: } else { //EOR.W Dq,<mem> 11095: XEiJ.mpuCycleCount += 8; 11096: int a = efaMltWord (ea); 11097: XEiJ.busWw (a, z = XEiJ.regRn[qqq] ^ XEiJ.busRws (a)); 11098: } 11099: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | (char) z - 1 >> 31 & XEiJ.REG_CCR_Z | ((short) z < 0 ? XEiJ.REG_CCR_N : 0); //ccr_tst_word 11100: } 11101: } //irpEorWord 11102: 11103: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11104: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 11105: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 11106: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11107: //EOR.L Dq,<ea> |-|012346|-|-UUUU|-**00|D M+-WXZ |1011_qqq_110_mmm_rrr 11108: //CMPM.L (Ar)+,(Aq)+ |-|012346|-|-UUUU|-****| |1011_qqq_110_001_rrr 11109: public static void irpEorLong () throws M68kException { 11110: int ea = XEiJ.regOC & 63; 11111: if (ea >> 3 == XEiJ.MMM_AR) { //CMPM.L (Ar)+,(Aq)+ 11112: XEiJ.mpuCycleCount += 20; 11113: int y = XEiJ.busRls ((XEiJ.regRn[ea] += 4) - 4); //このr[ea]はアドレスレジスタ 11114: int x; 11115: int z = (x = XEiJ.busRls ((XEiJ.regRn[XEiJ.regOC >> 9 & 15] += 4) - 4)) - y; 11116: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X) | 11117: ((x ^ y) & (x ^ z)) >>> 31 << 1 | 11118: (x & (y ^ z) ^ (y | z)) >>> 31); //ccr_cmp 11119: } else { 11120: int qqq = XEiJ.regOC >> 9 & 7; 11121: int z; 11122: if (ea < XEiJ.EA_AR) { //EOR.L Dq,Dr 11123: XEiJ.mpuCycleCount += 8; 11124: XEiJ.regRn[ea] = z = XEiJ.regRn[ea] ^ XEiJ.regRn[qqq]; 11125: } else { //EOR.L Dq,<mem> 11126: XEiJ.mpuCycleCount += 12; 11127: int a = efaMltLong (ea); 11128: XEiJ.busWl (a, z = XEiJ.busRls (a) ^ XEiJ.regRn[qqq]); 11129: } 11130: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 11131: } 11132: } //irpEorLong 11133: 11134: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11135: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 11136: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 11137: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11138: //CMPA.L <ea>,Aq |-|012346|-|-UUUU|-****|DAM+-WXZPI|1011_qqq_111_mmm_rrr 11139: //CMP.L <ea>,Aq |A|012346|-|-UUUU|-****|DAM+-WXZPI|1011_qqq_111_mmm_rrr [CMPA.L <ea>,Aq] 11140: public static void irpCmpaLong () throws M68kException { 11141: XEiJ.mpuCycleCount += 6; 11142: int ea = XEiJ.regOC & 63; 11143: int y = ea < XEiJ.EA_MM ? XEiJ.regRn[ea] : XEiJ.busRls (efaAnyLong (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ。ここでAqが変化する可能性があることに注意 11144: int x; 11145: int z = (x = XEiJ.regRn[XEiJ.regOC >> 9 & 15]) - y; 11146: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X) | 11147: ((x ^ y) & (x ^ z)) >>> 31 << 1 | 11148: (x & (y ^ z) ^ (y | z)) >>> 31); //ccr_cmp 11149: } //irpCmpaLong 11150: 11151: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11152: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 11153: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 11154: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11155: //AND.B <ea>,Dq |-|012346|-|-UUUU|-**00|D M+-WXZPI|1100_qqq_000_mmm_rrr 11156: public static void irpAndToRegByte () throws M68kException { 11157: XEiJ.mpuCycleCount += 4; 11158: int ea = XEiJ.regOC & 63; 11159: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.MPU_TSTB_TABLE[255 & (XEiJ.regRn[XEiJ.regOC >> 9 & 7] &= ~255 | (ea < XEiJ.EA_AR ? XEiJ.regRn[ea] : XEiJ.busRbs (efaAnyByte (ea))))]; //ccr_tst_byte。1拡張してからAND 11160: } //irpAndToRegByte 11161: 11162: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11163: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 11164: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 11165: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11166: //AND.W <ea>,Dq |-|012346|-|-UUUU|-**00|D M+-WXZPI|1100_qqq_001_mmm_rrr 11167: public static void irpAndToRegWord () throws M68kException { 11168: XEiJ.mpuCycleCount += 4; 11169: int ea = XEiJ.regOC & 63; 11170: int z = XEiJ.regRn[XEiJ.regOC >> 9 & 7] &= ~65535 | (ea < XEiJ.EA_AR ? XEiJ.regRn[ea] : XEiJ.busRws (efaAnyWord (ea))); //1拡張してからAND 11171: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | (char) z - 1 >> 31 & XEiJ.REG_CCR_Z | ((short) z < 0 ? XEiJ.REG_CCR_N : 0); //ccr_tst_word 11172: } //irpAndToRegWord 11173: 11174: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11175: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 11176: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 11177: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11178: //AND.L <ea>,Dq |-|012346|-|-UUUU|-**00|D M+-WXZPI|1100_qqq_010_mmm_rrr 11179: public static void irpAndToRegLong () throws M68kException { 11180: int ea = XEiJ.regOC & 63; 11181: int qqq = XEiJ.regOC >> 9 & 7; 11182: int z; 11183: if (ea < XEiJ.EA_AR) { //AND.L Dr,Dq 11184: XEiJ.mpuCycleCount += 8; 11185: z = XEiJ.regRn[qqq] &= XEiJ.regRn[ea]; 11186: } else { //AND.L <mem>,Dq 11187: XEiJ.mpuCycleCount += ea == XEiJ.EA_IM ? 8 : 6; //ソースが#<data>のとき2増やす 11188: z = XEiJ.regRn[qqq] &= XEiJ.busRls (efaAnyLong (ea)); 11189: } 11190: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 11191: } //irpAndToRegLong 11192: 11193: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11194: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 11195: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 11196: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11197: //MULU.W <ea>,Dq |-|012346|-|-UUUU|-***0|D M+-WXZPI|1100_qqq_011_mmm_rrr 11198: public static void irpMuluWord () throws M68kException { 11199: int ea = XEiJ.regOC & 63; 11200: int qqq = XEiJ.regOC >> 9 & 7; 11201: int y = ea < XEiJ.EA_AR ? (char) XEiJ.regRn[ea] : XEiJ.busRwz (efaAnyWord (ea)); 11202: //muluの所要サイクル数は38+2n 11203: //nはソースに含まれる1の数 11204: int s = y & 0x5555; 11205: s += y - s >> 1; 11206: int t = s & 0x3333; 11207: t += s - t >> 2; 11208: t += t >> 4; 11209: XEiJ.mpuCycleCount += 38 + (((t & 15) + (t >> 8 & 15)) << 1); //38+2n 11210: //XEiJ.mpuCycleCount += 38 + (Integer.bitCount (y) << 1); //少し遅くなる 11211: int z; 11212: XEiJ.regRn[qqq] = z = (char) XEiJ.regRn[qqq] * y; //積の下位32ビット。オーバーフローは無視 11213: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 11214: } //irpMuluWord 11215: 11216: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11217: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 11218: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 11219: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11220: //ABCD.B Dr,Dq |-|012346|-|UUUUU|*U*U*| |1100_qqq_100_000_rrr 11221: //ABCD.B -(Ar),-(Aq) |-|012346|-|UUUUU|*U*U*| |1100_qqq_100_001_rrr 11222: //AND.B Dq,<ea> |-|012346|-|-UUUU|-**00| M+-WXZ |1100_qqq_100_mmm_rrr 11223: public static void irpAndToMemByte () throws M68kException { 11224: int ea = XEiJ.regOC & 63; 11225: if (ea >= XEiJ.EA_MM) { //AND.B Dq,<ea> 11226: XEiJ.mpuCycleCount += 8; 11227: int a = efaMltByte (ea); 11228: int z = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & XEiJ.busRbs (a); 11229: XEiJ.busWb (a, z); 11230: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.MPU_TSTB_TABLE[255 & z]; //ccr_tst_byte 11231: } else if (ea < XEiJ.EA_AR) { //ABCD.B Dr,Dq 11232: int qqq = XEiJ.regOC >> 9 & 7; 11233: XEiJ.mpuCycleCount += 6; 11234: XEiJ.regRn[qqq] = ~0xff & XEiJ.regRn[qqq] | irpAbcd (XEiJ.regRn[qqq], XEiJ.regRn[ea]); 11235: } else { //ABCD.B -(Ar),-(Aq) 11236: XEiJ.mpuCycleCount += 18; 11237: int y = XEiJ.busRbz (--XEiJ.regRn[ea]); //このr[ea]はアドレスレジスタ 11238: int a = --XEiJ.regRn[(XEiJ.regOC >> 9) - (96 - 8)]; 11239: XEiJ.busWb (a, irpAbcd (XEiJ.busRbz (a), y)); 11240: } 11241: } //irpAndToMemByte 11242: 11243: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11244: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 11245: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 11246: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11247: //EXG.L Dq,Dr |-|012346|-|-----|-----| |1100_qqq_101_000_rrr 11248: //EXG.L Aq,Ar |-|012346|-|-----|-----| |1100_qqq_101_001_rrr 11249: //AND.W Dq,<ea> |-|012346|-|-UUUU|-**00| M+-WXZ |1100_qqq_101_mmm_rrr 11250: public static void irpAndToMemWord () throws M68kException { 11251: int ea = XEiJ.regOC & 63; 11252: if (ea < XEiJ.EA_MM) { //EXG 11253: XEiJ.mpuCycleCount += 6; 11254: if (ea < XEiJ.EA_AR) { //EXG.L Dq,Dr 11255: int qqq = XEiJ.regOC >> 9 & 7; 11256: int t = XEiJ.regRn[qqq]; 11257: XEiJ.regRn[qqq] = XEiJ.regRn[ea]; 11258: XEiJ.regRn[ea] = t; 11259: } else { //EXG.L Aq,Ar 11260: int aqq = (XEiJ.regOC >> 9) - (96 - 8); 11261: int t = XEiJ.regRn[aqq]; 11262: XEiJ.regRn[aqq] = XEiJ.regRn[ea]; //このr[ea]アドレスレジスタ 11263: XEiJ.regRn[ea] = t; //このr[ea]はアドレスレジスタ 11264: } 11265: } else { //AND.W Dq,<ea> 11266: XEiJ.mpuCycleCount += 8; 11267: int a = efaMltWord (ea); 11268: int z = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & XEiJ.busRws (a); 11269: XEiJ.busWw (a, z); 11270: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | (char) z - 1 >> 31 & XEiJ.REG_CCR_Z | ((short) z < 0 ? XEiJ.REG_CCR_N : 0); //ccr_tst_word 11271: } 11272: } //irpAndToMemWord 11273: 11274: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11275: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 11276: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 11277: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11278: //EXG.L Dq,Ar |-|012346|-|-----|-----| |1100_qqq_110_001_rrr 11279: //AND.L Dq,<ea> |-|012346|-|-UUUU|-**00| M+-WXZ |1100_qqq_110_mmm_rrr 11280: public static void irpAndToMemLong () throws M68kException { 11281: int ea = XEiJ.regOC & 63; 11282: int qqq = XEiJ.regOC >> 9 & 7; 11283: if (ea >> 3 == XEiJ.MMM_AR) { //EXG.L Dq,Ar 11284: XEiJ.mpuCycleCount += 6; 11285: int t = XEiJ.regRn[qqq]; 11286: XEiJ.regRn[qqq] = XEiJ.regRn[ea]; //このr[ea]はアドレスレジスタ 11287: XEiJ.regRn[ea] = t; //このr[ea]はアドレスレジスタ 11288: } else { //AND.L Dq,<ea> 11289: XEiJ.mpuCycleCount += 12; 11290: int a = efaMltLong (ea); 11291: int z; 11292: XEiJ.busWl (a, z = XEiJ.busRls (a) & XEiJ.regRn[qqq]); 11293: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 11294: } 11295: } //irpAndToMemLong 11296: 11297: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11298: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 11299: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 11300: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11301: //MULS.W <ea>,Dq |-|012346|-|-UUUU|-***0|D M+-WXZPI|1100_qqq_111_mmm_rrr 11302: public static void irpMulsWord () throws M68kException { 11303: int ea = XEiJ.regOC & 63; 11304: int qqq = XEiJ.regOC >> 9 & 7; 11305: int y = ea < XEiJ.EA_AR ? (short) XEiJ.regRn[ea] : XEiJ.busRws (efaAnyWord (ea)); 11306: int t = y << 1 ^ y; //右側が1である0と右側が0または末尾である1は1、それ以外は0。ソースは符号拡張されているので上位16ビットはすべて0 11307: //mulsの所要サイクル数は38+2n 11308: //nはソースの末尾に0を付け加えた17ビットに含まれる10または01の数 11309: int s = t & 0x5555; 11310: s += t - s >> 1; 11311: t = s & 0x3333; 11312: t += s - t >> 2; 11313: t += t >> 4; 11314: XEiJ.mpuCycleCount += 38 + (((t & 15) + (t >> 8 & 15)) << 1); //38+2n 11315: int z; 11316: XEiJ.regRn[qqq] = z = (short) XEiJ.regRn[qqq] * y; //積の下位32ビット。オーバーフローは無視 11317: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X); //ccr_tst 11318: } //irpMulsWord 11319: 11320: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11321: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 11322: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 11323: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11324: //ADD.B <ea>,Dq |-|012346|-|UUUUU|*****|D M+-WXZPI|1101_qqq_000_mmm_rrr 11325: public static void irpAddToRegByte () throws M68kException { 11326: XEiJ.mpuCycleCount += 4; 11327: int ea = XEiJ.regOC & 63; 11328: int qqq = XEiJ.regOC >> 9 & 7; 11329: int x, y, z; 11330: y = ea < XEiJ.EA_AR ? XEiJ.regRn[ea] : XEiJ.busRbs (efaAnyByte (ea)); 11331: x = XEiJ.regRn[qqq]; 11332: z = x + y; 11333: XEiJ.regRn[qqq] = ~255 & x | 255 & z; 11334: XEiJ.regCCR = (XEiJ.MPU_TSTB_TABLE[255 & z] | 11335: ((x ^ z) & (y ^ z)) >> 6 & XEiJ.REG_CCR_V | 11336: (byte) ((x | y) ^ (x ^ y) & z) >> 7 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_add_byte 11337: } //irpAddToRegByte 11338: 11339: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11340: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 11341: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 11342: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11343: //ADD.W <ea>,Dq |-|012346|-|UUUUU|*****|DAM+-WXZPI|1101_qqq_001_mmm_rrr 11344: public static void irpAddToRegWord () throws M68kException { 11345: XEiJ.mpuCycleCount += 4; 11346: int ea = XEiJ.regOC & 63; 11347: int qqq = XEiJ.regOC >> 9 & 7; 11348: int x, y, z; 11349: y = ea < XEiJ.EA_MM ? XEiJ.regRn[ea] : XEiJ.busRws (efaAnyWord (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ 11350: x = XEiJ.regRn[qqq]; 11351: z = x + y; 11352: XEiJ.regRn[qqq] = ~65535 & x | (char) z; 11353: XEiJ.regCCR = (z >> 12 & XEiJ.REG_CCR_N | (char) z - 1 >> 14 & XEiJ.REG_CCR_Z | 11354: ((x ^ z) & (y ^ z)) >> 14 & XEiJ.REG_CCR_V | 11355: (short) ((x | y) ^ (x ^ y) & z) >> 15 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_add_word 11356: } //irpAddToRegWord 11357: 11358: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11359: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 11360: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 11361: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11362: //ADD.L <ea>,Dq |-|012346|-|UUUUU|*****|DAM+-WXZPI|1101_qqq_010_mmm_rrr 11363: public static void irpAddToRegLong () throws M68kException { 11364: int ea = XEiJ.regOC & 63; 11365: int qqq = XEiJ.regOC >> 9 & 7; 11366: XEiJ.mpuCycleCount += ea < XEiJ.EA_MM || ea == XEiJ.EA_IM ? 8 : 6; //ソースが#<data>のとき2増やす 11367: int x, y, z; 11368: y = ea < XEiJ.EA_MM ? XEiJ.regRn[ea] : XEiJ.busRls (efaAnyLong (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ 11369: x = XEiJ.regRn[qqq]; 11370: z = x + y; 11371: XEiJ.regRn[qqq] = z; 11372: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | 11373: ((x ^ z) & (y ^ z)) >> 30 & XEiJ.REG_CCR_V | 11374: ((x | y) ^ (x ^ y) & z) >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_add 11375: } //irpAddToRegLong 11376: 11377: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11378: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 11379: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 11380: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11381: //ADDA.W <ea>,Aq |-|012346|-|-----|-----|DAM+-WXZPI|1101_qqq_011_mmm_rrr 11382: //ADD.W <ea>,Aq |A|012346|-|-----|-----|DAM+-WXZPI|1101_qqq_011_mmm_rrr [ADDA.W <ea>,Aq] 11383: // 11384: //ADDA.W <ea>,Aq 11385: // ソースを符号拡張してロングで加算する 11386: public static void irpAddaWord () throws M68kException { 11387: XEiJ.mpuCycleCount += 8; 11388: int ea = XEiJ.regOC & 63; 11389: int z = ea < XEiJ.EA_MM ? (short) XEiJ.regRn[ea] : XEiJ.busRws (efaAnyWord (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ。ここでAqが変化する可能性があることに注意 11390: XEiJ.regRn[XEiJ.regOC >> 9 & 15] += z; //r[op >> 9 & 15] += ea < XEiJ.EA_MM ? (short) r[ea] : rws (efaAnyWord (ea));は不可 11391: //ccrは変化しない 11392: } //irpAddaWord 11393: 11394: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11395: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 11396: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 11397: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11398: //ADDX.B Dr,Dq |-|012346|-|*UUUU|*****| |1101_qqq_100_000_rrr 11399: //ADDX.B -(Ar),-(Aq) |-|012346|-|*UUUU|*****| |1101_qqq_100_001_rrr 11400: //ADD.B Dq,<ea> |-|012346|-|UUUUU|*****| M+-WXZ |1101_qqq_100_mmm_rrr 11401: public static void irpAddToMemByte () throws M68kException { 11402: int ea = XEiJ.regOC & 63; 11403: int a, x, y, z; 11404: if (ea < XEiJ.EA_MM) { 11405: if (ea < XEiJ.EA_AR) { //ADDX.B Dr,Dq 11406: int qqq = XEiJ.regOC >> 9 & 7; 11407: XEiJ.mpuCycleCount += 4; 11408: y = XEiJ.regRn[ea]; 11409: x = XEiJ.regRn[qqq]; 11410: z = x + y + (XEiJ.regCCR >> 4); //Xの左側はすべて0なのでCCR_X&を省略 11411: XEiJ.regRn[qqq] = ~255 & x | 255 & z; 11412: } else { //ADDX.B -(Ar),-(Aq) 11413: XEiJ.mpuCycleCount += 18; 11414: y = XEiJ.busRbs (--XEiJ.regRn[ea]); //このr[ea]はアドレスレジスタ 11415: a = --XEiJ.regRn[XEiJ.regOC >> 9 & 15]; //1qqq=aqq 11416: x = XEiJ.busRbs (a); 11417: z = x + y + (XEiJ.regCCR >> 4); //Xの左側はすべて0なのでCCR_X&を省略 11418: XEiJ.busWb (a, z); 11419: } 11420: XEiJ.regCCR = (z >> 4 & XEiJ.REG_CCR_N | (255 & z) - 1 >> 6 & XEiJ.regCCR & XEiJ.REG_CCR_Z | //ADDXはZをクリアすることはあるがセットすることはない 11421: ((x ^ z) & (y ^ z)) >> 6 & XEiJ.REG_CCR_V | 11422: (byte) ((x | y) ^ (x ^ y) & z) >> 7 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_addx_byte 11423: } else { //ADD.B Dq,<ea> 11424: XEiJ.mpuCycleCount += 8; 11425: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7]; 11426: a = efaMltByte (ea); 11427: x = XEiJ.busRbs (a); 11428: z = x + y; 11429: XEiJ.busWb (a, z); 11430: XEiJ.regCCR = (XEiJ.MPU_TSTB_TABLE[255 & z] | 11431: ((x ^ z) & (y ^ z)) >> 6 & XEiJ.REG_CCR_V | 11432: (byte) ((x | y) ^ (x ^ y) & z) >> 7 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_add_byte 11433: } 11434: } //irpAddToMemByte 11435: 11436: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11437: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 11438: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 11439: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11440: //ADDX.W Dr,Dq |-|012346|-|*UUUU|*****| |1101_qqq_101_000_rrr 11441: //ADDX.W -(Ar),-(Aq) |-|012346|-|*UUUU|*****| |1101_qqq_101_001_rrr 11442: //ADD.W Dq,<ea> |-|012346|-|UUUUU|*****| M+-WXZ |1101_qqq_101_mmm_rrr 11443: public static void irpAddToMemWord () throws M68kException { 11444: int ea = XEiJ.regOC & 63; 11445: int a, x, y, z; 11446: if (ea < XEiJ.EA_MM) { 11447: if (ea < XEiJ.EA_AR) { //ADDX.W Dr,Dq 11448: int qqq = XEiJ.regOC >> 9 & 7; 11449: XEiJ.mpuCycleCount += 4; 11450: y = XEiJ.regRn[ea]; 11451: x = XEiJ.regRn[qqq]; 11452: z = x + y + (XEiJ.regCCR >> 4); //Xの左側はすべて0なのでCCR_X&を省略 11453: XEiJ.regRn[qqq] = ~65535 & x | (char) z; 11454: } else { //ADDX.W -(Ar),-(Aq) 11455: XEiJ.mpuCycleCount += 18; 11456: y = XEiJ.busRws (XEiJ.regRn[ea] -= 2); //このr[ea]はアドレスレジスタ 11457: a = XEiJ.regRn[XEiJ.regOC >> 9 & 15] -= 2; 11458: x = XEiJ.busRws (a); 11459: z = x + y + (XEiJ.regCCR >> 4); //Xの左側はすべて0なのでCCR_X&を省略 11460: XEiJ.busWw (a, z); 11461: } 11462: XEiJ.regCCR = (z >> 12 & XEiJ.REG_CCR_N | (char) z - 1 >> 14 & XEiJ.regCCR & XEiJ.REG_CCR_Z | //ADDXはZをクリアすることはあるがセットすることはない 11463: ((x ^ z) & (y ^ z)) >> 14 & XEiJ.REG_CCR_V | 11464: (short) ((x | y) ^ (x ^ y) & z) >> 15 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_addx_word 11465: } else { //ADD.W Dq,<ea> 11466: XEiJ.mpuCycleCount += 8; 11467: a = efaMltWord (ea); 11468: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7]; 11469: x = XEiJ.busRws (a); 11470: z = x + y; 11471: XEiJ.busWw (a, z); 11472: XEiJ.regCCR = (z >> 12 & XEiJ.REG_CCR_N | (char) z - 1 >> 14 & XEiJ.REG_CCR_Z | 11473: ((x ^ z) & (y ^ z)) >> 14 & XEiJ.REG_CCR_V | 11474: (short) ((x | y) ^ (x ^ y) & z) >> 15 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_add_word 11475: } 11476: } //irpAddToMemWord 11477: 11478: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11479: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 11480: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 11481: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11482: //ADDX.L Dr,Dq |-|012346|-|*UUUU|*****| |1101_qqq_110_000_rrr 11483: //ADDX.L -(Ar),-(Aq) |-|012346|-|*UUUU|*****| |1101_qqq_110_001_rrr 11484: //ADD.L Dq,<ea> |-|012346|-|UUUUU|*****| M+-WXZ |1101_qqq_110_mmm_rrr 11485: public static void irpAddToMemLong () throws M68kException { 11486: int ea = XEiJ.regOC & 63; 11487: if (ea < XEiJ.EA_MM) { 11488: int x; 11489: int y; 11490: int z; 11491: if (ea < XEiJ.EA_AR) { //ADDX.L Dr,Dq 11492: int qqq = XEiJ.regOC >> 9 & 7; 11493: XEiJ.mpuCycleCount += 8; 11494: XEiJ.regRn[qqq] = z = (x = XEiJ.regRn[qqq]) + (y = XEiJ.regRn[ea]) + (XEiJ.regCCR >> 4); //Xの左側はすべて0なのでCCR_X&を省略 11495: } else { //ADDX.L -(Ar),-(Aq) 11496: XEiJ.mpuCycleCount += 30; 11497: y = XEiJ.busRls (XEiJ.regRn[ea] -= 4); //このr[ea]はアドレスレジスタ 11498: int a = XEiJ.regRn[XEiJ.regOC >> 9 & 15] -= 4; 11499: XEiJ.busWl (a, z = (x = XEiJ.busRls (a)) + y + (XEiJ.regCCR >> 4)); //Xの左側はすべて0なのでCCR_X&を省略 11500: } 11501: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_Z : 0) | 11502: ((x ^ z) & (y ^ z)) >>> 31 << 1 | 11503: ((x | y) ^ (x ^ y) & z) >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_addx 11504: } else { //ADD.L Dq,<ea> 11505: XEiJ.mpuCycleCount += 12; 11506: int a = efaMltLong (ea); 11507: int x; 11508: int y; 11509: int z; 11510: XEiJ.busWl (a, z = (x = XEiJ.busRls (a)) + (y = XEiJ.regRn[XEiJ.regOC >> 9 & 7])); 11511: XEiJ.regCCR = (z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | 11512: ((x ^ z) & (y ^ z)) >>> 31 << 1 | 11513: ((x | y) ^ (x ^ y) & z) >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //ccr_add 11514: } 11515: } //irpAddToMemLong 11516: 11517: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11518: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 11519: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 11520: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11521: //ADDA.L <ea>,Aq |-|012346|-|-----|-----|DAM+-WXZPI|1101_qqq_111_mmm_rrr 11522: //ADD.L <ea>,Aq |A|012346|-|-----|-----|DAM+-WXZPI|1101_qqq_111_mmm_rrr [ADDA.L <ea>,Aq] 11523: public static void irpAddaLong () throws M68kException { 11524: int ea = XEiJ.regOC & 63; 11525: XEiJ.mpuCycleCount += ea < XEiJ.EA_MM || ea == XEiJ.EA_IM ? 8 : 6; //Dr/Ar/#<data>のとき8+、それ以外は6+ 11526: int z = ea < XEiJ.EA_MM ? XEiJ.regRn[ea] : XEiJ.busRls (efaAnyLong (ea)); //このr[ea]はデータレジスタまたはアドレスレジスタ。ここでAqが変化する可能性があることに注意 11527: XEiJ.regRn[XEiJ.regOC >> 9 & 15] += z; //r[op >> 9 & 15] += ea < XEiJ.EA_MM ? r[ea] : rls (efaAnyLong (ea));は不可 11528: //ccrは変化しない 11529: } //irpAddaLong 11530: 11531: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11532: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 11533: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 11534: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11535: //ASR.B #<data>,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_000_000_rrr 11536: //LSR.B #<data>,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_000_001_rrr 11537: //ROXR.B #<data>,Dr |-|012346|-|*UUUU|***0*| |1110_qqq_000_010_rrr 11538: //ROR.B #<data>,Dr |-|012346|-|-UUUU|-**0*| |1110_qqq_000_011_rrr 11539: //ASR.B Dq,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_000_100_rrr 11540: //LSR.B Dq,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_000_101_rrr 11541: //ROXR.B Dq,Dr |-|012346|-|*UUUU|***0*| |1110_qqq_000_110_rrr 11542: //ROR.B Dq,Dr |-|012346|-|-UUUU|-**0*| |1110_qqq_000_111_rrr 11543: //ASR.B Dr |A|012346|-|UUUUU|***0*| |1110_001_000_000_rrr [ASR.B #1,Dr] 11544: //LSR.B Dr |A|012346|-|UUUUU|***0*| |1110_001_000_001_rrr [LSR.B #1,Dr] 11545: //ROXR.B Dr |A|012346|-|*UUUU|***0*| |1110_001_000_010_rrr [ROXR.B #1,Dr] 11546: //ROR.B Dr |A|012346|-|-UUUU|-**0*| |1110_001_000_011_rrr [ROR.B #1,Dr] 11547: // 11548: //ASR.B #<data>,Dr 11549: //ASR.B Dq,Dr 11550: // 算術右シフトバイト 11551: // ........................アイウエオカキク XNZVC 11552: // 0 ........................アイウエオカキク Xア*00 Z=アイウエオカキク==0 11553: // 1 ........................アアイウエオカキ クア*0ク Z=アイウエオカキ==0 11554: // 2 ........................アアアイウエオカ キア*0キ Z=アイウエオカ==0 11555: // 3 ........................アアアアイウエオ カア*0カ Z=アイウエオ==0 11556: // 4 ........................アアアアアイウエ オア*0オ Z=アイウエ==0 11557: // 5 ........................アアアアアアイウ エア*0エ Z=アイウ==0 11558: // 6 ........................アアアアアアアイ ウア*0ウ Z=アイ==0 11559: // 7 ........................アアアアアアアア イア*0イ Z=ア==0 11560: // 8 ........................アアアアアアアア アア*0ア Z=ア==0 11561: // CCR 11562: // X countが0のとき変化しない。他は最後に押し出されたビット 11563: // N 結果の最上位ビット 11564: // Z 結果が0のときセット。他はクリア 11565: // V 常にクリア 11566: // C countが0のときクリア。他は最後に押し出されたビット 11567: // 11568: //LSR.B #<data>,Dr 11569: //LSR.B Dq,Dr 11570: // 論理右シフトバイト 11571: // ........................アイウエオカキク XNZVC 11572: // 0 ........................アイウエオカキク Xア*00 Z=アイウエオカキク==0 11573: // 1 ........................0アイウエオカキ ク0*0ク Z=アイウエオカキ==0 11574: // 2 ........................00アイウエオカ キ0*0キ Z=アイウエオカ==0 11575: // 3 ........................000アイウエオ カ0*0カ Z=アイウエオ==0 11576: // 4 ........................0000アイウエ オ0*0オ Z=アイウエ==0 11577: // 5 ........................00000アイウ エ0*0エ Z=アイウ==0 11578: // 6 ........................000000アイ ウ0*0ウ Z=アイ==0 11579: // 7 ........................0000000ア イ0*0イ Z=ア==0 11580: // 8 ........................00000000 ア010ア 11581: // 9 ........................00000000 00100 11582: // CCR 11583: // X countが0のとき変化しない。他は最後に押し出されたビット 11584: // N 結果の最上位ビット 11585: // Z 結果が0のときセット。他はクリア 11586: // V 常にクリア 11587: // C countが0のときクリア。他は最後に押し出されたビット 11588: // 11589: //ROR.B #<data>,Dr 11590: //ROR.B Dq,Dr 11591: // 右ローテートバイト 11592: // ........................アイウエオカキク XNZVC 11593: // 0 ........................アイウエオカキク Xア*00 Z=アイウエオカキク==0 11594: // 1 ........................クアイウエオカキ Xク*0ク Z=アイウエオカキク==0 11595: // : 11596: // 7 ........................イウエオカキクア Xイ*0イ Z=アイウエオカキク==0 11597: // 8 ........................アイウエオカキク Xア*0ア Z=アイウエオカキク==0 11598: // CCR 11599: // X 常に変化しない 11600: // N 結果の最上位ビット 11601: // Z 結果が0のときセット。他はクリア 11602: // V 常にクリア 11603: // C countが0のときクリア。他は結果の最上位ビット 11604: // 11605: //ROXR.B #<data>,Dr 11606: //ROXR.B Dq,Dr 11607: // 拡張右ローテートバイト 11608: // ........................アイウエオカキク XNZVC 11609: // 0 ........................アイウエオカキク Xア*0X Z=アイウエオカキク==0 11610: // 1 ........................Xアイウエオカキ クX*0ク Z=アイウエオカキX==0 11611: // 2 ........................クXアイウエオカ キク*0キ Z=アイウエオカクX==0 11612: // 3 ........................キクXアイウエオ カキ*0カ Z=アイウエオキクX==0 11613: // 4 ........................カキクXアイウエ オカ*0オ Z=アイウエカキクX==0 11614: // 5 ........................オカキクXアイウ エオ*0エ Z=アイウオカキクX==0 11615: // 6 ........................エオカキクXアイ ウエ*0ウ Z=アイエオカキクX==0 11616: // 7 ........................ウエオカキクXア イウ*0イ Z=アウエオカキクX==0 11617: // 8 ........................イウエオカキクX アイ*0ア Z=イウエオカキクX==0 11618: // 9 ........................アイウエオカキク Xア*0X Z=アイウエオカキク==0 11619: // CCR 11620: // X countが0のとき変化しない。他は最後に押し出されたビット 11621: // N 結果の最上位ビット 11622: // Z 結果が0のときセット。他はクリア 11623: // V 常にクリア 11624: // C countが0のときXのコピー。他は最後に押し出されたビット 11625: public static void irpXxrToRegByte () throws M68kException { 11626: int rrr; 11627: int x = XEiJ.regRn[rrr = XEiJ.regOC & 7]; 11628: int y; 11629: int z; 11630: int t; 11631: switch (XEiJ.regOC >> 3 & 0b111_000 >> 3) { 11632: case 0b000_000 >> 3: //ASR.B #<data>,Dr 11633: XEiJ.mpuCycleCount += 6 + 2 + ((y = (XEiJ.regOC >> 9) - 1 & 7) << 1); //y=data-1=1-1~8-1 11634: XEiJ.regRn[rrr] = ~0xff & x | 0xff & (z = (t = (byte) x >> y) >> 1); 11635: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | -(t & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 11636: break; 11637: case 0b001_000 >> 3: //LSR.B #<data>,Dr 11638: XEiJ.mpuCycleCount += 6 + 2 + ((y = (XEiJ.regOC >> 9) - 1 & 7) << 1); //y=data-1=1-1~8-1 11639: XEiJ.regRn[rrr] = ~0xff & x | (z = (t = (0xff & x) >>> y) >>> 1); 11640: XEiJ.regCCR = (z == 0 ? XEiJ.REG_CCR_Z : 0) | -(t & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 11641: break; 11642: case 0b010_000 >> 3: //ROXR.B #<data>,Dr 11643: XEiJ.mpuCycleCount += 6 + 2 + ((y = (XEiJ.regOC >> 9) - 1 & 7) << 1); //y=data-1=1-1~8-1 11644: z = (XEiJ.regCCR & XEiJ.REG_CCR_X) << 7 - 4 | (0xff & x) >>> 1; 11645: if (y == 1 - 1) { //y=data-1=1-1 11646: t = x; 11647: } else { //y=data-1=2-1~8-1 11648: z = x << 9 - 1 - y | (t = z >>> y - (2 - 1)) >>> 1; 11649: } 11650: XEiJ.regRn[rrr] = ~0xff & x | 0xff & (z = (byte) z); 11651: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | -(t & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 11652: break; 11653: case 0b011_000 >> 3: //ROR.B #<data>,Dr 11654: XEiJ.mpuCycleCount += 6 + 2 + ((y = (XEiJ.regOC >> 9) - 1 & 7) << 1); //y=data-1=1-1~8-1 11655: XEiJ.regRn[rrr] = ~0xff & x | 0xff & (z = (byte) (x << 7 - y | (0xff & x) >>> y + 1)); 11656: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X) | z >>> 7 & 1; //Xは変化しない。Cは結果の最上位ビット 11657: break; 11658: case 0b100_000 >> 3: //ASR.B Dq,Dr 11659: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & 63; //y=0~63。Javaのシフト演算子は5ビットでマスクされることに注意 11660: XEiJ.mpuCycleCount += 6 + (y << 1); 11661: if (y == 0) { //y=data=0 11662: z = (byte) x; 11663: t = XEiJ.regCCR & XEiJ.REG_CCR_X; //Xは変化しない。Cはクリア 11664: } else { //y=data=1~63 11665: XEiJ.regRn[rrr] = ~0xff & x | 0xff & (z = (t = (byte) x >> (y <= 8 ? y - 1 : 7)) >> 1); 11666: t = -(t & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 11667: } 11668: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | t; 11669: break; 11670: case 0b101_000 >> 3: //LSR.B Dq,Dr 11671: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & 63; //y=0~63。Javaのシフト演算子は5ビットでマスクされることに注意 11672: XEiJ.mpuCycleCount += 6 + (y << 1); 11673: if (y == 0) { //y=data=0 11674: z = (byte) x; 11675: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | (z < 0 ? XEiJ.REG_CCR_N : z == 0 ? XEiJ.REG_CCR_Z : 0); //Xは変化しない。Cはクリア 11676: } else { //y=data=1~63 11677: XEiJ.regRn[rrr] = ~0xff & x | (z = (t = y <= 8 ? (0xff & x) >>> y - 1 : 0) >>> 1); 11678: XEiJ.regCCR = (z == 0 ? XEiJ.REG_CCR_Z : 0) | -(t & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 11679: } 11680: break; 11681: case 0b110_000 >> 3: //ROXR.B Dq,Dr 11682: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & 63; //y=0~63。Javaのシフト演算子は5ビットでマスクされることに注意 11683: XEiJ.mpuCycleCount += 6 + (y << 1); 11684: //y %= 9; 11685: y = (y & 7) - (y >> 3); //y=data=-7~7 11686: y += y >> 3 & 9; //y=data=0~8 11687: if (y == 0) { //y=data=0 11688: z = (byte) x; 11689: t = -(XEiJ.regCCR >> 4 & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //Xは変化しない。CはXのコピー 11690: } else { //y=data=1~8 11691: z = (XEiJ.regCCR & XEiJ.REG_CCR_X) << 7 - 4 | (0xff & x) >>> 1; 11692: if (y == 1) { //y=data=1 11693: t = x; //Cは最後に押し出されたビット 11694: } else { //y=data=2~8 11695: z = x << 9 - y | (t = z >>> y - 2) >>> 1; 11696: } 11697: XEiJ.regRn[rrr] = ~0xff & x | 0xff & (z = (byte) z); 11698: t = -(t & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 11699: } 11700: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | t; 11701: break; 11702: case 0b111_000 >> 3: //ROR.B Dq,Dr 11703: default: 11704: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & 63; //y=0~63。Javaのシフト演算子は5ビットでマスクされることに注意 11705: XEiJ.mpuCycleCount += 6 + (y << 1); 11706: if (y == 0) { 11707: z = (byte) x; 11708: t = 0; //Cはクリア 11709: } else { 11710: y &= 7; //y=data=0~7 11711: XEiJ.regRn[rrr] = ~0xff & x | 0xff & (z = (byte) (x << 8 - y | (0xff & x) >>> y)); 11712: t = z >>> 7 & 1; //Cは結果の最上位ビット 11713: } 11714: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X) | t; //Xは変化しない 11715: } 11716: } //irpXxrToRegByte 11717: 11718: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11719: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 11720: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 11721: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11722: //ASR.W #<data>,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_001_000_rrr 11723: //LSR.W #<data>,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_001_001_rrr 11724: //ROXR.W #<data>,Dr |-|012346|-|*UUUU|***0*| |1110_qqq_001_010_rrr 11725: //ROR.W #<data>,Dr |-|012346|-|-UUUU|-**0*| |1110_qqq_001_011_rrr 11726: //ASR.W Dq,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_001_100_rrr 11727: //LSR.W Dq,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_001_101_rrr 11728: //ROXR.W Dq,Dr |-|012346|-|*UUUU|***0*| |1110_qqq_001_110_rrr 11729: //ROR.W Dq,Dr |-|012346|-|-UUUU|-**0*| |1110_qqq_001_111_rrr 11730: //ASR.W Dr |A|012346|-|UUUUU|***0*| |1110_001_001_000_rrr [ASR.W #1,Dr] 11731: //LSR.W Dr |A|012346|-|UUUUU|***0*| |1110_001_001_001_rrr [LSR.W #1,Dr] 11732: //ROXR.W Dr |A|012346|-|*UUUU|***0*| |1110_001_001_010_rrr [ROXR.W #1,Dr] 11733: //ROR.W Dr |A|012346|-|-UUUU|-**0*| |1110_001_001_011_rrr [ROR.W #1,Dr] 11734: // 11735: //ASR.W #<data>,Dr 11736: //ASR.W Dq,Dr 11737: //ASR.W <ea> 11738: // 算術右シフトワード 11739: // ................アイウエオカキクケコサシスセソタ XNZVC 11740: // 0 ................アイウエオカキクケコサシスセソタ Xア*00 Z=アイウエオカキクケコサシスセソタ==0 11741: // 1 ................アアイウエオカキクケコサシスセソ タア*0タ Z=アイウエオカキクケコサシスセソ==0 11742: // : 11743: // 15 ................アアアアアアアアアアアアアアアア イア*0イ Z=ア==0 11744: // 16 ................アアアアアアアアアアアアアアアア アア*0ア Z=ア==0 11745: // CCR 11746: // X countが0のとき変化しない。他は最後に押し出されたビット 11747: // N 結果の最上位ビット 11748: // Z 結果が0のときセット。他はクリア 11749: // V 常にクリア 11750: // C countが0のときクリア。他は最後に押し出されたビット 11751: // 11752: //LSR.W #<data>,Dr 11753: //LSR.W Dq,Dr 11754: //LSR.W <ea> 11755: // 論理右シフトワード 11756: // ................アイウエオカキクケコサシスセソタ XNZVC 11757: // 0 ................アイウエオカキクケコサシスセソタ Xア*00 Z=アイウエオカキクケコサシスセソタ==0 11758: // 1 ................0アイウエオカキクケコサシスセソ タ0*0タ Z=アイウエオカキクケコサシスセソ==0 11759: // : 11760: // 15 ................000000000000000ア イ0*0イ Z=ア==0 11761: // 16 ................0000000000000000 ア010ア 11762: // 17 ................0000000000000000 00100 11763: // CCR 11764: // X countが0のとき変化しない。他は最後に押し出されたビット 11765: // N 結果の最上位ビット 11766: // Z 結果が0のときセット。他はクリア 11767: // V 常にクリア 11768: // C countが0のときクリア。他は最後に押し出されたビット 11769: // 11770: //ROR.W #<data>,Dr 11771: //ROR.W Dq,Dr 11772: //ROR.W <ea> 11773: // 右ローテートワード 11774: // ................アイウエオカキクケコサシスセソタ XNZVC 11775: // 0 ................アイウエオカキクケコサシスセソタ Xア*00 Z=アイウエオカキクケコサシスセソタ==0 11776: // 1 ................タアイウエオカキクケコサシスセソ Xタ*0タ Z=アイウエオカキクケコサシスセソタ==0 11777: // : 11778: // 15 ................イウエオカキクケコサシスセソタア Xイ*0イ Z=アイウエオカキクケコサシスセソタ==0 11779: // 16 ................アイウエオカキクケコサシスセソタ Xア*0ア Z=アイウエオカキクケコサシスセソタ==0 11780: // CCR 11781: // X 常に変化しない 11782: // N 結果の最上位ビット 11783: // Z 結果が0のときセット。他はクリア 11784: // V 常にクリア 11785: // C countが0のときクリア。他は結果の最上位ビット 11786: // 11787: //ROXR.W #<data>,Dr 11788: //ROXR.W Dq,Dr 11789: //ROXR.W <ea> 11790: // 拡張右ローテートワード 11791: // ................アイウエオカキクケコサシスセソタ XNZVC 11792: // 0 ................アイウエオカキクケコサシスセソタ Xア*0X Z=アイウエオカキクケコサシスセソタ==0 11793: // 1 ................Xアイウエオカキクケコサシスセソ タX*0タ Z=アイウエオカキクケコサシスセソX==0 11794: // 2 ................タXアイウエオカキクケコサシスセ ソタ*0ソ Z=アイウエオカキクケコサシスセタX==0 11795: // : 11796: // 15 ................ウエオカキクケコサシスセソタXア イウ*0イ Z=アウエオカキクケコサシスセソタX==0 11797: // 16 ................イウエオカキクケコサシスセソタX アイ*0ア Z=イウエオカキクケコサシスセソタX==0 11798: // 17 ................アイウエオカキクケコサシスセソタ Xア*0X Z=アイウエオカキクケコサシスセソタ==0 11799: // CCR 11800: // X countが0のとき変化しない。他は最後に押し出されたビット 11801: // N 結果の最上位ビット 11802: // Z 結果が0のときセット。他はクリア 11803: // V 常にクリア 11804: // C countが0のときXのコピー。他は最後に押し出されたビット 11805: public static void irpXxrToRegWord () throws M68kException { 11806: int rrr; 11807: int x = XEiJ.regRn[rrr = XEiJ.regOC & 7]; 11808: int y; 11809: int z; 11810: int t; 11811: switch (XEiJ.regOC >> 3 & 0b111_000 >> 3) { 11812: case 0b000_000 >> 3: //ASR.W #<data>,Dr 11813: XEiJ.mpuCycleCount += 6 + 2 + ((y = (XEiJ.regOC >> 9) - 1 & 7) << 1); //y=data-1=1-1~8-1 11814: XEiJ.regRn[rrr] = ~0xffff & x | (char) (z = (t = (short) x >> y) >> 1); 11815: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | -(t & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 11816: break; 11817: case 0b001_000 >> 3: //LSR.W #<data>,Dr 11818: XEiJ.mpuCycleCount += 6 + 2 + ((y = (XEiJ.regOC >> 9) - 1 & 7) << 1); //y=data-1=1-1~8-1 11819: XEiJ.regRn[rrr] = ~0xffff & x | (z = (t = (char) x >>> y) >>> 1); 11820: XEiJ.regCCR = (z == 0 ? XEiJ.REG_CCR_Z : 0) | -(t & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 11821: break; 11822: case 0b010_000 >> 3: //ROXR.W #<data>,Dr 11823: XEiJ.mpuCycleCount += 6 + 2 + ((y = (XEiJ.regOC >> 9) - 1 & 7) << 1); //y=data-1=1-1~8-1 11824: z = (XEiJ.regCCR & XEiJ.REG_CCR_X) << 15 - 4 | (char) x >>> 1; 11825: if (y == 1 - 1) { //y=data-1=1-1 11826: t = x; 11827: } else { //y=data-1=2-1~8-1 11828: z = x << 17 - 1 - y | (t = z >>> y - (2 - 1)) >>> 1; 11829: } 11830: XEiJ.regRn[rrr] = ~0xffff & x | (char) (z = (short) z); 11831: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | -(t & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 11832: break; 11833: case 0b011_000 >> 3: //ROR.W #<data>,Dr 11834: XEiJ.mpuCycleCount += 6 + 2 + ((y = (XEiJ.regOC >> 9) - 1 & 7) << 1); //y=data-1=1-1~8-1 11835: XEiJ.regRn[rrr] = ~0xffff & x | (char) (z = (short) (x << 16 - 1 - y | (char) x >>> y + 1)); 11836: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X) | z >>> 15 & 1; //Xは変化しない。Cは結果の最上位ビット 11837: break; 11838: case 0b100_000 >> 3: //ASR.W Dq,Dr 11839: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & 63; //y=0~63。Javaのシフト演算子は5ビットでマスクされることに注意 11840: XEiJ.mpuCycleCount += 6 + (y << 1); 11841: if (y == 0) { //y=data=0 11842: z = (short) x; 11843: t = XEiJ.regCCR & XEiJ.REG_CCR_X; //Xは変化しない。Cはクリア 11844: } else { //y=data=1~63 11845: XEiJ.regRn[rrr] = ~0xffff & x | (char) (z = (t = (short) x >> (y <= 16 ? y - 1 : 15)) >> 1); 11846: t = -(t & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 11847: } 11848: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | t; 11849: break; 11850: case 0b101_000 >> 3: //LSR.W Dq,Dr 11851: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & 63; //y=0~63。Javaのシフト演算子は5ビットでマスクされることに注意 11852: XEiJ.mpuCycleCount += 6 + (y << 1); 11853: if (y == 0) { //y=data=0 11854: z = (short) x; 11855: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | (z < 0 ? XEiJ.REG_CCR_N : z == 0 ? XEiJ.REG_CCR_Z : 0); //Xは変化しない。Cはクリア 11856: } else { //y=data=1~63 11857: XEiJ.regRn[rrr] = ~0xffff & x | (z = (t = y <= 16 ? (char) x >>> y - 1 : 0) >>> 1); 11858: XEiJ.regCCR = (z == 0 ? XEiJ.REG_CCR_Z : 0) | -(t & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 11859: } 11860: break; 11861: case 0b110_000 >> 3: //ROXR.W Dq,Dr 11862: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & 63; //y=0~63。Javaのシフト演算子は5ビットでマスクされることに注意 11863: XEiJ.mpuCycleCount += 6 + (y << 1); 11864: //y %= 17; 11865: y = (y & 15) - (y >> 4); //y=data=-3~15 11866: y += y >> 4 & 17; //y=data=0~16 11867: if (y == 0) { //y=data=0 11868: z = (short) x; 11869: t = -(XEiJ.regCCR >> 4 & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //Xは変化しない。CはXのコピー 11870: } else { //y=data=1~16 11871: z = (XEiJ.regCCR & XEiJ.REG_CCR_X) << 15 - 4 | (char) x >>> 1; 11872: if (y == 1) { //y=data=1 11873: t = x; //Cは最後に押し出されたビット 11874: } else { //y=data=2~16 11875: z = x << 17 - y | (t = z >>> y - 2) >>> 1; 11876: } 11877: XEiJ.regRn[rrr] = ~0xffff & x | (char) (z = (short) z); 11878: t = -(t & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 11879: } 11880: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | t; 11881: break; 11882: case 0b111_000 >> 3: //ROR.W Dq,Dr 11883: default: 11884: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & 63; //y=0~63。Javaのシフト演算子は5ビットでマスクされることに注意 11885: XEiJ.mpuCycleCount += 6 + (y << 1); 11886: if (y == 0) { 11887: z = (short) x; 11888: t = 0; //Cはクリア 11889: } else { 11890: y &= 15; //y=data=0~15 11891: XEiJ.regRn[rrr] = ~0xffff & x | (char) (z = (short) (x << 16 - y | (char) x >>> y)); 11892: t = z >>> 15 & 1; //Cは結果の最上位ビット 11893: } 11894: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X) | t; //Xは変化しない 11895: } 11896: } //irpXxrToRegWord 11897: 11898: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11899: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 11900: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 11901: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 11902: //ASR.L #<data>,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_010_000_rrr 11903: //LSR.L #<data>,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_010_001_rrr 11904: //ROXR.L #<data>,Dr |-|012346|-|*UUUU|***0*| |1110_qqq_010_010_rrr 11905: //ROR.L #<data>,Dr |-|012346|-|-UUUU|-**0*| |1110_qqq_010_011_rrr 11906: //ASR.L Dq,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_010_100_rrr 11907: //LSR.L Dq,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_010_101_rrr 11908: //ROXR.L Dq,Dr |-|012346|-|*UUUU|***0*| |1110_qqq_010_110_rrr 11909: //ROR.L Dq,Dr |-|012346|-|-UUUU|-**0*| |1110_qqq_010_111_rrr 11910: //ASR.L Dr |A|012346|-|UUUUU|***0*| |1110_001_010_000_rrr [ASR.L #1,Dr] 11911: //LSR.L Dr |A|012346|-|UUUUU|***0*| |1110_001_010_001_rrr [LSR.L #1,Dr] 11912: //ROXR.L Dr |A|012346|-|*UUUU|***0*| |1110_001_010_010_rrr [ROXR.L #1,Dr] 11913: //ROR.L Dr |A|012346|-|-UUUU|-**0*| |1110_001_010_011_rrr [ROR.L #1,Dr] 11914: // 11915: //ASR.L #<data>,Dr 11916: //ASR.L Dq,Dr 11917: // 算術右シフトロング 11918: // アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ XNZVC 11919: // 0 アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ Xア*00 Z=アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ==0 11920: // 1 アアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマ ミア*0ミ Z=アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマ==0 11921: // : 11922: // 31 アアアアアアアアアアアアアアアアアアアアアアアアアアアアアアアア イア*0イ Z=ア==0 11923: // 32 アアアアアアアアアアアアアアアアアアアアアアアアアアアアアアアア アア*0ア Z=ア==0 11924: // CCR 11925: // X countが0のとき変化しない。他は最後に押し出されたビット 11926: // N 結果の最上位ビット 11927: // Z 結果が0のときセット。他はクリア 11928: // V 常にクリア 11929: // C countが0のときクリア。他は最後に押し出されたビット 11930: // 11931: //LSR.L #<data>,Dr 11932: //LSR.L Dq,Dr 11933: // 論理右シフトロング 11934: // アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ XNZVC 11935: // 0 アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ Xア*00 Z=アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ==0 11936: // 1 0アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマ ミ0*0ミ Z=アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマ==0 11937: // : 11938: // 31 0000000000000000000000000000000ア イ0*0イ Z=ア==0 11939: // 32 00000000000000000000000000000000 ア010ア 11940: // 33 00000000000000000000000000000000 00100 11941: // CCR 11942: // X countが0のとき変化しない。他は最後に押し出されたビット 11943: // N 結果の最上位ビット 11944: // Z 結果が0のときセット。他はクリア 11945: // V 常にクリア 11946: // C countが0のときクリア。他は最後に押し出されたビット 11947: // 11948: //ROR.L #<data>,Dr 11949: //ROR.L Dq,Dr 11950: // 右ローテートロング 11951: // アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ XNZVC 11952: // 0 アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ Xア*00 Z=アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ==0 11953: // 1 ミアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマ Xミ*0ミ Z=アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ==0 11954: // : 11955: // 31 イウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミア Xイ*0イ Z=アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ==0 11956: // 32 アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ Xア*0ア Z=アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ==0 11957: // CCR 11958: // X 常に変化しない 11959: // N 結果の最上位ビット 11960: // Z 結果が0のときセット。他はクリア 11961: // V 常にクリア 11962: // C countが0のときクリア。他は結果の最上位ビット 11963: // 11964: //ROXR.L #<data>,Dr 11965: //ROXR.L Dq,Dr 11966: // 拡張右ローテートロング 11967: // アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ XNZVC 11968: // 0 アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ Xア*0X Z=アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ==0 11969: // 1 Xアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマ ミX*0ミ Z=アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマX==0 11970: // 2 ミXアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホ マミ*0マ Z=アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホミX==0 11971: // : 11972: // 31 ウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミXア イウ*0イ Z=アウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミX==0 11973: // 32 イウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミX アイ*0ア Z=イウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミX==0 11974: // 33 アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ Xア*0X Z=アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ==0 11975: // CCR 11976: // X countが0のとき変化しない。他は最後に押し出されたビット 11977: // N 結果の最上位ビット 11978: // Z 結果が0のときセット。他はクリア 11979: // V 常にクリア 11980: // C countが0のときXのコピー。他は最後に押し出されたビット 11981: public static void irpXxrToRegLong () throws M68kException { 11982: int rrr; 11983: int x = XEiJ.regRn[rrr = XEiJ.regOC & 7]; 11984: int y; 11985: int z; 11986: int t; 11987: switch (XEiJ.regOC >> 3 & 0b111_000 >> 3) { 11988: case 0b000_000 >> 3: //ASR.L #<data>,Dr 11989: XEiJ.mpuCycleCount += 8 + 2 + ((y = (XEiJ.regOC >> 9) - 1 & 7) << 1); //y=data-1=1-1~8-1 11990: XEiJ.regRn[rrr] = z = (t = x >> y) >> 1; 11991: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | -(t & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 11992: break; 11993: case 0b001_000 >> 3: //LSR.L #<data>,Dr 11994: XEiJ.mpuCycleCount += 8 + 2 + ((y = (XEiJ.regOC >> 9) - 1 & 7) << 1); //y=data-1=1-1~8-1 11995: XEiJ.regRn[rrr] = z = (t = x >>> y) >>> 1; 11996: XEiJ.regCCR = (z == 0 ? XEiJ.REG_CCR_Z : 0) | -(t & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 11997: break; 11998: case 0b010_000 >> 3: //ROXR.L #<data>,Dr 11999: XEiJ.mpuCycleCount += 8 + 2 + ((y = (XEiJ.regOC >> 9) - 1 & 7) << 1); //y=data-1=1-1~8-1 12000: z = (XEiJ.regCCR & XEiJ.REG_CCR_X) << 31 - 4 | x >>> 1; 12001: if (y == 1 - 1) { //y=data-1=1-1 12002: t = x; 12003: } else { //y=data-1=2-1~8-1 12004: z = x << -y | (t = z >>> y - (2 - 1)) >>> 1; //Javaのシフト演算子は5ビットでマスクされるので33-1-yを-yに省略 12005: } 12006: XEiJ.regRn[rrr] = z; 12007: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | -(t & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 12008: break; 12009: case 0b011_000 >> 3: //ROR.L #<data>,Dr 12010: XEiJ.mpuCycleCount += 8 + 2 + ((y = (XEiJ.regOC >> 9) - 1 & 7) << 1); //y=data-1=1-1~8-1 12011: XEiJ.regRn[rrr] = z = x << ~y | x >>> y + 1; //Javaのシフト演算子は5ビットでマスクされるので32-1-yを~yに省略 12012: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X) | z >>> 31; //Xは変化しない。Cは結果の最上位ビット 12013: break; 12014: case 0b100_000 >> 3: //ASR.L Dq,Dr 12015: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & 63; //y=0~63。Javaのシフト演算子は5ビットでマスクされることに注意 12016: XEiJ.mpuCycleCount += 8 + (y << 1); 12017: if (y == 0) { //y=data=0 12018: z = x; 12019: t = XEiJ.regCCR & XEiJ.REG_CCR_X; //Xは変化しない。Cはクリア 12020: } else { //y=data=1~63 12021: XEiJ.regRn[rrr] = z = (t = x >> (y <= 32 ? y - 1 : 31)) >> 1; 12022: t = -(t & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 12023: } 12024: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | t; 12025: break; 12026: case 0b101_000 >> 3: //LSR.L Dq,Dr 12027: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & 63; //y=0~63。Javaのシフト演算子は5ビットでマスクされることに注意 12028: XEiJ.mpuCycleCount += 8 + (y << 1); 12029: if (y == 0) { //y=data=0 12030: z = x; 12031: XEiJ.regCCR = XEiJ.regCCR & XEiJ.REG_CCR_X | (z < 0 ? XEiJ.REG_CCR_N : z == 0 ? XEiJ.REG_CCR_Z : 0); //Xは変化しない。Cはクリア 12032: } else { //y=data=1~63 12033: XEiJ.regRn[rrr] = z = (t = y <= 32 ? x >>> y - 1 : 0) >>> 1; 12034: XEiJ.regCCR = (z == 0 ? XEiJ.REG_CCR_Z : 0) | -(t & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 12035: } 12036: break; 12037: case 0b110_000 >> 3: //ROXR.L Dq,Dr 12038: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & 63; //y=0~63。Javaのシフト演算子は5ビットでマスクされることに注意 12039: XEiJ.mpuCycleCount += 8 + (y << 1); 12040: //y %= 33; 12041: y -= 32 - y >> 6 & 33; //y=data=0~32 12042: if (y == 0) { //y=data=0 12043: z = x; 12044: t = -(XEiJ.regCCR >> 4 & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //Xは変化しない。CはXのコピー 12045: } else { //y=data=1~32 12046: z = (XEiJ.regCCR & XEiJ.REG_CCR_X) << 31 - 4 | x >>> 1; 12047: if (y == 1) { //y=data=1 12048: t = x; //Cは最後に押し出されたビット 12049: } else { //y=data=2~32 12050: z = x << 33 - y | (t = z >>> y - 2) >>> 1; 12051: } 12052: XEiJ.regRn[rrr] = z; 12053: t = -(t & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 12054: } 12055: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | t; 12056: break; 12057: case 0b111_000 >> 3: //ROR.L Dq,Dr 12058: default: 12059: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & 63; //y=0~63。Javaのシフト演算子は5ビットでマスクされることに注意 12060: XEiJ.mpuCycleCount += 8 + (y << 1); 12061: if (y == 0) { 12062: z = x; 12063: t = 0; //Cはクリア 12064: } else { 12065: y &= 31; //y=data=0~31 12066: XEiJ.regRn[rrr] = z = x << -y | x >>> y; //Javaのシフト演算子は5ビットでマスクされるので32-yを-yに省略。y=32のときx|xになるが問題ない 12067: t = z >>> 31; //Cは結果の最上位ビット 12068: } 12069: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X) | t; //Xは変化しない 12070: } 12071: } //irpXxrToRegLong 12072: 12073: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 12074: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 12075: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 12076: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 12077: //ASR.W <ea> |-|012346|-|UUUUU|***0*| M+-WXZ |1110_000_011_mmm_rrr 12078: // 12079: //ASR.W #<data>,Dr 12080: //ASR.W Dq,Dr 12081: //ASR.W <ea> 12082: // 算術右シフトワード 12083: // ................アイウエオカキクケコサシスセソタ XNZVC 12084: // 0 ................アイウエオカキクケコサシスセソタ Xア*00 Z=アイウエオカキクケコサシスセソタ==0 12085: // 1 ................アアイウエオカキクケコサシスセソ タア*0タ Z=アイウエオカキクケコサシスセソ==0 12086: // : 12087: // 15 ................アアアアアアアアアアアアアアアア イア*0イ Z=ア==0 12088: // 16 ................アアアアアアアアアアアアアアアア アア*0ア Z=ア==0 12089: // CCR 12090: // X countが0のとき変化しない。他は最後に押し出されたビット 12091: // N 結果の最上位ビット 12092: // Z 結果が0のときセット。他はクリア 12093: // V 常にクリア 12094: // C countが0のときクリア。他は最後に押し出されたビット 12095: public static void irpAsrToMem () throws M68kException { 12096: XEiJ.mpuCycleCount += 8; 12097: int ea = XEiJ.regOC & 63; 12098: int a = efaMltWord (ea); 12099: int x = XEiJ.busRws (a); 12100: int z = x >> 1; 12101: XEiJ.busWw (a, z); 12102: XEiJ.regCCR = ((z < 0 ? XEiJ.REG_CCR_N : 0) | 12103: (z == 0 ? XEiJ.REG_CCR_Z : 0) | 12104: -(x & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //XとCは最後に押し出されたビット 12105: } //irpAsrToMem 12106: 12107: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 12108: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 12109: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 12110: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 12111: //ASL.B #<data>,Dr |-|012346|-|UUUUU|*****| |1110_qqq_100_000_rrr 12112: //LSL.B #<data>,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_100_001_rrr 12113: //ROXL.B #<data>,Dr |-|012346|-|*UUUU|***0*| |1110_qqq_100_010_rrr 12114: //ROL.B #<data>,Dr |-|012346|-|-UUUU|-**0*| |1110_qqq_100_011_rrr 12115: //ASL.B Dq,Dr |-|012346|-|UUUUU|*****| |1110_qqq_100_100_rrr 12116: //LSL.B Dq,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_100_101_rrr 12117: //ROXL.B Dq,Dr |-|012346|-|*UUUU|***0*| |1110_qqq_100_110_rrr 12118: //ROL.B Dq,Dr |-|012346|-|-UUUU|-**0*| |1110_qqq_100_111_rrr 12119: //ASL.B Dr |A|012346|-|UUUUU|*****| |1110_001_100_000_rrr [ASL.B #1,Dr] 12120: //LSL.B Dr |A|012346|-|UUUUU|***0*| |1110_001_100_001_rrr [LSL.B #1,Dr] 12121: //ROXL.B Dr |A|012346|-|*UUUU|***0*| |1110_001_100_010_rrr [ROXL.B #1,Dr] 12122: //ROL.B Dr |A|012346|-|-UUUU|-**0*| |1110_001_100_011_rrr [ROL.B #1,Dr] 12123: // 12124: //ASL.B #<data>,Dr 12125: //ASL.B Dq,Dr 12126: // 算術左シフトバイト 12127: // ........................アイウエオカキク XNZVC 12128: // 0 ........................アイウエオカキク Xア*00 Z=アイウエオカキク==0 12129: // 1 ........................イウエオカキク0 アイ**ア Z=イウエオカキク==0,V=アイ!=0/-1 12130: // : 12131: // 7 ........................ク0000000 キク**キ Z=ク==0,V=アイウエオカキク!=0/-1 12132: // 8 ........................00000000 ク01*ク V=アイウエオカキク!=0 12133: // 9 ........................00000000 001*0 V=アイウエオカキク!=0 12134: // CCR 12135: // X countが0のとき変化しない。他は最後に押し出されたビット 12136: // N 結果の最上位ビット 12137: // Z 結果が0のときセット。他はクリア 12138: // V ASRで元に戻せないときセット。他はクリア 12139: // C countが0のときクリア。他は最後に押し出されたビット 12140: // 12141: //LSL.B #<data>,Dr 12142: //LSL.B Dq,Dr 12143: // 論理左シフトバイト 12144: // ........................アイウエオカキク XNZVC 12145: // 0 ........................アイウエオカキク Xア*00 Z=アイウエオカキク==0 12146: // 1 ........................イウエオカキク0 アイ*0ア Z=イウエオカキク==0 12147: // : 12148: // 7 ........................ク0000000 キク*0キ Z=ク==0 12149: // 8 ........................00000000 ク010ク 12150: // 9 ........................00000000 00100 12151: // CCR 12152: // X countが0のとき変化しない。他は最後に押し出されたビット 12153: // N 結果の最上位ビット 12154: // Z 結果が0のときセット。他はクリア 12155: // V 常にクリア 12156: // C countが0のときクリア。他は最後に押し出されたビット 12157: // 12158: //ROL.B #<data>,Dr 12159: //ROL.B Dq,Dr 12160: // 左ローテートバイト 12161: // ........................アイウエオカキク XNZVC 12162: // 0 ........................アイウエオカキク Xア*00 Z=アイウエオカキク==0 12163: // 1 ........................イウエオカキクア Xイ*0ア Z=アイウエオカキク==0 12164: // : 12165: // 7 ........................クアイウエオカキ Xク*0キ Z=アイウエオカキク==0 12166: // 8 ........................アイウエオカキク Xア*0ク Z=アイウエオカキク==0 12167: // CCR 12168: // X 常に変化しない 12169: // N 結果の最上位ビット 12170: // Z 結果が0のときセット。他はクリア 12171: // V 常にクリア 12172: // C countが0のときクリア。他は結果の最下位ビット 12173: // 12174: //ROXL.B #<data>,Dr 12175: //ROXL.B Dq,Dr 12176: // 拡張左ローテートバイト 12177: // ........................アイウエオカキク XNZVC 12178: // 0 ........................アイウエオカキク Xア*0X Z=アイウエオカキク==0 12179: // 1 ........................イウエオカキクX アイ*0ア Z=イウエオカキクX==0 12180: // 2 ........................ウエオカキクXア イウ*0イ Z=アウエオカキクX==0 12181: // : 12182: // 7 ........................クXアイウエオカ キク*0キ Z=アイウエオカクX==0 12183: // 8 ........................Xアイウエオカキ クX*0ク Z=アイウエオカキX==0 12184: // 9 ........................アイウエオカキク Xア*0X Z=アイウエオカキク==0 12185: // CCR 12186: // X countが0のとき変化しない。他は最後に押し出されたビット 12187: // N 結果の最上位ビット 12188: // Z 結果が0のときセット。他はクリア 12189: // V 常にクリア 12190: // C countが0のときXのコピー。他は最後に押し出されたビット 12191: public static void irpXxlToRegByte () throws M68kException { 12192: int rrr; 12193: int x = XEiJ.regRn[rrr = XEiJ.regOC & 7]; 12194: int y; 12195: int z; 12196: int t; 12197: switch (XEiJ.regOC >> 3 & 0b111_000 >> 3) { 12198: case 0b000_000 >> 3: //ASL.B #<data>,Dr 12199: XEiJ.mpuCycleCount += 6 + 2 + ((y = (XEiJ.regOC >> 9) - 1 & 7) << 1); //y=data-1=1-1~8-1 12200: XEiJ.regRn[rrr] = ~0xff & x | 0xff & (z = (byte) ((t = x << y) << 1)); 12201: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | (z >> y + 1 != (byte) x ? XEiJ.REG_CCR_V : 0) | (byte) t >> 7 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //VはASRで元に戻せないときセット。XとCは最後に押し出されたビット 12202: break; 12203: case 0b001_000 >> 3: //LSL.B #<data>,Dr 12204: XEiJ.mpuCycleCount += 6 + 2 + ((y = (XEiJ.regOC >> 9) - 1 & 7) << 1); //y=data-1=1-1~8-1 12205: XEiJ.regRn[rrr] = ~0xff & x | 0xff & (z = (byte) ((t = x << y) << 1)); 12206: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | (byte) t >> 7 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 12207: break; 12208: case 0b010_000 >> 3: //ROXL.B #<data>,Dr 12209: XEiJ.mpuCycleCount += 6 + 2 + ((y = (XEiJ.regOC >> 9) - 1 & 7) << 1); //y=data-1=1-1~8-1 12210: z = x << 1 | XEiJ.regCCR >> 4 & 1; 12211: if (y == 1 - 1) { //y=data-1=1-1 12212: t = x; 12213: } else { //y=data-1=2-1~8-1 12214: z = (t = z << y - (2 - 1)) << 1 | (0xff & x) >>> 9 - 1 - y; 12215: } 12216: XEiJ.regRn[rrr] = ~0xff & x | 0xff & (z = (byte) z); 12217: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | (byte) t >> 7 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 12218: break; 12219: case 0b011_000 >> 3: //ROL.B #<data>,Dr 12220: XEiJ.mpuCycleCount += 6 + 2 + ((y = (XEiJ.regOC >> 9) - 1 & 7) << 1); //y=data-1=1-1~8-1 12221: XEiJ.regRn[rrr] = ~0xff & x | 0xff & (z = (byte) (x << y + 1 | (0xff & x) >>> 7 - y)); 12222: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X) | z & 1; //Xは変化しない。Cは結果の最下位ビット 12223: break; 12224: case 0b100_000 >> 3: //ASL.B Dq,Dr 12225: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & 63; //y=0~63。Javaのシフト演算子は5ビットでマスクされることに注意 12226: XEiJ.mpuCycleCount += 6 + (y << 1); 12227: if (y <= 7) { //y=data=0~7 12228: if (y == 0) { //y=data=0 12229: z = (byte) x; 12230: t = XEiJ.regCCR & XEiJ.REG_CCR_X; //Xは変化しない。VとCはクリア 12231: } else { //y=data=1~7 12232: XEiJ.regRn[rrr] = ~0xff & x | 0xff & (z = (byte) ((t = x << y - 1) << 1)); 12233: t = (z >> y != (byte) x ? XEiJ.REG_CCR_V : 0) | (byte) t >> 7 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //VはASRで元に戻せないときセット。XとCは最後に押し出されたビット 12234: } 12235: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | t; 12236: } else { //y=data=8~63 12237: XEiJ.regRn[rrr] = ~0xff & x; 12238: XEiJ.regCCR = XEiJ.REG_CCR_Z | ((byte) x != 0 ? XEiJ.REG_CCR_V : 0) | (y == 8 ? -(x & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C) : 0); 12239: } 12240: break; 12241: case 0b101_000 >> 3: //LSL.B Dq,Dr 12242: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & 63; //y=0~63。Javaのシフト演算子は5ビットでマスクされることに注意 12243: XEiJ.mpuCycleCount += 6 + (y << 1); 12244: if (y == 0) { //y=data=0 12245: z = (byte) x; 12246: t = XEiJ.regCCR & XEiJ.REG_CCR_X; //Xは変化しない。Cはクリア 12247: } else { //y=data=1~63 12248: XEiJ.regRn[rrr] = ~0xff & x | 0xff & (z = (byte) ((t = y <= 8 ? x << y - 1 : 0) << 1)); 12249: t = (byte) t >> 7 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 12250: } 12251: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | t; 12252: break; 12253: case 0b110_000 >> 3: //ROXL.B Dq,Dr 12254: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & 63; //y=0~63。Javaのシフト演算子は5ビットでマスクされることに注意 12255: XEiJ.mpuCycleCount += 6 + (y << 1); 12256: //y %= 9; 12257: y = (y & 7) - (y >> 3); //y=data=-7~7 12258: y += y >> 3 & 9; //y=data=0~8 12259: if (y == 0) { //y=data=0 12260: z = (byte) x; 12261: t = -(XEiJ.regCCR >> 4 & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //Xは変化しない。CはXのコピー 12262: } else { //y=data=1~8 12263: z = x << 1 | XEiJ.regCCR >> 4 & 1; 12264: if (y == 1) { //y=data=1 12265: t = x; //Cは最後に押し出されたビット 12266: } else { //y=data=2~8 12267: z = (t = z << y - 2) << 1 | (0xff & x) >>> 9 - y; 12268: } 12269: XEiJ.regRn[rrr] = ~0xff & x | 0xff & (z = (byte) z); 12270: t = (byte) t >> 7 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 12271: } 12272: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | t; 12273: break; 12274: case 0b111_000 >> 3: //ROL.B Dq,Dr 12275: default: 12276: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & 63; //y=0~63。Javaのシフト演算子は5ビットでマスクされることに注意 12277: XEiJ.mpuCycleCount += 6 + (y << 1); 12278: if (y == 0) { 12279: z = (byte) x; 12280: t = 0; //Cはクリア 12281: } else { 12282: y &= 7; //y=data=0~7 12283: XEiJ.regRn[rrr] = ~0xff & x | 0xff & (z = (byte) (x << y | (0xff & x) >>> 8 - y)); 12284: t = z & 1; //Cは結果の最下位ビット 12285: } 12286: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X) | t; //Xは変化しない 12287: } 12288: } //irpXxlToRegByte 12289: 12290: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 12291: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 12292: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 12293: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 12294: //ASL.W #<data>,Dr |-|012346|-|UUUUU|*****| |1110_qqq_101_000_rrr 12295: //LSL.W #<data>,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_101_001_rrr 12296: //ROXL.W #<data>,Dr |-|012346|-|*UUUU|***0*| |1110_qqq_101_010_rrr 12297: //ROL.W #<data>,Dr |-|012346|-|-UUUU|-**0*| |1110_qqq_101_011_rrr 12298: //ASL.W Dq,Dr |-|012346|-|UUUUU|*****| |1110_qqq_101_100_rrr 12299: //LSL.W Dq,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_101_101_rrr 12300: //ROXL.W Dq,Dr |-|012346|-|*UUUU|***0*| |1110_qqq_101_110_rrr 12301: //ROL.W Dq,Dr |-|012346|-|-UUUU|-**0*| |1110_qqq_101_111_rrr 12302: //ASL.W Dr |A|012346|-|UUUUU|*****| |1110_001_101_000_rrr [ASL.W #1,Dr] 12303: //LSL.W Dr |A|012346|-|UUUUU|***0*| |1110_001_101_001_rrr [LSL.W #1,Dr] 12304: //ROXL.W Dr |A|012346|-|*UUUU|***0*| |1110_001_101_010_rrr [ROXL.W #1,Dr] 12305: //ROL.W Dr |A|012346|-|-UUUU|-**0*| |1110_001_101_011_rrr [ROL.W #1,Dr] 12306: // 12307: //ASL.W #<data>,Dr 12308: //ASL.W Dq,Dr 12309: //ASL.W <ea> 12310: // 算術左シフトワード 12311: // ................アイウエオカキクケコサシスセソタ XNZVC 12312: // 0 ................アイウエオカキクケコサシスセソタ Xア*00 Z=アイウエオカキクケコサシスセソタ==0 12313: // 1 ................イウエオカキクケコサシスセソタ0 アイ**ア Z=イウエオカキクケコサシスセソタ==0,V=アイ!=0/-1 12314: // : 12315: // 15 ................タ000000000000000 ソタ**ソ Z=タ==0,V=アイウエオカキクケコサシスセソタ!=0/-1 12316: // 16 ................0000000000000000 タ01*タ V=アイウエオカキクケコサシスセソタ!=0 12317: // 17 ................0000000000000000 001*0 V=アイウエオカキクケコサシスセソタ!=0 12318: // CCR 12319: // X countが0のとき変化しない。他は最後に押し出されたビット 12320: // N 結果の最上位ビット 12321: // Z 結果が0のときセット。他はクリア 12322: // V ASRで元に戻せないときセット。他はクリア 12323: // C countが0のときクリア。他は最後に押し出されたビット 12324: // 12325: //LSL.W #<data>,Dr 12326: //LSL.W Dq,Dr 12327: //LSL.W <ea> 12328: // 論理左シフトワード 12329: // ................アイウエオカキクケコサシスセソタ XNZVC 12330: // 0 ................アイウエオカキクケコサシスセソタ Xア*00 Z=アイウエオカキクケコサシスセソタ==0 12331: // 1 ................イウエオカキクケコサシスセソタ0 アイ*0ア Z=イウエオカキクケコサシスセソタ==0 12332: // : 12333: // 15 ................タ000000000000000 ソタ*0ソ Z=タ==0 12334: // 16 ................0000000000000000 タ010タ 12335: // 17 ................0000000000000000 00100 12336: // CCR 12337: // X countが0のとき変化しない。他は最後に押し出されたビット 12338: // N 結果の最上位ビット 12339: // Z 結果が0のときセット。他はクリア 12340: // V 常にクリア 12341: // C countが0のときクリア。他は最後に押し出されたビット 12342: // 12343: //ROL.W #<data>,Dr 12344: //ROL.W Dq,Dr 12345: //ROL.W <ea> 12346: // 左ローテートワード 12347: // ................アイウエオカキクケコサシスセソタ XNZVC 12348: // 0 ................アイウエオカキクケコサシスセソタ Xア*00 Z=アイウエオカキクケコサシスセソタ==0 12349: // 1 ................イウエオカキクケコサシスセソタア Xイ*0ア Z=アイウエオカキクケコサシスセソタ==0 12350: // : 12351: // 15 ................タアイウエオカキクケコサシスセソ Xタ*0ソ Z=アイウエオカキクケコサシスセソタ==0 12352: // 16 ................アイウエオカキクケコサシスセソタ Xア*0タ Z=アイウエオカキクケコサシスセソタ==0 12353: // CCR 12354: // X 常に変化しない 12355: // N 結果の最上位ビット 12356: // Z 結果が0のときセット。他はクリア 12357: // V 常にクリア 12358: // C countが0のときクリア。他は結果の最下位ビット 12359: // 12360: //ROXL.W #<data>,Dr 12361: //ROXL.W Dq,Dr 12362: //ROXL.W <ea> 12363: // 拡張左ローテートワード 12364: // ................アイウエオカキクケコサシスセソタ XNZVC 12365: // 0 ................アイウエオカキクケコサシスセソタ Xア*0X Z=アイウエオカキクケコサシスセソタ==0 12366: // 1 ................イウエオカキクケコサシスセソタX アイ*0ア Z=イウエオカキクケコサシスセソタX==0 12367: // 2 ................ウエオカキクケコサシスセソタXア イウ*0イ Z=アウエオカキクケコサシスセソタX==0 12368: // : 12369: // 15 ................タXアイウエオカキクケコサシスセ ソタ*0ソ Z=アイウエオカキクケコサシスセタX==0 12370: // 16 ................Xアイウエオカキクケコサシスセソ タX*0タ Z=アイウエオカキクケコサシスセソX==0 12371: // 17 ................アイウエオカキクケコサシスセソタ Xア*0X Z=アイウエオカキクケコサシスセソタ==0 12372: // CCR 12373: // X countが0のとき変化しない。他は最後に押し出されたビット 12374: // N 結果の最上位ビット 12375: // Z 結果が0のときセット。他はクリア 12376: // V 常にクリア 12377: // C countが0のときXのコピー。他は最後に押し出されたビット 12378: public static void irpXxlToRegWord () throws M68kException { 12379: int rrr; 12380: int x = XEiJ.regRn[rrr = XEiJ.regOC & 7]; 12381: int y; 12382: int z; 12383: int t; 12384: switch (XEiJ.regOC >> 3 & 0b111_000 >> 3) { 12385: case 0b000_000 >> 3: //ASL.W #<data>,Dr 12386: XEiJ.mpuCycleCount += 6 + 2 + ((y = (XEiJ.regOC >> 9) - 1 & 7) << 1); //y=data-1=1-1~8-1 12387: XEiJ.regRn[rrr] = ~0xffff & x | (char) (z = (short) ((t = x << y) << 1)); 12388: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | (z >> y + 1 != (short) x ? XEiJ.REG_CCR_V : 0) | (short) t >> 15 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //VはASRで元に戻せないときセット。XとCは最後に押し出されたビット 12389: break; 12390: case 0b001_000 >> 3: //LSL.W #<data>,Dr 12391: XEiJ.mpuCycleCount += 6 + 2 + ((y = (XEiJ.regOC >> 9) - 1 & 7) << 1); //y=data-1=1-1~8-1 12392: XEiJ.regRn[rrr] = ~0xffff & x | (char) (z = (short) ((t = x << y) << 1)); 12393: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | (short) t >> 15 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 12394: break; 12395: case 0b010_000 >> 3: //ROXL.W #<data>,Dr 12396: XEiJ.mpuCycleCount += 6 + 2 + ((y = (XEiJ.regOC >> 9) - 1 & 7) << 1); //y=data-1=1-1~8-1 12397: z = x << 1 | XEiJ.regCCR >> 4 & 1; 12398: if (y == 1 - 1) { //y=data-1=1-1 12399: t = x; 12400: } else { //y=data-1=2-1~8-1 12401: z = (t = z << y - (2 - 1)) << 1 | (char) x >>> 17 - 1 - y; 12402: } 12403: XEiJ.regRn[rrr] = ~0xffff & x | (char) (z = (short) z); 12404: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | (short) t >> 15 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 12405: break; 12406: case 0b011_000 >> 3: //ROL.W #<data>,Dr 12407: XEiJ.mpuCycleCount += 6 + 2 + ((y = (XEiJ.regOC >> 9) - 1 & 7) << 1); //y=data-1=1-1~8-1 12408: XEiJ.regRn[rrr] = ~0xffff & x | (char) (z = (short) (x << y + 1 | (char) x >>> 16 - 1 - y)); 12409: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X) | z & 1; //Xは変化しない。Cは結果の最下位ビット 12410: break; 12411: case 0b100_000 >> 3: //ASL.W Dq,Dr 12412: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & 63; //y=0~63。Javaのシフト演算子は5ビットでマスクされることに注意 12413: XEiJ.mpuCycleCount += 6 + (y << 1); 12414: if (y <= 15) { //y=data=0~15 12415: if (y == 0) { //y=data=0 12416: z = (short) x; 12417: t = XEiJ.regCCR & XEiJ.REG_CCR_X; //Xは変化しない。VとCはクリア 12418: } else { //y=data=1~15 12419: XEiJ.regRn[rrr] = ~0xffff & x | (char) (z = (short) ((t = x << y - 1) << 1)); 12420: t = (z >> y != (short) x ? XEiJ.REG_CCR_V : 0) | (short) t >> 15 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //VはASRで元に戻せないときセット。XとCは最後に押し出されたビット 12421: } 12422: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | t; 12423: } else { //y=data=16~63 12424: XEiJ.regRn[rrr] = ~0xffff & x; 12425: XEiJ.regCCR = XEiJ.REG_CCR_Z | ((short) x != 0 ? XEiJ.REG_CCR_V : 0) | (y == 16 ? -(x & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C) : 0); 12426: } 12427: break; 12428: case 0b101_000 >> 3: //LSL.W Dq,Dr 12429: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & 63; //y=0~63。Javaのシフト演算子は5ビットでマスクされることに注意 12430: XEiJ.mpuCycleCount += 6 + (y << 1); 12431: if (y == 0) { //y=data=0 12432: z = (short) x; 12433: t = XEiJ.regCCR & XEiJ.REG_CCR_X; //Xは変化しない。Cはクリア 12434: } else { //y=data=1~63 12435: XEiJ.regRn[rrr] = ~0xffff & x | (char) (z = (short) ((t = y <= 16 ? x << y - 1 : 0) << 1)); 12436: t = (short) t >> 15 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 12437: } 12438: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | t; 12439: break; 12440: case 0b110_000 >> 3: //ROXL.W Dq,Dr 12441: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & 63; //y=0~63。Javaのシフト演算子は5ビットでマスクされることに注意 12442: XEiJ.mpuCycleCount += 6 + (y << 1); 12443: //y %= 17; 12444: y = (y & 15) - (y >> 4); //y=data=-3~15 12445: y += y >> 4 & 17; //y=data=0~16 12446: if (y == 0) { //y=data=0 12447: z = (short) x; 12448: t = -(XEiJ.regCCR >> 4 & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //Xは変化しない。CはXのコピー 12449: } else { //y=data=1~16 12450: z = x << 1 | XEiJ.regCCR >> 4 & 1; 12451: if (y == 1) { //y=data=1 12452: t = x; //Cは最後に押し出されたビット 12453: } else { //y=data=2~16 12454: z = (t = z << y - 2) << 1 | (char) x >>> 17 - y; 12455: } 12456: XEiJ.regRn[rrr] = ~0xffff & x | (char) (z = (short) z); 12457: t = (short) t >> 15 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 12458: } 12459: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | t; 12460: break; 12461: case 0b111_000 >> 3: //ROL.W Dq,Dr 12462: default: 12463: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & 63; //y=0~63。Javaのシフト演算子は5ビットでマスクされることに注意 12464: XEiJ.mpuCycleCount += 6 + (y << 1); 12465: if (y == 0) { 12466: z = (short) x; 12467: t = 0; //Cはクリア 12468: } else { 12469: y &= 15; //y=data=0~15 12470: XEiJ.regRn[rrr] = ~0xffff & x | (char) (z = (short) (x << y | (char) x >>> 16 - y)); 12471: t = z & 1; //Cは結果の最下位ビット 12472: } 12473: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X) | t; //Xは変化しない 12474: } 12475: } //irpXxlToRegWord 12476: 12477: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 12478: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 12479: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 12480: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 12481: //ASL.L #<data>,Dr |-|012346|-|UUUUU|*****| |1110_qqq_110_000_rrr 12482: //LSL.L #<data>,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_110_001_rrr 12483: //ROXL.L #<data>,Dr |-|012346|-|*UUUU|***0*| |1110_qqq_110_010_rrr 12484: //ROL.L #<data>,Dr |-|012346|-|-UUUU|-**0*| |1110_qqq_110_011_rrr 12485: //ASL.L Dq,Dr |-|012346|-|UUUUU|*****| |1110_qqq_110_100_rrr 12486: //LSL.L Dq,Dr |-|012346|-|UUUUU|***0*| |1110_qqq_110_101_rrr 12487: //ROXL.L Dq,Dr |-|012346|-|*UUUU|***0*| |1110_qqq_110_110_rrr 12488: //ROL.L Dq,Dr |-|012346|-|-UUUU|-**0*| |1110_qqq_110_111_rrr 12489: //ASL.L Dr |A|012346|-|UUUUU|*****| |1110_001_110_000_rrr [ASL.L #1,Dr] 12490: //LSL.L Dr |A|012346|-|UUUUU|***0*| |1110_001_110_001_rrr [LSL.L #1,Dr] 12491: //ROXL.L Dr |A|012346|-|*UUUU|***0*| |1110_001_110_010_rrr [ROXL.L #1,Dr] 12492: //ROL.L Dr |A|012346|-|-UUUU|-**0*| |1110_001_110_011_rrr [ROL.L #1,Dr] 12493: // 12494: //ASL.L #<data>,Dr 12495: //ASL.L Dq,Dr 12496: // 算術左シフトロング 12497: // アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ XNZVC 12498: // 0 アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ Xア**0 Z=アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ==0 12499: // 1 イウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ0 アイ**ア Z=イウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ==0,V=アイ!=0/-1 12500: // : 12501: // 31 ミ0000000000000000000000000000000 マミ**マ Z=ミ==0,V=アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ!=0/-1 12502: // 32 00000000000000000000000000000000 ミ01*ミ V=アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ!=0 12503: // 33 00000000000000000000000000000000 001*0 V=アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ!=0 12504: // CCR 12505: // X countが0のとき変化しない。他は最後に押し出されたビット 12506: // N 結果の最上位ビット 12507: // Z 結果が0のときセット。他はクリア 12508: // V ASRで元に戻せないときセット。他はクリア 12509: // C countが0のときクリア。他は最後に押し出されたビット 12510: // 12511: //LSL.L #<data>,Dr 12512: //LSL.L Dq,Dr 12513: // 論理左シフトロング 12514: // アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ XNZVC 12515: // 0 アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ Xア*00 Z=アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ==0 12516: // 1 イウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ0 アイ*0ア Z=イウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ==0 12517: // : 12518: // 31 ミ0000000000000000000000000000000 マミ*0マ Z=ミ==0 12519: // 32 00000000000000000000000000000000 ミ010ミ 12520: // 33 00000000000000000000000000000000 00100 12521: // CCR 12522: // X countが0のとき変化しない。他は最後に押し出されたビット 12523: // N 結果の最上位ビット 12524: // Z 結果が0のときセット。他はクリア 12525: // V 常にクリア 12526: // C countが0のときクリア。他は最後に押し出されたビット 12527: // 12528: //ROL.L #<data>,Dr 12529: //ROL.L Dq,Dr 12530: // 左ローテートロング 12531: // アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ XNZVC 12532: // 0 アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ Xア*00 Z=アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ==0 12533: // 1 イウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミア Xイ*0ア Z=アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ==0 12534: // : 12535: // 31 ミアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマ Xミ*0マ Z=アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ==0 12536: // 32 アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ Xア*0ミ Z=アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ==0 12537: // CCR 12538: // X 常に変化しない 12539: // N 結果の最上位ビット 12540: // Z 結果が0のときセット。他はクリア 12541: // V 常にクリア 12542: // C countが0のときクリア。他は結果の最下位ビット 12543: // 12544: //ROXL.L #<data>,Dr 12545: //ROXL.L Dq,Dr 12546: // 拡張左ローテートロング 12547: // アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ XNZVC 12548: // 0 アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ Xア*0X Z=アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ==0 12549: // 1 イウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミX アイ*0ア Z=イウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミX==0 12550: // 2 ウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミXア イウ*0イ Z=アウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミX==0 12551: // : 12552: // 31 ミXアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホ マミ*0マ Z=アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホミX==0 12553: // 32 Xアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマ ミX*0ミ Z=アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマX==0 12554: // 33 アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ Xア*0X Z=アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミ==0 12555: // CCR 12556: // X countが0のとき変化しない。他は最後に押し出されたビット 12557: // N 結果の最上位ビット 12558: // Z 結果が0のときセット。他はクリア 12559: // V 常にクリア 12560: // C countが0のときXのコピー。他は最後に押し出されたビット 12561: public static void irpXxlToRegLong () throws M68kException { 12562: int rrr; 12563: int x = XEiJ.regRn[rrr = XEiJ.regOC & 7]; 12564: int y; 12565: int z; 12566: int t; 12567: switch (XEiJ.regOC >> 3 & 0b111_000 >> 3) { 12568: case 0b000_000 >> 3: //ASL.L #<data>,Dr 12569: XEiJ.mpuCycleCount += 8 + 2 + ((y = (XEiJ.regOC >> 9) - 1 & 7) << 1); //y=data-1=1-1~8-1 12570: XEiJ.regRn[rrr] = z = (t = x << y) << 1; 12571: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | (z >> y + 1 != x ? XEiJ.REG_CCR_V : 0) | t >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //VはASRで元に戻せないときセット。XとCは最後に押し出されたビット 12572: break; 12573: case 0b001_000 >> 3: //LSL.L #<data>,Dr 12574: XEiJ.mpuCycleCount += 8 + 2 + ((y = (XEiJ.regOC >> 9) - 1 & 7) << 1); //y=data-1=1-1~8-1 12575: XEiJ.regRn[rrr] = z = (t = x << y) << 1; 12576: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | t >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 12577: break; 12578: case 0b010_000 >> 3: //ROXL.L #<data>,Dr 12579: XEiJ.mpuCycleCount += 8 + 2 + ((y = (XEiJ.regOC >> 9) - 1 & 7) << 1); //y=data-1=1-1~8-1 12580: z = x << 1 | XEiJ.regCCR >> 4 & 1; 12581: if (y == 1 - 1) { //y=data-1=1-1 12582: t = x; 12583: } else { //y=data-1=2-1~8-1 12584: z = (t = z << y - (2 - 1)) << 1 | x >>> -y; //Javaのシフト演算子は5ビットでマスクされるので33-1-yを-yに省略 12585: } 12586: XEiJ.regRn[rrr] = z; 12587: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | t >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 12588: break; 12589: case 0b011_000 >> 3: //ROL.L #<data>,Dr 12590: XEiJ.mpuCycleCount += 8 + 2 + ((y = (XEiJ.regOC >> 9) - 1 & 7) << 1); //y=data-1=1-1~8-1 12591: XEiJ.regRn[rrr] = z = x << y + 1 | x >>> ~y; //Javaのシフト演算子は5ビットでマスクされるので32-1-yを~yに省略 12592: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X) | z & 1; //Xは変化しない。Cは結果の最下位ビット 12593: break; 12594: case 0b100_000 >> 3: //ASL.L Dq,Dr 12595: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & 63; //y=0~63。Javaのシフト演算子は5ビットでマスクされることに注意 12596: XEiJ.mpuCycleCount += 8 + (y << 1); 12597: if (y <= 31) { //y=data=0~31 12598: if (y == 0) { //y=data=0 12599: z = x; 12600: t = XEiJ.regCCR & XEiJ.REG_CCR_X; //Xは変化しない。VとCはクリア 12601: } else { //y=data=1~31 12602: XEiJ.regRn[rrr] = z = (t = x << y - 1) << 1; 12603: t = (z >> y != x ? XEiJ.REG_CCR_V : 0) | t >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //VはASRで元に戻せないときセット。XとCは最後に押し出されたビット 12604: } 12605: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | t; 12606: } else { //y=data=32~63 12607: XEiJ.regRn[rrr] = 0; 12608: XEiJ.regCCR = XEiJ.REG_CCR_Z | (x != 0 ? XEiJ.REG_CCR_V : 0) | (y == 32 ? -(x & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C) : 0); 12609: } 12610: break; 12611: case 0b101_000 >> 3: //LSL.L Dq,Dr 12612: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & 63; //y=0~63。Javaのシフト演算子は5ビットでマスクされることに注意 12613: XEiJ.mpuCycleCount += 8 + (y << 1); 12614: if (y == 0) { //y=data=0 12615: z = x; 12616: t = XEiJ.regCCR & XEiJ.REG_CCR_X; //Xは変化しない。Cはクリア 12617: } else { //y=data=1~63 12618: XEiJ.regRn[rrr] = z = (t = y <= 32 ? x << y - 1 : 0) << 1; 12619: t = t >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 12620: } 12621: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | t; 12622: break; 12623: case 0b110_000 >> 3: //ROXL.L Dq,Dr 12624: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & 63; //y=0~63。Javaのシフト演算子は5ビットでマスクされることに注意 12625: XEiJ.mpuCycleCount += 8 + (y << 1); 12626: //y %= 33; 12627: y -= 32 - y >> 6 & 33; //y=data=0~32 12628: if (y == 0) { //y=data=0 12629: z = x; 12630: t = -(XEiJ.regCCR >> 4 & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //Xは変化しない。CはXのコピー 12631: } else { //y=data=1~32 12632: z = x << 1 | XEiJ.regCCR >> 4 & 1; 12633: if (y == 1) { //y=data=1 12634: t = x; //Cは最後に押し出されたビット 12635: } else { //y=data=2~32 12636: z = (t = z << y - 2) << 1 | x >>> 33 - y; 12637: } 12638: XEiJ.regRn[rrr] = z; 12639: t = t >> 31 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); //XとCは最後に押し出されたビット 12640: } 12641: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.REG_CCR_Z : 0) | t; 12642: break; 12643: case 0b111_000 >> 3: //ROL.L Dq,Dr 12644: default: 12645: y = XEiJ.regRn[XEiJ.regOC >> 9 & 7] & 63; //y=0~63。Javaのシフト演算子は5ビットでマスクされることに注意 12646: XEiJ.mpuCycleCount += 8 + (y << 1); 12647: if (y == 0) { 12648: z = x; 12649: t = 0; //Cはクリア 12650: } else { 12651: XEiJ.regRn[rrr] = z = x << y | x >>> -y; //Javaのシフト演算子は5ビットでマスクされるのでy&31をyに、32-(y&31)を-yに省略。y=32のときx|xになるが問題ない 12652: t = z & 1; 12653: } 12654: XEiJ.regCCR = z >> 28 & XEiJ.REG_CCR_N | (z == 0 ? XEiJ.regCCR & XEiJ.REG_CCR_X | XEiJ.REG_CCR_Z : XEiJ.regCCR & XEiJ.REG_CCR_X) | t; //Xは変化しない 12655: } 12656: } //irpXxlToRegLong 12657: 12658: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 12659: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 12660: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 12661: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 12662: //ASL.W <ea> |-|012346|-|UUUUU|*****| M+-WXZ |1110_000_111_mmm_rrr 12663: // 12664: //ASL.W #<data>,Dr 12665: //ASL.W Dq,Dr 12666: //ASL.W <ea> 12667: // 算術左シフトワード 12668: // ................アイウエオカキクケコサシスセソタ XNZVC 12669: // 0 ................アイウエオカキクケコサシスセソタ Xア*00 Z=アイウエオカキクケコサシスセソタ==0 12670: // 1 ................イウエオカキクケコサシスセソタ0 アイ**ア Z=イウエオカキクケコサシスセソタ==0,V=アイ!=0/-1 12671: // : 12672: // 15 ................タ000000000000000 ソタ**ソ Z=タ==0,V=アイウエオカキクケコサシスセソタ!=0/-1 12673: // 16 ................0000000000000000 タ01*タ V=アイウエオカキクケコサシスセソタ!=0 12674: // 17 ................0000000000000000 001*0 V=アイウエオカキクケコサシスセソタ!=0 12675: // CCR 12676: // X countが0のとき変化しない。他は最後に押し出されたビット 12677: // N 結果の最上位ビット 12678: // Z 結果が0のときセット。他はクリア 12679: // V ASRで元に戻せないときセット。他はクリア 12680: // C countが0のときクリア。他は最後に押し出されたビット 12681: public static void irpAslToMem () throws M68kException { 12682: XEiJ.mpuCycleCount += 8; 12683: int ea = XEiJ.regOC & 63; 12684: int a = efaMltWord (ea); 12685: int x = XEiJ.busRws (a); 12686: int z = (short) (x << 1); 12687: XEiJ.busWw (a, z); 12688: XEiJ.regCCR = ((z < 0 ? XEiJ.REG_CCR_N : 0) | 12689: (z == 0 ? XEiJ.REG_CCR_Z : 0) | 12690: (x ^ z) >>> 31 << 1 | //Vは最上位ビットが変化したときセット 12691: x >> 15 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //XとCは最後に押し出されたビット 12692: } //irpAslToMem 12693: 12694: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 12695: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 12696: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 12697: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 12698: //LSR.W <ea> |-|012346|-|UUUUU|*0*0*| M+-WXZ |1110_001_011_mmm_rrr 12699: // 12700: //LSR.W #<data>,Dr 12701: //LSR.W Dq,Dr 12702: //LSR.W <ea> 12703: // 論理右シフトワード 12704: // ................アイウエオカキクケコサシスセソタ XNZVC 12705: // 0 ................アイウエオカキクケコサシスセソタ Xア*00 Z=アイウエオカキクケコサシスセソタ==0 12706: // 1 ................0アイウエオカキクケコサシスセソ タ0*0タ Z=アイウエオカキクケコサシスセソ==0 12707: // : 12708: // 15 ................000000000000000ア イ0*0イ Z=ア==0 12709: // 16 ................0000000000000000 ア010ア 12710: // 17 ................0000000000000000 00100 12711: // CCR 12712: // X countが0のとき変化しない。他は最後に押し出されたビット 12713: // N 結果の最上位ビット 12714: // Z 結果が0のときセット。他はクリア 12715: // V 常にクリア 12716: // C countが0のときクリア。他は最後に押し出されたビット 12717: public static void irpLsrToMem () throws M68kException { 12718: XEiJ.mpuCycleCount += 8; 12719: int ea = XEiJ.regOC & 63; 12720: int a = efaMltWord (ea); 12721: int x = XEiJ.busRwz (a); 12722: int z = x >>> 1; 12723: XEiJ.busWw (a, z); 12724: XEiJ.regCCR = ((z == 0 ? XEiJ.REG_CCR_Z : 0) | 12725: -(x & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //XとCは最後に押し出されたビット 12726: } //irpLsrToMem 12727: 12728: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 12729: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 12730: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 12731: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 12732: //LSL.W <ea> |-|012346|-|UUUUU|***0*| M+-WXZ |1110_001_111_mmm_rrr 12733: // 12734: //LSL.W #<data>,Dr 12735: //LSL.W Dq,Dr 12736: //LSL.W <ea> 12737: // 論理左シフトワード 12738: // ................アイウエオカキクケコサシスセソタ XNZVC 12739: // 0 ................アイウエオカキクケコサシスセソタ Xア*00 Z=アイウエオカキクケコサシスセソタ==0 12740: // 1 ................イウエオカキクケコサシスセソタ0 アイ*0ア Z=イウエオカキクケコサシスセソタ==0 12741: // : 12742: // 15 ................タ000000000000000 ソタ*0ソ Z=タ==0 12743: // 16 ................0000000000000000 タ010タ 12744: // 17 ................0000000000000000 00100 12745: // CCR 12746: // X countが0のとき変化しない。他は最後に押し出されたビット 12747: // N 結果の最上位ビット 12748: // Z 結果が0のときセット。他はクリア 12749: // V 常にクリア 12750: // C countが0のときクリア。他は最後に押し出されたビット 12751: public static void irpLslToMem () throws M68kException { 12752: XEiJ.mpuCycleCount += 8; 12753: int ea = XEiJ.regOC & 63; 12754: int a = efaMltWord (ea); 12755: int x = XEiJ.busRws (a); 12756: int z = (short) (x << 1); 12757: XEiJ.busWw (a, z); 12758: XEiJ.regCCR = ((z < 0 ? XEiJ.REG_CCR_N : 0) | 12759: (z == 0 ? XEiJ.REG_CCR_Z : 0) | 12760: x >> 15 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //XとCは最後に押し出されたビット 12761: } //irpLslToMem 12762: 12763: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 12764: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 12765: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 12766: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 12767: //ROXR.W <ea> |-|012346|-|*UUUU|***0*| M+-WXZ |1110_010_011_mmm_rrr 12768: // 12769: //ROXR.W #<data>,Dr 12770: //ROXR.W Dq,Dr 12771: //ROXR.W <ea> 12772: // 拡張右ローテートワード 12773: // ................アイウエオカキクケコサシスセソタ XNZVC 12774: // 0 ................アイウエオカキクケコサシスセソタ Xア*0X Z=アイウエオカキクケコサシスセソタ==0 12775: // 1 ................Xアイウエオカキクケコサシスセソ タX*0タ Z=アイウエオカキクケコサシスセソX==0 12776: // 2 ................タXアイウエオカキクケコサシスセ ソタ*0ソ Z=アイウエオカキクケコサシスセタX==0 12777: // : 12778: // 15 ................ウエオカキクケコサシスセソタXア イウ*0イ Z=アウエオカキクケコサシスセソタX==0 12779: // 16 ................イウエオカキクケコサシスセソタX アイ*0ア Z=イウエオカキクケコサシスセソタX==0 12780: // 17 ................アイウエオカキクケコサシスセソタ Xア*0X Z=アイウエオカキクケコサシスセソタ==0 12781: // CCR 12782: // X countが0のとき変化しない。他は最後に押し出されたビット 12783: // N 結果の最上位ビット 12784: // Z 結果が0のときセット。他はクリア 12785: // V 常にクリア 12786: // C countが0のときXのコピー。他は最後に押し出されたビット 12787: public static void irpRoxrToMem () throws M68kException { 12788: XEiJ.mpuCycleCount += 8; 12789: int ea = XEiJ.regOC & 63; 12790: int a = efaMltWord (ea); 12791: int x = XEiJ.busRwz (a); 12792: int z = -(XEiJ.regCCR & XEiJ.REG_CCR_X) << 15 - 4 | x >>> 1; 12793: XEiJ.busWw (a, z); 12794: XEiJ.regCCR = ((z < 0 ? XEiJ.REG_CCR_N : 0) | 12795: (z == 0 ? XEiJ.REG_CCR_Z : 0) | 12796: -(x & 1) & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //XとCは最後に押し出されたビット 12797: } //irpRoxrToMem 12798: 12799: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 12800: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 12801: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 12802: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 12803: //ROXL.W <ea> |-|012346|-|*UUUU|***0*| M+-WXZ |1110_010_111_mmm_rrr 12804: // 12805: //ROXL.W #<data>,Dr 12806: //ROXL.W Dq,Dr 12807: //ROXL.W <ea> 12808: // 拡張左ローテートワード 12809: // ................アイウエオカキクケコサシスセソタ XNZVC 12810: // 0 ................アイウエオカキクケコサシスセソタ Xア*0X Z=アイウエオカキクケコサシスセソタ==0 12811: // 1 ................イウエオカキクケコサシスセソタX アイ*0ア Z=イウエオカキクケコサシスセソタX==0 12812: // 2 ................ウエオカキクケコサシスセソタXア イウ*0イ Z=アウエオカキクケコサシスセソタX==0 12813: // : 12814: // 15 ................タXアイウエオカキクケコサシスセ ソタ*0ソ Z=アイウエオカキクケコサシスセタX==0 12815: // 16 ................Xアイウエオカキクケコサシスセソ タX*0タ Z=アイウエオカキクケコサシスセソX==0 12816: // 17 ................アイウエオカキクケコサシスセソタ Xア*0X Z=アイウエオカキクケコサシスセソタ==0 12817: // CCR 12818: // X countが0のとき変化しない。他は最後に押し出されたビット 12819: // N 結果の最上位ビット 12820: // Z 結果が0のときセット。他はクリア 12821: // V 常にクリア 12822: // C countが0のときXのコピー。他は最後に押し出されたビット 12823: public static void irpRoxlToMem () throws M68kException { 12824: XEiJ.mpuCycleCount += 8; 12825: int ea = XEiJ.regOC & 63; 12826: int a = efaMltWord (ea); 12827: int x = XEiJ.busRws (a); 12828: int z = (short) (x << 1 | XEiJ.regCCR >> 4 & 1); 12829: XEiJ.busWw (a, z); 12830: XEiJ.regCCR = ((z < 0 ? XEiJ.REG_CCR_N : 0) | 12831: (z == 0 ? XEiJ.REG_CCR_Z : 0) | 12832: x >> 15 & (XEiJ.REG_CCR_X | XEiJ.REG_CCR_C)); //XとCは最後に押し出されたビット 12833: } //irpRoxlToMem 12834: 12835: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 12836: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 12837: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 12838: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 12839: //ROR.W <ea> |-|012346|-|-UUUU|-**0*| M+-WXZ |1110_011_011_mmm_rrr 12840: // 12841: //ROR.W #<data>,Dr 12842: //ROR.W Dq,Dr 12843: //ROR.W <ea> 12844: // 右ローテートワード 12845: // ................アイウエオカキクケコサシスセソタ XNZVC 12846: // 0 ................アイウエオカキクケコサシスセソタ Xア*00 Z=アイウエオカキクケコサシスセソタ==0 12847: // 1 ................タアイウエオカキクケコサシスセソ Xタ*0タ Z=アイウエオカキクケコサシスセソタ==0 12848: // : 12849: // 15 ................イウエオカキクケコサシスセソタア Xイ*0イ Z=アイウエオカキクケコサシスセソタ==0 12850: // 16 ................アイウエオカキクケコサシスセソタ Xア*0ア Z=アイウエオカキクケコサシスセソタ==0 12851: // CCR 12852: // X 常に変化しない 12853: // N 結果の最上位ビット 12854: // Z 結果が0のときセット。他はクリア 12855: // V 常にクリア 12856: // C countが0のときクリア。他は結果の最上位ビット 12857: public static void irpRorToMem () throws M68kException { 12858: XEiJ.mpuCycleCount += 8; 12859: int ea = XEiJ.regOC & 63; 12860: int a = efaMltWord (ea); 12861: int x = XEiJ.busRwz (a); 12862: int z = (short) (x << 15 | x >>> 1); 12863: XEiJ.busWw (a, z); 12864: XEiJ.regCCR = (XEiJ.regCCR & XEiJ.REG_CCR_X | //Xは変化しない 12865: (z < 0 ? XEiJ.REG_CCR_N : 0) | 12866: (z == 0 ? XEiJ.REG_CCR_Z : 0) | 12867: z >>> 31); //Cは結果の最上位ビット 12868: } //irpRorToMem 12869: 12870: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 12871: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 12872: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 12873: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 12874: //ROL.W <ea> |-|012346|-|-UUUU|-**0*| M+-WXZ |1110_011_111_mmm_rrr 12875: // 12876: //ROL.W #<data>,Dr 12877: //ROL.W Dq,Dr 12878: //ROL.W <ea> 12879: // 左ローテートワード 12880: // ................アイウエオカキクケコサシスセソタ XNZVC 12881: // 0 ................アイウエオカキクケコサシスセソタ Xア*00 Z=アイウエオカキクケコサシスセソタ==0 12882: // 1 ................イウエオカキクケコサシスセソタア Xイ*0ア Z=アイウエオカキクケコサシスセソタ==0 12883: // : 12884: // 15 ................タアイウエオカキクケコサシスセソ Xタ*0ソ Z=アイウエオカキクケコサシスセソタ==0 12885: // 16 ................アイウエオカキクケコサシスセソタ Xア*0タ Z=アイウエオカキクケコサシスセソタ==0 12886: // CCR 12887: // X 常に変化しない 12888: // N 結果の最上位ビット 12889: // Z 結果が0のときセット。他はクリア 12890: // V 常にクリア 12891: // C countが0のときクリア。他は結果の最下位ビット 12892: public static void irpRolToMem () throws M68kException { 12893: XEiJ.mpuCycleCount += 8; 12894: int ea = XEiJ.regOC & 63; 12895: int a = efaMltWord (ea); 12896: int x = XEiJ.busRwz (a); 12897: int z = (short) (x << 1 | x >>> 15); 12898: XEiJ.busWw (a, z); 12899: XEiJ.regCCR = (XEiJ.regCCR & XEiJ.REG_CCR_X | //Xは変化しない 12900: (z < 0 ? XEiJ.REG_CCR_N : 0) | 12901: (z == 0 ? XEiJ.REG_CCR_Z : 0) | 12902: z & 1); //Cは結果の最下位ビット 12903: } //irpRolToMem 12904: 12905: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 12906: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 12907: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 12908: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 12909: //FPACK <data> |A|012346|-|UUUUU|*****| |1111_111_0dd_ddd_ddd [FLINE #<data>] 12910: public static void irpFpack () throws M68kException { 12911: if (!MainMemory.mmrFEfuncActivated) { 12912: irpFline (); 12913: return; 12914: } 12915: StringBuilder sb; 12916: int a0; 12917: if (FEFunction.FPK_DEBUG_TRACE) { 12918: sb = new StringBuilder (); 12919: String name = Disassembler.DIS_FPACK_NAME[XEiJ.regOC & 255]; 12920: if (name.length () == 0) { 12921: XEiJ.fmtHex4 (sb.append ('$'), XEiJ.regOC); 12922: } else { 12923: sb.append (name); 12924: } 12925: sb.append ('\n'); 12926: XEiJ.fmtHex8 (XEiJ.fmtHex8 (XEiJ.fmtHex8 (XEiJ.fmtHex8 (sb.append (" D0="), XEiJ.regRn[0]).append (" D1="), XEiJ.regRn[1]).append (" D2="), XEiJ.regRn[2]).append (" D3="), XEiJ.regRn[3]); 12927: a0 = XEiJ.regRn[8]; 12928: MainMemory.mmrRstr (sb.append (" (A0)=\""), a0, MainMemory.mmrStrlen (a0, 20)).append ("\"\n"); 12929: } 12930: XEiJ.mpuCycleCount += FEFunction.FPK_CLOCK; //一律にFEFunction.FPK_CLOCKサイクルかかることにする 12931: switch (XEiJ.regOC & 255) { 12932: case 0x00: FEFunction.fpkLMUL (); break; 12933: case 0x01: FEFunction.fpkLDIV (); break; 12934: case 0x02: FEFunction.fpkLMOD (); break; 12935: //case 0x03: break; 12936: case 0x04: FEFunction.fpkUMUL (); break; 12937: case 0x05: FEFunction.fpkUDIV (); break; 12938: case 0x06: FEFunction.fpkUMOD (); break; 12939: //case 0x07: break; 12940: case 0x08: FEFunction.fpkIMUL (); break; 12941: case 0x09: FEFunction.fpkIDIV (); break; 12942: //case 0x0a: break; 12943: //case 0x0b: break; 12944: case 0x0c: FEFunction.fpkRANDOMIZE (); break; 12945: case 0x0d: FEFunction.fpkSRAND (); break; 12946: case 0x0e: FEFunction.fpkRAND (); break; 12947: //case 0x0f: break; 12948: case 0x10: FEFunction.fpkSTOL (); break; 12949: case 0x11: FEFunction.fpkLTOS (); break; 12950: case 0x12: FEFunction.fpkSTOH (); break; 12951: case 0x13: FEFunction.fpkHTOS (); break; 12952: case 0x14: FEFunction.fpkSTOO (); break; 12953: case 0x15: FEFunction.fpkOTOS (); break; 12954: case 0x16: FEFunction.fpkSTOB (); break; 12955: case 0x17: FEFunction.fpkBTOS (); break; 12956: case 0x18: FEFunction.fpkIUSING (); break; 12957: //case 0x19: break; 12958: case 0x1a: FEFunction.fpkLTOD (); break; 12959: case 0x1b: FEFunction.fpkDTOL (); break; 12960: case 0x1c: FEFunction.fpkLTOF (); break; 12961: case 0x1d: FEFunction.fpkFTOL (); break; 12962: case 0x1e: FEFunction.fpkFTOD (); break; 12963: case 0x1f: FEFunction.fpkDTOF (); break; 12964: case 0x20: FEFunction.fpkVAL (); break; 12965: case 0x21: FEFunction.fpkUSING (); break; 12966: case 0x22: FEFunction.fpkSTOD (); break; 12967: case 0x23: FEFunction.fpkDTOS (); break; 12968: case 0x24: FEFunction.fpkECVT (); break; 12969: case 0x25: FEFunction.fpkFCVT (); break; 12970: case 0x26: FEFunction.fpkGCVT (); break; 12971: //case 0x27: break; 12972: case 0x28: FEFunction.fpkDTST (); break; 12973: case 0x29: FEFunction.fpkDCMP (); break; 12974: case 0x2a: FEFunction.fpkDNEG (); break; 12975: case 0x2b: FEFunction.fpkDADD (); break; 12976: case 0x2c: FEFunction.fpkDSUB (); break; 12977: case 0x2d: FEFunction.fpkDMUL (); break; 12978: case 0x2e: FEFunction.fpkDDIV (); break; 12979: case 0x2f: FEFunction.fpkDMOD (); break; 12980: case 0x30: FEFunction.fpkDABS (); break; 12981: case 0x31: FEFunction.fpkDCEIL (); break; 12982: case 0x32: FEFunction.fpkDFIX (); break; 12983: case 0x33: FEFunction.fpkDFLOOR (); break; 12984: case 0x34: FEFunction.fpkDFRAC (); break; 12985: case 0x35: FEFunction.fpkDSGN (); break; 12986: case 0x36: FEFunction.fpkSIN (); break; 12987: case 0x37: FEFunction.fpkCOS (); break; 12988: case 0x38: FEFunction.fpkTAN (); break; 12989: case 0x39: FEFunction.fpkATAN (); break; 12990: case 0x3a: FEFunction.fpkLOG (); break; 12991: case 0x3b: FEFunction.fpkEXP (); break; 12992: case 0x3c: FEFunction.fpkSQR (); break; 12993: case 0x3d: FEFunction.fpkPI (); break; 12994: case 0x3e: FEFunction.fpkNPI (); break; 12995: case 0x3f: FEFunction.fpkPOWER (); break; 12996: case 0x40: FEFunction.fpkRND (); break; 12997: case 0x41: FEFunction.fpkSINH (); break; 12998: case 0x42: FEFunction.fpkCOSH (); break; 12999: case 0x43: FEFunction.fpkTANH (); break; 13000: case 0x44: FEFunction.fpkATANH (); break; 13001: case 0x45: FEFunction.fpkASIN (); break; 13002: case 0x46: FEFunction.fpkACOS (); break; 13003: case 0x47: FEFunction.fpkLOG10 (); break; 13004: case 0x48: FEFunction.fpkLOG2 (); break; 13005: case 0x49: FEFunction.fpkDFREXP (); break; 13006: case 0x4a: FEFunction.fpkDLDEXP (); break; 13007: case 0x4b: FEFunction.fpkDADDONE (); break; 13008: case 0x4c: FEFunction.fpkDSUBONE (); break; 13009: case 0x4d: FEFunction.fpkDDIVTWO (); break; 13010: case 0x4e: FEFunction.fpkDIEECNV (); break; 13011: case 0x4f: FEFunction.fpkIEEDCNV (); break; 13012: case 0x50: FEFunction.fpkFVAL (); break; 13013: case 0x51: FEFunction.fpkFUSING (); break; 13014: case 0x52: FEFunction.fpkSTOF (); break; 13015: case 0x53: FEFunction.fpkFTOS (); break; 13016: case 0x54: FEFunction.fpkFECVT (); break; 13017: case 0x55: FEFunction.fpkFFCVT (); break; 13018: case 0x56: FEFunction.fpkFGCVT (); break; 13019: //case 0x57: break; 13020: case 0x58: FEFunction.fpkFTST (); break; 13021: case 0x59: FEFunction.fpkFCMP (); break; 13022: case 0x5a: FEFunction.fpkFNEG (); break; 13023: case 0x5b: FEFunction.fpkFADD (); break; 13024: case 0x5c: FEFunction.fpkFSUB (); break; 13025: case 0x5d: FEFunction.fpkFMUL (); break; 13026: case 0x5e: FEFunction.fpkFDIV (); break; 13027: case 0x5f: FEFunction.fpkFMOD (); break; 13028: case 0x60: FEFunction.fpkFABS (); break; 13029: case 0x61: FEFunction.fpkFCEIL (); break; 13030: case 0x62: FEFunction.fpkFFIX (); break; 13031: case 0x63: FEFunction.fpkFFLOOR (); break; 13032: case 0x64: FEFunction.fpkFFRAC (); break; 13033: case 0x65: FEFunction.fpkFSGN (); break; 13034: case 0x66: FEFunction.fpkFSIN (); break; 13035: case 0x67: FEFunction.fpkFCOS (); break; 13036: case 0x68: FEFunction.fpkFTAN (); break; 13037: case 0x69: FEFunction.fpkFATAN (); break; 13038: case 0x6a: FEFunction.fpkFLOG (); break; 13039: case 0x6b: FEFunction.fpkFEXP (); break; 13040: case 0x6c: FEFunction.fpkFSQR (); break; 13041: case 0x6d: FEFunction.fpkFPI (); break; 13042: case 0x6e: FEFunction.fpkFNPI (); break; 13043: case 0x6f: FEFunction.fpkFPOWER (); break; 13044: case 0x70: FEFunction.fpkFRND (); break; 13045: case 0x71: FEFunction.fpkFSINH (); break; 13046: case 0x72: FEFunction.fpkFCOSH (); break; 13047: case 0x73: FEFunction.fpkFTANH (); break; 13048: case 0x74: FEFunction.fpkFATANH (); break; 13049: case 0x75: FEFunction.fpkFASIN (); break; 13050: case 0x76: FEFunction.fpkFACOS (); break; 13051: case 0x77: FEFunction.fpkFLOG10 (); break; 13052: case 0x78: FEFunction.fpkFLOG2 (); break; 13053: case 0x79: FEFunction.fpkFFREXP (); break; 13054: case 0x7a: FEFunction.fpkFLDEXP (); break; 13055: case 0x7b: FEFunction.fpkFADDONE (); break; 13056: case 0x7c: FEFunction.fpkFSUBONE (); break; 13057: case 0x7d: FEFunction.fpkFDIVTWO (); break; 13058: case 0x7e: FEFunction.fpkFIEECNV (); break; 13059: case 0x7f: FEFunction.fpkIEEFCNV (); break; 13060: //case 0x80: break; 13061: //case 0x81: break; 13062: //case 0x82: break; 13063: //case 0x83: break; 13064: //case 0x84: break; 13065: //case 0x85: break; 13066: //case 0x86: break; 13067: //case 0x87: break; 13068: //case 0x88: break; 13069: //case 0x89: break; 13070: //case 0x8a: break; 13071: //case 0x8b: break; 13072: //case 0x8c: break; 13073: //case 0x8d: break; 13074: //case 0x8e: break; 13075: //case 0x8f: break; 13076: //case 0x90: break; 13077: //case 0x91: break; 13078: //case 0x92: break; 13079: //case 0x93: break; 13080: //case 0x94: break; 13081: //case 0x95: break; 13082: //case 0x96: break; 13083: //case 0x97: break; 13084: //case 0x98: break; 13085: //case 0x99: break; 13086: //case 0x9a: break; 13087: //case 0x9b: break; 13088: //case 0x9c: break; 13089: //case 0x9d: break; 13090: //case 0x9e: break; 13091: //case 0x9f: break; 13092: //case 0xa0: break; 13093: //case 0xa1: break; 13094: //case 0xa2: break; 13095: //case 0xa3: break; 13096: //case 0xa4: break; 13097: //case 0xa5: break; 13098: //case 0xa6: break; 13099: //case 0xa7: break; 13100: //case 0xa8: break; 13101: //case 0xa9: break; 13102: //case 0xaa: break; 13103: //case 0xab: break; 13104: //case 0xac: break; 13105: //case 0xad: break; 13106: //case 0xae: break; 13107: //case 0xaf: break; 13108: //case 0xb0: break; 13109: //case 0xb1: break; 13110: //case 0xb2: break; 13111: //case 0xb3: break; 13112: //case 0xb4: break; 13113: //case 0xb5: break; 13114: //case 0xb6: break; 13115: //case 0xb7: break; 13116: //case 0xb8: break; 13117: //case 0xb9: break; 13118: //case 0xba: break; 13119: //case 0xbb: break; 13120: //case 0xbc: break; 13121: //case 0xbd: break; 13122: //case 0xbe: break; 13123: //case 0xbf: break; 13124: //case 0xc0: break; 13125: //case 0xc1: break; 13126: //case 0xc2: break; 13127: //case 0xc3: break; 13128: //case 0xc4: break; 13129: //case 0xc5: break; 13130: //case 0xc6: break; 13131: //case 0xc7: break; 13132: //case 0xc8: break; 13133: //case 0xc9: break; 13134: //case 0xca: break; 13135: //case 0xcb: break; 13136: //case 0xcc: break; 13137: //case 0xcd: break; 13138: //case 0xce: break; 13139: //case 0xcf: break; 13140: //case 0xd0: break; 13141: //case 0xd1: break; 13142: //case 0xd2: break; 13143: //case 0xd3: break; 13144: //case 0xd4: break; 13145: //case 0xd5: break; 13146: //case 0xd6: break; 13147: //case 0xd7: break; 13148: //case 0xd8: break; 13149: //case 0xd9: break; 13150: //case 0xda: break; 13151: //case 0xdb: break; 13152: //case 0xdc: break; 13153: //case 0xdd: break; 13154: //case 0xde: break; 13155: //case 0xdf: break; 13156: case 0xe0: FEFunction.fpkCLMUL (); break; 13157: case 0xe1: FEFunction.fpkCLDIV (); break; 13158: case 0xe2: FEFunction.fpkCLMOD (); break; 13159: case 0xe3: FEFunction.fpkCUMUL (); break; 13160: case 0xe4: FEFunction.fpkCUDIV (); break; 13161: case 0xe5: FEFunction.fpkCUMOD (); break; 13162: case 0xe6: FEFunction.fpkCLTOD (); break; 13163: case 0xe7: FEFunction.fpkCDTOL (); break; 13164: case 0xe8: FEFunction.fpkCLTOF (); break; 13165: case 0xe9: FEFunction.fpkCFTOL (); break; 13166: case 0xea: FEFunction.fpkCFTOD (); break; 13167: case 0xeb: FEFunction.fpkCDTOF (); break; 13168: case 0xec: FEFunction.fpkCDCMP (); break; 13169: case 0xed: FEFunction.fpkCDADD (); break; 13170: case 0xee: FEFunction.fpkCDSUB (); break; 13171: case 0xef: FEFunction.fpkCDMUL (); break; 13172: case 0xf0: FEFunction.fpkCDDIV (); break; 13173: case 0xf1: FEFunction.fpkCDMOD (); break; 13174: case 0xf2: FEFunction.fpkCFCMP (); break; 13175: case 0xf3: FEFunction.fpkCFADD (); break; 13176: case 0xf4: FEFunction.fpkCFSUB (); break; 13177: case 0xf5: FEFunction.fpkCFMUL (); break; 13178: case 0xf6: FEFunction.fpkCFDIV (); break; 13179: case 0xf7: FEFunction.fpkCFMOD (); break; 13180: case 0xf8: FEFunction.fpkCDTST (); break; 13181: case 0xf9: FEFunction.fpkCFTST (); break; 13182: case 0xfa: FEFunction.fpkCDINC (); break; 13183: case 0xfb: FEFunction.fpkCFINC (); break; 13184: case 0xfc: FEFunction.fpkCDDEC (); break; 13185: case 0xfd: FEFunction.fpkCFDEC (); break; 13186: case 0xfe: FEFunction.fpkFEVARG (); break; 13187: //case 0xff: FEFunction.fpkFEVECS (); break; //FLOATn.Xに処理させる 13188: default: 13189: XEiJ.mpuCycleCount -= FEFunction.FPK_CLOCK; //戻す 13190: irpFline (); 13191: } 13192: if (FEFunction.FPK_DEBUG_TRACE) { 13193: int i = sb.length (); 13194: XEiJ.fmtHex8 (XEiJ.fmtHex8 (XEiJ.fmtHex8 (XEiJ.fmtHex8 (sb.append (" D0="), XEiJ.regRn[0]).append (" D1="), XEiJ.regRn[1]).append (" D2="), XEiJ.regRn[2]).append (" D3="), XEiJ.regRn[3]); 13195: int l = MainMemory.mmrStrlen (a0, 20); 13196: sb.append (" (A0)=\""); 13197: i = sb.length () - i; 13198: MainMemory.mmrRstr (sb, a0, l).append ("\"\n"); 13199: if (a0 <= XEiJ.regRn[8] && XEiJ.regRn[8] <= a0 + l) { 13200: for (i += sb.length () + XEiJ.regRn[8] - a0; sb.length () < i; ) { 13201: sb.append (' '); 13202: } 13203: sb.append ('^'); 13204: } 13205: System.out.println (sb.toString ()); 13206: } 13207: } //irpFpack 13208: 13209: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 13210: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 13211: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 13212: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 13213: //DOS <data> |A|012346|-|UUUUU|UUUUU| |1111_111_1dd_ddd_ddd [FLINE #<data>] 13214: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 13215: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 13216: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 13217: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 13218: //FLINE #<data> |-|012346|-|UUUUU|UUUUU| |1111_ddd_ddd_ddd_ddd (line 1111 emulator) 13219: public static void irpFline () throws M68kException { 13220: XEiJ.mpuCycleCount += 34; 13221: if (XEiJ.MPU_INLINE_EXCEPTION) { 13222: int save_sr = XEiJ.regSRT1 | XEiJ.regSRS | XEiJ.regSRI | XEiJ.regCCR; 13223: int sp = XEiJ.regRn[15]; 13224: XEiJ.regSRT1 = XEiJ.mpuTraceFlag = 0; //srのTビットを消す 13225: if (XEiJ.regSRS == 0) { //ユーザモードのとき 13226: XEiJ.regSRS = XEiJ.REG_SR_S; //スーパーバイザモードへ移行する 13227: XEiJ.mpuUSP = sp; //USPを保存 13228: sp = XEiJ.mpuISP; //SSPを復元 13229: if (DataBreakPoint.DBP_ON) { 13230: DataBreakPoint.dbpMemoryMap = DataBreakPoint.dbpSuperMap; //スーパーバイザメモリマップに切り替える 13231: } else { 13232: XEiJ.busMemoryMap = XEiJ.busSuperMap; //スーパーバイザメモリマップに切り替える 13233: } 13234: if (InstructionBreakPoint.IBP_ON) { 13235: InstructionBreakPoint.ibpOp1MemoryMap = InstructionBreakPoint.ibpOp1SuperMap; 13236: } 13237: } 13238: XEiJ.regRn[15] = sp -= 6; 13239: XEiJ.busWl (sp + 2, XEiJ.regPC0); //pushl。pcをプッシュする 13240: XEiJ.busWw (sp, save_sr); //pushw。srをプッシュする 13241: irpSetPC (XEiJ.busRlsf (M68kException.M6E_LINE_1111_EMULATOR << 2)); //例外ベクタを取り出してジャンプする 13242: } else { 13243: irpException (M68kException.M6E_LINE_1111_EMULATOR, XEiJ.regPC0, XEiJ.regSRT1 | XEiJ.regSRS | XEiJ.regSRI | XEiJ.regCCR); //pcは命令の先頭 13244: } 13245: } //irpFline 13246: 13247: //irpIllegal () 13248: // オペコードの上位10bitで分類されなかった未実装命令 13249: // 0x4afcのILLEGAL命令はここには来ない 13250: public static void irpIllegal () throws M68kException { 13251: if (true) { 13252: XEiJ.mpuCycleCount += 34; 13253: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 13254: throw M68kException.m6eSignal; 13255: } 13256: } //irpIllegal 13257: 13258: //z = irpAbcd (x, y) 13259: // ABCD 13260: public static int irpAbcd (int x, int y) { 13261: int c = XEiJ.regCCR >> 4; 13262: int t = (x & 0xff) + (y & 0xff) + c; //仮の結果 13263: int z = t; //結果 13264: if (0x0a <= (x & 0x0f) + (y & 0x0f) + c) { //ハーフキャリー 13265: z += 0x10 - 0x0a; 13266: } 13267: //XとCはキャリーがあるときセット、さもなくばクリア 13268: if (0xa0 <= z) { //キャリー 13269: z += 0x100 - 0xa0; 13270: XEiJ.regCCR |= XEiJ.REG_CCR_X | XEiJ.REG_CCR_C; 13271: } else { 13272: XEiJ.regCCR &= ~(XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); 13273: } 13274: //Zは結果が0でないときクリア、さもなくば変化しない 13275: z &= 0xff; 13276: if (z != 0x00) { 13277: XEiJ.regCCR &= ~XEiJ.REG_CCR_Z; 13278: } 13279: if (true) { 13280: //000/030のときNは結果の最上位ビット 13281: if ((z & 0x80) != 0) { 13282: XEiJ.regCCR |= XEiJ.REG_CCR_N; 13283: } else { 13284: XEiJ.regCCR &= ~XEiJ.REG_CCR_N; 13285: } 13286: //000のときVは補正値の加算でオーバーフローしたときセット、さもなくばクリア 13287: int a = z - t; //補正値 13288: if ((((t ^ z) & (a ^ z)) & 0x80) != 0) { 13289: XEiJ.regCCR |= XEiJ.REG_CCR_V; 13290: } else { 13291: XEiJ.regCCR &= ~XEiJ.REG_CCR_V; 13292: } 13293: } else if (false) { 13294: //000/030のときNは結果の最上位ビット 13295: if ((z & 0x80) != 0) { 13296: XEiJ.regCCR |= XEiJ.REG_CCR_N; 13297: } else { 13298: XEiJ.regCCR &= ~XEiJ.REG_CCR_N; 13299: } 13300: //030のときVはクリア 13301: XEiJ.regCCR &= ~XEiJ.REG_CCR_V; 13302: } else { 13303: //060のときNとVは変化しない 13304: } 13305: return z; 13306: } //irpAbcd 13307: 13308: //z = irpSbcd (x, y) 13309: // SBCD 13310: public static int irpSbcd (int x, int y) { 13311: int b = XEiJ.regCCR >> 4; 13312: int t = (x & 0xff) - (y & 0xff) - b; //仮の結果 13313: int z = t; //結果 13314: if ((x & 0x0f) - (y & 0x0f) - b < 0) { //ハーフボロー 13315: z -= 0x10 - 0x0a; 13316: } 13317: //XとCはボローがあるときセット、さもなくばクリア 13318: if (z < 0) { //ボロー 13319: if (t < 0) { 13320: z -= 0x100 - 0xa0; 13321: } 13322: XEiJ.regCCR |= XEiJ.REG_CCR_X | XEiJ.REG_CCR_C; 13323: } else { 13324: XEiJ.regCCR &= ~(XEiJ.REG_CCR_X | XEiJ.REG_CCR_C); 13325: } 13326: //Zは結果が0でないときクリア、さもなくば変化しない 13327: z &= 0xff; 13328: if (z != 0x00) { 13329: XEiJ.regCCR &= ~XEiJ.REG_CCR_Z; 13330: } 13331: if (true) { 13332: //000/030のときNは結果の最上位ビット 13333: if ((z & 0x80) != 0) { 13334: XEiJ.regCCR |= XEiJ.REG_CCR_N; 13335: } else { 13336: XEiJ.regCCR &= ~XEiJ.REG_CCR_N; 13337: } 13338: //000のときVは補正値の加算でオーバーフローしたときセット、さもなくばクリア 13339: int a = z - t; //補正値 13340: if ((((t ^ z) & (a ^ z)) & 0x80) != 0) { 13341: XEiJ.regCCR |= XEiJ.REG_CCR_V; 13342: } else { 13343: XEiJ.regCCR &= ~XEiJ.REG_CCR_V; 13344: } 13345: } else if (false) { 13346: //000/030のときNは結果の最上位ビット 13347: if ((z & 0x80) != 0) { 13348: XEiJ.regCCR |= XEiJ.REG_CCR_N; 13349: } else { 13350: XEiJ.regCCR &= ~XEiJ.REG_CCR_N; 13351: } 13352: //030のときVはクリア 13353: XEiJ.regCCR &= ~XEiJ.REG_CCR_V; 13354: } else { 13355: //060のときNとVは変化しない 13356: } 13357: return z; 13358: } //irpSbcd 13359: 13360: 13361: 13362: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 13363: // | | MPU | |CCin |CCout|addressing| 1st opcode 2nd opcode 13364: // A:alias P:privileged |A|012346|P|XNZVC|XNZVC|DAM+-WXZPI|bbbb_bbb_bbb_bbb_bbb-bbbbbbbbbbbbbbbb 13365: //------------------------------------------------+-+------+-+-----+-----+----------+------------------------------------- 13366: //HFSBOOT |-|012346|-|-----|-----| |0100_111_000_000_000 13367: //HFSINST |-|012346|-|-----|-----| |0100_111_000_000_001 13368: //HFSSTR |-|012346|-|-----|-----| |0100_111_000_000_010 13369: //HFSINT |-|012346|-|-----|-----| |0100_111_000_000_011 13370: //EMXNOP |-|012346|-|-----|-----| |0100_111_000_000_100 13371: // エミュレータ拡張命令 13372: public static void irpEmx () throws M68kException { 13373: switch (XEiJ.regOC & 63) { 13374: case XEiJ.EMX_OPCODE_HFSBOOT & 63: 13375: XEiJ.mpuCycleCount += 40; 13376: if (HFS.hfsIPLBoot ()) { 13377: //JMP $6800.W 13378: irpSetPC (0x00006800); 13379: } 13380: break; 13381: case XEiJ.EMX_OPCODE_HFSINST & 63: 13382: XEiJ.mpuCycleCount += 40; 13383: HFS.hfsInstall (); 13384: break; 13385: case XEiJ.EMX_OPCODE_HFSSTR & 63: 13386: XEiJ.mpuCycleCount += 40; 13387: HFS.hfsStrategy (); 13388: break; 13389: case XEiJ.EMX_OPCODE_HFSINT & 63: 13390: XEiJ.mpuCycleCount += 40; 13391: //XEiJ.mpuClockTime += (int) (TMR_FREQ / 100000L); //0.01ms 13392: if (HFS.hfsInterrupt ()) { 13393: //WAIT 13394: XEiJ.mpuTraceFlag = 0; //トレース例外を発生させない 13395: XEiJ.regPC = XEiJ.regPC0; //ループ 13396: XEiJ.mpuClockTime += XEiJ.TMR_FREQ * 4 / 1000000; //4us。10MHzのとき40サイクル 13397: XEiJ.mpuLastNano += 4000L; 13398: } 13399: break; 13400: case XEiJ.EMX_OPCODE_EMXNOP & 63: 13401: XEiJ.mpuCycleCount += 40; 13402: XEiJ.emxNop (); 13403: break; 13404: case XEiJ.EMX_OPCODE_EMXWAIT & 63: 13405: WaitInstruction.execute (); //待機命令を実行する 13406: break; 13407: default: 13408: XEiJ.mpuCycleCount += 34; 13409: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 13410: throw M68kException.m6eSignal; 13411: } 13412: } //irpEmx 13413: 13414: 13415: 13416: //irpSetPC (a) 13417: // pcへデータを書き込む 13418: // 奇数のときはアドレスエラーが発生する 13419: public static void irpSetPC (int a) throws M68kException { 13420: if (XEiJ.TEST_BIT_0_SHIFT ? a << 31 - 0 < 0 : (a & 1) != 0) { 13421: M68kException.m6eNumber = M68kException.M6E_ADDRESS_ERROR; 13422: M68kException.m6eAddress = a; 13423: M68kException.m6eDirection = XEiJ.MPU_WR_READ; 13424: M68kException.m6eSize = XEiJ.MPU_SS_LONG; 13425: throw M68kException.m6eSignal; 13426: } 13427: if (BranchLog.BLG_ON) { 13428: //BranchLog.blgJump (a); //分岐ログに分岐レコードを追加する 13429: if (BranchLog.blgPrevHeadSuper != (BranchLog.blgHead | BranchLog.blgSuper) || BranchLog.blgPrevTail != XEiJ.regPC0) { //前回のレコードと異なるとき 13430: int i = (char) BranchLog.blgNewestRecord++ << BranchLog.BLG_RECORD_SHIFT; 13431: BranchLog.blgArray[i] = BranchLog.blgPrevHeadSuper = BranchLog.blgHead | BranchLog.blgSuper; 13432: BranchLog.blgArray[i + 1] = BranchLog.blgPrevTail = XEiJ.regPC0; 13433: } 13434: BranchLog.blgHead = XEiJ.regPC = a; 13435: BranchLog.blgSuper = XEiJ.regSRS >>> 13; 13436: } else { 13437: XEiJ.regPC = a; 13438: } 13439: } //irpSetPC 13440: 13441: //irpSetSR (newSr) 13442: // srへデータを書き込む 13443: // ori to sr/andi to sr/eori to sr/move to sr/stop/rteで使用される 13444: // スーパーバイザモードになっていることを確認してから呼び出すこと 13445: // rteではr[15]が指すアドレスからsrとpcを取り出してr[15]を更新してから呼び出すこと 13446: // スーパーバイザモード→ユーザモードのときは移行のための処理を行う 13447: // 新しい割り込みマスクレベルよりも高い割り込み処理の終了をデバイスに通知する 13448: public static void irpSetSR (int newSr) { 13449: XEiJ.regSRT1 = XEiJ.REG_SR_T1 & newSr; 13450: if ((XEiJ.regSRS = XEiJ.REG_SR_S & newSr) == 0) { //スーパーバイザモード→ユーザモード 13451: XEiJ.mpuISP = XEiJ.regRn[15]; //XEiJ.mpuISPを保存 13452: XEiJ.regRn[15] = XEiJ.mpuUSP; //XEiJ.mpuUSPを復元 13453: if (DataBreakPoint.DBP_ON) { 13454: DataBreakPoint.dbpMemoryMap = DataBreakPoint.dbpUserMap; //ユーザメモリマップに切り替える 13455: } else { 13456: XEiJ.busMemoryMap = XEiJ.busUserMap; //ユーザメモリマップに切り替える 13457: } 13458: if (InstructionBreakPoint.IBP_ON) { 13459: InstructionBreakPoint.ibpOp1MemoryMap = InstructionBreakPoint.ibpOp1UserMap; 13460: } 13461: } 13462: int t = (XEiJ.mpuIMR = 0x7f >> ((XEiJ.regSRI = XEiJ.REG_SR_I & newSr) >> 8)) & XEiJ.mpuISR; //XEiJ.mpuISRで1→0とするビット 13463: if (t != 0) { //終了する割り込みがあるとき 13464: XEiJ.mpuISR ^= t; 13465: //デバイスに割り込み処理の終了を通知する 13466: if (t == XEiJ.MPU_MFP_INTERRUPT_MASK) { //MFPのみ 13467: MC68901.mfpDone (); 13468: } else if (t == XEiJ.MPU_DMA_INTERRUPT_MASK) { //DMAのみ 13469: HD63450.dmaDone (); 13470: } else if (t == XEiJ.MPU_SCC_INTERRUPT_MASK) { //SCCのみ 13471: Z8530.sccDone (); 13472: } else if (t == XEiJ.MPU_IOI_INTERRUPT_MASK) { //IOIのみ 13473: IOInterrupt.ioiDone (); 13474: } else if (t == XEiJ.MPU_EB2_INTERRUPT_MASK) { //EB2のみ 13475: XEiJ.eb2Done (); 13476: } else { //SYSのみまたは複数 13477: if (XEiJ.TEST_BIT_1_SHIFT ? t << 24 + XEiJ.MPU_MFP_INTERRUPT_LEVEL < 0 : (t & XEiJ.MPU_MFP_INTERRUPT_MASK) != 0) { 13478: MC68901.mfpDone (); 13479: } 13480: if (t << 24 + XEiJ.MPU_DMA_INTERRUPT_LEVEL < 0) { //(t & XEiJ.MPU_DMA_INTERRUPT_MASK) != 0 13481: HD63450.dmaDone (); 13482: } 13483: if (XEiJ.TEST_BIT_2_SHIFT ? t << 24 + XEiJ.MPU_SCC_INTERRUPT_LEVEL < 0 : (t & XEiJ.MPU_SCC_INTERRUPT_MASK) != 0) { 13484: Z8530.sccDone (); 13485: } 13486: if (t << 24 + XEiJ.MPU_IOI_INTERRUPT_LEVEL < 0) { //(t & XEiJ.MPU_IOI_INTERRUPT_MASK) != 0 13487: IOInterrupt.ioiDone (); 13488: } 13489: if (t << 24 + XEiJ.MPU_EB2_INTERRUPT_LEVEL < 0) { //(t & XEiJ.MPU_EB2_INTERRUPT_MASK) != 0 13490: XEiJ.eb2Done (); 13491: } 13492: if (XEiJ.TEST_BIT_0_SHIFT ? t << 24 + XEiJ.MPU_SYS_INTERRUPT_LEVEL < 0 : (t & XEiJ.MPU_SYS_INTERRUPT_MASK) != 0) { 13493: XEiJ.sysDone (); 13494: } 13495: } 13496: } 13497: XEiJ.mpuIMR |= ~XEiJ.mpuISR & XEiJ.MPU_SYS_INTERRUPT_MASK; //割り込みマスクレベルが7のときレベル7割り込みの処理中でなければレベル7割り込みを許可する 13498: XEiJ.regCCR = XEiJ.REG_CCR_MASK & newSr; 13499: } //irpSetSR 13500: 13501: //irpInterrupt (vectorNumber, level) 13502: // 割り込み処理を開始する 13503: public static void irpInterrupt (int vectorNumber, int level) throws M68kException { 13504: if (XEiJ.regOC == 0b0100_111_001_110_010) { //最後に実行した命令はSTOP命令 13505: XEiJ.regPC = XEiJ.regPC0 + 4; //次の命令に進む 13506: } 13507: XEiJ.mpuClockTime += XEiJ.mpuModifiedUnit * 44; 13508: int save_sr = XEiJ.regSRT1 | XEiJ.regSRS | XEiJ.regSRI | XEiJ.regCCR; 13509: XEiJ.regSRI = level << 8; //割り込みマスクを要求されたレベルに変更する 13510: XEiJ.mpuIMR = 0x7f >> level; 13511: XEiJ.mpuISR |= 0x80 >> level; 13512: int sp = XEiJ.regRn[15]; 13513: XEiJ.regSRT1 = 0; //srのTビットを消す 13514: if (XEiJ.regSRS == 0) { //ユーザモードのとき 13515: XEiJ.regSRS = XEiJ.REG_SR_S; //スーパーバイザモードへ移行する 13516: XEiJ.mpuUSP = sp; //USPを保存 13517: sp = XEiJ.mpuISP; //SSPを復元 13518: if (DataBreakPoint.DBP_ON) { 13519: DataBreakPoint.dbpMemoryMap = DataBreakPoint.dbpSuperMap; //スーパーバイザメモリマップに切り替える 13520: } else { 13521: XEiJ.busMemoryMap = XEiJ.busSuperMap; //スーパーバイザメモリマップに切り替える 13522: } 13523: if (InstructionBreakPoint.IBP_ON) { 13524: InstructionBreakPoint.ibpOp1MemoryMap = InstructionBreakPoint.ibpOp1SuperMap; 13525: } 13526: } 13527: XEiJ.regRn[15] = sp -= 6; 13528: XEiJ.busWl (sp + 2, XEiJ.regPC); //pushl。pcをプッシュする 13529: XEiJ.busWw (sp, save_sr); //pushw。srをプッシュする 13530: if (BranchLog.BLG_ON) { 13531: XEiJ.regPC0 = XEiJ.regPC; //rteによる割り込み終了と同時に次の割り込みを受け付けたとき間でpc0を更新しないと2番目の分岐レコードの終了アドレスが1番目と同じになっておかしな分岐レコードができてしまう 13532: } 13533: irpSetPC (XEiJ.busRlsf (vectorNumber << 2)); //例外ベクタを取り出してジャンプする 13534: } //irpInterrupt 13535: 13536: //irpException (vectorNumber, save_pc, save_sr) 13537: // 例外処理を開始する 13538: // スタックへのプッシュ、ベクタの取り出し、ジャンプのいずれかでバスエラーまたはアドレスエラーが発生する場合がある 13539: public static void irpException (int vectorNumber, int save_pc, int save_sr) throws M68kException { 13540: int sp = XEiJ.regRn[15]; 13541: XEiJ.regSRT1 = XEiJ.mpuTraceFlag = 0; //srのTビットを消す 13542: if (XEiJ.regSRS == 0) { //ユーザモードのとき 13543: XEiJ.regSRS = XEiJ.REG_SR_S; //スーパーバイザモードへ移行する 13544: XEiJ.mpuUSP = sp; //USPを保存 13545: sp = XEiJ.mpuISP; //SSPを復元 13546: if (DataBreakPoint.DBP_ON) { 13547: DataBreakPoint.dbpMemoryMap = DataBreakPoint.dbpSuperMap; //スーパーバイザメモリマップに切り替える 13548: } else { 13549: XEiJ.busMemoryMap = XEiJ.busSuperMap; //スーパーバイザメモリマップに切り替える 13550: } 13551: if (InstructionBreakPoint.IBP_ON) { 13552: InstructionBreakPoint.ibpOp1MemoryMap = InstructionBreakPoint.ibpOp1SuperMap; 13553: } 13554: } 13555: XEiJ.regRn[15] = sp -= 6; 13556: XEiJ.busWl (sp + 2, save_pc); //pushl。pcをプッシュする 13557: XEiJ.busWw (sp, save_sr); //pushw。srをプッシュする 13558: irpSetPC (XEiJ.busRlsf (vectorNumber << 2)); //例外ベクタを取り出してジャンプする 13559: } //irpException 13560: 13561: 13562: 13563: //a = efaAnyByte (ea) //| M+-WXZPI| 13564: // 任意のモードのバイトオペランドの実効アドレスを求める 13565: // (A7)+と-(A7)はA7を奇偶に関わらず2変化させ、跨いだワードの上位バイト(アドレスの小さい方)を参照する 13566: // #<data>はオペコードに続くワードの下位バイトを参照する。上位バイトは不定なので参照してはならない 13567: @SuppressWarnings ("fallthrough") public static int efaAnyByte (int ea) throws M68kException { 13568: int t, w; 13569: switch (ea) { 13570: case 0b010_000: //(A0) 13571: if (XEiJ.EFA_SEPARATE_AR) { 13572: XEiJ.mpuCycleCount += 4; 13573: return XEiJ.regRn[ 8]; 13574: } 13575: //fallthrough 13576: case 0b010_001: //(A1) 13577: if (XEiJ.EFA_SEPARATE_AR) { 13578: XEiJ.mpuCycleCount += 4; 13579: return XEiJ.regRn[ 9]; 13580: } 13581: //fallthrough 13582: case 0b010_010: //(A2) 13583: if (XEiJ.EFA_SEPARATE_AR) { 13584: XEiJ.mpuCycleCount += 4; 13585: return XEiJ.regRn[10]; 13586: } 13587: //fallthrough 13588: case 0b010_011: //(A3) 13589: if (XEiJ.EFA_SEPARATE_AR) { 13590: XEiJ.mpuCycleCount += 4; 13591: return XEiJ.regRn[11]; 13592: } 13593: //fallthrough 13594: case 0b010_100: //(A4) 13595: if (XEiJ.EFA_SEPARATE_AR) { 13596: XEiJ.mpuCycleCount += 4; 13597: return XEiJ.regRn[12]; 13598: } 13599: //fallthrough 13600: case 0b010_101: //(A5) 13601: if (XEiJ.EFA_SEPARATE_AR) { 13602: XEiJ.mpuCycleCount += 4; 13603: return XEiJ.regRn[13]; 13604: } 13605: //fallthrough 13606: case 0b010_110: //(A6) 13607: if (XEiJ.EFA_SEPARATE_AR) { 13608: XEiJ.mpuCycleCount += 4; 13609: return XEiJ.regRn[14]; 13610: } 13611: //fallthrough 13612: case 0b010_111: //(A7) 13613: if (XEiJ.EFA_SEPARATE_AR) { 13614: XEiJ.mpuCycleCount += 4; 13615: return XEiJ.regRn[15]; 13616: } else { 13617: XEiJ.mpuCycleCount += 4; 13618: return XEiJ.regRn[ea - (0b010_000 - 8)]; 13619: } 13620: case 0b011_000: //(A0)+ 13621: if (XEiJ.EFA_SEPARATE_AR) { 13622: XEiJ.mpuCycleCount += 4; 13623: return XEiJ.regRn[ 8]++; 13624: } 13625: //fallthrough 13626: case 0b011_001: //(A1)+ 13627: if (XEiJ.EFA_SEPARATE_AR) { 13628: XEiJ.mpuCycleCount += 4; 13629: return XEiJ.regRn[ 9]++; 13630: } 13631: //fallthrough 13632: case 0b011_010: //(A2)+ 13633: if (XEiJ.EFA_SEPARATE_AR) { 13634: XEiJ.mpuCycleCount += 4; 13635: return XEiJ.regRn[10]++; 13636: } 13637: //fallthrough 13638: case 0b011_011: //(A3)+ 13639: if (XEiJ.EFA_SEPARATE_AR) { 13640: XEiJ.mpuCycleCount += 4; 13641: return XEiJ.regRn[11]++; 13642: } 13643: //fallthrough 13644: case 0b011_100: //(A4)+ 13645: if (XEiJ.EFA_SEPARATE_AR) { 13646: XEiJ.mpuCycleCount += 4; 13647: return XEiJ.regRn[12]++; 13648: } 13649: //fallthrough 13650: case 0b011_101: //(A5)+ 13651: if (XEiJ.EFA_SEPARATE_AR) { 13652: XEiJ.mpuCycleCount += 4; 13653: return XEiJ.regRn[13]++; 13654: } 13655: //fallthrough 13656: case 0b011_110: //(A6)+ 13657: if (XEiJ.EFA_SEPARATE_AR) { 13658: XEiJ.mpuCycleCount += 4; 13659: return XEiJ.regRn[14]++; 13660: } else { 13661: XEiJ.mpuCycleCount += 4; 13662: return XEiJ.regRn[ea - (0b011_000 - 8)]++; 13663: } 13664: case 0b011_111: //(A7)+ 13665: XEiJ.mpuCycleCount += 4; 13666: return (XEiJ.regRn[15] += 2) - 2; 13667: case 0b100_000: //-(A0) 13668: if (XEiJ.EFA_SEPARATE_AR) { 13669: XEiJ.mpuCycleCount += 6; 13670: return --XEiJ.regRn[ 8]; 13671: } 13672: //fallthrough 13673: case 0b100_001: //-(A1) 13674: if (XEiJ.EFA_SEPARATE_AR) { 13675: XEiJ.mpuCycleCount += 6; 13676: return --XEiJ.regRn[ 9]; 13677: } 13678: //fallthrough 13679: case 0b100_010: //-(A2) 13680: if (XEiJ.EFA_SEPARATE_AR) { 13681: XEiJ.mpuCycleCount += 6; 13682: return --XEiJ.regRn[10]; 13683: } 13684: //fallthrough 13685: case 0b100_011: //-(A3) 13686: if (XEiJ.EFA_SEPARATE_AR) { 13687: XEiJ.mpuCycleCount += 6; 13688: return --XEiJ.regRn[11]; 13689: } 13690: //fallthrough 13691: case 0b100_100: //-(A4) 13692: if (XEiJ.EFA_SEPARATE_AR) { 13693: XEiJ.mpuCycleCount += 6; 13694: return --XEiJ.regRn[12]; 13695: } 13696: //fallthrough 13697: case 0b100_101: //-(A5) 13698: if (XEiJ.EFA_SEPARATE_AR) { 13699: XEiJ.mpuCycleCount += 6; 13700: return --XEiJ.regRn[13]; 13701: } 13702: //fallthrough 13703: case 0b100_110: //-(A6) 13704: if (XEiJ.EFA_SEPARATE_AR) { 13705: XEiJ.mpuCycleCount += 6; 13706: return --XEiJ.regRn[14]; 13707: } else { 13708: XEiJ.mpuCycleCount += 6; 13709: return --XEiJ.regRn[ea - (0b100_000 - 8)]; 13710: } 13711: case 0b100_111: //-(A7) 13712: XEiJ.mpuCycleCount += 6; 13713: return XEiJ.regRn[15] -= 2; 13714: case 0b101_000: //(d16,A0) 13715: case 0b101_001: //(d16,A1) 13716: case 0b101_010: //(d16,A2) 13717: case 0b101_011: //(d16,A3) 13718: case 0b101_100: //(d16,A4) 13719: case 0b101_101: //(d16,A5) 13720: case 0b101_110: //(d16,A6) 13721: case 0b101_111: //(d16,A7) 13722: XEiJ.mpuCycleCount += 8; 13723: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 13724: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 13725: + XEiJ.busRwse ((XEiJ.regPC += 2) - 2)); //pcws。ワードディスプレースメント 13726: } else { 13727: t = XEiJ.regPC; 13728: XEiJ.regPC = t + 2; 13729: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 13730: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 13731: } 13732: case 0b110_000: //(d8,A0,Rn.wl) 13733: case 0b110_001: //(d8,A1,Rn.wl) 13734: case 0b110_010: //(d8,A2,Rn.wl) 13735: case 0b110_011: //(d8,A3,Rn.wl) 13736: case 0b110_100: //(d8,A4,Rn.wl) 13737: case 0b110_101: //(d8,A5,Rn.wl) 13738: case 0b110_110: //(d8,A6,Rn.wl) 13739: case 0b110_111: //(d8,A7,Rn.wl) 13740: XEiJ.mpuCycleCount += 10; 13741: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 13742: w = XEiJ.busRwze ((XEiJ.regPC += 2) - 2); //pcwz。拡張ワード 13743: } else { 13744: w = XEiJ.regPC; 13745: XEiJ.regPC = w + 2; 13746: w = XEiJ.busRwze (w); //pcwz。拡張ワード 13747: } 13748: return (XEiJ.regRn[ea - (0b110_000 - 8)] //ベースレジスタ 13749: + (byte) w //バイトディスプレースメント 13750: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 13751: XEiJ.regRn[w >> 12])); //ロングインデックス 13752: case 0b111_000: //(xxx).W 13753: XEiJ.mpuCycleCount += 8; 13754: return XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 13755: case 0b111_001: //(xxx).L 13756: XEiJ.mpuCycleCount += 12; 13757: return XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 13758: case 0b111_010: //(d16,PC) 13759: XEiJ.mpuCycleCount += 8; 13760: t = XEiJ.regPC; 13761: XEiJ.regPC = t + 2; 13762: return (t //ベースレジスタ 13763: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 13764: case 0b111_011: //(d8,PC,Rn.wl) 13765: XEiJ.mpuCycleCount += 10; 13766: t = XEiJ.regPC; 13767: XEiJ.regPC = t + 2; 13768: w = XEiJ.busRwze (t); //pcwz。拡張ワード 13769: return (t //ベースレジスタ 13770: + (byte) w //バイトディスプレースメント 13771: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 13772: XEiJ.regRn[w >> 12])); //ロングインデックス 13773: case 0b111_100: //#<data> 13774: XEiJ.mpuCycleCount += 4; 13775: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 13776: return (XEiJ.regPC += 2) - 1; //下位バイト 13777: } else { 13778: t = XEiJ.regPC; 13779: XEiJ.regPC = t + 2; 13780: return t + 1; //下位バイト 13781: } 13782: } //switch 13783: XEiJ.mpuCycleCount += 34; 13784: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 13785: throw M68kException.m6eSignal; 13786: } //efaAnyByte 13787: 13788: //a = efaMemByte (ea) //| M+-WXZP | 13789: // メモリモードのバイトオペランドの実効アドレスを求める 13790: // efaAnyByteとの違いは#<data>がないこと 13791: @SuppressWarnings ("fallthrough") public static int efaMemByte (int ea) throws M68kException { 13792: int t, w; 13793: switch (ea) { 13794: case 0b010_000: //(A0) 13795: if (XEiJ.EFA_SEPARATE_AR) { 13796: XEiJ.mpuCycleCount += 4; 13797: return XEiJ.regRn[ 8]; 13798: } 13799: //fallthrough 13800: case 0b010_001: //(A1) 13801: if (XEiJ.EFA_SEPARATE_AR) { 13802: XEiJ.mpuCycleCount += 4; 13803: return XEiJ.regRn[ 9]; 13804: } 13805: //fallthrough 13806: case 0b010_010: //(A2) 13807: if (XEiJ.EFA_SEPARATE_AR) { 13808: XEiJ.mpuCycleCount += 4; 13809: return XEiJ.regRn[10]; 13810: } 13811: //fallthrough 13812: case 0b010_011: //(A3) 13813: if (XEiJ.EFA_SEPARATE_AR) { 13814: XEiJ.mpuCycleCount += 4; 13815: return XEiJ.regRn[11]; 13816: } 13817: //fallthrough 13818: case 0b010_100: //(A4) 13819: if (XEiJ.EFA_SEPARATE_AR) { 13820: XEiJ.mpuCycleCount += 4; 13821: return XEiJ.regRn[12]; 13822: } 13823: //fallthrough 13824: case 0b010_101: //(A5) 13825: if (XEiJ.EFA_SEPARATE_AR) { 13826: XEiJ.mpuCycleCount += 4; 13827: return XEiJ.regRn[13]; 13828: } 13829: //fallthrough 13830: case 0b010_110: //(A6) 13831: if (XEiJ.EFA_SEPARATE_AR) { 13832: XEiJ.mpuCycleCount += 4; 13833: return XEiJ.regRn[14]; 13834: } 13835: //fallthrough 13836: case 0b010_111: //(A7) 13837: if (XEiJ.EFA_SEPARATE_AR) { 13838: XEiJ.mpuCycleCount += 4; 13839: return XEiJ.regRn[15]; 13840: } else { 13841: XEiJ.mpuCycleCount += 4; 13842: return XEiJ.regRn[ea - (0b010_000 - 8)]; 13843: } 13844: case 0b011_000: //(A0)+ 13845: if (XEiJ.EFA_SEPARATE_AR) { 13846: XEiJ.mpuCycleCount += 4; 13847: return XEiJ.regRn[ 8]++; 13848: } 13849: //fallthrough 13850: case 0b011_001: //(A1)+ 13851: if (XEiJ.EFA_SEPARATE_AR) { 13852: XEiJ.mpuCycleCount += 4; 13853: return XEiJ.regRn[ 9]++; 13854: } 13855: //fallthrough 13856: case 0b011_010: //(A2)+ 13857: if (XEiJ.EFA_SEPARATE_AR) { 13858: XEiJ.mpuCycleCount += 4; 13859: return XEiJ.regRn[10]++; 13860: } 13861: //fallthrough 13862: case 0b011_011: //(A3)+ 13863: if (XEiJ.EFA_SEPARATE_AR) { 13864: XEiJ.mpuCycleCount += 4; 13865: return XEiJ.regRn[11]++; 13866: } 13867: //fallthrough 13868: case 0b011_100: //(A4)+ 13869: if (XEiJ.EFA_SEPARATE_AR) { 13870: XEiJ.mpuCycleCount += 4; 13871: return XEiJ.regRn[12]++; 13872: } 13873: //fallthrough 13874: case 0b011_101: //(A5)+ 13875: if (XEiJ.EFA_SEPARATE_AR) { 13876: XEiJ.mpuCycleCount += 4; 13877: return XEiJ.regRn[13]++; 13878: } 13879: //fallthrough 13880: case 0b011_110: //(A6)+ 13881: if (XEiJ.EFA_SEPARATE_AR) { 13882: XEiJ.mpuCycleCount += 4; 13883: return XEiJ.regRn[14]++; 13884: } else { 13885: XEiJ.mpuCycleCount += 4; 13886: return XEiJ.regRn[ea - (0b011_000 - 8)]++; 13887: } 13888: case 0b011_111: //(A7)+ 13889: XEiJ.mpuCycleCount += 4; 13890: return (XEiJ.regRn[15] += 2) - 2; 13891: case 0b100_000: //-(A0) 13892: if (XEiJ.EFA_SEPARATE_AR) { 13893: XEiJ.mpuCycleCount += 6; 13894: return --XEiJ.regRn[ 8]; 13895: } 13896: //fallthrough 13897: case 0b100_001: //-(A1) 13898: if (XEiJ.EFA_SEPARATE_AR) { 13899: XEiJ.mpuCycleCount += 6; 13900: return --XEiJ.regRn[ 9]; 13901: } 13902: //fallthrough 13903: case 0b100_010: //-(A2) 13904: if (XEiJ.EFA_SEPARATE_AR) { 13905: XEiJ.mpuCycleCount += 6; 13906: return --XEiJ.regRn[10]; 13907: } 13908: //fallthrough 13909: case 0b100_011: //-(A3) 13910: if (XEiJ.EFA_SEPARATE_AR) { 13911: XEiJ.mpuCycleCount += 6; 13912: return --XEiJ.regRn[11]; 13913: } 13914: //fallthrough 13915: case 0b100_100: //-(A4) 13916: if (XEiJ.EFA_SEPARATE_AR) { 13917: XEiJ.mpuCycleCount += 6; 13918: return --XEiJ.regRn[12]; 13919: } 13920: //fallthrough 13921: case 0b100_101: //-(A5) 13922: if (XEiJ.EFA_SEPARATE_AR) { 13923: XEiJ.mpuCycleCount += 6; 13924: return --XEiJ.regRn[13]; 13925: } 13926: //fallthrough 13927: case 0b100_110: //-(A6) 13928: if (XEiJ.EFA_SEPARATE_AR) { 13929: XEiJ.mpuCycleCount += 6; 13930: return --XEiJ.regRn[14]; 13931: } else { 13932: XEiJ.mpuCycleCount += 6; 13933: return --XEiJ.regRn[ea - (0b100_000 - 8)]; 13934: } 13935: case 0b100_111: //-(A7) 13936: XEiJ.mpuCycleCount += 6; 13937: return XEiJ.regRn[15] -= 2; 13938: case 0b101_000: //(d16,A0) 13939: case 0b101_001: //(d16,A1) 13940: case 0b101_010: //(d16,A2) 13941: case 0b101_011: //(d16,A3) 13942: case 0b101_100: //(d16,A4) 13943: case 0b101_101: //(d16,A5) 13944: case 0b101_110: //(d16,A6) 13945: case 0b101_111: //(d16,A7) 13946: XEiJ.mpuCycleCount += 8; 13947: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 13948: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 13949: + XEiJ.busRwse ((XEiJ.regPC += 2) - 2)); //pcws。ワードディスプレースメント 13950: } else { 13951: t = XEiJ.regPC; 13952: XEiJ.regPC = t + 2; 13953: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 13954: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 13955: } 13956: case 0b110_000: //(d8,A0,Rn.wl) 13957: case 0b110_001: //(d8,A1,Rn.wl) 13958: case 0b110_010: //(d8,A2,Rn.wl) 13959: case 0b110_011: //(d8,A3,Rn.wl) 13960: case 0b110_100: //(d8,A4,Rn.wl) 13961: case 0b110_101: //(d8,A5,Rn.wl) 13962: case 0b110_110: //(d8,A6,Rn.wl) 13963: case 0b110_111: //(d8,A7,Rn.wl) 13964: XEiJ.mpuCycleCount += 10; 13965: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 13966: w = XEiJ.busRwze ((XEiJ.regPC += 2) - 2); //pcwz。拡張ワード 13967: } else { 13968: w = XEiJ.regPC; 13969: XEiJ.regPC = w + 2; 13970: w = XEiJ.busRwze (w); //pcwz。拡張ワード 13971: } 13972: return (XEiJ.regRn[ea - (0b110_000 - 8)] //ベースレジスタ 13973: + (byte) w //バイトディスプレースメント 13974: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 13975: XEiJ.regRn[w >> 12])); //ロングインデックス 13976: case 0b111_000: //(xxx).W 13977: XEiJ.mpuCycleCount += 8; 13978: return XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 13979: case 0b111_001: //(xxx).L 13980: XEiJ.mpuCycleCount += 12; 13981: return XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 13982: case 0b111_010: //(d16,PC) 13983: XEiJ.mpuCycleCount += 8; 13984: t = XEiJ.regPC; 13985: XEiJ.regPC = t + 2; 13986: return (t //ベースレジスタ 13987: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 13988: case 0b111_011: //(d8,PC,Rn.wl) 13989: XEiJ.mpuCycleCount += 10; 13990: t = XEiJ.regPC; 13991: XEiJ.regPC = t + 2; 13992: w = XEiJ.busRwze (t); //pcwz。拡張ワード 13993: return (t //ベースレジスタ 13994: + (byte) w //バイトディスプレースメント 13995: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 13996: XEiJ.regRn[w >> 12])); //ロングインデックス 13997: } //switch 13998: XEiJ.mpuCycleCount += 34; 13999: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 14000: throw M68kException.m6eSignal; 14001: } //efaMemByte 14002: 14003: //a = efaMltByte (ea) //| M+-WXZ | 14004: // メモリ可変モードのバイトオペランドの実効アドレスを求める 14005: // efaMemByteとの違いは(d16,PC)と(d8,PC,Rn.wl)がないこと 14006: @SuppressWarnings ("fallthrough") public static int efaMltByte (int ea) throws M68kException { 14007: int t, w; 14008: switch (ea) { 14009: case 0b010_000: //(A0) 14010: if (XEiJ.EFA_SEPARATE_AR) { 14011: XEiJ.mpuCycleCount += 4; 14012: return XEiJ.regRn[ 8]; 14013: } 14014: //fallthrough 14015: case 0b010_001: //(A1) 14016: if (XEiJ.EFA_SEPARATE_AR) { 14017: XEiJ.mpuCycleCount += 4; 14018: return XEiJ.regRn[ 9]; 14019: } 14020: //fallthrough 14021: case 0b010_010: //(A2) 14022: if (XEiJ.EFA_SEPARATE_AR) { 14023: XEiJ.mpuCycleCount += 4; 14024: return XEiJ.regRn[10]; 14025: } 14026: //fallthrough 14027: case 0b010_011: //(A3) 14028: if (XEiJ.EFA_SEPARATE_AR) { 14029: XEiJ.mpuCycleCount += 4; 14030: return XEiJ.regRn[11]; 14031: } 14032: //fallthrough 14033: case 0b010_100: //(A4) 14034: if (XEiJ.EFA_SEPARATE_AR) { 14035: XEiJ.mpuCycleCount += 4; 14036: return XEiJ.regRn[12]; 14037: } 14038: //fallthrough 14039: case 0b010_101: //(A5) 14040: if (XEiJ.EFA_SEPARATE_AR) { 14041: XEiJ.mpuCycleCount += 4; 14042: return XEiJ.regRn[13]; 14043: } 14044: //fallthrough 14045: case 0b010_110: //(A6) 14046: if (XEiJ.EFA_SEPARATE_AR) { 14047: XEiJ.mpuCycleCount += 4; 14048: return XEiJ.regRn[14]; 14049: } 14050: //fallthrough 14051: case 0b010_111: //(A7) 14052: if (XEiJ.EFA_SEPARATE_AR) { 14053: XEiJ.mpuCycleCount += 4; 14054: return XEiJ.regRn[15]; 14055: } else { 14056: XEiJ.mpuCycleCount += 4; 14057: return XEiJ.regRn[ea - (0b010_000 - 8)]; 14058: } 14059: case 0b011_000: //(A0)+ 14060: if (XEiJ.EFA_SEPARATE_AR) { 14061: XEiJ.mpuCycleCount += 4; 14062: return XEiJ.regRn[ 8]++; 14063: } 14064: //fallthrough 14065: case 0b011_001: //(A1)+ 14066: if (XEiJ.EFA_SEPARATE_AR) { 14067: XEiJ.mpuCycleCount += 4; 14068: return XEiJ.regRn[ 9]++; 14069: } 14070: //fallthrough 14071: case 0b011_010: //(A2)+ 14072: if (XEiJ.EFA_SEPARATE_AR) { 14073: XEiJ.mpuCycleCount += 4; 14074: return XEiJ.regRn[10]++; 14075: } 14076: //fallthrough 14077: case 0b011_011: //(A3)+ 14078: if (XEiJ.EFA_SEPARATE_AR) { 14079: XEiJ.mpuCycleCount += 4; 14080: return XEiJ.regRn[11]++; 14081: } 14082: //fallthrough 14083: case 0b011_100: //(A4)+ 14084: if (XEiJ.EFA_SEPARATE_AR) { 14085: XEiJ.mpuCycleCount += 4; 14086: return XEiJ.regRn[12]++; 14087: } 14088: //fallthrough 14089: case 0b011_101: //(A5)+ 14090: if (XEiJ.EFA_SEPARATE_AR) { 14091: XEiJ.mpuCycleCount += 4; 14092: return XEiJ.regRn[13]++; 14093: } 14094: //fallthrough 14095: case 0b011_110: //(A6)+ 14096: if (XEiJ.EFA_SEPARATE_AR) { 14097: XEiJ.mpuCycleCount += 4; 14098: return XEiJ.regRn[14]++; 14099: } else { 14100: XEiJ.mpuCycleCount += 4; 14101: return XEiJ.regRn[ea - (0b011_000 - 8)]++; 14102: } 14103: case 0b011_111: //(A7)+ 14104: XEiJ.mpuCycleCount += 4; 14105: return (XEiJ.regRn[15] += 2) - 2; 14106: case 0b100_000: //-(A0) 14107: if (XEiJ.EFA_SEPARATE_AR) { 14108: XEiJ.mpuCycleCount += 6; 14109: return --XEiJ.regRn[ 8]; 14110: } 14111: //fallthrough 14112: case 0b100_001: //-(A1) 14113: if (XEiJ.EFA_SEPARATE_AR) { 14114: XEiJ.mpuCycleCount += 6; 14115: return --XEiJ.regRn[ 9]; 14116: } 14117: //fallthrough 14118: case 0b100_010: //-(A2) 14119: if (XEiJ.EFA_SEPARATE_AR) { 14120: XEiJ.mpuCycleCount += 6; 14121: return --XEiJ.regRn[10]; 14122: } 14123: //fallthrough 14124: case 0b100_011: //-(A3) 14125: if (XEiJ.EFA_SEPARATE_AR) { 14126: XEiJ.mpuCycleCount += 6; 14127: return --XEiJ.regRn[11]; 14128: } 14129: //fallthrough 14130: case 0b100_100: //-(A4) 14131: if (XEiJ.EFA_SEPARATE_AR) { 14132: XEiJ.mpuCycleCount += 6; 14133: return --XEiJ.regRn[12]; 14134: } 14135: //fallthrough 14136: case 0b100_101: //-(A5) 14137: if (XEiJ.EFA_SEPARATE_AR) { 14138: XEiJ.mpuCycleCount += 6; 14139: return --XEiJ.regRn[13]; 14140: } 14141: //fallthrough 14142: case 0b100_110: //-(A6) 14143: if (XEiJ.EFA_SEPARATE_AR) { 14144: XEiJ.mpuCycleCount += 6; 14145: return --XEiJ.regRn[14]; 14146: } else { 14147: XEiJ.mpuCycleCount += 6; 14148: return --XEiJ.regRn[ea - (0b100_000 - 8)]; 14149: } 14150: case 0b100_111: //-(A7) 14151: XEiJ.mpuCycleCount += 6; 14152: return XEiJ.regRn[15] -= 2; 14153: case 0b101_000: //(d16,A0) 14154: case 0b101_001: //(d16,A1) 14155: case 0b101_010: //(d16,A2) 14156: case 0b101_011: //(d16,A3) 14157: case 0b101_100: //(d16,A4) 14158: case 0b101_101: //(d16,A5) 14159: case 0b101_110: //(d16,A6) 14160: case 0b101_111: //(d16,A7) 14161: XEiJ.mpuCycleCount += 8; 14162: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 14163: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 14164: + XEiJ.busRwse ((XEiJ.regPC += 2) - 2)); //pcws。ワードディスプレースメント 14165: } else { 14166: t = XEiJ.regPC; 14167: XEiJ.regPC = t + 2; 14168: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 14169: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 14170: } 14171: case 0b110_000: //(d8,A0,Rn.wl) 14172: case 0b110_001: //(d8,A1,Rn.wl) 14173: case 0b110_010: //(d8,A2,Rn.wl) 14174: case 0b110_011: //(d8,A3,Rn.wl) 14175: case 0b110_100: //(d8,A4,Rn.wl) 14176: case 0b110_101: //(d8,A5,Rn.wl) 14177: case 0b110_110: //(d8,A6,Rn.wl) 14178: case 0b110_111: //(d8,A7,Rn.wl) 14179: XEiJ.mpuCycleCount += 10; 14180: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 14181: w = XEiJ.busRwze ((XEiJ.regPC += 2) - 2); //pcwz。拡張ワード 14182: } else { 14183: w = XEiJ.regPC; 14184: XEiJ.regPC = w + 2; 14185: w = XEiJ.busRwze (w); //pcwz。拡張ワード 14186: } 14187: return (XEiJ.regRn[ea - (0b110_000 - 8)] //ベースレジスタ 14188: + (byte) w //バイトディスプレースメント 14189: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 14190: XEiJ.regRn[w >> 12])); //ロングインデックス 14191: case 0b111_000: //(xxx).W 14192: XEiJ.mpuCycleCount += 8; 14193: return XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 14194: case 0b111_001: //(xxx).L 14195: XEiJ.mpuCycleCount += 12; 14196: return XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 14197: } //switch 14198: XEiJ.mpuCycleCount += 34; 14199: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 14200: throw M68kException.m6eSignal; 14201: } //efaMltByte 14202: 14203: //a = efaCntByte (ea) //| M WXZP | 14204: // 制御モードのロングオペランドの実効アドレスを求める 14205: // efaMemByteとの違いは(Ar)+と-(Ar)がないこと 14206: @SuppressWarnings ("fallthrough") public static int efaCntByte (int ea) throws M68kException { 14207: int t, w; 14208: switch (ea) { 14209: case 0b010_000: //(A0) 14210: if (XEiJ.EFA_SEPARATE_AR) { 14211: XEiJ.mpuCycleCount += 4; 14212: return XEiJ.regRn[ 8]; 14213: } 14214: //fallthrough 14215: case 0b010_001: //(A1) 14216: if (XEiJ.EFA_SEPARATE_AR) { 14217: XEiJ.mpuCycleCount += 4; 14218: return XEiJ.regRn[ 9]; 14219: } 14220: //fallthrough 14221: case 0b010_010: //(A2) 14222: if (XEiJ.EFA_SEPARATE_AR) { 14223: XEiJ.mpuCycleCount += 4; 14224: return XEiJ.regRn[10]; 14225: } 14226: //fallthrough 14227: case 0b010_011: //(A3) 14228: if (XEiJ.EFA_SEPARATE_AR) { 14229: XEiJ.mpuCycleCount += 4; 14230: return XEiJ.regRn[11]; 14231: } 14232: //fallthrough 14233: case 0b010_100: //(A4) 14234: if (XEiJ.EFA_SEPARATE_AR) { 14235: XEiJ.mpuCycleCount += 4; 14236: return XEiJ.regRn[12]; 14237: } 14238: //fallthrough 14239: case 0b010_101: //(A5) 14240: if (XEiJ.EFA_SEPARATE_AR) { 14241: XEiJ.mpuCycleCount += 4; 14242: return XEiJ.regRn[13]; 14243: } 14244: //fallthrough 14245: case 0b010_110: //(A6) 14246: if (XEiJ.EFA_SEPARATE_AR) { 14247: XEiJ.mpuCycleCount += 4; 14248: return XEiJ.regRn[14]; 14249: } 14250: //fallthrough 14251: case 0b010_111: //(A7) 14252: if (XEiJ.EFA_SEPARATE_AR) { 14253: XEiJ.mpuCycleCount += 4; 14254: return XEiJ.regRn[15]; 14255: } else { 14256: XEiJ.mpuCycleCount += 4; 14257: return XEiJ.regRn[ea - (0b010_000 - 8)]; 14258: } 14259: case 0b101_000: //(d16,A0) 14260: case 0b101_001: //(d16,A1) 14261: case 0b101_010: //(d16,A2) 14262: case 0b101_011: //(d16,A3) 14263: case 0b101_100: //(d16,A4) 14264: case 0b101_101: //(d16,A5) 14265: case 0b101_110: //(d16,A6) 14266: case 0b101_111: //(d16,A7) 14267: XEiJ.mpuCycleCount += 8; 14268: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 14269: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 14270: + XEiJ.busRwse ((XEiJ.regPC += 2) - 2)); //pcws。ワードディスプレースメント 14271: } else { 14272: t = XEiJ.regPC; 14273: XEiJ.regPC = t + 2; 14274: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 14275: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 14276: } 14277: case 0b110_000: //(d8,A0,Rn.wl) 14278: case 0b110_001: //(d8,A1,Rn.wl) 14279: case 0b110_010: //(d8,A2,Rn.wl) 14280: case 0b110_011: //(d8,A3,Rn.wl) 14281: case 0b110_100: //(d8,A4,Rn.wl) 14282: case 0b110_101: //(d8,A5,Rn.wl) 14283: case 0b110_110: //(d8,A6,Rn.wl) 14284: case 0b110_111: //(d8,A7,Rn.wl) 14285: XEiJ.mpuCycleCount += 10; 14286: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 14287: w = XEiJ.busRwze ((XEiJ.regPC += 2) - 2); //pcwz。拡張ワード 14288: } else { 14289: w = XEiJ.regPC; 14290: XEiJ.regPC = w + 2; 14291: w = XEiJ.busRwze (w); //pcwz。拡張ワード 14292: } 14293: return (XEiJ.regRn[ea - (0b110_000 - 8)] //ベースレジスタ 14294: + (byte) w //バイトディスプレースメント 14295: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 14296: XEiJ.regRn[w >> 12])); //ロングインデックス 14297: case 0b111_000: //(xxx).W 14298: XEiJ.mpuCycleCount += 8; 14299: return XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 14300: case 0b111_001: //(xxx).L 14301: XEiJ.mpuCycleCount += 12; 14302: return XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 14303: case 0b111_010: //(d16,PC) 14304: XEiJ.mpuCycleCount += 8; 14305: t = XEiJ.regPC; 14306: XEiJ.regPC = t + 2; 14307: return (t //ベースレジスタ 14308: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 14309: case 0b111_011: //(d8,PC,Rn.wl) 14310: XEiJ.mpuCycleCount += 10; 14311: t = XEiJ.regPC; 14312: XEiJ.regPC = t + 2; 14313: w = XEiJ.busRwze (t); //pcwz。拡張ワード 14314: return (t //ベースレジスタ 14315: + (byte) w //バイトディスプレースメント 14316: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 14317: XEiJ.regRn[w >> 12])); //ロングインデックス 14318: } //switch 14319: XEiJ.mpuCycleCount += 34; 14320: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 14321: throw M68kException.m6eSignal; 14322: } //efaCntByte 14323: 14324: //a = efaAnyWord (ea) //| M+-WXZPI| 14325: // 任意のモードのワードオペランドの実効アドレスを求める 14326: // efaAnyByteとの違いは(Ar)+と-(Ar)がArを2変化させることと、(A7)+と-(A7)と#<data>の特別な動作がないこと 14327: @SuppressWarnings ("fallthrough") public static int efaAnyWord (int ea) throws M68kException { 14328: int t, w; 14329: switch (ea) { 14330: case 0b010_000: //(A0) 14331: if (XEiJ.EFA_SEPARATE_AR) { 14332: XEiJ.mpuCycleCount += 4; 14333: return XEiJ.regRn[ 8]; 14334: } 14335: //fallthrough 14336: case 0b010_001: //(A1) 14337: if (XEiJ.EFA_SEPARATE_AR) { 14338: XEiJ.mpuCycleCount += 4; 14339: return XEiJ.regRn[ 9]; 14340: } 14341: //fallthrough 14342: case 0b010_010: //(A2) 14343: if (XEiJ.EFA_SEPARATE_AR) { 14344: XEiJ.mpuCycleCount += 4; 14345: return XEiJ.regRn[10]; 14346: } 14347: //fallthrough 14348: case 0b010_011: //(A3) 14349: if (XEiJ.EFA_SEPARATE_AR) { 14350: XEiJ.mpuCycleCount += 4; 14351: return XEiJ.regRn[11]; 14352: } 14353: //fallthrough 14354: case 0b010_100: //(A4) 14355: if (XEiJ.EFA_SEPARATE_AR) { 14356: XEiJ.mpuCycleCount += 4; 14357: return XEiJ.regRn[12]; 14358: } 14359: //fallthrough 14360: case 0b010_101: //(A5) 14361: if (XEiJ.EFA_SEPARATE_AR) { 14362: XEiJ.mpuCycleCount += 4; 14363: return XEiJ.regRn[13]; 14364: } 14365: //fallthrough 14366: case 0b010_110: //(A6) 14367: if (XEiJ.EFA_SEPARATE_AR) { 14368: XEiJ.mpuCycleCount += 4; 14369: return XEiJ.regRn[14]; 14370: } 14371: //fallthrough 14372: case 0b010_111: //(A7) 14373: if (XEiJ.EFA_SEPARATE_AR) { 14374: XEiJ.mpuCycleCount += 4; 14375: return XEiJ.regRn[15]; 14376: } else { 14377: XEiJ.mpuCycleCount += 4; 14378: return XEiJ.regRn[ea - (0b010_000 - 8)]; 14379: } 14380: case 0b011_000: //(A0)+ 14381: if (XEiJ.EFA_SEPARATE_AR) { 14382: XEiJ.mpuCycleCount += 4; 14383: return (XEiJ.regRn[ 8] += 2) - 2; 14384: } 14385: //fallthrough 14386: case 0b011_001: //(A1)+ 14387: if (XEiJ.EFA_SEPARATE_AR) { 14388: XEiJ.mpuCycleCount += 4; 14389: return (XEiJ.regRn[ 9] += 2) - 2; 14390: } 14391: //fallthrough 14392: case 0b011_010: //(A2)+ 14393: if (XEiJ.EFA_SEPARATE_AR) { 14394: XEiJ.mpuCycleCount += 4; 14395: return (XEiJ.regRn[10] += 2) - 2; 14396: } 14397: //fallthrough 14398: case 0b011_011: //(A3)+ 14399: if (XEiJ.EFA_SEPARATE_AR) { 14400: XEiJ.mpuCycleCount += 4; 14401: return (XEiJ.regRn[11] += 2) - 2; 14402: } 14403: //fallthrough 14404: case 0b011_100: //(A4)+ 14405: if (XEiJ.EFA_SEPARATE_AR) { 14406: XEiJ.mpuCycleCount += 4; 14407: return (XEiJ.regRn[12] += 2) - 2; 14408: } 14409: //fallthrough 14410: case 0b011_101: //(A5)+ 14411: if (XEiJ.EFA_SEPARATE_AR) { 14412: XEiJ.mpuCycleCount += 4; 14413: return (XEiJ.regRn[13] += 2) - 2; 14414: } 14415: //fallthrough 14416: case 0b011_110: //(A6)+ 14417: if (XEiJ.EFA_SEPARATE_AR) { 14418: XEiJ.mpuCycleCount += 4; 14419: return (XEiJ.regRn[14] += 2) - 2; 14420: } 14421: //fallthrough 14422: case 0b011_111: //(A7)+ 14423: if (XEiJ.EFA_SEPARATE_AR) { 14424: XEiJ.mpuCycleCount += 4; 14425: return (XEiJ.regRn[15] += 2) - 2; 14426: } else { 14427: XEiJ.mpuCycleCount += 4; 14428: return (XEiJ.regRn[ea - (0b011_000 - 8)] += 2) - 2; 14429: } 14430: case 0b100_000: //-(A0) 14431: if (XEiJ.EFA_SEPARATE_AR) { 14432: XEiJ.mpuCycleCount += 6; 14433: return XEiJ.regRn[ 8] -= 2; 14434: } 14435: //fallthrough 14436: case 0b100_001: //-(A1) 14437: if (XEiJ.EFA_SEPARATE_AR) { 14438: XEiJ.mpuCycleCount += 6; 14439: return XEiJ.regRn[ 9] -= 2; 14440: } 14441: //fallthrough 14442: case 0b100_010: //-(A2) 14443: if (XEiJ.EFA_SEPARATE_AR) { 14444: XEiJ.mpuCycleCount += 6; 14445: return XEiJ.regRn[10] -= 2; 14446: } 14447: //fallthrough 14448: case 0b100_011: //-(A3) 14449: if (XEiJ.EFA_SEPARATE_AR) { 14450: XEiJ.mpuCycleCount += 6; 14451: return XEiJ.regRn[11] -= 2; 14452: } 14453: //fallthrough 14454: case 0b100_100: //-(A4) 14455: if (XEiJ.EFA_SEPARATE_AR) { 14456: XEiJ.mpuCycleCount += 6; 14457: return XEiJ.regRn[12] -= 2; 14458: } 14459: //fallthrough 14460: case 0b100_101: //-(A5) 14461: if (XEiJ.EFA_SEPARATE_AR) { 14462: XEiJ.mpuCycleCount += 6; 14463: return XEiJ.regRn[13] -= 2; 14464: } 14465: //fallthrough 14466: case 0b100_110: //-(A6) 14467: if (XEiJ.EFA_SEPARATE_AR) { 14468: XEiJ.mpuCycleCount += 6; 14469: return XEiJ.regRn[14] -= 2; 14470: } 14471: //fallthrough 14472: case 0b100_111: //-(A7) 14473: if (XEiJ.EFA_SEPARATE_AR) { 14474: XEiJ.mpuCycleCount += 6; 14475: return XEiJ.regRn[15] -= 2; 14476: } else { 14477: XEiJ.mpuCycleCount += 6; 14478: return XEiJ.regRn[ea - (0b100_000 - 8)] -= 2; 14479: } 14480: case 0b101_000: //(d16,A0) 14481: case 0b101_001: //(d16,A1) 14482: case 0b101_010: //(d16,A2) 14483: case 0b101_011: //(d16,A3) 14484: case 0b101_100: //(d16,A4) 14485: case 0b101_101: //(d16,A5) 14486: case 0b101_110: //(d16,A6) 14487: case 0b101_111: //(d16,A7) 14488: XEiJ.mpuCycleCount += 8; 14489: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 14490: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 14491: + XEiJ.busRwse ((XEiJ.regPC += 2) - 2)); //pcws。ワードディスプレースメント 14492: } else { 14493: t = XEiJ.regPC; 14494: XEiJ.regPC = t + 2; 14495: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 14496: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 14497: } 14498: case 0b110_000: //(d8,A0,Rn.wl) 14499: case 0b110_001: //(d8,A1,Rn.wl) 14500: case 0b110_010: //(d8,A2,Rn.wl) 14501: case 0b110_011: //(d8,A3,Rn.wl) 14502: case 0b110_100: //(d8,A4,Rn.wl) 14503: case 0b110_101: //(d8,A5,Rn.wl) 14504: case 0b110_110: //(d8,A6,Rn.wl) 14505: case 0b110_111: //(d8,A7,Rn.wl) 14506: XEiJ.mpuCycleCount += 10; 14507: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 14508: w = XEiJ.busRwze ((XEiJ.regPC += 2) - 2); //pcwz。拡張ワード 14509: } else { 14510: w = XEiJ.regPC; 14511: XEiJ.regPC = w + 2; 14512: w = XEiJ.busRwze (w); //pcwz。拡張ワード 14513: } 14514: return (XEiJ.regRn[ea - (0b110_000 - 8)] //ベースレジスタ 14515: + (byte) w //バイトディスプレースメント 14516: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 14517: XEiJ.regRn[w >> 12])); //ロングインデックス 14518: case 0b111_000: //(xxx).W 14519: XEiJ.mpuCycleCount += 8; 14520: return XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 14521: case 0b111_001: //(xxx).L 14522: XEiJ.mpuCycleCount += 12; 14523: return XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 14524: case 0b111_010: //(d16,PC) 14525: XEiJ.mpuCycleCount += 8; 14526: t = XEiJ.regPC; 14527: XEiJ.regPC = t + 2; 14528: return (t //ベースレジスタ 14529: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 14530: case 0b111_011: //(d8,PC,Rn.wl) 14531: XEiJ.mpuCycleCount += 10; 14532: t = XEiJ.regPC; 14533: XEiJ.regPC = t + 2; 14534: w = XEiJ.busRwze (t); //pcwz。拡張ワード 14535: return (t //ベースレジスタ 14536: + (byte) w //バイトディスプレースメント 14537: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 14538: XEiJ.regRn[w >> 12])); //ロングインデックス 14539: case 0b111_100: //#<data> 14540: XEiJ.mpuCycleCount += 4; 14541: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 14542: return (XEiJ.regPC += 2) - 2; 14543: } else { 14544: t = XEiJ.regPC; 14545: XEiJ.regPC = t + 2; 14546: return t; 14547: } 14548: } //switch 14549: XEiJ.mpuCycleCount += 34; 14550: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 14551: throw M68kException.m6eSignal; 14552: } //efaAnyWord 14553: 14554: //a = efaMemWord (ea) //| M+-WXZP | 14555: // メモリモードのワードオペランドの実効アドレスを求める 14556: // efaAnyWordとの違いは#<data>がないこと 14557: @SuppressWarnings ("fallthrough") public static int efaMemWord (int ea) throws M68kException { 14558: int t, w; 14559: switch (ea) { 14560: case 0b010_000: //(A0) 14561: if (XEiJ.EFA_SEPARATE_AR) { 14562: XEiJ.mpuCycleCount += 4; 14563: return XEiJ.regRn[ 8]; 14564: } 14565: //fallthrough 14566: case 0b010_001: //(A1) 14567: if (XEiJ.EFA_SEPARATE_AR) { 14568: XEiJ.mpuCycleCount += 4; 14569: return XEiJ.regRn[ 9]; 14570: } 14571: //fallthrough 14572: case 0b010_010: //(A2) 14573: if (XEiJ.EFA_SEPARATE_AR) { 14574: XEiJ.mpuCycleCount += 4; 14575: return XEiJ.regRn[10]; 14576: } 14577: //fallthrough 14578: case 0b010_011: //(A3) 14579: if (XEiJ.EFA_SEPARATE_AR) { 14580: XEiJ.mpuCycleCount += 4; 14581: return XEiJ.regRn[11]; 14582: } 14583: //fallthrough 14584: case 0b010_100: //(A4) 14585: if (XEiJ.EFA_SEPARATE_AR) { 14586: XEiJ.mpuCycleCount += 4; 14587: return XEiJ.regRn[12]; 14588: } 14589: //fallthrough 14590: case 0b010_101: //(A5) 14591: if (XEiJ.EFA_SEPARATE_AR) { 14592: XEiJ.mpuCycleCount += 4; 14593: return XEiJ.regRn[13]; 14594: } 14595: //fallthrough 14596: case 0b010_110: //(A6) 14597: if (XEiJ.EFA_SEPARATE_AR) { 14598: XEiJ.mpuCycleCount += 4; 14599: return XEiJ.regRn[14]; 14600: } 14601: //fallthrough 14602: case 0b010_111: //(A7) 14603: if (XEiJ.EFA_SEPARATE_AR) { 14604: XEiJ.mpuCycleCount += 4; 14605: return XEiJ.regRn[15]; 14606: } else { 14607: XEiJ.mpuCycleCount += 4; 14608: return XEiJ.regRn[ea - (0b010_000 - 8)]; 14609: } 14610: case 0b011_000: //(A0)+ 14611: if (XEiJ.EFA_SEPARATE_AR) { 14612: XEiJ.mpuCycleCount += 4; 14613: return (XEiJ.regRn[ 8] += 2) - 2; 14614: } 14615: //fallthrough 14616: case 0b011_001: //(A1)+ 14617: if (XEiJ.EFA_SEPARATE_AR) { 14618: XEiJ.mpuCycleCount += 4; 14619: return (XEiJ.regRn[ 9] += 2) - 2; 14620: } 14621: //fallthrough 14622: case 0b011_010: //(A2)+ 14623: if (XEiJ.EFA_SEPARATE_AR) { 14624: XEiJ.mpuCycleCount += 4; 14625: return (XEiJ.regRn[10] += 2) - 2; 14626: } 14627: //fallthrough 14628: case 0b011_011: //(A3)+ 14629: if (XEiJ.EFA_SEPARATE_AR) { 14630: XEiJ.mpuCycleCount += 4; 14631: return (XEiJ.regRn[11] += 2) - 2; 14632: } 14633: //fallthrough 14634: case 0b011_100: //(A4)+ 14635: if (XEiJ.EFA_SEPARATE_AR) { 14636: XEiJ.mpuCycleCount += 4; 14637: return (XEiJ.regRn[12] += 2) - 2; 14638: } 14639: //fallthrough 14640: case 0b011_101: //(A5)+ 14641: if (XEiJ.EFA_SEPARATE_AR) { 14642: XEiJ.mpuCycleCount += 4; 14643: return (XEiJ.regRn[13] += 2) - 2; 14644: } 14645: //fallthrough 14646: case 0b011_110: //(A6)+ 14647: if (XEiJ.EFA_SEPARATE_AR) { 14648: XEiJ.mpuCycleCount += 4; 14649: return (XEiJ.regRn[14] += 2) - 2; 14650: } 14651: //fallthrough 14652: case 0b011_111: //(A7)+ 14653: if (XEiJ.EFA_SEPARATE_AR) { 14654: XEiJ.mpuCycleCount += 4; 14655: return (XEiJ.regRn[15] += 2) - 2; 14656: } else { 14657: XEiJ.mpuCycleCount += 4; 14658: return (XEiJ.regRn[ea - (0b011_000 - 8)] += 2) - 2; 14659: } 14660: case 0b100_000: //-(A0) 14661: if (XEiJ.EFA_SEPARATE_AR) { 14662: XEiJ.mpuCycleCount += 6; 14663: return XEiJ.regRn[ 8] -= 2; 14664: } 14665: //fallthrough 14666: case 0b100_001: //-(A1) 14667: if (XEiJ.EFA_SEPARATE_AR) { 14668: XEiJ.mpuCycleCount += 6; 14669: return XEiJ.regRn[ 9] -= 2; 14670: } 14671: //fallthrough 14672: case 0b100_010: //-(A2) 14673: if (XEiJ.EFA_SEPARATE_AR) { 14674: XEiJ.mpuCycleCount += 6; 14675: return XEiJ.regRn[10] -= 2; 14676: } 14677: //fallthrough 14678: case 0b100_011: //-(A3) 14679: if (XEiJ.EFA_SEPARATE_AR) { 14680: XEiJ.mpuCycleCount += 6; 14681: return XEiJ.regRn[11] -= 2; 14682: } 14683: //fallthrough 14684: case 0b100_100: //-(A4) 14685: if (XEiJ.EFA_SEPARATE_AR) { 14686: XEiJ.mpuCycleCount += 6; 14687: return XEiJ.regRn[12] -= 2; 14688: } 14689: //fallthrough 14690: case 0b100_101: //-(A5) 14691: if (XEiJ.EFA_SEPARATE_AR) { 14692: XEiJ.mpuCycleCount += 6; 14693: return XEiJ.regRn[13] -= 2; 14694: } 14695: //fallthrough 14696: case 0b100_110: //-(A6) 14697: if (XEiJ.EFA_SEPARATE_AR) { 14698: XEiJ.mpuCycleCount += 6; 14699: return XEiJ.regRn[14] -= 2; 14700: } 14701: //fallthrough 14702: case 0b100_111: //-(A7) 14703: if (XEiJ.EFA_SEPARATE_AR) { 14704: XEiJ.mpuCycleCount += 6; 14705: return XEiJ.regRn[15] -= 2; 14706: } else { 14707: XEiJ.mpuCycleCount += 6; 14708: return XEiJ.regRn[ea - (0b100_000 - 8)] -= 2; 14709: } 14710: case 0b101_000: //(d16,A0) 14711: case 0b101_001: //(d16,A1) 14712: case 0b101_010: //(d16,A2) 14713: case 0b101_011: //(d16,A3) 14714: case 0b101_100: //(d16,A4) 14715: case 0b101_101: //(d16,A5) 14716: case 0b101_110: //(d16,A6) 14717: case 0b101_111: //(d16,A7) 14718: XEiJ.mpuCycleCount += 8; 14719: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 14720: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 14721: + XEiJ.busRwse ((XEiJ.regPC += 2) - 2)); //pcws。ワードディスプレースメント 14722: } else { 14723: t = XEiJ.regPC; 14724: XEiJ.regPC = t + 2; 14725: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 14726: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 14727: } 14728: case 0b110_000: //(d8,A0,Rn.wl) 14729: case 0b110_001: //(d8,A1,Rn.wl) 14730: case 0b110_010: //(d8,A2,Rn.wl) 14731: case 0b110_011: //(d8,A3,Rn.wl) 14732: case 0b110_100: //(d8,A4,Rn.wl) 14733: case 0b110_101: //(d8,A5,Rn.wl) 14734: case 0b110_110: //(d8,A6,Rn.wl) 14735: case 0b110_111: //(d8,A7,Rn.wl) 14736: XEiJ.mpuCycleCount += 10; 14737: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 14738: w = XEiJ.busRwze ((XEiJ.regPC += 2) - 2); //pcwz。拡張ワード 14739: } else { 14740: w = XEiJ.regPC; 14741: XEiJ.regPC = w + 2; 14742: w = XEiJ.busRwze (w); //pcwz。拡張ワード 14743: } 14744: return (XEiJ.regRn[ea - (0b110_000 - 8)] //ベースレジスタ 14745: + (byte) w //バイトディスプレースメント 14746: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 14747: XEiJ.regRn[w >> 12])); //ロングインデックス 14748: case 0b111_000: //(xxx).W 14749: XEiJ.mpuCycleCount += 8; 14750: return XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 14751: case 0b111_001: //(xxx).L 14752: XEiJ.mpuCycleCount += 12; 14753: return XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 14754: case 0b111_010: //(d16,PC) 14755: XEiJ.mpuCycleCount += 8; 14756: t = XEiJ.regPC; 14757: XEiJ.regPC = t + 2; 14758: return (t //ベースレジスタ 14759: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 14760: case 0b111_011: //(d8,PC,Rn.wl) 14761: XEiJ.mpuCycleCount += 10; 14762: t = XEiJ.regPC; 14763: XEiJ.regPC = t + 2; 14764: w = XEiJ.busRwze (t); //pcwz。拡張ワード 14765: return (t //ベースレジスタ 14766: + (byte) w //バイトディスプレースメント 14767: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 14768: XEiJ.regRn[w >> 12])); //ロングインデックス 14769: } //switch 14770: XEiJ.mpuCycleCount += 34; 14771: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 14772: throw M68kException.m6eSignal; 14773: } //efaMemWord 14774: 14775: //a = efaMltWord (ea) //| M+-WXZ | 14776: // メモリ可変モードのワードオペランドの実効アドレスを求める 14777: // efaMemWordとの違いは(d16,PC)と(d8,PC,Rn.wl)がないこと 14778: @SuppressWarnings ("fallthrough") public static int efaMltWord (int ea) throws M68kException { 14779: int t, w; 14780: switch (ea) { 14781: case 0b010_000: //(A0) 14782: if (XEiJ.EFA_SEPARATE_AR) { 14783: XEiJ.mpuCycleCount += 4; 14784: return XEiJ.regRn[ 8]; 14785: } 14786: //fallthrough 14787: case 0b010_001: //(A1) 14788: if (XEiJ.EFA_SEPARATE_AR) { 14789: XEiJ.mpuCycleCount += 4; 14790: return XEiJ.regRn[ 9]; 14791: } 14792: //fallthrough 14793: case 0b010_010: //(A2) 14794: if (XEiJ.EFA_SEPARATE_AR) { 14795: XEiJ.mpuCycleCount += 4; 14796: return XEiJ.regRn[10]; 14797: } 14798: //fallthrough 14799: case 0b010_011: //(A3) 14800: if (XEiJ.EFA_SEPARATE_AR) { 14801: XEiJ.mpuCycleCount += 4; 14802: return XEiJ.regRn[11]; 14803: } 14804: //fallthrough 14805: case 0b010_100: //(A4) 14806: if (XEiJ.EFA_SEPARATE_AR) { 14807: XEiJ.mpuCycleCount += 4; 14808: return XEiJ.regRn[12]; 14809: } 14810: //fallthrough 14811: case 0b010_101: //(A5) 14812: if (XEiJ.EFA_SEPARATE_AR) { 14813: XEiJ.mpuCycleCount += 4; 14814: return XEiJ.regRn[13]; 14815: } 14816: //fallthrough 14817: case 0b010_110: //(A6) 14818: if (XEiJ.EFA_SEPARATE_AR) { 14819: XEiJ.mpuCycleCount += 4; 14820: return XEiJ.regRn[14]; 14821: } 14822: //fallthrough 14823: case 0b010_111: //(A7) 14824: if (XEiJ.EFA_SEPARATE_AR) { 14825: XEiJ.mpuCycleCount += 4; 14826: return XEiJ.regRn[15]; 14827: } else { 14828: XEiJ.mpuCycleCount += 4; 14829: return XEiJ.regRn[ea - (0b010_000 - 8)]; 14830: } 14831: case 0b011_000: //(A0)+ 14832: if (XEiJ.EFA_SEPARATE_AR) { 14833: XEiJ.mpuCycleCount += 4; 14834: return (XEiJ.regRn[ 8] += 2) - 2; 14835: } 14836: //fallthrough 14837: case 0b011_001: //(A1)+ 14838: if (XEiJ.EFA_SEPARATE_AR) { 14839: XEiJ.mpuCycleCount += 4; 14840: return (XEiJ.regRn[ 9] += 2) - 2; 14841: } 14842: //fallthrough 14843: case 0b011_010: //(A2)+ 14844: if (XEiJ.EFA_SEPARATE_AR) { 14845: XEiJ.mpuCycleCount += 4; 14846: return (XEiJ.regRn[10] += 2) - 2; 14847: } 14848: //fallthrough 14849: case 0b011_011: //(A3)+ 14850: if (XEiJ.EFA_SEPARATE_AR) { 14851: XEiJ.mpuCycleCount += 4; 14852: return (XEiJ.regRn[11] += 2) - 2; 14853: } 14854: //fallthrough 14855: case 0b011_100: //(A4)+ 14856: if (XEiJ.EFA_SEPARATE_AR) { 14857: XEiJ.mpuCycleCount += 4; 14858: return (XEiJ.regRn[12] += 2) - 2; 14859: } 14860: //fallthrough 14861: case 0b011_101: //(A5)+ 14862: if (XEiJ.EFA_SEPARATE_AR) { 14863: XEiJ.mpuCycleCount += 4; 14864: return (XEiJ.regRn[13] += 2) - 2; 14865: } 14866: //fallthrough 14867: case 0b011_110: //(A6)+ 14868: if (XEiJ.EFA_SEPARATE_AR) { 14869: XEiJ.mpuCycleCount += 4; 14870: return (XEiJ.regRn[14] += 2) - 2; 14871: } 14872: //fallthrough 14873: case 0b011_111: //(A7)+ 14874: if (XEiJ.EFA_SEPARATE_AR) { 14875: XEiJ.mpuCycleCount += 4; 14876: return (XEiJ.regRn[15] += 2) - 2; 14877: } else { 14878: XEiJ.mpuCycleCount += 4; 14879: return (XEiJ.regRn[ea - (0b011_000 - 8)] += 2) - 2; 14880: } 14881: case 0b100_000: //-(A0) 14882: if (XEiJ.EFA_SEPARATE_AR) { 14883: XEiJ.mpuCycleCount += 6; 14884: return XEiJ.regRn[ 8] -= 2; 14885: } 14886: //fallthrough 14887: case 0b100_001: //-(A1) 14888: if (XEiJ.EFA_SEPARATE_AR) { 14889: XEiJ.mpuCycleCount += 6; 14890: return XEiJ.regRn[ 9] -= 2; 14891: } 14892: //fallthrough 14893: case 0b100_010: //-(A2) 14894: if (XEiJ.EFA_SEPARATE_AR) { 14895: XEiJ.mpuCycleCount += 6; 14896: return XEiJ.regRn[10] -= 2; 14897: } 14898: //fallthrough 14899: case 0b100_011: //-(A3) 14900: if (XEiJ.EFA_SEPARATE_AR) { 14901: XEiJ.mpuCycleCount += 6; 14902: return XEiJ.regRn[11] -= 2; 14903: } 14904: //fallthrough 14905: case 0b100_100: //-(A4) 14906: if (XEiJ.EFA_SEPARATE_AR) { 14907: XEiJ.mpuCycleCount += 6; 14908: return XEiJ.regRn[12] -= 2; 14909: } 14910: //fallthrough 14911: case 0b100_101: //-(A5) 14912: if (XEiJ.EFA_SEPARATE_AR) { 14913: XEiJ.mpuCycleCount += 6; 14914: return XEiJ.regRn[13] -= 2; 14915: } 14916: //fallthrough 14917: case 0b100_110: //-(A6) 14918: if (XEiJ.EFA_SEPARATE_AR) { 14919: XEiJ.mpuCycleCount += 6; 14920: return XEiJ.regRn[14] -= 2; 14921: } 14922: //fallthrough 14923: case 0b100_111: //-(A7) 14924: if (XEiJ.EFA_SEPARATE_AR) { 14925: XEiJ.mpuCycleCount += 6; 14926: return XEiJ.regRn[15] -= 2; 14927: } else { 14928: XEiJ.mpuCycleCount += 6; 14929: return XEiJ.regRn[ea - (0b100_000 - 8)] -= 2; 14930: } 14931: case 0b101_000: //(d16,A0) 14932: case 0b101_001: //(d16,A1) 14933: case 0b101_010: //(d16,A2) 14934: case 0b101_011: //(d16,A3) 14935: case 0b101_100: //(d16,A4) 14936: case 0b101_101: //(d16,A5) 14937: case 0b101_110: //(d16,A6) 14938: case 0b101_111: //(d16,A7) 14939: XEiJ.mpuCycleCount += 8; 14940: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 14941: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 14942: + XEiJ.busRwse ((XEiJ.regPC += 2) - 2)); //pcws。ワードディスプレースメント 14943: } else { 14944: t = XEiJ.regPC; 14945: XEiJ.regPC = t + 2; 14946: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 14947: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 14948: } 14949: case 0b110_000: //(d8,A0,Rn.wl) 14950: case 0b110_001: //(d8,A1,Rn.wl) 14951: case 0b110_010: //(d8,A2,Rn.wl) 14952: case 0b110_011: //(d8,A3,Rn.wl) 14953: case 0b110_100: //(d8,A4,Rn.wl) 14954: case 0b110_101: //(d8,A5,Rn.wl) 14955: case 0b110_110: //(d8,A6,Rn.wl) 14956: case 0b110_111: //(d8,A7,Rn.wl) 14957: XEiJ.mpuCycleCount += 10; 14958: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 14959: w = XEiJ.busRwze ((XEiJ.regPC += 2) - 2); //pcwz。拡張ワード 14960: } else { 14961: w = XEiJ.regPC; 14962: XEiJ.regPC = w + 2; 14963: w = XEiJ.busRwze (w); //pcwz。拡張ワード 14964: } 14965: return (XEiJ.regRn[ea - (0b110_000 - 8)] //ベースレジスタ 14966: + (byte) w //バイトディスプレースメント 14967: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 14968: XEiJ.regRn[w >> 12])); //ロングインデックス 14969: case 0b111_000: //(xxx).W 14970: XEiJ.mpuCycleCount += 8; 14971: return XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 14972: case 0b111_001: //(xxx).L 14973: XEiJ.mpuCycleCount += 12; 14974: return XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 14975: } //switch 14976: XEiJ.mpuCycleCount += 34; 14977: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 14978: throw M68kException.m6eSignal; 14979: } //efaMltWord 14980: 14981: //a = efaCntWord (ea) //| M WXZP | 14982: // 制御モードのワードオペランドの実効アドレスを求める 14983: // efaMemWordとの違いは(Ar)+と-(Ar)がないこと 14984: @SuppressWarnings ("fallthrough") public static int efaCntWord (int ea) throws M68kException { 14985: int t, w; 14986: switch (ea) { 14987: case 0b010_000: //(A0) 14988: if (XEiJ.EFA_SEPARATE_AR) { 14989: XEiJ.mpuCycleCount += 4; 14990: return XEiJ.regRn[ 8]; 14991: } 14992: //fallthrough 14993: case 0b010_001: //(A1) 14994: if (XEiJ.EFA_SEPARATE_AR) { 14995: XEiJ.mpuCycleCount += 4; 14996: return XEiJ.regRn[ 9]; 14997: } 14998: //fallthrough 14999: case 0b010_010: //(A2) 15000: if (XEiJ.EFA_SEPARATE_AR) { 15001: XEiJ.mpuCycleCount += 4; 15002: return XEiJ.regRn[10]; 15003: } 15004: //fallthrough 15005: case 0b010_011: //(A3) 15006: if (XEiJ.EFA_SEPARATE_AR) { 15007: XEiJ.mpuCycleCount += 4; 15008: return XEiJ.regRn[11]; 15009: } 15010: //fallthrough 15011: case 0b010_100: //(A4) 15012: if (XEiJ.EFA_SEPARATE_AR) { 15013: XEiJ.mpuCycleCount += 4; 15014: return XEiJ.regRn[12]; 15015: } 15016: //fallthrough 15017: case 0b010_101: //(A5) 15018: if (XEiJ.EFA_SEPARATE_AR) { 15019: XEiJ.mpuCycleCount += 4; 15020: return XEiJ.regRn[13]; 15021: } 15022: //fallthrough 15023: case 0b010_110: //(A6) 15024: if (XEiJ.EFA_SEPARATE_AR) { 15025: XEiJ.mpuCycleCount += 4; 15026: return XEiJ.regRn[14]; 15027: } 15028: //fallthrough 15029: case 0b010_111: //(A7) 15030: if (XEiJ.EFA_SEPARATE_AR) { 15031: XEiJ.mpuCycleCount += 4; 15032: return XEiJ.regRn[15]; 15033: } else { 15034: XEiJ.mpuCycleCount += 4; 15035: return XEiJ.regRn[ea - (0b010_000 - 8)]; 15036: } 15037: case 0b101_000: //(d16,A0) 15038: case 0b101_001: //(d16,A1) 15039: case 0b101_010: //(d16,A2) 15040: case 0b101_011: //(d16,A3) 15041: case 0b101_100: //(d16,A4) 15042: case 0b101_101: //(d16,A5) 15043: case 0b101_110: //(d16,A6) 15044: case 0b101_111: //(d16,A7) 15045: XEiJ.mpuCycleCount += 8; 15046: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 15047: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 15048: + XEiJ.busRwse ((XEiJ.regPC += 2) - 2)); //pcws。ワードディスプレースメント 15049: } else { 15050: t = XEiJ.regPC; 15051: XEiJ.regPC = t + 2; 15052: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 15053: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 15054: } 15055: case 0b110_000: //(d8,A0,Rn.wl) 15056: case 0b110_001: //(d8,A1,Rn.wl) 15057: case 0b110_010: //(d8,A2,Rn.wl) 15058: case 0b110_011: //(d8,A3,Rn.wl) 15059: case 0b110_100: //(d8,A4,Rn.wl) 15060: case 0b110_101: //(d8,A5,Rn.wl) 15061: case 0b110_110: //(d8,A6,Rn.wl) 15062: case 0b110_111: //(d8,A7,Rn.wl) 15063: XEiJ.mpuCycleCount += 10; 15064: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 15065: w = XEiJ.busRwze ((XEiJ.regPC += 2) - 2); //pcwz。拡張ワード 15066: } else { 15067: w = XEiJ.regPC; 15068: XEiJ.regPC = w + 2; 15069: w = XEiJ.busRwze (w); //pcwz。拡張ワード 15070: } 15071: return (XEiJ.regRn[ea - (0b110_000 - 8)] //ベースレジスタ 15072: + (byte) w //バイトディスプレースメント 15073: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 15074: XEiJ.regRn[w >> 12])); //ロングインデックス 15075: case 0b111_000: //(xxx).W 15076: XEiJ.mpuCycleCount += 8; 15077: return XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 15078: case 0b111_001: //(xxx).L 15079: XEiJ.mpuCycleCount += 12; 15080: return XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 15081: case 0b111_010: //(d16,PC) 15082: XEiJ.mpuCycleCount += 8; 15083: t = XEiJ.regPC; 15084: XEiJ.regPC = t + 2; 15085: return (t //ベースレジスタ 15086: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 15087: case 0b111_011: //(d8,PC,Rn.wl) 15088: XEiJ.mpuCycleCount += 10; 15089: t = XEiJ.regPC; 15090: XEiJ.regPC = t + 2; 15091: w = XEiJ.busRwze (t); //pcwz。拡張ワード 15092: return (t //ベースレジスタ 15093: + (byte) w //バイトディスプレースメント 15094: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 15095: XEiJ.regRn[w >> 12])); //ロングインデックス 15096: } //switch 15097: XEiJ.mpuCycleCount += 34; 15098: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 15099: throw M68kException.m6eSignal; 15100: } //efaCntWord 15101: 15102: //a = efaCltWord (ea) //| M WXZ | 15103: // 制御可変モードのワードオペランドの実効アドレスを求める 15104: // efaCntWordとの違いは(d16,PC)と(d8,PC,Rn.wl)がないこと 15105: @SuppressWarnings ("fallthrough") public static int efaCltWord (int ea) throws M68kException { 15106: int t, w; 15107: switch (ea) { 15108: case 0b010_000: //(A0) 15109: if (XEiJ.EFA_SEPARATE_AR) { 15110: XEiJ.mpuCycleCount += 4; 15111: return XEiJ.regRn[ 8]; 15112: } 15113: //fallthrough 15114: case 0b010_001: //(A1) 15115: if (XEiJ.EFA_SEPARATE_AR) { 15116: XEiJ.mpuCycleCount += 4; 15117: return XEiJ.regRn[ 9]; 15118: } 15119: //fallthrough 15120: case 0b010_010: //(A2) 15121: if (XEiJ.EFA_SEPARATE_AR) { 15122: XEiJ.mpuCycleCount += 4; 15123: return XEiJ.regRn[10]; 15124: } 15125: //fallthrough 15126: case 0b010_011: //(A3) 15127: if (XEiJ.EFA_SEPARATE_AR) { 15128: XEiJ.mpuCycleCount += 4; 15129: return XEiJ.regRn[11]; 15130: } 15131: //fallthrough 15132: case 0b010_100: //(A4) 15133: if (XEiJ.EFA_SEPARATE_AR) { 15134: XEiJ.mpuCycleCount += 4; 15135: return XEiJ.regRn[12]; 15136: } 15137: //fallthrough 15138: case 0b010_101: //(A5) 15139: if (XEiJ.EFA_SEPARATE_AR) { 15140: XEiJ.mpuCycleCount += 4; 15141: return XEiJ.regRn[13]; 15142: } 15143: //fallthrough 15144: case 0b010_110: //(A6) 15145: if (XEiJ.EFA_SEPARATE_AR) { 15146: XEiJ.mpuCycleCount += 4; 15147: return XEiJ.regRn[14]; 15148: } 15149: //fallthrough 15150: case 0b010_111: //(A7) 15151: if (XEiJ.EFA_SEPARATE_AR) { 15152: XEiJ.mpuCycleCount += 4; 15153: return XEiJ.regRn[15]; 15154: } else { 15155: XEiJ.mpuCycleCount += 4; 15156: return XEiJ.regRn[ea - (0b010_000 - 8)]; 15157: } 15158: case 0b101_000: //(d16,A0) 15159: case 0b101_001: //(d16,A1) 15160: case 0b101_010: //(d16,A2) 15161: case 0b101_011: //(d16,A3) 15162: case 0b101_100: //(d16,A4) 15163: case 0b101_101: //(d16,A5) 15164: case 0b101_110: //(d16,A6) 15165: case 0b101_111: //(d16,A7) 15166: XEiJ.mpuCycleCount += 8; 15167: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 15168: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 15169: + XEiJ.busRwse ((XEiJ.regPC += 2) - 2)); //pcws。ワードディスプレースメント 15170: } else { 15171: t = XEiJ.regPC; 15172: XEiJ.regPC = t + 2; 15173: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 15174: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 15175: } 15176: case 0b110_000: //(d8,A0,Rn.wl) 15177: case 0b110_001: //(d8,A1,Rn.wl) 15178: case 0b110_010: //(d8,A2,Rn.wl) 15179: case 0b110_011: //(d8,A3,Rn.wl) 15180: case 0b110_100: //(d8,A4,Rn.wl) 15181: case 0b110_101: //(d8,A5,Rn.wl) 15182: case 0b110_110: //(d8,A6,Rn.wl) 15183: case 0b110_111: //(d8,A7,Rn.wl) 15184: XEiJ.mpuCycleCount += 10; 15185: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 15186: w = XEiJ.busRwze ((XEiJ.regPC += 2) - 2); //pcwz。拡張ワード 15187: } else { 15188: w = XEiJ.regPC; 15189: XEiJ.regPC = w + 2; 15190: w = XEiJ.busRwze (w); //pcwz。拡張ワード 15191: } 15192: return (XEiJ.regRn[ea - (0b110_000 - 8)] //ベースレジスタ 15193: + (byte) w //バイトディスプレースメント 15194: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 15195: XEiJ.regRn[w >> 12])); //ロングインデックス 15196: case 0b111_000: //(xxx).W 15197: XEiJ.mpuCycleCount += 8; 15198: return XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 15199: case 0b111_001: //(xxx).L 15200: XEiJ.mpuCycleCount += 12; 15201: return XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 15202: } //switch 15203: XEiJ.mpuCycleCount += 34; 15204: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 15205: throw M68kException.m6eSignal; 15206: } //efaCltWord 15207: 15208: //a = efaAnyLong (ea) //| M+-WXZPI| 15209: // 任意のモードのロングオペランドの実効アドレスを求める 15210: // efaAnyWordとの違いは(Ar)+と-(Ar)がArを4変化させることと、#<data>がPCを4変化させることと、 15211: // オペランドのアクセスが1ワード増える分の4サイクルが追加されていること 15212: @SuppressWarnings ("fallthrough") public static int efaAnyLong (int ea) throws M68kException { 15213: int t, w; 15214: switch (ea) { 15215: case 0b010_000: //(A0) 15216: if (XEiJ.EFA_SEPARATE_AR) { 15217: XEiJ.mpuCycleCount += 8; 15218: return XEiJ.regRn[ 8]; 15219: } 15220: //fallthrough 15221: case 0b010_001: //(A1) 15222: if (XEiJ.EFA_SEPARATE_AR) { 15223: XEiJ.mpuCycleCount += 8; 15224: return XEiJ.regRn[ 9]; 15225: } 15226: //fallthrough 15227: case 0b010_010: //(A2) 15228: if (XEiJ.EFA_SEPARATE_AR) { 15229: XEiJ.mpuCycleCount += 8; 15230: return XEiJ.regRn[10]; 15231: } 15232: //fallthrough 15233: case 0b010_011: //(A3) 15234: if (XEiJ.EFA_SEPARATE_AR) { 15235: XEiJ.mpuCycleCount += 8; 15236: return XEiJ.regRn[11]; 15237: } 15238: //fallthrough 15239: case 0b010_100: //(A4) 15240: if (XEiJ.EFA_SEPARATE_AR) { 15241: XEiJ.mpuCycleCount += 8; 15242: return XEiJ.regRn[12]; 15243: } 15244: //fallthrough 15245: case 0b010_101: //(A5) 15246: if (XEiJ.EFA_SEPARATE_AR) { 15247: XEiJ.mpuCycleCount += 8; 15248: return XEiJ.regRn[13]; 15249: } 15250: //fallthrough 15251: case 0b010_110: //(A6) 15252: if (XEiJ.EFA_SEPARATE_AR) { 15253: XEiJ.mpuCycleCount += 8; 15254: return XEiJ.regRn[14]; 15255: } 15256: //fallthrough 15257: case 0b010_111: //(A7) 15258: if (XEiJ.EFA_SEPARATE_AR) { 15259: XEiJ.mpuCycleCount += 8; 15260: return XEiJ.regRn[15]; 15261: } else { 15262: XEiJ.mpuCycleCount += 8; 15263: return XEiJ.regRn[ea - (0b010_000 - 8)]; 15264: } 15265: case 0b011_000: //(A0)+ 15266: if (XEiJ.EFA_SEPARATE_AR) { 15267: XEiJ.mpuCycleCount += 8; 15268: return (XEiJ.regRn[ 8] += 4) - 4; 15269: } 15270: //fallthrough 15271: case 0b011_001: //(A1)+ 15272: if (XEiJ.EFA_SEPARATE_AR) { 15273: XEiJ.mpuCycleCount += 8; 15274: return (XEiJ.regRn[ 9] += 4) - 4; 15275: } 15276: //fallthrough 15277: case 0b011_010: //(A2)+ 15278: if (XEiJ.EFA_SEPARATE_AR) { 15279: XEiJ.mpuCycleCount += 8; 15280: return (XEiJ.regRn[10] += 4) - 4; 15281: } 15282: //fallthrough 15283: case 0b011_011: //(A3)+ 15284: if (XEiJ.EFA_SEPARATE_AR) { 15285: XEiJ.mpuCycleCount += 8; 15286: return (XEiJ.regRn[11] += 4) - 4; 15287: } 15288: //fallthrough 15289: case 0b011_100: //(A4)+ 15290: if (XEiJ.EFA_SEPARATE_AR) { 15291: XEiJ.mpuCycleCount += 8; 15292: return (XEiJ.regRn[12] += 4) - 4; 15293: } 15294: //fallthrough 15295: case 0b011_101: //(A5)+ 15296: if (XEiJ.EFA_SEPARATE_AR) { 15297: XEiJ.mpuCycleCount += 8; 15298: return (XEiJ.regRn[13] += 4) - 4; 15299: } 15300: //fallthrough 15301: case 0b011_110: //(A6)+ 15302: if (XEiJ.EFA_SEPARATE_AR) { 15303: XEiJ.mpuCycleCount += 8; 15304: return (XEiJ.regRn[14] += 4) - 4; 15305: } 15306: //fallthrough 15307: case 0b011_111: //(A7)+ 15308: if (XEiJ.EFA_SEPARATE_AR) { 15309: XEiJ.mpuCycleCount += 8; 15310: return (XEiJ.regRn[15] += 4) - 4; 15311: } else { 15312: XEiJ.mpuCycleCount += 8; 15313: return (XEiJ.regRn[ea - (0b011_000 - 8)] += 4) - 4; 15314: } 15315: case 0b100_000: //-(A0) 15316: if (XEiJ.EFA_SEPARATE_AR) { 15317: XEiJ.mpuCycleCount += 10; 15318: return XEiJ.regRn[ 8] -= 4; 15319: } 15320: //fallthrough 15321: case 0b100_001: //-(A1) 15322: if (XEiJ.EFA_SEPARATE_AR) { 15323: XEiJ.mpuCycleCount += 10; 15324: return XEiJ.regRn[ 9] -= 4; 15325: } 15326: //fallthrough 15327: case 0b100_010: //-(A2) 15328: if (XEiJ.EFA_SEPARATE_AR) { 15329: XEiJ.mpuCycleCount += 10; 15330: return XEiJ.regRn[10] -= 4; 15331: } 15332: //fallthrough 15333: case 0b100_011: //-(A3) 15334: if (XEiJ.EFA_SEPARATE_AR) { 15335: XEiJ.mpuCycleCount += 10; 15336: return XEiJ.regRn[11] -= 4; 15337: } 15338: //fallthrough 15339: case 0b100_100: //-(A4) 15340: if (XEiJ.EFA_SEPARATE_AR) { 15341: XEiJ.mpuCycleCount += 10; 15342: return XEiJ.regRn[12] -= 4; 15343: } 15344: //fallthrough 15345: case 0b100_101: //-(A5) 15346: if (XEiJ.EFA_SEPARATE_AR) { 15347: XEiJ.mpuCycleCount += 10; 15348: return XEiJ.regRn[13] -= 4; 15349: } 15350: //fallthrough 15351: case 0b100_110: //-(A6) 15352: if (XEiJ.EFA_SEPARATE_AR) { 15353: XEiJ.mpuCycleCount += 10; 15354: return XEiJ.regRn[14] -= 4; 15355: } 15356: //fallthrough 15357: case 0b100_111: //-(A7) 15358: if (XEiJ.EFA_SEPARATE_AR) { 15359: XEiJ.mpuCycleCount += 10; 15360: return XEiJ.regRn[15] -= 4; 15361: } else { 15362: XEiJ.mpuCycleCount += 10; 15363: return XEiJ.regRn[ea - (0b100_000 - 8)] -= 4; 15364: } 15365: case 0b101_000: //(d16,A0) 15366: case 0b101_001: //(d16,A1) 15367: case 0b101_010: //(d16,A2) 15368: case 0b101_011: //(d16,A3) 15369: case 0b101_100: //(d16,A4) 15370: case 0b101_101: //(d16,A5) 15371: case 0b101_110: //(d16,A6) 15372: case 0b101_111: //(d16,A7) 15373: XEiJ.mpuCycleCount += 12; 15374: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 15375: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 15376: + XEiJ.busRwse ((XEiJ.regPC += 2) - 2)); //pcws。ワードディスプレースメント 15377: } else { 15378: t = XEiJ.regPC; 15379: XEiJ.regPC = t + 2; 15380: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 15381: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 15382: } 15383: case 0b110_000: //(d8,A0,Rn.wl) 15384: case 0b110_001: //(d8,A1,Rn.wl) 15385: case 0b110_010: //(d8,A2,Rn.wl) 15386: case 0b110_011: //(d8,A3,Rn.wl) 15387: case 0b110_100: //(d8,A4,Rn.wl) 15388: case 0b110_101: //(d8,A5,Rn.wl) 15389: case 0b110_110: //(d8,A6,Rn.wl) 15390: case 0b110_111: //(d8,A7,Rn.wl) 15391: XEiJ.mpuCycleCount += 14; 15392: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 15393: w = XEiJ.busRwze ((XEiJ.regPC += 2) - 2); //pcwz。拡張ワード 15394: } else { 15395: w = XEiJ.regPC; 15396: XEiJ.regPC = w + 2; 15397: w = XEiJ.busRwze (w); //pcwz。拡張ワード 15398: } 15399: return (XEiJ.regRn[ea - (0b110_000 - 8)] //ベースレジスタ 15400: + (byte) w //バイトディスプレースメント 15401: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 15402: XEiJ.regRn[w >> 12])); //ロングインデックス 15403: case 0b111_000: //(xxx).W 15404: XEiJ.mpuCycleCount += 12; 15405: return XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 15406: case 0b111_001: //(xxx).L 15407: XEiJ.mpuCycleCount += 16; 15408: return XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 15409: case 0b111_010: //(d16,PC) 15410: XEiJ.mpuCycleCount += 12; 15411: t = XEiJ.regPC; 15412: XEiJ.regPC = t + 2; 15413: return (t //ベースレジスタ 15414: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 15415: case 0b111_011: //(d8,PC,Rn.wl) 15416: XEiJ.mpuCycleCount += 14; 15417: t = XEiJ.regPC; 15418: XEiJ.regPC = t + 2; 15419: w = XEiJ.busRwze (t); //pcwz。拡張ワード 15420: return (t //ベースレジスタ 15421: + (byte) w //バイトディスプレースメント 15422: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 15423: XEiJ.regRn[w >> 12])); //ロングインデックス 15424: case 0b111_100: //#<data> 15425: XEiJ.mpuCycleCount += 8; 15426: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 15427: return (XEiJ.regPC += 4) - 4; 15428: } else { 15429: t = XEiJ.regPC; 15430: XEiJ.regPC = t + 4; 15431: return t; 15432: } 15433: } //switch 15434: XEiJ.mpuCycleCount += 34; 15435: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 15436: throw M68kException.m6eSignal; 15437: } //efaAnyLong 15438: 15439: //a = efaMemLong (ea) //| M+-WXZP | 15440: // メモリモードのロングオペランドの実効アドレスを求める 15441: // efaAnyLongとの違いは#<data>がないこと 15442: @SuppressWarnings ("fallthrough") public static int efaMemLong (int ea) throws M68kException { 15443: int t, w; 15444: switch (ea) { 15445: case 0b010_000: //(A0) 15446: if (XEiJ.EFA_SEPARATE_AR) { 15447: XEiJ.mpuCycleCount += 8; 15448: return XEiJ.regRn[ 8]; 15449: } 15450: //fallthrough 15451: case 0b010_001: //(A1) 15452: if (XEiJ.EFA_SEPARATE_AR) { 15453: XEiJ.mpuCycleCount += 8; 15454: return XEiJ.regRn[ 9]; 15455: } 15456: //fallthrough 15457: case 0b010_010: //(A2) 15458: if (XEiJ.EFA_SEPARATE_AR) { 15459: XEiJ.mpuCycleCount += 8; 15460: return XEiJ.regRn[10]; 15461: } 15462: //fallthrough 15463: case 0b010_011: //(A3) 15464: if (XEiJ.EFA_SEPARATE_AR) { 15465: XEiJ.mpuCycleCount += 8; 15466: return XEiJ.regRn[11]; 15467: } 15468: //fallthrough 15469: case 0b010_100: //(A4) 15470: if (XEiJ.EFA_SEPARATE_AR) { 15471: XEiJ.mpuCycleCount += 8; 15472: return XEiJ.regRn[12]; 15473: } 15474: //fallthrough 15475: case 0b010_101: //(A5) 15476: if (XEiJ.EFA_SEPARATE_AR) { 15477: XEiJ.mpuCycleCount += 8; 15478: return XEiJ.regRn[13]; 15479: } 15480: //fallthrough 15481: case 0b010_110: //(A6) 15482: if (XEiJ.EFA_SEPARATE_AR) { 15483: XEiJ.mpuCycleCount += 8; 15484: return XEiJ.regRn[14]; 15485: } 15486: //fallthrough 15487: case 0b010_111: //(A7) 15488: if (XEiJ.EFA_SEPARATE_AR) { 15489: XEiJ.mpuCycleCount += 8; 15490: return XEiJ.regRn[15]; 15491: } else { 15492: XEiJ.mpuCycleCount += 8; 15493: return XEiJ.regRn[ea - (0b010_000 - 8)]; 15494: } 15495: case 0b011_000: //(A0)+ 15496: if (XEiJ.EFA_SEPARATE_AR) { 15497: XEiJ.mpuCycleCount += 8; 15498: return (XEiJ.regRn[ 8] += 4) - 4; 15499: } 15500: //fallthrough 15501: case 0b011_001: //(A1)+ 15502: if (XEiJ.EFA_SEPARATE_AR) { 15503: XEiJ.mpuCycleCount += 8; 15504: return (XEiJ.regRn[ 9] += 4) - 4; 15505: } 15506: //fallthrough 15507: case 0b011_010: //(A2)+ 15508: if (XEiJ.EFA_SEPARATE_AR) { 15509: XEiJ.mpuCycleCount += 8; 15510: return (XEiJ.regRn[10] += 4) - 4; 15511: } 15512: //fallthrough 15513: case 0b011_011: //(A3)+ 15514: if (XEiJ.EFA_SEPARATE_AR) { 15515: XEiJ.mpuCycleCount += 8; 15516: return (XEiJ.regRn[11] += 4) - 4; 15517: } 15518: //fallthrough 15519: case 0b011_100: //(A4)+ 15520: if (XEiJ.EFA_SEPARATE_AR) { 15521: XEiJ.mpuCycleCount += 8; 15522: return (XEiJ.regRn[12] += 4) - 4; 15523: } 15524: //fallthrough 15525: case 0b011_101: //(A5)+ 15526: if (XEiJ.EFA_SEPARATE_AR) { 15527: XEiJ.mpuCycleCount += 8; 15528: return (XEiJ.regRn[13] += 4) - 4; 15529: } 15530: //fallthrough 15531: case 0b011_110: //(A6)+ 15532: if (XEiJ.EFA_SEPARATE_AR) { 15533: XEiJ.mpuCycleCount += 8; 15534: return (XEiJ.regRn[14] += 4) - 4; 15535: } 15536: //fallthrough 15537: case 0b011_111: //(A7)+ 15538: if (XEiJ.EFA_SEPARATE_AR) { 15539: XEiJ.mpuCycleCount += 8; 15540: return (XEiJ.regRn[15] += 4) - 4; 15541: } else { 15542: XEiJ.mpuCycleCount += 8; 15543: return (XEiJ.regRn[ea - (0b011_000 - 8)] += 4) - 4; 15544: } 15545: case 0b100_000: //-(A0) 15546: if (XEiJ.EFA_SEPARATE_AR) { 15547: XEiJ.mpuCycleCount += 10; 15548: return XEiJ.regRn[ 8] -= 4; 15549: } 15550: //fallthrough 15551: case 0b100_001: //-(A1) 15552: if (XEiJ.EFA_SEPARATE_AR) { 15553: XEiJ.mpuCycleCount += 10; 15554: return XEiJ.regRn[ 9] -= 4; 15555: } 15556: //fallthrough 15557: case 0b100_010: //-(A2) 15558: if (XEiJ.EFA_SEPARATE_AR) { 15559: XEiJ.mpuCycleCount += 10; 15560: return XEiJ.regRn[10] -= 4; 15561: } 15562: //fallthrough 15563: case 0b100_011: //-(A3) 15564: if (XEiJ.EFA_SEPARATE_AR) { 15565: XEiJ.mpuCycleCount += 10; 15566: return XEiJ.regRn[11] -= 4; 15567: } 15568: //fallthrough 15569: case 0b100_100: //-(A4) 15570: if (XEiJ.EFA_SEPARATE_AR) { 15571: XEiJ.mpuCycleCount += 10; 15572: return XEiJ.regRn[12] -= 4; 15573: } 15574: //fallthrough 15575: case 0b100_101: //-(A5) 15576: if (XEiJ.EFA_SEPARATE_AR) { 15577: XEiJ.mpuCycleCount += 10; 15578: return XEiJ.regRn[13] -= 4; 15579: } 15580: //fallthrough 15581: case 0b100_110: //-(A6) 15582: if (XEiJ.EFA_SEPARATE_AR) { 15583: XEiJ.mpuCycleCount += 10; 15584: return XEiJ.regRn[14] -= 4; 15585: } 15586: //fallthrough 15587: case 0b100_111: //-(A7) 15588: if (XEiJ.EFA_SEPARATE_AR) { 15589: XEiJ.mpuCycleCount += 10; 15590: return XEiJ.regRn[15] -= 4; 15591: } else { 15592: XEiJ.mpuCycleCount += 10; 15593: return XEiJ.regRn[ea - (0b100_000 - 8)] -= 4; 15594: } 15595: case 0b101_000: //(d16,A0) 15596: case 0b101_001: //(d16,A1) 15597: case 0b101_010: //(d16,A2) 15598: case 0b101_011: //(d16,A3) 15599: case 0b101_100: //(d16,A4) 15600: case 0b101_101: //(d16,A5) 15601: case 0b101_110: //(d16,A6) 15602: case 0b101_111: //(d16,A7) 15603: XEiJ.mpuCycleCount += 12; 15604: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 15605: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 15606: + XEiJ.busRwse ((XEiJ.regPC += 2) - 2)); //pcws。ワードディスプレースメント 15607: } else { 15608: t = XEiJ.regPC; 15609: XEiJ.regPC = t + 2; 15610: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 15611: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 15612: } 15613: case 0b110_000: //(d8,A0,Rn.wl) 15614: case 0b110_001: //(d8,A1,Rn.wl) 15615: case 0b110_010: //(d8,A2,Rn.wl) 15616: case 0b110_011: //(d8,A3,Rn.wl) 15617: case 0b110_100: //(d8,A4,Rn.wl) 15618: case 0b110_101: //(d8,A5,Rn.wl) 15619: case 0b110_110: //(d8,A6,Rn.wl) 15620: case 0b110_111: //(d8,A7,Rn.wl) 15621: XEiJ.mpuCycleCount += 14; 15622: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 15623: w = XEiJ.busRwze ((XEiJ.regPC += 2) - 2); //pcwz。拡張ワード 15624: } else { 15625: w = XEiJ.regPC; 15626: XEiJ.regPC = w + 2; 15627: w = XEiJ.busRwze (w); //pcwz。拡張ワード 15628: } 15629: return (XEiJ.regRn[ea - (0b110_000 - 8)] //ベースレジスタ 15630: + (byte) w //バイトディスプレースメント 15631: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 15632: XEiJ.regRn[w >> 12])); //ロングインデックス 15633: case 0b111_000: //(xxx).W 15634: XEiJ.mpuCycleCount += 12; 15635: return XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 15636: case 0b111_001: //(xxx).L 15637: XEiJ.mpuCycleCount += 16; 15638: return XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 15639: case 0b111_010: //(d16,PC) 15640: XEiJ.mpuCycleCount += 12; 15641: t = XEiJ.regPC; 15642: XEiJ.regPC = t + 2; 15643: return (t //ベースレジスタ 15644: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 15645: case 0b111_011: //(d8,PC,Rn.wl) 15646: XEiJ.mpuCycleCount += 14; 15647: t = XEiJ.regPC; 15648: XEiJ.regPC = t + 2; 15649: w = XEiJ.busRwze (t); //pcwz。拡張ワード 15650: return (t //ベースレジスタ 15651: + (byte) w //バイトディスプレースメント 15652: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 15653: XEiJ.regRn[w >> 12])); //ロングインデックス 15654: } //switch 15655: XEiJ.mpuCycleCount += 34; 15656: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 15657: throw M68kException.m6eSignal; 15658: } //efaMemLong 15659: 15660: //a = efaMltLong (ea) //| M+-WXZ | 15661: // メモリ可変モードのロングオペランドの実効アドレスを求める 15662: // efaMemLongとの違いは(d16,PC)と(d8,PC,Rn.wl)がないこと 15663: @SuppressWarnings ("fallthrough") public static int efaMltLong (int ea) throws M68kException { 15664: int t, w; 15665: switch (ea) { 15666: case 0b010_000: //(A0) 15667: if (XEiJ.EFA_SEPARATE_AR) { 15668: XEiJ.mpuCycleCount += 8; 15669: return XEiJ.regRn[ 8]; 15670: } 15671: //fallthrough 15672: case 0b010_001: //(A1) 15673: if (XEiJ.EFA_SEPARATE_AR) { 15674: XEiJ.mpuCycleCount += 8; 15675: return XEiJ.regRn[ 9]; 15676: } 15677: //fallthrough 15678: case 0b010_010: //(A2) 15679: if (XEiJ.EFA_SEPARATE_AR) { 15680: XEiJ.mpuCycleCount += 8; 15681: return XEiJ.regRn[10]; 15682: } 15683: //fallthrough 15684: case 0b010_011: //(A3) 15685: if (XEiJ.EFA_SEPARATE_AR) { 15686: XEiJ.mpuCycleCount += 8; 15687: return XEiJ.regRn[11]; 15688: } 15689: //fallthrough 15690: case 0b010_100: //(A4) 15691: if (XEiJ.EFA_SEPARATE_AR) { 15692: XEiJ.mpuCycleCount += 8; 15693: return XEiJ.regRn[12]; 15694: } 15695: //fallthrough 15696: case 0b010_101: //(A5) 15697: if (XEiJ.EFA_SEPARATE_AR) { 15698: XEiJ.mpuCycleCount += 8; 15699: return XEiJ.regRn[13]; 15700: } 15701: //fallthrough 15702: case 0b010_110: //(A6) 15703: if (XEiJ.EFA_SEPARATE_AR) { 15704: XEiJ.mpuCycleCount += 8; 15705: return XEiJ.regRn[14]; 15706: } 15707: //fallthrough 15708: case 0b010_111: //(A7) 15709: if (XEiJ.EFA_SEPARATE_AR) { 15710: XEiJ.mpuCycleCount += 8; 15711: return XEiJ.regRn[15]; 15712: } else { 15713: XEiJ.mpuCycleCount += 8; 15714: return XEiJ.regRn[ea - (0b010_000 - 8)]; 15715: } 15716: case 0b011_000: //(A0)+ 15717: if (XEiJ.EFA_SEPARATE_AR) { 15718: XEiJ.mpuCycleCount += 8; 15719: return (XEiJ.regRn[ 8] += 4) - 4; 15720: } 15721: //fallthrough 15722: case 0b011_001: //(A1)+ 15723: if (XEiJ.EFA_SEPARATE_AR) { 15724: XEiJ.mpuCycleCount += 8; 15725: return (XEiJ.regRn[ 9] += 4) - 4; 15726: } 15727: //fallthrough 15728: case 0b011_010: //(A2)+ 15729: if (XEiJ.EFA_SEPARATE_AR) { 15730: XEiJ.mpuCycleCount += 8; 15731: return (XEiJ.regRn[10] += 4) - 4; 15732: } 15733: //fallthrough 15734: case 0b011_011: //(A3)+ 15735: if (XEiJ.EFA_SEPARATE_AR) { 15736: XEiJ.mpuCycleCount += 8; 15737: return (XEiJ.regRn[11] += 4) - 4; 15738: } 15739: //fallthrough 15740: case 0b011_100: //(A4)+ 15741: if (XEiJ.EFA_SEPARATE_AR) { 15742: XEiJ.mpuCycleCount += 8; 15743: return (XEiJ.regRn[12] += 4) - 4; 15744: } 15745: //fallthrough 15746: case 0b011_101: //(A5)+ 15747: if (XEiJ.EFA_SEPARATE_AR) { 15748: XEiJ.mpuCycleCount += 8; 15749: return (XEiJ.regRn[13] += 4) - 4; 15750: } 15751: //fallthrough 15752: case 0b011_110: //(A6)+ 15753: if (XEiJ.EFA_SEPARATE_AR) { 15754: XEiJ.mpuCycleCount += 8; 15755: return (XEiJ.regRn[14] += 4) - 4; 15756: } 15757: //fallthrough 15758: case 0b011_111: //(A7)+ 15759: if (XEiJ.EFA_SEPARATE_AR) { 15760: XEiJ.mpuCycleCount += 8; 15761: return (XEiJ.regRn[15] += 4) - 4; 15762: } else { 15763: XEiJ.mpuCycleCount += 8; 15764: return (XEiJ.regRn[ea - (0b011_000 - 8)] += 4) - 4; 15765: } 15766: case 0b100_000: //-(A0) 15767: if (XEiJ.EFA_SEPARATE_AR) { 15768: XEiJ.mpuCycleCount += 10; 15769: return XEiJ.regRn[ 8] -= 4; 15770: } 15771: //fallthrough 15772: case 0b100_001: //-(A1) 15773: if (XEiJ.EFA_SEPARATE_AR) { 15774: XEiJ.mpuCycleCount += 10; 15775: return XEiJ.regRn[ 9] -= 4; 15776: } 15777: //fallthrough 15778: case 0b100_010: //-(A2) 15779: if (XEiJ.EFA_SEPARATE_AR) { 15780: XEiJ.mpuCycleCount += 10; 15781: return XEiJ.regRn[10] -= 4; 15782: } 15783: //fallthrough 15784: case 0b100_011: //-(A3) 15785: if (XEiJ.EFA_SEPARATE_AR) { 15786: XEiJ.mpuCycleCount += 10; 15787: return XEiJ.regRn[11] -= 4; 15788: } 15789: //fallthrough 15790: case 0b100_100: //-(A4) 15791: if (XEiJ.EFA_SEPARATE_AR) { 15792: XEiJ.mpuCycleCount += 10; 15793: return XEiJ.regRn[12] -= 4; 15794: } 15795: //fallthrough 15796: case 0b100_101: //-(A5) 15797: if (XEiJ.EFA_SEPARATE_AR) { 15798: XEiJ.mpuCycleCount += 10; 15799: return XEiJ.regRn[13] -= 4; 15800: } 15801: //fallthrough 15802: case 0b100_110: //-(A6) 15803: if (XEiJ.EFA_SEPARATE_AR) { 15804: XEiJ.mpuCycleCount += 10; 15805: return XEiJ.regRn[14] -= 4; 15806: } 15807: //fallthrough 15808: case 0b100_111: //-(A7) 15809: if (XEiJ.EFA_SEPARATE_AR) { 15810: XEiJ.mpuCycleCount += 10; 15811: return XEiJ.regRn[15] -= 4; 15812: } else { 15813: XEiJ.mpuCycleCount += 10; 15814: return XEiJ.regRn[ea - (0b100_000 - 8)] -= 4; 15815: } 15816: case 0b101_000: //(d16,A0) 15817: case 0b101_001: //(d16,A1) 15818: case 0b101_010: //(d16,A2) 15819: case 0b101_011: //(d16,A3) 15820: case 0b101_100: //(d16,A4) 15821: case 0b101_101: //(d16,A5) 15822: case 0b101_110: //(d16,A6) 15823: case 0b101_111: //(d16,A7) 15824: XEiJ.mpuCycleCount += 12; 15825: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 15826: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 15827: + XEiJ.busRwse ((XEiJ.regPC += 2) - 2)); //pcws。ワードディスプレースメント 15828: } else { 15829: t = XEiJ.regPC; 15830: XEiJ.regPC = t + 2; 15831: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 15832: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 15833: } 15834: case 0b110_000: //(d8,A0,Rn.wl) 15835: case 0b110_001: //(d8,A1,Rn.wl) 15836: case 0b110_010: //(d8,A2,Rn.wl) 15837: case 0b110_011: //(d8,A3,Rn.wl) 15838: case 0b110_100: //(d8,A4,Rn.wl) 15839: case 0b110_101: //(d8,A5,Rn.wl) 15840: case 0b110_110: //(d8,A6,Rn.wl) 15841: case 0b110_111: //(d8,A7,Rn.wl) 15842: XEiJ.mpuCycleCount += 14; 15843: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 15844: w = XEiJ.busRwze ((XEiJ.regPC += 2) - 2); //pcwz。拡張ワード 15845: } else { 15846: w = XEiJ.regPC; 15847: XEiJ.regPC = w + 2; 15848: w = XEiJ.busRwze (w); //pcwz。拡張ワード 15849: } 15850: return (XEiJ.regRn[ea - (0b110_000 - 8)] //ベースレジスタ 15851: + (byte) w //バイトディスプレースメント 15852: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 15853: XEiJ.regRn[w >> 12])); //ロングインデックス 15854: case 0b111_000: //(xxx).W 15855: XEiJ.mpuCycleCount += 12; 15856: return XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 15857: case 0b111_001: //(xxx).L 15858: XEiJ.mpuCycleCount += 16; 15859: return XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 15860: } //switch 15861: XEiJ.mpuCycleCount += 34; 15862: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 15863: throw M68kException.m6eSignal; 15864: } //efaMltLong 15865: 15866: //a = efaCntLong (ea) //| M WXZP | 15867: // 制御モードのロングオペランドの実効アドレスを求める 15868: // efaMemLongとの違いは(Ar)+と-(Ar)がないこと 15869: @SuppressWarnings ("fallthrough") public static int efaCntLong (int ea) throws M68kException { 15870: int t, w; 15871: switch (ea) { 15872: case 0b010_000: //(A0) 15873: if (XEiJ.EFA_SEPARATE_AR) { 15874: XEiJ.mpuCycleCount += 8; 15875: return XEiJ.regRn[ 8]; 15876: } 15877: //fallthrough 15878: case 0b010_001: //(A1) 15879: if (XEiJ.EFA_SEPARATE_AR) { 15880: XEiJ.mpuCycleCount += 8; 15881: return XEiJ.regRn[ 9]; 15882: } 15883: //fallthrough 15884: case 0b010_010: //(A2) 15885: if (XEiJ.EFA_SEPARATE_AR) { 15886: XEiJ.mpuCycleCount += 8; 15887: return XEiJ.regRn[10]; 15888: } 15889: //fallthrough 15890: case 0b010_011: //(A3) 15891: if (XEiJ.EFA_SEPARATE_AR) { 15892: XEiJ.mpuCycleCount += 8; 15893: return XEiJ.regRn[11]; 15894: } 15895: //fallthrough 15896: case 0b010_100: //(A4) 15897: if (XEiJ.EFA_SEPARATE_AR) { 15898: XEiJ.mpuCycleCount += 8; 15899: return XEiJ.regRn[12]; 15900: } 15901: //fallthrough 15902: case 0b010_101: //(A5) 15903: if (XEiJ.EFA_SEPARATE_AR) { 15904: XEiJ.mpuCycleCount += 8; 15905: return XEiJ.regRn[13]; 15906: } 15907: //fallthrough 15908: case 0b010_110: //(A6) 15909: if (XEiJ.EFA_SEPARATE_AR) { 15910: XEiJ.mpuCycleCount += 8; 15911: return XEiJ.regRn[14]; 15912: } 15913: //fallthrough 15914: case 0b010_111: //(A7) 15915: if (XEiJ.EFA_SEPARATE_AR) { 15916: XEiJ.mpuCycleCount += 8; 15917: return XEiJ.regRn[15]; 15918: } else { 15919: XEiJ.mpuCycleCount += 8; 15920: return XEiJ.regRn[ea - (0b010_000 - 8)]; 15921: } 15922: case 0b101_000: //(d16,A0) 15923: case 0b101_001: //(d16,A1) 15924: case 0b101_010: //(d16,A2) 15925: case 0b101_011: //(d16,A3) 15926: case 0b101_100: //(d16,A4) 15927: case 0b101_101: //(d16,A5) 15928: case 0b101_110: //(d16,A6) 15929: case 0b101_111: //(d16,A7) 15930: XEiJ.mpuCycleCount += 12; 15931: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 15932: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 15933: + XEiJ.busRwse ((XEiJ.regPC += 2) - 2)); //pcws。ワードディスプレースメント 15934: } else { 15935: t = XEiJ.regPC; 15936: XEiJ.regPC = t + 2; 15937: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 15938: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 15939: } 15940: case 0b110_000: //(d8,A0,Rn.wl) 15941: case 0b110_001: //(d8,A1,Rn.wl) 15942: case 0b110_010: //(d8,A2,Rn.wl) 15943: case 0b110_011: //(d8,A3,Rn.wl) 15944: case 0b110_100: //(d8,A4,Rn.wl) 15945: case 0b110_101: //(d8,A5,Rn.wl) 15946: case 0b110_110: //(d8,A6,Rn.wl) 15947: case 0b110_111: //(d8,A7,Rn.wl) 15948: XEiJ.mpuCycleCount += 14; 15949: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 15950: w = XEiJ.busRwze ((XEiJ.regPC += 2) - 2); //pcwz。拡張ワード 15951: } else { 15952: w = XEiJ.regPC; 15953: XEiJ.regPC = w + 2; 15954: w = XEiJ.busRwze (w); //pcwz。拡張ワード 15955: } 15956: return (XEiJ.regRn[ea - (0b110_000 - 8)] //ベースレジスタ 15957: + (byte) w //バイトディスプレースメント 15958: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 15959: XEiJ.regRn[w >> 12])); //ロングインデックス 15960: case 0b111_000: //(xxx).W 15961: XEiJ.mpuCycleCount += 12; 15962: return XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 15963: case 0b111_001: //(xxx).L 15964: XEiJ.mpuCycleCount += 16; 15965: return XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 15966: case 0b111_010: //(d16,PC) 15967: XEiJ.mpuCycleCount += 12; 15968: t = XEiJ.regPC; 15969: XEiJ.regPC = t + 2; 15970: return (t //ベースレジスタ 15971: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 15972: case 0b111_011: //(d8,PC,Rn.wl) 15973: XEiJ.mpuCycleCount += 14; 15974: t = XEiJ.regPC; 15975: XEiJ.regPC = t + 2; 15976: w = XEiJ.busRwze (t); //pcwz。拡張ワード 15977: return (t //ベースレジスタ 15978: + (byte) w //バイトディスプレースメント 15979: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 15980: XEiJ.regRn[w >> 12])); //ロングインデックス 15981: } //switch 15982: XEiJ.mpuCycleCount += 34; 15983: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 15984: throw M68kException.m6eSignal; 15985: } //efaCntLong 15986: 15987: //a = efaCltLong (ea) //| M WXZ | 15988: // 制御可変モードのワードオペランドの実効アドレスを求める 15989: // efaCntLongとの違いは(d16,PC)と(d8,PC,Rn.wl)がないこと 15990: @SuppressWarnings ("fallthrough") public static int efaCltLong (int ea) throws M68kException { 15991: int t, w; 15992: switch (ea) { 15993: case 0b010_000: //(A0) 15994: if (XEiJ.EFA_SEPARATE_AR) { 15995: XEiJ.mpuCycleCount += 8; 15996: return XEiJ.regRn[ 8]; 15997: } 15998: //fallthrough 15999: case 0b010_001: //(A1) 16000: if (XEiJ.EFA_SEPARATE_AR) { 16001: XEiJ.mpuCycleCount += 8; 16002: return XEiJ.regRn[ 9]; 16003: } 16004: //fallthrough 16005: case 0b010_010: //(A2) 16006: if (XEiJ.EFA_SEPARATE_AR) { 16007: XEiJ.mpuCycleCount += 8; 16008: return XEiJ.regRn[10]; 16009: } 16010: //fallthrough 16011: case 0b010_011: //(A3) 16012: if (XEiJ.EFA_SEPARATE_AR) { 16013: XEiJ.mpuCycleCount += 8; 16014: return XEiJ.regRn[11]; 16015: } 16016: //fallthrough 16017: case 0b010_100: //(A4) 16018: if (XEiJ.EFA_SEPARATE_AR) { 16019: XEiJ.mpuCycleCount += 8; 16020: return XEiJ.regRn[12]; 16021: } 16022: //fallthrough 16023: case 0b010_101: //(A5) 16024: if (XEiJ.EFA_SEPARATE_AR) { 16025: XEiJ.mpuCycleCount += 8; 16026: return XEiJ.regRn[13]; 16027: } 16028: //fallthrough 16029: case 0b010_110: //(A6) 16030: if (XEiJ.EFA_SEPARATE_AR) { 16031: XEiJ.mpuCycleCount += 8; 16032: return XEiJ.regRn[14]; 16033: } 16034: //fallthrough 16035: case 0b010_111: //(A7) 16036: if (XEiJ.EFA_SEPARATE_AR) { 16037: XEiJ.mpuCycleCount += 8; 16038: return XEiJ.regRn[15]; 16039: } else { 16040: XEiJ.mpuCycleCount += 8; 16041: return XEiJ.regRn[ea - (0b010_000 - 8)]; 16042: } 16043: case 0b101_000: //(d16,A0) 16044: case 0b101_001: //(d16,A1) 16045: case 0b101_010: //(d16,A2) 16046: case 0b101_011: //(d16,A3) 16047: case 0b101_100: //(d16,A4) 16048: case 0b101_101: //(d16,A5) 16049: case 0b101_110: //(d16,A6) 16050: case 0b101_111: //(d16,A7) 16051: XEiJ.mpuCycleCount += 12; 16052: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 16053: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 16054: + XEiJ.busRwse ((XEiJ.regPC += 2) - 2)); //pcws。ワードディスプレースメント 16055: } else { 16056: t = XEiJ.regPC; 16057: XEiJ.regPC = t + 2; 16058: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 16059: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 16060: } 16061: case 0b110_000: //(d8,A0,Rn.wl) 16062: case 0b110_001: //(d8,A1,Rn.wl) 16063: case 0b110_010: //(d8,A2,Rn.wl) 16064: case 0b110_011: //(d8,A3,Rn.wl) 16065: case 0b110_100: //(d8,A4,Rn.wl) 16066: case 0b110_101: //(d8,A5,Rn.wl) 16067: case 0b110_110: //(d8,A6,Rn.wl) 16068: case 0b110_111: //(d8,A7,Rn.wl) 16069: XEiJ.mpuCycleCount += 14; 16070: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 16071: w = XEiJ.busRwze ((XEiJ.regPC += 2) - 2); //pcwz。拡張ワード 16072: } else { 16073: w = XEiJ.regPC; 16074: XEiJ.regPC = w + 2; 16075: w = XEiJ.busRwze (w); //pcwz。拡張ワード 16076: } 16077: return (XEiJ.regRn[ea - (0b110_000 - 8)] //ベースレジスタ 16078: + (byte) w //バイトディスプレースメント 16079: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 16080: XEiJ.regRn[w >> 12])); //ロングインデックス 16081: case 0b111_000: //(xxx).W 16082: XEiJ.mpuCycleCount += 12; 16083: return XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 16084: case 0b111_001: //(xxx).L 16085: XEiJ.mpuCycleCount += 16; 16086: return XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 16087: } //switch 16088: XEiJ.mpuCycleCount += 34; 16089: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 16090: throw M68kException.m6eSignal; 16091: } //efaCltLong 16092: 16093: //a = efaAnyQuad (ea) //| M+-WXZPI| 16094: // 任意のモードのクワッドオペランドの実効アドレスを求める 16095: // efaAnyLongとの違いは(Ar)+と-(Ar)がArを8変化させることと、#<data>がPCを8変化させることと、 16096: // オペランドのアクセスが2ワード増える分の8サイクルが追加されていること 16097: @SuppressWarnings ("fallthrough") public static int efaAnyQuad (int ea) throws M68kException { 16098: int t, w; 16099: switch (ea) { 16100: case 0b010_000: //(A0) 16101: if (XEiJ.EFA_SEPARATE_AR) { 16102: XEiJ.mpuCycleCount += 16; 16103: return XEiJ.regRn[ 8]; 16104: } 16105: //fallthrough 16106: case 0b010_001: //(A1) 16107: if (XEiJ.EFA_SEPARATE_AR) { 16108: XEiJ.mpuCycleCount += 16; 16109: return XEiJ.regRn[ 9]; 16110: } 16111: //fallthrough 16112: case 0b010_010: //(A2) 16113: if (XEiJ.EFA_SEPARATE_AR) { 16114: XEiJ.mpuCycleCount += 16; 16115: return XEiJ.regRn[10]; 16116: } 16117: //fallthrough 16118: case 0b010_011: //(A3) 16119: if (XEiJ.EFA_SEPARATE_AR) { 16120: XEiJ.mpuCycleCount += 16; 16121: return XEiJ.regRn[11]; 16122: } 16123: //fallthrough 16124: case 0b010_100: //(A4) 16125: if (XEiJ.EFA_SEPARATE_AR) { 16126: XEiJ.mpuCycleCount += 16; 16127: return XEiJ.regRn[12]; 16128: } 16129: //fallthrough 16130: case 0b010_101: //(A5) 16131: if (XEiJ.EFA_SEPARATE_AR) { 16132: XEiJ.mpuCycleCount += 16; 16133: return XEiJ.regRn[13]; 16134: } 16135: //fallthrough 16136: case 0b010_110: //(A6) 16137: if (XEiJ.EFA_SEPARATE_AR) { 16138: XEiJ.mpuCycleCount += 16; 16139: return XEiJ.regRn[14]; 16140: } 16141: //fallthrough 16142: case 0b010_111: //(A7) 16143: if (XEiJ.EFA_SEPARATE_AR) { 16144: XEiJ.mpuCycleCount += 16; 16145: return XEiJ.regRn[15]; 16146: } else { 16147: XEiJ.mpuCycleCount += 16; 16148: return XEiJ.regRn[ea - (0b010_000 - 8)]; 16149: } 16150: case 0b011_000: //(A0)+ 16151: if (XEiJ.EFA_SEPARATE_AR) { 16152: XEiJ.mpuCycleCount += 16; 16153: return (XEiJ.regRn[ 8] += 8) - 8; 16154: } 16155: //fallthrough 16156: case 0b011_001: //(A1)+ 16157: if (XEiJ.EFA_SEPARATE_AR) { 16158: XEiJ.mpuCycleCount += 16; 16159: return (XEiJ.regRn[ 9] += 8) - 8; 16160: } 16161: //fallthrough 16162: case 0b011_010: //(A2)+ 16163: if (XEiJ.EFA_SEPARATE_AR) { 16164: XEiJ.mpuCycleCount += 16; 16165: return (XEiJ.regRn[10] += 8) - 8; 16166: } 16167: //fallthrough 16168: case 0b011_011: //(A3)+ 16169: if (XEiJ.EFA_SEPARATE_AR) { 16170: XEiJ.mpuCycleCount += 16; 16171: return (XEiJ.regRn[11] += 8) - 8; 16172: } 16173: //fallthrough 16174: case 0b011_100: //(A4)+ 16175: if (XEiJ.EFA_SEPARATE_AR) { 16176: XEiJ.mpuCycleCount += 16; 16177: return (XEiJ.regRn[12] += 8) - 8; 16178: } 16179: //fallthrough 16180: case 0b011_101: //(A5)+ 16181: if (XEiJ.EFA_SEPARATE_AR) { 16182: XEiJ.mpuCycleCount += 16; 16183: return (XEiJ.regRn[13] += 8) - 8; 16184: } 16185: //fallthrough 16186: case 0b011_110: //(A6)+ 16187: if (XEiJ.EFA_SEPARATE_AR) { 16188: XEiJ.mpuCycleCount += 16; 16189: return (XEiJ.regRn[14] += 8) - 8; 16190: } 16191: //fallthrough 16192: case 0b011_111: //(A7)+ 16193: if (XEiJ.EFA_SEPARATE_AR) { 16194: XEiJ.mpuCycleCount += 16; 16195: return (XEiJ.regRn[15] += 8) - 8; 16196: } else { 16197: XEiJ.mpuCycleCount += 16; 16198: return (XEiJ.regRn[ea - (0b011_000 - 8)] += 8) - 8; 16199: } 16200: case 0b100_000: //-(A0) 16201: if (XEiJ.EFA_SEPARATE_AR) { 16202: XEiJ.mpuCycleCount += 18; 16203: return XEiJ.regRn[ 8] -= 8; 16204: } 16205: //fallthrough 16206: case 0b100_001: //-(A1) 16207: if (XEiJ.EFA_SEPARATE_AR) { 16208: XEiJ.mpuCycleCount += 18; 16209: return XEiJ.regRn[ 9] -= 8; 16210: } 16211: //fallthrough 16212: case 0b100_010: //-(A2) 16213: if (XEiJ.EFA_SEPARATE_AR) { 16214: XEiJ.mpuCycleCount += 18; 16215: return XEiJ.regRn[10] -= 8; 16216: } 16217: //fallthrough 16218: case 0b100_011: //-(A3) 16219: if (XEiJ.EFA_SEPARATE_AR) { 16220: XEiJ.mpuCycleCount += 18; 16221: return XEiJ.regRn[11] -= 8; 16222: } 16223: //fallthrough 16224: case 0b100_100: //-(A4) 16225: if (XEiJ.EFA_SEPARATE_AR) { 16226: XEiJ.mpuCycleCount += 18; 16227: return XEiJ.regRn[12] -= 8; 16228: } 16229: //fallthrough 16230: case 0b100_101: //-(A5) 16231: if (XEiJ.EFA_SEPARATE_AR) { 16232: XEiJ.mpuCycleCount += 18; 16233: return XEiJ.regRn[13] -= 8; 16234: } 16235: //fallthrough 16236: case 0b100_110: //-(A6) 16237: if (XEiJ.EFA_SEPARATE_AR) { 16238: XEiJ.mpuCycleCount += 18; 16239: return XEiJ.regRn[14] -= 8; 16240: } 16241: //fallthrough 16242: case 0b100_111: //-(A7) 16243: if (XEiJ.EFA_SEPARATE_AR) { 16244: XEiJ.mpuCycleCount += 18; 16245: return XEiJ.regRn[15] -= 8; 16246: } else { 16247: XEiJ.mpuCycleCount += 18; 16248: return XEiJ.regRn[ea - (0b100_000 - 8)] -= 8; 16249: } 16250: case 0b101_000: //(d16,A0) 16251: case 0b101_001: //(d16,A1) 16252: case 0b101_010: //(d16,A2) 16253: case 0b101_011: //(d16,A3) 16254: case 0b101_100: //(d16,A4) 16255: case 0b101_101: //(d16,A5) 16256: case 0b101_110: //(d16,A6) 16257: case 0b101_111: //(d16,A7) 16258: XEiJ.mpuCycleCount += 20; 16259: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 16260: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 16261: + XEiJ.busRwse ((XEiJ.regPC += 2) - 2)); //pcws。ワードディスプレースメント 16262: } else { 16263: t = XEiJ.regPC; 16264: XEiJ.regPC = t + 2; 16265: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 16266: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 16267: } 16268: case 0b110_000: //(d8,A0,Rn.wl) 16269: case 0b110_001: //(d8,A1,Rn.wl) 16270: case 0b110_010: //(d8,A2,Rn.wl) 16271: case 0b110_011: //(d8,A3,Rn.wl) 16272: case 0b110_100: //(d8,A4,Rn.wl) 16273: case 0b110_101: //(d8,A5,Rn.wl) 16274: case 0b110_110: //(d8,A6,Rn.wl) 16275: case 0b110_111: //(d8,A7,Rn.wl) 16276: XEiJ.mpuCycleCount += 22; 16277: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 16278: w = XEiJ.busRwze ((XEiJ.regPC += 2) - 2); //pcwz。拡張ワード 16279: } else { 16280: w = XEiJ.regPC; 16281: XEiJ.regPC = w + 2; 16282: w = XEiJ.busRwze (w); //pcwz。拡張ワード 16283: } 16284: return (XEiJ.regRn[ea - (0b110_000 - 8)] //ベースレジスタ 16285: + (byte) w //バイトディスプレースメント 16286: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 16287: XEiJ.regRn[w >> 12])); //ロングインデックス 16288: case 0b111_000: //(xxx).W 16289: XEiJ.mpuCycleCount += 20; 16290: return XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 16291: case 0b111_001: //(xxx).L 16292: XEiJ.mpuCycleCount += 24; 16293: return XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 16294: case 0b111_010: //(d16,PC) 16295: XEiJ.mpuCycleCount += 20; 16296: t = XEiJ.regPC; 16297: XEiJ.regPC = t + 2; 16298: return (t //ベースレジスタ 16299: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 16300: case 0b111_011: //(d8,PC,Rn.wl) 16301: XEiJ.mpuCycleCount += 22; 16302: t = XEiJ.regPC; 16303: XEiJ.regPC = t + 2; 16304: w = XEiJ.busRwze (t); //pcwz。拡張ワード 16305: return (t //ベースレジスタ 16306: + (byte) w //バイトディスプレースメント 16307: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 16308: XEiJ.regRn[w >> 12])); //ロングインデックス 16309: case 0b111_100: //#<data> 16310: XEiJ.mpuCycleCount += 16; 16311: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 16312: return (XEiJ.regPC += 8) - 8; 16313: } else { 16314: t = XEiJ.regPC; 16315: XEiJ.regPC = t + 8; 16316: return t; 16317: } 16318: } //switch 16319: XEiJ.mpuCycleCount += 34; 16320: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 16321: throw M68kException.m6eSignal; 16322: } //efaAnyQuad 16323: 16324: //a = efaMltQuad (ea) //| M+-WXZ | 16325: // メモリ可変モードのクワッドオペランドの実効アドレスを求める 16326: // efaMltLongとの違いは(Ar)+と-(Ar)がArを8変化させることと、#<data>がPCを8変化させることと、 16327: // オペランドのアクセスが2ワード増える分の8サイクルが追加されていること 16328: @SuppressWarnings ("fallthrough") public static int efaMltQuad (int ea) throws M68kException { 16329: int t, w; 16330: switch (ea) { 16331: case 0b010_000: //(A0) 16332: if (XEiJ.EFA_SEPARATE_AR) { 16333: XEiJ.mpuCycleCount += 16; 16334: return XEiJ.regRn[ 8]; 16335: } 16336: //fallthrough 16337: case 0b010_001: //(A1) 16338: if (XEiJ.EFA_SEPARATE_AR) { 16339: XEiJ.mpuCycleCount += 16; 16340: return XEiJ.regRn[ 9]; 16341: } 16342: //fallthrough 16343: case 0b010_010: //(A2) 16344: if (XEiJ.EFA_SEPARATE_AR) { 16345: XEiJ.mpuCycleCount += 16; 16346: return XEiJ.regRn[10]; 16347: } 16348: //fallthrough 16349: case 0b010_011: //(A3) 16350: if (XEiJ.EFA_SEPARATE_AR) { 16351: XEiJ.mpuCycleCount += 16; 16352: return XEiJ.regRn[11]; 16353: } 16354: //fallthrough 16355: case 0b010_100: //(A4) 16356: if (XEiJ.EFA_SEPARATE_AR) { 16357: XEiJ.mpuCycleCount += 16; 16358: return XEiJ.regRn[12]; 16359: } 16360: //fallthrough 16361: case 0b010_101: //(A5) 16362: if (XEiJ.EFA_SEPARATE_AR) { 16363: XEiJ.mpuCycleCount += 16; 16364: return XEiJ.regRn[13]; 16365: } 16366: //fallthrough 16367: case 0b010_110: //(A6) 16368: if (XEiJ.EFA_SEPARATE_AR) { 16369: XEiJ.mpuCycleCount += 16; 16370: return XEiJ.regRn[14]; 16371: } 16372: //fallthrough 16373: case 0b010_111: //(A7) 16374: if (XEiJ.EFA_SEPARATE_AR) { 16375: XEiJ.mpuCycleCount += 16; 16376: return XEiJ.regRn[15]; 16377: } else { 16378: XEiJ.mpuCycleCount += 16; 16379: return XEiJ.regRn[ea - (0b010_000 - 8)]; 16380: } 16381: case 0b011_000: //(A0)+ 16382: if (XEiJ.EFA_SEPARATE_AR) { 16383: XEiJ.mpuCycleCount += 16; 16384: return (XEiJ.regRn[ 8] += 8) - 8; 16385: } 16386: //fallthrough 16387: case 0b011_001: //(A1)+ 16388: if (XEiJ.EFA_SEPARATE_AR) { 16389: XEiJ.mpuCycleCount += 16; 16390: return (XEiJ.regRn[ 9] += 8) - 8; 16391: } 16392: //fallthrough 16393: case 0b011_010: //(A2)+ 16394: if (XEiJ.EFA_SEPARATE_AR) { 16395: XEiJ.mpuCycleCount += 16; 16396: return (XEiJ.regRn[10] += 8) - 8; 16397: } 16398: //fallthrough 16399: case 0b011_011: //(A3)+ 16400: if (XEiJ.EFA_SEPARATE_AR) { 16401: XEiJ.mpuCycleCount += 16; 16402: return (XEiJ.regRn[11] += 8) - 8; 16403: } 16404: //fallthrough 16405: case 0b011_100: //(A4)+ 16406: if (XEiJ.EFA_SEPARATE_AR) { 16407: XEiJ.mpuCycleCount += 16; 16408: return (XEiJ.regRn[12] += 8) - 8; 16409: } 16410: //fallthrough 16411: case 0b011_101: //(A5)+ 16412: if (XEiJ.EFA_SEPARATE_AR) { 16413: XEiJ.mpuCycleCount += 16; 16414: return (XEiJ.regRn[13] += 8) - 8; 16415: } 16416: //fallthrough 16417: case 0b011_110: //(A6)+ 16418: if (XEiJ.EFA_SEPARATE_AR) { 16419: XEiJ.mpuCycleCount += 16; 16420: return (XEiJ.regRn[14] += 8) - 8; 16421: } 16422: //fallthrough 16423: case 0b011_111: //(A7)+ 16424: if (XEiJ.EFA_SEPARATE_AR) { 16425: XEiJ.mpuCycleCount += 16; 16426: return (XEiJ.regRn[15] += 8) - 8; 16427: } else { 16428: XEiJ.mpuCycleCount += 16; 16429: return (XEiJ.regRn[ea - (0b011_000 - 8)] += 8) - 8; 16430: } 16431: case 0b100_000: //-(A0) 16432: if (XEiJ.EFA_SEPARATE_AR) { 16433: XEiJ.mpuCycleCount += 18; 16434: return XEiJ.regRn[ 8] -= 8; 16435: } 16436: //fallthrough 16437: case 0b100_001: //-(A1) 16438: if (XEiJ.EFA_SEPARATE_AR) { 16439: XEiJ.mpuCycleCount += 18; 16440: return XEiJ.regRn[ 9] -= 8; 16441: } 16442: //fallthrough 16443: case 0b100_010: //-(A2) 16444: if (XEiJ.EFA_SEPARATE_AR) { 16445: XEiJ.mpuCycleCount += 18; 16446: return XEiJ.regRn[10] -= 8; 16447: } 16448: //fallthrough 16449: case 0b100_011: //-(A3) 16450: if (XEiJ.EFA_SEPARATE_AR) { 16451: XEiJ.mpuCycleCount += 18; 16452: return XEiJ.regRn[11] -= 8; 16453: } 16454: //fallthrough 16455: case 0b100_100: //-(A4) 16456: if (XEiJ.EFA_SEPARATE_AR) { 16457: XEiJ.mpuCycleCount += 18; 16458: return XEiJ.regRn[12] -= 8; 16459: } 16460: //fallthrough 16461: case 0b100_101: //-(A5) 16462: if (XEiJ.EFA_SEPARATE_AR) { 16463: XEiJ.mpuCycleCount += 18; 16464: return XEiJ.regRn[13] -= 8; 16465: } 16466: //fallthrough 16467: case 0b100_110: //-(A6) 16468: if (XEiJ.EFA_SEPARATE_AR) { 16469: XEiJ.mpuCycleCount += 18; 16470: return XEiJ.regRn[14] -= 8; 16471: } 16472: //fallthrough 16473: case 0b100_111: //-(A7) 16474: if (XEiJ.EFA_SEPARATE_AR) { 16475: XEiJ.mpuCycleCount += 18; 16476: return XEiJ.regRn[15] -= 8; 16477: } else { 16478: XEiJ.mpuCycleCount += 18; 16479: return XEiJ.regRn[ea - (0b100_000 - 8)] -= 8; 16480: } 16481: case 0b101_000: //(d16,A0) 16482: case 0b101_001: //(d16,A1) 16483: case 0b101_010: //(d16,A2) 16484: case 0b101_011: //(d16,A3) 16485: case 0b101_100: //(d16,A4) 16486: case 0b101_101: //(d16,A5) 16487: case 0b101_110: //(d16,A6) 16488: case 0b101_111: //(d16,A7) 16489: XEiJ.mpuCycleCount += 20; 16490: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 16491: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 16492: + XEiJ.busRwse ((XEiJ.regPC += 2) - 2)); //pcws。ワードディスプレースメント 16493: } else { 16494: t = XEiJ.regPC; 16495: XEiJ.regPC = t + 2; 16496: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 16497: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 16498: } 16499: case 0b110_000: //(d8,A0,Rn.wl) 16500: case 0b110_001: //(d8,A1,Rn.wl) 16501: case 0b110_010: //(d8,A2,Rn.wl) 16502: case 0b110_011: //(d8,A3,Rn.wl) 16503: case 0b110_100: //(d8,A4,Rn.wl) 16504: case 0b110_101: //(d8,A5,Rn.wl) 16505: case 0b110_110: //(d8,A6,Rn.wl) 16506: case 0b110_111: //(d8,A7,Rn.wl) 16507: XEiJ.mpuCycleCount += 22; 16508: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 16509: w = XEiJ.busRwze ((XEiJ.regPC += 2) - 2); //pcwz。拡張ワード 16510: } else { 16511: w = XEiJ.regPC; 16512: XEiJ.regPC = w + 2; 16513: w = XEiJ.busRwze (w); //pcwz。拡張ワード 16514: } 16515: return (XEiJ.regRn[ea - (0b110_000 - 8)] //ベースレジスタ 16516: + (byte) w //バイトディスプレースメント 16517: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 16518: XEiJ.regRn[w >> 12])); //ロングインデックス 16519: case 0b111_000: //(xxx).W 16520: XEiJ.mpuCycleCount += 20; 16521: return XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 16522: case 0b111_001: //(xxx).L 16523: XEiJ.mpuCycleCount += 24; 16524: return XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 16525: } //switch 16526: XEiJ.mpuCycleCount += 34; 16527: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 16528: throw M68kException.m6eSignal; 16529: } //efaMltQuad 16530: 16531: //a = efaAnyExtd (ea) //| M+-WXZPI| 16532: // 任意のモードのエクステンデッドオペランドの実効アドレスを求める 16533: // efaAnyQuadとの違いは(Ar)+と-(Ar)がArを12変化させることと、#<data>がPCを12変化させることと、 16534: // オペランドのアクセスが2ワード増える分の8サイクルが追加されていること 16535: @SuppressWarnings ("fallthrough") public static int efaAnyExtd (int ea) throws M68kException { 16536: int t, w; 16537: switch (ea) { 16538: case 0b010_000: //(A0) 16539: if (XEiJ.EFA_SEPARATE_AR) { 16540: XEiJ.mpuCycleCount += 24; 16541: return XEiJ.regRn[ 8]; 16542: } 16543: //fallthrough 16544: case 0b010_001: //(A1) 16545: if (XEiJ.EFA_SEPARATE_AR) { 16546: XEiJ.mpuCycleCount += 24; 16547: return XEiJ.regRn[ 9]; 16548: } 16549: //fallthrough 16550: case 0b010_010: //(A2) 16551: if (XEiJ.EFA_SEPARATE_AR) { 16552: XEiJ.mpuCycleCount += 24; 16553: return XEiJ.regRn[10]; 16554: } 16555: //fallthrough 16556: case 0b010_011: //(A3) 16557: if (XEiJ.EFA_SEPARATE_AR) { 16558: XEiJ.mpuCycleCount += 24; 16559: return XEiJ.regRn[11]; 16560: } 16561: //fallthrough 16562: case 0b010_100: //(A4) 16563: if (XEiJ.EFA_SEPARATE_AR) { 16564: XEiJ.mpuCycleCount += 24; 16565: return XEiJ.regRn[12]; 16566: } 16567: //fallthrough 16568: case 0b010_101: //(A5) 16569: if (XEiJ.EFA_SEPARATE_AR) { 16570: XEiJ.mpuCycleCount += 24; 16571: return XEiJ.regRn[13]; 16572: } 16573: //fallthrough 16574: case 0b010_110: //(A6) 16575: if (XEiJ.EFA_SEPARATE_AR) { 16576: XEiJ.mpuCycleCount += 24; 16577: return XEiJ.regRn[14]; 16578: } 16579: //fallthrough 16580: case 0b010_111: //(A7) 16581: if (XEiJ.EFA_SEPARATE_AR) { 16582: XEiJ.mpuCycleCount += 24; 16583: return XEiJ.regRn[15]; 16584: } else { 16585: XEiJ.mpuCycleCount += 24; 16586: return XEiJ.regRn[ea - (0b010_000 - 8)]; 16587: } 16588: case 0b011_000: //(A0)+ 16589: if (XEiJ.EFA_SEPARATE_AR) { 16590: XEiJ.mpuCycleCount += 24; 16591: return (XEiJ.regRn[ 8] += 12) - 12; 16592: } 16593: //fallthrough 16594: case 0b011_001: //(A1)+ 16595: if (XEiJ.EFA_SEPARATE_AR) { 16596: XEiJ.mpuCycleCount += 24; 16597: return (XEiJ.regRn[ 9] += 12) - 12; 16598: } 16599: //fallthrough 16600: case 0b011_010: //(A2)+ 16601: if (XEiJ.EFA_SEPARATE_AR) { 16602: XEiJ.mpuCycleCount += 24; 16603: return (XEiJ.regRn[10] += 12) - 12; 16604: } 16605: //fallthrough 16606: case 0b011_011: //(A3)+ 16607: if (XEiJ.EFA_SEPARATE_AR) { 16608: XEiJ.mpuCycleCount += 24; 16609: return (XEiJ.regRn[11] += 12) - 12; 16610: } 16611: //fallthrough 16612: case 0b011_100: //(A4)+ 16613: if (XEiJ.EFA_SEPARATE_AR) { 16614: XEiJ.mpuCycleCount += 24; 16615: return (XEiJ.regRn[12] += 12) - 12; 16616: } 16617: //fallthrough 16618: case 0b011_101: //(A5)+ 16619: if (XEiJ.EFA_SEPARATE_AR) { 16620: XEiJ.mpuCycleCount += 24; 16621: return (XEiJ.regRn[13] += 12) - 12; 16622: } 16623: //fallthrough 16624: case 0b011_110: //(A6)+ 16625: if (XEiJ.EFA_SEPARATE_AR) { 16626: XEiJ.mpuCycleCount += 24; 16627: return (XEiJ.regRn[14] += 12) - 12; 16628: } 16629: //fallthrough 16630: case 0b011_111: //(A7)+ 16631: if (XEiJ.EFA_SEPARATE_AR) { 16632: XEiJ.mpuCycleCount += 24; 16633: return (XEiJ.regRn[15] += 12) - 12; 16634: } else { 16635: XEiJ.mpuCycleCount += 24; 16636: return (XEiJ.regRn[ea - (0b011_000 - 8)] += 12) - 12; 16637: } 16638: case 0b100_000: //-(A0) 16639: if (XEiJ.EFA_SEPARATE_AR) { 16640: XEiJ.mpuCycleCount += 26; 16641: return XEiJ.regRn[ 8] -= 12; 16642: } 16643: //fallthrough 16644: case 0b100_001: //-(A1) 16645: if (XEiJ.EFA_SEPARATE_AR) { 16646: XEiJ.mpuCycleCount += 26; 16647: return XEiJ.regRn[ 9] -= 12; 16648: } 16649: //fallthrough 16650: case 0b100_010: //-(A2) 16651: if (XEiJ.EFA_SEPARATE_AR) { 16652: XEiJ.mpuCycleCount += 26; 16653: return XEiJ.regRn[10] -= 12; 16654: } 16655: //fallthrough 16656: case 0b100_011: //-(A3) 16657: if (XEiJ.EFA_SEPARATE_AR) { 16658: XEiJ.mpuCycleCount += 26; 16659: return XEiJ.regRn[11] -= 12; 16660: } 16661: //fallthrough 16662: case 0b100_100: //-(A4) 16663: if (XEiJ.EFA_SEPARATE_AR) { 16664: XEiJ.mpuCycleCount += 26; 16665: return XEiJ.regRn[12] -= 12; 16666: } 16667: //fallthrough 16668: case 0b100_101: //-(A5) 16669: if (XEiJ.EFA_SEPARATE_AR) { 16670: XEiJ.mpuCycleCount += 26; 16671: return XEiJ.regRn[13] -= 12; 16672: } 16673: //fallthrough 16674: case 0b100_110: //-(A6) 16675: if (XEiJ.EFA_SEPARATE_AR) { 16676: XEiJ.mpuCycleCount += 26; 16677: return XEiJ.regRn[14] -= 12; 16678: } 16679: //fallthrough 16680: case 0b100_111: //-(A7) 16681: if (XEiJ.EFA_SEPARATE_AR) { 16682: XEiJ.mpuCycleCount += 26; 16683: return XEiJ.regRn[15] -= 12; 16684: } else { 16685: XEiJ.mpuCycleCount += 26; 16686: return XEiJ.regRn[ea - (0b100_000 - 8)] -= 12; 16687: } 16688: case 0b101_000: //(d16,A0) 16689: case 0b101_001: //(d16,A1) 16690: case 0b101_010: //(d16,A2) 16691: case 0b101_011: //(d16,A3) 16692: case 0b101_100: //(d16,A4) 16693: case 0b101_101: //(d16,A5) 16694: case 0b101_110: //(d16,A6) 16695: case 0b101_111: //(d16,A7) 16696: XEiJ.mpuCycleCount += 28; 16697: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 16698: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 16699: + XEiJ.busRwse ((XEiJ.regPC += 2) - 2)); //pcws。ワードディスプレースメント 16700: } else { 16701: t = XEiJ.regPC; 16702: XEiJ.regPC = t + 2; 16703: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 16704: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 16705: } 16706: case 0b110_000: //(d8,A0,Rn.wl) 16707: case 0b110_001: //(d8,A1,Rn.wl) 16708: case 0b110_010: //(d8,A2,Rn.wl) 16709: case 0b110_011: //(d8,A3,Rn.wl) 16710: case 0b110_100: //(d8,A4,Rn.wl) 16711: case 0b110_101: //(d8,A5,Rn.wl) 16712: case 0b110_110: //(d8,A6,Rn.wl) 16713: case 0b110_111: //(d8,A7,Rn.wl) 16714: XEiJ.mpuCycleCount += 30; 16715: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 16716: w = XEiJ.busRwze ((XEiJ.regPC += 2) - 2); //pcwz。拡張ワード 16717: } else { 16718: w = XEiJ.regPC; 16719: XEiJ.regPC = w + 2; 16720: w = XEiJ.busRwze (w); //pcwz。拡張ワード 16721: } 16722: return (XEiJ.regRn[ea - (0b110_000 - 8)] //ベースレジスタ 16723: + (byte) w //バイトディスプレースメント 16724: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 16725: XEiJ.regRn[w >> 12])); //ロングインデックス 16726: case 0b111_000: //(xxx).W 16727: XEiJ.mpuCycleCount += 28; 16728: return XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 16729: case 0b111_001: //(xxx).L 16730: XEiJ.mpuCycleCount += 32; 16731: return XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 16732: case 0b111_010: //(d16,PC) 16733: XEiJ.mpuCycleCount += 28; 16734: t = XEiJ.regPC; 16735: XEiJ.regPC = t + 2; 16736: return (t //ベースレジスタ 16737: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 16738: case 0b111_011: //(d8,PC,Rn.wl) 16739: XEiJ.mpuCycleCount += 30; 16740: t = XEiJ.regPC; 16741: XEiJ.regPC = t + 2; 16742: w = XEiJ.busRwze (t); //pcwz。拡張ワード 16743: return (t //ベースレジスタ 16744: + (byte) w //バイトディスプレースメント 16745: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 16746: XEiJ.regRn[w >> 12])); //ロングインデックス 16747: case 0b111_100: //#<data> 16748: XEiJ.mpuCycleCount += 24; 16749: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 16750: return (XEiJ.regPC += 12) - 12; 16751: } else { 16752: t = XEiJ.regPC; 16753: XEiJ.regPC = t + 12; 16754: return t; 16755: } 16756: } //switch 16757: XEiJ.mpuCycleCount += 34; 16758: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 16759: throw M68kException.m6eSignal; 16760: } //efaAnyExtd 16761: 16762: //a = efaMltExtd (ea) //| M+-WXZ | 16763: // メモリ可変モードのエクステンデッドオペランドの実効アドレスを求める 16764: // efaMltQuadとの違いは(Ar)+と-(Ar)がArを12変化させることと、#<data>がPCを12変化させることと、 16765: // オペランドのアクセスが2ワード増える分の8サイクルが追加されていること 16766: @SuppressWarnings ("fallthrough") public static int efaMltExtd (int ea) throws M68kException { 16767: int t, w; 16768: switch (ea) { 16769: case 0b010_000: //(A0) 16770: if (XEiJ.EFA_SEPARATE_AR) { 16771: XEiJ.mpuCycleCount += 24; 16772: return XEiJ.regRn[ 8]; 16773: } 16774: //fallthrough 16775: case 0b010_001: //(A1) 16776: if (XEiJ.EFA_SEPARATE_AR) { 16777: XEiJ.mpuCycleCount += 24; 16778: return XEiJ.regRn[ 9]; 16779: } 16780: //fallthrough 16781: case 0b010_010: //(A2) 16782: if (XEiJ.EFA_SEPARATE_AR) { 16783: XEiJ.mpuCycleCount += 24; 16784: return XEiJ.regRn[10]; 16785: } 16786: //fallthrough 16787: case 0b010_011: //(A3) 16788: if (XEiJ.EFA_SEPARATE_AR) { 16789: XEiJ.mpuCycleCount += 24; 16790: return XEiJ.regRn[11]; 16791: } 16792: //fallthrough 16793: case 0b010_100: //(A4) 16794: if (XEiJ.EFA_SEPARATE_AR) { 16795: XEiJ.mpuCycleCount += 24; 16796: return XEiJ.regRn[12]; 16797: } 16798: //fallthrough 16799: case 0b010_101: //(A5) 16800: if (XEiJ.EFA_SEPARATE_AR) { 16801: XEiJ.mpuCycleCount += 24; 16802: return XEiJ.regRn[13]; 16803: } 16804: //fallthrough 16805: case 0b010_110: //(A6) 16806: if (XEiJ.EFA_SEPARATE_AR) { 16807: XEiJ.mpuCycleCount += 24; 16808: return XEiJ.regRn[14]; 16809: } 16810: //fallthrough 16811: case 0b010_111: //(A7) 16812: if (XEiJ.EFA_SEPARATE_AR) { 16813: XEiJ.mpuCycleCount += 24; 16814: return XEiJ.regRn[15]; 16815: } else { 16816: XEiJ.mpuCycleCount += 24; 16817: return XEiJ.regRn[ea - (0b010_000 - 8)]; 16818: } 16819: case 0b011_000: //(A0)+ 16820: if (XEiJ.EFA_SEPARATE_AR) { 16821: XEiJ.mpuCycleCount += 24; 16822: return (XEiJ.regRn[ 8] += 12) - 12; 16823: } 16824: //fallthrough 16825: case 0b011_001: //(A1)+ 16826: if (XEiJ.EFA_SEPARATE_AR) { 16827: XEiJ.mpuCycleCount += 24; 16828: return (XEiJ.regRn[ 9] += 12) - 12; 16829: } 16830: //fallthrough 16831: case 0b011_010: //(A2)+ 16832: if (XEiJ.EFA_SEPARATE_AR) { 16833: XEiJ.mpuCycleCount += 24; 16834: return (XEiJ.regRn[10] += 12) - 12; 16835: } 16836: //fallthrough 16837: case 0b011_011: //(A3)+ 16838: if (XEiJ.EFA_SEPARATE_AR) { 16839: XEiJ.mpuCycleCount += 24; 16840: return (XEiJ.regRn[11] += 12) - 12; 16841: } 16842: //fallthrough 16843: case 0b011_100: //(A4)+ 16844: if (XEiJ.EFA_SEPARATE_AR) { 16845: XEiJ.mpuCycleCount += 24; 16846: return (XEiJ.regRn[12] += 12) - 12; 16847: } 16848: //fallthrough 16849: case 0b011_101: //(A5)+ 16850: if (XEiJ.EFA_SEPARATE_AR) { 16851: XEiJ.mpuCycleCount += 24; 16852: return (XEiJ.regRn[13] += 12) - 12; 16853: } 16854: //fallthrough 16855: case 0b011_110: //(A6)+ 16856: if (XEiJ.EFA_SEPARATE_AR) { 16857: XEiJ.mpuCycleCount += 24; 16858: return (XEiJ.regRn[14] += 12) - 12; 16859: } 16860: //fallthrough 16861: case 0b011_111: //(A7)+ 16862: if (XEiJ.EFA_SEPARATE_AR) { 16863: XEiJ.mpuCycleCount += 24; 16864: return (XEiJ.regRn[15] += 12) - 12; 16865: } else { 16866: XEiJ.mpuCycleCount += 24; 16867: return (XEiJ.regRn[ea - (0b011_000 - 8)] += 12) - 12; 16868: } 16869: case 0b100_000: //-(A0) 16870: case 0b100_001: //-(A1) 16871: case 0b100_010: //-(A2) 16872: case 0b100_011: //-(A3) 16873: case 0b100_100: //-(A4) 16874: case 0b100_101: //-(A5) 16875: case 0b100_110: //-(A6) 16876: case 0b100_111: //-(A7) 16877: XEiJ.mpuCycleCount += 26; 16878: return XEiJ.regRn[ea - (0b100_000 - 8)] -= 12; 16879: case 0b101_000: //(d16,A0) 16880: case 0b101_001: //(d16,A1) 16881: case 0b101_010: //(d16,A2) 16882: case 0b101_011: //(d16,A3) 16883: case 0b101_100: //(d16,A4) 16884: case 0b101_101: //(d16,A5) 16885: case 0b101_110: //(d16,A6) 16886: case 0b101_111: //(d16,A7) 16887: XEiJ.mpuCycleCount += 28; 16888: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 16889: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 16890: + XEiJ.busRwse ((XEiJ.regPC += 2) - 2)); //pcws。ワードディスプレースメント 16891: } else { 16892: t = XEiJ.regPC; 16893: XEiJ.regPC = t + 2; 16894: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 16895: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 16896: } 16897: case 0b110_000: //(d8,A0,Rn.wl) 16898: case 0b110_001: //(d8,A1,Rn.wl) 16899: case 0b110_010: //(d8,A2,Rn.wl) 16900: case 0b110_011: //(d8,A3,Rn.wl) 16901: case 0b110_100: //(d8,A4,Rn.wl) 16902: case 0b110_101: //(d8,A5,Rn.wl) 16903: case 0b110_110: //(d8,A6,Rn.wl) 16904: case 0b110_111: //(d8,A7,Rn.wl) 16905: XEiJ.mpuCycleCount += 30; 16906: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 16907: w = XEiJ.busRwze ((XEiJ.regPC += 2) - 2); //pcwz。拡張ワード 16908: } else { 16909: w = XEiJ.regPC; 16910: XEiJ.regPC = w + 2; 16911: w = XEiJ.busRwze (w); //pcwz。拡張ワード 16912: } 16913: return (XEiJ.regRn[ea - (0b110_000 - 8)] //ベースレジスタ 16914: + (byte) w //バイトディスプレースメント 16915: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 16916: XEiJ.regRn[w >> 12])); //ロングインデックス 16917: case 0b111_000: //(xxx).W 16918: XEiJ.mpuCycleCount += 28; 16919: return XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 16920: case 0b111_001: //(xxx).L 16921: XEiJ.mpuCycleCount += 32; 16922: return XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 16923: } //switch 16924: XEiJ.mpuCycleCount += 34; 16925: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 16926: throw M68kException.m6eSignal; 16927: } //efaMltExtd 16928: 16929: //a = efaLeaPea (ea) //| M WXZP | 16930: // LEA命令とPEA命令のオペランドの実効アドレスを求める 16931: // efaCntWordとの違いはサイクル数のみ 16932: // LEA命令のベースサイクル数4を含んでいるのでLEA命令ではベースサイクル数を加えなくてよい 16933: // PEA命令のベースサイクル数は12-4=8 16934: @SuppressWarnings ("fallthrough") public static int efaLeaPea (int ea) throws M68kException { 16935: int t, w; 16936: switch (ea) { 16937: case 0b010_000: //(A0) 16938: if (XEiJ.EFA_SEPARATE_AR) { 16939: XEiJ.mpuCycleCount += 4; 16940: return XEiJ.regRn[ 8]; 16941: } 16942: //fallthrough 16943: case 0b010_001: //(A1) 16944: if (XEiJ.EFA_SEPARATE_AR) { 16945: XEiJ.mpuCycleCount += 4; 16946: return XEiJ.regRn[ 9]; 16947: } 16948: //fallthrough 16949: case 0b010_010: //(A2) 16950: if (XEiJ.EFA_SEPARATE_AR) { 16951: XEiJ.mpuCycleCount += 4; 16952: return XEiJ.regRn[10]; 16953: } 16954: //fallthrough 16955: case 0b010_011: //(A3) 16956: if (XEiJ.EFA_SEPARATE_AR) { 16957: XEiJ.mpuCycleCount += 4; 16958: return XEiJ.regRn[11]; 16959: } 16960: //fallthrough 16961: case 0b010_100: //(A4) 16962: if (XEiJ.EFA_SEPARATE_AR) { 16963: XEiJ.mpuCycleCount += 4; 16964: return XEiJ.regRn[12]; 16965: } 16966: //fallthrough 16967: case 0b010_101: //(A5) 16968: if (XEiJ.EFA_SEPARATE_AR) { 16969: XEiJ.mpuCycleCount += 4; 16970: return XEiJ.regRn[13]; 16971: } 16972: //fallthrough 16973: case 0b010_110: //(A6) 16974: if (XEiJ.EFA_SEPARATE_AR) { 16975: XEiJ.mpuCycleCount += 4; 16976: return XEiJ.regRn[14]; 16977: } 16978: //fallthrough 16979: case 0b010_111: //(A7) 16980: if (XEiJ.EFA_SEPARATE_AR) { 16981: XEiJ.mpuCycleCount += 4; 16982: return XEiJ.regRn[15]; 16983: } else { 16984: XEiJ.mpuCycleCount += 4; 16985: return XEiJ.regRn[ea - (0b010_000 - 8)]; 16986: } 16987: case 0b101_000: //(d16,A0) 16988: case 0b101_001: //(d16,A1) 16989: case 0b101_010: //(d16,A2) 16990: case 0b101_011: //(d16,A3) 16991: case 0b101_100: //(d16,A4) 16992: case 0b101_101: //(d16,A5) 16993: case 0b101_110: //(d16,A6) 16994: case 0b101_111: //(d16,A7) 16995: XEiJ.mpuCycleCount += 8; 16996: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 16997: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 16998: + XEiJ.busRwse ((XEiJ.regPC += 2) - 2)); //pcws。ワードディスプレースメント 16999: } else { 17000: t = XEiJ.regPC; 17001: XEiJ.regPC = t + 2; 17002: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 17003: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 17004: } 17005: case 0b110_000: //(d8,A0,Rn.wl) 17006: case 0b110_001: //(d8,A1,Rn.wl) 17007: case 0b110_010: //(d8,A2,Rn.wl) 17008: case 0b110_011: //(d8,A3,Rn.wl) 17009: case 0b110_100: //(d8,A4,Rn.wl) 17010: case 0b110_101: //(d8,A5,Rn.wl) 17011: case 0b110_110: //(d8,A6,Rn.wl) 17012: case 0b110_111: //(d8,A7,Rn.wl) 17013: XEiJ.mpuCycleCount += 12; 17014: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 17015: w = XEiJ.busRwze ((XEiJ.regPC += 2) - 2); //pcwz。拡張ワード 17016: } else { 17017: w = XEiJ.regPC; 17018: XEiJ.regPC = w + 2; 17019: w = XEiJ.busRwze (w); //pcwz。拡張ワード 17020: } 17021: return (XEiJ.regRn[ea - (0b110_000 - 8)] //ベースレジスタ 17022: + (byte) w //バイトディスプレースメント 17023: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 17024: XEiJ.regRn[w >> 12])); //ロングインデックス 17025: case 0b111_000: //(xxx).W 17026: XEiJ.mpuCycleCount += 8; 17027: return XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 17028: case 0b111_001: //(xxx).L 17029: XEiJ.mpuCycleCount += 12; 17030: return XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 17031: case 0b111_010: //(d16,PC) 17032: XEiJ.mpuCycleCount += 8; 17033: t = XEiJ.regPC; 17034: XEiJ.regPC = t + 2; 17035: return (t //ベースレジスタ 17036: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 17037: case 0b111_011: //(d8,PC,Rn.wl) 17038: XEiJ.mpuCycleCount += 12; 17039: t = XEiJ.regPC; 17040: XEiJ.regPC = t + 2; 17041: w = XEiJ.busRwze (t); //pcwz。拡張ワード 17042: return (t //ベースレジスタ 17043: + (byte) w //バイトディスプレースメント 17044: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 17045: XEiJ.regRn[w >> 12])); //ロングインデックス 17046: } //switch 17047: XEiJ.mpuCycleCount += 34; 17048: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 17049: throw M68kException.m6eSignal; 17050: } //efaLeaPea 17051: 17052: //a = efaJmpJsr (ea) //| M WXZP | 17053: // JMP命令とJSR命令のオペランドの実効アドレスを求める 17054: // efaCntWordとの違いはサイクル数のみ 17055: // JMP命令のベースサイクル数8を含んでいるのでJMP命令ではベースサイクル数を加えなくてよい 17056: // JSR命令のベースサイクル数は16-8=8 17057: @SuppressWarnings ("fallthrough") public static int efaJmpJsr (int ea) throws M68kException { 17058: int t, w; 17059: switch (ea) { 17060: case 0b010_000: //(A0) 17061: if (XEiJ.EFA_SEPARATE_AR) { 17062: XEiJ.mpuCycleCount += 8; 17063: return XEiJ.regRn[ 8]; 17064: } 17065: //fallthrough 17066: case 0b010_001: //(A1) 17067: if (XEiJ.EFA_SEPARATE_AR) { 17068: XEiJ.mpuCycleCount += 8; 17069: return XEiJ.regRn[ 9]; 17070: } 17071: //fallthrough 17072: case 0b010_010: //(A2) 17073: if (XEiJ.EFA_SEPARATE_AR) { 17074: XEiJ.mpuCycleCount += 8; 17075: return XEiJ.regRn[10]; 17076: } 17077: //fallthrough 17078: case 0b010_011: //(A3) 17079: if (XEiJ.EFA_SEPARATE_AR) { 17080: XEiJ.mpuCycleCount += 8; 17081: return XEiJ.regRn[11]; 17082: } 17083: //fallthrough 17084: case 0b010_100: //(A4) 17085: if (XEiJ.EFA_SEPARATE_AR) { 17086: XEiJ.mpuCycleCount += 8; 17087: return XEiJ.regRn[12]; 17088: } 17089: //fallthrough 17090: case 0b010_101: //(A5) 17091: if (XEiJ.EFA_SEPARATE_AR) { 17092: XEiJ.mpuCycleCount += 8; 17093: return XEiJ.regRn[13]; 17094: } 17095: //fallthrough 17096: case 0b010_110: //(A6) 17097: if (XEiJ.EFA_SEPARATE_AR) { 17098: XEiJ.mpuCycleCount += 8; 17099: return XEiJ.regRn[14]; 17100: } 17101: //fallthrough 17102: case 0b010_111: //(A7) 17103: if (XEiJ.EFA_SEPARATE_AR) { 17104: XEiJ.mpuCycleCount += 8; 17105: return XEiJ.regRn[15]; 17106: } else { 17107: XEiJ.mpuCycleCount += 8; 17108: return XEiJ.regRn[ea - (0b010_000 - 8)]; 17109: } 17110: case 0b101_000: //(d16,A0) 17111: case 0b101_001: //(d16,A1) 17112: case 0b101_010: //(d16,A2) 17113: case 0b101_011: //(d16,A3) 17114: case 0b101_100: //(d16,A4) 17115: case 0b101_101: //(d16,A5) 17116: case 0b101_110: //(d16,A6) 17117: case 0b101_111: //(d16,A7) 17118: XEiJ.mpuCycleCount += 10; 17119: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 17120: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 17121: + XEiJ.busRwse ((XEiJ.regPC += 2) - 2)); //pcws。ワードディスプレースメント 17122: } else { 17123: t = XEiJ.regPC; 17124: XEiJ.regPC = t + 2; 17125: return (XEiJ.regRn[ea - (0b101_000 - 8)] //ベースレジスタ 17126: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 17127: } 17128: case 0b110_000: //(d8,A0,Rn.wl) 17129: case 0b110_001: //(d8,A1,Rn.wl) 17130: case 0b110_010: //(d8,A2,Rn.wl) 17131: case 0b110_011: //(d8,A3,Rn.wl) 17132: case 0b110_100: //(d8,A4,Rn.wl) 17133: case 0b110_101: //(d8,A5,Rn.wl) 17134: case 0b110_110: //(d8,A6,Rn.wl) 17135: case 0b110_111: //(d8,A7,Rn.wl) 17136: XEiJ.mpuCycleCount += 14; 17137: if (XEiJ.MPU_COMPOUND_POSTINCREMENT) { 17138: w = XEiJ.busRwze ((XEiJ.regPC += 2) - 2); //pcwz。拡張ワード 17139: } else { 17140: w = XEiJ.regPC; 17141: XEiJ.regPC = w + 2; 17142: w = XEiJ.busRwze (w); //pcwz。拡張ワード 17143: } 17144: return (XEiJ.regRn[ea - (0b110_000 - 8)] //ベースレジスタ 17145: + (byte) w //バイトディスプレースメント 17146: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 17147: XEiJ.regRn[w >> 12])); //ロングインデックス 17148: case 0b111_000: //(xxx).W 17149: XEiJ.mpuCycleCount += 10; 17150: return XEiJ.busRwse ((XEiJ.regPC += 2) - 2); //pcws 17151: case 0b111_001: //(xxx).L 17152: XEiJ.mpuCycleCount += 12; 17153: return XEiJ.busRlse ((XEiJ.regPC += 4) - 4); //pcls 17154: case 0b111_010: //(d16,PC) 17155: XEiJ.mpuCycleCount += 10; 17156: t = XEiJ.regPC; 17157: XEiJ.regPC = t + 2; 17158: return (t //ベースレジスタ 17159: + XEiJ.busRwse (t)); //pcws。ワードディスプレースメント 17160: case 0b111_011: //(d8,PC,Rn.wl) 17161: XEiJ.mpuCycleCount += 14; 17162: t = XEiJ.regPC; 17163: XEiJ.regPC = t + 2; 17164: w = XEiJ.busRwze (t); //pcwz。拡張ワード 17165: return (t //ベースレジスタ 17166: + (byte) w //バイトディスプレースメント 17167: + (w << 31 - 11 >= 0 ? (short) XEiJ.regRn[w >> 12] : //ワードインデックス 17168: XEiJ.regRn[w >> 12])); //ロングインデックス 17169: } //switch 17170: XEiJ.mpuCycleCount += 34; 17171: M68kException.m6eNumber = M68kException.M6E_ILLEGAL_INSTRUCTION; 17172: throw M68kException.m6eSignal; 17173: } //efaJmpJsr 17174: 17175: 17176: 17177: } //class MC68000 17178: 17179: 17180: