Example #1
0
 public Server(ICpu cpu, IRamMemory ram, IEnumerable<IHardDrive> hardDrives)
 {
     this.Cpu = cpu;
     this.Ram = ram;
     this.HardDrives = hardDrives;
     this.VideoCard = this.defaultVideoCard;
 }
 public IPc GetPc(
     ICpu cpu,
     IEnumerable<IHardDrive> hardDrives,
     IMotherboard motherboard)
 {
     return new Pc(cpu, hardDrives, motherboard);
 }
Example #3
0
 public Server(
     ICpu cpu,
     IEnumerable<IHardDrive> hardDrives,
     IMotherboard motherboard)
     : base(cpu, hardDrives, motherboard)
 {
 }
 public IServer GetServer(
     ICpu cpu,
     IEnumerable<IHardDrive> hardDrives,
     IMotherboard motherboard)
 {
     return new Server(cpu, hardDrives, motherboard);
 }
Example #5
0
 public Computer(ICpu cpu, IRam ram, IEnumerable<HardDrive> hardDrives, VideoCardBase videoCard)
 {
     this.Cpu = cpu;
     this.Ram = ram;
     this.HardDrives = hardDrives;
     this.VideoCard = videoCard;
 }
Example #6
0
 public Computer(ICpu cpu, IRam ram, IVideoCard gpu, IStorage storage)
 {
     Storage = storage;
     Gpu = gpu;
     Ram = ram;
     Cpu = cpu;
 }
Example #7
0
        /// <summary>
        /// Take the topmost arguments down to the ARG_MARKER_STRING, pop them off, and then
        /// put them back again in reversed order so a function can read them in normal order.
        /// Note that if this is an indirect call, it will also consume the thing just under
        /// the ARG_MARKER, since that's expected to be the delegate or KOSDelegate that we already
        /// read and pulled the needed information from.
        /// <param name="cpu">the cpu we are running on, fur stack manipulation purposes</param>
        /// <param name="direct">need to know if this was a direct or indirect call.  If indirect,
        /// then that means it also needs to consume the indirect reference off the stack just under
        /// the args</param>
        /// </summary>
        public static void ReverseStackArgs(ICpu cpu, bool direct)
        {
            List<object> args = new List<object>();
            object arg = cpu.PopValue();
            while (cpu.GetStackSize() > 0 && arg.GetType() != ArgMarkerType)
            {
                args.Add(arg);

                // It's important to dereference with PopValue, not using PopStack, because the function
                // being called might not even be able to see the variable in scope anyway.
                // In other words, if calling a function like so:
                //     declare foo to 3.
                //     myfunc(foo).
                // The code inside myfunc needs to see that as being identical to just saying:
                //     myfunc(3).
                // It has to be unaware of the fact that the name of the argument was 'foo'.  It just needs to
                // see the contents that were inside foo.
                arg = cpu.PopValue();
            }
            if (! direct)
                cpu.PopStack(); // throw away the delegate or KOSDelegate info - we already snarfed it by now.
            // Push the arg marker back on again.
            cpu.PushStack(new KOSArgMarkerType());
            // Push the arguments back on again, which will invert their order:
            foreach (object item in args)
                cpu.PushStack(item);
        }
Example #8
0
 public Computer(ICpu cpu, IRamMemory ram, IVideoCard videoCard, IEnumerable<IHardDrive> hardDrives)
 {
     this.cpu = cpu;
     this.ram = ram;
     this.videoCard = videoCard;
     this.hardDrives = hardDrives;
 }
Example #9
0
 public MotherBoard(IRamMemory ram, ICpu cpu, IHardDrive hardDrive, IVideoCard videoCard)
 {
     this.ram = ram;
     this.cpu = cpu;
     this.hardDrive = hardDrive;
     this.videoCard = videoCard;
 }
 public ILaptop GetLaptop(
     ICpu cpu,
     IEnumerable<IHardDrive> hardDrives,
     IMotherboard motherboard,
     ILaptopBattery battery)
 {
     return new Laptop(cpu, hardDrives, motherboard, battery);
 }
Example #11
0
 public Computer(ComputerType type, ICpu cpu, Ram ram, IEnumerable<HardDrive> hardDrives, IVideoCard videoCard)
 {
     this.Cpu = cpu;
     this.Ram = ram;
     this.HardDrives = hardDrives;
     this.VideoCard = videoCard;
     this.Type = type;
 }
 public Computer(
     ICpu cpu,
     IEnumerable<IHardDrive> hardDrives,
     IMotherboard motherboard)
 {
     this.Cpu = cpu;
     this.HardDrives = hardDrives;
     this.Motherboard = motherboard;
 }
Example #13
0
 public Laptop(
     ICpu cpu,
     IEnumerable<IHardDrive> hardDrives,
     IMotherboard motherboard,
     ILaptopBattery battery)
     : base(cpu, hardDrives, motherboard)
 {
     this.Battery = battery;
 }
Example #14
0
 /// <summary>
 /// Make a new UserDelegate given the current state of the CPU and its stack, and
 /// the entry point location of the function to call.
 /// </summary>
 /// <param name="cpu">the CPU on which this program is running.</param>
 /// <param name="context">The IProgramContext in which the entryPoint is stored.  Entry point 27 in the interpreter is not the same as entrypoint 27 in program context.</param>
 /// <param name="entryPoint">instruction address where OpcodeCall should jump to to call the function.</param>
 /// <param name="useClosure">If true, then a snapshot of the current scoping stack, and thus a persistent ref to its variables,
 ///   will be kept in the delegate so it can be called later as a callback with closure.  Set to false if the
 ///   function is only getting called instantly using whatever the scope is at the time of the call.</param>
 public UserDelegate(ICpu cpu, IProgramContext context, int entryPoint, bool useClosure)
 {
     this.cpu = cpu;
     ProgContext = context;
     EntryPoint = entryPoint;
     if (useClosure)
         CaptureClosure();
     else
         Closure = new List<VariableScope>(); // make sure it exists as an empty list so we don't have to have 'if null' checks everwywhere.
 }
Example #15
0
 public Console(ICpu cpu, IMmu mmu, IGpu gpu, ITimer timer, IController controller)
 {
     Cpu = cpu;
     Mmu = mmu;
     Gpu = gpu;
     Timer = timer;
     Controller = controller;
     _emitFrames = true;
     _breakpoints = new HashSet<uint>();
 }
 public override Server ManufactureServer()
 {
     this.ram = new RamMemory(32);
     this.cpu = new Cpu(4, 32, this.ram);
     this.hardDrives = new List<HardDriver>
     {
         new HardDriver(0, true, 2, new List<HardDriver> { new HardDriver(1000, false, 0), new HardDriver(1000, false, 0) })
     };
     return new Server(this.cpu, this.ram, this.hardDrives);
 }
        public Motherboard(ICpu cpu, IRam ram, IVideoCard videoCard)
        {
            cpu.Motherboard = this;
            this.Cpu = cpu;

            ram.Motherboard = this;
            this.Ram = ram;

            videoCard.Motherboard = this;
            this.VideoCard = videoCard;
        }
        // The hardcoded values are used on only one place so i think that there is no need of constants.
        public override PersonalComputer ManufacturePC()
        {
            this.ram = new RamMemory(4);
            this.videoCard = new MonochromeVideoCard();
            this.cpu = new Cpu(2, 64, this.ram, this.videoCard);
            this.hardDrives = new[]
            {
                new HardDriver(2000, false, 0)
            };

            return new PersonalComputer(this.cpu, this.ram, this.videoCard, this.hardDrives);
        }
        // The hardcoded values are used on only one place so i think that there is no need of constants.
        public override PersonalComputer ManufacturePC()
        {
            this.ram = new RamMemory(8);
            this.videoCard = new ColorfulVideoCard();
            this.cpu = new Cpu(4, 64, this.ram, this.videoCard);
            this.hardDrives = new[]
            {
                new HardDriver(1000, false, 0)
            };

            return new PersonalComputer(this.cpu, this.ram, this.videoCard, this.hardDrives);
        }
Example #20
0
 protected Computer(
     ICpu cpu,
     IRam ram,
     IEnumerable<IHardDrive> hardDrives,
     IVideoCard videoCard)
 {
     this.Cpu = cpu;
     this.Ram = ram;
     this.HardDrives = hardDrives;
     this.VideoCard = videoCard;
     this.Motherboard = new Motherboard(this.Cpu, this.Ram, this.VideoCard);
 }
        public override Laptop ManufactureLaptop()
        {
            this.ram = new RamMemory(8);
            this.videoCard = new ColorfulVideoCard();
            this.cpu = new Cpu(4, 32, this.ram, this.videoCard);
            this.hardDrives = new[]
            {
                new HardDriver(1000, false, 0)
            };
            IBattery battery = BatteryFactory.GetBattery(BatteryType.LaptopBattery);

            return new Laptop(this.cpu, this.ram, this.videoCard, this.hardDrives, battery);
        }
Example #22
0
        public DebugControl( Debugger debugger )
        {
            Debug.Assert( debugger != null );
            if( debugger == null )
                throw new ArgumentNullException( "debugger" );
            _debugger = debugger;

            _breakpoints = new List<Breakpoint>();
            _breakpointLookup = new Dictionary<int, Breakpoint>();

            _cpu = _debugger.Host.CurrentInstance.Cpu;
            Debug.Assert( _cpu != null );
        }
 public CpuStateViewModel(ICpu cpu)
 {
     A = $"{cpu.A:X2}";
     B = $"{cpu.B:X2}";
     C = $"{cpu.C:X2}";
     D = $"{cpu.D:X2}";
     E = $"{cpu.E:X2}";
     FC = $"{cpu.FC}";
     FH = $"{cpu.FH}";
     FN = $"{cpu.FN}";
     FZ = $"{cpu.FZ}";
     H = $"{cpu.H:X2}";
     L = $"{cpu.L:X2}";
     SP = $"{cpu.SP:X4}";
     PC = $"{cpu.PC:X4}";
     IME = $"{cpu.IME}";
 }
Example #24
0
        public CpuPane( Studio studio )
            : this()
        {
            Debug.Assert( studio != null );
            if( studio == null )
                throw new ArgumentNullException( "studio" );
            _studio = studio;

            this.Icon = IconUtilities.ConvertToIcon( Properties.Resources.RegistersIcon );

            _cpu = _studio.Debugger.Host.CurrentInstance.Cpu;
            _core0 = _cpu.Cores[ 0 ];

            _studio.GlobalRefreshRequested += new EventHandler( StudioGlobalRefreshRequested );

            this.generalRegistersLabel_SizeChanged( this, EventArgs.Empty );

            _useFriendlyLabels = true;
            this.friendlyCheckbox.Checked = _useFriendlyLabels;

            this.UpdateValues();
        }
Example #25
0
 protected override void ExecuteInternal(ICpu _, IMemory __, Operand src, Operand dst, Operand ___)
 {
     dst.Value = src.Value;
 }
Example #26
0
 public GamingDesktop(ICpu cpu, IMotherBoard motherBoard, IVideoCard videoCard) : base(cpu, motherBoard, videoCard)
 {
 }
Example #27
0
 public void Execute(ICpu cpu)
 {
     cpu.Memory[Value] = (byte)((cpu.Registers[Register] >> 8) & 0xFF);
 }
Example #28
0
 public NOP(ICpu cpu) : base(cpu)
 {
 }
Example #29
0
 public void Execute(Instruction instruction, ICpu cpu, IMmu mmu)
 {
     throw new NotImplementedException(Mnemonic);
 }
Example #30
0
 public BranchIfCarry(ICpu cpu, IAddressMode addressMode) : base(cpu, addressMode)
 {
 }
Example #31
0
 public RTS(ICpu cpu) : base(cpu)
 {
 }
Example #32
0
 public Ldy(ICpu cpu) : base(cpu)
 {
 }
Example #33
0
 public Host(ICpu processor)
 {
     Cpu = processor;
 }
 public AbsoluteModeXOffset(ICpu cpu) : base(cpu)
 {
 }
Example #35
0
 public ROR(ICpu cpu) : base(cpu)
 {
 }
Example #36
0
 public void Execute(Instruction instruction, ICpu cpu, IMmu mmu)
 {
     cpu.Registers.C.Value = cpu.ReadImmediateN();
 }
Example #37
0
 public Emulator(ICpu cpu)
 {
     this.cpu = cpu;
     this.memory = new Memory();
     this.cpu.Memory = this.memory;
 }
Example #38
0
 public void Execute(Instruction instruction, ICpu cpu, IMmu mmu)
 {
     mmu.WriteByte((ushort)(0xFF00 + cpu.Registers.C.Value), cpu.Registers.A.Value);
 }
Example #39
0
 public override int Resolve(ICpu cpu, ref byte[] raw)
 {
     return(raw[0]);
 }
Example #40
0
 public void Execute(ICpu cpu)
 {
     cpu.Registers.ProgramCounter = Value;
 }
 public PersonalComputer(IRam ram, ICpu cpu, IEnumerable <IHardDrive> drives, IVideoCard videoCard)
     : base(ram, cpu, drives, videoCard)
 {
 }
 public void Execute(ICpu cpu) => cpu.Registers.ProgramCounter = Pop(cpu);
Example #43
0
 public IndirectYMode(ICpu cpu) : base(cpu)
 {
 }
Example #44
0
File: Sleep.cs Project: avdosev/vm
 protected override void ExecuteInternal(ICpu cpu, IMemory memory, Operand timeToSleep, Operand op1, Operand op2)
 {
     Thread.Sleep(timeToSleep.Value.ToInt());
 }
Example #45
0
        public void Execute(Instruction instruction, ICpu cpu, IMmu mmu)
        {
            var n = cpu.ReadImmediateN();

            cpu.Registers.A.Value = mmu.ReadByte((ushort)(0xFF00 + n));
        }
Example #46
0
 public IncCommand(ICpu cpu)
     : base(cpu)
 {
 }
Example #47
0
 public Decision OnInstructionExecuteError(ICpu cpu, IMemory memory, string message)
 {
     return(Decision.Terminate);
 }
Example #48
0
 public Emulator(ICpu cpu, IPpu ppu, IMemory memory)
 {
     this.cpu = cpu;
     this.ppu = ppu;
     this.memory = memory;
 }
Example #49
0
 protected Desktop(ICpu cpu, IMotherBoard motherBoard, IVideoCard videoCard)
 {
     _cpu         = cpu;
     _motherBoard = motherBoard;
     _videoCard   = videoCard;
 }
Example #50
0
 protected PersonalComputer(ICpu cpu, IRam ram, IVideoCard gpu, IStorage storage)
     : base(cpu, ram, gpu, storage)
 {
 }
 public BranchIfPositive(ICpu cpu, IAddressMode addressMode) : base(cpu, addressMode)
 {
 }
Example #52
0
 public Decision OnStep(ICpu cpu, IMemory memory)
 {
     return(Decision.Continue);
 }
Example #53
0
 public Pc(ICpu cpu, IRam ram, IEnumerable<HardDrive> hardDrives, VideoCardBase videoCard)
     : base(cpu, ram, hardDrives, videoCard)
 {
 }
 public BranchIfNotEqual(ICpu cpu, IAddressMode addressMode) : base(cpu, addressMode)
 {
 }
Example #55
0
 public Laptop(IRam ram, ICpu cpu, IEnumerable<IHardDrive> drives, IVideoCard videoCard, IBattery battery)
     : base(ram, cpu, drives, videoCard)
 {
     this.Battery = battery;
 }
Example #56
0
 public void Initialization()
 {
     cpu32 = new Cpu32Bit(4);
 }
Example #57
0
 Decision ISupervisor.OnInstructionExecuteError(ICpu cpu, IMemory memory, string message)
 {
     return(OnPause(new PauseContext(memory, cpu, StopReason.InstructionExecutionError, null, message)));
 }
Example #58
0
 public JMP(ICpu cpu) : base(cpu)
 {
 }
Example #59
0
 public BPL(ICpu cpu) : base(cpu)
 {
 }
Example #60
0
 public RelativeMode(ICpu cpu) : base(cpu)
 {
 }