Пример #1
0
        void mapLoadSDC(int map_id, MapConfig cfg)
        {
            string map_path = "EDN8/MAPS/";
            int    map_pkg;

            byte[] map_rout = new byte[4096];


            edio.fileOpen("EDN8/MAPROUT.BIN", Edio.FAT_READ);
            edio.fileRead(map_rout, 0, map_rout.Length);
            edio.fileClose();

            map_pkg = map_rout[map_id];
            if (map_pkg == 0xff && map_id != 0xff)
            {
                cfg         = new MapConfig();
                cfg.map_idx = 255;
                cfg.Ctrl    = MapConfig.ctrl_unlock;
                edio.fpgInit("EDN8/MAPS/255.RBF", cfg);
                throw new Exception("Unsupported mapper: " + map_id);
            }

            if (map_pkg < 100)
            {
                map_path += "0";
            }
            if (map_pkg < 10)
            {
                map_path += "0";
            }
            map_path += map_pkg + ".RBF";

            Console.WriteLine("int mapper: " + map_path);
            edio.fpgInit(map_path, cfg);
        }
Пример #2
0
        public void loadOS(NesRom rom, string map_path)
        {
            if (map_path == null)
            {
                map_path = getTestMapper(255);
            }

            byte[]    prg = rom.PrgData;
            byte[]    chr = rom.ChrData;
            MapConfig cfg = new MapConfig();

            cfg.map_idx = 0xff;
            cfg.Ctrl    = MapConfig.ctrl_unlock;

            cmd(cmd_reboot);
            edio.rx8();//exec

            edio.memWR(rom.PrgAddr, prg, 0, prg.Length);
            edio.memWR(rom.ChrAddr, chr, 0, chr.Length);

            edio.getStatus();

            if (map_path == null)
            {
                mapLoadSDC(255, cfg);
            }
            else
            {
                byte[] map = File.ReadAllBytes(map_path);
                edio.fpgInit(map, cfg);
            }
        }
Пример #3
0
        public MapConfig getConfig()
        {
            MapConfig cfg = new MapConfig();

            byte[] data = new byte[cfg.getBinary().Length];
            memRD(ADDR_CFG, data, 0, data.Length);
            return(new MapConfig(data));
        }
Пример #4
0
        void haltExit()
        {
            MapConfig cfg = new MapConfig();

            cfg.map_idx = 0xff;
            cfg.Ctrl    = MapConfig.ctrl_unlock;
            edio.setConfig(cfg);
        }
Пример #5
0
 public void fpgInit(byte[] data, MapConfig cfg)
 {
     if (cfg != null)
     {
         fpgInitCfg(cfg);
     }
     txCMD(CMD_FPG_USB);
     tx32(data.Length);
     txDataACK(data, 0, data.Length);
     checkStatus();
 }
Пример #6
0
        void halt()
        {
            MapConfig cfg = new MapConfig();

            cfg.map_idx = 0xff;
            edio.setConfig(cfg);
            cmd('h');
            if (edio.rx8() != 0)
            {
                throw new Exception("Unexpected response at USB halt");
            }
        }
Пример #7
0
 public void fpgInit(byte[] data, MapConfig cfg)
 {
     //if (cfg != null) fpgInitCfg(cfg);
     txCMD(CMD_FPG_USB);
     tx32(data.Length);
     txDataACK(data, 0, data.Length);
     checkStatus();
     if (cfg != null)
     {
         memWR(ADDR_CFG, cfg.getBinary(), 0, cfg.getBinary().Length);
     }
 }
Пример #8
0
 public void fpgInit(int flash_addr, MapConfig cfg)
 {
     if (cfg != null)
     {
         fpgInitCfg(cfg);
     }
     txCMD(CMD_FPG_FLA);
     tx32(flash_addr);
     //txData(cfg.getBinary());
     tx8(0);//exec
     checkStatus();
 }
Пример #9
0
 public void fpgInit(int flash_addr, MapConfig cfg)
 {
     //if (cfg != null) fpgInitCfg(cfg);
     txCMD(CMD_FPG_FLA);
     tx32(flash_addr);
     //txData(cfg.getBinary());
     tx8(0);//exec
     checkStatus();
     if (cfg != null)
     {
         memWR(ADDR_CFG, cfg.getBinary(), 0, cfg.getBinary().Length);
     }
 }
Пример #10
0
        public void fpgInit(string sd_path, MapConfig cfg)
        {
            if (cfg != null)
            {
                fpgInitCfg(cfg);
            }
            FileInfo f = fileInfo(sd_path);

            fileOpen(sd_path, FAT_READ);
            txCMD(CMD_FPG_SDC);
            tx32(f.size);
            //txData(cfg.getBinary());
            tx8(0);
            checkStatus();
        }
Пример #11
0
        public void fpgInit(string sd_path, MapConfig cfg)
        {
            //if (cfg != null) fpgInitCfg(cfg);
            FileInfo f = fileInfo(sd_path);

            fileOpen(sd_path, FAT_READ);
            txCMD(CMD_FPG_SDC);
            tx32(f.size);
            //txData(cfg.getBinary());
            tx8(0);
            checkStatus();
            if (cfg != null)
            {
                memWR(ADDR_CFG, cfg.getBinary(), 0, cfg.getBinary().Length);
            }
        }
Пример #12
0
        /*
         * void fpgInitCfg(MapConfig cfg)
         * {
         *  txCMD(CMD_FPG_CFG);
         *  txData(cfg.getBinary());
         * }*/


        public void setConfig(MapConfig cfg)
        {
            byte[] bin_cfg = cfg.getBinary();
            memWR(Edio.ADDR_CFG, bin_cfg, 0, bin_cfg.Length);
        }
Пример #13
0
 void fpgInitCfg(MapConfig cfg)
 {
     txCMD(CMD_FPG_CFG);
     txData(cfg.getBinary());
 }