This repository has been archived by the owner on Jul 6, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
MainPage.xaml
162 lines (155 loc) · 9.68 KB
/
MainPage.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<Page
x:Class="PIC_Simulator.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:PIC_Simulator"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<DataTemplate x:Key="ProcessorInstructionTemplate">
<StackPanel Orientation="Horizontal">
<ToggleButton IsChecked="{Binding IsBreakpoint, Mode=TwoWay}"/>
<TextBlock Text="{Binding LineNumber}" Width="30" Margin="10,0,0,0" />
<TextBlock Text="{Binding}" FontFamily="Lucida Console, Consolas, Monospace" Foreground="#FF1134D3"/>
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="GeneralInstructionTemplate">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding LineNumber}" Margin="30,0,0,0" Width="30" />
<TextBlock Text="{Binding}" FontFamily="Lucida Console, Consolas, Monospace" Foreground="#FF454545" />
</StackPanel>
</DataTemplate>
<local:InstructionTemplateSelector x:Key="InstructionTemplateSelector" ProcessorInstructionTemplate="{StaticResource ProcessorInstructionTemplate}" GeneralInstructionTemplate="{StaticResource GeneralInstructionTemplate}" />
<local:TimeToFrequencyConverter x:Key="TimeToFrequency" />
<local:StringFormatConverter x:Key="StringFormat" />
<local:FormatBinaryConverter x:Key="FormatBinary" />
</Page.Resources>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" Padding="{StaticResource ContentDialogPadding}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="0.3*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="0.7*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="3*"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Text="Register" Style="{StaticResource TitleTextBlockStyle}" />
<StackPanel Grid.Row="1" Grid.Column="0" Padding="{StaticResource TextControlThemePadding}">
<StackPanel Padding="{StaticResource TextControlThemePadding}">
<TextBlock Text="W"/>
<TextBlock Text="{x:Bind processor.Wreg, Mode=OneWay, Converter={StaticResource StringFormat}, ConverterParameter=0x\{0:X2\} }" />
</StackPanel>
<StackPanel Padding="{StaticResource TextControlThemePadding}">
<TextBlock Text="Status" />
<TextBlock Text="{x:Bind processor.memController.StatusRegister, Mode=OneWay, Converter={StaticResource FormatBinary} }" />
</StackPanel>
<StackPanel Padding="{StaticResource TextControlThemePadding}">
<TextBlock Text="PC" />
<TextBlock Text="{x:Bind processor.memController.PC, Mode=OneWay, Converter={StaticResource StringFormat}, ConverterParameter=0x\{0:X4\} }" />
</StackPanel>
</StackPanel>
<Pivot Grid.Row="0" Grid.RowSpan="2" Grid.Column="1">
<PivotItem Header="Speicher">
<GridView ItemsSource="{x:Bind processor.memController.Memory}" Grid.Row="1" Grid.Column="1">
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid MaximumRowsOrColumns="16" Orientation="Horizontal" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
</GridView>
</PivotItem>
<PivotItem Header="I/O">
<StackPanel Orientation="Horizontal">
<StackPanel Margin="0,0,50,0">
<TextBlock Text="Port A" />
<GridView ItemsSource="{x:Bind processor.memController.PortA, Mode=OneWay}" IsItemClickEnabled="True" IsDoubleTapEnabled="True" DoubleTapped="IORegister_FlipBit" Tag="PortA">
<GridView.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" />
</DataTemplate>
</GridView.ItemTemplate>
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid Orientation="Horizontal" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
</GridView>
<TextBlock Text="Tris A" />
<GridView ItemsSource="{x:Bind processor.memController.TrisA, Mode=OneWay}" IsItemClickEnabled="True" IsDoubleTapEnabled="True" DoubleTapped="IORegister_FlipBit" Tag="TrisA">
<GridView.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" />
</DataTemplate>
</GridView.ItemTemplate>
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid Orientation="Horizontal" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
</GridView>
</StackPanel>
<StackPanel>
<TextBlock Text="Port B" />
<GridView ItemsSource="{x:Bind processor.memController.PortB, Mode=OneWay}" IsItemClickEnabled="True" IsDoubleTapEnabled="True" DoubleTapped="IORegister_FlipBit" Tag="PortB">
<GridView.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" />
</DataTemplate>
</GridView.ItemTemplate>
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid Orientation="Horizontal" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
</GridView>
<TextBlock Text="Tris B" />
<GridView ItemsSource="{x:Bind processor.memController.TrisB, Mode=OneWay}" IsItemClickEnabled="True" IsDoubleTapEnabled="True" DoubleTapped="IORegister_FlipBit" Tag="TrisB">
<GridView.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" />
</DataTemplate>
</GridView.ItemTemplate>
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid Orientation="Horizontal" />
</ItemsPanelTemplate>
</GridView.ItemsPanel>
</GridView>
</StackPanel>
</StackPanel>
</PivotItem>
</Pivot>
<TextBlock Grid.Row="0" Grid.Column="2" Text="Prozessor" Style="{StaticResource TitleTextBlockStyle}" />
<StackPanel Grid.Row="1" Grid.Column="2" Padding="{StaticResource TextControlThemePadding}">
<TextBlock Text="Quarzfrequenz (MHz)" />
<TextBox ToolTipService.ToolTip="Es können beliebige Werte, auch Kommazahlen, eingetragen werden." x:Name="frequency" InputScope="Digits" TextAlignment="Right" Text="{x:Bind processor.Clock.Interval, Mode=TwoWay, Converter={StaticResource TimeToFrequency}}" />
<Slider Minimum="1" Maximum="20" TickPlacement="Outside" TickFrequency="1" Value="{Binding Text,ElementName=frequency,Mode=TwoWay}" IsThumbToolTipEnabled="False"/>
<TextBlock Text="Laufzeit" />
<TextBlock Text="{Binding Stopwatch}" />
</StackPanel>
<TextBlock Grid.Row="2" Grid.Column="2" Text="Stack" Style="{StaticResource TitleTextBlockStyle}" />
<ListView Grid.Row="3" Grid.Column="2" ItemsSource="{x:Bind processor.Stack}" />
<TextBlock Grid.Row="2" Text="Programmlisting" Style="{StaticResource TitleTextBlockStyle}" />
<ListView x:Name="SourcecodeListingView" ItemsSource="{Binding Sourcecode}" Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2" ItemTemplateSelector="{StaticResource InstructionTemplateSelector}" />
</Grid>
<Page.BottomAppBar>
<CommandBar>
<CommandBar.Content>
<TextBlock Text="PIC-Simulator" x:Name="statusbar" Margin="12,14" />
</CommandBar.Content>
<AppBarButton Icon="Play" Label="Start" IsEnabled="{Binding InverseControlButtonState}" Click="RunButton_Click" />
<AppBarButton Icon="Stop" Label="Stop" IsEnabled="{Binding ControlButtonState}" Click="StopButton_Click" />
<AppBarButton Icon="Forward" Label="Schritt" IsEnabled="{Binding InverseControlButtonState}" Click="StepButton_Click" />
<AppBarButton Icon="Undo" Label="Reset" IsEnabled="{Binding InverseControlButtonState}" Click="ResetButton_Click" />
<AppBarSeparator />
<AppBarButton Icon="OpenFile" Label="Listing öffnen" Click="OpenFileChooser_Click" />
<CommandBar.SecondaryCommands>
<AppBarButton Icon="Help" Label="Hilfe" Click="HelpButton_Click" />
</CommandBar.SecondaryCommands>
</CommandBar>
</Page.BottomAppBar>
</Page>