|
|
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: {
1.1.1.13! root 27: static const uint CONTRAST = 0; // $E8E001
! 28: static const uint SCOPE3D = 1; // $E8E003
! 29: static const uint IMAGEUNIT = 2; // $E8E005
! 30: static const uint KEY = 3; // $E8E007
! 31: static const uint WAIT = 4; // $E8E009
! 32: static const uint MPU = 5; // $E8E00B
! 33: static const uint SRAMWP = 6; // $E8E00D
! 34: static const uint POWEROFF = 7; // $E8E00F
1.1 root 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.13! root 63: busdata ReadPort(uint32 offset);
! 64: busdata WritePort(uint32 offset, uint32 data);
! 65: busdata PeekPort(uint32 offset);
! 66: bool PokePort(uint32 offset, uint32 data);
1.1 root 67:
68: private:
1.1.1.12 root 69: DECLARE_MONITOR_CALLBACK(MonitorUpdate);
70:
1.1 root 71: struct SYSPORT sysport {};
1.1.1.11 root 72:
1.1.1.12 root 73: Monitor monitor { this };
74:
1.1.1.11 root 75: CGROMDevice *cgrom {};
76: IPLROM1Device *iplrom1 {};
77: ROMDevice *iplrom2 {};
78: Keyboard *keyboard {};
79: MainRAMDevice *mainram {};
80: NMIDevice *nmi {};
81: SRAMDevice *sram {};
1.1.1.12 root 82: VideoCtlrDevice *videoctlr {};
1.1 root 83: };
1.1.1.6 root 84:
1.1.1.11 root 85: static inline SysportDevice *GetSysportDevice() {
86: return Object::GetObject<SysportDevice>(OBJ_SYSPORT);
87: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.