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

@ -20,7 +20,7 @@ The project is heavily inspired by the [*Briel Computers Apple 1 Replica*](http:
- Design a modular casing with laser cut parts. The casing will house the main board, but additional layers can be put on top of it to increase its size and allow for expansion boards to be added later on.
- Release several varations of a DIY kit for this project (PCB only, PCB + passives, PCB + passives + casing, complete kit, etc.) so others can easily build the computer at home.
**Pictures of revision 0 (very first PCB based on the schematic to verify that it functions properly):**
**Pictures of revision 0 (very first PCB based on the schematic to verify that it functions properly):**
*(Revision 1, which is designated to be the first production revision, is currently being tested)*
<img src="https://github.com/DutchMaker/Apple-1-Mini/raw/master/docs/revision0.jpg" width="450" />

View File

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

View File

@ -1,4 +1,3 @@
004A: 00 08 00 10 00 1B
0050: 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
0FF0: A0 A4 B3 B0 B0 B0 AE A0
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
VisualStudioVersion = 15.0.26430.14
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
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

View File

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

View File

@ -1,16 +1,22 @@
using System;
using System.Diagnostics;
using System.IO;
using System.IO.Ports;
using System.Text;
using System.Threading;
using System.Windows.Forms;
namespace Uploader
namespace DataUploader
{
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 bool receiving;
private static Stopwatch duration;
[STAThread]
static void Main(string[] args)
@ -26,7 +32,15 @@ namespace Uploader
Console.WriteLine("Connected...");
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))
{
int progress = 0;
@ -35,26 +49,41 @@ namespace Uploader
while (reader.Peek() >= 0)
{
int data = reader.Read();
// Don't send any data if we are busy receiving
while (receiving)
{
Thread.Sleep(10);
}
if (data < 96)
{
serial.Write(new byte[] { (byte)data }, 0, 1);
Thread.Sleep(50);
if (data == 13)
if (data != 10 && 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);
}
}
Console.WriteLine("");
Console.WriteLine("Finishing...");
SendNewLine();
serial.WriteLine("");
serial.Close();
Console.Title = "Upload succeeded!";
@ -64,16 +93,27 @@ namespace Uploader
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)
{
receiving = true;
serial.ReadExisting();
receiving = false;
}
private static void Progress(int progress, long total)
{
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
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Uploader")]
[assembly: AssemblyTitle("DataUploader")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Uploader")]
[assembly: AssemblyProduct("DataUploader")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[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.
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!**
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