Example #1
0
        /// <summary>
        /// Creates TVC keyboard emulation
        /// </summary>
        /// <param name="in_tvc">TVC hardware which owns this keyboard</param>
        public TVCKeyboard(TVComputer in_tvc)
        {
            m_tvc = in_tvc;

            // init matrx
            m_keyboard_matrix = new byte[KeyboardRowCount];
            for (int i = 0; i < m_keyboard_matrix.Length; i++)
            {
                m_keyboard_matrix[i] = 0xff;
            }

            // create key mapping table
            LoadKeyMappingTableFromResource("TVCEmu.Resources.DefaultKeyMapping.txt");

            // clear pressed key table
            m_pressed_keys = new Key[PressedKeyCount];
            for (int i = 0; i < PressedKeyCount; i++)
            {
                m_pressed_keys[i] = Key.None;
            }

            // add port access handlers
            m_tvc.Ports.AddPortWriter(0x03, PortWrite03H);
            m_tvc.Ports.AddPortReader(0x58, PortRead58H);

            // setup injection service
            m_keyboard_injection_pos  = -1;
            m_keyboard_injection_rate = m_tvc.MillisecToCPUTicks(KeyboardInjectionRate);
        }
Example #2
0
        public TVCInterrupt(TVComputer in_tvc)
        {
            m_tvc = in_tvc;

            m_tvc.Ports.AddPortWriter(0x07, PortWrite07H);
            m_tvc.Ports.AddPortReader(0x59, PortRead59H);
        }
Example #3
0
        public TVCMemory(TVComputer in_tvc)
        {
            m_tvc = in_tvc;

            m_page_reader = new PageReader[PageCount];
            m_page_writer = new PageWriter[PageCount];

            // reserve space for memories
            m_mem_sys = new byte[SysMemLength];
            m_mem_ext = new byte[ExtMemLength];

            m_mem_iomem = new byte[IOCardCount][];
            for (int i = 0; i < IOCardCount; i++)
            {
                m_mem_iomem[i] = new byte[IOMemSize];
            }

            m_mem_user  = new byte[PageCount * PageLength];
            m_mem_video = new byte[VideoPageCount * PageLength];

            // register port handlers
            m_tvc.Ports.AddPortWriter(0x02, PortWrite02H);
            m_tvc.Ports.AddPortWriter(0x03, PortWrite03H);
            m_tvc.Ports.AddPortReset(0x02, PortReset02H);
            m_tvc.Ports.AddPortReset(0x03, PortReset03H);
        }
Example #4
0
        public TVCVideo(TVComputer in_tvc)
        {
            m_tvc = in_tvc;

            m_context = SynchronizationContext.Current;

            // fill color cache
            m_graphics16_colors = new uint[128];
            int graphics16_color_index;
            int index;

            m_colors = new uint[TVCColors.Length];
            for (int i = 0; i < TVCColors.Length; i++)
            {
                m_colors[i] = 0xff000000u | ((uint)TVCColors[i].R << 16) | ((uint)TVCColors[i].G << 8) | (TVCColors[i].B);

                graphics16_color_index = 0;
                index = i;
                for (int j = 0; j < 4; j++)
                {
                    graphics16_color_index <<= 2;

                    if ((index & 0x08) != 0)
                    {
                        graphics16_color_index |= 0x01;
                    }

                    index <<= 1;
                }

                m_graphics16_colors[graphics16_color_index] = m_colors[i];
            }

            m_6845_registers = new byte[MC6845RegisterCount];
            m_port_palette   = new byte[PaletterColorCount];

            m_tvc.Ports.AddPortWriter(0x00, PortWrite00H);

            m_tvc.Ports.AddPortWriter(0x06, PortWrite06H);

            m_tvc.Ports.AddPortWriter(0x60, PortWrite60H);
            m_tvc.Ports.AddPortWriter(0x61, PortWrite61H);
            m_tvc.Ports.AddPortWriter(0x62, PortWrite62H);
            m_tvc.Ports.AddPortWriter(0x63, PortWrite63H);

            m_tvc.Ports.AddPortWriter(0x70, PortWrite70H);
            m_tvc.Ports.AddPortWriter(0x71, PortWrite71H);

            m_frame_ready_event_param = new FrameReadyEventparam();

            AllocateFrameBuffer(640, 576);
        }