Skip to content

Commit

Permalink
Release 0.5.5.6 - fixed a crash when video memory offsets are greater…
Browse files Browse the repository at this point in the history
… than $3F:FFFF.
  • Loading branch information
dtremblay committed Jul 3, 2021
1 parent 7ddf18c commit d495b95
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 20 deletions.
8 changes: 4 additions & 4 deletions Main/Display/Gpu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ private unsafe void DrawBitmap(int* p, bool gammaCorrection, int layer, bool bkg
}
byte lutIndex = (byte)((reg >> 1) & 7); // 8 possible LUTs

int bitmapAddress = VICKY.ReadLong(regAddr + 1);
int bitmapAddress = VICKY.ReadLong(regAddr + 1) & 0x3F_FFFF;
int xOffset = VICKY.ReadWord(regAddr + 4);
int yOffset = VICKY.ReadWord(regAddr + 6);

Expand Down Expand Up @@ -639,7 +639,7 @@ private unsafe void DrawTiles(int* p, bool gammaCorrection, byte TextColumns, in

int tilemapWidth = VICKY.ReadWord(addrTileCtrlReg + 4) & 0x3FF; // 10 bits
//int tilemapHeight = VICKY.ReadWord(addrTileCtrlReg + 6) & 0x3FF; // 10 bits
int tilemapAddress = VICKY.ReadLong(addrTileCtrlReg + 1 );
int tilemapAddress = VICKY.ReadLong(addrTileCtrlReg + 1 ) & 0x3F_FFFF;

int tilemapWindowX = VICKY.ReadWord(addrTileCtrlReg + 8);
bool dirUp = (tilemapWindowX & 0x4000) != 0;
Expand All @@ -666,7 +666,7 @@ private unsafe void DrawTiles(int* p, bool gammaCorrection, byte TextColumns, in
int[] strides = new int[8];
for (int i=0;i<8;i++)
{
tilesetPointers[i] = VICKY.ReadLong(MemoryMap.TILESET_BASE_ADDR - MemoryMap.VICKY_BASE_ADDR + i * 4);
tilesetPointers[i] = VICKY.ReadLong(MemoryMap.TILESET_BASE_ADDR - MemoryMap.VICKY_BASE_ADDR + i * 4) & 0x3F_FFFF;
byte tilesetConfig = VICKY.ReadByte(MemoryMap.TILESET_BASE_ADDR - MemoryMap.VICKY_BASE_ADDR + i * 4 + 3);
strides[i] = (tilesetConfig & 8) != 0 ? 256 : 16;
}
Expand Down Expand Up @@ -758,7 +758,7 @@ private unsafe void DrawSprites(int* p, bool gammaCorrection, byte layer, bool b
int lutAddress = MemoryMap.GRP_LUT_BASE_ADDR - MemoryMap.VICKY_BASE_ADDR + lutIndex * 1024;
bool striding = (reg & 0x80) == 0x80;

int spriteAddress = VICKY.ReadLong(addrSprite + 1);
int spriteAddress = VICKY.ReadLong(addrSprite + 1) & 0x3F_FFFF;
int posX = VICKY.ReadWord(addrSprite + 4) - 32;


Expand Down
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.5.5.5")]
[assembly: AssemblyFileVersion("0.5.5.5")]
[assembly: AssemblyVersion("0.5.5.6")]
[assembly: AssemblyFileVersion("0.5.5.6")]
2 changes: 1 addition & 1 deletion Main/UI/AssetLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ private unsafe void ConvertBitmapToRaw(Bitmap bitmap, ResourceChecker.Resource r

for (int i = 2; i < 256; i++)
{
int value = MemMgrRef.VICKY.ReadLong(lutBaseAddress + 4 * i);
int value = MemMgrRef.VICKY.ReadLong(lutBaseAddress + 4 * i) & 0x3F_FFFF;
if (value != 0)
{
lut.Add(value);
Expand Down
13 changes: 8 additions & 5 deletions Main/UI/GameGeneratorForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,18 @@ public partial class GameGeneratorForm : Form
Dictionary<string, List<string>> templates;

AutocompleteMenu popupMenu;
string[] keywords = {"ASSET", "COPY", "GOTO", "FILL", "VGM_INIT", "VGM_PLAY", "ENABLE_IRQS" };
string[] keywords = {"ASSET", "COPY", "GOTO", "FILL", "VGM_INIT", "VGM_PLAY", "ENABLE_INTERRUPTS",
"ENABLE_SPRITE", "DISABLE_SPRITE", "SET_SPRITE_POS",
"ENABLE_BITMAP", "DISABLE_BITMAP", "ENABLE_TILEMAP", "DISABLE_TILEMAP", "SET_TILEMAP_POS",
"IF", "ELSE", "VAR", "INCR", "DECR", "FOR"};
//string[] methods = { "Equals()", "GetHashCode()", "GetType()", "ToString()" };
string[] snippets = { "if(^)\n{\n;\n}", "if(^)\n{\n;\n}\nelse\n{\n;\n}", "for(^;;)\n{\n;\n}", "while(^)\n{\n;\n}", "do${\n^;\n}while();", "switch(^)\n{\ncase : break;\n}" };
string[] declarationSnippets = {
/*string[] declarationSnippets = {
"public class ^\n{\n}", "private class ^\n{\n}", "internal class ^\n{\n}",
"public struct ^\n{\n;\n}", "private struct ^\n{\n;\n}", "internal struct ^\n{\n;\n}",
"public void ^()\n{\n;\n}", "private void ^()\n{\n;\n}", "internal void ^()\n{\n;\n}", "protected void ^()\n{\n;\n}",
"public ^{ get; set; }", "private ^{ get; set; }", "internal ^{ get; set; }", "protected ^{ get; set; }"
};
};*/

public GameGeneratorForm()
{
Expand All @@ -58,8 +61,8 @@ private void BuildAutocompleteMenu()

foreach (var item in snippets)
items.Add(new SnippetAutocompleteItem(item) { ImageIndex = 1 });
foreach (var item in declarationSnippets)
items.Add(new DeclarationSnippet(item) { ImageIndex = 0 });
//foreach (var item in declarationSnippets)
// items.Add(new DeclarationSnippet(item) { ImageIndex = 0 });
//foreach (var item in methods)
// items.Add(new MethodAutocompleteItem(item) { ImageIndex = 2 });
foreach (var item in keywords)
Expand Down
21 changes: 17 additions & 4 deletions Main/UI/TileEditor.Designer.cs

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

14 changes: 10 additions & 4 deletions Main/UI/TileEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ public void Tilemap0Button_Click(object sender, EventArgs e)
int ControlReg = MemMgr.ReadByte(addrOffset);
TilemapEnabledCheckbox.Checked = (ControlReg & 1) != 0;
// address in memory
int tilemapAddr = MemMgr.ReadLong(addrOffset + 1);
int tilemapAddr = MemMgr.ReadLong(addrOffset + 1) & 0x3F_FFFF;
TilemapAddress.Text = (tilemapAddr + 0xB0_0000).ToString("X6");

int width = MemMgr.ReadWord(addrOffset + 4);
int height = MemMgr.ReadWord(addrOffset + 6);
int width = MemMgr.ReadWord(addrOffset + 4) & 0x3FF; // max 1024
int height = MemMgr.ReadWord(addrOffset + 6) & 0x3FF; // max 1024
Width.Text = width.ToString();
Height.Text = height.ToString();

Expand Down Expand Up @@ -312,7 +312,7 @@ private void TilemapEnabledCheckbox_CheckedChanged(object sender, EventArgs e)
private void TilesetList_SelectedIndexChanged(object sender, EventArgs e)
{
int tilesetBaseAddr = MemoryLocations.MemoryMap.TILESET_BASE_ADDR + TilesetList.SelectedIndex * 4;
int tilesetAddr = MemMgr.ReadLong(tilesetBaseAddr);
int tilesetAddr = MemMgr.ReadLong(tilesetBaseAddr) & 0x3F_FFFF;
TilesetAddress.Text = (tilesetAddr + 0xB0_0000).ToString("X6");
int cfgReg = MemMgr.ReadByte(tilesetBaseAddr + 3);
Stride256Checkbox.Checked = (cfgReg & 8) != 0;
Expand All @@ -327,5 +327,11 @@ private void LutList_SelectedIndexChanged(object sender, EventArgs e)
MemMgr.WriteByte(tilesetBaseAddr + 3, ConfigRegister);
TilesetViewer.Refresh();
}

private void btnMemory_Click(object sender, EventArgs e)
{
int address = Convert.ToInt32(TilemapAddress.Text, 16);
MemoryWindow.Instance.GotoAddress(address & 0xFFFF00);
}
}
}
5 changes: 5 additions & 0 deletions Release Notes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Release 0.5.5.6
---------------
Fixed an issue that cause the emulator to crash when Video Address written in Vicky are not offset properly.
Added a "Show Memory" button to the Tile Editor.

Release 0.5.5.5
---------------
Fixed FPtoFixed conversion and overflow flag assignment. This was causing problems in BASIC816 for loops.
Expand Down
Binary file modified bin/Release/FoenixIDE.exe
Binary file not shown.

0 comments on commit d495b95

Please sign in to comment.