Annotation of nono/vm/ssg.h, revision 1.1.1.3

1.1       root        1: //
                      2: // nono
                      3: // Copyright (C) 2024 nono project
                      4: // Licensed under nono-license.txt
                      5: //
                      6: 
                      7: //
                      8: // SSG (YM2149)
                      9: //
                     10: 
                     11: #pragma once
                     12: 
                     13: #include "device.h"
                     14: 
                     15: // レジスタ
                     16: struct SSG
                     17: {
                     18:        //      7   6   5   4   3   2   1   0
                     19:        //    +---+---+---+---+---+---+---+---+
                     20:        // R0 |              Low              |
                     21:        //    +---------------+---------------+ Frequency of channel A
                     22:        // R1 |       -       |      High     |
                     23:        //    +---+---+---+---+---+---+---+---+
                     24:        //
                     25:        //    +---+---+---+---+---+---+---+---+
                     26:        // R2 |              Low              |
                     27:        //    +---------------+---------------+ Frequency of channel B
                     28:        // R3 |       -       |      High     |
                     29:        //    +---+---+---+---+---+---+---+---+
                     30:        //
                     31:        //    +---+---+---+---+---+---+---+---+
                     32:        // R4 |              Low              |
                     33:        //    +---------------+---------------+ Frequency of channel C
                     34:        // R5 |       -       |      High     |
                     35:        //    +---+---+---+---+---+---+---+---+
                     36:        //
                     37:        //    +-----------+---+---+---+---+---+
                     38:        // R6 |     -     |       freq        | Frequency of noise
                     39:        //    +-----------+---+---+---+---+---+
                     40:        //
                     41:        //    +---+---+---+---+---+---+---+---+
                     42:        // R7 |  I/O  |   Noise   |   Tone    | I/O port and mixer settings
                     43:        //    | B | A | C | B | A | C | B | A |
                     44:        //    +---+---+---+---+---+---+---+---+
                     45:        //
                     46:        //    +-----------+---+---+---+---+---+
                     47:        // R8 |     -     | M |     level     | Level of channel A
                     48:        //    +-----------+---+---+---+---+---+
                     49:        //    +-----------+---+---+---+---+---+
                     50:        // R9 |     -     | M |     level     | Level of channel B
                     51:        //    +-----------+---+---+---+---+---+
                     52:        //    +-----------+---+---+---+---+---+
                     53:        // RA |     -     | M |     level     | Level of channel C
                     54:        //    +-----------+---+---+---+---+---+
                     55:        //
                     56:        //    +-------------------------------+
                     57:        // RB |           freq (Low)          | Frequency of envelope
                     58:        // RC |           freq (High)         |
                     59:        //    +-------------------------------+
                     60:        //
                     61:        //    +---------------+---+---+---+---+
                     62:        // RD |       -       |CNT|ATT|ALT|HLD| Shape of envelope
                     63:        //    +---------------+---+---+---+---+
                     64:        //
                     65:        //    +-------------------------------+
                     66:        // RE |           8 bit data          | Data of I/O port A
                     67:        //    +-------------------------------+
                     68:        // RF |           8 bit data          | Data of I/O port B
                     69:        //    +-------------------------------+
                     70: 
                     71:        uint freq[3];
                     72:        uint noise_freq;
                     73:        uint settings;
                     74:        bool ampmode[3];
                     75:        uint amplevel[3];
                     76:        uint envelope_freq;
                     77:        uint envelope_shape;
                     78:        uint dataA;
                     79:        uint dataB;
                     80: 
                     81:        // Rn の値を返す
                     82:        uint32 Get(uint n) const;
                     83: 
                     84:        // レベルレジスタの値を返す
                     85:        uint32 GetLevelReg(int n) const {
                     86:                return (ampmode[n] ? 0x10 : 0) | amplevel[n];
                     87:        }
                     88: };
                     89: 
                     90: class SSGDevice : public IODevice
                     91: {
                     92:        using inherited = IODevice;
                     93: 
                     94:        // マスタークロック (1.536MHz)
                     95:        static const uint fMaster = 1536000;
                     96: 
                     97:  public:
                     98:        SSGDevice();
                     99:        ~SSGDevice() override;
                    100: 
                    101:        void ResetHard(bool poweron) override;
                    102: 
                    103:        busdata Read1(uint32 addr) override;
                    104:        busdata Write1(uint32 addr, uint32 data) override;
                    105:        busdata Peek1(uint32 addr) override;
                    106: 
                    107:  private:
1.1.1.3 ! root      108:        DECLARE_MONITOR_SCREEN(MonitorScreen);
1.1       root      109: 
                    110:        uint32 GetReg(uint32 n) const;
                    111: 
                    112:        uint32 regno {};
                    113:        SSG reg {};
                    114: 
1.1.1.2   root      115:        Monitor *monitor {};
1.1       root      116: };
                    117: 
1.1.1.3 ! root      118: inline SSGDevice *GetSSGDevice() {
1.1       root      119:        return Object::GetObject<SSGDevice>(OBJ_SSG);
                    120: }

unix.superglobalmegacorp.com

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