-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into features/graphics_rework
- Loading branch information
Showing
15 changed files
with
239 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<UserControl xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" | ||
x:Class="ZXBasicStudio.DebuggingTools.Flags.Controls.ZXFlagsView"> | ||
<UserControl.Styles> | ||
</UserControl.Styles> | ||
<Grid Grid.Row="1" RowDefinitions="50" VerticalAlignment="Stretch"> | ||
<Panel Background="#FF606060"> | ||
<Grid ColumnDefinitions="*,*,*,*,*,*,*,*" RowDefinitions="25,25" Name="gridFlags"> | ||
<TextBlock Grid.Row="0" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" ToolTip.Tip="S - Sign flag: Set if the 2-complement value is negative (copy of MSB)">S</TextBlock> | ||
<TextBlock Grid.Row="0" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" ToolTip.Tip="Z - Zero flag: Set if the value is zero">Z</TextBlock> | ||
<TextBlock Grid.Row="0" Grid.Column="2" HorizontalAlignment="Center" VerticalAlignment="Center" ToolTip.Tip="F5 - undocumented: Copy of bit 5">-</TextBlock> | ||
<TextBlock Grid.Row="0" Grid.Column="3" HorizontalAlignment="Center" VerticalAlignment="Center" ToolTip.Tip="H - Half Carry: Carry from bit 3 to bit 4">H</TextBlock> | ||
<TextBlock Grid.Row="0" Grid.Column="4" HorizontalAlignment="Center" VerticalAlignment="Center" ToolTip.Tip="F3 - undocumented: Copy of bit 3">-</TextBlock> | ||
<TextBlock Grid.Row="0" Grid.Column="5" | ||
HorizontalAlignment="Center" VerticalAlignment="Center" ToolTip.Tip="P/V - Parity or Overflow: Parity set if even number of bits set. Overflow set if the 2-complement result does not fit in the register"> | ||
V | ||
</TextBlock> | ||
<TextBlock Grid.Row="0" Grid.Column="6" | ||
HorizontalAlignment="Center" VerticalAlignment="Center" ToolTip.Tip="N - Subtract: Set if the last operation was a subtraction"> | ||
N | ||
</TextBlock> | ||
<TextBlock Grid.Row="0" Grid.Column="7" | ||
HorizontalAlignment="Center" VerticalAlignment="Center" ToolTip.Tip="C - Carry: Set if the result did not fit in the register"> | ||
C | ||
</TextBlock> | ||
<Border Grid.Column="0" Grid.Row="1" BorderBrush="Black" BorderThickness="0,1,0,0"> | ||
<TextBlock Name="Bit7" HorizontalAlignment="Center" VerticalAlignment="Center"/> | ||
</Border> | ||
<Border Grid.Column="1" Grid.Row="1" BorderBrush="Black" BorderThickness="1,1,0,0"> | ||
<TextBlock Name="Bit6" HorizontalAlignment="Center" VerticalAlignment="Center"/> | ||
</Border> | ||
<Border Grid.Column="2" Grid.Row="1" BorderBrush="Black" BorderThickness="1,1,0,0"> | ||
<TextBlock Name="Bit5" HorizontalAlignment="Center" VerticalAlignment="Center"/> | ||
</Border> | ||
<Border Grid.Column="3" Grid.Row="1" BorderBrush="Black" BorderThickness="1,1,0,0"> | ||
<TextBlock Name="Bit4" HorizontalAlignment="Center" VerticalAlignment="Center"/> | ||
</Border> | ||
<Border Grid.Column="4" Grid.Row="1" BorderBrush="Black" BorderThickness="1,1,0,0"> | ||
<TextBlock Name="Bit3" HorizontalAlignment="Center" VerticalAlignment="Center"/> | ||
</Border> | ||
<Border Grid.Column="5" Grid.Row="1" BorderBrush="Black" BorderThickness="1,1,0,0"> | ||
<TextBlock Name="Bit2" HorizontalAlignment="Center" VerticalAlignment="Center"/> | ||
</Border> | ||
<Border Grid.Column="6" Grid.Row="1" BorderBrush="Black" BorderThickness="1,1,0,0"> | ||
<TextBlock Name="Bit1" HorizontalAlignment="Center" VerticalAlignment="Center"/> | ||
</Border> | ||
<Border Grid.Column="7" Grid.Row="1" BorderBrush="Black" BorderThickness="1,1,0,0"> | ||
<TextBlock Name="Bit0" HorizontalAlignment="Center" VerticalAlignment="Center"/> | ||
</Border> | ||
</Grid> | ||
</Panel> | ||
</Grid> | ||
</UserControl> |
52 changes: 52 additions & 0 deletions
52
ZXBStudio/DebuggingTools/Flags/Controls/ZXFlagsView.axaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using System; | ||
using System.Linq; | ||
using Avalonia.Controls; | ||
|
||
namespace ZXBasicStudio.DebuggingTools.Flags.Controls | ||
{ | ||
public partial class ZXFlagsView : UserControl | ||
{ | ||
|
||
public ZXFlagsView() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
public void Update(byte value) | ||
{ | ||
var bits = GetBinaryFromByte(value); | ||
Bit7.Text = bits[7].ToString(); | ||
Bit6.Text = bits[6].ToString(); | ||
Bit5.Text = bits[5].ToString(); | ||
Bit4.Text = bits[4].ToString(); | ||
Bit3.Text = bits[3].ToString(); | ||
Bit2.Text = bits[2].ToString(); | ||
Bit1.Text = bits[1].ToString(); | ||
Bit0.Text = bits[0].ToString(); | ||
} | ||
|
||
private static int[] GetBinaryFromByte(byte value) | ||
{ | ||
string s = Convert.ToString(value, 2); | ||
int[] bits = s.PadLeft(8, '0') | ||
.Select(c => int.Parse(c.ToString())) | ||
.ToArray(); | ||
|
||
Array.Reverse(bits); | ||
return bits; | ||
} | ||
|
||
public void Clear() | ||
{ | ||
Bit7.Text = "-"; | ||
Bit6.Text = "-"; | ||
Bit5.Text = "-"; | ||
Bit4.Text = "-"; | ||
Bit3.Text = "-"; | ||
Bit2.Text = "-"; | ||
Bit1.Text = "-"; | ||
Bit0.Text = "-"; | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.