Annotation of nono/vm/gvram.cpp, revision 1.1

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: 
        !            16: GVRAMDevice *gGVRAM;
        !            17: 
        !            18: GVRAMDevice::GVRAMDevice()
        !            19: {
        !            20:        logname = "gvram";
        !            21:        devname = "GVRAM";
        !            22:        devaddr = 0xc00000;
        !            23:        devlen  = 0x200000;     // XXX とりあえず
        !            24: 
        !            25:        mem = new uint8[devlen];
        !            26: }
        !            27: 
        !            28: GVRAMDevice::~GVRAMDevice()
        !            29: {
        !            30:        delete[] mem;
        !            31: }
        !            32: 
        !            33: uint64
        !            34: GVRAMDevice::Read8(uint32 addr)
        !            35: {
        !            36:        uint32 offset = addr - devaddr;
        !            37:        return mem[HB(offset)];
        !            38: }
        !            39: 
        !            40: uint64
        !            41: GVRAMDevice::Read16(uint32 addr)
        !            42: {
        !            43:        uint32 offset = addr - devaddr;
        !            44:        return *(uint16 *)&mem[offset];
        !            45: }
        !            46: 
        !            47: uint64
        !            48: GVRAMDevice::Write8(uint32 addr, uint32 data)
        !            49: {
        !            50:        uint32 offset = addr - devaddr;
        !            51:        mem[HB(offset)] = data;
        !            52:        return 0;
        !            53: }
        !            54: 
        !            55: uint64
        !            56: GVRAMDevice::Write16(uint32 addr, uint32 data)
        !            57: {
        !            58:        uint32 offset = addr - devaddr;
        !            59:        *(uint16 *)&mem[offset] = data;
        !            60:        return 0;
        !            61: }
        !            62: 
        !            63: uint64
        !            64: GVRAMDevice::Peek8(uint32 addr)
        !            65: {
        !            66:        return mem[HB(addr - devaddr)];
        !            67: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.