diff --git a/FoenixIDESetup/FoenixIDESetup.vdproj b/FoenixIDESetup/FoenixIDESetup.vdproj index 38dca77..9cfc6f2 100644 --- a/FoenixIDESetup/FoenixIDESetup.vdproj +++ b/FoenixIDESetup/FoenixIDESetup.vdproj @@ -135,19 +135,19 @@ } "Entry" { - "MsmKey" = "8:_944C207290DD4465B1DEC1E24DE2B090" + "MsmKey" = "8:_97ED8AC2650A4AF1AE552E30015BD9EF" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { - "MsmKey" = "8:_97ED8AC2650A4AF1AE552E30015BD9EF" + "MsmKey" = "8:_997CD1FAF6CF4BC390F7E9018B0C0B14" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { - "MsmKey" = "8:_997CD1FAF6CF4BC390F7E9018B0C0B14" + "MsmKey" = "8:_9C1708C0257F4DAFB3C32023098E2F72" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } @@ -737,10 +737,10 @@ "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_944C207290DD4465B1DEC1E24DE2B090" + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_97ED8AC2650A4AF1AE552E30015BD9EF" { - "SourcePath" = "8:..\\Main\\Resources\\base_asm\\vicky_ii_def.asm" - "TargetName" = "8:vicky_ii_def.asm" + "SourcePath" = "8:..\\Main\\Resources\\base_asm\\interrupt_def.asm" + "TargetName" = "8:interrupt_def.asm" "Tag" = "8:" "Folder" = "8:_2CED8A43FBFA44579E2CA91207C3D167" "Condition" = "8:" @@ -757,10 +757,10 @@ "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_97ED8AC2650A4AF1AE552E30015BD9EF" + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_997CD1FAF6CF4BC390F7E9018B0C0B14" { - "SourcePath" = "8:..\\Main\\Resources\\base_asm\\interrupt_def.asm" - "TargetName" = "8:interrupt_def.asm" + "SourcePath" = "8:..\\Main\\Resources\\base_asm\\VKYII_CFP9553_SDMA_def.asm" + "TargetName" = "8:VKYII_CFP9553_SDMA_def.asm" "Tag" = "8:" "Folder" = "8:_2CED8A43FBFA44579E2CA91207C3D167" "Condition" = "8:" @@ -777,10 +777,10 @@ "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } - "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_997CD1FAF6CF4BC390F7E9018B0C0B14" + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_9C1708C0257F4DAFB3C32023098E2F72" { - "SourcePath" = "8:..\\Main\\Resources\\base_asm\\VKYII_CFP9553_SDMA_def.asm" - "TargetName" = "8:VKYII_CFP9553_SDMA_def.asm" + "SourcePath" = "8:..\\Main\\Resources\\base_asm\\VKYII_CFP9553_GENERAL_def.asm" + "TargetName" = "8:VKYII_CFP9553_GENERAL_def.asm" "Tag" = "8:" "Folder" = "8:_2CED8A43FBFA44579E2CA91207C3D167" "Condition" = "8:" diff --git a/Main/Controls/ColorCheckBox.cs b/Main/Controls/ColorCheckBox.cs new file mode 100644 index 0000000..d3bd187 --- /dev/null +++ b/Main/Controls/ColorCheckBox.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace FoenixIDE.Simulator.Controls +{ + class ColorCheckBox: CheckBox + { + private bool active; + public bool IsActive + { + get + { + return active; + } + set + { + active = value; + Invalidate(); + } + } + + public ColorCheckBox() + { + Appearance = System.Windows.Forms.Appearance.Normal; + FlatStyle = System.Windows.Forms.FlatStyle.Flat; + TextAlign = ContentAlignment.MiddleRight; + FlatAppearance.BorderSize = 0; + AutoSize = false; + Height = 16; + } + + protected override void OnPaint(PaintEventArgs pevent) + { + pevent.Graphics.Clear(BackColor); + Size box = new Size(Size.Width - 2, Size.Height - 2); + SolidBrush foreBrush = new SolidBrush(ForeColor); + if (Text.Length > 0) + { + + pevent.Graphics.DrawString(Text, Font, foreBrush, 27, 0); + } + + Rectangle rect = new Rectangle(new Point(0,0), box); + + pevent.Graphics.FillRectangle(active ? Brushes.Crimson : Brushes.White, rect); + + if (Checked) + { + using (Font wing = new Font("Wingdings", 10f)) + pevent.Graphics.DrawString("ü", wing, foreBrush, -1, 0); + } + pevent.Graphics.DrawRectangle(Pens.DarkSlateBlue, rect); + + Rectangle fRect = ClientRectangle; + + //if (Focused) + //{ + // fRect.Inflate(-1, -1); + // using (Pen pen = new Pen(Brushes.Gray) { DashStyle = System.Drawing.Drawing2D.DashStyle.Dot }) + // pevent.Graphics.DrawRectangle(pen, fRect); + //} + } + } + + +} diff --git a/Main/FileFormat/HexFile.cs b/Main/FileFormat/HexFile.cs index 174bb84..8347c51 100644 --- a/Main/FileFormat/HexFile.cs +++ b/Main/FileFormat/HexFile.cs @@ -51,7 +51,7 @@ static public String Load(MemoryRAM ram, string Filename, int gabeAddressBank, o // data row. The next n bytes are data to be loaded into memory case "00": address = GetByte(offset, 0, 2); - if (startAddress == -1) + if (startAddress == -1 && ((address & 0xFF00) != 0xFF00)) { startAddress = bank + address; } @@ -74,7 +74,7 @@ static public String Load(MemoryRAM ram, string Filename, int gabeAddressBank, o // end of file - just ignore case "01": - length = bank + address - startAddress; + length = address; break; case "02": diff --git a/Main/FoenixIDE.csproj b/Main/FoenixIDE.csproj index c6caae1..1f26aae 100644 --- a/Main/FoenixIDE.csproj +++ b/Main/FoenixIDE.csproj @@ -81,6 +81,9 @@ + + Component + @@ -356,9 +359,13 @@ + + PreserveNewest + PreserveNewest + @@ -416,9 +423,6 @@ PreserveNewest - - PreserveNewest - PreserveNewest diff --git a/Main/Properties/AssemblyInfo.cs b/Main/Properties/AssemblyInfo.cs index 23edd09..cc1bd98 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.6")] -[assembly: AssemblyFileVersion("0.5.5.6")] +[assembly: AssemblyVersion("0.5.5.7")] +[assembly: AssemblyFileVersion("0.5.5.7")] diff --git a/Main/Properties/Resources.Designer.cs b/Main/Properties/Resources.Designer.cs index 75b9179..58292f8 100644 --- a/Main/Properties/Resources.Designer.cs +++ b/Main/Properties/Resources.Designer.cs @@ -89,5 +89,15 @@ internal static System.Drawing.Bitmap save_btn { return ((System.Drawing.Bitmap)(obj)); } } + + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap zero { + get { + object obj = ResourceManager.GetObject("zero", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } } } diff --git a/Main/Properties/Resources.resx b/Main/Properties/Resources.resx index 1792ced..9f34f6f 100644 --- a/Main/Properties/Resources.resx +++ b/Main/Properties/Resources.resx @@ -127,4 +127,7 @@ ..\Resources\save_btn.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\zero.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/Main/Resources/base_asm/vicky_ii_def.asm b/Main/Resources/base_asm/VKYII_CFP9553_GENERAL_def.asm similarity index 70% rename from Main/Resources/base_asm/vicky_ii_def.asm rename to Main/Resources/base_asm/VKYII_CFP9553_GENERAL_def.asm index 3402877..5130625 100644 --- a/Main/Resources/base_asm/vicky_ii_def.asm +++ b/Main/Resources/base_asm/VKYII_CFP9553_GENERAL_def.asm @@ -1,7 +1,4 @@ -; -; Internal VICKY Registers and Internal Memory Locations (LUTs) -; - +;Internal VICKY Registers and Internal Memory Locations (LUTs) MASTER_CTRL_REG_L = $AF0000 ;Control Bits Fields Mstr_Ctrl_Text_Mode_En = $01 ; Enable the Text Mode @@ -17,9 +14,18 @@ MASTER_CTRL_REG_H = $AF0001 Mstr_Ctrl_Video_Mode0 = $01 ; 0 - 640x480 (Clock @ 25.175Mhz), 1 - 800x600 (Clock @ 40Mhz) Mstr_Ctrl_Video_Mode1 = $02 ; 0 - No Pixel Doubling, 1- Pixel Doubling (Reduce the Pixel Resolution by 2) -; Reserved - TBD -VKY_RESERVED_00 = $AF0002 +; New - GAMMA Control/HI-Res DipSwitch Value; +GAMMA_CTRL_REG = $AF0002 +GAMMA_Ctrl_Input = $01 ; 0 = DipSwitch Chooses GAMMA on/off , 1- Software Control +GAMMA_Ctrl_Soft = $02 ; 0 = GAMMA Table is not Applied, 1 = GAMMA Table is Applied +SYNC_Turn_Off = $04 ; 0 = Normal Operation, 1 = Turn Off Sync to get sleep mode from Monitor +GAMMA_DP_SW_VAL = $08 ; READ ONLY - Actual DIP Switch Value +HIRES_DP_SW_VAL = $10 ; READ ONLY - 0 = Hi-Res on BOOT ON, 1 = Hi-Res on BOOT OFF + + + VKY_RESERVED_01 = $AF0003 + Border_Ctrl_Enable = $01 BORDER_CTRL_REG = $AF0004 ; Bit[0] - Enable (1 by default) Bit[4..6]: X Scroll Offset ( Will scroll Left) (Acceptable Value: 0..7) BORDER_COLOR_B = $AF0005 @@ -28,13 +34,17 @@ BORDER_COLOR_R = $AF0007 BORDER_X_SIZE = $AF0008; X- Values: 0 - 32 (Default: 32) BORDER_Y_SIZE = $AF0009; Y- Values 0 -32 (Default: 32) +; AF000A +; AF000B +; AF000C + BACKGROUND_COLOR_B = $AF000D ; When in Graphic Mode, if a pixel is "0" then the Background pixel is chosen BACKGROUND_COLOR_G = $AF000E BACKGROUND_COLOR_R = $AF000F ; VKY_TXT_CURSOR_CTRL_REG = $AF0010 ;[0] Enable Text Mode Vky_Cursor_Enable = $01 -Vky_Cursor_Flash_Rate0 = $02 +Vky_Cursor_Flash_Rate0 = $02 ; 00 - 1/Sec, 01 - 2/Sec, 10 - 4/Sec, 11 - 5/Sec Vky_Cursor_Flash_Rate1 = $04 Vky_Cursor_FONT_Page0 = $08 ; Pick Font Page 0 or Font Page 1 Vky_Cursor_FONT_Page1 = $10 ; Pick Font Page 0 or Font Page 1 @@ -47,6 +57,9 @@ VKY_TXT_CURSOR_X_REG_H = $AF0015 VKY_TXT_CURSOR_Y_REG_L = $AF0016 VKY_TXT_CURSOR_Y_REG_H = $AF0017 +; AF0018 +; AF0019 +; AF001A ; Line Interrupt Registers VKY_LINE_IRQ_CTRL_REG = $AF001B ;[0] - Enable Line 0, [1] -Enable Line 1 @@ -56,10 +69,10 @@ VKY_LINE1_CMP_VALUE_LO = $AF001E ;Write Only [7:0] VKY_LINE1_CMP_VALUE_HI = $AF001F ;Write Only [3:0] ; When you Read the Register -VKY_INFO_CHIP_NUM_L = $AF001C -VKY_INFO_CHIP_NUM_H = $AF001D -VKY_INFO_CHIP_VER_L = $AF001E -VKY_INFO_CHIP_VER_H = $AF001F +VKY_INFO_CHIP_NUM_L = $AF001C ; Version +VKY_INFO_CHIP_NUM_H = $AF001D ; Version +VKY_INFO_CHIP_VER_L = $AF001E ; Sub-Version +VKY_INFO_CHIP_VER_H = $AF001F ; Sub-Version ; Mouse Pointer Graphic Memory MOUSE_PTR_GRAP0_START = $AF0500 ; 16 x 16 = 256 Pixels (Grey Scale) 0 = Transparent, 1 = Black , 255 = White @@ -82,8 +95,20 @@ C256F_MODEL_MINOR = $AF070C ; FPGA_DOR = $AF070D ; FPGA_MOR = $AF070E ; FPGA_YOR = $AF070F ; - ; = $AF0800 ; the RTC is Here + +; VMEM 2 CPU Read Registers +VMEM2CPU_CTRL_REG = $AF0900 ; +VMEM2CPU_Clear_FIFO = $01 ; Setting this to 1 will flush (Reset) the FIFO, clear it after to return to normal function + ; Probably a good idea to reset this before starting to fetch data from VMEM in your application +VMEM2CPU_Intterupt = $02 ; This is not implemented because there is not enough Interrupt line on the FMX + ; It could be implemented in the U... Right now it is not plugged anywere. +VMEM2CPU_Data_Port = $AF0901 ; This is a Byte Port of the data that you have requested. (Output of the FIFO) +VMEM2CPU_Fifo_Count_LO = $AF0902 ; FIFO Count Lo (number of byte in the FIFO) FIFO Count is 10bits, Count_Bit0 to Count_Bit7 of Count +VMEM2CPU_Fifo_Count_HI = $AF0903 ; FIFO Count Hi, Bit 0 = Count_Bit8, Bit 1 = Count_Bit9 +VMEM2CPU_Fifo_Empty = $80 ; Bit 7 of VMEM2CPU_Fifo_Count_HI, when 1, the FIFO is empty. + + ; = $AF1000 ; The SuperIO Start is Here ; = $AF13FF ; The SuperIO Start is Here @@ -104,16 +129,5 @@ GAMMA_G_LUT_PTR = $AF4100 GAMMA_R_LUT_PTR = $AF4200 FONT_MEMORY_BANK0 = $AF8000 ;$AF8000 - $AF87FF -FONT_MEMORY_BANK1 = $AF8800 ;$AF8800 - $AF8FFF CS_TEXT_MEM_PTR = $AFA000 CS_COLOR_MEM_PTR = $AFC000 - - -BTX_START = $AFE000 ; BEATRIX Registers -BTX_END = $AFFFFF - -.include "VKYII_CFP9553_BITMAP_def.asm" -.include "VKYII_CFP9553_TILEMAP_def.asm" -.include "VKYII_CFP9553_VDMA_def.asm" -.include "VKYII_CFP9553_SDMA_def.asm" -.include "VKYII_CFP9553_SPRITE_def.asm" \ No newline at end of file diff --git a/Main/Resources/base_asm/VKYII_CFP9553_TILEMAP_def.asm b/Main/Resources/base_asm/VKYII_CFP9553_TILEMAP_def.asm index 54b4dba..e2c56c1 100644 --- a/Main/Resources/base_asm/VKYII_CFP9553_TILEMAP_def.asm +++ b/Main/Resources/base_asm/VKYII_CFP9553_TILEMAP_def.asm @@ -1,11 +1,18 @@ ; CS_TileMAP0_Registers $AF:0200 - $AF:027F - TileMap +; A TileMAP is composed of 16bits Tile Number +;Active_Tile_Data[7:0] -> Tile Number +;Active_Tile_Data[10:8] -> Tile Attributes // Tile Set +;Active_Tile_Data[13:11] -> Undefined +;Active_Tile_Data[14] -> Undefined +;Active_Tile_Data[15] -> undefined + ; Bit Field Definition for the Control Register TILE_Enable = $01 - +TILE_Collision_On = $40 ; Enable ; ;Tile MAP Layer 0 Registers -TL0_CONTROL_REG = $AF0200 ; Bit[0] - Enable, Bit[3:1] - LUT Select, +TL0_CONTROL_REG = $AF0200 ; Bit[0] - Enable, Bit[3:1] - LUT Select, Bit[6] - Collision On TL0_START_ADDY_L = $AF0201 ; Not USed right now - Starting Address to where is the MAP TL0_START_ADDY_M = $AF0202 TL0_START_ADDY_H = $AF0203 @@ -14,10 +21,9 @@ TL0_TOTAL_X_SIZE_H = $AF0205 TL0_TOTAL_Y_SIZE_L = $AF0206 ; Size of the Map in Y Tile Count [9:0] TL0_TOTAL_Y_SIZE_H = $AF0207 TL0_WINDOW_X_POS_L = $AF0208 ; Top Left Corner Position of the TileMAp Window in X + Scroll -TL0_WINDOW_X_POS_H = $AF0209 ; Direction: [14] Scroll: [13:10] Pos: [9:0] in X +TL0_WINDOW_X_POS_H = $AF0209 ; Direction: [14] Pos: [13-4] Scroll: [3:0] in X TL0_WINDOW_Y_POS_L = $AF020A ; Top Left Corner Position of the TileMAp Window in Y -TL0_WINDOW_Y_POS_H = $AF020B ; Direction: [14] Scroll: [13:10] Pos: [9:0] in Y - +TL0_WINDOW_Y_POS_H = $AF020B ; Direction: [14] Pos: [13:4] Scroll: [3:0] in Y ;Tile MAP Layer 1 Registers TL1_CONTROL_REG = $AF020C ; Bit[0] - Enable, Bit[3:1] - LUT Select, TL1_START_ADDY_L = $AF020D ; Not USed right now - Starting Address to where is the MAP @@ -28,10 +34,9 @@ TL1_TOTAL_X_SIZE_H = $AF0211 TL1_TOTAL_Y_SIZE_L = $AF0212 ; Size of the Map in Y Tile Count [9:0] TL1_TOTAL_Y_SIZE_H = $AF0213 TL1_WINDOW_X_POS_L = $AF0214 ; Top Left Corner Position of the TileMAp Window in X + Scroll -TL1_WINDOW_X_POS_H = $AF0215 ; Direction: [14] Scroll: [13:10] Pos: [9:0] in X +TL1_WINDOW_X_POS_H = $AF0215 ; Direction: [14] Pos: [13-4] Scroll: [3:0] in X TL1_WINDOW_Y_POS_L = $AF0216 ; Top Left Corner Position of the TileMAp Window in Y -TL1_WINDOW_Y_POS_H = $AF0217 ; Direction: [14] Scroll: [13:10] Pos: [9:0] in Y - +TL1_WINDOW_Y_POS_H = $AF0217 ; Direction: [14] Pos: [13:4] Scroll: [3:0] in Y ;Tile MAP Layer 2 Registers TL2_CONTROL_REG = $AF0218 ; Bit[0] - Enable, Bit[3:1] - LUT Select, TL2_START_ADDY_L = $AF0219 ; Not USed right now - Starting Address to where is the MAP @@ -42,10 +47,9 @@ TL2_TOTAL_X_SIZE_H = $AF021D TL2_TOTAL_Y_SIZE_L = $AF021E ; Size of the Map in Y Tile Count [9:0] TL2_TOTAL_Y_SIZE_H = $AF021F TL2_WINDOW_X_POS_L = $AF0220 ; Top Left Corner Position of the TileMAp Window in X + Scroll -TL2_WINDOW_X_POS_H = $AF0221 ; Direction: [14] Scroll: [13:10] Pos: [9:0] in X +TL2_WINDOW_X_POS_H = $AF0221 ; Direction: [14] Pos: [13-4] Scroll: [3:0] in X TL2_WINDOW_Y_POS_L = $AF0222 ; Top Left Corner Position of the TileMAp Window in Y -TL2_WINDOW_Y_POS_H = $AF0223 ; Direction: [14] Scroll: [13:10] Pos: [9:0] in Y - +TL2_WINDOW_Y_POS_H = $AF0223 ; Direction: [14] Pos: [13:4] Scroll: [3:0] in Y ;Tile MAP Layer 3 Registers TL3_CONTROL_REG = $AF0224 ; Bit[0] - Enable, Bit[3:1] - LUT Select, TL3_START_ADDY_L = $AF0225 ; Not USed right now - Starting Address to where is the MAP @@ -56,54 +60,47 @@ TL3_TOTAL_X_SIZE_H = $AF0229 TL3_TOTAL_Y_SIZE_L = $AF022A ; Size of the Map in Y Tile Count [9:0] TL3_TOTAL_Y_SIZE_H = $AF022B TL3_WINDOW_X_POS_L = $AF022C ; Top Left Corner Position of the TileMAp Window in X + Scroll -TL3_WINDOW_X_POS_H = $AF022D ; Direction: [14] Scroll: [13:10] Pos: [9:0] in X +TL3_WINDOW_X_POS_H = $AF022D ; Direction: [14] Pos: [13-4] Scroll: [3:0] in X TL3_WINDOW_Y_POS_L = $AF022E ; Top Left Corner Position of the TileMAp Window in Y -TL3_WINDOW_Y_POS_H = $AF022F ; Direction: [14] Scroll: [13:10] Pos: [9:0] in Y +TL3_WINDOW_Y_POS_H = $AF022F ; Direction: [14] Pos: [13:4] Scroll: [3:0] in Y ; CS_TileMAP1_Registers $AF:0280 - $AF:02FF - TileData ; Tile Set 0 Location info TILESET0_ADDY_L = $AF0280 ; Pointer to Tileset 0 [21:0] TILESET0_ADDY_M = $AF0281 TILESET0_ADDY_H = $AF0282 -TILESET0_ADDY_CFG = $AF0283 ; [3] - TileStride256x256 [2:0] LUT - -; Tile Set 1 Location info +TILESET0_ADDY_CFG = $AF0283 ; [3] - TileStride256x256 +; Tile Set 0 Location info TILESET1_ADDY_L = $AF0284 TILESET1_ADDY_M = $AF0285 TILESET1_ADDY_H = $AF0286 TILESET1_ADDY_CFG = $AF0287 - -; Tile Set 2 Location info +; Tile Set 0 Location info TILESET2_ADDY_L = $AF0288 TILESET2_ADDY_M = $AF0289 TILESET2_ADDY_H = $AF028A TILESET2_ADDY_CFG = $AF028B - -; Tile Set 3 Location info +; Tile Set 0 Location info TILESET3_ADDY_L = $AF028C TILESET3_ADDY_M = $AF028D TILESET3_ADDY_H = $AF028E TILESET3_ADDY_CFG = $AF028F - -; Tile Set 4 Location info +; Tile Set 0 Location info TILESET4_ADDY_L = $AF0290 TILESET4_ADDY_M = $AF0291 TILESET4_ADDY_H = $AF0292 TILESET4_ADDY_CFG = $AF0293 - -; Tile Set 5 Location info +; Tile Set 0 Location info TILESET5_ADDY_L = $AF0294 TILESET5_ADDY_M = $AF0295 TILESET5_ADDY_H = $AF0296 TILESET5_ADDY_CFG = $AF0297 - -; Tile Set 6 Location info +; Tile Set 0 Location info TILESET6_ADDY_L = $AF0298 TILESET6_ADDY_M = $AF0299 TILESET6_ADDY_H = $AF029A TILESET6_ADDY_CFG = $AF029B - -; Tile Set 7 Location info +; Tile Set 0 Location info TILESET7_ADDY_L = $AF029C TILESET7_ADDY_M = $AF029D TILESET7_ADDY_H = $AF029E diff --git a/Main/Resources/zero.bmp b/Main/Resources/zero.bmp new file mode 100644 index 0000000..1a4e7fa Binary files /dev/null and b/Main/Resources/zero.bmp differ diff --git a/Main/UI/AssetLoader.Designer.cs b/Main/UI/AssetLoader.Designer.cs index bd5cd3c..0799d72 100644 --- a/Main/UI/AssetLoader.Designer.cs +++ b/Main/UI/AssetLoader.Designer.cs @@ -44,11 +44,12 @@ private void InitializeComponent() this.ExtensionLabel = new System.Windows.Forms.Label(); this.ExtLabel = new System.Windows.Forms.Label(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.labelHash = new System.Windows.Forms.Label(); this.textTransparentColor = new System.Windows.Forms.TextBox(); this.radioCustomColor = new System.Windows.Forms.RadioButton(); this.radioTopLeftColor = new System.Windows.Forms.RadioButton(); this.radioBlack = new System.Windows.Forms.RadioButton(); - this.labelHash = new System.Windows.Forms.Label(); + this.checkOverwriteLUT = new System.Windows.Forms.CheckBox(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // @@ -216,6 +217,15 @@ private void InitializeComponent() this.groupBox1.TabStop = false; this.groupBox1.Text = "Transparent Color"; // + // labelHash + // + this.labelHash.AutoSize = true; + this.labelHash.Location = new System.Drawing.Point(358, 16); + this.labelHash.Name = "labelHash"; + this.labelHash.Size = new System.Drawing.Size(15, 13); + this.labelHash.TabIndex = 28; + this.labelHash.Text = "#"; + // // textTransparentColor // this.textTransparentColor.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -266,20 +276,22 @@ private void InitializeComponent() this.radioBlack.UseVisualStyleBackColor = true; this.radioBlack.CheckedChanged += new System.EventHandler(this.radioBlack_CheckedChanged); // - // labelHash + // checkOverwriteLUT // - this.labelHash.AutoSize = true; - this.labelHash.Location = new System.Drawing.Point(358, 16); - this.labelHash.Name = "labelHash"; - this.labelHash.Size = new System.Drawing.Size(15, 13); - this.labelHash.TabIndex = 28; - this.labelHash.Text = "#"; + this.checkOverwriteLUT.AutoSize = true; + this.checkOverwriteLUT.Location = new System.Drawing.Point(330, 127); + this.checkOverwriteLUT.Name = "checkOverwriteLUT"; + this.checkOverwriteLUT.Size = new System.Drawing.Size(134, 17); + this.checkOverwriteLUT.TabIndex = 25; + this.checkOverwriteLUT.Text = "Overwrite Existing LUT"; + this.checkOverwriteLUT.UseVisualStyleBackColor = true; // // AssetLoader // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(476, 177); + this.Controls.Add(this.checkOverwriteLUT); this.Controls.Add(this.groupBox1); this.Controls.Add(this.ExtLabel); this.Controls.Add(this.ExtensionLabel); @@ -334,5 +346,6 @@ private void InitializeComponent() private System.Windows.Forms.RadioButton radioTopLeftColor; private System.Windows.Forms.RadioButton radioBlack; private System.Windows.Forms.Label labelHash; + private System.Windows.Forms.CheckBox checkOverwriteLUT; } } \ No newline at end of file diff --git a/Main/UI/AssetLoader.cs b/Main/UI/AssetLoader.cs index daf6a78..a033e9c 100644 --- a/Main/UI/AssetLoader.cs +++ b/Main/UI/AssetLoader.cs @@ -278,6 +278,7 @@ private void StoreButton_Click(object sender, EventArgs e) else { // Keep the Asset Loader open + StoreButton.Enabled = true; } } @@ -306,7 +307,7 @@ private unsafe void ConvertBitmapToRaw(Bitmap bitmap, ResourceChecker.Resource r bool done = false; byte mask = 0xFF; List lut = null; - while (!done) + while (!done && mask != 0xc0) { int transparentColor = 0; try @@ -325,16 +326,20 @@ private unsafe void ConvertBitmapToRaw(Bitmap bitmap, ResourceChecker.Resource r 0xFFFFFF }; - for (int i = 2; i < 256; i++) + // The user may decide to overwrite the palette from this bitmap + if (!checkOverwriteLUT.Checked) { - int value = MemMgrRef.VICKY.ReadLong(lutBaseAddress + 4 * i) & 0x3F_FFFF; - if (value != 0) - { - lut.Add(value); - } - else + for (int i = 2; i < 256; i++) { - break; + int value = MemMgrRef.VICKY.ReadLong(lutBaseAddress + 4 * i); + if (value != 0) + { + lut.Add(value); + } + else + { + break; + } } } @@ -351,9 +356,9 @@ private unsafe void ConvertBitmapToRaw(Bitmap bitmap, ResourceChecker.Resource r case 1: byte palIndex = bitmapPointer[line * bitmapData.Stride + col * bytesPerPixel]; System.Drawing.Color palValue = bitmap.Palette.Entries[palIndex]; - b = palValue.B; - g = palValue.G; - r = palValue.R; + b = (byte)(palValue.B & mask); + g = (byte)(palValue.G & mask); + r = (byte)(palValue.R & mask); break; case 2: ushort wordValue = (ushort)(bitmapPointer[line * bitmapData.Stride + col * bytesPerPixel] + bitmapPointer[line * bitmapData.Stride + col * bytesPerPixel + 1] * 256); @@ -411,40 +416,53 @@ private unsafe void ConvertBitmapToRaw(Bitmap bitmap, ResourceChecker.Resource r } } } - - int videoAddress = resource.StartAddress - 0xB0_0000; - MemMgrRef.VIDEO.CopyBuffer(data, 0, videoAddress, data.Length); - - if (lut != null) + if (mask != 0xc0) { - for (int i = 0; i < lut.Count; i++) + int videoAddress = resource.StartAddress - 0xB0_0000; + + MemMgrRef.VIDEO.CopyBuffer(data, 0, videoAddress, data.Length); + + if (lut != null) { - int rbg = lut[i]; - MemMgrRef.VICKY.WriteByte(lutBaseAddress + 4 * i, LowByte(rbg)); - MemMgrRef.VICKY.WriteByte(lutBaseAddress + 4 * i + 1, MidByte(rbg)); - MemMgrRef.VICKY.WriteByte(lutBaseAddress + 4 * i + 2, HighByte(rbg)); + for (int i = 0; i < lut.Count; i++) + { + int rbg = lut[i]; + MemMgrRef.VICKY.WriteByte(lutBaseAddress + 4 * i, LowByte(rbg)); + MemMgrRef.VICKY.WriteByte(lutBaseAddress + 4 * i + 1, MidByte(rbg)); + MemMgrRef.VICKY.WriteByte(lutBaseAddress + 4 * i + 2, HighByte(rbg)); + } } - } - // Check if a LUT matching our index is present in the Resources, if so don't do anything. - Resource resLut = ResChecker.Find(ResourceType.lut, lutBaseAddress + MemoryLocations.MemoryMap.VICKY_BASE_ADDR); - if (resLut == null) { - Resource lutPlaceholder = new Resource + // Check if a LUT matching our index is present in the Resources, if so don't do anything. + Resource resLut = ResChecker.Find(ResourceType.lut, lutBaseAddress + MemoryLocations.MemoryMap.VICKY_BASE_ADDR); + if (resLut == null) { - Length = 0x400, - FileType = ResourceType.lut, - Name = "Generated LUT", - StartAddress = lutBaseAddress + MemoryLocations.MemoryMap.VICKY_BASE_ADDR - }; - ResChecker.Add(lutPlaceholder); + Resource lutPlaceholder = new Resource + { + Length = 0x400, + FileType = ResourceType.lut, + Name = "Generated LUT", + StartAddress = lutBaseAddress + MemoryLocations.MemoryMap.VICKY_BASE_ADDR + }; + ResChecker.Add(lutPlaceholder); + } + } + else + { + MessageBox.Show("An error occured converting the image colors to LUT.\n" + + "You can try loading the image with a different LUT or\n" + + "Zero one of the LUTs or\n" + + "Check the Overwrite Existing LUT checkbox"); + + ResChecker.Items.Remove(resource); + resource.Length = -1; } } else { resource.Length = -1; - StoreButton.Enabled = true; } } diff --git a/Main/UI/CPUWindow.Designer.cs b/Main/UI/CPUWindow.Designer.cs index 297da10..edc38c4 100644 --- a/Main/UI/CPUWindow.Designer.cs +++ b/Main/UI/CPUWindow.Designer.cs @@ -1,4 +1,6 @@ -namespace FoenixIDE.UI +using FoenixIDE.Simulator.Controls; + +namespace FoenixIDE.UI { partial class CPUWindow { @@ -55,32 +57,32 @@ private void InitializeComponent() this.InspectOverlayButton = new System.Windows.Forms.Button(); this.StepOverOverlayButton = new System.Windows.Forms.Button(); this.HeaderTextbox = new System.Windows.Forms.Label(); - this.panel1 = new System.Windows.Forms.Panel(); - this.SDCardCheckBox = new System.Windows.Forms.CheckBox(); - this.OPL2LCheckbox = new System.Windows.Forms.CheckBox(); - this.OPL2RCheckbox = new System.Windows.Forms.CheckBox(); - this.MPU401Checkbox = new System.Windows.Forms.CheckBox(); - this.COM1Checkbox = new System.Windows.Forms.CheckBox(); - this.COM2Checkbox = new System.Windows.Forms.CheckBox(); - this.FDCCheckbox = new System.Windows.Forms.CheckBox(); - this.MouseCheckbox = new System.Windows.Forms.CheckBox(); - this.RTCCheckbox = new System.Windows.Forms.CheckBox(); - this.TMR2Checkbox = new System.Windows.Forms.CheckBox(); - this.TMR1Checkbox = new System.Windows.Forms.CheckBox(); - this.TMR0Checkbox = new System.Windows.Forms.CheckBox(); - this.SOLCheckbox = new System.Windows.Forms.CheckBox(); + this.irqPanel = new System.Windows.Forms.Panel(); + this.SDCardCheckBox = new FoenixIDE.Simulator.Controls.ColorCheckBox(); + this.OPL2LCheckbox = new FoenixIDE.Simulator.Controls.ColorCheckBox(); + this.OPL2RCheckbox = new FoenixIDE.Simulator.Controls.ColorCheckBox(); + this.MPU401Checkbox = new FoenixIDE.Simulator.Controls.ColorCheckBox(); + this.COM1Checkbox = new FoenixIDE.Simulator.Controls.ColorCheckBox(); + this.COM2Checkbox = new FoenixIDE.Simulator.Controls.ColorCheckBox(); + this.FDCCheckbox = new FoenixIDE.Simulator.Controls.ColorCheckBox(); + this.MouseCheckbox = new FoenixIDE.Simulator.Controls.ColorCheckBox(); + this.RTCCheckbox = new FoenixIDE.Simulator.Controls.ColorCheckBox(); + this.TMR2Checkbox = new FoenixIDE.Simulator.Controls.ColorCheckBox(); + this.TMR1Checkbox = new FoenixIDE.Simulator.Controls.ColorCheckBox(); + this.TMR0Checkbox = new FoenixIDE.Simulator.Controls.ColorCheckBox(); + this.SOLCheckbox = new FoenixIDE.Simulator.Controls.ColorCheckBox(); this.Reg2Label = new System.Windows.Forms.Label(); this.Reg1Label = new System.Windows.Forms.Label(); this.Reg0Label = new System.Windows.Forms.Label(); - this.KeyboardCheckBox = new System.Windows.Forms.CheckBox(); - this.SOFCheckbox = new System.Windows.Forms.CheckBox(); + this.KeyboardCheckBox = new FoenixIDE.Simulator.Controls.ColorCheckBox(); + this.SOFCheckbox = new FoenixIDE.Simulator.Controls.ColorCheckBox(); this.BreakOnIRQCheckBox = new System.Windows.Forms.CheckBox(); this.LabelOverlayButton = new System.Windows.Forms.Button(); this.registerDisplay1 = new FoenixIDE.RegisterDisplay(); this.HeaderPanel.SuspendLayout(); this.SecondPanel.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.DebugPanel)).BeginInit(); - this.panel1.SuspendLayout(); + this.irqPanel.SuspendLayout(); this.SuspendLayout(); // // HeaderPanel @@ -377,161 +379,211 @@ private void InitializeComponent() this.HeaderTextbox.UseCompatibleTextRendering = true; this.HeaderTextbox.UseMnemonic = false; // - // panel1 - // - this.panel1.Controls.Add(this.SDCardCheckBox); - this.panel1.Controls.Add(this.OPL2LCheckbox); - this.panel1.Controls.Add(this.OPL2RCheckbox); - this.panel1.Controls.Add(this.MPU401Checkbox); - this.panel1.Controls.Add(this.COM1Checkbox); - this.panel1.Controls.Add(this.COM2Checkbox); - this.panel1.Controls.Add(this.FDCCheckbox); - this.panel1.Controls.Add(this.MouseCheckbox); - this.panel1.Controls.Add(this.RTCCheckbox); - this.panel1.Controls.Add(this.TMR2Checkbox); - this.panel1.Controls.Add(this.TMR1Checkbox); - this.panel1.Controls.Add(this.TMR0Checkbox); - this.panel1.Controls.Add(this.SOLCheckbox); - this.panel1.Controls.Add(this.Reg2Label); - this.panel1.Controls.Add(this.Reg1Label); - this.panel1.Controls.Add(this.Reg0Label); - this.panel1.Controls.Add(this.KeyboardCheckBox); - this.panel1.Controls.Add(this.SOFCheckbox); - this.panel1.Controls.Add(this.BreakOnIRQCheckBox); - this.panel1.Location = new System.Drawing.Point(372, 25); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(230, 74); - this.panel1.TabIndex = 12; + // irqPanel + // + this.irqPanel.Controls.Add(this.SDCardCheckBox); + this.irqPanel.Controls.Add(this.OPL2LCheckbox); + this.irqPanel.Controls.Add(this.OPL2RCheckbox); + this.irqPanel.Controls.Add(this.MPU401Checkbox); + this.irqPanel.Controls.Add(this.COM1Checkbox); + this.irqPanel.Controls.Add(this.COM2Checkbox); + this.irqPanel.Controls.Add(this.FDCCheckbox); + this.irqPanel.Controls.Add(this.MouseCheckbox); + this.irqPanel.Controls.Add(this.RTCCheckbox); + this.irqPanel.Controls.Add(this.TMR2Checkbox); + this.irqPanel.Controls.Add(this.TMR1Checkbox); + this.irqPanel.Controls.Add(this.TMR0Checkbox); + this.irqPanel.Controls.Add(this.SOLCheckbox); + this.irqPanel.Controls.Add(this.Reg2Label); + this.irqPanel.Controls.Add(this.Reg1Label); + this.irqPanel.Controls.Add(this.Reg0Label); + this.irqPanel.Controls.Add(this.KeyboardCheckBox); + this.irqPanel.Controls.Add(this.SOFCheckbox); + this.irqPanel.Controls.Add(this.BreakOnIRQCheckBox); + this.irqPanel.Location = new System.Drawing.Point(372, 25); + this.irqPanel.Name = "irqPanel"; + this.irqPanel.Size = new System.Drawing.Size(230, 74); + this.irqPanel.TabIndex = 12; // // SDCardCheckBox // this.SDCardCheckBox.Checked = true; this.SDCardCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; + this.SDCardCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.SDCardCheckBox.IsActive = false; this.SDCardCheckBox.Location = new System.Drawing.Point(88, 38); this.SDCardCheckBox.Name = "SDCardCheckBox"; this.SDCardCheckBox.Size = new System.Drawing.Size(15, 14); this.SDCardCheckBox.TabIndex = 34; + this.SDCardCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.SDCardCheckBox.UseVisualStyleBackColor = true; + this.SDCardCheckBox.CheckedChanged += new System.EventHandler(this.IRQCheckbox_CheckedChanged); // // OPL2LCheckbox // this.OPL2LCheckbox.Checked = true; this.OPL2LCheckbox.CheckState = System.Windows.Forms.CheckState.Checked; + this.OPL2LCheckbox.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.OPL2LCheckbox.IsActive = false; this.OPL2LCheckbox.Location = new System.Drawing.Point(189, 56); this.OPL2LCheckbox.Name = "OPL2LCheckbox"; this.OPL2LCheckbox.Size = new System.Drawing.Size(15, 14); this.OPL2LCheckbox.TabIndex = 33; + this.OPL2LCheckbox.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.OPL2LCheckbox.UseVisualStyleBackColor = true; + this.OPL2LCheckbox.CheckedChanged += new System.EventHandler(this.IRQCheckbox_CheckedChanged); // // OPL2RCheckbox // this.OPL2RCheckbox.Checked = true; this.OPL2RCheckbox.CheckState = System.Windows.Forms.CheckState.Checked; + this.OPL2RCheckbox.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.OPL2RCheckbox.IsActive = false; this.OPL2RCheckbox.Location = new System.Drawing.Point(206, 56); this.OPL2RCheckbox.Name = "OPL2RCheckbox"; this.OPL2RCheckbox.Size = new System.Drawing.Size(15, 14); this.OPL2RCheckbox.TabIndex = 32; + this.OPL2RCheckbox.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.OPL2RCheckbox.UseVisualStyleBackColor = true; + this.OPL2RCheckbox.CheckedChanged += new System.EventHandler(this.IRQCheckbox_CheckedChanged); // // MPU401Checkbox // this.MPU401Checkbox.Checked = true; this.MPU401Checkbox.CheckState = System.Windows.Forms.CheckState.Checked; + this.MPU401Checkbox.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.MPU401Checkbox.IsActive = false; this.MPU401Checkbox.Location = new System.Drawing.Point(122, 38); this.MPU401Checkbox.Name = "MPU401Checkbox"; this.MPU401Checkbox.Size = new System.Drawing.Size(15, 14); this.MPU401Checkbox.TabIndex = 31; + this.MPU401Checkbox.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.MPU401Checkbox.UseVisualStyleBackColor = true; + this.MPU401Checkbox.CheckedChanged += new System.EventHandler(this.IRQCheckbox_CheckedChanged); // // COM1Checkbox // this.COM1Checkbox.Checked = true; this.COM1Checkbox.CheckState = System.Windows.Forms.CheckState.Checked; + this.COM1Checkbox.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.COM1Checkbox.IsActive = false; this.COM1Checkbox.Location = new System.Drawing.Point(139, 38); this.COM1Checkbox.Name = "COM1Checkbox"; this.COM1Checkbox.Size = new System.Drawing.Size(15, 14); this.COM1Checkbox.TabIndex = 30; + this.COM1Checkbox.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.COM1Checkbox.UseVisualStyleBackColor = true; + this.COM1Checkbox.CheckedChanged += new System.EventHandler(this.IRQCheckbox_CheckedChanged); // // COM2Checkbox // this.COM2Checkbox.Checked = true; this.COM2Checkbox.CheckState = System.Windows.Forms.CheckState.Checked; + this.COM2Checkbox.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.COM2Checkbox.IsActive = false; this.COM2Checkbox.Location = new System.Drawing.Point(156, 38); this.COM2Checkbox.Name = "COM2Checkbox"; this.COM2Checkbox.Size = new System.Drawing.Size(15, 14); this.COM2Checkbox.TabIndex = 29; + this.COM2Checkbox.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.COM2Checkbox.UseVisualStyleBackColor = true; + this.COM2Checkbox.CheckedChanged += new System.EventHandler(this.IRQCheckbox_CheckedChanged); // // FDCCheckbox // this.FDCCheckbox.Checked = true; this.FDCCheckbox.CheckState = System.Windows.Forms.CheckState.Checked; + this.FDCCheckbox.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.FDCCheckbox.IsActive = false; this.FDCCheckbox.Location = new System.Drawing.Point(105, 21); this.FDCCheckbox.Name = "FDCCheckbox"; this.FDCCheckbox.Size = new System.Drawing.Size(15, 14); this.FDCCheckbox.TabIndex = 28; + this.FDCCheckbox.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.FDCCheckbox.UseVisualStyleBackColor = true; // // MouseCheckbox // this.MouseCheckbox.Checked = true; this.MouseCheckbox.CheckState = System.Windows.Forms.CheckState.Checked; + this.MouseCheckbox.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.MouseCheckbox.IsActive = false; this.MouseCheckbox.Location = new System.Drawing.Point(88, 21); this.MouseCheckbox.Name = "MouseCheckbox"; this.MouseCheckbox.Size = new System.Drawing.Size(15, 14); this.MouseCheckbox.TabIndex = 27; + this.MouseCheckbox.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.MouseCheckbox.UseVisualStyleBackColor = true; + this.MouseCheckbox.CheckedChanged += new System.EventHandler(this.IRQCheckbox_CheckedChanged); // // RTCCheckbox // this.RTCCheckbox.Checked = true; this.RTCCheckbox.CheckState = System.Windows.Forms.CheckState.Checked; + this.RTCCheckbox.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.RTCCheckbox.IsActive = false; this.RTCCheckbox.Location = new System.Drawing.Point(122, 21); this.RTCCheckbox.Name = "RTCCheckbox"; this.RTCCheckbox.Size = new System.Drawing.Size(15, 14); this.RTCCheckbox.TabIndex = 26; + this.RTCCheckbox.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.RTCCheckbox.UseVisualStyleBackColor = true; // // TMR2Checkbox // this.TMR2Checkbox.Checked = true; this.TMR2Checkbox.CheckState = System.Windows.Forms.CheckState.Checked; + this.TMR2Checkbox.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.TMR2Checkbox.IsActive = false; this.TMR2Checkbox.Location = new System.Drawing.Point(139, 21); this.TMR2Checkbox.Name = "TMR2Checkbox"; this.TMR2Checkbox.Size = new System.Drawing.Size(15, 14); this.TMR2Checkbox.TabIndex = 25; + this.TMR2Checkbox.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.TMR2Checkbox.UseVisualStyleBackColor = true; // // TMR1Checkbox // this.TMR1Checkbox.Checked = true; this.TMR1Checkbox.CheckState = System.Windows.Forms.CheckState.Checked; + this.TMR1Checkbox.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.TMR1Checkbox.IsActive = false; this.TMR1Checkbox.Location = new System.Drawing.Point(156, 21); this.TMR1Checkbox.Name = "TMR1Checkbox"; this.TMR1Checkbox.Size = new System.Drawing.Size(15, 14); this.TMR1Checkbox.TabIndex = 24; + this.TMR1Checkbox.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.TMR1Checkbox.UseVisualStyleBackColor = true; // // TMR0Checkbox // + this.TMR0Checkbox.BackColor = System.Drawing.SystemColors.Control; this.TMR0Checkbox.Checked = true; this.TMR0Checkbox.CheckState = System.Windows.Forms.CheckState.Checked; + this.TMR0Checkbox.FlatAppearance.BorderSize = 0; + this.TMR0Checkbox.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.TMR0Checkbox.IsActive = false; this.TMR0Checkbox.Location = new System.Drawing.Point(173, 21); this.TMR0Checkbox.Name = "TMR0Checkbox"; this.TMR0Checkbox.Size = new System.Drawing.Size(15, 14); this.TMR0Checkbox.TabIndex = 23; - this.TMR0Checkbox.UseVisualStyleBackColor = true; + this.TMR0Checkbox.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.TMR0Checkbox.UseVisualStyleBackColor = false; + this.TMR0Checkbox.CheckedChanged += new System.EventHandler(this.IRQCheckbox_CheckedChanged); // // SOLCheckbox // this.SOLCheckbox.Checked = true; this.SOLCheckbox.CheckState = System.Windows.Forms.CheckState.Checked; + this.SOLCheckbox.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.SOLCheckbox.IsActive = false; this.SOLCheckbox.Location = new System.Drawing.Point(190, 21); this.SOLCheckbox.Name = "SOLCheckbox"; this.SOLCheckbox.Size = new System.Drawing.Size(15, 14); this.SOLCheckbox.TabIndex = 22; + this.SOLCheckbox.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.SOLCheckbox.UseVisualStyleBackColor = true; + this.SOLCheckbox.CheckedChanged += new System.EventHandler(this.IRQCheckbox_CheckedChanged); // // Reg2Label // @@ -564,25 +616,34 @@ private void InitializeComponent() // this.KeyboardCheckBox.Checked = true; this.KeyboardCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; + this.KeyboardCheckBox.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.KeyboardCheckBox.IsActive = false; this.KeyboardCheckBox.Location = new System.Drawing.Point(206, 39); this.KeyboardCheckBox.Name = "KeyboardCheckBox"; this.KeyboardCheckBox.Size = new System.Drawing.Size(15, 14); this.KeyboardCheckBox.TabIndex = 18; + this.KeyboardCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.KeyboardCheckBox.UseVisualStyleBackColor = true; + this.KeyboardCheckBox.CheckedChanged += new System.EventHandler(this.IRQCheckbox_CheckedChanged); // // SOFCheckbox // this.SOFCheckbox.Checked = true; this.SOFCheckbox.CheckState = System.Windows.Forms.CheckState.Checked; + this.SOFCheckbox.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.SOFCheckbox.IsActive = false; this.SOFCheckbox.Location = new System.Drawing.Point(206, 21); this.SOFCheckbox.Name = "SOFCheckbox"; this.SOFCheckbox.Size = new System.Drawing.Size(15, 14); this.SOFCheckbox.TabIndex = 17; + this.SOFCheckbox.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.SOFCheckbox.UseVisualStyleBackColor = true; + this.SOFCheckbox.CheckedChanged += new System.EventHandler(this.IRQCheckbox_CheckedChanged); // // BreakOnIRQCheckBox // this.BreakOnIRQCheckBox.AutoSize = true; + this.BreakOnIRQCheckBox.BackColor = System.Drawing.SystemColors.Control; this.BreakOnIRQCheckBox.Checked = true; this.BreakOnIRQCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; this.BreakOnIRQCheckBox.Location = new System.Drawing.Point(3, 3); @@ -590,7 +651,7 @@ private void InitializeComponent() this.BreakOnIRQCheckBox.Size = new System.Drawing.Size(91, 17); this.BreakOnIRQCheckBox.TabIndex = 16; this.BreakOnIRQCheckBox.Text = "Break on IRQ"; - this.BreakOnIRQCheckBox.UseVisualStyleBackColor = true; + this.BreakOnIRQCheckBox.UseVisualStyleBackColor = false; this.BreakOnIRQCheckBox.CheckedChanged += new System.EventHandler(this.BreakOnIRQCheckBox_CheckedChanged); // // LabelOverlayButton @@ -625,7 +686,7 @@ private void InitializeComponent() this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(758, 517); this.Controls.Add(this.LabelOverlayButton); - this.Controls.Add(this.panel1); + this.Controls.Add(this.irqPanel); this.Controls.Add(this.HeaderTextbox); this.Controls.Add(this.StepOverOverlayButton); this.Controls.Add(this.InspectOverlayButton); @@ -655,8 +716,8 @@ private void InitializeComponent() this.SecondPanel.ResumeLayout(false); this.SecondPanel.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.DebugPanel)).EndInit(); - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); + this.irqPanel.ResumeLayout(false); + this.irqPanel.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -687,29 +748,29 @@ private void InitializeComponent() private System.Windows.Forms.Button StepOverOverlayButton; private System.Windows.Forms.Label HeaderTextbox; private System.Windows.Forms.Label BPLabel; - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.CheckBox KeyboardCheckBox; - private System.Windows.Forms.CheckBox SOFCheckbox; + private System.Windows.Forms.Panel irqPanel; private System.Windows.Forms.CheckBox BreakOnIRQCheckBox; - private System.Windows.Forms.CheckBox SOLCheckbox; private System.Windows.Forms.Label Reg2Label; private System.Windows.Forms.Label Reg1Label; private System.Windows.Forms.Label Reg0Label; - private System.Windows.Forms.CheckBox MPU401Checkbox; - private System.Windows.Forms.CheckBox COM1Checkbox; - private System.Windows.Forms.CheckBox COM2Checkbox; - private System.Windows.Forms.CheckBox FDCCheckbox; - private System.Windows.Forms.CheckBox MouseCheckbox; - private System.Windows.Forms.CheckBox RTCCheckbox; - private System.Windows.Forms.CheckBox TMR2Checkbox; - private System.Windows.Forms.CheckBox TMR1Checkbox; - private System.Windows.Forms.CheckBox TMR0Checkbox; - private System.Windows.Forms.CheckBox OPL2LCheckbox; - private System.Windows.Forms.CheckBox OPL2RCheckbox; - private System.Windows.Forms.CheckBox SDCardCheckBox; private System.Windows.Forms.Button StepOverButton; private System.Windows.Forms.Button LabelOverlayButton; private System.Windows.Forms.Button ResetButton; private System.Windows.Forms.Button WatchButton; + private ColorCheckBox SOLCheckbox; + private ColorCheckBox MPU401Checkbox; + private ColorCheckBox COM1Checkbox; + private ColorCheckBox COM2Checkbox; + private ColorCheckBox FDCCheckbox; + private ColorCheckBox MouseCheckbox; + private ColorCheckBox RTCCheckbox; + private ColorCheckBox TMR2Checkbox; + private ColorCheckBox TMR1Checkbox; + private ColorCheckBox TMR0Checkbox; + private ColorCheckBox OPL2LCheckbox; + private ColorCheckBox OPL2RCheckbox; + private ColorCheckBox SDCardCheckBox; + private ColorCheckBox SOFCheckbox; + private ColorCheckBox KeyboardCheckBox; } } \ No newline at end of file diff --git a/Main/UI/CPUWindow.cs b/Main/UI/CPUWindow.cs index 84eb6a4..68f7825 100644 --- a/Main/UI/CPUWindow.cs +++ b/Main/UI/CPUWindow.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using System.Windows.Forms; using FoenixIDE.Processor; +using FoenixIDE.Simulator.Controls; using FoenixIDE.Simulator.Devices; using FoenixIDE.Simulator.FileFormat; using Microsoft.VisualBasic; @@ -426,7 +427,12 @@ public void RunButton_Click(object sender, EventArgs e) { // Clear the interrupt IRQPC = -1; - + kernel.MemMgr.INTERRUPT.WriteFromGabe(0, 0); + kernel.MemMgr.INTERRUPT.WriteFromGabe(1, 0); + kernel.MemMgr.INTERRUPT.WriteFromGabe(2, 0); + kernel.MemMgr.INTERRUPT.WriteFromGabe(3, 0); + InterruptMatchesCheckboxes(); + kernel.CPU.DebugPause = false; lastLine.Text = ""; kernel.CPU.CPUThread = new Thread(new ThreadStart(ThreadProc)); @@ -856,47 +862,93 @@ private bool InterruptMatchesCheckboxes() { // Read Interrupt Register 0 byte reg0 = kernel.MemMgr.INTERRUPT.ReadByte(0); + bool result = false; if (SOFCheckbox.Checked && (reg0 & (byte)Register0.FNX0_INT00_SOF) != 0) { - return true; + SOFCheckbox.IsActive = true; + result = true; + } + else + { + if (SOFCheckbox.IsActive) SOFCheckbox.IsActive = false; } if (SOLCheckbox.Checked && (reg0 & (byte)Register0.FNX0_INT01_SOL) != 0) { - return true; + SOLCheckbox.IsActive = true; + result = true; + } + else + { + if (SOLCheckbox.IsActive) SOLCheckbox.IsActive = false; } if (TMR0Checkbox.Checked && (reg0 & (byte)Register0.FNX0_INT02_TMR0) != 0) { - return true; + TMR0Checkbox.IsActive = true; + result = true; + } + else + { + if (TMR0Checkbox.IsActive) TMR0Checkbox.IsActive = false; } if (TMR1Checkbox.Checked && (reg0 & (byte)Register0.FNX0_INT03_TMR1) != 0) { - return true; + TMR1Checkbox.IsActive = true; + result = true; + } + else + { + if (TMR1Checkbox.IsActive) + TMR1Checkbox.IsActive = false; } if (TMR2Checkbox.Checked && (reg0 & (byte)Register0.FNX0_INT04_TMR2) != 0) { - return true; + TMR2Checkbox.IsActive = true; + result = true; + } + else + { + if (TMR2Checkbox.IsActive) + TMR2Checkbox.IsActive = false; } if (MouseCheckbox.Checked && (reg0 & (byte)Register0.FNX0_INT07_MOUSE) != 0) { - return true; + MouseCheckbox.IsActive = true; + result = true; + } + else + { + if (MouseCheckbox.IsActive) + MouseCheckbox.IsActive = false; } // Read Interrupt Register 1 byte reg1 = kernel.MemMgr.INTERRUPT.ReadByte(1); if (SDCardCheckBox.Checked && (reg1 & (byte)Register1.FNX1_INT07_SDCARD ) != 0) { - return true; + SDCardCheckBox.IsActive = true; + result = true; + } + else + { + if (SDCardCheckBox.IsActive) + SDCardCheckBox.IsActive = false; } if (KeyboardCheckBox.Checked && (reg1 & (byte)Register1.FNX1_INT00_KBD) != 0) { - return true; + KeyboardCheckBox.IsActive = true; + result = true; + } + else + { + if (KeyboardCheckBox.IsActive) + KeyboardCheckBox.IsActive = false; } //Read Interrupt Register 2 byte reg2 = kernel.MemMgr.INTERRUPT.ReadByte(2); //Read Interrupt Register 3 byte reg3 = kernel.MemMgr.INTERRUPT.ReadByte(3); - return false; + return result; } private void ResetButton_Click(object sender, EventArgs e) @@ -928,5 +980,14 @@ private void DebugPanel_MouseClick(object sender, MouseEventArgs e) } } } + + private void IRQCheckbox_CheckedChanged(object sender, EventArgs e) + { + if (sender is ColorCheckBox) + { + ColorCheckBox ccb = (ColorCheckBox)sender; + ccb.IsActive = false; + } + } } } diff --git a/Main/UI/GameGeneratorForm.cs b/Main/UI/GameGeneratorForm.cs index 0a94e87..3ae7096 100644 --- a/Main/UI/GameGeneratorForm.cs +++ b/Main/UI/GameGeneratorForm.cs @@ -289,7 +289,13 @@ private void GenerateASMButton_Click(object sender, EventArgs e) ".include \"includes/macros_inc.asm\"", ".include \"includes/bank_00_inc.asm\"", ".include \"includes/timer_def.asm\"", - ".include \"includes/vicky_ii_def.asm\"", + ".include \"includes/VKYII_CFP9553_GENERAL_def.asm\"", + ".include \"includes/VKYII_CFP9553_BITMAP_def.asm\"", + ".include \"includes/VKYII_CFP9553_SPRITE_def.asm\"", + ".include \"includes/VKYII_CFP9553_TILEMAP_def.asm\"", + ".include \"includes/VKYII_CFP9553_SDMA_def.asm\"", + ".include \"includes/VKYII_CFP9553_VDMA_def.asm\"", + ".include \"includes/VKYII_CFP9553_COLLISION_def.asm\"", ".include \"includes/interrupt_def.asm\"", ".include \"includes/io_def.asm\"", ".include \"includes/kernel_inc.asm\"", diff --git a/Main/UI/MemoryWindow.Designer.cs b/Main/UI/MemoryWindow.Designer.cs index 3af977c..266925d 100644 --- a/Main/UI/MemoryWindow.Designer.cs +++ b/Main/UI/MemoryWindow.Designer.cs @@ -56,6 +56,7 @@ private void InitializeComponent() this.HighlightPanel = new System.Windows.Forms.TextBox(); this.PositionLabel = new System.Windows.Forms.Label(); this.SaveDialog = new System.Windows.Forms.SaveFileDialog(); + this.ZeroButton = new System.Windows.Forms.Button(); this.HeaderPanel.SuspendLayout(); this.FooterPanel.SuspendLayout(); this.SuspendLayout(); @@ -64,6 +65,7 @@ private void InitializeComponent() // this.HeaderPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.HeaderPanel.Controls.Add(this.ZeroButton); this.HeaderPanel.Controls.Add(this.SaveButton); this.HeaderPanel.Controls.Add(this.AddressCombo); this.HeaderPanel.Controls.Add(this.PreviousButton); @@ -407,6 +409,19 @@ private void InitializeComponent() this.SaveDialog.Filter = "Binary files|*.bin"; this.SaveDialog.Title = "Save Memory to File"; // + // ZeroButton + // + this.ZeroButton.BackColor = System.Drawing.SystemColors.Control; + this.ZeroButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; + this.ZeroButton.Image = global::FoenixIDE.Simulator.Properties.Resources.zero; + this.ZeroButton.Location = new System.Drawing.Point(449, 1); + this.ZeroButton.Margin = new System.Windows.Forms.Padding(0); + this.ZeroButton.Name = "ZeroButton"; + this.ZeroButton.Size = new System.Drawing.Size(25, 23); + this.ZeroButton.TabIndex = 12; + this.ZeroButton.UseVisualStyleBackColor = false; + this.ZeroButton.Click += new System.EventHandler(this.ZeroButton_Click); + // // MemoryWindow // this.AcceptButton = this.ViewButton; @@ -464,5 +479,6 @@ private void InitializeComponent() private System.Windows.Forms.SaveFileDialog SaveDialog; private System.Windows.Forms.Button MCRBit8Button; private System.Windows.Forms.Button MCRBit9Button; + private System.Windows.Forms.Button ZeroButton; } } \ No newline at end of file diff --git a/Main/UI/MemoryWindow.cs b/Main/UI/MemoryWindow.cs index b9b3872..c0d4310 100644 --- a/Main/UI/MemoryWindow.cs +++ b/Main/UI/MemoryWindow.cs @@ -45,6 +45,7 @@ private void MemoryWindow_Load(object sender, EventArgs e) MemoryWindowTooltips.SetToolTip(MCRBit2Button, "Enable Graphics Mode"); MemoryWindowTooltips.SetToolTip(MCRBit1Button, "Enable Text Overlay"); MemoryWindowTooltips.SetToolTip(MCRBit0Button, "Enable Text"); + MemoryWindowTooltips.SetToolTip(ZeroButton, "Reset Page to Zeroes"); // Set the MCR MCRBit0Button.Tag = 0; @@ -67,6 +68,7 @@ private void MemoryWindow_Load(object sender, EventArgs e) HighlightPanel.ReadOnly = true; FooterPanel.Visible = false; UpdateDisplayTimer.Enabled = false; + ZeroButton.Visible = false; } else { @@ -513,5 +515,11 @@ private void SaveButton_Click(object sender, EventArgs e) outputFile.Close(); } } + + private void ZeroButton_Click(object sender, EventArgs e) + { + byte[] buffer = new byte[256]; + Memory.CopyBuffer(buffer, 0, StartAddress, 256); + } } } diff --git a/Release Notes.txt b/Release Notes.txt index fe13b36..543dd5f 100644 --- a/Release Notes.txt +++ b/Release Notes.txt @@ -1,3 +1,11 @@ +Release 0.5.5.7 +--------------- +Added Zero button in Memory window to reset a page to zero. +Fixed Asset Loading - when LUT data already exists, we often ended up in an infinite loop, for 8bpp image. We now exit the LUT loop when the mask equals $C0 (only 2 bits). +Added an "Overwrite LUT" checkbox in the Asset Loader. +Updated the Game Generator to use the new VICKY "GENERAL" file. +Added specialized checkboxes to display which interrupt was triggered, in the CPU window. + Release 0.5.5.6 --------------- Fixed an issue that cause the emulator to crash when Video Address written in Vicky are not offset properly. diff --git a/bin/Release/FoenixIDE.exe b/bin/Release/FoenixIDE.exe index d32ebef..06ffdad 100644 Binary files a/bin/Release/FoenixIDE.exe and b/bin/Release/FoenixIDE.exe differ