352 Commits

Author SHA1 Message Date
Fabricio Breve
145bba203c Consolidate and remove mapper force options (#187)
Drop several per-mapper OSD force options and unify Zemina-family handling.

- Update SMS.sv config string to label the mapper selection as "Zemina/MSX".
- Remove individual force wires for MSX, Nemesis1, Nemesis2, 4-PAK, Castle and Wonderkid; map Zemina to cover MSX/Nemesis II+/Zemina.
- Simplify system instantiation to remove now-unused mapper force signals.
- Update rtl/system.vhd: remove corresponding entity ports, simplify mapper_manual_force and use_zem logic, adjust boot/init paths and detection conditions (nemesis/zemina/wonderkid handling), and update a process sensitivity list to reflect removed signals.

These changes simplify mapper override handling by consolidating identical mappers and removing obsolete OSD override signals and related special-case logic.

Co-authored-by: Fabricio Breve <7475908+fbreve@users.noreply.github.com>
2026-05-16 15:31:46 +08:00
Fabricio Breve
74d2b82d5b Enhance OSD mapper selection and fix Codemasters regression (#186)
* Add all mappers to the OSD option.

Add all mappers to the 'Mapper' OSD menu. This allows users to manually select a mapper for unknown ROMs that are not automatically detected via CRC or heuristics.

Expose additional mapper choices in the OSD and wire them through to the system logic. SMS.sv: expand CONF_STR mapper entry, extract status[48:45] into mapper_sel and generate individual mapper_force signals; pass those signals into the system instance. rtl/system.vhd: add new mapper_*_force ports, introduce mapper_manual_force (OR of all manual-force signals), and update reset/initialization and write-detection logic to respect manual forcing (affects nem_bank0 init, 4-PAK detection, codies clearing, and mapper selection). Also update mapper detection assignments (castle, wonderkid, linear, dahjee, use_zem) to allow OSD-forced behavior while preserving CRC/auto-detection fallbacks.

* Fix Codemasters regression introduced by Super Boy I/II VDP fix

Remove unused xmode_M2/smode_M2 signals from the vdp->vdp_main->vdp_background
port chain. The signal was added in commit 3e39e1a but never consumed inside
vdp_background, causing a Quartus synthesis artifact that broke Codemasters
games (Micro Machines, Fantastic Dizzy) while other Mode 4 games remained fine.

Also restore correct legacy TMS9918 data pipeline timing in vdp_background:
- datac captured at x=011 (pattern byte), render at x=100 (color byte)
- Matches the pre-3e39e1a behavior, fixing Super Boy I/II as well
- Preserves SC-3000 text mode and Graphics I/II address pipeline

Connect smode_M2 to the video module in SMS.sv so that 224-line and
240-line mode games get correct vertical counter wrapping.

* Mapper heuristics: auto-detect Castle/Dahjee-A/Nemesis/Zemina

Add heuristic detection for mappers that were previously only selectable via OSD or detected by CRC:
- Castle (32KB ROM heuristic based on mirroring)
- Dahjee Type A (preamble detection)
- Nemesis/Korean 1 and 2 (page-0 / last-page blank test)
- Zemina 16KB (header byte detection)

* Remove mappers used by single games from the OSD option

Remove rarely-used mapper options from the OSD config string (drop 4-PAK, Castle, Nemesis I, Wonder Kid) and compact remaining mapper IDs. Reassign mapper force signals to match the new indices (Codies→2, Dahjee A→3, Linear→4, MSX→5, Nemesis II+→6, Zemina→7).

* Bugfix: Wonder Kid would not load when BIOS is in use

Apply Wonder Kid initialization on BIOS→cartridge handoff when the mapper is auto‑detected.
Ensures correct startup for Wonder Kid ROMs when a BIOS is enabled (including Japanese BIOS). No change to other mappers or OSD options.

---------

Co-authored-by: Fabricio Breve <7475908+fbreve@users.noreply.github.com>
2026-05-12 15:59:14 +08:00
Fabricio Breve
efab452f61 Add support for three new SG-1000 games: The Castle, Magical Kid Wiz, Bomberman Special (#185)
* Clear bk_pending when download starts

Add explicit check to clear bk_pending on the transition into downloading (~old_downloading & downloading). This prevents a lingering backup-pending flag when a new download begins while preserving the existing logic that sets bk_pending on bk_ena && ~OSD_STATUS && bk_save_write and clears it when bk_state is active. Change applied in SMS.sv.

* Add Meka mapper 11 and Dahjee Type A expansion

Introduce support for MEKA mapper 11 and Dahjee Type A expansion.

New Master System games supported:

- FA Tetris (Korea) (Unl)
- Flashpoint (Korea) (Unl)

New SG-1000 games supported:
- Rally-X (Taiwan) (Chinese Logo) (Unl)
- Rally-X (Taiwan) (English Logo) (Unl)
- Road Fighter (Taiwan) (Chinese Logo) (Unl)
- Road Fighter (Taiwan) (English Logo) (Unl)

Also add CRC-based for 4 PAK All Action (Australia) (Unl).

Changes include:

- Added signals: mapper_4pak_crc, mapper_linear, mapper_sega_locked, mapper_dahjee_a.
- Implemented CRC matches for several carts (linear/MEKA type 11 and Dahjee Type A), and set mapper_4pak via CRC (0x73ED) at reset instead of purely write-based auto-detect.
- Added mapper_linear branch: linear ROM addressing for specific 32KB games.
- Added mapper_sega_locked mode to keep Sega mapper path but block bank writes for 48KB dahjee_typeb games (works around FPGA boot/logo issues).
- Added mapper_dahjee_a: supports linear ROM with 8KB RAM at 0x2000-0x3FFF; adjusted nvram addressing and read paths so that that area reads/writes use the nvram block.
- Updated rom_RD gating and I/O/data mux logic to account for Dahjee Type A and linear mapper cases.
- Updated rom_a_i generation to include sc3000_en, mapper_linear, and mapper_dahjee_a linear-addressing behavior.
- Minor comment and formatting clarifications around mapper selection and OSD mapper lock/force behavior.

These changes enable proper behavior for several regional/unlabeled cartridges and fix boot issues on physical FPGA targets by selecting the correct mapping path and protecting bank registers when required.

* 3 new SG-1000 games supported; Restrict Survivors auto-detect; add ROM CRCs

3 new SG-1000 games supported:
- Castle, The (Taiwan) (Unl)
- Magical Kid Wiz (Taiwan) (Unl)
- Bomberman Special (Taiwan) (Chinese Logo)

Limit Survivors multicart/megacart auto-detection to explicit .sc loads (prevent .sg palette-only downloads from enabling paging) and update related comments. Add CRC entries for Taiwanese releases to improve mapper detection: The Castle (0xF6EE) and Magical Kid Wiz (0xD935) to mapper_linear, and Bomberman Special (0x683D) to mapper_dahjee_a.

---------

Co-authored-by: Fabricio Breve <7475908+fbreve@users.noreply.github.com>
2026-05-03 22:26:22 +08:00
Fabricio Breve
d17f5b97f0 Add Meka mapper 11 and Dahjee Type A expansion (#184)
* Clear bk_pending when download starts

Add explicit check to clear bk_pending on the transition into downloading (~old_downloading & downloading). This prevents a lingering backup-pending flag when a new download begins while preserving the existing logic that sets bk_pending on bk_ena && ~OSD_STATUS && bk_save_write and clears it when bk_state is active. Change applied in SMS.sv.

* Add Meka mapper 11 and Dahjee Type A expansion

Introduce support for MEKA mapper 11 and Dahjee Type A expansion.

New Master System games supported:

- FA Tetris (Korea) (Unl)
- Flashpoint (Korea) (Unl)

New SG-1000 games supported:
- Rally-X (Taiwan) (Chinese Logo) (Unl)
- Rally-X (Taiwan) (English Logo) (Unl)
- Road Fighter (Taiwan) (Chinese Logo) (Unl)
- Road Fighter (Taiwan) (English Logo) (Unl)

Also add CRC-based for 4 PAK All Action (Australia) (Unl).

Changes include:

- Added signals: mapper_4pak_crc, mapper_linear, mapper_sega_locked, mapper_dahjee_a.
- Implemented CRC matches for several carts (linear/MEKA type 11 and Dahjee Type A), and set mapper_4pak via CRC (0x73ED) at reset instead of purely write-based auto-detect.
- Added mapper_linear branch: linear ROM addressing for specific 32KB games.
- Added mapper_sega_locked mode to keep Sega mapper path but block bank writes for 48KB dahjee_typeb games (works around FPGA boot/logo issues).
- Added mapper_dahjee_a: supports linear ROM with 8KB RAM at 0x2000-0x3FFF; adjusted nvram addressing and read paths so that that area reads/writes use the nvram block.
- Updated rom_RD gating and I/O/data mux logic to account for Dahjee Type A and linear mapper cases.
- Updated rom_a_i generation to include sc3000_en, mapper_linear, and mapper_dahjee_a linear-addressing behavior.
- Minor comment and formatting clarifications around mapper selection and OSD mapper lock/force behavior.

These changes enable proper behavior for several regional/unlabeled cartridges and fix boot issues on physical FPGA targets by selecting the correct mapping path and protecting bank registers when required.

---------

Co-authored-by: Fabricio Breve <7475908+fbreve@users.noreply.github.com>
2026-05-01 15:12:50 +08:00
Keith Conger
dbe2a4db22 README.md updates (#183) 2026-04-30 14:22:07 +08:00
Alexey Melnikov
4e0a644d84 Merge pull request #182 from fbreve/wonder-kid
Add support for The Castle and Wonder Kid mappers with CRC detection
2026-04-30 02:31:37 +08:00
Keith Conger
12ca9c1d83 Gear to Gear Link Cable Support (#180)
* Gear to Gear link cable support over USERIO

* Combine USERIO options
2026-04-30 02:28:54 +08:00
Fabricio Breve
e6dadb754b Add Wonder Kid mapper detection and init
rtl/system.vhd: add support for the Wonder Kid [Proto] mapper (Codemasters-style 16KB). Introduces signal mapper_wonderkid and CRC detection (0x8613). Prevents MSX mapper selection when Wonder Kid is detected, and on RESET_n rising initializes banks to page 0 and pre-locks mapper B to avoid 4-PAK misdetection. Includes explanatory comments for the new mapper behavior.
2026-04-29 12:09:18 -03:00
Fabricio Breve
e9130e7b04 Add The Castle mapper (32KB RAM) support
Introduce mapper_castle signal and CRC detection (CRC16-CCITT 0xEF38) for The Castle (Japan) SG-1000 cartridge. Treat The Castle as a 32KB cart with 32KB RAM at 0x8000-0xFFFF by updating sc_cart_ram_32k/sc_cart_ram_low, nvram addressing, and ROM read gating (prevent ROM reads when Castle RAM is mapped into the upper half). Also exclude the Castle mapper from System E / SC-3000 mapper handling and add explanatory comments.
2026-04-29 11:23:49 -03:00
Fabricio Breve
a2c0a09ceb add 4-Pak All Action + Zemina mapper support (#181)
* Added support for loading Master System BIOS files.

Master System BIOS files can now be used to boot games and play built-in titles.

* Fix lightgun position calculation for vertical aim

The Master System core exhibited a vertical aim deviation with the lightgun, even when properly calibrated.
The offset was zero at the top of the screen but increased progressively toward the bottom.

This commit corrects the lightgun position calculation logic, ensuring accurate aiming across the full vertical range of the screen.

* Implement Soft Reset (Console Reset Button) via OSD and Controller

- Added a "Soft Reset" option to the OSD menu.
- Implemented falling-edge triggering for the OSD reset to ensure the pulse fires after the menu closes.
- Added a ~37ms pulse stretcher to guarantee the Z80 CPU polling loop detects the reset press.
- Mapped the controller 'Select' button to trigger the Soft Reset signal.
- Routed the signal to I/O port $DD bit 4 (active-low), matching the physical reset button behavior on original SMS hardware.
- Improves compatibility and usability for games that utilize the reset button to return to the title screen or menu.

* VDP: Fix legacy modes (Super Boy I/II) while maintaining Mode 4 compatibility

vdp_background.vhd: Refactor legacy mode (Graphics I, II, Text) rendering logic to fix Super Boy I and II.
Correct VRAM addressing for Graphics II (Mode 2) to properly handle banked pattern and color tables.
vdp_main.vhd: Ensure vertical scroll wrapping remains correct for Mode 4. This prevents graphical regressions in titles like After Burner (SMS) and Fray (GG).
vdp.vhd: Add smode_M2 signal to propagate mode bits for proper legacy mode decoding.
video.vhd: Refine high-resolution (224/240 line) timing detection logic.

* add 4-Pak All Action + Zemina mapper support

Implemented 4-Pak All Action (mapper 14) and Zemina (SMS Korean MSX-type 8KB banks, mapper 12) mappers.

The following games are now properly supported:
- 4 PAK All Action (Australia) (Unl)
- F-1 Spirit - The Way to Formula-1
- Knightmare II: The Maze of Galious
- Nemesis
- Nemesis II
- Penguin Adventure

Mapper 12 had partial support before, but only ROMs starting with bytes "41 42" were detected. The newly supported ROMs (except Nemesis) start with "F3 C3". This pattern cannot be used for detection because it is also present in some games that use the Sega mapper.

To improve detection, a CRC16-CCITT is computed over the last 8KB block during ROM loading. Since this method may fail for translations, hacks, or modified ROMs, an OSD option is available to manually force the Zemina mapper.

The new "Mapper" option replaces the previous "Disable Mappers" setting. It defaults to "Auto" (equivalent to the previous "Off"). The other options are "Sega" (previous "On") and "Zemina" (new).

Nemesis is a special case: it uses the Zemina mapper but initially reads from the last 8KB page. The CRC16-CCITT is also used to detect and handle this case.

---------

Co-authored-by: Fabricio Breve <7475908+fbreve@users.noreply.github.com>
2026-04-29 15:13:06 +08:00
Keith Conger
3bf691ad09 Sega SC-3000 and SK-1100 Support (#179) 2026-04-27 14:53:30 +08:00
Fabricio Breve
3e39e1a6f4 VDP: Fix legacy modes (Super Boy I/II) while maintaining Mode 4 compatibility (#178)
* Added support for loading Master System BIOS files.

Master System BIOS files can now be used to boot games and play built-in titles.

* Fix lightgun position calculation for vertical aim

The Master System core exhibited a vertical aim deviation with the lightgun, even when properly calibrated.
The offset was zero at the top of the screen but increased progressively toward the bottom.

This commit corrects the lightgun position calculation logic, ensuring accurate aiming across the full vertical range of the screen.

* Implement Soft Reset (Console Reset Button) via OSD and Controller

- Added a "Soft Reset" option to the OSD menu.
- Implemented falling-edge triggering for the OSD reset to ensure the pulse fires after the menu closes.
- Added a ~37ms pulse stretcher to guarantee the Z80 CPU polling loop detects the reset press.
- Mapped the controller 'Select' button to trigger the Soft Reset signal.
- Routed the signal to I/O port $DD bit 4 (active-low), matching the physical reset button behavior on original SMS hardware.
- Improves compatibility and usability for games that utilize the reset button to return to the title screen or menu.

* VDP: Fix legacy modes (Super Boy I/II) while maintaining Mode 4 compatibility

vdp_background.vhd: Refactor legacy mode (Graphics I, II, Text) rendering logic to fix Super Boy I and II.
Correct VRAM addressing for Graphics II (Mode 2) to properly handle banked pattern and color tables.
vdp_main.vhd: Ensure vertical scroll wrapping remains correct for Mode 4. This prevents graphical regressions in titles like After Burner (SMS) and Fray (GG).
vdp.vhd: Add smode_M2 signal to propagate mode bits for proper legacy mode decoding.
video.vhd: Refine high-resolution (224/240 line) timing detection logic.

---------

Co-authored-by: Fabricio Breve <7475908+fbreve@users.noreply.github.com>
2026-04-25 14:49:05 +08:00
Fabricio Breve
72f37dcbdc Implement Soft Reset (Console Reset Button) via OSD and Controller (#177)
* Added support for loading Master System BIOS files.

Master System BIOS files can now be used to boot games and play built-in titles.

* Fix lightgun position calculation for vertical aim

The Master System core exhibited a vertical aim deviation with the lightgun, even when properly calibrated.
The offset was zero at the top of the screen but increased progressively toward the bottom.

This commit corrects the lightgun position calculation logic, ensuring accurate aiming across the full vertical range of the screen.

* Implement Soft Reset (Console Reset Button) via OSD and Controller

- Added a "Soft Reset" option to the OSD menu.
- Implemented falling-edge triggering for the OSD reset to ensure the pulse fires after the menu closes.
- Added a ~37ms pulse stretcher to guarantee the Z80 CPU polling loop detects the reset press.
- Mapped the controller 'Select' button to trigger the Soft Reset signal.
- Routed the signal to I/O port $DD bit 4 (active-low), matching the physical reset button behavior on original SMS hardware.
- Improves compatibility and usability for games that utilize the reset button to return to the title screen or menu.

---------

Co-authored-by: Fabricio Breve <7475908+fbreve@users.noreply.github.com>
2026-04-21 15:12:13 +08:00
Fabricio Breve
260e0a1903 Fix lightgun position calculation for vertical aim (#176)
* Added support for loading Master System BIOS files.

Master System BIOS files can now be used to boot games and play built-in titles.

* Fix lightgun position calculation for vertical aim

The Master System core exhibited a vertical aim deviation with the lightgun, even when properly calibrated.
The offset was zero at the top of the screen but increased progressively toward the bottom.

This commit corrects the lightgun position calculation logic, ensuring accurate aiming across the full vertical range of the screen.
2026-04-15 22:36:22 +08:00
Fabricio Breve
f9911f681d Added support for loading Master System BIOS files. (#175)
Master System BIOS files can now be used to boot games and play built-in titles.
2026-04-12 05:56:58 +08:00
Takiiiiiiii
4d8506a145 Update framework (#173) 2025-12-06 00:20:38 +08:00
Brendan Saricks
0d6981b751 Move Clone to Alternatives (#172) 2025-07-24 11:57:11 +08:00
Sorgelig
89630ef0b7 Release 20240418. 2024-04-18 19:27:58 +08:00
Sorgelig
7932b6164c Update sys. 2024-04-18 19:23:54 +08:00
Sorgelig
1dee74f357 Release 20231204. 2023-12-04 17:33:03 +08:00
Sorgelig
c08ee8355f Update sys. 2023-12-04 17:07:31 +08:00
Sorgelig
660454df3e Release 20230225. 2023-02-25 23:37:40 +08:00
Sorgelig
2b08f70860 Update sys. 2023-02-25 23:30:13 +08:00
Roberto Garcia-Lago
2d8636c90f MGL for GameGear profile.
Creating an MGL file with "GameGear" as a setname to help new users with core awareness and be able to set separate configs from the base core.
2022-11-08 14:23:40 +08:00
birdybro
0306b4c1ea Add video rotation option to SystemE Arcade (#157)
Also reworked aspect ratio because the nested ternaries were getting pretty long. This is easier to read for most people with the new combinatorial block instead.
2022-11-06 21:06:44 +08:00
Sorgelig
cf8dc07fbe Release 20221014. 2022-10-14 22:22:16 +08:00
Sorgelig
aefce3fdc5 Update sys. 2022-10-14 22:22:04 +08:00
birdybro
30622bc9b4 Update README.md (#153) 2022-10-14 15:03:06 +08:00
birdybro
901ff4b568 Fix crosshair "none" option (#152)
Resolves --> https://github.com/MiSTer-devel/SMS_MiSTer/issues/151
2022-10-04 15:02:18 +08:00
birdybro
ba393da331 Autosave cleanup and fix column mask option (#144)
* Made Autosave function the same as NES core (but left the toggle default state the same).
* Made it so people can enable Autosave even if the game does not support saving, just like NES and other cores.
* Column masking shouldn't be disabled, ran into issues with some SMS and GG games.
* Removed trailing whitespaces in emu module
* Fixed my mistaken indentation of the gg wire assignment on, I didn't notice that it was a single line concurrent assignment above.
* In system.vhd the signal vdp_y1 is unused, already talked to greyrogue about it. Gets rid of a warning message.
2022-08-26 06:17:37 +08:00
birdybro
7ec42c2dcf Switch to SG-1000's correct palette for .SG ROMs (#142) 2022-08-12 16:54:32 +08:00
Alastair M. Robinson
8a7a6739dc MiST target builds again. (#139) 2022-07-18 15:42:02 +08:00
Jose Tejada
3cfa9282d2 Fixes issue #136 by virtually decreasing the DAC bandwidth (#138) 2022-07-18 00:50:55 +08:00
birdybro
6be66524e0 Update status bit docs (#135)
Forgot to do this when I made the last change.
2022-07-12 03:17:45 +08:00
birdybro
73c150d476 Remove forced crop to support codemasters resolution (#133)
There are 256x240 resolution games, the forced cropping prevented the full resolution of these 4 games from being shown:

Cosmic Spacehead
The Excellent Dizzy Collection
Fantastic Dizzy
Micro Machines

https://www.smspower.org/Tags/Extra-Height
2022-07-11 21:54:15 +08:00
birdybro
29aa9f2ccf Add quirk for Ys (Japan) to fix graphics bug (#132) 2022-07-08 19:54:03 +08:00
birdybro
26247dd359 Update edge detection method from VHDL 87 to VHDL 93 (#131)
Technically, `Clk’event and clk = ‘1’` can result in non-`0` triggers (e.g. `1`, `U`, `H`, `X`, `Z`, `W`, etc...), whereas `rising_edge(clk)` does not.
2022-07-07 16:00:25 +08:00
birdybro
abc889b070 Revert left column mask disable for game gear (#129)
Apparently it is necessary in full screen aspect ratio mode.
2022-06-24 22:32:16 +08:00
birdybro
cfb4f978a3 Disable invalid OSD combinations (#128)
When Game Gear is active the border and the column mask don't do anything anyways, and the inverse is true when an SMS or Sega System E game is loaded regarding the game gear resolution option.
2022-06-24 20:20:09 +08:00
Sorgelig
023d2592e3 Simplified FM write handle in turbo mode. 2022-06-23 02:37:21 +08:00
trbocode
1621925d57 Added 5MHz option (#127)
This helps eliminate Slowdown in games like Aleste, Sonic Chaos. The FM chip needs a buffer in this case, so one was added.
2022-06-22 06:45:24 +08:00
Sorgelig
e9a6ec2eb1 Release 20220620. 2022-06-20 21:44:49 +08:00
Sorgelig
195ec42023 Update sys. 2022-06-20 21:44:26 +08:00
trbocode
016a8a3cb3 Added new Extended Game Gear Resolution Option (#126)
This option allows Game Gear games to run at SMS resolutions. Compatibility may vary per game, but most work to an extent.
2022-06-20 20:44:26 +08:00
birdybro
3a0ec0639d Set Aspect Ratio to 4:3 for Game Gear (#125) 2022-06-18 04:52:17 +08:00
greyrogue
376228fade Add support for Megumi Rescue Arcade (#124)
--Minor fix to button reading for Megumi Rescue and Riddle of Pythagoras.
2022-06-01 16:43:32 +08:00
bellwood420
57dba7bedd Add an option to use joystick x-axis as paddle input. (#122) 2022-04-15 22:07:21 +08:00
Sorgelig
497e866508 Release 20220326. 2022-03-26 21:41:10 +08:00
Sorgelig
7d07218b0d Update sys. 2022-03-26 21:36:41 +08:00
Sorgelig
a5521ad46a Release 20220214. 2022-02-14 03:52:24 +08:00