|
|
1.1 root 1: //
2: // nono
1.1.1.2 root 3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
1.1 root 5: //
6:
7: #include "areaset.h"
1.1.1.3 root 8: #include "mpu.h"
1.1 root 9:
1.1.1.4 ! root 10: std::unique_ptr<AreaSetDevice> gAreaSet;
! 11:
1.1 root 12: AreaSetDevice::AreaSetDevice()
13: {
14: logname = "area";
15: devname = "AreaSet";
16: devaddr = baseaddr;
17: devlen = 0x2000;
18: }
19:
20: AreaSetDevice::~AreaSetDevice()
21: {
22: }
23:
1.1.1.3 root 24: void
25: AreaSetDevice::ResetHard()
26: {
27: limit = 0;
28: }
29:
1.1 root 30: uint64
31: AreaSetDevice::Read8(uint32 addr)
32: {
33: switch (addr) {
34: case 0xe86001:
35: return limit;
36: }
37: return (uint64)-1;
38: }
39:
40: uint64
41: AreaSetDevice::Read16(uint32 addr)
42: {
43: return 0xff00 | Read8(addr + 1);
44: }
45:
46: uint64
47: AreaSetDevice::Write8(uint32 addr, uint32 data)
48: {
1.1.1.3 root 49: gMPU->AddCycle(7); // InsideOut p.135
50:
1.1 root 51: switch (addr) {
52: case 0xe86001:
53: putlog(0, "未実装エリアセット書き込み $%02x", data);
54: limit = data;
55: return 0;
56: default:
57: break;
58: }
59: return (uint64)-1;
60: }
61:
62: uint64
63: AreaSetDevice::Write16(uint32 addr, uint32 data)
64: {
65: return Write8(addr + 1, data);
66: }
67:
68: uint64
69: AreaSetDevice::Peek8(uint32 addr)
70: {
71: switch (addr) {
72: case 0xe86001:
73: return limit;
74: default:
75: return 0xff;
76: }
77: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.