Exemple #1
0
 static void rstControl(int addr)
 {
     if (addr < Edio.ADDR_CFG)
     {
         edio.hostReset(Edio.HOST_RST_SOFT);
     }
 }
Exemple #2
0
        public void loadGame(string path, bool usr_fpga)
        {
            int  resp;
            int  offset = 0;
            bool sms    = path.ToLower().EndsWith(".sms") || path.ToLower().EndsWith(".gg");

            byte[] data = File.ReadAllBytes(path);
            if (data.Length > Edio.MAX_ROM_SIZE)
            {
                throw new Exception("ROM is too big");
            }

            if (data.Length % 1024 == 512 && sms)
            {
                offset = 512;                                  //skip sms header
            }
            int dst_addr = Edio.ADDR_ROM;

            if (path.ToLower().EndsWith(".nes"))
            {
                dst_addr += 0x10000;
            }

            edio.hostReset(Edio.HOST_RST_SOFT);
            edio.memWR(dst_addr, data, offset, data.Length - offset);
            edio.hostReset(Edio.HOST_RST_OFF);

            resp = edio.rx8();
            if (resp != 'r')
            {
                throw new Exception("unexpected response: " + resp);
            }

            hostTest();

            if (usr_fpga)
            {
                edio.fifoWR("*u");        //skip fpga reloading from sd
            }
            edio.fifoWR("*g");
            edio.fifoTX32(data.Length - offset);
            edio.fifoTxString("USB:" + Path.GetFileName(path));
        }
Exemple #3
0
        public static void start(string[] args, Edio io)
        {
            edio = io;
            usb  = new Usbio(edio);


            for (int i = 0; i < args.Length; i++)
            {
                string s = args[i].ToLower().Trim();

                if (s.Equals("-reset"))
                {
                    edio.hostReset(Edio.HOST_RST_SOFT);
                    continue;
                }

                if (s.Equals("-recovery"))
                {
                    cmd_recovery();
                    continue;
                }

                if (s.Equals("-appmode"))
                {
                    cmd_exitServiceMode();
                    continue;
                }

                if (s.Equals("-sermode"))
                {
                    cmd_enterServiceMode();
                    continue;
                }

                if (s.Equals("-flawr"))
                {
                    cmd_flashWrite(args[i + 1], args[i + 2]);
                    i += 2;
                    continue;
                }

                if (s.Equals("-rtcset"))
                {
                    edio.rtcSet(DateTime.Now);
                    continue;
                }

                if (s.EndsWith(".rbf"))
                {
                    cmd_loadFpga(args[i]);
                    continue;
                }

                if (s.StartsWith("-memprint"))
                {
                    cmd_memPrint(args[i + 1], args[i + 2]);
                    i += 2;
                }

                if (s.StartsWith("-memwr"))
                {
                    cmd_memWrite(args[i + 1], args[i + 2]);
                    i += 2;
                }

                if (s.StartsWith("-memrd"))
                {
                    cmd_memRead(args[i + 1], args[i + 2], args[i + 3]);
                    i += 3;
                }


                if (s.Equals("-verify"))
                {
                    cmd_verify(args[i + 1], args[i + 2], args[i + 3]);
                    i += 3;
                    continue;
                }


                if (s.EndsWith(".bin") || s.EndsWith(".gen") || s.EndsWith(".md") || s.EndsWith(".smd") || s.EndsWith(".32x") || s.EndsWith(".sms") || s.EndsWith(".nes"))
                {
                    //cmdMemWrite(args[i], "0");
                    cmd_loadGame(s);
                    continue;
                }

                if (s.Equals("-cp"))
                {
                    usb.copyFile(args[i + 1], args[i + 2]);
                    i += 2;
                    continue;
                }

                if (s.Equals("-mkdir"))
                {
                    usb.makeDir(args[i + 1]);
                    i += 1;
                    continue;
                }
            }

            edio.hostReset(Edio.HOST_RST_OFF);
            Console.WriteLine("");
        }