Annotation of nono/m680x0/m680x0disasm.h, revision 1.1.1.2

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

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.