|
|
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"
1.1.1.12! root 14: #include "monitor.h"
1.1 root 15:
1.1.1.11 root 16: class CGROMDevice;
17: class IPLROM1Device;
18: class Keyboard;
19: class MainRAMDevice;
20: class NMIDevice;
21: class ROMDevice;
22: class SRAMDevice;
1.1.1.12! root 23: class VideoCtlrDevice;
1.1.1.11 root 24:
1.1 root 25: struct SYSPORT
26: {
27: static const int CONTRAST = 0; // $E8E001
28: static const int SCOPE3D = 1; // $E8E003
29: static const int IMAGEUNIT = 2; // $E8E005
30: static const int KEY = 3; // $E8E007
31: static const int WAIT = 4; // $E8E009
32: static const int MPU = 5; // $E8E00B
33: static const int SRAMWP = 6; // $E8E00D
34: static const int POWEROFF = 7; // $E8E00F
35:
1.1.1.12! root 36: int rom_wait; // システムポートへの書き込み値ではなく ROM への指示値。
! 37: int ram_wait; // システムポートへの書き込み値ではなく RAM への指示値。
1.1.1.7 root 38: bool key_ctrl;
1.1.1.10 root 39: uint pwoff_count;
1.1 root 40: };
41:
1.1.1.8 root 42: class SysportDevice : public IODevice
1.1 root 43: {
1.1.1.3 root 44: using inherited = IODevice;
1.1.1.9 root 45:
1.1 root 46: static const uint32 baseaddr = 0xe8e000;
47:
48: public:
49: SysportDevice();
1.1.1.12! root 50: ~SysportDevice() override;
1.1 root 51:
1.1.1.11 root 52: bool Init() override;
1.1.1.9 root 53: void ResetHard(bool poweron) override;
1.1.1.4 root 54:
1.1.1.7 root 55: // KEYCTRL の状態を取得する
56: bool GetKeyCtrl() const {
57: return sysport.key_ctrl;
58: }
59:
1.1.1.3 root 60: protected:
61: // BusIO インタフェース
62: static const uint32 NPORT = 8;
1.1.1.12! root 63: busdata Read(uint32 offset);
! 64: busdata Write(uint32 offset, uint32 data);
! 65: busdata Peek(uint32 offset);
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.12! root 72: Monitor monitor { this };
! 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.