--- nono/m680x0/m68030.h 2026/04/29 17:05:22 1.1.1.13 +++ nono/m680x0/m68030.h 2026/04/29 17:05:26 1.1.1.14 @@ -77,34 +77,34 @@ struct M68K // 例外 // (型は core.cpp の try-catch と揃えること) - static const int EXCEP_RESET = 0; - static const int EXCEP_BUSERR = 2; - static const int EXCEP_ADDRERR = 3; - static const int EXCEP_ILLEGAL = 4; - static const int EXCEP_ZERODIV = 5; - static const int EXCEP_CHK = 6; - static const int EXCEP_TRAPV = 7; - static const int EXCEP_PRIV = 8; - static const int EXCEP_TRACE = 9; - static const int EXCEP_ALINE = 10; - static const int EXCEP_FLINE = 11; - static const int EXCEP_COPRO = 13; - static const int EXCEP_FORMAT = 14; - static const int EXCEP_UNINIT_INTR = 16; - static const int EXCEP_SPURIOUS = 24; - static const int EXCEP_LEVEL_BASE = 24; // オートベクタ演算用 - static const int EXCEP_LEVEL1 = 25; - static const int EXCEP_LEVEL7 = 31; - static const int EXCEP_TRAP0 = 32; - static const int EXCEP_TRAP15 = 47; - static const int EXCEP_FPCP_BRANCH = 48; - static const int EXCEP_FPCP_INEXACT = 49; - static const int EXCEP_FPCP_ZERODIV = 50; - static const int EXCEP_FPCP_UNFL = 51; - static const int EXCEP_FPCP_OPERR = 52; - static const int EXCEP_FPCP_OVFL = 53; - static const int EXCEP_FPCP_SNAN = 54; - static const int EXCEP_MMU_CONFIG = 56; + static const uint EXCEP_RESET = 0; + static const uint EXCEP_BUSERR = 2; + static const uint EXCEP_ADDRERR = 3; + static const uint EXCEP_ILLEGAL = 4; + static const uint EXCEP_ZERODIV = 5; + static const uint EXCEP_CHK = 6; + static const uint EXCEP_TRAPV = 7; + static const uint EXCEP_PRIV = 8; + static const uint EXCEP_TRACE = 9; + static const uint EXCEP_ALINE = 10; + static const uint EXCEP_FLINE = 11; + static const uint EXCEP_COPRO = 13; + static const uint EXCEP_FORMAT = 14; + static const uint EXCEP_UNINIT_INTR = 16; + static const uint EXCEP_SPURIOUS = 24; + static const uint EXCEP_LEVEL_BASE = 24; // オートベクタ演算用 + static const uint EXCEP_LEVEL1 = 25; + static const uint EXCEP_LEVEL7 = 31; + static const uint EXCEP_TRAP0 = 32; + static const uint EXCEP_TRAP15 = 47; + static const uint EXCEP_FPCP_BRANCH = 48; + static const uint EXCEP_FPCP_INEXACT = 49; + static const uint EXCEP_FPCP_ZERODIV = 50; + static const uint EXCEP_FPCP_UNFL = 51; + static const uint EXCEP_FPCP_OPERR = 52; + static const uint EXCEP_FPCP_OVFL = 53; + static const uint EXCEP_FPCP_SNAN = 54; + static const uint EXCEP_MMU_CONFIG = 56; }; struct m68030ccr @@ -123,18 +123,7 @@ struct m68030ccr uint32 X; uint32 V; uint32 N; - union { - uint64 CZ; - struct { -#if BYTE_ORDER == LITTLE_ENDIAN - uint32 Z; - uint32 C; -#else - uint32 C; - uint32 Z; -#endif - } __packed; - }; + DEF_UNION64(, CZ, C, Z); public: // value をフラグにセットする @@ -191,7 +180,7 @@ struct m68030ccr } // cond で示される条件が成立すれば true を返す。 - inline bool Cond(int cond) const { + inline bool Cond(uint cond) const { switch (cond) { case 0: // T return CondT(); @@ -249,13 +238,13 @@ struct m68kreg int intr_mask; // SR の割り込みマスク (0-7) // 現在の SP は常に A[7]。A[7] が示しているときは対応する変数の - // ほうは更新されないため無効。 - // ユーザ状態なら A[7] が USP を示し usp は無効、 - // isp, msp は ISP, MSP を示して有効。 - // スーパバイザ状態で SR_M なら A[7] が MSP を示し msp は無効、 - // isp, usp は ISP, USP を示して有効。 - // スーパバイザ状態で !SR_M なら A[7] が ISP を示し isp は無効、 - // msp, usp は MSP, USP を示して有効。 + // ほうは更新されないため無効 (図中 'x')。 + // + // A[7] usp isp msp + // ---- --- --- --- + // ユーザ USP x ISP MSP + // スーパーバイザ(I) ISP USP x MSP + // スーパーバイザ(M) MSP USP ISP x uint32 usp; uint32 isp; uint32 msp; @@ -319,7 +308,7 @@ struct m68kbus uint32 GetSSW() const { return laddr.GetSSW() | size; } // アクセス方向(R/W)を設定する。 - void SetWrite(bool write_) { laddr.SetWrite(write_); } + void SetWrite(bool write_) { laddr.ChangeWrite(write_); } }; // 仮