/// <summary>
    /// We've parsed everything from stdin, let's start processing it.
    /// </summary>
    /// <returns>success?</returns>
    private static bool DoStuff()
    {
        PrintUsage(true);

        //
        // Process the secondary/standalone commands
        // /fast, /slow, /m, etc
        //

        if (enterFastMode)
        {
            // start in normal mode and send a "FAST" command
            // unirom doesn't have to respond, so if it's already in fast mode, no biggie
            if (!NewSIO(SIOSPEED.SLOW))
            {
                return(false);
            }

            // The bytes "FAST" with no null terminator
            activeSerial.Write(BitConverter.GetBytes(0x54534146), 0, 4);
            Thread.Sleep(100);

            // Switch to fast
            if (!NewSIO(SIOSPEED.FAST))
            {
                return(false);
            }
        }
        else if (enterSlowMode)
        {
            // As above, but returns to 115200 so you don't have to 'nops /fast' all the time

            // going to assume Unirom's in fast mode.. so start there and negotiate back down
            if (!NewSIO(SIOSPEED.FAST))
            {
                return(false);
            }

            // The bytes "FAST" with no null terminator
            activeSerial.Write(BitConverter.GetBytes(0x574F4C53), 0, 4);
            Thread.Sleep(100);

            // Now switch back
            if (!NewSIO(SIOSPEED.SLOW))
            {
                return(false);
            }
        }
        else
        {
            if (!NewSIO(SIOSPEED.SLOW))
            {
                return(false);
            }
        }


        // If we got /m on its own
        if (monitorComms && argCommand == CommandMode.NOT_SET)
        {
            GDB.MonitorSerialToSocket();
            return(true);
        }

        // we just did 'nops /fast /m' or something
        if (allArgsAreSecondary)
        {
            return(true);
        }


        //
        // A little cleanup...
        //

        if (usingCachedComPort)
        {
            Console.WriteLine("Using port " + argComPort + " from comport.txt\n");
        }

        // Clear the SIO buffer incase the last program has been spamming

        Console.WriteLine("Emptying buffer... ");
        while (activeSerial.BytesToRead != 0)
        {
            Console.Write("" + (char)activeSerial.ReadByte());
        }
        Console.WriteLine("...done!\n\n");


        //
        // Process the primary commands
        //

        // Upload

        if (argCommand == CommandMode.SEND_EXE)
        {
            TransferLogic.Command_SendEXE(inFile);
        }

        if (argCommand == CommandMode.SEND_BIN)
        {
            TransferLogic.Command_SendBin(argAddr, inFile);
        }

        if (argCommand == CommandMode.SEND_ROM)
        {
            TransferLogic.Command_SendROM(argAddr, inFile);
        }

        // Program flow

        if (argCommand == CommandMode.JUMP_JMP)
        {
            TransferLogic.Command_JumpAddr(argAddr);
        }

        if (argCommand == CommandMode.JUMP_CALL)
        {
            TransferLogic.Command_CallAddr(argAddr);
        }

        // Pokeypoke

        if (argCommand == CommandMode.POKE8)
        {
            byte[] bytes = { (byte)(argValue & 0xFF) };
            TransferLogic.Command_SendBin(argAddr, bytes);
        }

        if (argCommand == CommandMode.POKE16)
        {
            short  shorty = (byte)(argValue & 0xFFFF);
            byte[] bytes  = BitConverter.GetBytes(shorty);
            TransferLogic.Command_SendBin(argAddr, bytes);
        }

        if (argCommand == CommandMode.POKE32)
        {
            byte[] bytes = BitConverter.GetBytes(argValue);
            TransferLogic.Command_SendBin(argAddr, bytes);
        }

        // Utility

        if (argCommand == CommandMode.PING)
        {
            TransferLogic.ChallengeResponse(argCommand);
        }

        if (argCommand == CommandMode.RESET)
        {
            TransferLogic.WriteChallenge(argCommand.challenge());
        }

        // Debug functions

        if (argCommand == CommandMode.DEBUG)
        {
            // if it returns true, we might enter /m (monitor) mode, etc
            if (
                !TransferLogic.ChallengeResponse(argCommand)
                )
            {
                return(false);
            }
        }

        if (argCommand == CommandMode.HALT)
        {
            TransferLogic.ChallengeResponse(argCommand);
        }

        if (argCommand == CommandMode.CONT)
        {
            TransferLogic.ChallengeResponse(argCommand);
        }

        if (argCommand == CommandMode.REGS)
        {
            TransferLogic.Command_DumpRegs();
        }

        if (argCommand == CommandMode.SETREG)
        {
            if (!TransferLogic.Command_SetReg(argRegister, argValue))
            {
                return(Error("Couldn't set reg " + argRegister + " to " + argValue, false));
            }
        }


        // Hook functions

        if (
            argCommand == CommandMode.HOOKREAD ||
            argCommand == CommandMode.HOOKWRITE ||
            argCommand == CommandMode.HOOKEXEC
            )
        {
            if (TransferLogic.ChallengeResponse(argCommand))
            {
                activeSerial.Write(BitConverter.GetBytes(argAddr), 0, 4);
            }
        }

        // Memory card

        if (argCommand == CommandMode.MCUP)
        {
            if (!TransferLogic.Command_MemcardUpload(argCard, inFile))
            {
                return(false);
            }
        }

        if (argCommand == CommandMode.WIPEMEM)
        {
            if (!TransferLogic.Command_WipeMem(argAddr, argValue))
            {
                return(false);
            }
        }

        if (argCommand == CommandMode.MCDOWN)
        {
            if (!TransferLogic.Command_MemcardDownload(argCard, argFileName))
            {
                return(false);
            }
        }

        // Peek / Read functions

        if (argCommand == CommandMode.DUMP)
        {
            if (!TransferLogic.Command_Dump(argAddr, argSize))
            {
                return(false);
            }
        }

        if (argCommand == CommandMode.WATCH)
        {
            TransferLogic.Watch(argAddr, argSize);
            return(true);
        }


        //
        // Major work in progress
        //

        if (argCommand == CommandMode.GDB)
        {
            GDB.DebugInit(argPort);
        }

        if (argCommand == CommandMode.BRIDGE)
        {
            GDB.Init(argPort);
        }

        //
        // All done, are we leaving the comms monitor open?
        //

        if (monitorComms)
        {
            GDB.MonitorSerialToSocket();
        }
        else
        {
            Console.WriteLine("\n Bye!");
            activeSerial.Close();
        }

        return(true);
    }     // void Transfer