Annotation of nono/vm/xpbus.h, revision 1.1.1.2

1.1       root        1: //
                      2: // nono
                      3: // Copyright (C) 2022 nono project
                      4: // Licensed under nono-license.txt
                      5: //
                      6: 
                      7: //
                      8: // XP プロセッサの物理バス
                      9: //
                     10: 
                     11: #pragma once
                     12: 
1.1.1.2 ! root       13: #include "mainbus.h"
1.1       root       14: #include <array>
                     15: 
                     16: class SubRAM2Device;
                     17: class XPRAMDevice;
                     18: 
                     19: // XP 外部バス
1.1.1.2 ! root       20: class XPbusDevice : public IODevice
1.1       root       21: {
1.1.1.2 ! root       22:        using inherited = IODevice;
1.1       root       23:  public:
                     24:        XPbusDevice();
                     25:        ~XPbusDevice() override;
                     26: 
                     27:        bool Init() override;
                     28:        void ResetHard(bool poweron) override;
                     29: 
1.1.1.2 ! root       30:        busdata Read8(uint32 addr) override;
        !            31:        busdata Read16(uint32 addr) override;
        !            32:        busdata Read32(uint32 addr) override;
        !            33:        busdata Write8(uint32 addr, uint32 data) override;
        !            34:        busdata Write16(uint32 addr, uint32 data) override;
        !            35:        busdata Write32(uint32 addr, uint32 data) override;
        !            36:        busdata Peek8(uint32 addr) override;
        !            37:        bool Poke8(uint32 addr, uint32 data) override;
1.1       root       38: 
                     39:        // RAM Control Register (RMCR) を設定/取得
                     40:        uint32 GetRMCR() const;
                     41:        void SetRMCR(uint32);
                     42:        // 内蔵 RAM の先頭番地を取得 (モニタ用)
                     43:        uint32 GetXPRAMAddr() const { return ram_addr; }
                     44: 
                     45:  private:
                     46:        inline IODevice *SearchDevice(uint32 addr) const;
                     47: 
                     48:        // 3port RAM (非共有部)
                     49:        std::unique_ptr<SubRAM2Device> pSubRAM2 /*{}*/;
                     50:        // XP 内蔵 512 バイト RAM
                     51:        std::unique_ptr<XPRAMDevice> pXPRAM /*{}*/;
                     52: 
                     53:        // XP 内蔵 512 バイト RAM の位置
                     54:        uint32 ram_addr {};
                     55: 
                     56:        IODevice *subram {};    // 共有 SRAM
                     57:        IODevice *nopio {};
                     58: };
                     59: 
                     60: // XP 内蔵 RAM
                     61: class XPRAMDevice : public IODevice
                     62: {
                     63:        using inherited = IODevice;
                     64:  public:
                     65:        XPRAMDevice();
                     66:        ~XPRAMDevice() override;
                     67: 
1.1.1.2 ! root       68:        busdata Read8(uint32 addr) override;
        !            69:        busdata Read16(uint32 addr) override;
        !            70:        busdata Read32(uint32 addr) override;
        !            71:        busdata Write8(uint32 addr, uint32 data) override;
        !            72:        busdata Write16(uint32 addr, uint32 data) override;
        !            73:        busdata Write32(uint32 addr, uint32 data) override;
        !            74:        busdata Peek8(uint32 addr) override;
        !            75:        bool Poke8(uint32 addr, uint32 data) override;
1.1       root       76: 
                     77:  private:
                     78:        std::array<uint8, 512> ram {};
                     79: };
                     80: 
                     81: static inline XPbusDevice *GetXPbusDevice() {
                     82:        return Object::GetObject<XPbusDevice>(OBJ_XPBUS);
                     83: }

unix.superglobalmegacorp.com

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