Esempio n. 1
0
 /// <summary>
 /// Call this after setting Width and Height. It determines the last index in the grid, so iteration is reduced.
 /// </summary>
 public void UpdateMax()
 {
     Comment("ByteGrid.Max = ByteGrid.Width * ByteGrid.Height");
     Max.Set(0);
     Loop.Descend_Post(X.Set(Height), _ => {
         Max.Set(z => z.Add(Width));
     });
 }
Esempio n. 2
0
        private void UpdateController2()
        {
            X.Set(_index);
            _gamepads[X].StatePrev.Set(_gamepads[X].State);
            Loop.Descend_Post(Y.Set(8), _ => {
                A.Set(NES.Controller.Two).LSR();
                _gamepads[X].State.SetROL();
            });

            _gamepads[X].JustReleased.Set(_gamepads[X].State.Xor(0xFF).And(_gamepads[X].StatePrev));
            _gamepads[X].JustPressed.Set(_gamepads[X].StatePrev.Xor(0xFF).And(_gamepads[X].State));
        }
Esempio n. 3
0
 public void Decompress(Action <RegisterA> block)
 {
     _temp.Set(TempPtr0[Y.Set(0)]);
     Loop.AscendWhile(Y.Increment(), () => Y.LessThan(_temp), _ => {
         Y.State.Unsafe(() => {
             X.Set(A.Set(TempPtr0[Y]));
             Y.Increment();
             Loop.Descend_Post(X, _ => {
                 block(A.Set(TempPtr0[Y]));
             });
         });
     });
 }
Esempio n. 4
0
 public RegisterA MoveDown(RegisterA a = null)
 {
     if (a == null)
     {
         Index.Set(z => z.Add(Width));
     }
     else
     {
         Loop.Descend_Post(X.Set(a), _ => {
             Index.Set(z => z.Add(Width));
         });
     }
     return(A);
 }
Esempio n. 5
0
 private void Handler()
 {
     _liveQueue.Unsafe_Pop(Y);
     X.Set(_liveQueue.Unsafe_Peek(Y));             //Number of bytes of data
     Loop.While_Pre(() => X.NotEquals(VRamQueue.Op.NOP), _ => {
         _liveQueue.Unsafe_Pop(Y);
         A.Set(_liveQueue.Unsafe_Peek(Y));
         Loop.Descend_Post(X, _ => {
             NES.PPU.Data.Set(A);
         });
         _liveQueue.Unsafe_Pop(Y);
         X.Set(_liveQueue.Unsafe_Peek(Y));
     });
     GoTo(_executeLoopContinue);
 }
        public void Decompress(Action <RegisterA> block)
        {
            U8 compressionIndicator = 255;

            _temp.Set(TempPtr0[Y.Set(0)]);
            Loop.AscendWhile(Y.Increment(), () => Y.LessThan(_temp), _ => {
                If.Block(c => c
                         .True(() => A.Set(TempPtr0[Y]).Equals(compressionIndicator), () => {
                    Y.State.Unsafe(() => {
                        Y.Increment();
                        X.Set(A.Set(TempPtr0[Y]));
                        Y.Increment();
                        Loop.Descend_Post(X, _ => block(A.Set(TempPtr0[Y])));
                    });
                })
                         .Else(() => block(A.Set(TempPtr0[Y])))
                         );
            });
        }
Esempio n. 7
0
        private void Handler()
        {
            _liveQueue.Unsafe_Pop(Y);
            TempPtr0.Lo.Set(_liveQueue.Unsafe_Peek(Y));
            _liveQueue.Unsafe_Pop(Y);
            TempPtr0.Hi.Set(_liveQueue.Unsafe_Peek(Y));
            _liveQueue.Unsafe_Pop(Y);
            X.Set(_liveQueue.Unsafe_Peek(Y));             //Number of bytes of data

            Stack.Preserve(Y, () => {
                Y.Set(0);
                Loop.Descend_Post(X, _ => {
                    NES.PPU.Data.Set(TempPtr0[Y]);
                    Y.Increment();
                });
            });

            GoTo(_executeLoopContinue);
        }
Esempio n. 8
0
        private void UpdateController()
        {
            X.Set(_index);
            _gamepads[X].StatePrev.Set(_gamepads[X].State);
            Loop.Descend_Post(Y.Set(8), _ => {
                //If(	Option(() => _index.LessThan(2), () => {
                //		A.Set(NES.Controller.One).LogicalShiftRight();
                //	}),
                //	Default(() => {
                //		A.Set(NES.Controller.One).LogicalShiftRight();
                //	})
                //)

                A.Set(NES.Controller.One).LSR();
                _gamepads[X].State.SetROL();
            });

            _gamepads[X].JustReleased.Set(_gamepads[X].State.Xor(0xFF).And(_gamepads[X].StatePrev));
            _gamepads[X].JustPressed.Set(_gamepads[X].StatePrev.Xor(0xFF).And(_gamepads[X].State));
        }
        private void Handler()
        {
            _liveQueue.Unsafe_Pop(Y);
            _ptrRomStart.Lo.Set(_liveQueue.Unsafe_Peek(Y));
            _liveQueue.Unsafe_Pop(Y);
            _ptrRomStart.Hi.Set(_liveQueue.Unsafe_Peek(Y));
            _liveQueue.Unsafe_Pop(Y);
            A.Set(_liveQueue.Unsafe_Peek(Y));             //Number of bytes of data

            Loop.While_Pre(() => A.NotEquals(VRamQueue.Op.NOP), _ => { });

            Stack.Preserve(Y, () => {
                Y.Set(0);
                Loop.Descend_Post(X, _ => {
                    NES.PPU.Data.Set(TempPtr0[Y]);
                    Y.Increment();
                });
            });

            GoTo(_executeLoopContinue);
        }
Esempio n. 10
0
        public static void RLEDecompress(/*Action dataAction,*/ VByte temp, Action <RegisterA> block)
        {
            //var lbl = LabelFor(dataAction);
            //TempPtr0.PointTo(lbl);
            byte compressionIndicator = 255;
            var  length = temp.Set(TempPtr0[Y.Set(0)]);

            Loop.AscendWhile(Y.Increment(), () => Y.LessThan(length), _ => {
                If.Block(c => c
                         .True(() => A.Set(TempPtr0[Y]).Equals(compressionIndicator), () => {
                    Y.State.Unsafe(() => {
                        Y.Increment();
                        X.Set(A.Set(TempPtr0[Y]));
                        Y.Increment();
                        Loop.Descend_Post(X, _ => block(A.Set(TempPtr0[Y])));
                    });
                })
                         .Else(() => block(A.Set(TempPtr0[Y])))
                         );
            });
        }