|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
5: //
6:
1.1.1.4 root 7: //
8: // OPM (YM2151)
9: //
10:
1.1 root 11: #pragma once
12:
13: #include "device.h"
1.1.1.5 root 14: #include "event.h"
1.1 root 15:
1.1.1.6 root 16: class ADPCMDevice;
17: class FDCDevice;
18:
1.1.1.3 root 19: class OPMDevice : public IODevice
1.1 root 20: {
21: using inherited = IODevice;
1.1.1.4 root 22:
1.1.1.8 root 23: static const uint32 baseaddr = 0xe90000;
1.1.1.5 root 24: static const uint64 clk = 250_nsec; // 4MHz
1.1 root 25:
26: public:
27: OPMDevice();
1.1.1.7 root 28: ~OPMDevice() override;
1.1 root 29:
1.1.1.6 root 30: bool Init() override;
1.1.1.5 root 31: void ResetHard(bool poweron) override;
32:
1.1 root 33: protected:
34: // BusIO インタフェース
35: static const uint32 NPORT = 2;
1.1.1.8 root 36: busdata ReadPort(uint32 offset);
37: busdata WritePort(uint32 offset, uint32 data);
38: busdata PeekPort(uint32 offset);
39: bool PokePort(uint32 offset, uint32 data);
1.1.1.4 root 40:
41: private:
1.1.1.5 root 42: bool IsBusy() const;
43:
1.1.1.4 root 44: int reg {}; // アクセスレジスタ番号
1.1.1.5 root 45:
1.1.1.9 ! root 46: uint64 busy_origin {}; // BUSY の起点時刻
! 47: uint64 busy_start {}; // BUSY のアサート開始時刻
! 48: uint64 busy_end {}; // BUSY のアサート終了時刻
1.1 root 49:
1.1.1.6 root 50: ADPCMDevice *adpcm {};
51: FDCDevice *fdc {};
52: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.