Skip to content

Commit

Permalink
Load ROM from SD
Browse files Browse the repository at this point in the history
  • Loading branch information
sorgelig committed Nov 24, 2017
1 parent d5c8987 commit 07e1c84
Show file tree
Hide file tree
Showing 46 changed files with 462 additions and 6,117 deletions.
21 changes: 3 additions & 18 deletions Arcade-BombJack-lite.qsf
Expand Up @@ -353,31 +353,17 @@ set_location_assignment PIN_W20 -to SW[3]

set_global_assignment -name PRE_FLOW_SCRIPT_FILE "quartus_sh:sys/build_id.tcl"

set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
set_global_assignment -name CDF_FILE jtag_lite.cdf
set_global_assignment -name QIP_FILE sys/sys.qip
set_global_assignment -name QIP_FILE sys/sysmem.qip
set_global_assignment -name VHDL_FILE memory/rom_7j.vhd
set_global_assignment -name VHDL_FILE memory/rom_7l.vhd
set_global_assignment -name VHDL_FILE memory/rom_7m.vhd
set_global_assignment -name VHDL_FILE memory/rom_8k.vhd
set_global_assignment -name VHDL_FILE memory/rom_8h.vhd
set_global_assignment -name VHDL_FILE memory/rom_8e.vhd
set_global_assignment -name VHDL_FILE memory/rom_4p.vhd
set_global_assignment -name VHDL_FILE memory/rom_8r.vhd
set_global_assignment -name VHDL_FILE memory/rom_8n.vhd
set_global_assignment -name VHDL_FILE memory/rom_8l.vhd
set_global_assignment -name VHDL_FILE memory/rom_1j.vhd
set_global_assignment -name VHDL_FILE memory/rom_1l.vhd
set_global_assignment -name VHDL_FILE memory/rom_1m.vhd
set_global_assignment -name VHDL_FILE memory/rom_1n.vhd
set_global_assignment -name VHDL_FILE memory/rom_1r.vhd
set_global_assignment -name VHDL_FILE dpram.vhd
set_global_assignment -name VHDL_FILE memory/ram_1e.vhd
set_global_assignment -name VHDL_FILE memory/ram_1h.vhd
set_global_assignment -name VHDL_FILE memory/ram_6ab.vhd
set_global_assignment -name VHDL_FILE memory/ram_6c.vhd
set_global_assignment -name VHDL_FILE memory/ram4x.vhd
set_global_assignment -name VHDL_FILE memory/ram_3k.vhd
set_global_assignment -name VHDL_FILE memory/rom_3h.vhd
set_global_assignment -name VHDL_FILE memory/ram_6lm.vhd
set_global_assignment -name VHDL_FILE memory/ram_3ef.vhd
set_global_assignment -name VHDL_FILE T80/T80_Reg.vhd
Expand All @@ -401,5 +387,4 @@ set_global_assignment -name VHDL_FILE bombjack/p2_switches.vhd
set_global_assignment -name VERILOG_FILE screen_rotate.v
set_global_assignment -name VHDL_FILE bombjack/bombjack.vhd
set_global_assignment -name VHDL_FILE bombjack_top.vhd
set_global_assignment -name SYSTEMVERILOG_FILE "Arcade-BombJack.sv"
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
set_global_assignment -name SYSTEMVERILOG_FILE "Arcade-BombJack.sv"
17 changes: 1 addition & 16 deletions Arcade-BombJack.qsf
Expand Up @@ -354,28 +354,13 @@ set_global_assignment -name PRE_FLOW_SCRIPT_FILE "quartus_sh:sys/build_id.tcl"
set_global_assignment -name CDF_FILE jtag.cdf
set_global_assignment -name QIP_FILE sys/sys.qip
set_global_assignment -name QIP_FILE sys/vip.qip
set_global_assignment -name VHDL_FILE memory/rom_7j.vhd
set_global_assignment -name VHDL_FILE memory/rom_7l.vhd
set_global_assignment -name VHDL_FILE memory/rom_7m.vhd
set_global_assignment -name VHDL_FILE memory/rom_8k.vhd
set_global_assignment -name VHDL_FILE memory/rom_8h.vhd
set_global_assignment -name VHDL_FILE memory/rom_8e.vhd
set_global_assignment -name VHDL_FILE memory/rom_4p.vhd
set_global_assignment -name VHDL_FILE memory/rom_8r.vhd
set_global_assignment -name VHDL_FILE memory/rom_8n.vhd
set_global_assignment -name VHDL_FILE memory/rom_8l.vhd
set_global_assignment -name VHDL_FILE memory/rom_1j.vhd
set_global_assignment -name VHDL_FILE memory/rom_1l.vhd
set_global_assignment -name VHDL_FILE memory/rom_1m.vhd
set_global_assignment -name VHDL_FILE memory/rom_1n.vhd
set_global_assignment -name VHDL_FILE memory/rom_1r.vhd
set_global_assignment -name VHDL_FILE dpram.vhd
set_global_assignment -name VHDL_FILE memory/ram_1e.vhd
set_global_assignment -name VHDL_FILE memory/ram_1h.vhd
set_global_assignment -name VHDL_FILE memory/ram_6ab.vhd
set_global_assignment -name VHDL_FILE memory/ram_6c.vhd
set_global_assignment -name VHDL_FILE memory/ram4x.vhd
set_global_assignment -name VHDL_FILE memory/ram_3k.vhd
set_global_assignment -name VHDL_FILE memory/rom_3h.vhd
set_global_assignment -name VHDL_FILE memory/ram_6lm.vhd
set_global_assignment -name VHDL_FILE memory/ram_3ef.vhd
set_global_assignment -name VHDL_FILE T80/T80_Reg.vhd
Expand Down
31 changes: 24 additions & 7 deletions Arcade-BombJack.sv
Expand Up @@ -113,7 +113,7 @@ assign {DDRAM_CLK, DDRAM_BURSTCNT, DDRAM_ADDR, DDRAM_DIN, DDRAM_BE, DDRAM_RD, DD
assign {SD_SCK, SD_MOSI, SD_CS} = 'Z;
assign {SDRAM_DQ, SDRAM_A, SDRAM_BA, SDRAM_CLK, SDRAM_CKE, SDRAM_DQML, SDRAM_DQMH, SDRAM_nWE, SDRAM_nCAS, SDRAM_nRAS, SDRAM_nCS} = 'Z;

assign LED_USER = 0;
assign LED_USER = ioctl_download;
assign LED_DISK = 0;
assign LED_POWER = 0;

Expand All @@ -128,8 +128,8 @@ localparam CONF_STR = {
"O2,Orientation,Vert,Horz;",
"-;",
"T6,Reset;",
"J,Jump,Start;",
"V,v1.00.",`BUILD_DATE
"J,Jump,Start 1P,Start 2P;",
"V,v2.00.",`BUILD_DATE
};

//////////////////// CLOCKS ///////////////////
Expand All @@ -151,6 +151,11 @@ pll pll
wire [31:0] status;
wire [1:0] buttons;

wire ioctl_download;
wire ioctl_wr;
wire [24:0] ioctl_addr;
wire [7:0] ioctl_dout;

wire [65:0] ps2_key;

wire [15:0] joystick_0, joystick_1;
Expand All @@ -166,6 +171,11 @@ hps_io #(.STRLEN($size(CONF_STR)>>3)) hps_io
.buttons(buttons),
.status(status),

.ioctl_download(ioctl_download),
.ioctl_wr(ioctl_wr),
.ioctl_addr(ioctl_addr),
.ioctl_dout(ioctl_dout),

.joystick_0(joystick_0),
.joystick_1(joystick_1),
.ps2_key(ps2_key)
Expand All @@ -185,6 +195,7 @@ always @(posedge clk_sys) begin
'hX6B: btn_left <= pressed; // left
'hX74: btn_right <= pressed; // right
'h029: btn_fire <= pressed; // space
'h014: btn_fire <= pressed; // ctrl

'h005: btn_one_player <= pressed; // F1
'h006: btn_two_players <= pressed; // F2
Expand All @@ -205,8 +216,10 @@ wire m_down = status[2] ? btn_right | joy[0] : btn_down | joy[2];
wire m_left = status[2] ? btn_down | joy[2] : btn_left | joy[1];
wire m_right = status[2] ? btn_up | joy[3] : btn_right | joy[0];
wire m_fire = btn_fire | joy[4];
wire m_start = btn_one_player | joy[5];
wire m_coin = m_start | btn_two_players;

wire m_start1 = btn_one_player | joy[5];
wire m_start2 = btn_two_players | joy[6];
wire m_coin = m_start1 | m_start2;

wire hblank, vblank;
wire ce_vid = ce_6m;
Expand Down Expand Up @@ -269,15 +282,19 @@ bombjack_top bombjack_top
.clk_48M(clk_sys),
.clk_6M(clk_6M),

.p1_start(m_start),
.dn_addr(ioctl_addr[16:0]),
.dn_data(ioctl_dout),
.dn_wr(ioctl_wr),

.p1_start(m_start1),
.p1_coin(m_coin),
.p1_jump(m_fire),
.p1_down(m_down),
.p1_up(m_up),
.p1_left(m_left),
.p1_right(m_right),

.p2_start(btn_two_players),
.p2_start(m_start2),
.p2_coin(0),
.p2_jump(0),
.p2_down(0),
Expand Down
19 changes: 19 additions & 0 deletions README.txt
Expand Up @@ -23,3 +23,22 @@
--
--
---------------------------------------------------------------------------------

*** Attention ***

ROM is not included. In order to use this arcade, you need to provide a correct ROM file.

1) Put bat and 7za.exe files from releases folder into the same folder on PC.

2) Execute bat file - it will show the name of zip file containing required files.

3) Find this zip file somewhere. You need to find the file exactly as required.
Do not rename other zip files even if they also replresent the same game - they are not compatible!
The name of zip is taken from M.A.M.E. project, so you can get more info about
hashes and contained files there.

4) Put required zip into the same folder and execute the bat again.

5) If everything will go without errors or warnings, then you will get the rom file.

6) Place the rom file into root of SD card.
17 changes: 16 additions & 1 deletion bombjack/bombjack.vhd
Expand Up @@ -83,6 +83,11 @@ entity BOMB_JACK is
-- Active high external buttons
I_RESET : in std_logic; -- push button

clk_48M : in std_logic;
dn_addr : in std_logic_vector(16 downto 0);
dn_data : in std_logic_vector(7 downto 0);
dn_wr : in std_logic;

-- Clocks
I_CLK_4M : in std_logic := '0';
I_CLK_6M : in std_logic := '0';
Expand Down Expand Up @@ -366,7 +371,12 @@ begin
-- chips 1J, 1L, 1M, 1N, 1R page 1
prog_roms : entity work.PROG_ROMS
port map (
I_CLK => clk_12M,
clk_48M => clk_48M,
dn_addr => dn_addr,
dn_data => dn_data,
dn_wr => dn_wr,

I_CLK => clk_12M,
I_ROM_SEL => rom_sel,
I_ADDR => cpu_addr(12 downto 0),
O_DATA => rom_data
Expand Down Expand Up @@ -695,6 +705,11 @@ begin
-----------------------------------------
p9 : entity work.audio
port map (
clk_48M => clk_48M,
dn_addr => dn_addr,
dn_data => dn_data,
dn_wr => dn_wr,

I_CLK_12M => clk_12M,
I_CLK_EN => s_clk_en,
I_RESET_n => RESETn,
Expand Down
30 changes: 22 additions & 8 deletions bombjack/p9_audio_cpu.vhd
Expand Up @@ -23,6 +23,11 @@ library ieee;

entity audio is
port (
clk_48M : in std_logic;
dn_addr : in std_logic_vector(16 downto 0);
dn_data : in std_logic_vector(7 downto 0);
dn_wr : in std_logic;

I_CLK_12M : in std_logic;
I_CLK_EN : in std_logic;
I_RESET_n : in std_logic;
Expand Down Expand Up @@ -71,6 +76,8 @@ architecture RTL of audio is
signal s_vsync_n_t0 : std_logic := '0';
signal s_vsync_n_t1 : std_logic := '0';
signal s_vsync_n_re : std_logic := '0';

signal ROM_3H_cs : std_logic;

begin

Expand Down Expand Up @@ -180,14 +187,21 @@ begin
q => ram_data
);

-- chip 3H page 9
ROM_3H : entity work.ROM_3H
port map (
clock => I_CLK_12M,
clken => s_srom1,
address => cpu_addr(12 downto 0),
q => rom_3H_data
);
ROM_3H_cs <= '1' when dn_addr(16 downto 13) = X"0" else '0';

ROM_3H : work.dpram generic map (13,8)
port map
(
clock_a => clk_48M,
wren_a => dn_wr and ROM_3H_cs,
address_a => dn_addr(12 downto 0),
data_a => dn_data,

clock_b => I_CLK_12M,
enable_b => s_srom1,
address_b => cpu_addr(12 downto 0),
q_b => rom_3H_data
);

-- -- chip 3J page 9 (not fitted to board, empty socket)

Expand Down

0 comments on commit 07e1c84

Please sign in to comment.