--- nono/vm/vm_luna.h 2026/04/29 17:04:32 1.1.1.1 +++ nono/vm/vm_luna.h 2026/04/29 17:05:11 1.1.1.9 @@ -1,6 +1,11 @@ // // nono -// Copyright (C) 2020 isaki@NetBSD.org +// Copyright (C) 2020 nono project +// Licensed under nono-license.txt +// + +// +// VM (LUNA) // #pragma once @@ -9,37 +14,66 @@ class VM_LUNA : public VM { - typedef VM inherited; + using inherited = VM; public: VM_LUNA(); - virtual ~VM_LUNA(); + virtual ~VM_LUNA() override; + + bool Init() override; // 電源ボタンを押す。 - virtual void PowerButton(); + void PowerButton() override; - private: - std::unique_ptr crtc2; - std::unique_ptr sysclk; - std::unique_ptr nulldev; + protected: + // ブートページを切り替える。 + void SwitchBootPage(Device *parent, bool isrom) override; + + // デバイスマップから devtable を作成 + void MakeDevtable(const uint8 *maptable); + + // ブートページ切り替え用 (unique_ptr ではない) + IODevice *ram0 {}; + + std::unique_ptr pBT454 {}; + std::unique_ptr pCRTC2 {}; + std::unique_ptr pEthernet {}; + std::unique_ptr pLCD {}; + std::unique_ptr pNopIO {}; + std::unique_ptr pPartialRAM {}; + std::unique_ptr pPlaneVRAM {}; + std::unique_ptr pPROM {}; + std::unique_ptr pPROM0 {}; + std::unique_ptr pPIO0 {}; + std::unique_ptr pPIO1 {}; + std::unique_ptr pRTC {}; + std::unique_ptr pSIO {}; + std::unique_ptr pSPC {}; + std::unique_ptr pSysClk {}; + std::unique_ptr pTAS {}; + std::unique_ptr pZRAM {}; +}; +class VM_LUNA1 final : public VM_LUNA +{ + using inherited = VM_LUNA; + public: + VM_LUNA1(); + ~VM_LUNA1() override; + + private: static const uint8 maptable[256]; }; -class VM_LUNA88K : public VM +class VM_LUNA88K final : public VM_LUNA { - typedef VM inherited; + using inherited = VM_LUNA; public: VM_LUNA88K(); - virtual ~VM_LUNA88K(); - - // 電源ボタンを押す。 - virtual void PowerButton(); + ~VM_LUNA88K() override; private: - std::unique_ptr crtc2; - std::unique_ptr fuserom; - std::unique_ptr sysclk; - std::unique_ptr nulldev; + std::unique_ptr pCMMU {}; + std::unique_ptr pFuseROM {}; static const uint8 maptable[256]; };