|
|
1.1 ! root 1: // ! 2: // nono ! 3: // Copyright (C) 2020 nono project ! 4: // Licensed under nono-license.txt ! 5: // ! 6: ! 7: #pragma once ! 8: ! 9: #include "disasm.h" ! 10: #include "m680x0.h" ! 11: ! 12: // 逆アセンブル ! 13: class m680x0disasm final : public DisasmLine ! 14: { ! 15: using inherited = DisasmLine; ! 16: public: ! 17: m680x0disasm(); ! 18: ~m680x0disasm() override; ! 19: ! 20: // 逆アセンブルを実行 ! 21: bool Exec(DebuggerMemoryStream *mem_) override; ! 22: ! 23: // IOCS コール名を返す。なければ NULL を返す。(分岐履歴から呼ばれる) ! 24: static const char *GetIOCSName(int n) { return x68k_iocscall[n]; } ! 25: ! 26: // FPgen の命令名を返す。なければ "" を返す。(FPU モニタからも呼ばれる) ! 27: static const char *make_fpgen(uint); ! 28: ! 29: private: ! 30: uint32 pc0 {}; // 命令先頭アドレス ! 31: ! 32: enum Reg { ! 33: CCR, ! 34: SR, ! 35: PC, ! 36: USP, ! 37: ! 38: MSP, ! 39: ISP, ! 40: VBR, ! 41: SFC, ! 42: DFC, ! 43: CACR, ! 44: CAAR, ! 45: ! 46: TC, ! 47: MMUSR, ! 48: SRP, ! 49: CRP, ! 50: TT0, ! 51: TT1, ! 52: ! 53: FPCR, ! 54: FPSR, ! 55: FPIAR, ! 56: ! 57: URP, ! 58: ITT0, ! 59: ITT1, ! 60: DTT0, ! 61: DTT1, ! 62: ! 63: MaxReg, ! 64: }; ! 65: ! 66: // L/S/X/P/W/D/B/(Pk) は FMOVE <ea>,FPn の時の並び順。 ! 67: enum Size { ! 68: L = 0, // Long ! 69: S, // Single ! 70: X, // eXtended ! 71: P, // Packed ! 72: W, // Word ! 73: D, // Double ! 74: B, // Byte ! 75: Pk, // Packed with dynamic k-factor ! 76: Q, // Quad ! 77: None, ! 78: }; ! 79: ! 80: uint32 fetch2(); ! 81: uint32 peek2(); // PC を進めずワードを取得 (IOCSコール用) ! 82: uint32 fetch4(); ! 83: ! 84: std::string make_reg(Reg); ! 85: ! 86: std::string hex8(uint32); ! 87: std::string hex16(uint32); ! 88: std::string hex32(uint32); ! 89: std::string shex8(uint32); ! 90: std::string shex16(uint32); ! 91: std::string shex32(uint32); ! 92: std::string make_ea(); ! 93: std::string make_ea(uint); ! 94: std::string make_eaix(std::string basereg); ! 95: ! 96: std::string addr2(uint32 addr); // addr をワードアドレスとして ! 97: std::string addr4(uint32 addr); // addr をロングワードアドレスとして ! 98: std::string addr2(); // フェッチした値をワードアドレスとして ! 99: std::string addr4(); // フェッチした値をロングワードアドレスとして ! 100: std::string disp2(); // フェッチしたワードディスプレースメント ! 101: std::string disp4(); // フェッチしたロングワードディスプレースメント ! 102: std::string imm1(); ! 103: std::string imm2(); ! 104: std::string imm4(); ! 105: std::string make_dn(uint); ! 106: std::string make_an(uint); ! 107: std::string make_rn(uint); ! 108: std::string make_anin(uint); ! 109: std::string make_anpd(uint); ! 110: std::string make_anpi(uint); ! 111: std::string make_q8(); ! 112: std::string make_reglist(); ! 113: void make_reglist_half(std::string& s, const char *reg, uint16 mask); ! 114: std::string make_bf(); ! 115: std::string make_fc(); ! 116: std::string make_movec(); ! 117: std::string make_fpn(uint n); ! 118: std::string make_fpcc(uint16 ir); ! 119: uint make_fpctls(std::string& s); ! 120: std::string make_fpnlist(); ! 121: ! 122: static const char * const reg_names[]; ! 123: static const char * const size_str[]; ! 124: static const char * const conditions[]; ! 125: static const char * const fpconditions[]; ! 126: static const char * const btst_names[]; ! 127: static const char * const fpgen_names[0x3b]; ! 128: static const char * const fmovecr_text[]; ! 129: static const char * const x68k_doscall[256]; ! 130: static const char * const x68k_fpcall[256]; ! 131: static const char * const x68k_iocscall[256]; ! 132: void ops_cmp2chk2(Size sz); ! 133: void ops_btst_movep(); ! 134: void ops_cas(Size sz); ! 135: void ops_cas2(Size sz); ! 136: void ops_moves(Size sz); ! 137: void ops_movep(); ! 138: void ops_btst_imm_ea(); ! 139: void ops_move(Size sz); ! 140: void ops_movem_ext(Size sz); ! 141: void ops_bcc(); ! 142: void ops_sub(Size sz); ! 143: void ops_add(Size sz); ! 144: void ops_eor_cmpm(Size sz); ! 145: void ops_rotate(std::string dir, Size sz); ! 146: void ops_pmove(Reg reg, Size sz); ! 147: void ops_fpgen_fpn_fpn(); ! 148: void ops_fpgen_ea_fpn(); ! 149: void ops_fmovecr(); ! 150: void ops_fmove_fpn_ea(); ! 151: void ops_fmovem_ea_ctl(); ! 152: void ops_fmovem_ctl_ea(); ! 153: void ops_fmovem_ea_fpn(); ! 154: void ops_fmovem_fpn_ea(); ! 155: ! 156: std::vector<uint16> ir {}; ! 157: ! 158: std::string name {}; ! 159: Size size {}; ! 160: std::string src {}; ! 161: std::string dst {}; ! 162: ! 163: #define OP_PROTO(name) void __CONCAT(op_,name)() ! 164: #include "m680x0ops.h" ! 165: #undef OP_PROTO ! 166: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.