From c593b737ddbff0cfb7387eef007ccfea276a277a Mon Sep 17 00:00:00 2001 From: agg23 Date: Wed, 28 Sep 2022 10:52:28 -0700 Subject: [PATCH] fix (#33): Added reset option and ROM swapping --- dist/Cores/agg23.SNES/core.json | 4 +-- dist/Cores/agg23.SNES/data.json | 2 +- dist/Cores/agg23.SNES/interact.json | 56 +++++++++++++---------------- src/fpga/apf/build_id.mif | 6 ++-- src/fpga/core/core_top.v | 21 +++++++---- 5 files changed, 45 insertions(+), 44 deletions(-) diff --git a/dist/Cores/agg23.SNES/core.json b/dist/Cores/agg23.SNES/core.json index bb226a6..4c9eca5 100644 --- a/dist/Cores/agg23.SNES/core.json +++ b/dist/Cores/agg23.SNES/core.json @@ -7,8 +7,8 @@ "description": "Super Nintendo and Super Famicom. Nintendo's second major home console", "author": "agg23", "url": "https://github.com/agg23/openfpga-snes", - "version": "0.2.0", - "date_release": "2022-09-19" + "version": "0.3.0", + "date_release": "2022-09-28" }, "framework": { "target_product": "Analogue Pocket", diff --git a/dist/Cores/agg23.SNES/data.json b/dist/Cores/agg23.SNES/data.json index f0fb264..4bccf04 100644 --- a/dist/Cores/agg23.SNES/data.json +++ b/dist/Cores/agg23.SNES/data.json @@ -6,7 +6,7 @@ "name": "SMC", "id": 0, "required": true, - "parameters": "0x108", + "parameters": "0x109", "extensions": ["smc", "sfc"], "address": "0x10000000" }, diff --git a/dist/Cores/agg23.SNES/interact.json b/dist/Cores/agg23.SNES/interact.json index 124d631..58b88a2 100644 --- a/dist/Cores/agg23.SNES/interact.json +++ b/dist/Cores/agg23.SNES/interact.json @@ -2,6 +2,14 @@ "interact": { "magic": "APF_VER_1", "variables": [ + { + "name": "Reset core", + "id": 10, + "type": "action", + "enabled": true, + "address": "0x00000050", + "value": 1 + }, { "name": "Use Multitap", "id": 20, @@ -16,42 +24,26 @@ { "name": "Lightgun Options", "id": 30, - "type": "action", - "enabled": false - }, - { - "name": "No Lightgun", - "id": 31, - "group": 3, - "type": "radio", - "enabled": true, - "address": "0x00000104", - "persist": true, - "writeonly": true, - "defaultval": 1, - "value": 0 - }, - { - "name": "Use Super Scope", - "id": 32, - "group": 3, - "type": "radio", + "type": "list", "enabled": true, "address": "0x00000104", - "writeonly": true, "persist": true, - "value": 1 - }, - { - "name": "Use Justifier", - "id": 33, - "group": 3, - "type": "radio", - "enabled": true, - "address": "0x00000104", "writeonly": true, - "persist": true, - "value": 3 + "defaultval": 0, + "options": [ + { + "name": "No Lightgun", + "value": 0 + }, + { + "name": "Use Super Scope", + "value": 1 + }, + { + "name": "Use Justifier", + "value": 2 + } + ] }, { "name": "D-Pad Aim Speed", diff --git a/src/fpga/apf/build_id.mif b/src/fpga/apf/build_id.mif index 94be3df..4151fce 100644 --- a/src/fpga/apf/build_id.mif +++ b/src/fpga/apf/build_id.mif @@ -9,8 +9,8 @@ DATA_RADIX = HEX; CONTENT BEGIN - 0E0 : 20220924; - 0E1 : 00112758; - 0E2 : 2ef70c64; + 0E0 : 20220928; + 0E1 : 00083938; + 0E2 : 46a76eb8; END; diff --git a/src/fpga/core/core_top.v b/src/fpga/core/core_top.v index 74c31fc..458cbf4 100644 --- a/src/fpga/core/core_top.v +++ b/src/fpga/core/core_top.v @@ -329,8 +329,15 @@ module core_top ( end always @(posedge clk_74a) begin + if (reset_delay > 0) begin + reset_delay <= reset_delay - 1; + end + if (bridge_wr) begin casex (bridge_addr) + 32'h00000050: begin + reset_delay <= 32'h100000; + end 32'h00000100: begin multitap_enabled <= bridge_wr_data[0]; end @@ -626,7 +633,7 @@ module core_top ( cont4_key_s, clk_sys_21_48 ); - + synch_3 #( .WIDTH(32) ) joy1_s ( @@ -638,17 +645,19 @@ module core_top ( wire PAL; // Settings - reg multitap_enabled; - reg lightgun_enabled; - reg lightgun_type; + reg multitap_enabled; + reg lightgun_enabled; + reg lightgun_type; reg [7:0] lightgun_dpad_aim_speed; - reg use_4_3_video; + reg use_4_3_video; + + reg [31:0] reset_delay = 0; MAIN_SNES snes ( .clk_mem_85_9 (clk_mem_85_9), .clk_sys_21_48(clk_sys_21_48), - .core_reset(~pll_core_locked), + .core_reset(~pll_core_locked || reset_delay > 0), // Settings .multitap_enabled(multitap_enabled),