Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/coolgirl-multicart/coolgirl-famicom-multicart.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2016-06-09 05:07:08 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2016-06-09 05:07:08 +0300
commit2e418ceb6a0744a02a59b5f0ef78da3d5af4181d (patch)
treebb97c6d362313598ee30d3201e5ff800fdd4501b
parent8e6fecad657a588375a85ffd4acbef977315464f (diff)
Four-screen mode!
-rw-r--r--CoolGirl.qsf4
-rw-r--r--CoolGirl.v29
-rw-r--r--mappers.vh2
3 files changed, 24 insertions, 11 deletions
diff --git a/CoolGirl.qsf b/CoolGirl.qsf
index e634dec..d6afdeb 100644
--- a/CoolGirl.qsf
+++ b/CoolGirl.qsf
@@ -149,4 +149,6 @@ set_instance_assignment -name IO_STANDARD "3.3-V PCI" -to sram_ce
set_global_assignment -name CDF_FILE CoolGirl.cdf
set_instance_assignment -name IO_STANDARD "3.3-V PCI" -to ppu_ciram_ce
set_global_assignment -name POWER_PRESET_COOLING_SOLUTION "NO HEAT SINK WITH STILL AIR"
-set_global_assignment -name OPTIMIZATION_MODE BALANCED \ No newline at end of file
+set_global_assignment -name OPTIMIZATION_MODE BALANCED
+set_location_assignment PIN_93 -to ppu_not_a13_out
+set_instance_assignment -name IO_STANDARD "3.3-V PCI" -to ppu_not_a13_out \ No newline at end of file
diff --git a/CoolGirl.v b/CoolGirl.v
index 8ca7d93..471037d 100644
--- a/CoolGirl.v
+++ b/CoolGirl.v
@@ -21,7 +21,9 @@ module CoolGirl # (
parameter USE_MAPPER_118 = 1, // mapper #118 - TxSROM
parameter USE_MAPPER_163 = 0, // mapper #163
parameter USE_MAPPER_189 = 1, // mapper #189
- parameter USE_MAPPER_228 = 1 // mapper #228 - Cheetahmen II only
+ parameter USE_MAPPER_228 = 1, // mapper #228 - Cheetahmen II only
+
+ parameter USE_FOUR_SCREEN = 1
)
(
input m2,
@@ -47,16 +49,17 @@ module CoolGirl # (
output ppu_ciram_a10,
input ppu_not_a13,
output ppu_ciram_ce,
- output ppu_not_a13out,
+ output ppu_not_a13_out,
output irq
);
- reg [7:0] new_dendy_init = 8'b11111111;
+ reg [7:0] new_dendy_init = 4'b1111;
reg new_dendy = 0;
+ reg four_screen = 0;
assign cpu_addr_out[26:13] = {cpu_base[26:14] | (cpu_addr_mapped[20:14] & ~prg_mask[20:14]), cpu_addr_mapped[13]};
assign sram_addr_out[14:13] = sram_page[1:0];
- assign ppu_addr_out[17:10] = {ppu_addr_mapped[17:13] & ~chr_mask[17:13], ppu_addr_mapped[12:10]};
+ assign ppu_addr_out[17:10] = ext_ntram_access ? {6'b111111, ppu_addr_in[11:10]} : {ppu_addr_mapped[17:13] & ~chr_mask[17:13], ppu_addr_mapped[12:10]};
assign cpu_data_in = cpu_data_out_enabled ? cpu_data_out : 8'bZZZZZZZZ;
wire flash_ce_w = ~(~romsel | (m2 & map_rom_on_6000 & cpu_addr_in[14] & cpu_addr_in[13]));
@@ -69,19 +72,27 @@ module CoolGirl # (
assign sram_ce = sram_ce_w;
assign sram_we = cpu_rw_in | sram_ce_w;
assign sram_oe = ~cpu_rw_in | sram_ce_w | cpu_data_out_enabled;
- assign ppu_rd_out = ppu_rd_in | ppu_addr_in[13];
- assign ppu_wr_out = ppu_wr_in | ppu_addr_in[13] | ~chr_write_enabled;
- assign ppu_ciram_ce = 1'bZ; // ppu_not_a13;
+ assign ppu_rd_out = ppu_rd_in | (ppu_addr_in[13] & ~ext_ntram_access);
+ assign ppu_wr_out = ppu_wr_in | ((ppu_addr_in[13] | ~chr_write_enabled) & ~ext_ntram_access);
+ wire ext_ntram_access = USE_FOUR_SCREEN & four_screen & ppu_addr_in[13] & ~ppu_addr_in[12]; // four-screen and $2000-$2FFF accessed
+ assign ppu_ciram_ce = new_dendy_init_finished ?
+ (new_dendy ? 1'bZ : // not used by new famiclones
+ ext_ntram_access ? 1'b1 : // disable internal NTRAM
+ ~ppu_addr_in[13]) // enable it otherwise
+ : 1'b0; // ground it while powering on for new famiclones
+ assign ppu_not_a13_out = new_dendy_init_finished ? 1'bZ : 1'b0; // ground it while powering on for new famiclones
+ wire new_dendy_init_finished = new_dendy_init == 0;
+
always @ (posedge m2)
begin
- if (new_dendy_init != 0)
+ if (!new_dendy_init_finished)
new_dendy_init = new_dendy_init - 1'b1;
end
always @ (negedge ppu_rd_in)
begin
- if (new_dendy_init == 0 && (ppu_addr_in[13] != ~ppu_not_a13))
+ if (new_dendy_init_finished && (ppu_addr_in[13] != ~ppu_not_a13))
new_dendy = 1;
end
diff --git a/mappers.vh b/mappers.vh
index 249dd32..d767230 100644
--- a/mappers.vh
+++ b/mappers.vh
@@ -279,7 +279,7 @@
{flags[2:0], mapper[4:0]} = cpu_data_in[7:0]; // some flags, mapper
3'b111: // $5xx7
// some other parameters
- {lockout, mirroring[1:0], prg_write_enabled, chr_write_enabled, sram_enabled} = {cpu_data_in[7], cpu_data_in[4:0]};
+ {lockout, four_screen, mirroring[1:0], prg_write_enabled, chr_write_enabled, sram_enabled} = {cpu_data_in[7], cpu_data_in[5:0]};
endcase
if (USE_MAPPER_009_010 && mapper == 5'b10001) prg_bank_b = 8'b11111101;