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