public void ReturnsTrueWhenAPageBoundaryWasCrossed(AddressingMode mode, RegisterName register) { model.GetRegister(register).SetValue(0x10); Assert.That(ArgumentUtils.CrossesPageBoundary(model, mode, 0x10F0), Is.True, "A page boundary was crossed, but not noticed."); }
public Mv(RegisterName toLoad, RegisterName destination, RegisterName ignored = 0) { // we re-use the 3 register format and having 1 ignored param makes the parser easier. this.toLoad = toLoad; this.destination = destination; }
public void ReturnFromRegistration() { HeadingText.GetComponent <TextMeshProUGUI>().text = "User Login"; LoginButton.SetActive(true); LoginButtonCover.SetActive(true); UserLoginText.SetActive(true); PasswordText.SetActive(true); RegisterButton.SetActive(true); //RegisterName, RegisterPassword, RegisterLocation, RegisterAge, SubmitCoverButton, SubmitButton; RegisterName.SetActive(false); RegisterPassword.SetActive(false); RegisterLocation.SetActive(false); RegisterAge.SetActive(false); SubmitCoverButton.SetActive(false); SubmitButton.SetActive(false); Registering = false; if (netManager) { if (netManager.IsConnectedToServer()) { netManager.AttemptAccountCreation(RegisterName.GetComponent <TMP_InputField>().text, RegisterPassword.GetComponent <TMP_InputField>().text); } } }
private Register(RegisterName register, RegisterFlags flags, RegisterSize size, RegisterName?containing = null) { RegisterName = register; Flags = flags; Size = size; Containing = containing; }
// Update is called once per frame void Update() { if (!loggingIn && !loggedIn && !Registering) { if (UserLoginText.GetComponent <TMP_InputField>().text != "" && PasswordText.GetComponent <TMP_InputField>().text != "") { LoginButton.SetActive(true); LoginButtonCover.SetActive(false); } else { LoginButton.SetActive(false); LoginButtonCover.SetActive(true); } } if (Registering) { if (RegisterName.GetComponent <TMP_InputField>().text != "" && RegisterPassword.GetComponent <TMP_InputField>().text != "" && RegisterAge.GetComponent <TMP_InputField>().text != "" && RegisterLocation.GetComponent <TMP_InputField>().text != "") { SubmitCoverButton.SetActive(false); SubmitButton.SetActive(true); } else { SubmitCoverButton.SetActive(true); SubmitButton.SetActive(false); } } if (loggingIn) { if (loginConfirmed) { fakeLoginCount++; if (fakeLoginCount > 180) { LoggedIn(); loggingIn = false; fakeLoginCount = 0; } } } if (loginFailed) { errorCount++; if (errorCount > 250) { loginFailed = false; errorCount = 0; ErrorMessageBacking.SetActive(false); ErrorMessageText.SetActive(false); } } }
public void ReturnsFalseWhenAPageBoundaryWasNotCrossed(AddressingMode mode, RegisterName register) { model.GetRegister(register).SetValue(0x10); Assert.That(ArgumentUtils.CrossesPageBoundary(model, mode, 0x10E0), Is.False, "We reported incorrectly that a page boundary was crossed."); }
public NthInstruction(int index, RegisterName registerName) { // todo1[ak] check args this.Index = index; this.RegisterName = registerName; }
public void ForZeropageIndexedMode(AddressingMode mode, RegisterName register) { memory.SetValue(0x0070, 0x8); model.GetRegister(register).SetValue(0x10); Assert.That(ArgumentUtils.ArgumentFor(model, memory, mode, 0x60), Is.EqualTo(0x8)); }
private void UpdateForPasteWait(WpfTextChangedEventArgs e) { Debug.Assert(InPasteWait); var command = _margin.CommandLineTextBox.Text ?? ""; if (e.Changes.Count == 1 && command.Length > 0) { var change = e.Changes.First(); if (change.AddedLength == 1) { // If we are in a paste wait context then attempt to complete it by passing on the // typed char to _vimBuffer. This will process it as the register var c = command[change.Offset]; var keyInput = KeyInputUtil.CharToKeyInput(c); _vimBuffer.Process(keyInput); // Now we need to update the command line. During edits the controller is responsible // for manually updating the command line state. Also we have to keep the caret postion // correct var name = RegisterName.OfChar(c); var toPaste = name.IsSome() ? _vimBuffer.GetRegister(name.Value).StringValue : string.Empty; EndPasteWait(toPaste); return; } } // The buffer was in a paste wait but the UI isn't in sync for completing // the operation. Just pass Escape down to the buffer so it will cancel out // of paste wait and go back to a known state _vimBuffer.Process(KeyInputUtil.EscapeKey); }
public void ReturnsTheProperNumberOfCyclesWhenNotCrossingPageBoundary( AddressingMode mode, RegisterName register) { model.GetRegister(register).SetValue(0x10); Assert.That(executor.Execute(opcode, mode, 0x10E0), Is.EqualTo(InstructionTestDouble.NumberOfCycles)); }
public void AllChars1() { foreach (var cur in RegisterNameUtil.RegisterNameChars) { var res = RegisterName.OfChar(cur); Assert.True(res.IsSome()); } }
internal static CommandData CreateCommandData( int?count = null, RegisterName name = null) { return(new CommandData( FSharpOption.CreateForNullable(count), FSharpOption.CreateForReference(name))); }
public void ModifyOtherThanX0Test() { var enums = new RegisterName[] { RegisterName.x1, RegisterName.x2, RegisterName.x3, RegisterName.x4, RegisterName.x5, RegisterName.x6, RegisterName.x7, RegisterName.x8, RegisterName.x9, RegisterName.x10, RegisterName.x11, RegisterName.x12, RegisterName.x13, RegisterName.x14, RegisterName.x15, RegisterName.x16, RegisterName.x17, RegisterName.x18, RegisterName.x19, RegisterName.x20, RegisterName.x21, RegisterName.x22, RegisterName.x23, RegisterName.x24, RegisterName.x25, RegisterName.x26, RegisterName.x27, RegisterName.x28, RegisterName.x29, RegisterName.x30, RegisterName.x31, RegisterName.x32, }; // Write the values starting with 10 uint value = 10; int expectedValue = 10; foreach (var curValue in enums) { register.WriteUnsignedInt(curValue, value); value++; } // Now again read all of them again and verify if they are all different! foreach (var curValue in enums) { var content = register.ReadUnsignedInt(curValue); Assert.AreEqual(content, expectedValue); expectedValue++; } }
public MachineState DoOperation(RegisterName lhs, OperatorEffect operatorEffect, RegisterName rhs) { var newState = new MachineState(this); var result = DoOperation(Registers[lhs], operatorEffect, Registers[rhs]); newState.Registers[lhs] = result.Value; newState.ZeroFlag = result.ZeroFlag; return(newState); }
private void MovingFromConstValue() { RegisterName destReg = ((AssemblerCommand.RegName)currentOpRands[0]).Value; BitValue value = ((AssemblerCommand.ConstValue)currentOpRands[1]).Value; ((StatusRegister)Parent.registers[RegisterName.PS]).SetValue(value.IsNegative); Parent.registers[destReg].SetValue(value); }
private void MovingFromRegister() { RegisterName destReg = ((AssemblerCommand.RegName)currentOpRands[0]).Value; RegisterName sourceReg = ((AssemblerCommand.RegName)currentOpRands[1]).Value; ((StatusRegister)Parent.registers[RegisterName.PS]).SetValue(Parent.registers[sourceReg].GetValue().IsNegative); Parent.registers[destReg].SetValue(new BitValue(Parent.registers[sourceReg].GetValue())); }
public void SetRegisterValue_DeleteSingleLine() { var reg = _map.GetRegister('c'); _map.SetRegisterValue(reg, RegisterOperation.Delete, RegisterValue.OfString("foo bar", OperationKind.CharacterWise)); AssertRegister(reg, "foo bar", OperationKind.CharacterWise); AssertRegister(RegisterName.Unnamed, "foo bar", OperationKind.CharacterWise); AssertRegister(RegisterName.NewNumbered(NumberedRegister.Register_1), "foo bar", OperationKind.CharacterWise); AssertRegister(RegisterName.SmallDelete, "foo bar", OperationKind.CharacterWise); }
private static ushort IndexedIndirectAddressFor(ProgrammingModel model, Memory memory, RegisterName register, ushort operand) { var zeroPageAddress = OffsetAddressFor(model, register, operand); var effectiveAddressLow = memory.GetValue(zeroPageAddress); var effectiveAddressHi = memory.GetValue((ushort)(zeroPageAddress + 1)); return (ushort)(effectiveAddressHi << 8 | effectiveAddressLow); }
public void CanSetTheValueInRegister(RegisterName name) { const int expectedValue = 42; var registerBeforeSet = model.GetRegister(name); registerBeforeSet.SetValue(expectedValue); var registerAfterSet = model.GetRegister(name); Assert.That(registerAfterSet.GetValue(), Is.EqualTo(expectedValue)); }
public Register(RegisterName name, Word value, RegisterAccessRights internalRights = RegisterAccessRights.Read | RegisterAccessRights.Write, RegisterAccessRights externalRights = RegisterAccessRights.Read | RegisterAccessRights.Write) { Name = name; InternalRights = internalRights; ExternalRights = externalRights; Value = value; }
public static Payload MakeRegisterNamePayload(string registrant, string name, long registrationFee) { var registerName = new RegisterName { Registrant = registrant.FromHexString(), Name = name, RegistrationFee = registrationFee }; return(TransactionFactory.MakePayload(registerName, PayloadType.RegisterName)); }
/// <summary> /// Calculates hash code based on the contained data. /// </summary> /// <returns>The hash code of the object.</returns> public override int GetHashCode() { return (DisplayName.GetHashCode() + Username.GetHashCode() + RegisterName.GetHashCode() + Password.GetHashCode() + Domain.GetHashCode() + Proxy.GetHashCode() + RegRequired.GetHashCode()); }
private void MakeNegation() { RegisterName destReg = ((AssemblerCommand.RegName)currentOpRands[0]).Value; BitValue value = new BitValue(Parent.registers[destReg].GetValue()); value.Negate(); Parent.registers[destReg].SetValue(value); ((StatusRegister)Parent.registers[RegisterName.PS]).SetValue(value.IsNegative); }
private void AddingWithRegister() { RegisterName destReg = ((AssemblerCommand.RegName)currentOpRands[0]).Value; RegisterName sourceReg = ((AssemblerCommand.RegName)currentOpRands[1]).Value; var curDestValue = Parent.registers[destReg].GetValue(); curDestValue.Add(Parent.registers[sourceReg].GetValue()); ((StatusRegister)Parent.registers[RegisterName.PS]).SetValue(curDestValue.IsNegative); Parent.registers[destReg].SetValue(curDestValue); }
public void ForSpan_DeleteToBlackHole() { _map.GetRegister(RegisterName.Blackhole).UpdateValue("", OperationKind.CharacterWise); _map.GetRegister(RegisterName.NewNumbered(NumberedRegister.Number1)).UpdateValue("hey", OperationKind.CharacterWise); var namedReg = _map.GetRegister('c'); _map.SetRegisterValue(namedReg, RegisterOperation.Yank, new RegisterValue("foo bar", OperationKind.CharacterWise)); _map.SetRegisterValue(_map.GetRegister(RegisterName.Blackhole), RegisterOperation.Delete, new RegisterValue("foo bar", OperationKind.CharacterWise)); AssertRegister(namedReg, "foo bar", OperationKind.CharacterWise); AssertRegister(RegisterName.Unnamed, "foo bar", OperationKind.CharacterWise); AssertRegister(RegisterName.NewNumbered(NumberedRegister.Number1), "hey", OperationKind.CharacterWise); AssertRegister(RegisterName.Blackhole, "", OperationKind.CharacterWise); }
public StoreOff(RegisterName source, short offset, RegisterName destination) { var bytes = new byte[4]; var shortBytes = BitConverter.GetBytes(offset); for (int i = 0; i < shortBytes.Length; i++) bytes[i] = shortBytes[i]; var bytesAsUnsigned = BitConverter.ToUInt32(bytes, 0); this.source = source; this.offset = offset; this.offsetUnsigned = bytesAsUnsigned; this.destination = destination; }
public void StartRegistration() { LoginButton.SetActive(false); LoginButtonCover.SetActive(false); UserLoginText.SetActive(false); PasswordText.SetActive(false); HeadingText.GetComponent <TextMeshProUGUI>().text = "Register New Profile"; RegisterButton.SetActive(false); //RegisterName, RegisterPassword, RegisterLocation, RegisterAge, SubmitCoverButton, SubmitButton; RegisterName.SetActive(true); RegisterPassword.SetActive(true); RegisterLocation.SetActive(true); RegisterAge.SetActive(true); SubmitCoverButton.SetActive(true); Registering = true; }
public void ReadTest1() { var enums = new RegisterName[] { RegisterName.x0, RegisterName.x1, RegisterName.x2, RegisterName.x3, RegisterName.x4, RegisterName.x5, RegisterName.x6, RegisterName.x7, RegisterName.x8, RegisterName.x9, RegisterName.x10, RegisterName.x11, RegisterName.x12, RegisterName.x13, RegisterName.x14, RegisterName.x15, RegisterName.x16, RegisterName.x17, RegisterName.x18, RegisterName.x19, RegisterName.x20, RegisterName.x21, RegisterName.x22, RegisterName.x23, RegisterName.x24, RegisterName.x25, RegisterName.x26, RegisterName.x27, RegisterName.x28, RegisterName.x29, RegisterName.x30, RegisterName.x31, RegisterName.x32, }; // The initial value for all register is zero! foreach (var curValue in enums) { var initValue = register.ReadUnsignedInt(curValue); Assert.AreEqual(initValue, 0); } }
public MachineState DoOperation(RegisterName lhs, Int32 index, OperatorEffect operatorEffect, AbstractValue rhs) { var newState = new MachineState(this); switch (operatorEffect) { case OperatorEffect.Assignment: case OperatorEffect.Cmp: { var result = DoOperation(Registers[lhs].PointsTo[index], operatorEffect, rhs); newState.Registers[lhs].PointsTo[index] = result.Value; newState.ZeroFlag = result.ZeroFlag; break; } } return(newState); }
public MachineState DoOperation(RegisterName lhs, OperatorEffect operatorEffect, AbstractValue rhs) { var newState = new MachineState(this); if (Registers[lhs].IsPointer && operatorEffect != OperatorEffect.Assignment) { var newBuffer = Registers[lhs].PointsTo.DoOperation(operatorEffect, rhs); newState.Registers[lhs] = new AbstractValue(newBuffer); } else { var result = DoOperation(Registers[lhs], operatorEffect, rhs); newState.Registers[lhs] = result.Value; newState.ZeroFlag = result.ZeroFlag; } return(newState); }
/// <summary> /// Equality comparer. /// </summary> /// <param name="obj">Meant to be other PhoneLineInfo object.</param> /// <returns>Returns true if the two objects are equal, otherwise false.</returns> public override bool Equals(object obj) { if (obj == this) { return(true); } PhoneLineInfo other = obj as PhoneLineInfo; if (other == null) { return(false); } return (DisplayName.Equals(other.DisplayName) && Username.Equals(other.Username) && RegisterName.Equals(other.RegisterName) && Password.Equals(other.Password) && Domain.Equals(other.Domain) && Proxy.Equals(other.Proxy) && RegRequired.Equals(other.RegRequired)); }
public static void SetupCommandMotion <T>(this Mock <ICommandUtil> commandUtil, int?count = null, RegisterName registerName = null) where T : NormalCommand { var realCount = FSharpOption.CreateForNullable(count); var realName = FSharpOption.CreateForReference(registerName); var commandData = new CommandData(realCount, realName); commandUtil .Setup(x => x.RunCommand(It.Is <Command>(c => c.IsNormalCommand && c.AsNormalCommand().Item1 is T))) .Returns(CommandResult.NewCompleted(ModeSwitch.NoSwitch)) .Verifiable(); }
void AssertRegister(RegisterName name, string value, OperationKind kind) { AssertRegister(_registerMap.GetRegister(name), value, kind); }
public Register GetRegister(RegisterName name) { throw new NotImplementedException(); }
private void SetLastCommand(NormalCommand command, int? count = null, RegisterName name = null) { var data = VimUtil.CreateCommandData(count, name); var storedCommand = StoredCommand.NewNormalCommand(command, data, CommandFlags.None); _vimData.LastCommand = FSharpOption.Create(storedCommand); }
public Register GetRegister(RegisterName name) { throw new NotImplementedException(); }
public MachineState DoOperation(RegisterName lhs, OperatorEffect operatorEffect, AbstractValue rhs) { var newState = new MachineState(this); if (Registers[lhs].IsPointer && operatorEffect != OperatorEffect.Assignment) { var newBuffer = Registers[lhs].PointsTo.DoOperation(operatorEffect, rhs); newState.Registers[lhs] = new AbstractValue(newBuffer); } else { var result = DoOperation(Registers[lhs], operatorEffect, rhs); newState.Registers[lhs] = result.Value; newState.ZeroFlag = result.ZeroFlag; } return newState; }
public CarInstruction(RegisterName registerName) { this.RegisterName = registerName; }
public AbstractValue this[RegisterName index] { get { return registers[(Int32)index]; } set { registers[(Int32)index] = value; } }
public Register GetRegister(RegisterName name) { return registers[name]; }
public Div(RegisterName arg1, RegisterName arg2, RegisterName result) { this.result = result; this.arg2 = arg2; this.arg1 = arg1; }
public Store(uint destination, RegisterName source) { this.source = source; this.destination = destination; }
public TestInstruction(RegisterName registerName) { // todo1[ak] check args this.RegisterName = registerName; }
public byte[] GetBytes(RegisterName name) { return BitConverter.GetBytes(registers[name]); }
private byte[] Resolve(VmState state, int length, RegisterName source) { var bytes = BitConverter.GetBytes(state.registers[source]); return bytes; }
public uint ReadUnsignedInt(RegisterName name) { var index = ToInt(name); return(ReadUnsignedInt(index)); }
public MachineState DoOperation(RegisterName lhs, OperatorEffect operatorEffect, RegisterName rhs) { var newState = new MachineState(this); var result = DoOperation(Registers[lhs], operatorEffect, Registers[rhs]); newState.Registers[lhs] = result.Value; newState.ZeroFlag = result.ZeroFlag; return newState; }
public void WriteUnsignedInt(RegisterName name, uint value) { var index = ToInt(name); WriteUnsignedInt(index, value); }
public MachineState DoOperation(RegisterName lhs, Int32 index, OperatorEffect operatorEffect, AbstractValue rhs) { var newState = new MachineState(this); switch (operatorEffect) { case OperatorEffect.Assignment: case OperatorEffect.Cmp: { var result = DoOperation(Registers[lhs].PointsTo[index], operatorEffect, rhs); newState.Registers[lhs].PointsTo[index] = result.Value; newState.ZeroFlag = result.ZeroFlag; break; } } return newState; }
public Word this[RegisterName reg] { get { return(_registers[reg].Value); } set { _registers[reg].Value = value; } }
private static ushort OffsetAddressFor(ProgrammingModel model, RegisterName register, ushort operand) { return (ushort)(operand + model.GetRegister(register).GetValue()); }
public Shr(RegisterName target, RegisterName source, RegisterName result) { this.target = target; this.source = source; this.result = result; }
public void Register() { _runner.Run(@"""a"); Assert.True(_runner.HasRegisterName); Assert.Equal(RegisterName.OfChar('a').Value, _runner.RegisterName); }
public Load(uint source, RegisterName destination) { this.source = source; this.destination = destination; }
public Push(RegisterName toPush, RegisterName ignored = 0, RegisterName ignored2 = 0) { // we re-use the 3 register format and having 2 ignored params makes the parser easier. this.toPush = toPush; }
public MovInstruction(RegisterName to, object from) { this.To = to; this.From = from; }
public static void SetupCommandNormal(this Mock <ICommandUtil> commandUtil, NormalCommand normalCommand, int?count = null, RegisterName registerName = null) { var realCount = FSharpOption.CreateForNullable(count); var realName = FSharpOption.CreateForReference(registerName); var commandData = new CommandData(realCount, realName); var command = Command.NewNormalCommand(normalCommand, commandData); commandUtil .Setup(x => x.RunCommand(command)) .Returns(CommandResult.NewCompleted(ModeSwitch.NoSwitch)) .Verifiable(); }
public PushInstruction(RegisterName registerName) { this.RegisterName = registerName; }
public static void SetupCommandVisual(this Mock <ICommandUtil> commandUtil, VisualCommand visualCommand, int?count = null, RegisterName registerName = null, VisualSpan visualSpan = null) { var realCount = count.HasValue ? FSharpOption.Create(count.Value) : FSharpOption <int> .None; var realName = registerName != null?FSharpOption.Create(registerName) : FSharpOption <RegisterName> .None; var commandData = new CommandData(realCount, realName); if (visualSpan != null) { var command = Command.NewVisualCommand(visualCommand, commandData, visualSpan); commandUtil .Setup(x => x.RunCommand(command)) .Returns(CommandResult.NewCompleted(ModeSwitch.SwitchPreviousMode)) .Verifiable(); } else { commandUtil .Setup(x => x.RunCommand(It.Is <Command>(command => command.IsVisualCommand && command.AsVisualCommand().Item1.Equals(visualCommand) && command.AsVisualCommand().Item2.Equals(commandData)))) .Returns(CommandResult.NewCompleted(ModeSwitch.SwitchPreviousMode)) .Verifiable(); } }
public MvIm(uint toLoad, RegisterName destination) { this.toLoad = toLoad; this.destination = destination; }