diff --git a/Main/Display/Gpu.cs b/Main/Display/Gpu.cs index 9469cfe..c84c2aa 100644 --- a/Main/Display/Gpu.cs +++ b/Main/Display/Gpu.cs @@ -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); @@ -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; @@ -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; } @@ -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; diff --git a/Main/Properties/AssemblyInfo.cs b/Main/Properties/AssemblyInfo.cs index 01fb122..23edd09 100644 --- a/Main/Properties/AssemblyInfo.cs +++ b/Main/Properties/AssemblyInfo.cs @@ -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")] diff --git a/Main/UI/AssetLoader.cs b/Main/UI/AssetLoader.cs index 6a8e227..daf6a78 100644 --- a/Main/UI/AssetLoader.cs +++ b/Main/UI/AssetLoader.cs @@ -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); diff --git a/Main/UI/GameGeneratorForm.cs b/Main/UI/GameGeneratorForm.cs index da0e401..0a94e87 100644 --- a/Main/UI/GameGeneratorForm.cs +++ b/Main/UI/GameGeneratorForm.cs @@ -29,15 +29,18 @@ public partial class GameGeneratorForm : Form Dictionary> 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() { @@ -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) diff --git a/Main/UI/TileEditor.Designer.cs b/Main/UI/TileEditor.Designer.cs index 769ee9d..f1535a1 100644 --- a/Main/UI/TileEditor.Designer.cs +++ b/Main/UI/TileEditor.Designer.cs @@ -61,6 +61,7 @@ private void InitializeComponent() this.LutList = new System.Windows.Forms.ComboBox(); this.TilesetAddress = new System.Windows.Forms.TextBox(); this.label4 = new System.Windows.Forms.Label(); + this.btnMemory = new System.Windows.Forms.Button(); this.HeaderPanel.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.TilesetViewer)).BeginInit(); this.TilemapGroup.SuspendLayout(); @@ -164,6 +165,7 @@ private void InitializeComponent() // // TilemapGroup // + this.TilemapGroup.Controls.Add(this.btnMemory); this.TilemapGroup.Controls.Add(this.WindowY); this.TilemapGroup.Controls.Add(this.WindowX); this.TilemapGroup.Controls.Add(this.label2); @@ -179,7 +181,7 @@ private void InitializeComponent() this.TilemapGroup.Controls.Add(this.TilemapEnabledCheckbox); this.TilemapGroup.Location = new System.Drawing.Point(5, 30); this.TilemapGroup.Name = "TilemapGroup"; - this.TilemapGroup.Size = new System.Drawing.Size(353, 133); + this.TilemapGroup.Size = new System.Drawing.Size(355, 133); this.TilemapGroup.TabIndex = 1; this.TilemapGroup.TabStop = false; this.TilemapGroup.Text = "Tilemap Properties"; @@ -286,10 +288,10 @@ private void InitializeComponent() // // TilemapAddress // - this.TilemapAddress.Location = new System.Drawing.Point(257, 17); + this.TilemapAddress.Location = new System.Drawing.Point(251, 17); this.TilemapAddress.MaxLength = 6; this.TilemapAddress.Name = "TilemapAddress"; - this.TilemapAddress.Size = new System.Drawing.Size(88, 20); + this.TilemapAddress.Size = new System.Drawing.Size(76, 20); this.TilemapAddress.TabIndex = 2; this.TilemapAddress.TextChanged += new System.EventHandler(this.TilemapAddress_TextChanged); // @@ -340,7 +342,7 @@ private void InitializeComponent() this.TilesetGroup.Controls.Add(this.label4); this.TilesetGroup.Location = new System.Drawing.Point(5, 192); this.TilesetGroup.Name = "TilesetGroup"; - this.TilesetGroup.Size = new System.Drawing.Size(353, 48); + this.TilesetGroup.Size = new System.Drawing.Size(355, 48); this.TilesetGroup.TabIndex = 5; this.TilesetGroup.TabStop = false; this.TilesetGroup.Text = "Tileset Properties"; @@ -389,6 +391,16 @@ private void InitializeComponent() this.label4.TabIndex = 0; this.label4.Text = "Tileset Address: $"; // + // btnMemory + // + this.btnMemory.Image = global::FoenixIDE.Simulator.Properties.Resources.memory_btn; + this.btnMemory.Location = new System.Drawing.Point(329, 14); + this.btnMemory.Name = "btnMemory"; + this.btnMemory.Size = new System.Drawing.Size(24, 24); + this.btnMemory.TabIndex = 13; + this.btnMemory.UseVisualStyleBackColor = true; + this.btnMemory.Click += new System.EventHandler(this.btnMemory_Click); + // // TileEditor // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -452,5 +464,6 @@ private void InitializeComponent() private System.Windows.Forms.Label label4; private System.Windows.Forms.CheckBox Stride256Checkbox; private System.Windows.Forms.ComboBox LutList; + private System.Windows.Forms.Button btnMemory; } } \ No newline at end of file diff --git a/Main/UI/TileEditor.cs b/Main/UI/TileEditor.cs index 906ddbe..b0ebab1 100644 --- a/Main/UI/TileEditor.cs +++ b/Main/UI/TileEditor.cs @@ -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(); @@ -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; @@ -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); + } } } diff --git a/Release Notes.txt b/Release Notes.txt index d54c738..fe13b36 100644 --- a/Release Notes.txt +++ b/Release Notes.txt @@ -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. diff --git a/bin/Release/FoenixIDE.exe b/bin/Release/FoenixIDE.exe index f7e13e5..d32ebef 100644 Binary files a/bin/Release/FoenixIDE.exe and b/bin/Release/FoenixIDE.exe differ