--- nono/m88xx0/m88100subr.cpp 2026/04/29 17:04:31 1.1.1.1 +++ nono/m88xx0/m88100subr.cpp 2026/04/29 17:05:07 1.1.1.10 @@ -1,14 +1,43 @@ // // nono -// Copyright (C) 2020 isaki@NetBSD.org +// Copyright (C) 2020 nono project +// Licensed under nono-license.txt // -#include "header.h" #include "m88100.h" // コンストラクタ -m88kcpu::m88kcpu() +m88kcpu::m88kcpu(MPU88xx0Device *dev_) { + dev = dev_; + + cmmu[0].Ctor(this); + cmmu[1].Ctor(this); + + // レジスタのうち不定と明記されてるものは、未初期化のまま触ったことが + // 分かりやすいような適当なパターンで埋めておく。ただし最上位も c に + // すると BT454 のレジスタ付近を指してしまうので、それは避けておく。 + // XXX Super Reset が出来たらそっちに移動? + const uint32 Undefined = 0x0ccccccc; + for (int i = 1; i < 32; i++) { + r[i] = Undefined; + } + for (int i = 0; i < countof(fcr); i++) { + fcr[i] = Undefined & fcr_mask[i]; + } + + epsr = Undefined; + ssbr = Undefined; + sfip = Undefined; + snip = Undefined; + sxip = Undefined; + // DMTx は bit0(Valid) をクリア。DMAx/DMDx は不定。 + dma0 = Undefined; + dma1 = Undefined; + dma2 = Undefined; + dmd0 = Undefined; + dmd1 = Undefined; + dmd2 = Undefined; } // デストラクタ @@ -16,20 +45,56 @@ m88kcpu::~m88kcpu() { } -/*static*/ const char * const m88100reg::sipname[3] = { - "sxip", "snip", "sfip", -}; - -// -// m88200 -// - -// コンストラクタ -m88200::m88200() +// DOS call エミュレーションのコールバックを設定 +void +m88kcpu::SetFLineCallback(bool (*callback)(m88kcpu *, void *), void *arg) { + fline_callback = callback; + fline_arg = arg; } -// デストラクタ -m88200::~m88200() +// PID の VERSION フィールドをセットする。初期化時に呼ぶ。 +void +m88kcpu::SetVersion(uint32 version) { + pid &= ~PID_VER_MASK; + pid |= version << 1; } + +// fcr のマスク +/*static*/ const uint32 m88100reg::fcr_mask[11] = { + FPECR_MASK, + 0xffffffff, // fphs1 + 0xffffffff, // fpls1 + 0xffffffff, // fphs2 + 0xffffffff, // fpls2 + FPPT_MASK, + FPRH_MASK, + 0xffffffff, // fprl + FPIT_MASK, + FPSR_MASK, + FPCR_MASK, +}; + +/*static*/ const char * const m88100reg::sipname[3] = { + "sxip", "snip", "sfip", +}; + +/*static*/ const char * const m88100reg::dmt_en_str[16] = { + "----", + "---B", + "--B-", + "--HH", + "-B--", + "-1-1", // not used normally + "-11-", // not used normally + "-111", // not used normally + "B---", + "1--1", // not used normally + "1-1-", // not used normally + "1-11", // not used normally + "HH--", + "11-1", // not used normally + "111-", // not used normally + "LLLL", +};