Improved data uploader utility

This commit is contained in:
Ruud van Falier 2017-08-06 18:43:00 +02:00
parent 4ecef43360
commit 0dbb17d510
16 changed files with 111 additions and 29 deletions

View File

@ -1,5 +1,5 @@
// ---------------------------------------------------------------------------------- // // ---------------------------------------------------------------------------------- //
// Apple 1 Replica firmware for Arduino // // Apple 1 Mini firmware for Arduino //
// // // //
// Version 1.0 // // Version 1.0 //
// By Ruud van Falier // // By Ruud van Falier //
@ -106,7 +106,7 @@ void display_boot_message()
Serial.print("| "); Serial.print("| ");
Serial.print(VT100_OFF); Serial.print(VT100_OFF);
Serial.print(VT100_BOLD); Serial.print(VT100_BOLD);
Serial.print("APPLE 1 REPLICA"); Serial.print("APPLE 1 MINI");
Serial.print(VT100_OFF); Serial.print(VT100_OFF);
Serial.print(VT100_DEFAULT); Serial.print(VT100_DEFAULT);
Serial.println(" |"); Serial.println(" |");

View File

@ -1,4 +1,3 @@
004A: 00 08 00 10 00 1B 004A: 00 08 00 10 00 1B
0050: FF FF FF FF FF FF FF FF 0050: FF FF FF FF FF FF FF FF
0058: FF FF FF FF FF FF FF FF 0058: FF FF FF FF FF FF FF FF
@ -278,6 +277,3 @@
0FE8: CC C9 CD C9 D4 A0 C9 D3 0FE8: CC C9 CD C9 D4 A0 C9 D3
0FF0: A0 A4 B3 B0 B0 B0 AE A0 0FF0: A0 A4 B3 B0 B0 B0 AE A0
0FF8: 29 47 03 5F B3 B8 0B 01 0FF8: 29 47 03 5F B3 B8 0B 01
E2B3R
RUN

View File

@ -0,0 +1,3 @@
E2B3R
RUN

View File

@ -0,0 +1,2 @@
280: A2 C BD 8B 2 20 EF FF CA D0 F7 60 8D C4 CC D2 CF D7 A0 CF CC CC C5 C8

View File

@ -0,0 +1,39 @@
0: 00 05 00 10 00 00 00 00
8: 00 00 00 00 00 00 00 00
280: A9 00 85 07 A9 00 A8 AA
288: 85 06 A5 00 85 04 A5 01
290: 85 05 C0 04 D0 04 A5 04
298: 85 06 C0 05 D0 04 A5 05
2A0: 85 06 A5 06 81 04 A1 04
2A8: C5 06 D0 2E E6 04 D0 02
2B0: E6 05 A5 02 C5 04 D0 04
2B8: A5 03 C5 05 D0 D4 A5 00
2C0: 85 04 A5 01 85 05 C0 04
2C8: D0 04 A5 04 85 06 C0 05
2D0: D0 04 A5 05 85 06 A1 04
2D8: C5 06 D0 69 E6 04 D0 02
2E0: E6 05 A5 02 C5 04 D0 04
2E8: A5 03 C5 05 D0 D8 C0 00
2F0: D0 08 A9 FF 85 06 C8 4C
2F8: 8A 02 C0 01 D0 04 A9 01
300: D0 F2 C0 02 D0 08 06 06
308: 90 ED A9 7F D0 E6 C0 03
310: D0 08 38 66 06 B0 E0 C8
318: D0 DD C0 04 F0 F9 A9 50
320: 20 6C 03 A9 41 20 6C 03
328: A9 53 20 6C 03 A9 53 20
330: 6C 03 20 9C 03 E6 07 A5
338: 07 20 70 03 20 91 03 EA
340: EA EA 4C 84 02 48 98 20
348: 70 03 20 9C 03 A5 05 20
350: 70 03 A5 04 20 70 03 20
358: 9C 03 A5 06 20 70 03 20
360: 9C 03 68 20 70 03 20 91
368: 03 4C 00 FF 20 EF FF 60
370: 48 4A 4A 4A 4A 29 0F 09
378: 30 C9 3A 90 02 69 06 20
380: 6C 03 68 29 0F 09 30 C9
388: 3A 90 02 69 06 20 6C 03
390: 60 A9 0D 20 6C 03 A9 0A
398: 20 6C 03 60 A9 20 20 6C
3A0: 03 60

View File

@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15 # Visual Studio 15
VisualStudioVersion = 15.0.26430.14 VisualStudioVersion = 15.0.26430.14
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Uploader", "Uploader\Uploader.csproj", "{A6D02388-9408-492F-A165-B6D4EA110558}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataUploader", "DataUploader\DataUploader.csproj", "{A6D02388-9408-492F-A165-B6D4EA110558}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

@ -6,8 +6,8 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A6D02388-9408-492F-A165-B6D4EA110558}</ProjectGuid> <ProjectGuid>{A6D02388-9408-492F-A165-B6D4EA110558}</ProjectGuid>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<RootNamespace>Uploader</RootNamespace> <RootNamespace>DataUploader</RootNamespace>
<AssemblyName>Uploader</AssemblyName> <AssemblyName>DataUploader</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>

View File

@ -1,16 +1,22 @@
using System; using System;
using System.Diagnostics;
using System.IO; using System.IO;
using System.IO.Ports; using System.IO.Ports;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
namespace Uploader namespace DataUploader
{ {
class Program class Program
{ {
private const string PORT = "COM7"; private const string PORT = "COM5";
private const int DELAY_CHAR = 30;
private const int DELAY_LINE = 100;
private static SerialPort serial = new SerialPort(PORT, 9600, Parity.None, 8, StopBits.One); private static SerialPort serial = new SerialPort(PORT, 9600, Parity.None, 8, StopBits.One);
private static bool receiving;
private static Stopwatch duration;
[STAThread] [STAThread]
static void Main(string[] args) static void Main(string[] args)
@ -27,6 +33,14 @@ namespace Uploader
Console.WriteLine("Connected..."); Console.WriteLine("Connected...");
Console.WriteLine($"Uploading {dialog.FileName}"); Console.WriteLine($"Uploading {dialog.FileName}");
// Wait for firmware to load (Arduino may reset on connect).
Thread.Sleep(2000);
// Clear the buffer
SendNewLine();
duration = Stopwatch.StartNew();
using (var reader = new StreamReader(dialog.FileName, Encoding.ASCII)) using (var reader = new StreamReader(dialog.FileName, Encoding.ASCII))
{ {
int progress = 0; int progress = 0;
@ -36,25 +50,40 @@ namespace Uploader
{ {
int data = reader.Read(); int data = reader.Read();
// Don't send any data if we are busy receiving
while (receiving)
{
Thread.Sleep(10);
}
if (data < 96) if (data < 96)
{ {
serial.Write(new byte[] { (byte)data }, 0, 1); if (data != 10 && data != 13)
Thread.Sleep(50);
if (data == 13)
{ {
Thread.Sleep(150); serial.Write(((char) data).ToString());
Thread.Sleep(DELAY_CHAR);
}
else if (data == 13)
{
SendNewLine();
} }
Console.Write((char) data); Console.Write((char) data);
} }
else
{
Debug.Write(string.Format("[{0}]", data));
}
Progress(++progress, total); Progress(++progress, total);
} }
} }
serial.WriteLine(""); Console.WriteLine("");
Console.WriteLine("Finishing...");
SendNewLine();
serial.Close(); serial.Close();
Console.Title = "Upload succeeded!"; Console.Title = "Upload succeeded!";
@ -64,16 +93,27 @@ namespace Uploader
Console.ReadKey(); Console.ReadKey();
} }
private static void SendNewLine()
{
serial.Write("\r");
Thread.Sleep(DELAY_CHAR);
serial.Write("\n");
Thread.Sleep(DELAY_LINE);
}
private static void Serial_DataReceived(object sender, SerialDataReceivedEventArgs e) private static void Serial_DataReceived(object sender, SerialDataReceivedEventArgs e)
{ {
receiving = true;
serial.ReadExisting(); serial.ReadExisting();
receiving = false;
} }
private static void Progress(int progress, long total) private static void Progress(int progress, long total)
{ {
decimal percentage = progress / ((decimal)total / 100); decimal percentage = progress / ((decimal)total / 100);
int bytesPerSec = (int)(progress / duration.Elapsed.TotalSeconds);
Console.Title = $"Uploading... ({progress:N0} of {total:N0} bytes - {percentage:N2}%)"; Console.Title = $"Uploading... ({progress:N0} of {total:N0} bytes - {bytesPerSec} bytes/sec - {percentage:N2}%)";
} }
} }
} }

View File

@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("Uploader")] [assembly: AssemblyTitle("DataUploader")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Uploader")] [assembly: AssemblyProduct("DataUploader")]
[assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]

View File

@ -1,8 +1,10 @@
# Data uploader utility # Data Uploader utility
## Upload memory data to the Apple 1 Mini
It's difficult to upload data to the Apple 1 Mini using most standard terminal clients because there need to be specific delays in between data being sent. It's difficult to upload data to the Apple 1 Mini using most standard terminal clients because there need to be specific delays in between data being sent.
This utility simplifies that process by letting select a file and handling the upload for you. This utility simplifies that process by letting select a file and handling the upload for you.
**Utility is still under development and not very user friendly at the moment!** **Utility is still under development and not very user friendly at the moment!**
Requires Visual Studio to build *Requires Visual Studio to build*

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB