Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup2 #3

Merged
merged 3 commits into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ Features:

Planned features:
* ROM mapper control override via file extension
* Mapper updates
* Mouse as paddle support

> [!IMPORTANT]
Expand All @@ -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.<br>

### Supported mappers
* Auto detected<br>
F8 F6 FE E0 3F F4 P2 FA CV 2K UA E7 F0 32<br>
* Auto detected (00 F8 F6 FE E0 3F F4 P2 FA CV 2K UA E7 F0 32)<br>

LED 2 to 4 are activated as hint in case an unsupported game (mapper) detected<br>

### single Button Joystick
* Button ```Trigger```

### four Button Joystick or Gamepad
* Gamepad Button ```Trigger A (DS2 circle)``` Trigger
Expand Down Expand Up @@ -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<br>

**Multicolor RGB LED**
* **<font color="green">green</font>**&ensp;&thinsp;&ensp;&thinsp;&ensp;&thinsp;all fine and ready to go<br>
Expand Down
54 changes: 31 additions & 23 deletions src/A2601top.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
14 changes: 8 additions & 6 deletions src/a2600_top_tn20k.vhd
Original file line number Diff line number Diff line change
@@ -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
--
Expand Down Expand Up @@ -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 (
Expand Down Expand Up @@ -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
Expand Down Expand 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,

Expand All @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/misc/video_analyzer.v
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down