Exemplo n.º 1
0
        /// <summary>
        /// Returns the ROM/RAM enum that relates to this particular memory read operation
        /// </summary>
        public override ZXSpectrum.CDLResult ReadCDL(ushort addr)
        {
            var res = new ZXSpectrum.CDLResult();

            int divisor = addr / 0x4000;

            res.Address = addr % 0x4000;

            // paging logic goes here
            switch (divisor)
            {
            case 0: res.Type = ZXSpectrum.CDLType.ROM0; break;

            case 1: res.Type = ZXSpectrum.CDLType.RAM0; break;
            }

            return(res);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns the ROM/RAM enum that relates to this particular memory read operation
        /// </summary>
        public override ZXSpectrum.CDLResult ReadCDL(ushort addr)
        {
            var result = new ZXSpectrum.CDLResult();

            int divisor = addr / 0x4000;

            result.Address = addr % 0x4000;

            // special paging
            if (SpecialPagingMode)
            {
                switch (divisor)
                {
                case 0:
                    switch (PagingConfiguration)
                    {
                    case 0:
                        result.Type = ZXSpectrum.CDLType.RAM0;
                        break;

                    case 1:
                    case 2:
                    case 3:
                        result.Type = ZXSpectrum.CDLType.RAM4;
                        break;
                    }
                    break;

                case 1:
                    switch (PagingConfiguration)
                    {
                    case 0:
                        result.Type = ZXSpectrum.CDLType.RAM1;
                        break;

                    case 1:
                    case 2:
                        result.Type = ZXSpectrum.CDLType.RAM5;
                        break;

                    case 3:
                        result.Type = ZXSpectrum.CDLType.RAM7;
                        break;
                    }
                    break;

                case 2:
                    switch (PagingConfiguration)
                    {
                    case 0:
                        result.Type = ZXSpectrum.CDLType.RAM0;
                        break;

                    case 1:
                    case 2:
                    case 3:
                        result.Type = ZXSpectrum.CDLType.RAM6;
                        break;
                    }
                    break;

                case 3:
                    switch (PagingConfiguration)
                    {
                    case 0:
                    case 2:
                    case 3:
                        result.Type = ZXSpectrum.CDLType.RAM3;
                        break;

                    case 1:
                        result.Type = ZXSpectrum.CDLType.RAM7;
                        break;
                    }
                    break;
                }
            }
            else
            {
                switch (divisor)
                {
                // ROM 0x000
                case 0:
                    switch (_ROMpaged)
                    {
                    case 0:
                        result.Type = ZXSpectrum.CDLType.ROM0;
                        break;

                    case 1:
                        result.Type = ZXSpectrum.CDLType.ROM1;
                        break;

                    case 2:
                        result.Type = ZXSpectrum.CDLType.ROM2;
                        break;

                    case 3:
                        result.Type = ZXSpectrum.CDLType.ROM3;
                        break;
                    }
                    break;

                // RAM 0x4000 (RAM5 - Bank5 always)
                case 1:
                    result.Type = ZXSpectrum.CDLType.RAM5;
                    break;

                // RAM 0x8000 (RAM2 - Bank2)
                case 2:
                    result.Type = ZXSpectrum.CDLType.RAM2;
                    break;

                // RAM 0xc000 (any ram bank 0 - 7 may be paged in - default bank0)
                case 3:
                    switch (RAMPaged)
                    {
                    case 0:
                        result.Type = ZXSpectrum.CDLType.RAM0;
                        break;

                    case 1:
                        result.Type = ZXSpectrum.CDLType.RAM1;
                        break;

                    case 2:
                        result.Type = ZXSpectrum.CDLType.RAM2;
                        break;

                    case 3:
                        result.Type = ZXSpectrum.CDLType.RAM3;
                        break;

                    case 4:
                        result.Type = ZXSpectrum.CDLType.RAM4;
                        break;

                    case 5:
                        result.Type = ZXSpectrum.CDLType.RAM5;
                        break;

                    case 6:
                        result.Type = ZXSpectrum.CDLType.RAM6;
                        break;

                    case 7:
                        result.Type = ZXSpectrum.CDLType.RAM7;
                        break;
                    }
                    break;

                default:
                    break;
                }
            }

            return(result);
        }