Ejemplo n.º 1
0
 public void randomiseRegisters()
 {
     for (int index = CMemory.HexToInt("83E4"); index <= CMemory.HexToInt("83EB"); ++index)
     {
         this.memory[index].signifBit = (byte)this.random.Next(15);
         this.memory[index].lowerBit  = (byte)this.random.Next(15);
     }
 }
Ejemplo n.º 2
0
 public CMemory(ref CPPI _PPI)
 {
     this.PPI             = _PPI;
     this.flagReg.S       = false;
     this.flagReg.Z       = false;
     this.flagReg.AC      = false;
     this.flagReg.P       = false;
     this.flagReg.C       = false;
     CMemory.MEM_SIZE     = CMemory.HexToInt("FFFF") + 1;
     CMemory.USER_MEM_ST  = CMemory.HexToInt("8000");
     CMemory.USER_MEM_END = CMemory.HexToInt("83C6");
     this.memory          = new Cell[CMemory.MEM_SIZE];
     this.random          = new Random(54321);
     this.randomiseMemory();
 }
Ejemplo n.º 3
0
        public void getRegEntry(string regEntr, ref int sigDigit, ref int lowDigit)
        {
            regEntr.ToUpper();
            string strHex;

            switch (regEntr)
            {
            case "A":
                strHex = "83EB";
                break;

            case "F":
                strHex = "83EA";
                break;

            case "B":
                strHex = "83E9";
                break;

            case "C":
                strHex = "83E8";
                break;

            case "D":
                strHex = "83E7";
                break;

            case "E":
                strHex = "83E6";
                break;

            case "H":
                strHex = "83E5";
                break;

            case "L":
                strHex = "83E4";
                break;

            default:
                strHex = regEntr;
                break;
            }
            int index = CMemory.HexToInt(strHex);

            sigDigit = (int)this.memory[index].signifBit;
            lowDigit = (int)this.memory[index].lowerBit;
        }
Ejemplo n.º 4
0
        public void changeRegEntry(int regEntr, int sigDigit, int lowDigit)
        {
            string strHex = "";

            switch (regEntr)
            {
            case 0:
                strHex = "83E9";
                break;

            case 1:
                strHex = "83E8";
                break;

            case 2:
                strHex = "83E7";
                break;

            case 3:
                strHex = "83E6";
                break;

            case 4:
                strHex = "83E5";
                break;

            case 5:
                strHex = "83E4";
                break;

            case 6:
                strHex = this.getRegPair("83E5", "83E4");
                break;

            case 7:
                strHex = "83EB";
                break;

            case 8:
                strHex = "83EA";
                break;
            }
            int index = CMemory.HexToInt(strHex);

            this.memory[index].signifBit = (byte)sigDigit;
            this.memory[index].lowerBit  = (byte)lowDigit;
        }
Ejemplo n.º 5
0
        public void getMemoryValue(string memPos, ref int signifDigit, ref int loverDigit)
        {
            int index = CMemory.HexToInt(memPos);

            if (index == 250)
            {
                int aword = this.PPI.getAword();
                signifDigit = aword >> 4;
                loverDigit  = aword & 15;
                this.PPI.setAword((int)byte.MaxValue);
            }
            else
            {
                signifDigit = (int)this.memory[index].signifBit;
                loverDigit  = (int)this.memory[index].lowerBit;
            }
        }
Ejemplo n.º 6
0
        public void changeRegEntry(string regEntr, int sigDigit, int lowDigit)
        {
            regEntr.ToUpper();
            string strHex = "";

            switch (regEntr)
            {
            case "A":
                strHex = "83EB";
                break;

            case "F":
                strHex = "83EA";
                break;

            case "B":
                strHex = "83E9";
                break;

            case "C":
                strHex = "83E8";
                break;

            case "D":
                strHex = "83E7";
                break;

            case "E":
                strHex = "83E6";
                break;

            case "H":
                strHex = "83E5";
                break;

            case "L":
                strHex = "83E4";
                break;
            }
            int index = CMemory.HexToInt(strHex);

            this.memory[index].signifBit = (byte)sigDigit;
            this.memory[index].lowerBit  = (byte)lowDigit;
        }
Ejemplo n.º 7
0
        public void setMemoryValue(string memPos, int signifDigit, int loverDigit)
        {
            int index1 = CMemory.HexToInt(memPos);

            this.memory[index1].signifBit = (byte)signifDigit;
            this.memory[index1].lowerBit  = (byte)loverDigit;
            int val = signifDigit << 4 | loverDigit;

            if (index1 == 251)
            {
                string bit = CMemory.IntToBit((long)val);
                for (int index2 = 0; index2 < 8; ++index2)
                {
                    this.PPI.setLamp(7 - index2, index2 < bit.Length && (int)bit[bit.Length - index2 - 1] == 49);
                }
            }
            if (index1 != 252)
            {
                return;
            }
            this.PPI.setCword(val);
        }
Ejemplo n.º 8
0
        public bool isClientRegion(string hex)
        {
            int num = CMemory.HexToInt(hex);

            return(num >= CMemory.USER_MEM_ST && num <= CMemory.USER_MEM_END || num >= CMemory.HexToInt("83E4") && num <= CMemory.HexToInt("83EB"));
        }