|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2018 [email protected]
4: //
5:
6: #include "gvram.h"
7: #include "vicon.h"
8:
9: //
10: // GVRAM
11: //
12: // GVRAM はワード単位でホストバイトオーダ配置なので、
13: // バイトアクセス時は HB() マクロを使用のこと。
14: //
15:
1.1.1.2 ! root 16: std::unique_ptr<GVRAMDevice> gGVRAM;
1.1 root 17:
18: GVRAMDevice::GVRAMDevice()
19: {
20: logname = "gvram";
21: devname = "GVRAM";
22: devaddr = 0xc00000;
23: devlen = 0x200000; // XXX とりあえず
24:
1.1.1.2 ! root 25: mem.reset(new uint8[devlen]);
1.1 root 26: }
27:
28: GVRAMDevice::~GVRAMDevice()
29: {
30: }
31:
32: uint64
33: GVRAMDevice::Read8(uint32 addr)
34: {
35: uint32 offset = addr - devaddr;
36: return mem[HB(offset)];
37: }
38:
39: uint64
40: GVRAMDevice::Read16(uint32 addr)
41: {
42: uint32 offset = addr - devaddr;
43: return *(uint16 *)&mem[offset];
44: }
45:
46: uint64
47: GVRAMDevice::Write8(uint32 addr, uint32 data)
48: {
49: uint32 offset = addr - devaddr;
50: mem[HB(offset)] = data;
51: return 0;
52: }
53:
54: uint64
55: GVRAMDevice::Write16(uint32 addr, uint32 data)
56: {
57: uint32 offset = addr - devaddr;
58: *(uint16 *)&mem[offset] = data;
59: return 0;
60: }
61:
62: uint64
63: GVRAMDevice::Peek8(uint32 addr)
64: {
65: return mem[HB(addr - devaddr)];
66: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.