예제 #1
0
        public void WriteVideoRamAndReadVideoRam()
        {
            TestContext.WriteLine("outputDmdDisplay, writeVideoRam and readVideoRam");
            byte BANK   = 2;
            byte OFFSET = 1;

            outputDmdDisplay.writeVideoRam(BANK, OFFSET, 33);
            var result = outputDmdDisplay.readVideoRam(BANK, OFFSET);

            Assert.That(result, Is.EqualTo(33));
        }
예제 #2
0
        public void write(ushort offset, byte value)
        {
            var address = dmdMapper.getAddress(offset);

            if (address.subsystem == dmdMapper.SUBSYSTEM_DMD_VIDEORAM)
            {
                outputDmdDisplay.writeVideoRam((byte)address.bank, address.offset, value);
                return;
            }

            this.ram[offset] = value;
            switch (offset)
            {
            case OP.WPC95_PRINTER_DATA:
            case OP.WPC95_PRINTER_BAUD:
            case OP.WPC95_PRINTER_ADDR:
            case OP.WPC95_PRINTER_STATUS:
            case OP.WPC95_PRINTER_PRESENCE:
                Debug.Print("WRITE_IGNORED {0} {1}", REVERSEOP[offset], value);
                break;

            case OP.WPC_DMD_SCANLINE:
                Debug.Print("WRITE {0} {1}", REVERSEOP[offset], value);
                // The CPU can also write to WPC_DMD_SCANLINE to request an FIRQ interrupt to be generated when the current scanline reaches a certain value.
                // This is used to implement shading: the active page buffer is rapidly changed between different bit planes at different frequencies to simulate color.
                // Because there is latency between the time that FIRQ is generated and the CPU can respond to it, this writable register can compensate for that delay
                // and help to ensure that flipping occurs as fast as possible.
                outputDmdDisplay.requestFIRQ = true;
                break;

            case OP.WPC_DMD_ACTIVE_PAGE:
                Debug.Print("WRITE {0} {1}", REVERSEOP[offset], value);
                // The visible page register, WPC_DMD_ACTIVE_PAGE, holds the page number of the frame that should
                // be clocked to the display. Writing to this register does not take effect immediately but instead
                // at the beginning of the next vertical retrace.
                outputDmdDisplay.setNextActivePage(value);
                break;

            //which page is exposed at address 0x3800?
            case OP.WPC_DMD_LOW_PAGE:
                // AKA PAGE3800
                outputDmdDisplay.selectDmdPage(0, value);
                break;

            case OP.WPC_DMD_HIGH_PAGE:
                // AKA PAGE3A00
                outputDmdDisplay.selectDmdPage(1, value);
                break;

            case OP.WPC95_DMD_PAGE3000:
                outputDmdDisplay.selectDmdPage(2, value);
                break;

            case OP.WPC95_DMD_PAGE3200:
                outputDmdDisplay.selectDmdPage(3, value);
                break;

            case OP.WPC95_DMD_PAGE3400:
                outputDmdDisplay.selectDmdPage(4, value);
                break;

            case OP.WPC95_DMD_PAGE3600:
                outputDmdDisplay.selectDmdPage(5, value);
                break;

            case OP.WPC_ALPHA_POS:
                this.outputAlphaDisplay.setSegmentColumn(value);
                break;

            case OP.WPC_ALPHA_ROW1_A:
                this.outputAlphaDisplay.setRow1(true, value);
                break;

            case OP.WPC_ALPHA_ROW1_B:
                this.outputAlphaDisplay.setRow1(false, value);
                break;

            case OP.WPC_ALPHA_ROW2_A:
                this.outputAlphaDisplay.setRow2(true, value);
                break;

            case OP.WPC_ALPHA_ROW2_B:
                this.outputAlphaDisplay.setRow2(false, value);
                break;

            default:
                Debug.Print("W_NOT_IMPLEMENTED {0} {1}", "0x" + offset.ToString("X4"), value);
                Debug.Print("DMD W_NOT_IMPLEMENTED {0} {1}", "0x" + offset.ToString("X4"), value);
                break;
            }
        }