From 7bd9d0411349e00dcab4944b9ec4922bd4713420 Mon Sep 17 00:00:00 2001 From: Stefan Voss <75468830+vossstef@users.noreply.github.com> Date: Sat, 19 Oct 2024 11:37:12 +0200 Subject: [PATCH] Cleanup2 (#3) --- README.md | 22 +++++++++++----- src/A2601top.vhd | 54 ++++++++++++++++++++++----------------- src/a2600_top_tn20k.vhd | 14 +++++----- src/misc/video_analyzer.v | 2 +- 4 files changed, 56 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index cbdf7bf..69c821c 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,6 @@ Features: Planned features: * ROM mapper control override via file extension -* Mapper updates * Mouse as paddle support > [!IMPORTANT] @@ -46,8 +45,12 @@ The installation of A2600Nano on the Tang Nano 20k board can be done using a Lin ROM can be loaded via OSD file selection.
### Supported mappers -* Auto detected
-F8 F6 FE E0 3F F4 P2 FA CV 2K UA E7 F0 32
+* Auto detected (00 F8 F6 FE E0 3F F4 P2 FA CV 2K UA E7 F0 32)
+ +LED 2 to 4 are activated as hint in case an unsupported game (mapper) detected
+ +### single Button Joystick +* Button ```Trigger``` ### four Button Joystick or Gamepad * Gamepad Button ```Trigger A (DS2 circle)``` Trigger @@ -125,9 +128,16 @@ You have first to set the DS2 Sticks into analog mode by pressing the DS2 ANALOG ## LED UI -| LED | function | TN20K | TP20K | TP25K | TM138K |TN9k| -| --- | - | - |- | - | - |-| -| 1 | crt | x |x | x | x |N/A| +| LED | function | TN20K | TP20K | TP25K | TM138K |TN9k| +| --- | - | - |- | - | - | - | +| 0 |Cartridge selected| x |- | - | - | - | +| 1 | reserved | x |- | - | - | - | +| 2 | Game unsupported | x |- | - | - | - | +| 3 | Game unsupported | x |- | - | - | - | +| 4 | Game unsupported | x |- | - | - | - | +| 5 | Game unsupported | x |- | - | - | - | + +LED 2 to 4 are activated as hint in case an unsupported game (mapper) detected
**Multicolor RGB LED** * **green**      all fine and ready to go
diff --git a/src/A2601top.vhd b/src/A2601top.vhd index d447418..e5782ce 100644 --- a/src/A2601top.vhd +++ b/src/A2601top.vhd @@ -572,6 +572,14 @@ begin else last_1FF0 <= '0'; end if; + when BANKAR => + when BANK3E => + when BANKSB => + when BANKWD => + when BANKEF => + when BANKDPCP => + when BANKCTY => + when BANKCDF => when others => null; end case; @@ -581,30 +589,30 @@ begin end process; -- derive banking scheme from cartridge size ---process(rom_size, force_bs) ---begin --- if(force_bs /= "00000") then +process(rom_size, force_bs) +begin + if(force_bs /= "00000") then bss <= force_bs; --- elsif(rom_size = '0'&x"0000") then --- bss <= BANK00; --- elsif(rom_size <= '0'&x"0800") then -- 2k and less --- bss <= BANK2K; --- elsif(rom_size <= '0'&x"1000") then -- 4k and less --- bss <= BANK00; --- elsif(rom_size <= '0'&x"2000") then -- 8k and less --- bss <= BANKF8; --- elsif(rom_size <= '0'&x"3000") then -- 12k and less --- bss <= BANKFA; --- elsif(rom_size <= '0'&x"4000") then -- 16k and less --- bss <= BANKF6; --- elsif(rom_size <= '0'&x"8000") then -- 32k and less --- bss <= BANKF4; --- elsif(rom_size <= '1'&x"0000") then -- 64k and less --- bss <= BANK32; --- else --- bss <= BANK00; --- end if; ---end process; + elsif(rom_size = '0'&x"0000") then + bss <= BANK00; + elsif(rom_size <= '0'&x"0800") then -- 2k and less + bss <= BANK2K; + elsif(rom_size <= '0'&x"1000") then -- 4k and less + bss <= BANK00; + elsif(rom_size <= '0'&x"2000") then -- 8k and less + bss <= BANKF8; + elsif(rom_size <= '0'&x"3000") then -- 12k and less + bss <= BANKFA; + elsif(rom_size <= '0'&x"4000") then -- 16k and less + bss <= BANKF6; + elsif(rom_size <= '0'&x"8000") then -- 32k and less + bss <= BANKF4; + elsif(rom_size <= '1'&x"0000") then -- 64k and less + bss <= BANK32; + else + bss <= BANK00; + end if; +end process; process (clk) begin diff --git a/src/a2600_top_tn20k.vhd b/src/a2600_top_tn20k.vhd index 8615746..62f08cd 100644 --- a/src/a2600_top_tn20k.vhd +++ b/src/a2600_top_tn20k.vhd @@ -1,5 +1,5 @@ ------------------------------------------------------------------------- --- A2600 Top level for Tang Nano +-- A2600 Top level for Tang Nano 20k -- 2024 Stefan Voss -- based on the work of many others -- @@ -221,6 +221,7 @@ signal paldetect : std_logic; signal reset_detect : std_logic; signal cart_download_d : std_logic; signal cart_download : std_logic; +signal bs_unsupported : std_logic; component CLKDIV generic ( @@ -513,7 +514,8 @@ port map( ); leds_n <= not leds; -leds(0) <= '0'; +leds(1) <= '0'; +leds(5 downto 2) <= "1111" when force_bs > 14 else "0000"; -- indicate unsupported mapper -- 9 pin d-sub joystick pinout: -- pin 1: up @@ -757,7 +759,7 @@ sd_wr(4 downto 0) <= "00000"; loader_busy => loader_busy, load_crt => load_crt, sd_img_size => sd_img_size, - leds => leds(5 downto 1), + leds(0) => leds(0), img_select => img_select, img_size_crt => img_size_crt, @@ -768,7 +770,7 @@ sd_wr(4 downto 0) <= "00000"; ioctl_wait => ioctl_wait ); -reset2600 <= system_reset(0) or not pll_locked or ioctl_download; +reset2600 <= system_reset(0) or not pll_locked or cart_download; -- swap joysticks and paddle joy_p1 <= joyB when joyswap = '1' else joyA; @@ -863,7 +865,7 @@ end process; detect_inst: entity work.detect2600 port map( clk => clk, - reset => reset_detect, + reset => reset_detect or system_reset(0), addr => dl_addr(15 downto 0), enable => ioctl_wr and cart_download, cart_size => img_size_crt, @@ -883,7 +885,7 @@ process(clk) begin if rising_edge(clk) then dl_wr <= '0'; - if ioctl_download and load_crt then + if cart_download then if ioctl_wr = '1' then dl_addr <= ioctl_addr(15 downto 0); dl_data <= ioctl_data; diff --git a/src/misc/video_analyzer.v b/src/misc/video_analyzer.v index a8ec3f0..0af859c 100644 --- a/src/misc/video_analyzer.v +++ b/src/misc/video_analyzer.v @@ -53,7 +53,7 @@ always @(posedge clk) begin if(vcnt == 11'd524) begin pal <= 1'b0; // NTSC end - if(vcnt == 11'd312 ) begin + if(vcnt == 11'd624 ) begin pal <= 1'b1; // PAL end changed <= 1'b1;