Exemple #1
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="map"></param>
        /// <param name="ppu"></param>
        public NesCpu(NesCpuMemoryMap map, INesPpuVBlank ppu)
        {
            this.Clock = new NesCpuClock(ppu);
            this.MemoryMap = map;
            this.PpuVblank = ppu;

            // CPU命令に対応するAction情報を作成
            this.opCodeActionDictionary = CpuCommandTable.Table
                .Select(x => x.Value.Command)
                .Distinct()
                .Select(x =>
                {
                    var instance = Expression.Constant(this, typeof(NesCpu));
                    var callMethod = Expression.Call(
                        instance,
                        instance.Type.GetMethod(x.ToString(),
                        System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance)
                        );
                    var lambda = Expression.Lambda<Action>(callMethod);
                    return new { Method = lambda.Compile(), Key = x };
                })
                .ToDictionary(x => x.Key, x => x.Method);
        }
Exemple #2
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="ppu"></param>
 public NesCpuClock(INesPpuVBlank ppu)
 {
     this.Ppu = ppu;
 }