Annotation of nono/vm/sram.h, revision 1.1.1.10

1.1       root        1: //
                      2: // nono
1.1.1.3   root        3: // Copyright (C) 2020 nono project
                      4: // Licensed under nono-license.txt
1.1       root        5: //
                      6: 
1.1.1.8   root        7: //
                      8: // SRAM
                      9: //
                     10: 
1.1       root       11: #pragma once
                     12: 
                     13: #include "device.h"
1.1.1.3   root       14: #include "mappedfile.h"
1.1.1.10! root       15: #include <array>
1.1       root       16: 
1.1.1.7   root       17: class SRAMDevice : public IODevice
1.1       root       18: {
1.1.1.3   root       19:        using inherited = IODevice;
1.1.1.8   root       20: 
1.1       root       21:        static const uint32 baseaddr = 0xed0000;
                     22: 
1.1.1.3   root       23:        // Pluto-X によるホストファイル起動アドレス
                     24:        static const uint32 plutoaddr = 0xeac000;
                     25: 
1.1       root       26:  public:
                     27:        SRAMDevice();
1.1.1.5   root       28:        virtual ~SRAMDevice() override;
1.1       root       29: 
1.1.1.3   root       30:        bool Init() override;
1.1.1.8   root       31:        void ResetHard(bool poweron) override;
1.1       root       32: 
1.1.1.3   root       33:        uint64 Read8(uint32 addr) override;
                     34:        uint64 Read16(uint32 addr) override;
                     35:        uint64 Write8(uint32 addr, uint32 data) override;
                     36:        uint64 Write16(uint32 addr, uint32 data) override;
                     37:        uint64 Peek8(uint32 addr) override;
1.1.1.10! root       38:        uint64 Poke8(uint32 addr, uint32 data) override;
1.1       root       39: 
1.1.1.10! root       40:        void WriteEnable(bool value);
        !            41: 
        !            42:        // SRAM の指定の位置の値を副作用なく読み出す
        !            43:        uint32 Get8(uint32 offset) const;
        !            44:        uint32 Get16(uint32 offset) const;
        !            45:        uint32 Get32(uint32 offset) const;
        !            46: 
        !            47:        // SRAM $ed0008.L RAM 容量を返す (ホストファイル起動用)
        !            48:        uint32 GetRAMSize() const { return Get32(0x0008); }
1.1       root       49: 
1.1.1.9   root       50:        // SRAM $ed000c.L ROM 起動アドレスを返す (romemu 用)
1.1.1.10! root       51:        uint32 GetROMAddr() const { return Get32(0x000c); }
        !            52: 
        !            53:        // SRAM の初期値
        !            54:        static std::array<uint8, 0x60> InitialData;
1.1.1.9   root       55: 
1.1       root       56:  private:
1.1.1.9   root       57:        // RAM 容量欄を設定値に同期させる。
                     58:        void SyncRAMSize();
                     59: 
1.1.1.2   root       60:        // アドレスデコーダ
                     61:        uint64 Decoder(uint32 addr) const;
                     62: 
1.1.1.3   root       63:        // ファイル
                     64:        std::string filename {};
                     65:        MappedFile file {};
                     66:        uint8 *mem {};
1.1       root       67: 
1.1.1.4   root       68:        bool writeable {};
1.1       root       69: };
                     70: 
1.1.1.10! root       71: static inline SRAMDevice *GetSRAMDevice() {
        !            72:        return Object::GetObject<SRAMDevice>(OBJ_SRAM);
        !            73: }

unix.superglobalmegacorp.com

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