Skip to content

Commit

Permalink
Release 0.5.6.5
Browse files Browse the repository at this point in the history
---------------
Fixed the Asset Loader to use *.tlm for tilemaps, instead of .tls.
Added the "Restart with Default Kernel" menu item to reload the default kernel, instead of the last program.
Changed the PCB Revision to EMB, EMC, EMU and EM+ for Rev B, Rev C, Rev U and Rev U+ respectively.
  • Loading branch information
Daniel Tremblay committed May 1, 2022
1 parent 066868c commit 7d1b662
Show file tree
Hide file tree
Showing 9 changed files with 302 additions and 192 deletions.
1 change: 1 addition & 0 deletions FoenixIDE.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6F8BC56C-269E-4E6D-BC71-9A5A646BC9EE}"
ProjectSection(SolutionItems) = preProject
foenix-96x96.png = foenix-96x96.png
README.md = README.md
Release Notes.txt = Release Notes.txt
EndProjectSection
EndProject
Expand Down
17 changes: 16 additions & 1 deletion Main/FoenixSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,22 @@ public FoenixSystem(BoardVersion version, string DefaultKernel)
// Set board revision
MemMgr.GABE.WriteByte(MemoryMap.REVOFPCB_C - MemoryMap.GABE_START, (byte)'E');
MemMgr.GABE.WriteByte(MemoryMap.REVOFPCB_4 - MemoryMap.GABE_START, (byte)'M');
MemMgr.GABE.WriteByte(MemoryMap.REVOFPCB_A - MemoryMap.GABE_START, (byte)'U');
switch (boardVersion)
{
case BoardVersion.RevB:
MemMgr.GABE.WriteByte(MemoryMap.REVOFPCB_A - MemoryMap.GABE_START, (byte)'B');
break;
case BoardVersion.RevC:
MemMgr.GABE.WriteByte(MemoryMap.REVOFPCB_A - MemoryMap.GABE_START, (byte)'C');
break;
case BoardVersion.RevU:
MemMgr.GABE.WriteByte(MemoryMap.REVOFPCB_A - MemoryMap.GABE_START, (byte)'U');
break;
case BoardVersion.RevUPlus:
MemMgr.GABE.WriteByte(MemoryMap.REVOFPCB_A - MemoryMap.GABE_START, (byte)'+');
break;
}

// Set the rev date

}
Expand Down
11 changes: 9 additions & 2 deletions Main/UI/AssetLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ private unsafe void ConvertBitmapToRaw(Bitmap bitmap, ResourceChecker.Resource r
List<int> lut = null;


while (!done && mask != 0xc0)
while (!done && mask != 0x80)
{
int transparentColor = 0;
try
Expand Down Expand Up @@ -379,6 +379,8 @@ private unsafe void ConvertBitmapToRaw(Bitmap bitmap, ResourceChecker.Resource r
b = (byte)(bitmapPointer[line * bitmapData.Stride + col * bytesPerPixel] & mask);
g = (byte)(bitmapPointer[line * bitmapData.Stride + col * bytesPerPixel + 1] & mask);
r = (byte)(bitmapPointer[line * bitmapData.Stride + col * bytesPerPixel + 2] & mask);
// TODO - try this approximation
//
break;
case 4:
b = (byte)(bitmapPointer[line * bitmapData.Stride + col * bytesPerPixel] & mask);
Expand All @@ -388,7 +390,12 @@ private unsafe void ConvertBitmapToRaw(Bitmap bitmap, ResourceChecker.Resource r

break;
}
int rgb = b + g * 256 + r * 256 * 256;
int rgb = rgb = b + g * 256 + r * 256 * 256;
if (rgb != 0 && bytesPerPixel == 3 && mask == 0xc0)
{
rgb = (r * 7 / 255) << 5 + (g * 7 / 255) << 2 + (b * 3 / 255);
}

// Check if the RBG matches the transparent color
int index = 0;
if (rgb != transparentColor )
Expand Down
240 changes: 139 additions & 101 deletions Main/UI/CPUWindow.Designer.cs

Large diffs are not rendered by default.

35 changes: 23 additions & 12 deletions Main/UI/MainWindow.Designer.cs

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

31 changes: 26 additions & 5 deletions Main/UI/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,25 @@ private void DebugToolStripMenuItem_Click(object sender, EventArgs e)
}
}

private void DefaultKernelToolStripMenuItem_Click(object sender, EventArgs e)
{
previousCounter = 0;
debugWindow.Pause();
if (kernel.ResetCPU(defaultKernel))
{
gpu.Refresh();
debugWindow.SetKernel(kernel);
debugWindow.ClearTrace();
SetDipSwitchMemory();
memoryWindow.Memory = kernel.CPU.MemMgr;
memoryWindow.UpdateMCRButtons();
ResetSDCard();

// Restart the CPU
debugWindow.RunButton_Click(null, null);
}
}

private void MainWindow_FormClosing(object sender, FormClosingEventArgs e)
{
gpu.StartOfFrame = null;
Expand Down Expand Up @@ -1019,6 +1038,7 @@ private void EnableMenuItems()
{
RestartMenuItem.Enabled = true;
DebugMenuItem.Enabled = true;
DefaultKernelToolStripMenuItem.Enabled = true;
}

/*
Expand Down Expand Up @@ -1049,16 +1069,17 @@ private void DipSwitch_Paint(object sender, PaintEventArgs e)
int width = ((ToolStripLabel)sender).Width;
int height = ((ToolStripLabel)sender).Height;
e.Graphics.FillRectangle(Brushes.Red, new Rectangle(0, 0, width, height));
e.Graphics.DrawString("OFF", SystemFonts.SmallCaptionFont, Brushes.White, 0, 9);
e.Graphics.DrawString("ON", SystemFonts.SmallCaptionFont, Brushes.White, 2, -2);
Font smallFont = new Font(FontFamily.GenericMonospace, 7.0f);
e.Graphics.DrawString("ON", smallFont, Brushes.White, 2, -1); // ON above
e.Graphics.DrawString("OFF", smallFont, Brushes.White, 0, 7); // OFF below

for (int i = 0; i < 8; i++)
{
// Draw the switch slide
e.Graphics.FillRectangle(Brushes.LightGray, new Rectangle(textOffset + (i * switchWidth), offset, switchWidth - offset, bankHeight - offset * 2));
e.Graphics.DrawRectangle(Pens.DarkGray, new Rectangle(textOffset + (i * switchWidth), offset, switchWidth - offset, bankHeight - offset * 2));
e.Graphics.FillRectangle(Brushes.DarkSlateGray, new Rectangle(textOffset + (i * switchWidth), offset, switchWidth - offset, bankHeight - offset * 2));
e.Graphics.DrawRectangle(Pens.LightGray, new Rectangle(textOffset + (i * switchWidth), offset, switchWidth - offset, bankHeight - offset * 2));
int top = (switches[i]) ? offset + 1 : offset + dipHeight;
e.Graphics.FillEllipse(Brushes.DarkSlateGray, new Rectangle(textOffset + (i * switchWidth) + 1, top, switchWidth - offset * 2, dipHeight));
e.Graphics.FillEllipse(Brushes.Wheat, new Rectangle(textOffset + (i * switchWidth) + 1, top, switchWidth - offset * 2, dipHeight));
}
}
}
Expand Down
Loading

0 comments on commit 7d1b662

Please sign in to comment.