Ejemplo n.º 1
0
        public void Layer0Button_Click(object sender, EventArgs e)
        {
            Button selected = (Button)sender;

            // disable the previous button
            Layer0Button.BackColor = SystemColors.Control;
            Layer1Button.BackColor = SystemColors.Control;
            Layer2Button.BackColor = SystemColors.Control;
            Layer3Button.BackColor = SystemColors.Control;
            layer = Convert.ToInt32(selected.Tag);
            selected.BackColor = SystemColors.ActiveCaption;

            int addrOffset = 0xAF_0100 + layer * 8;
            int ControlReg = memory.ReadByte(addrOffset);

            LayersetAddress = memory.ReadLong(addrOffset + 1);
            int LUT = (ControlReg >> 1) & 3;

            LUTDomain.Text = LUT.ToString();

            TilesetAddressText.Text = (LayersetAddress + 0xB0_0000).ToString("X6");

            int StrideX = memory.ReadWord(addrOffset + 4);
            int StrideY = memory.ReadWord(addrOffset + 6);

            LayerEnabledCheckbox.Checked = (ControlReg & 1) == 1;
            StrideXText.Text             = StrideX.ToString("X4");
            StrideYText.Text             = StrideY.ToString("X4");
            TilesetViewer.Refresh();
        }
Ejemplo n.º 2
0
 private void TilesetViewer_MouseClick(object sender, MouseEventArgs e)
 {
     selectedX = e.X / TILE_WIDTH;
     selectedY = e.Y / TILE_WIDTH;
     TileSelectedLabel.Text = "Tile Selected: $" + (selectedY * 16 + selectedX).ToString("X2");
     TilesetViewer.Refresh();
 }
Ejemplo n.º 3
0
        private void LutList_SelectedIndexChanged(object sender, EventArgs e)
        {
            int  tilesetBaseAddr = MemoryLocations.MemoryMap.TILESET_BASE_ADDR + TilesetList.SelectedIndex * 4;
            byte ConfigRegister  = (byte)((Stride256Checkbox.Checked? 8:0) + LutList.SelectedIndex);

            MemMgr.WriteByte(tilesetBaseAddr + 3, ConfigRegister);
            TilesetViewer.Refresh();
        }
Ejemplo n.º 4
0
 private void LUTDomain_SelectedItemChanged(object sender, EventArgs e)
 {
     if (sender is DomainUpDown)
     {
         int  addrOffset = 0xAF_0100 + layer * 8;
         byte ControlReg = memory.ReadByte(addrOffset);
         byte lut        = Convert.ToByte(LUTDomain.Text);
         ControlReg = (byte)(ControlReg | (lut << 1));
         memory.WriteByte(addrOffset, ControlReg);
     }
     TilesetViewer.Refresh();
 }
Ejemplo n.º 5
0
        private void TilesetList_SelectedIndexChanged(object sender, EventArgs e)
        {
            int tilesetBaseAddr = MemoryLocations.MemoryMap.TILESET_BASE_ADDR + TilesetList.SelectedIndex * 4;
            int tilesetAddr     = MemMgr.ReadLong(tilesetBaseAddr) & 0x3F_FFFF;

            TilesetAddress.Text = (tilesetAddr + 0xB0_0000).ToString("X6");
            int cfgReg = MemMgr.ReadByte(tilesetBaseAddr + 3);

            Stride256Checkbox.Checked = (cfgReg & 8) != 0;
            LutList.SelectedIndex     = cfgReg & 7;
            TilesetViewer.Refresh();
        }
Ejemplo n.º 6
0
        /**
         * When the user moves the mouse, highlight the border in yellow and print the number.
         */
        private void TilesetViewer_MouseMove(object sender, MouseEventArgs e)
        {
            int x = e.X / TILE_WIDTH;

            if (x < 16)
            {
                hoverX = x;
            }
            int y = e.Y / TILE_WIDTH;

            if (y < 16)
            {
                hoverY = y;
            }
            TilesetViewer.Refresh();
        }
Ejemplo n.º 7
0
        private void LUTText_TextChanged(object sender, EventArgs e)
        {
            int  addrOffset = 0xAF_0100 + layer * 8;
            byte ControlReg = memory.ReadByte(addrOffset);
            byte lut        = 0;

            try
            {
                lut = Convert.ToByte(LUTText.Text);
                if (lut > 3)
                {
                    lut          = 0;
                    LUTText.Text = "0";
                }
            }
            catch
            {
                LUTText.Text = "0";
            }
            ControlReg = (byte)((ControlReg & 0xF1) | (lut << 1));
            memory.WriteByte(addrOffset, ControlReg);
            TilesetViewer.Refresh();
        }
Ejemplo n.º 8
0
 /**
  * When the user moves the mouse, highlight the border in yellow and print the number.
  */
 private void TilesetViewer_MouseMove(object sender, MouseEventArgs e)
 {
     hoverX = e.X / TILE_WIDTH;
     hoverY = e.Y / TILE_WIDTH;
     TilesetViewer.Refresh();
 }