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