|
|
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.9 root 7: //
8: // システムポート
9: //
10:
1.1 root 11: #pragma once
12:
13: #include "device.h"
14:
1.1.1.11 root 15: class CGROMDevice;
16: class IPLROM1Device;
17: class Keyboard;
18: class MainRAMDevice;
19: class NMIDevice;
20: class ROMDevice;
21: class SRAMDevice;
1.1.1.12 root 22: class VideoCtlrDevice;
1.1.1.11 root 23:
1.1 root 24: struct SYSPORT
25: {
1.1.1.13 root 26: static const uint CONTRAST = 0; // $E8E001
27: static const uint SCOPE3D = 1; // $E8E003
28: static const uint IMAGEUNIT = 2; // $E8E005
29: static const uint KEY = 3; // $E8E007
30: static const uint WAIT = 4; // $E8E009
31: static const uint MPU = 5; // $E8E00B
32: static const uint SRAMWP = 6; // $E8E00D
33: static const uint POWEROFF = 7; // $E8E00F
1.1 root 34:
1.1.1.12 root 35: int rom_wait; // システムポートへの書き込み値ではなく ROM への指示値。
36: int ram_wait; // システムポートへの書き込み値ではなく RAM への指示値。
1.1.1.7 root 37: bool key_ctrl;
1.1.1.10 root 38: uint pwoff_count;
1.1 root 39: };
40:
1.1.1.8 root 41: class SysportDevice : public IODevice
1.1 root 42: {
1.1.1.3 root 43: using inherited = IODevice;
1.1.1.9 root 44:
1.1 root 45: static const uint32 baseaddr = 0xe8e000;
46:
47: public:
48: SysportDevice();
1.1.1.12 root 49: ~SysportDevice() override;
1.1 root 50:
1.1.1.11 root 51: bool Init() override;
1.1.1.9 root 52: void ResetHard(bool poweron) override;
1.1.1.4 root 53:
1.1.1.7 root 54: // KEYCTRL の状態を取得する
55: bool GetKeyCtrl() const {
56: return sysport.key_ctrl;
57: }
58:
1.1.1.3 root 59: protected:
60: // BusIO インタフェース
61: static const uint32 NPORT = 8;
1.1.1.13 root 62: busdata ReadPort(uint32 offset);
63: busdata WritePort(uint32 offset, uint32 data);
64: busdata PeekPort(uint32 offset);
65: bool PokePort(uint32 offset, uint32 data);
1.1 root 66:
67: private:
1.1.1.12 root 68: DECLARE_MONITOR_CALLBACK(MonitorUpdate);
69:
1.1 root 70: struct SYSPORT sysport {};
1.1.1.11 root 71:
1.1.1.14! root 72: Monitor *monitor {};
1.1.1.12 root 73:
1.1.1.11 root 74: CGROMDevice *cgrom {};
75: IPLROM1Device *iplrom1 {};
76: ROMDevice *iplrom2 {};
77: Keyboard *keyboard {};
78: MainRAMDevice *mainram {};
79: NMIDevice *nmi {};
80: SRAMDevice *sram {};
1.1.1.12 root 81: VideoCtlrDevice *videoctlr {};
1.1 root 82: };
1.1.1.6 root 83:
1.1.1.11 root 84: static inline SysportDevice *GetSysportDevice() {
85: return Object::GetObject<SysportDevice>(OBJ_SYSPORT);
86: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.