public static void CLRF(Data.Command com) { byte f = (byte)(com.GetLowByte() & 127); Data.SetRegister(Data.AddressResolution(f), 0); Data.SetRegisterBit(Data.Registers.STATUS, Data.Flags.Status.Z, true); }
/// <summary> /// Write result according to d bit (relative address) /// </summary> /// <param name="d"></param> /// <param name="f"></param> /// <param name="result"></param> private static void DirectionalWrite(byte d, byte f, byte result) { //save to w register if (d == 0) { Data.SetRegisterW(result); } //save to f address else if (d == 128) { Data.SetRegister(Data.AddressResolution(f), result); } }
/// <summary> /// Handles user hex edit in fileregister view /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FileRegister_CellEditEnding(object sender, System.Windows.Controls.DataGridCellEditEndingEventArgs e) { var editingTextBox = e.EditingElement as TextBox; string newValue = editingTextBox.Text; if (e.EditAction == DataGridEditAction.Commit) { if (newValue.Length <= 2) { try { byte b = (byte)int.Parse(newValue, System.Globalization.NumberStyles.HexNumber); editingTextBox.Text = b.ToString("X2"); int row = e.Row.GetIndex(); int column = e.Column.DisplayIndex; Data.SetRegister((byte)(row * 8 + column), b); UpdateUI(); if (row > 0) { FileRegister.CurrentCell = new DataGridCellInfo(FileRegister.Items[row - 1], FileRegister.Columns[column]); } } catch { e.Cancel = true; (sender as DataGrid).CancelEdit(DataGridEditingUnit.Cell); MessageBox.Show("Invalid hexadecimal value", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } else { e.Cancel = true; (sender as DataGrid).CancelEdit(DataGridEditingUnit.Cell); MessageBox.Show("Only one hexadecimal byte allowed", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } }
public static void MOVWF(Data.Command com) { byte f = (byte)(com.GetLowByte() & 127); Data.SetRegister(Data.AddressResolution(f), Data.GetRegisterW()); }
private void PortBChanged(object sender, NotifyCollectionChangedEventArgs e) { Data.SetRegister(Data.Registers.PORTB, Data.BoolArrayToByte(View.PortB.ToArray <bool>())); UpdateUI(); }
private void TrisAChanged(object sender, NotifyCollectionChangedEventArgs e) { Data.SetRegister(Data.Registers.TRISA, Data.BoolArrayToByte(View.TrisA.ToArray <bool>())); UpdateUI(); }