コード例 #1
0
        public void Initialise_InitialisesRegisters()
        {
            // Arrange
            var registerBank = new RegisterBank {
                V = new byte[] { 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf }
            };

            // Act
            registerBank.Initialise();

            // Assert
            Assert.AreEqual(16, registerBank.V.Length);
            Assert.AreEqual(0, registerBank.V[0x00]);
            Assert.AreEqual(0, registerBank.V[0x01]);
            Assert.AreEqual(0, registerBank.V[0x02]);
            Assert.AreEqual(0, registerBank.V[0x03]);
            Assert.AreEqual(0, registerBank.V[0x04]);
            Assert.AreEqual(0, registerBank.V[0x05]);
            Assert.AreEqual(0, registerBank.V[0x06]);
            Assert.AreEqual(0, registerBank.V[0x07]);
            Assert.AreEqual(0, registerBank.V[0x08]);
            Assert.AreEqual(0, registerBank.V[0x09]);
            Assert.AreEqual(0, registerBank.V[0x0a]);
            Assert.AreEqual(0, registerBank.V[0x0b]);
            Assert.AreEqual(0, registerBank.V[0x0c]);
            Assert.AreEqual(0, registerBank.V[0x0d]);
            Assert.AreEqual(0, registerBank.V[0x0e]);
            Assert.AreEqual(0, registerBank.V[0x0f]);
        }
コード例 #2
0
        public IHttpActionResult PostRegisterBank(RegisterBank registerBank)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            int temp = (int)db.sp_check(registerBank.username).FirstOrDefault();

            if (temp == 0)
            {
                db.sp_InsertEMICard(registerBank.username);
            }

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (RegisterBankExists(registerBank.username))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = registerBank.username }, registerBank));
        }
コード例 #3
0
        public IHttpActionResult PostRegisterBank(RegisterBank registerBank)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.RegisterBank.Add(registerBank);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (RegisterBankExists(registerBank.username))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = registerBank.username }, registerBank));
        }
コード例 #4
0
        public IHttpActionResult PutRegisterBank(string id, RegisterBank registerBank)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != registerBank.username)
            {
                return(BadRequest());
            }

            db.sp_updatepassword(id, registerBank.Password);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!RegisterBankExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #5
0
 internal ShaderPassVertexShaderConstantBlockBase(BinaryReader binaryReader)
 {
     this.sourceParameter     = binaryReader.ReadStringID();
     this.scaleByTextureStage = (ScaleByTextureStage)binaryReader.ReadInt16();
     this.registerBank        = (RegisterBank)binaryReader.ReadInt16();
     this.registerIndex       = binaryReader.ReadInt16();
     this.componentMask       = (ComponentMask)binaryReader.ReadInt16();
 }
コード例 #6
0
 public TransferController(IUnitOfWork repos, ITransferDispatcher dispatcher, ICreditCommand command, RegisterBank registration, ILogger <TransferController> logger)
 {
     _repos        = repos;
     _dispatcher   = dispatcher;
     _command      = command;
     _registration = registration;
     _logger       = logger;
     _accountId    = 1;
 }
コード例 #7
0
        public IHttpActionResult GetRegisterBank(string id)
        {
            RegisterBank registerBank = db.RegisterBank.Find(id);

            if (registerBank == null)
            {
                return(NotFound());
            }

            return(Ok(registerBank));
        }
コード例 #8
0
        public void Initialise_InitialisesStack()
        {
            // Arrange
            var registerBank = new RegisterBank();

            // Act
            registerBank.Initialise();

            // Assert
            Assert.AreEqual(0, registerBank.Stack.Count);
        }
コード例 #9
0
        public void Initialise_InitialisesStackPointer()
        {
            // Arrange
            var registerBank = new RegisterBank();

            // Act
            registerBank.Initialise();

            // Assert
            Assert.AreEqual(0xfa0, registerBank.SP);
        }
コード例 #10
0
        public void Initialise_InitialisesProgramCounter()
        {
            // Arrange
            var registerBank = new RegisterBank();

            // Act
            registerBank.Initialise();

            // Assert
            Assert.AreEqual(0x200, registerBank.PC);
        }
コード例 #11
0
        public void Initialise_InitialisesKey()
        {
            // Arrange
            var registerBank = new RegisterBank {
                Key = 0x1
            };

            // Act
            registerBank.Initialise();

            // Assert
            Assert.AreEqual(0, registerBank.Key);
        }
コード例 #12
0
        public static IApplicationBuilder UseAutoconfig(this IApplicationBuilder app)
        {
            RegisterBank = app.ApplicationServices.GetService <RegisterBank>();

            var life = app.ApplicationServices.GetService <IApplicationLifetime>();

            life.ApplicationStarted.Register(OnStarted);

            //press Ctrl+C to reproduce if your app runs in Kestrel as a console app
            life.ApplicationStopping.Register(OnStopping);

            return(app);
        }
コード例 #13
0
        public void Initialise_InitialisesI()
        {
            // Arrange
            var registerBank = new RegisterBank {
                I = 0xfff
            };

            // Act
            registerBank.Initialise();

            // Assert
            Assert.AreEqual(0, registerBank.I);
        }
コード例 #14
0
        public void Initialise_InitialisesKeySound()
        {
            // Arrange
            var registerBank = new RegisterBank {
                Sound = 0xf
            };

            // Act
            registerBank.Initialise();

            // Assert
            Assert.AreEqual(0, registerBank.Sound);
        }
コード例 #15
0
        public void Initialise_InitialisesDelay()
        {
            // Arrange
            var registerBank = new RegisterBank {
                Delay = 0xf
            };

            // Act
            registerBank.Initialise();

            // Assert
            Assert.AreEqual(0, registerBank.Delay);
        }
コード例 #16
0
        public void Initialise_InitialisesKeyPressed()
        {
            // Arrange
            var registerBank = new RegisterBank {
                KeyPressed = true
            };

            // Act
            registerBank.Initialise();

            // Assert
            Assert.AreEqual(false, registerBank.KeyPressed);
        }
コード例 #17
0
        public IHttpActionResult DeleteRegisterBank(string id)
        {
            RegisterBank registerBank = db.RegisterBank.Find(id);

            if (registerBank == null)
            {
                return(NotFound());
            }

            db.Delete_EMIDetails(id);
            db.SaveChanges();

            return(Ok(registerBank));
        }
コード例 #18
0
        protected override void OnPaint(PaintEventArgs e)
        {
            this.OnPaintBackground(e);
            if (_debugger == null)
            {
                return;
            }
            if (_debugger.DebugHost.CpuHook == null)
            {
                return;
            }

            e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit;

            int x = 2;
            int y = 2;

            Brush labelBrush = (this.Enabled == true) ? _labelFontBrush : _disabledFontBrush;
            Brush valueBrush = (this.Enabled == true) ? _valueFontBrush : _disabledFontBrush;

            CoreState state = _debugger.DebugHost.CpuHook.GetCoreState(0);

            // PC
            e.Graphics.DrawString("PC", _font, labelBrush, x, y, _stringFormat);
            e.Graphics.DrawString(state.ProgramCounter.ToString("X8"), _font, valueBrush, x + _labelWidth + 3, y, _stringFormat);
            y += _lineHeight;

            RegisterType mode = RegisterType.General;

            switch (mode)
            {
            case RegisterType.General:
            {
                RegisterBank bank = RegisterBanks.General;
                for (int n = 1; n < 32; n++)
                {
                    Register reg = bank.Registers[n];

                    // Label
                    e.Graphics.DrawString(reg.Name, _font, labelBrush, x, y, _stringFormat);

                    // Value
                    string value = state.GeneralRegisters[n].ToString("X8");
                    e.Graphics.DrawString(value, _font, valueBrush, x + _labelWidth + 3, y, _stringFormat);

                    y += _lineHeight;
                }

                // LO
                e.Graphics.DrawString("$lo", _font, labelBrush, x, y, _stringFormat);
                e.Graphics.DrawString(state.Lo.ToString("X8"), _font, valueBrush, x + _labelWidth + 3, y, _stringFormat);
                y += _lineHeight;

                // HI
                e.Graphics.DrawString("$hi", _font, labelBrush, x, y, _stringFormat);
                e.Graphics.DrawString(state.Hi.ToString("X8"), _font, valueBrush, x + _labelWidth + 3, y, _stringFormat);
                y += _lineHeight;
            }
            break;

            case RegisterType.Fpu:
            {
                // Control register
                e.Graphics.DrawString("fcr", _font, labelBrush, x, y, _stringFormat);
                e.Graphics.DrawString(state.FpuControlRegister.ToString("X8"), _font, valueBrush, x + _labelWidth + 3, y, _stringFormat);
                y += _lineHeight;

                // Condition bit
                e.Graphics.DrawString("fc", _font, labelBrush, x, y, _stringFormat);
                e.Graphics.DrawString(state.FpuConditionBit.ToString(), _font, valueBrush, x + _labelWidth + 3, y, _stringFormat);
                y += _lineHeight;

                // Registers
                RegisterBank bank = RegisterBanks.Fpu;
                for (int n = 0; n < 32; n++)
                {
                    Register reg = bank.Registers[n];

                    // Label
                    e.Graphics.DrawString(reg.Name, _font, labelBrush, x, y, _stringFormat);

                    // Value
                    string value = state.FpuRegisters[n].ToString();
                    e.Graphics.DrawString(value, _font, valueBrush, x + _labelWidth + 3, y, _stringFormat);

                    y += _lineHeight;
                }
            }
            break;

            case RegisterType.Vfpu:
                break;
            }
        }