Annotation of nono/vm/opm.cpp, revision 1.1.1.4

1.1       root        1: //
                      2: // nono
                      3: // Copyright (C) 2020 nono project
                      4: // Licensed under nono-license.txt
                      5: //
                      6: 
1.1.1.4 ! root        7: //
        !             8: // OPM (YM2151)
        !             9: //
        !            10: 
1.1       root       11: #include "opm.h"
1.1.1.2   root       12: #include "mpu.h"
1.1.1.4 ! root       13: #include "fdc.h"
1.1       root       14: 
1.1.1.4 ! root       15: // グローバル参照用
        !            16: OPMDevice *gOPM;
1.1       root       17: 
1.1.1.4 ! root       18: // コンストラクタ
1.1       root       19: OPMDevice::OPMDevice()
1.1.1.3   root       20:        : inherited("OPM")
1.1       root       21: {
                     22:        devaddr = baseaddr;
                     23:        devlen  = 0x2000;
                     24: }
                     25: 
1.1.1.4 ! root       26: // デストラクタ
1.1       root       27: OPMDevice::~OPMDevice()
                     28: {
1.1.1.4 ! root       29:        gOPM = NULL;
1.1       root       30: }
                     31: 
                     32: uint64
1.1.1.2   root       33: OPMDevice::Read(uint32 offset)
1.1       root       34: {
1.1.1.4 ! root       35:        switch (offset) {
        !            36:         case 0:
        !            37:                putlog(0, "未実装読み込み $%06x", gMPU->GetPaddr());
        !            38:                return 0;
        !            39:         case 1:
        !            40:                // OPM ステータスレジスタ
        !            41:                putlog(0, "未実装OPMステータスレジスタ読み込み");
        !            42:                return 0;
        !            43:         default:
        !            44:                __unreachable();
        !            45:        }
1.1       root       46: }
                     47: 
                     48: uint64
1.1.1.2   root       49: OPMDevice::Write(uint32 offset, uint32 data)
1.1       root       50: {
1.1.1.4 ! root       51:        switch (offset) {
        !            52:         case 0:
        !            53:                putlog(1, "REG <- $%02x", data);
        !            54:                reg = data;
        !            55:                break;
        !            56:         case 1:
        !            57:                putlog(1, "DATA <- $%02x", data);
        !            58:                switch (reg) {
        !            59:                 case 0x1b:
        !            60:                        gFDC->SetForceReady(reg & 0x40);
        !            61:                        // 他のビットは未対応
        !            62:                        break;
        !            63:                 default:
        !            64:                        putlog(0, "未実装書き込み $%06x <- $%02x", gMPU->GetPaddr(), data);
        !            65:                        break;
        !            66:                }
        !            67:                break;
        !            68:         default:
        !            69:                __unreachable();
        !            70:        }
        !            71: 
1.1       root       72:        return 0;
                     73: }
                     74: 
                     75: uint64
1.1.1.2   root       76: OPMDevice::Peek(uint32 offset)
1.1       root       77: {
                     78:        // XXX 未実装
                     79:        return 0xff;
                     80: }

unix.superglobalmegacorp.com

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