예제 #1
0
 public static void SwitchPrgTo(RegisterA a)
 {
     //Carry.Clear();
     Temp[0].Set(A);
     Bank.And(0b11100000).Or(Temp[0]);
     GoSub(_SwitchBanks);
 }
예제 #2
0
 public static void SwitchChrTo(RegisterA a)
 {
     Carry.Clear();
     A.ROL().ROL().ROL().ROL().ROL();
     Temp[0].Set(A);
     Bank.And(0b00011111).ADC(Temp[0]);
     GoSub(_SwitchBanks);
 }
예제 #3
0
 public void Push(RegisterA a)
 {
     if (!_isWriting)
     {
         throw new Exception("Push can only be used within a LiveQueue.Write() block");
     }
     Values[_indexReg].Set(a);
     _indexReg.Inc();
 }
예제 #4
0
 public RegisterA MoveRight(RegisterA a = null)
 {
     if (a == null)
     {
         Index.Set(z => z.Add(1));
     }
     else
     {
         Index.Set(z => z.Add(a));
     }
     return(A);
 }
예제 #5
0
 public RegisterA MoveLeft(RegisterA a = null)
 {
     if (a == null)
     {
         Index.Set(z => z.Subtract(1));
     }
     else
     {
         Index.Set(z => z.Subtract(a));
     }
     return(A);
 }
예제 #6
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);
 }
예제 #7
0
        public static RegisterA Divide(this RegisterA a, U8 v)
        {
            switch ((int)v)
            {
            case 2:
                return(DivideByTwo());

            case 4:
                return(DivideByFour());

            case 8:
                return(DivideByEight());

            case 16:
                return(DivideBySixteen());

            case 32:
                return(DivideByThirtyTwo());
            }
            throw new NotImplementedException();
        }
예제 #8
0
        public static RegisterA Multiply(this RegisterA a, U8 n)
        {
            switch ((int)n)
            {
            case 2:
                Carry.Clear();
                //return A.RotateLeft();
                return(A.ASL());                        //no need to CLC

            case 4:
                return(A.Multiply(2).Multiply(2));

            case 8:
                return(A.Multiply(4).Multiply(2));

            case 16:
                return(A.Multiply(8).Multiply(2));

            default: throw new NotImplementedException();
            }
        }
예제 #9
0
 public override void setValue(int value)
 {
     this.value |= RegisterA.getNewCorrectValue(value) == 0;
 }
예제 #10
0
 public static RegisterA Abs(this RegisterA _)
 {
     If.True(A.IsNegative, () => A.Xor(0xFF).Add(1));
     return(A);
 }
예제 #11
0
 public static RegisterA Negate(RegisterA _)
 {
     A.Xor(0xFF);
     Carry.Set();
     return(A.ADC(0));
 }
예제 #12
0
 public static void SwitchTo(RegisterA a)
 {
     GoSub(_SwitchBanks);
 }