Annotation of nono/vm/areaset.cpp, revision 1.1.1.9

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: 
1.1.1.6   root        7: //
                      8: // エリアセット
                      9: //
                     10: 
1.1.1.9 ! root       11: // 書き込み専用デバイスなので BusIO を使うのも余計手間な気がする。
        !            12: 
1.1       root       13: #include "areaset.h"
1.1.1.3   root       14: #include "mpu.h"
1.1.1.9 ! root       15: #include "x68kio.h"
1.1       root       16: 
1.1.1.6   root       17: // コンストラクタ
1.1       root       18: AreaSetDevice::AreaSetDevice()
1.1.1.8   root       19:        : inherited(OBJ_AREASET)
1.1       root       20: {
                     21: }
                     22: 
1.1.1.6   root       23: // デストラクタ
1.1       root       24: AreaSetDevice::~AreaSetDevice()
                     25: {
                     26: }
                     27: 
1.1.1.9 ! root       28: // 初期化
        !            29: bool
        !            30: AreaSetDevice::Init()
        !            31: {
        !            32:        if (inherited::Init() == false) {
        !            33:                return false;
        !            34:        }
        !            35: 
        !            36:        x68kio = GetX68kIODevice();
        !            37: 
        !            38:        return true;
        !            39: }
        !            40: 
1.1.1.6   root       41: // リセット
1.1.1.3   root       42: void
1.1.1.6   root       43: AreaSetDevice::ResetHard(bool poweron)
1.1.1.3   root       44: {
1.1.1.9 ! root       45:        // リセットでどうなるかは分からないけど、
        !            46:        // さすがに不定ではないだろう。
        !            47:        x68kio->SetAreaset(0);
1.1.1.3   root       48: }
                     49: 
1.1.1.9 ! root       50: busdata
1.1       root       51: AreaSetDevice::Read8(uint32 addr)
                     52: {
1.1.1.9 ! root       53:        // 書き込み専用なので読み出しはすべてバスエラー。
        !            54:        putlog(2, "Read $%06x.B (BusErr)", addr);
        !            55:        return busdata::BusErr;
1.1       root       56: }
                     57: 
1.1.1.9 ! root       58: busdata
1.1       root       59: AreaSetDevice::Read16(uint32 addr)
                     60: {
1.1.1.9 ! root       61:        // 書き込み専用なので読み出しはすべてバスエラー。
        !            62:        putlog(2, "Read $%06x.W (BusErr)", addr);
        !            63:        return busdata::BusErr;
1.1       root       64: }
                     65: 
1.1.1.9 ! root       66: busdata
1.1       root       67: AreaSetDevice::Write8(uint32 addr, uint32 data)
                     68: {
1.1.1.9 ! root       69:        busdata r;
1.1.1.3   root       70: 
1.1.1.9 ! root       71:        // 2バイトおきのようだ。
        !            72:        uint32 offset = addr & 1;
        !            73:        if (offset == 0) {
        !            74:                putlog(2, "Write $%06x.B (BusErr)", addr);
        !            75:                r.SetBusErr();
        !            76:        } else {
        !            77:                putlog(1, "Write $%06x <- $%02x", addr, data);
        !            78:                x68kio->SetAreaset(data & 0xff);
1.1       root       79:        }
1.1.1.9 ! root       80: 
        !            81:        const busdata wait = busdata::Wait(7 * 40_nsec);
        !            82:        r |= wait;
        !            83:        return r;
1.1       root       84: }
                     85: 
1.1.1.9 ! root       86: busdata
1.1       root       87: AreaSetDevice::Write16(uint32 addr, uint32 data)
                     88: {
1.1.1.9 ! root       89:        // ワード書き込みは可能
        !            90:        return Write8(addr + 1, data & 0xff);
1.1       root       91: }
                     92: 
1.1.1.9 ! root       93: busdata
1.1       root       94: AreaSetDevice::Peek8(uint32 addr)
                     95: {
1.1.1.9 ! root       96:        return busdata::BusErr;
1.1       root       97: }

unix.superglobalmegacorp.com

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