Beispiel #1
0
        public static void Main(string[] args)
        {
            if (args is null || args.All(x => string.IsNullOrWhiteSpace(x)))
            {
                throw new ArgumentNullException(nameof(args));
            }

            int memSize = 512;

            if (args.Length == 1)
            {
                try
                {
                    memSize = int.Parse(args[0], CultureInfo.InvariantCulture);
                }
                catch (FormatException)
                {
                    Console.WriteLine($"Invalid number: {args[0]}");
                    Console.WriteLine("Usage: m68k.Monitor [memory size Kb]");
                    Environment.Exit(-1);
                }
            }

            Console.WriteLine("m68k Monitor v0.1 - Copyright 2008-2010 Tony Headford");
            using (var newMemory = new MemorySpace(memSize))
            {
                var newCpu = new MC68000();
                newCpu.SetAddressSpace(newMemory);
                newCpu.Reset();
                Monitor monitor = new Monitor(newCpu, newMemory);
                monitor.Run();
            }
        }