Exemplo n.º 1
0
        public static void RunTests(Options myOptions)
        {
            myOptions.SetFileName("test1.exe");
            RAMsim myRam    = new RAMsim(myOptions.GetMemSize());
            Loader myLoader = new Loader(myOptions, myRam);

            Console.WriteLine("testing Loader...");
            myLoader.Load();
            Console.Write("verifying MD5 hash...");
            Debug.Assert(myRam.getMDF() == "3500a8bef72dfed358b25b61b7602cf1");
            Console.WriteLine("success!");
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Options myOptions = new Options();

            myOptions.Parse(args);


            if (myOptions.GetTest())
            {
                TestRAM.RunTests();
                TestLoader.RunTests(myOptions);
                Environment.Exit(0);
            }

            RAMsim myRam    = new RAMsim(myOptions.GetMemSize());
            Loader myLoader = new Loader(myOptions, myRam);

            myLoader.Load();
        }
Exemplo n.º 3
0
        public static void RunTests()
        {
            Console.WriteLine("testing RAM...");

            RAMsim ram = new RAMsim(7);

            //test populate method
            Console.Write("verifying Populate...");
            ram.PopulateRam(new byte[] { 0xFF, 0xAA, 0xAA, 0xFF, 0xFF, 0xFF, 0xFF }, 0);
            Debug.Assert(ram.ReadHalfWord(1) == 0xAAAA);
            Console.WriteLine("success!");

            //test set/test flag methods
            Console.Write("verifying SetFlag/TestFlag...");
            ram.SetFlag(1, 6, true);
            Debug.Assert(ram.TestFlag(1, 6));
            ram.SetFlag(1, 6, false);
            Debug.Assert(!(ram.TestFlag(1, 6)));
            Console.WriteLine("success!");

            //test read/write methods
            Console.Write("verifying Read/Write Word...");
            ram.WriteWord(0, 0xFFFFFFFF);
            Debug.Assert(ram.ReadWord(0) == 0xFFFFFFFF);
            Console.WriteLine("success!");

            Console.Write("verifying Read/Write HalfWord...");
            ram.WriteWord(0, 0xCCCC);
            Debug.Assert(ram.ReadWord(0) == 0xCCCC);
            Console.WriteLine("success!");

            Console.Write("verifying Read/Write Byte...");
            ram.WriteWord(0, 0xAA);
            Debug.Assert(ram.ReadWord(0) == 0xAA);
            Console.WriteLine("success!");
        }
Exemplo n.º 4
0
 public Loader(Options toMyOptions, RAMsim toMyRam)
 {
     myOptions = toMyOptions;
     myRam     = toMyRam;
 }