Skip to content

Commit 5c0af9f

Browse files
authored
Release 0.4.0 (#52)
* feat: CHIP32 loading and full chip support (#47) * Experimental SMC header removal (doesn't work due to CHIP32 bug) * Support for skipping SMC headers via CHIP32 * Beginning of ROM loading and header parsing * PAL detection * Save ram size * Hi and ExHi loading * Support for SDD1 and SPC7110 * Load BSX ROMs * Don't commit bins * Fixed save not loading * Fixed lower nibble of chip type not being sent * Support loading SMC headered files * Remove old loader * Disabled debug logging * Fix header offset being used in ROM size calculation * Fix ExHiROM headers not being given extra weight * Updated README to cover new features * chore: Add clarity to README about expansion chips * RTC support (#50) * fix: Use calculated romsz for SDD1 check (#49) * PAL support and extra line fixes (#48) * PLL reconfiguration for PAL * Reset PLL to ensure proper reconfiguration * Proper switching of video modes and fixed garbage display lines * Clean up commented out code * RTC support (#50) * TCL script to build each bitstream type * Separate PAL PLL and build script * feat: Additional options; turbo and pseudo transparency (#51) * Update version number
1 parent 120c7c0 commit 5c0af9f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+7805
-1660
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
*.rbf_r
22
*.zip
33
dist/**/*.rev
4+
dist/**/*.bin
5+
src/**/*.bin
46
src/sim/work/
57
src/sim/*.hex
68
src/sim/*.mem

README.md

+15-13
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,31 @@ To install the core, copy the `Assets`, `Cores`, and `Platform` folders over to
1515

1616
## Usage
1717

18-
**NOTE:** ROM files must not contain a SMC header. If a ROM isn't loading and you think it should, check if it has a header with a tool like [Advanced SNES ROM Utility](https://www.romhacking.net/utilities/1638/) and remove it if so.
19-
20-
ROMs should be placed in `/Assets/snes/common`
21-
22-
PAL ROMs should boot, but there may be timing issues as the core currently doesn't properly support PAL (proper support coming soon).
18+
ROMs should be placed in `/Assets/snes/common`. Both headered and unheadered ROMs are now supported.
2319

2420
## Features
2521

2622
### Dock Support
2723

28-
Core supports four players/controllers via the Analogue Dock. To enable four player mode, turn on "Use Multitap" setting.
24+
Core supports four players/controllers via the Analogue Dock. To enable four player mode, turn on `Use Multitap` setting.
2925

3026
### Expansion Chips
3127

32-
The currently supported expansion chips are SA-1 (Super Mario RPG), Super FX (GSU-1/2; Star Fox), DSP (Super Mario Kart), and CX4 (Mega Man X 2). Additional chip support will come in the future once several new firmware features are released.
28+
All original expansion chips supported by MiSTer are also supported on the Pocket. The full list is: SA-1 (Super Mario RPG), Super FX/GSU-1/2 (Star Fox), DSP (Super Mario Kart), CX4 (Mega Man X 2), S-DD1 (Star Ocean), SPC7110 (Far East of Eden), ST1010 (F1 Roc 2), and BSX (Satellaview). The Super Game Boy, ST011 (Hayazashi Nidan Morita Shougi), and ST018 (Hayazashi Nidan Morita Shougi 2) are not supported in the MiSTer core, and therefore are not supported here. Additionally, the homebrew MSU expansion chip is not currently supported.
29+
30+
#### BSX
31+
32+
BSX ROMs must be patched to run without BIOS. The BSX BIOS is not currently supported
3333

34-
**NOTE:** The S-DD1 chip was dropped in release 0.2.0 due to sizing and popularity issues. Support will resume in a future release. In the meantime, you can [use this hack to remove the S-DD1 requirement](https://www.romhacking.net/hacks/614/).
34+
### Video
3535

36-
### Video Modes
36+
* `Use 4:3 Video` - The internal resolution of the SNES is a 8:7 aspect ratio, which is much taller than the 4:3 CRTs that were used at the time. Some games are designed to be displayed at 8:7, and others at 4:3. The `Use 4:3 Video` option is provided to switch to a 4:3 aspect ratio.
37+
* `Pseudo Transparency` - Enable blending of adjacent pixels, used in some games to simulate transparency
3738

38-
The Analogue Pocket framework doesn't currently allow for customizing video modes directly, so if you dislike the default 8:7 aspect ratio/want to change to 4:3, you can change it by modifying `Cores/agg23.SNES/video.json` and rearranging the config objects.
39+
### Turbo
3940

40-
Proper PAL support also requires editing these files to have an expanded vertical pixel height.
41+
* `CPU Turbo` - Applies a speed increase to the main SNES CPU. **NOTE:** This has different compatibility with different games. See the [MiSTer list of games](https://github.com/MiSTer-devel/SNES_MiSTer/blob/master/SNES_Turbo.md) that this feature works with
42+
* `SuperFX Turbo` - Applies a speed increase to the GSU (SuperFX) chip. Can be used in addition to the `CPU Turbo` option in games like Star Fox to maintain a higher frame rate.
4143

4244
### Controller Options
4345

@@ -50,12 +52,12 @@ There are several options provided for selecting which type of controller the co
5052

5153
### Lightguns
5254

53-
Core supports virtual lightguns by selecting the "Super Scope" or "Justifier" options under "Controller Options". Most lightgun games user the Super Scope but Lethal Enforcers uses the Justifier. The crosshair can be controlled with the D-Pad or left joystick, using the A button to fire and the B button to reload. D-Pad aim sensitivity can be adjusted with the "D-Pad Aim Speed" setting.
55+
Core supports virtual lightguns by selecting the `Super Scope` or `Justifier` options under `Controller Options`. Most lightgun games user the Super Scope but Lethal Enforcers uses the Justifier. The crosshair can be controlled with the D-Pad or left joystick, using the A button to fire and the B button to reload. D-Pad aim sensitivity can be adjusted with the `D-Pad Aim Speed` setting.
5456

5557
**NOTE:** Joystick support for aiming only appears to work when a controller is paired over Bluetooth and not connected to the Analogue Dock directly by USB.
5658

5759
### SNES Mouse
5860

59-
Core supports a virtual SNES mouse by selecting "Mouse" under "Controller Options". The mouse can be moved with the D-Pad or left joystick and left and right clicks can be performed by pressing the A and B buttons respectively. Mouse D-Pad movement sensitivity can be adjusted with the "D-Pad Aim Speed" setting.
61+
Core supports a virtual SNES mouse by selecting `Mouse` under `Controller Options`. The mouse can be moved with the D-Pad or left joystick and left and right clicks can be performed by pressing the A and B buttons respectively. Mouse D-Pad movement sensitivity can be adjusted with the `D-Pad Aim Speed` setting.
6062

6163
**NOTE:** The dock firmware doesn't currently support a USB mouse.

build.ps1

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
if (($args.count -ne 1) -or ($args[0] -eq "")) {
2+
Write-Output "Expected build type arg"
3+
exit 1
4+
}
5+
6+
$build_type = $args[0]
7+
8+
quartus_sh -t generate.tcl $build_type
9+
10+
$exitcode = $LASTEXITCODE
11+
if ($exitcode -ne 0) {
12+
Write-Output "Build failed with $exitcode"
13+
exit $exitcode
14+
}
15+
16+
$output_file = "snes_main.rev"
17+
18+
if (($build_type -eq "ntsc") -or ($build_type -eq "none")) {
19+
$output_file = "snes_main.rev"
20+
} elseif (($build_type -eq "pal") -or ($build_type -eq "none_pal")) {
21+
$output_file = "snes_pal.rev"
22+
} elseif ($build_type -eq "ntsc_spc") {
23+
$output_file = "snes_spc.rev"
24+
}
25+
26+
C:\Users\adam\code\pocket-text\tools\reverse.exe C:\Users\adam\code\fpga\snes\src\fpga\output_files\ap_core.rbf "C:\Users\adam\code\fpga\snes\dist\Cores\agg23.SNES\$output_file";

dist/Cores/agg23.SNES/core.json

+15-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"description": "Super Nintendo and Super Famicom. Nintendo's second major home console",
88
"author": "agg23",
99
"url": "https://github.com/agg23/openfpga-snes",
10-
"version": "0.3.2",
11-
"date_release": "2022-10-10"
10+
"version": "0.4.0",
11+
"date_release": "2022-11-10"
1212
},
1313
"framework": {
1414
"target_product": "Analogue Pocket",
@@ -21,13 +21,24 @@
2121
"hardware": {
2222
"link_port": false,
2323
"cartridge_adapter": -1
24-
}
24+
},
25+
"chip32_vm": "loader.bin"
2526
},
2627
"cores": [
2728
{
28-
"name": "default",
29+
"name": "main",
2930
"id": 0,
3031
"filename": "snes_main.rev"
32+
},
33+
{
34+
"name": "SPCSDD1",
35+
"id": 1,
36+
"filename": "snes_spc.rev"
37+
},
38+
{
39+
"name": "PAL",
40+
"id": 2,
41+
"filename": "snes_pal.rev"
3142
}
3243
]
3344
}

dist/Cores/agg23.SNES/data.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
"magic": "APF_VER_1",
44
"data_slots": [
55
{
6-
"name": "SMC",
6+
"name": "Cartridge",
77
"id": 0,
88
"required": true,
99
"parameters": "0x109",
10-
"extensions": ["smc", "sfc"],
10+
"extensions": ["smc", "sfc", "bs"],
1111
"address": "0x10000000"
1212
},
1313
{

dist/Cores/agg23.SNES/info.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ Port by agg23. Core by srg320.
22

33
Super Nintendo Entertainment System (SNES), referred to as the Super Famicom (SFC) in Japan was the second home console produced by Nintendo. A 16-bit console that remains hugely popular to this day due to its expansive library and impressive enhancement chips.
44

5-
Core supports 4 controllers (when connected to the Dock), and the SA-1, Super FX (GSU), DSP, and CX4 expansion chips (more coming later). Please report all issues to agg23, as most likely any issues experienced are issues with the port, not the core.
5+
Core supports 4 controllers (when connected to the Dock), and the SA-1, Super FX (GSU), DSP, CX4, S-DD1, SPC7110, and BSX expansion chips. Please report all issues to agg23, as most likely any issues experienced are issues with the port, not the core.

dist/Cores/agg23.SNES/interact.json

+38-5
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,37 @@
77
"id": 10,
88
"type": "action",
99
"enabled": true,
10-
"address": "0x00000050",
10+
"address": "0x50",
11+
"value": 1
12+
},
13+
{
14+
"name": "CPU Turbo",
15+
"id": 15,
16+
"type": "check",
17+
"enabled": true,
18+
"address": "0x80",
19+
"persist": true,
20+
"writeonly": true,
21+
"defaultval": 0,
22+
"value": 1
23+
},
24+
{
25+
"name": "SuperFX Turbo",
26+
"id": 16,
27+
"type": "check",
28+
"enabled": true,
29+
"address": "0x84",
30+
"persist": true,
31+
"writeonly": true,
32+
"defaultval": 0,
1133
"value": 1
1234
},
1335
{
1436
"name": "Use Multitap",
1537
"id": 20,
1638
"type": "check",
1739
"enabled": true,
18-
"address": "0x00000100",
40+
"address": "0x100",
1941
"persist": true,
2042
"writeonly": true,
2143
"defaultval": 0,
@@ -26,7 +48,7 @@
2648
"id": 30,
2749
"type": "list",
2850
"enabled": true,
29-
"address": "0x00000104",
51+
"address": "0x104",
3052
"persist": true,
3153
"writeonly": true,
3254
"defaultval": 0,
@@ -54,7 +76,7 @@
5476
"id": 34,
5577
"type": "slider_u32",
5678
"enabled": true,
57-
"address": "0x00000108",
79+
"address": "0x108",
5880
"persist": true,
5981
"writeonly": true,
6082
"defaultval": 3,
@@ -88,11 +110,22 @@
88110
"id": 40,
89111
"type": "check",
90112
"enabled": true,
91-
"address": "0x00000200",
113+
"address": "0x200",
92114
"persist": true,
93115
"writeonly": true,
94116
"defaultval": 0,
95117
"value": 1
118+
},
119+
{
120+
"name": "Pseudo Transparency",
121+
"id": 41,
122+
"type": "check",
123+
"enabled": true,
124+
"address": "0x204",
125+
"persist": true,
126+
"writeonly": true,
127+
"defaultval": 1,
128+
"value": 1
96129
}
97130
],
98131
"messages": []

generate.tcl

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Run with quartus_sh -t generate.tcl
2+
3+
# Load Quartus II Tcl Project package
4+
package require ::quartus::project
5+
6+
# Required for compilation
7+
package require ::quartus::flow
8+
9+
if { $argc != 1 } {
10+
puts "Exactly 1 argument required"
11+
exit
12+
}
13+
14+
project_open src/fpga/ap_core.qpf
15+
16+
if { [lindex $argv 0] == "ntsc" } {
17+
puts "NTSC"
18+
set_parameter -name PAL_PLL -entity core_top '0
19+
20+
set_parameter -name USE_CX4 -entity MAIN_SNES '1
21+
set_parameter -name USE_SDD1 -entity MAIN_SNES '0
22+
set_parameter -name USE_GSU -entity MAIN_SNES '1
23+
set_parameter -name USE_SA1 -entity MAIN_SNES '1
24+
set_parameter -name USE_DSPn -entity MAIN_SNES '1
25+
set_parameter -name USE_SPC7110 -entity MAIN_SNES '0
26+
set_parameter -name USE_BSX -entity MAIN_SNES '0
27+
set_parameter -name USE_MSU -entity MAIN_SNES '0
28+
} elseif { [lindex $argv 0] == "pal" } {
29+
puts "PAL"
30+
set_parameter -name PAL_PLL -entity core_top '1
31+
32+
set_parameter -name USE_CX4 -entity MAIN_SNES '1
33+
set_parameter -name USE_SDD1 -entity MAIN_SNES '0
34+
set_parameter -name USE_GSU -entity MAIN_SNES '1
35+
set_parameter -name USE_SA1 -entity MAIN_SNES '1
36+
set_parameter -name USE_DSPn -entity MAIN_SNES '1
37+
set_parameter -name USE_SPC7110 -entity MAIN_SNES '0
38+
set_parameter -name USE_BSX -entity MAIN_SNES '0
39+
set_parameter -name USE_MSU -entity MAIN_SNES '0
40+
} elseif { [lindex $argv 0] == "ntsc_spc" } {
41+
puts "NTSC SPC"
42+
set_parameter -name PAL_PLL -entity core_top '0
43+
44+
set_parameter -name USE_CX4 -entity MAIN_SNES '0
45+
set_parameter -name USE_SDD1 -entity MAIN_SNES '1
46+
set_parameter -name USE_GSU -entity MAIN_SNES '0
47+
set_parameter -name USE_SA1 -entity MAIN_SNES '0
48+
set_parameter -name USE_DSPn -entity MAIN_SNES '0
49+
set_parameter -name USE_SPC7110 -entity MAIN_SNES '1
50+
set_parameter -name USE_BSX -entity MAIN_SNES '1
51+
set_parameter -name USE_MSU -entity MAIN_SNES '0
52+
} elseif { [lindex $argv 0] == "none" } {
53+
puts "NONE"
54+
set_parameter -name PAL_PLL -entity core_top '0
55+
56+
set_parameter -name USE_CX4 -entity MAIN_SNES '0
57+
set_parameter -name USE_SDD1 -entity MAIN_SNES '0
58+
set_parameter -name USE_GSU -entity MAIN_SNES '0
59+
set_parameter -name USE_SA1 -entity MAIN_SNES '0
60+
set_parameter -name USE_DSPn -entity MAIN_SNES '0
61+
set_parameter -name USE_SPC7110 -entity MAIN_SNES '0
62+
set_parameter -name USE_BSX -entity MAIN_SNES '0
63+
set_parameter -name USE_MSU -entity MAIN_SNES '0
64+
} elseif { [lindex $argv 0] == "none_pal" } {
65+
puts "NONE PAL"
66+
set_parameter -name PAL_PLL -entity core_top '1
67+
68+
set_parameter -name USE_CX4 -entity MAIN_SNES '0
69+
set_parameter -name USE_SDD1 -entity MAIN_SNES '0
70+
set_parameter -name USE_GSU -entity MAIN_SNES '0
71+
set_parameter -name USE_SA1 -entity MAIN_SNES '0
72+
set_parameter -name USE_DSPn -entity MAIN_SNES '0
73+
set_parameter -name USE_SPC7110 -entity MAIN_SNES '0
74+
set_parameter -name USE_BSX -entity MAIN_SNES '0
75+
set_parameter -name USE_MSU -entity MAIN_SNES '0
76+
} else {
77+
puts "Unknown bitstream type [lindex $argv 0]"
78+
project_close
79+
exit
80+
}
81+
82+
execute_flow -compile
83+
84+
project_close

src/fpga/ap_core.qsf

+14-1
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,9 @@ set_global_assignment -name PARTITION_COLOR 16764057 -section_id Top
741741
set_global_assignment -name ALM_REGISTER_PACKING_EFFORT LOW
742742
set_global_assignment -name ROUTER_REGISTER_DUPLICATION ON
743743
set_global_assignment -name FITTER_EFFORT "STANDARD FIT"
744+
set_global_assignment -name NUM_PARALLEL_PROCESSORS 4
745+
set_global_assignment -name SYSTEMVERILOG_FILE core/rtl/mister_top/scanline_filler.sv
746+
set_global_assignment -name SYSTEMVERILOG_FILE core/core_top.sv
744747
set_global_assignment -name SYSTEMVERILOG_FILE core/rtl/mister_top/sync_fifo.sv
745748
set_global_assignment -name MIF_FILE core/rtl/chip/DSP/dsp11b23410_p.mif
746749
set_global_assignment -name MIF_FILE core/rtl/chip/DSP/dsp11b23410_d.mif
@@ -772,11 +775,21 @@ set_global_assignment -name VHDL_FILE core/rtl/CEGen.vhd
772775
set_global_assignment -name VHDL_FILE core/rtl/bram.vhd
773776
set_global_assignment -name QIP_FILE core/rtl/chip/chip.qip
774777
set_global_assignment -name QIP_FILE apf/apf.qip
775-
set_global_assignment -name VERILOG_FILE core/core_top.v
776778
set_global_assignment -name VERILOG_FILE core/core_bridge_cmd.v
777779
set_global_assignment -name SDC_FILE core/core_constraints.sdc
778780
set_global_assignment -name SIGNALTAP_FILE core/stp1.stp
779781
set_global_assignment -name QIP_FILE core/mf_pllbase.qip
780782
set_global_assignment -name SIP_FILE core/mf_pllbase.sip
783+
set_parameter -name USE_CX4 '0 -entity MAIN_SNES
784+
set_parameter -name USE_SDD1 '1 -entity MAIN_SNES
785+
set_parameter -name USE_GSU '0 -entity MAIN_SNES
786+
set_parameter -name USE_SA1 '0 -entity MAIN_SNES
787+
set_parameter -name USE_DSPn '0 -entity MAIN_SNES
788+
set_parameter -name USE_SPC7110 '1 -entity MAIN_SNES
789+
set_parameter -name USE_BSX '1 -entity MAIN_SNES
790+
set_parameter -name USE_MSU '0 -entity MAIN_SNES
791+
set_global_assignment -name QIP_FILE core/mf_pllbase_pal.qip
792+
set_global_assignment -name SIP_FILE core/mf_pllbase_pal.sip
793+
set_parameter -name PAL_PLL '0 -entity core_top
781794
set_global_assignment -name SLD_FILE db/stp1_auto_stripped.stp
782795
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top

src/fpga/apf/build_id.mif

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ DATA_RADIX = HEX;
99
CONTENT
1010
BEGIN
1111

12-
0E0 : 20220928;
13-
0E1 : 00121250;
14-
0E2 : 7a851a82;
12+
0E0 : 20221101;
13+
0E1 : 00113943;
14+
0E2 : dd8da6ac;
1515

1616
END;

src/fpga/core/core_bridge_cmd.v

+11
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ input wire dataslot_requestwrite_ok,
4545

4646
output reg dataslot_allcomplete,
4747

48+
output reg [31:0] rtc_seconds,
49+
output reg [31:0] rtc_date,
50+
output reg [31:0] rtc_time,
51+
4852
input wire savestate_supported,
4953
input wire [31:0] savestate_addr,
5054
input wire [31:0] savestate_size,
@@ -325,6 +329,13 @@ always @(posedge clk) begin
325329
dataslot_allcomplete <= 1;
326330
hstate <= ST_DONE_OK;
327331
end
332+
16'h0090: begin
333+
// RTC
334+
rtc_seconds <= host_20;
335+
rtc_date <= host_24;
336+
rtc_time <= host_28;
337+
hstate <= ST_DONE_OK;
338+
end
328339
16'h00A0: begin
329340
// Savestate: Start/Query
330341
host_40 <= savestate_supported;

0 commit comments

Comments
 (0)