mirror of
https://github.com/Gehstock/Mist_FPGA.git
synced 2026-02-13 19:34:09 +00:00
Crater Raider: add NVRAM save
This commit is contained in:
@@ -53,6 +53,7 @@ localparam CONF_STR = {
|
||||
"O5,Blend,Off,On;",
|
||||
"O6,Service,Off,On;",
|
||||
"O7,Spinner Speed,Low,High;",
|
||||
"R2048,Save NVRAM;",
|
||||
"T0,Reset;",
|
||||
"V,v1.1.",`BUILD_DATE
|
||||
};
|
||||
@@ -62,7 +63,7 @@ wire blend = status[5];
|
||||
wire service = status[6];
|
||||
wire spinspd = status[7];
|
||||
|
||||
assign LED = ~ioctl_downl;
|
||||
assign LED = ~(ioctl_downl | ioctl_upl);
|
||||
assign SDRAM_CLK = clk_mem;
|
||||
assign SDRAM_CKE = 1;
|
||||
|
||||
@@ -117,25 +118,30 @@ wire [15:0] snd_do;
|
||||
wire [14:0] sp_addr;
|
||||
wire [31:0] sp_do;
|
||||
wire ioctl_downl;
|
||||
wire ioctl_upl;
|
||||
wire [7:0] ioctl_index;
|
||||
wire ioctl_wr;
|
||||
wire [24:0] ioctl_addr;
|
||||
wire [7:0] ioctl_dout;
|
||||
wire [7:0] ioctl_din;
|
||||
|
||||
data_io data_io(
|
||||
.clk_sys ( clk_sys ),
|
||||
.SPI_SCK ( SPI_SCK ),
|
||||
.SPI_SS2 ( SPI_SS2 ),
|
||||
.SPI_DI ( SPI_DI ),
|
||||
.SPI_DO ( SPI_DO ),
|
||||
.ioctl_download( ioctl_downl ),
|
||||
.ioctl_upload ( ioctl_upl ),
|
||||
.ioctl_index ( ioctl_index ),
|
||||
.ioctl_wr ( ioctl_wr ),
|
||||
.ioctl_addr ( ioctl_addr ),
|
||||
.ioctl_dout ( ioctl_dout )
|
||||
.ioctl_dout ( ioctl_dout ),
|
||||
.ioctl_din ( ioctl_din )
|
||||
);
|
||||
|
||||
wire [24:0] sp_ioctl_addr = ioctl_addr - 17'he000; // sound cpu prg offset
|
||||
wire [24:0] dl_addr = ioctl_addr - 18'h2e000; // background + char grfx offset
|
||||
wire [24:0] dl_addr = ioctl_addr - (ioctl_index == 0 ? 18'h2e000 : 18'h0); // background + char grfx offset
|
||||
|
||||
reg port1_req, port2_req;
|
||||
sdram sdram(
|
||||
@@ -176,7 +182,7 @@ always @(posedge clk_sys) begin
|
||||
|
||||
ioctl_wr_last <= ioctl_wr;
|
||||
if (ioctl_downl) begin
|
||||
if (~ioctl_wr_last && ioctl_wr) begin
|
||||
if (~ioctl_wr_last && ioctl_wr && ioctl_index == 0) begin
|
||||
port1_req <= ~port1_req;
|
||||
port2_req <= ~port2_req;
|
||||
end
|
||||
@@ -249,9 +255,11 @@ Crater_Raider Crater_Raider(
|
||||
.snd_rom_do ( snd_addr[0] ? snd_do[15:8] : snd_do[7:0] ),
|
||||
.sp_addr ( sp_addr ),
|
||||
.sp_graphx32_do ( sp_do ),
|
||||
.dl_addr ( dl_addr ),
|
||||
.dl_wr ( ioctl_wr ),
|
||||
.dl_data ( ioctl_dout )
|
||||
.dl_addr ( dl_addr ),
|
||||
.dl_data ( ioctl_dout ),
|
||||
.dl_wr ( ioctl_wr && ioctl_index == 0 ),
|
||||
.up_data ( ioctl_din ),
|
||||
.cmos_wr ( ioctl_wr && ioctl_index == 8'hff )
|
||||
);
|
||||
|
||||
wire vs_out;
|
||||
|
||||
@@ -172,10 +172,11 @@ port(
|
||||
sp_addr : out std_logic_vector(14 downto 0);
|
||||
sp_graphx32_do : in std_logic_vector(31 downto 0);
|
||||
|
||||
dl_addr : in std_logic_vector(15 downto 0);
|
||||
dl_data : in std_logic_vector( 7 downto 0);
|
||||
dl_wr : in std_logic;
|
||||
|
||||
dl_addr : in std_logic_vector(15 downto 0);
|
||||
dl_data : in std_logic_vector( 7 downto 0);
|
||||
dl_wr : in std_logic;
|
||||
up_data : out std_logic_vector(7 downto 0);
|
||||
cmos_wr : in std_logic;
|
||||
dbg_cpu_addr : out std_logic_vector(15 downto 0)
|
||||
);
|
||||
end crater_raider;
|
||||
@@ -846,14 +847,19 @@ port map (
|
||||
cpu_rom_addr <= cpu_addr(15 downto 0);
|
||||
|
||||
-- working RAM F000-F7FF 2Ko
|
||||
wram : entity work.cmos_ram
|
||||
wram : entity work.dpram
|
||||
generic map( dWidth => 8, aWidth => 11)
|
||||
port map(
|
||||
clk => clock_vidn,
|
||||
we => wram_we,
|
||||
addr => cpu_addr(10 downto 0),
|
||||
d => cpu_do,
|
||||
q => wram_do
|
||||
clk_a => clock_vidn,
|
||||
addr_a => cpu_addr(10 downto 0),
|
||||
d_a => cpu_do,
|
||||
we_a => wram_we,
|
||||
q_a => wram_do,
|
||||
clk_b => clock_vid,
|
||||
we_b => cmos_wr,
|
||||
addr_b => dl_addr(10 downto 0),
|
||||
d_b => dl_data,
|
||||
q_b => up_data
|
||||
);
|
||||
|
||||
-- char RAM E800-EBFF 1Ko + mirroring 0400
|
||||
|
||||
Reference in New Issue
Block a user