--- nono/vm/vm_x68k.cpp 2026/04/29 17:04:42 1.1.1.3 +++ nono/vm/vm_x68k.cpp 2026/04/29 17:05:10 1.1.1.8 @@ -4,21 +4,33 @@ // Licensed under nono-license.txt // +// +// VM (X68030) +// + #include "vm_x68k.h" #include "bus.h" #include "config.h" +#include "dmac.h" +#include "fdc.h" #include "human68k.h" +#include "interrupt.h" +#include "mainapp.h" +#include "mfp.h" #include "mpu680x0.h" +#include "nmi.h" +#include "pedec.h" +#include "pluto.h" +#include "pio.h" +#include "power.h" #include "renderer.h" #include "rp5c15.h" +#include "romimg_x68k.h" #include "scheduler.h" +#include "spc.h" #include "x68kkbd.h" #include "xiospace.h" -// -// X68030 VM -// - // コンストラクタ VM_X68030::VM_X68030() { @@ -35,22 +47,29 @@ VM_X68030::VM_X68030() gConfig->Delete("luna-dipsw1"); gConfig->Delete("luna-dipsw2"); gConfig->Delete("prom-image"); + gConfig->Delete("rtc-epoch-year"); // デバイス (順序に注意) // BusErrDevice は親コンストラクタで作成済み。 - gScheduler.reset(new Scheduler()); // required by * - gMPU.reset(new MPU680x0Device(0xff0000)); - gRAM.reset(new RAMDevice()); // required by XIOSpace - xiospace.reset(new XIOSpaceDevice()); + NEWDV(MPU, new MPU680x0Device()); + NEWDV(Interrupt, new X68030Interrupt()); + NEWDV(RAM, new RAMDevice()); // required by XIOSpace + NEWDV(XIOSpace, new XIOSpaceDevice()); + NEWDV(IPLROM0, new IPLROM0Device()); + + NEWDV(NMI, new NMIDevice()); + NEWDV(Keyboard, new X68030Keyboard()); + NEWDV(Renderer, new X68030Renderer()); - gKeyboard.reset(new X68030Keyboard()); - gRenderer.reset(new X68030Renderer()); + if (gMainApp.human_mode) { + NEWDV(Human68k, new Human68k()); + } // 割り当て // 今は拡張メモリがないので、今は上位8ビット全領域がミラーになっている。 for (int i = 0; i < countof(::devtable); i++) { - ::devtable[i] = xiospace.get(); + ::devtable[i] = gXIOSpace; } } @@ -72,56 +91,72 @@ VM_X68030::PowerButton() // ボタンの状態を更新して.. power_button = !power_button; - // デバイスに指示 - DevicePowerOn(); + // スケジューラに指示 + gPower->MakePowerOn(); } - -// -// RXZ .r .x .z human68k console emulator -// - -// コンストラクタ -VM_RXZ::VM_RXZ() +// ブートページを切り替える。 +void +VM_X68030::SwitchBootPage(Device *parent, bool isrom) { - // 機種固有パラメータ - // MPU クロックの初期値は機種ごとに異なる。単位は MHz - gConfig->SetDefault("mpu-clock", 25); - // RAM 初期値は MAX にしておく - gConfig->SetDefault("ram-size", 12); - // SPC の入力クロック (5MHz = 200ns) - gConfig->Add("!spc-tCLF", 200); + if (gMainApp.human_mode) { + // Human モードではブートページを RAM に見せる。 + // 今のところ。 + return; + } - // この機種に不要なパラメータはここで削除する - // (機種が決まるより前に全機種の設定の和集合を用意してあるため) - gConfig->Delete("luna-dipsw1"); - gConfig->Delete("luna-dipsw2"); - gConfig->Delete("prom-image"); + // 共通処理 + inherited::SwitchBootPage(parent, isrom); - // デバイス (順序に注意) - // BusErrDevice は親コンストラクタで作成済み。 - - gScheduler.reset(new Scheduler()); // required by * - gMPU.reset(new MPU680x0Device(0)); - gRAM.reset(new RAMDevice()); // required by Human68k - gRTC.reset(new RP5C15Device()); - human68k.reset(new Human68k()); + // X68030 では XIOSpace が担当している + gXIOSpace->SwitchBootPage(isrom); } -// デストラクタ -VM_RXZ::~VM_RXZ() -{ -} +// リセットについて +// +// PWRRESET +// 電源オン ----------+--> VIPS +// (7505) +--> VideoCtlr +// +--> OSCIAN2 +// | +// | +------+ +// +-->| | +// 本体 SWRESET | YUKI | IPLRESET +// リセット ------------->| |-----------> FPU +// スイッチ +------+ +// | +// ▽ +// RESET | +// |<-> MPU (68030) +// +--> PPI +// +--> PEDEC +// +--> SPC +// +--> ADPCM +// +--> FDC +// +--> MFP +// | +// | EXRESET +// +---|>-----------> 外部バス +// ▽ +// SYSRESET | +// |<-> SAKI ---+ +// | | BEC0,BEC1 +// +--> DMAC <--+ +// +--> CYNTHIA +// リセットされない? +// o CACHY +// o YM2151 (FM音源) +// o SCC +// MPU の RESET 命令によるリセット void -VM_RXZ::PowerButton() +VM_X68030::ResetByMPU() { - // RXZ の電源ボタンは電源オンにしか使わない。 - // - // 電源 ボタン - // ON PUSH (何も起きない) - // OFF PUSH 電源オン - - // デバイスに指示 - DevicePowerOn(); + gDMAC->ResetHard(false); + gFDC->ResetHard(false); + gMFP->ResetHard(false); + gPEDEC->ResetHard(false); + gPluto->ResetHard(false); + gPPI->ResetHard(false); + gSPC->ResetHard(false); }