Annotation of nono/vm/pedec.h, revision 1.1

1.1     ! root        1: //
        !             2: // nono
        !             3: // Copyright (C) 2020 nono project
        !             4: // Licensed under nono-license.txt
        !             5: //
        !             6: 
        !             7: #pragma once
        !             8: 
        !             9: #include "device.h"
        !            10: #include "interrupt.h"
        !            11: 
        !            12: class PEDECDevice
        !            13:        : public InterruptDevice
        !            14: {
        !            15:        using inherited = InterruptDevice;
        !            16:  private:
        !            17:        static const int baseaddr = 0xe9c000;
        !            18: 
        !            19:  public:
        !            20:        PEDECDevice();
        !            21:        virtual ~PEDECDevice() override;
        !            22: 
        !            23:        void ResetHard() override;
        !            24: 
        !            25:        // InterruptDevice インタフェース
        !            26:        void AssertINT(Device *source) override;
        !            27:        void NegateINT(Device *source) override;
        !            28:        int InterruptAcknowledge(int lv) override;
        !            29: 
        !            30:  protected:
        !            31:        // BusIO インタフェース
        !            32:        static const uint32 NPORT = 8;
        !            33:        uint64 Read(uint32 addr);
        !            34:        uint64 Write(uint32 addr, uint32 data);
        !            35:        uint64 Peek(uint32 addr);
        !            36: 
        !            37:  private:
        !            38:        // 割り込みステータスレジスタの値を取得
        !            39:        uint32 GetStat() const;
        !            40: 
        !            41:        // 割り込み信号線の状態を変える
        !            42:        void ChangeInterrupt();
        !            43: 
        !            44:        // int_asserted が下位デバイスからの割り込み信号線 (%1 でアサート)。
        !            45:        // int_enabled がマスク (%1 なら割り込み許可)。
        !            46:        // よって二者を AND とれば上位に割り込みを上げるかどうかが求まる。
        !            47:        // SPC からの割り込みはここでマスク制御しないので int_enabled には
        !            48:        // IntmapSPC を常に立てておくこと。
        !            49:        // $e9c001 (割り込みステータスレジスタ) のビット順は
        !            50:        // これとは全然違うので注意のこと。
        !            51:        static const uint32 IntmapSPC = 0x10;
        !            52:        static const uint32 IntmapFDC = 0x08;
        !            53:        static const uint32 IntmapFDD = 0x04;
        !            54:        static const uint32 IntmapHDD = 0x02;
        !            55:        static const uint32 IntmapPRT = 0x01;
        !            56: 
        !            57:        uint32 int_asserted {};
        !            58:        uint32 int_enabled {};
        !            59:        uint8 vector {};
        !            60: };
        !            61: 
        !            62: extern std::unique_ptr<PEDECDevice> gPEDEC;

unix.superglobalmegacorp.com

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