Skip to content

Commit

Permalink
Release 0.6.0.9
Browse files Browse the repository at this point in the history
---------------
Allow console output to be visible for command line users.
Replaced the --kernel options to accept valid .pgz, .pgx, .hex and .bin files instead of only .hex.
The --board option now accepts b, c, u, u+, jr and jr816.
  • Loading branch information
Daniel Tremblay committed Jun 30, 2023
1 parent b378c90 commit cd09558
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 116 deletions.
81 changes: 53 additions & 28 deletions Main/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static void Main(string[] args)
private static Dictionary<String,String> DecodeProgramArguments(string[] args)
{
AttachConsole(ATTACH_PARENT_PROCESS);

Dictionary<string, string> context = new Dictionary<string, string>
{
{ "Continue", "true" }
Expand All @@ -45,12 +45,17 @@ private static Dictionary<String,String> DecodeProgramArguments(string[] args)
switch (args[i].Trim())
{
// the hex file to load is specified
case "-h":
case "--hex":
case "-k":
case "--kernel":
// a kernel file must be specified
if (args[i + 1].Trim().StartsWith("-") || !args[i + 1].Trim().EndsWith("hex"))
if (args[i + 1].Trim().StartsWith("-")
|| (
!args[i + 1].Trim().ToLower().EndsWith(".hex")
&& !args[i + 1].Trim().ToLower().EndsWith(".pgz")
&& !args[i + 1].Trim().ToLower().EndsWith(".pgx")
&& !args[i + 1].Trim().ToLower().EndsWith(".bin")))
{
Console.Out.WriteLine("You must specify a hex file.");
Console.Out.WriteLine(" - You must specify a hex, pgz, pgx or bin file.");
context["Continue"] = "false";
}
context.Add("defaultKernel", args[i + 1]);
Expand Down Expand Up @@ -91,26 +96,47 @@ private static Dictionary<String,String> DecodeProgramArguments(string[] args)
case "--irq":
context.Add("disabledIRQs", "true");
break;
// Board Version B or C
// Board Version B, C, U, U+, Jr, Jr816
case "-b":
case "--board":
string verArg = args[i + 1];
switch (verArg.ToLower())
if (verArg.StartsWith("-"))
{
Console.Out.WriteLine("Invalid board specified: " + verArg);
context["Continue"] = "false";
}
else
{
case "b":
context.Add("version", "RevB");
break;
case "c":
context.Add("version", "RevC");
break;
case "u":
context.Add("version", "RevU");
break;
case "u+":
context.Add("version", "RevU+");
break;
switch (verArg.ToLower())
{
case "b":
context.Add("version", "RevB");
break;
case "c":
context.Add("version", "RevC");
break;
case "u":
context.Add("version", "RevU");
break;
case "u+":
context.Add("version", "RevU+");
break;
case "jr":
context.Add("version", "RevJr");
break;
case "jr816":
context.Add("version", "RevJr816");
break;
default:
Console.Out.WriteLine("Invalid board specified: " + verArg + ". Must be one of b, c, u, u+, jr, jr816");
context["Continue"] = "false";
break;
}
i++;
}
break;
case "-h":
case "/?":
case "--help":
DisplayUsage();
context["Continue"] = "false";
Expand All @@ -122,43 +148,42 @@ private static Dictionary<String,String> DecodeProgramArguments(string[] args)
break;
}
}

// Add a carriage return
IntPtr cw = GetConsoleWindow();
SendMessage(cw, WM_CHAR, (IntPtr)VK_ENTER, IntPtr.Zero);

FreeConsole();

return context;
}

static void DisplayUsage()
{
Console.Out.WriteLine("Foenix IDE Command Line Usage:");
Console.Out.WriteLine(" -h, --hex: kernel file name");
Console.Out.WriteLine(" -k, --kernel: kernel file name - must be .hex, .pgx, .pgz or .bin file");
Console.Out.WriteLine(" -j, --jump: jump to specified address");
Console.Out.WriteLine(" -r, --run: autorun true/false");
Console.Out.WriteLine(" -i, --irq: disable IRQs true/false");
Console.Out.WriteLine(" -b, --board: board revision b, c or u");
Console.Out.WriteLine(" --help: show this usage");
Console.Out.WriteLine(" -b, --board: board revision b, c, u, u+, jr, jr816");
Console.Out.WriteLine(" -h, --help, /?: show this usage");
}
static void Console_CancelKeyPress(object sender, ConsoleCancelEventArgs e)
{
Application.Exit();
}

[DllImport("kernel32.dll")]
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool AttachConsole(int dwProcessId);
private const int ATTACH_PARENT_PROCESS = -1;

[DllImport("kernel32.dll")]
[DllImport("kernel32.dll", SetLastError = true)]
static extern IntPtr GetConsoleWindow();

[DllImport("user32.dll")]
[DllImport("user32.dll", SetLastError = true)]
static extern int SendMessage(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);
const uint WM_CHAR = 0x0102;
const int VK_ENTER = 0x0D;

[DllImport("kernel32.dll")]
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool FreeConsole();
}
}
4 changes: 2 additions & 2 deletions Main/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.6.0.8")]
[assembly: AssemblyFileVersion("0.6.0.8")]
[assembly: AssemblyVersion("0.6.0.9")]
[assembly: AssemblyFileVersion("0.6.0.9")]
164 changes: 82 additions & 82 deletions Main/UI/CPUWindow.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions Release Notes.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
Release 0.6.0.9
---------------
Allow console output to be visible for command line users.
Replaced the --kernel options to accept valid .pgz, .pgx, .hex and .bin files instead of only .hex.
The --board option now accepts b, c, u, u+, jr and jr816.
The -h, /? and --help flags now display the usage.
** TODO: Update the Keyboard device for F256Jr (ScanCode Set 2).
** TODO: Users can now modify the CPU registers when in debug mode. The registers have a white background when editable.
** TODO: Implemented the various cursor modes and rates.
** TODO: Add breaklines in debugger listing, when memory is not contiguous.

Release 0.6.0.8
---------------
Fixed the interrupt checkboxes and the tooltips in the CPU Window to match the F256 or C256 registers.
Fixed an issue when loading .bin files - this now goes only to RAM, not devices.
Re-adjusted controls position in the Main and CPU windows and locked the forms.
Fixed issue when the machine was left in Jr(816) it would restart in C mode.
Changing the board version in the Main Window now is properly reflected in the CPU Window.
** TODO: Update the Keyboard device for F256Jr (ScanCode Set 2).
** TODO: Users can now modify the CPU registers when in debug mode. The registers have a white background when editable.
** TODO: Implemented the various cursor modes and rates.
** TODO: Add breaklines in debugger listing, when memory is not contiguous.

Release 0.6.0.7
---------------
Expand Down

0 comments on commit cd09558

Please sign in to comment.