public void UpdateAttributeTableImmediately()
 {
     NES.PPU.SetHorizontalWrite();
     NES.PPU.SetAddress(0x23C0);
     Loop.AscendWhile(X.Set(0), () => X.NotEquals(Table.Length), _ => {
         NES.PPU.Data.Write(Table[X]);
     });
 }
Ejemplo n.º 2
0
 public void Push(VByte v)
 {
     X.Set(0);
     Loop.AscendWhile(X, () => X.NotEquals(Values.Length), loop => {
         If.True(() => Values[X].Equals(_clearVal), () => {
             Comment("Add action to the end of the queue");
             Values[X].Set(v);
             loop.Break();
         });
     });
 }
Ejemplo 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]));
             });
         });
     });
 }
Ejemplo n.º 4
0
 public void Pop()
 {
     Comment("Shift other actions left");
     X.Set(0);
     Loop.AscendWhile(X, () => X.NotEquals((U8)(Values.Length - 1)), _ => {
         //Get next value
         X.State.Unsafe(() => {                 //indicate X modification needs careful attention
             X.Inc();
             A.Set(Values[X]);                  //Store in current location
             X.Dec();
         });
         Values[X].Set(A);
     });
     Comment("Last command is empty");
     Values[X.Set(Values.Length - 1)].Set(_clearVal);
 }
Ejemplo n.º 5
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));

            Stack.Preserve(Y, () => {
                Y.Set(0);
                NES.PPU.SetAddress(NES.MemoryMap.Palette);
                Loop.AscendWhile(Y.Set(0), () => Y.NotEquals(32), _ => {
                    NES.PPU.Data.Set(TempPtr0[Y]);
                });
            });

            GoTo(_executeLoopContinue);
        }
Ejemplo n.º 6
0
        //TODO: handle either index in _indexReg
        public void PushRangeOnce(Action action)
        {
            var len = Length(action);

            if (len > 255)
            {
                throw new Exception("Block is too big, it must be 255 bytes or less.");
            }
            X.Set(WriteIndex);
            TempPtr0.PointTo(LabelFor(action));
            Loop.AscendWhile(Y.Set(0), () => Y.NotEquals((U8)len), _ => {
                Values[X].Set(TempPtr0[Y]);
                X.Inc();
            });
            Values[X].Set(_stopVal);
            WriteIndex.Set(X);
        }
        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])))
                         );
            });
        }
Ejemplo n.º 8
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])))
                         );
            });
        }