예제 #1
0
 protected void Reset()
 {
     mbbsEmuCpuCore.Reset();
     mbbsEmuMemoryCore.Clear();
     mbbsEmuCpuRegisters.CS = 1;
     mbbsEmuCpuRegisters.IP = 0;
 }
예제 #2
0
        static void Main(string[] args)
        {
            //Reset
            mbbsEmuCpuRegisters.Zero();
            mbbsEmuCpuCore.Reset();
            mbbsEmuMemoryCore.Clear();
            mbbsEmuCpuRegisters.CS = 1;
            mbbsEmuCpuRegisters.DS = 2;
            mbbsEmuCpuRegisters.IP = 0;

            var instructions = new Assembler(16);
            var label_start  = instructions.CreateLabel();
            var label_loop   = instructions.CreateLabel();

            instructions.Label(ref label_start);
            instructions.mov(__word_ptr[0], 1);
            instructions.Label(ref label_loop);
            instructions.mov(ax, __word_ptr[0]);
            instructions.cmp(ax, 0x7FFF);
            instructions.je(label_start);
            instructions.inc(__word_ptr[0]);
            instructions.jmp(label_loop);

            CreateCodeSegment(instructions);
            CreateDataSegment(new ReadOnlySpan <byte>());


            _isRunning = true;
            new Thread(RunThread).Start();
            new Thread(MonitorThread).Start();

            Console.ReadKey();
            _isRunning = false;
        }
예제 #3
0
파일: Program.cs 프로젝트: tuday2/MBBSEmu
        private void Execute(string[] args)
        {
            var realMode = args.Length == 1 && (args[0].Equals("-realmode") || args[0].Equals("-real"));

            if (realMode)
            {
                memoryCore = realModeMemoryCore = new RealModeMemoryCore(logger: null);
            }
            else
            {
                memoryCore = protectedModeMemoryCore = new ProtectedModeMemoryCore(null);
            }

            mbbsEmuCpuCore      = new CpuCore(logger: null);
            mbbsEmuCpuRegisters = (ICpuRegisters)mbbsEmuCpuCore;
            mbbsEmuCpuCore.Reset(memoryCore, null, null, null);

            // Reset
            mbbsEmuCpuRegisters.Zero();
            mbbsEmuCpuCore.Reset();
            memoryCore.Clear();
            mbbsEmuCpuCore.Registers.CS = 0x1000;
            mbbsEmuCpuCore.Registers.DS = 2;
            mbbsEmuCpuCore.Registers.IP = 0;

            var instructions = new Assembler(16);
            var label_start  = instructions.CreateLabel();
            var label_loop   = instructions.CreateLabel();

            instructions.Label(ref label_start);
            instructions.mov(__word_ptr[0], 1);
            instructions.Label(ref label_loop);
            instructions.mov(ax, __word_ptr[0]);
            instructions.cmp(ax, 0x7FFF);
            instructions.je(label_start);
            instructions.inc(__word_ptr[0]);
            instructions.jmp(label_loop);

            CreateCodeSegment(instructions);
            CreateDataSegment(new ReadOnlySpan <byte>());

            _isRunning = true;
            new Thread(RunThread).Start();
            new Thread(MonitorThread).Start();

            Console.ReadKey();
            _isRunning = false;
        }
예제 #4
0
        protected virtual void Reset()
        {
            mbbsEmuCpuRegisters.Zero();
            mbbsEmuCpuCore.Reset();
            mbbsEmuMemoryCore.Clear();
            mbbsEmuCpuRegisters.CS = CODE_SEGMENT;
            mbbsEmuCpuRegisters.IP = 0;

            testSessions = new PointerDictionary <SessionBase>();
            var textVariableService = _serviceResolver.GetService <ITextVariableService>();

            testSessions.Allocate(new TestSession(null, textVariableService));
            testSessions.Allocate(new TestSession(null, textVariableService));

            //Redeclare to re-allocate memory values that have been cleared
            majorbbs = new HostProcess.ExportedModules.Majorbbs(
                _serviceResolver.GetService <IClock>(),
                _serviceResolver.GetService <ILogger>(),
                _serviceResolver.GetService <AppSettings>(),
                _serviceResolver.GetService <IFileUtility>(),
                _serviceResolver.GetService <IGlobalCache>(),
                mbbsModule,
                testSessions,
                _serviceResolver.GetService <IAccountKeyRepository>(),
                _serviceResolver.GetService <IAccountRepository>(),
                textVariableService);

            galgsbl = new HostProcess.ExportedModules.Galgsbl(
                _serviceResolver.GetService <IClock>(),
                _serviceResolver.GetService <ILogger>(),
                _serviceResolver.GetService <AppSettings>(),
                _serviceResolver.GetService <IFileUtility>(),
                _serviceResolver.GetService <IGlobalCache>(),
                mbbsModule,
                testSessions,
                textVariableService);
        }
예제 #5
0
        static void Main(string[] args)
        {
            //Reset
            mbbsEmuCpuRegisters.Zero();
            mbbsEmuCpuCore.Reset();
            mbbsEmuMemoryCore.Clear();
            mbbsEmuCpuRegisters.CS = 1;
            mbbsEmuCpuRegisters.IP = 0;


            var msCodeSegment = new MemoryStream();

            //XOR AX, AX
            msCodeSegment.Write(new byte[] { 0x33, 0xC0 });
            //CMP AX, 0xF
            msCodeSegment.Write(new byte[] { 0x3D, 0xF, 0x00 });
            //JLE
            msCodeSegment.Write(new byte[] { 0x7E, 0x02 });
            //INC AX
            msCodeSegment.Write(new byte[] { 0x40 });
            //INC AX
            msCodeSegment.Write(new byte[] { 0x40 });
            //CMP AX, 0x64
            msCodeSegment.Write(new byte[] { 0x3D, 0x64, 0x00 });
            //JL
            msCodeSegment.Write(new byte[] { 0x7C, 0xF2 });

            CreateCodeSegment(msCodeSegment.ToArray());

            _isRunning = true;
            new Thread(RunThread).Start();
            new Thread(MonitorThread).Start();

            Console.ReadKey();
            _isRunning = false;
        }