Esempio n. 1
0
        private void tbKeyboardZone_KeyPress(object sender, KeyPressEventArgs e)
        {
            char c = e.KeyChar;

            // Special cases
            switch (c)
            {
            // Backspace -> Delete
            case '\b':
                c = (char)0x14;
                break;

            // Escape -> Run/Stop
            case (char)27:
                c = (char)0x03;
                break;
            }

            String key = new string(c, 1);

            Ultimate64Commands.SendKeyboardString(cfg, key);
            e.Handled = true;

            tbKeyboardZone.Text = key;
        }
Esempio n. 2
0
        private void bLoadJump_Click(object sender, EventArgs e)
        {
            if (binary == null)
            {
                return;
            }

            Ultimate64Commands.SendRamAndJump(cfg, binary);
        }
Esempio n. 3
0
        private void bLoadMemory_Click(object sender, EventArgs e)
        {
            if (binary == null)
            {
                return;
            }

            Ultimate64Commands.WriteMemoryWithAddress(cfg, binary);
        }
Esempio n. 4
0
        private void bSendString_Click(object sender, EventArgs e)
        {
            String text = tbCommand.Text;

            if (cbAppendReturn.Checked)
            {
                text += "\r";
            }

            Ultimate64Commands.SendKeyboardString(cfg, text);
        }
Esempio n. 5
0
 private void bReset_Click(object sender, EventArgs e)
 {
     if (cbConfirmReset.Checked)
     {
         var result = MessageBox.Show("Reset Ultimate 64, are you sure?", "Confirmation", MessageBoxButtons.OKCancel);
         if (result == DialogResult.Cancel)
         {
             return;
         }
     }
     Ultimate64Commands.SendReset(cfg);
 }
Esempio n. 6
0
        // TODO - Support petcat-style control codes?

        private static void Type(Config config, string[] args)
        {
            try
            {
                // Combine all the arguments into a single string.
                string[] vals = args.SubArray(2, args.Length - 2);
                string   text = String.Join(" ", vals);

                // Automatically add RETURN?
                if (text.StartsWith("-n "))
                {
                    text = text.Replace("-n ", "");
                }
                else
                {
                    text += "\r";   // RETURN
                }

                // Convert into char array
                char[] textAsChars = text.ToCharArray();

                // List of bytes to send.  Has to be bytes to handle 8-bit control characters in escape sequences.
                List <byte> bytesToSend = new List <byte>();

                // Loop through input string
                for (int i = 0; i < textAsChars.Length; i++)
                {
                    char c = textAsChars[i];

                    if (c == ESCAPE)
                    {
                        byte cc = SubstituteControlChar(textAsChars[++i]);  // Skips over control char on next loop
                        bytesToSend.Add(cc);
                    }
                    else
                    {
                        byte pet = Utilities.ASCIItoPETSCII(c);
                        bytesToSend.Add(pet);
                    }
                }

                Ultimate64Commands.SendKeyboardBytes(config, bytesToSend.ToArray());
            }
            catch (Exception e)
            {
                Handle(e);
            }
        }
Esempio n. 7
0
        private void bWriteMemory_Click(object sender, EventArgs e)
        {
            UInt16 address = (UInt16)udAddress.Value;

            char[]   delimiters = new char[] { ' ', ',' };
            string[] parts      = tbValues.Text.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);

            List <byte> vals = new List <byte>();

            foreach (string p in parts)
            {
                vals.Add(byte.Parse(p));
            }

            Ultimate64Commands.WriteMemory(cfg, address, vals.ToArray());
        }
Esempio n. 8
0
        private static void Poke(Config config, string param, string[] args)
        {
            try
            {
                string[] vals = args.SubArray(3, args.Length - 3);
                byte[]   data = new byte[vals.Length];

                for (int i = 0; i < vals.Length; i++)
                {
                    data[i] = Byte.Parse(vals[i]);
                }

                Ultimate64Commands.WriteMemory(config, UInt16.Parse(param), data);
            }
            catch (Exception e)
            {
                Handle(e);
            }
        }
Esempio n. 9
0
        private void tbKeyboardZone_KeyDown(object sender, KeyEventArgs e)
        {
            char key = '?';

            switch (e.KeyCode)                 // Reference:  http://sta.c64.org/cbm64pet.html
            {
            case Keys.Up:
                key = (char)0x91;
                break;

            case Keys.Down:
                key = (char)0x11;
                break;

            case Keys.Left:
                key = (char)0x9D;
                break;

            case Keys.Right:
                key = (char)0x1D;
                break;

            case Keys.Home:
                if (e.Shift)
                {
                    key = (char)0x93;
                }
                else
                {
                    key = (char)0x13;
                }
                break;

            case Keys.Insert:
                key = (char)0x94;
                break;

            case Keys.F1:
                key = (char)0x85;
                break;

            case Keys.F2:
                key = (char)0x89;
                break;

            case Keys.F3:
                key = (char)0x86;
                break;

            case Keys.F4:
                key = (char)0x8A;
                break;

            case Keys.F5:
                key = (char)0x87;
                break;

            case Keys.F6:
                key = (char)0x8B;
                break;

            case Keys.F7:
                key = (char)0x88;
                break;

            case Keys.F8:
                key = (char)0x8C;
                break;

            default:
                return;      // Don't send anything, key may be handled by _KeyPress
            }

            Ultimate64Commands.SendKeyboardKey(cfg, key);
            e.Handled = true;

            tbKeyboardZone.Text = "";
        }
Esempio n. 10
0
 private void bReadMemory_Click(object sender, EventArgs e)
 {
     byte[] buffer = Ultimate64Commands.ReadMemory(cfg);
     File.WriteAllBytes("c:\\Leif\\u64mem.bin", buffer);    // Not sure what this file actually is??  TODO, prompt for filename and make it a config item
     MessageBox.Show("Memory Dump Complete!");
 }
Esempio n. 11
0
        static int Main(string[] args)
        {
            try
            {
                if (args.Length == 0)
                {
                    Usage();
                }

                string ip    = args[0];
                string cmd   = args[1];
                string param = "";
                if (args.Length >= 3)
                {
                    param = args[2];
                }

                Config config = new Config(ip, 64);
                byte[] data   = null;

                switch (cmd)
                {
                case "reset":
                    Ultimate64Commands.SendReset(config);
                    break;

                case "type":
                    Type(config, args);
                    break;

                case "poke":
                    Poke(config, param, args);
                    break;

                case "write":
                case "load":
                    data = File.ReadAllBytes(param);
                    Ultimate64Commands.WriteMemoryWithAddress(config, data);
                    break;

                case "run":
                    data = File.ReadAllBytes(param);
                    Ultimate64Commands.SendRamAndRun(config, data);
                    break;

                case "jump":
                    data = File.ReadAllBytes(param);
                    Ultimate64Commands.SendRamAndJump(config, data);
                    break;

                default:
                    Usage();
                    break;
                }
            }
            catch (Exception e)
            {
                Handle(e);
            }

            return(0);
        }
Esempio n. 12
0
 private void bStopStream_Click(object sender, EventArgs e)
 {
     Ultimate64Commands.StopStream(cfg, Ultimate64Commands.StreamID.STREAM_DEBUG);
 }
Esempio n. 13
0
        private void bStartStream_Click(object sender, EventArgs e)
        {
            string local_ip = Ultimate64Commands.GetLocalIP(cfg);

            Ultimate64Commands.StartStream(cfg, Ultimate64Commands.StreamID.STREAM_DEBUG, local_ip + ":" + LISTEN_PORT.ToString());
        }