From 62e57df4dc52a4dfa018e5d3bda1848003a3cffc Mon Sep 17 00:00:00 2001 From: Gyorgy Szombathelyi Date: Fri, 14 Feb 2020 16:07:22 +0100 Subject: [PATCH] MCR3Mono: convert to single RBF + MRA files --- .../Midway MCR 3 Monoboard/mcr3mono.qsf | 3 +- .../Midway MCR 3 Monoboard/meta/Max RPM.mra | 28 ++++ .../meta/Power Drive.mra | 32 ++++ .../Midway MCR 3 Monoboard/meta/Rampage.mra | 32 ++++ .../Midway MCR 3 Monoboard/meta/Sarge.mra | 30 ++++ .../rtl/MCR3Mono_MiST.sv | 148 ++++++++++-------- .../Midway MCR 3 Monoboard/rtl/mcr3mono.vhd | 4 +- 7 files changed, 209 insertions(+), 68 deletions(-) create mode 100644 Arcade_MiST/Midway MCR 3 Monoboard/meta/Max RPM.mra create mode 100644 Arcade_MiST/Midway MCR 3 Monoboard/meta/Power Drive.mra create mode 100644 Arcade_MiST/Midway MCR 3 Monoboard/meta/Rampage.mra create mode 100644 Arcade_MiST/Midway MCR 3 Monoboard/meta/Sarge.mra diff --git a/Arcade_MiST/Midway MCR 3 Monoboard/mcr3mono.qsf b/Arcade_MiST/Midway MCR 3 Monoboard/mcr3mono.qsf index 3c3fb947..df1bcba3 100644 --- a/Arcade_MiST/Midway MCR 3 Monoboard/mcr3mono.qsf +++ b/Arcade_MiST/Midway MCR 3 Monoboard/mcr3mono.qsf @@ -41,7 +41,7 @@ # ======================== set_global_assignment -name PROJECT_OUTPUT_DIRECTORY output_files set_global_assignment -name NUM_PARALLEL_PROCESSORS ALL -set_global_assignment -name LAST_QUARTUS_VERSION 13.1 +set_global_assignment -name LAST_QUARTUS_VERSION "13.1 SP4.26" set_global_assignment -name PRE_FLOW_SCRIPT_FILE "quartus_sh:rtl/build_id.tcl" # Pin & Location Assignments @@ -75,6 +75,7 @@ set_location_assignment PIN_88 -to SPI_DI set_location_assignment PIN_126 -to SPI_SCK set_location_assignment PIN_127 -to SPI_SS2 set_location_assignment PIN_91 -to SPI_SS3 +set_location_assignment PIN_90 -to SPI_SS4 set_location_assignment PIN_13 -to CONF_DATA0 set_location_assignment PIN_49 -to SDRAM_A[0] set_location_assignment PIN_44 -to SDRAM_A[1] diff --git a/Arcade_MiST/Midway MCR 3 Monoboard/meta/Max RPM.mra b/Arcade_MiST/Midway MCR 3 Monoboard/meta/Max RPM.mra new file mode 100644 index 00000000..30b6e44f --- /dev/null +++ b/Arcade_MiST/Midway MCR 3 Monoboard/meta/Max RPM.mra @@ -0,0 +1,28 @@ + + Max RPM (ver 2) + 0217 + 20200202 + 1986 + Bally Midway + Action + MCR3Mono + maxrpm + + + + + 03 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Arcade_MiST/Midway MCR 3 Monoboard/meta/Power Drive.mra b/Arcade_MiST/Midway MCR 3 Monoboard/meta/Power Drive.mra new file mode 100644 index 00000000..7536a37c --- /dev/null +++ b/Arcade_MiST/Midway MCR 3 Monoboard/meta/Power Drive.mra @@ -0,0 +1,32 @@ + + Power Drive + 0217 + 20200202 + 1986 + Bally Midway + Action + MCR3Mono + powerdrv + + + + + + + 02 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Arcade_MiST/Midway MCR 3 Monoboard/meta/Rampage.mra b/Arcade_MiST/Midway MCR 3 Monoboard/meta/Rampage.mra new file mode 100644 index 00000000..c1d4259c --- /dev/null +++ b/Arcade_MiST/Midway MCR 3 Monoboard/meta/Rampage.mra @@ -0,0 +1,32 @@ + + Rampage (Rev 3) + 0217 + 20200202 + 1986 + Bally Midway + Action + MCR3Mono + rampage + + + + + + + 00 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Arcade_MiST/Midway MCR 3 Monoboard/meta/Sarge.mra b/Arcade_MiST/Midway MCR 3 Monoboard/meta/Sarge.mra new file mode 100644 index 00000000..865d3491 --- /dev/null +++ b/Arcade_MiST/Midway MCR 3 Monoboard/meta/Sarge.mra @@ -0,0 +1,30 @@ + + Sarge + 0217 + 20200202 + 1985 + Bally Midway + Action + MCR3Mono + sarge + + + + + 01 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Arcade_MiST/Midway MCR 3 Monoboard/rtl/MCR3Mono_MiST.sv b/Arcade_MiST/Midway MCR 3 Monoboard/rtl/MCR3Mono_MiST.sv index 2a5ba259..57eaadcb 100644 --- a/Arcade_MiST/Midway MCR 3 Monoboard/rtl/MCR3Mono_MiST.sv +++ b/Arcade_MiST/Midway MCR 3 Monoboard/rtl/MCR3Mono_MiST.sv @@ -27,10 +27,11 @@ module MCR3Mono_MiST( output AUDIO_L, output AUDIO_R, input SPI_SCK, - output SPI_DO, + inout SPI_DO, input SPI_DI, input SPI_SS2, input SPI_SS3, + input SPI_SS4, input CONF_DATA0, input CLOCK_27, output [12:0] SDRAM_A, @@ -48,11 +49,24 @@ module MCR3Mono_MiST( `include "rtl/build_id.v" -// Uncomment one to build with game-specific core name/inputs/sound board -//`define CORE_NAME "SARGE" -`define CORE_NAME "MAXRPM" -//`define CORE_NAME "RAMPAGE" -//`define CORE_NAME "POWERDRV" +`define CORE_NAME "RAMPAGE" +wire [6:0] core_mod; + +localparam CONF_STR = { + `CORE_NAME,";ROM;", + "O2,Rotate Controls,Off,On;", + "O5,Blend,Off,On;", + "O6,Swap Joystick,Off,On;", + "DIP;", + "O7,Service,Off,On;", + "T0,Reset;", + "V,v1.1.",`BUILD_DATE +}; + +wire rotate = status[2]; +wire blend = status[5]; +wire joyswap = status[6]; +wire service = status[7]; reg sg; // Sounds Good board reg [7:0] input0; @@ -65,8 +79,7 @@ reg [7:0] output6; // Game specific sound board/DIP/input settings always @(*) begin - if (`CORE_NAME == "SARGE" || - `CORE_NAME == "MAXRPM") + if (core_mod == 7'h1 || core_mod == 7'h3) sg = 0; else sg = 1; @@ -77,44 +90,43 @@ always @(*) begin input3 = 8'hff; input4 = 8'hff; - if (`CORE_NAME == "SARGE") begin - // Two stick/player like the original - input0 = ~{2'b00, service, 1'b0, m_two_players, m_one_player, m_coin2, m_coin1}; - input1 = ~{m_fireA | m_fireB, m_fireA | m_fireB, m_fire2A | m_fire2B, m_fire2A | m_fire2B, m_down, m_up, m_down, m_up}; - input2 = ~{m_fire3A | m_fire3B, m_fire3A | m_fire3B, m_fire4A | m_fire4B, m_fire4A | m_fire4B, m_down3, m_up3, m_down4, m_up4}; - end else if (`CORE_NAME == "MAXRPM") begin - input0 = ~{service, 3'b000, m_one_player, m_two_players, m_coin1, m_coin2}; - input1 = ~{maxrpm_adc_data}; - input2 = ~{maxrpm_gear1, maxrpm_gear2}; - end else if (`CORE_NAME == "RAMPAGE") begin + case (core_mod) + 7'h0: // RAMPAGE + begin // normal controls for 3 players input0 = ~{2'b00, service, 1'b0, 2'b00, m_coin2, m_coin1}; input1 = ~{2'b00, m_fireB, m_fireA, m_left, m_down, m_right, m_up}; input2 = ~{2'b00, m_fire2B, m_fire2A, m_left2, m_down2, m_right2, m_up2}; + input3 = ~{/*cheat*/status[11], /*coin B*/3'b000, /*coin A*/1'b0, /*score opt*/status[10], /*difficulty*/status[9:8]}; input4 = ~{2'b00, m_fire3B, m_fire3A, m_left3, m_down3, m_right3, m_up3}; - end else if (`CORE_NAME == "POWERDRV") begin + end + 7'h1: // SARGE + begin + // Two stick/player like the original + input0 = ~{2'b00, service, 1'b0, m_two_players, m_one_player, m_coin2, m_coin1}; + input1 = ~{m_fireA | m_fireB, m_fireA | m_fireB, m_fire2A | m_fire2B, m_fire2A | m_fire2B, m_down, m_up, m_down, m_up}; + input2 = ~{m_fire3A | m_fire3B, m_fire3A | m_fire3B, m_fire4A | m_fire4B, m_fire4A | m_fire4B, m_down3, m_up3, m_down4, m_up4}; + input3 = ~{2'b00, /*coinage*/2'b00, /*free play*/status[8], 3'b000}; + end + 7'h2: //POWERDRV + begin // Controls for 3 players using 4 buttons/joystick input0 = ~{2'b00, service, 1'b0, 1'b0, m_coin3, m_coin2, m_coin1}; input1 = ~{m_fire2B, m_fire2A, powerdrv_gear[1], m_fire2C, m_fireB, m_fireA, powerdrv_gear[0], m_fireC}; input2 = ~{sndstat[0], 3'b000, m_fire3B, m_fire3A, powerdrv_gear[2], m_fire3C}; + input3 = ~{/*cheat*/status[11], /*demosnd*/status[10], /*difficulty*/status[9:8], 1'b0, /*coinage*/2'b00}; end + 7'h3: // MAXRPM + begin + input0 = ~{service, 3'b000, m_one_player, m_two_players, m_coin1, m_coin2}; + input1 = ~{maxrpm_adc_data}; + input2 = ~{maxrpm_gear1, maxrpm_gear2}; + input3[0] = ~status[8]; // free play + end + default: ; + endcase end -localparam CONF_STR = { - `CORE_NAME,";ROM;", - "O2,Rotate Controls,Off,On;", - "O5,Blend,Off,On;", - "O6,Swap Joystick,Off,On;", - "O7,Service,Off,On;", - "T0,Reset;", - "V,v1.1.",`BUILD_DATE -}; - -wire rotate = status[2]; -wire blend = status[5]; -wire joyswap = status[6]; -wire service = status[7]; - assign LED = ~ioctl_downl; assign SDRAM_CLK = clk_mem; assign SDRAM_CKE = 1; @@ -138,14 +150,37 @@ wire [7:0] joystick_2; wire [7:0] joystick_3; wire scandoublerD; wire ypbpr; -wire [9:0] audio; -wire hs, vs, cs; -wire blankn; -wire [2:0] g, r, b; +wire no_csync; wire key_pressed; wire [7:0] key_code; wire key_strobe; +user_io #( + .STRLEN(($size(CONF_STR)>>3)), + .ROM_DIRECT_UPLOAD(1)) +user_io( + .clk_sys (clk_sys ), + .conf_str (CONF_STR ), + .SPI_CLK (SPI_SCK ), + .SPI_SS_IO (CONF_DATA0 ), + .SPI_MISO (SPI_DO ), + .SPI_MOSI (SPI_DI ), + .buttons (buttons ), + .switches (switches ), + .scandoubler_disable (scandoublerD ), + .ypbpr (ypbpr ), + .no_csync (no_csync ), + .core_mod (core_mod ), + .key_strobe (key_strobe ), + .key_pressed (key_pressed ), + .key_code (key_code ), + .joystick_0 (joystick_0 ), + .joystick_1 (joystick_1 ), + .joystick_2 (joystick_2 ), + .joystick_3 (joystick_3 ), + .status (status ) + ); + wire ioctl_downl; wire [7:0] ioctl_index; wire ioctl_wr; @@ -168,11 +203,13 @@ Rampage, Power Drive (Sounds Good board): 58000- SG 128k */ -data_io data_io( +data_io #(.ROM_DIRECT_UPLOAD(1)) data_io( .clk_sys ( clk_sys ), .SPI_SCK ( SPI_SCK ), .SPI_SS2 ( SPI_SS2 ), + .SPI_SS4 ( SPI_SS4 ), .SPI_DI ( SPI_DI ), + .SPI_DO ( SPI_DO ), .ioctl_download( ioctl_downl ), .ioctl_index ( ioctl_index ), .ioctl_wr ( ioctl_wr ), @@ -278,7 +315,11 @@ always @(posedge clk_sys) begin reset <= status[0] | buttons[1] | ioctl_downl | ~rom_loaded | (reset_count == 16'h0001); end -wire [1:0] sndstat; +wire [1:0] sndstat; +wire [9:0] audio; +wire hs, vs, cs; +wire blankn; +wire [2:0] g, r, b; mcr3mono mcr3mono ( .clock_40(clk_sys), @@ -318,8 +359,8 @@ mcr3mono mcr3mono ( wire vs_out; wire hs_out; -assign VGA_VS = scandoublerD | vs_out; -assign VGA_HS = scandoublerD ? cs : hs_out; +assign VGA_HS = ((~no_csync & scandoublerD) || ypbpr)? cs : hs_out; +assign VGA_VS = ((~no_csync & scandoublerD) || ypbpr)? 1'b1 : vs_out; mist_video #(.COLOR_DEPTH(3)) mist_video( .clk_sys ( clk_sys ), @@ -344,29 +385,6 @@ mist_video #(.COLOR_DEPTH(3)) mist_video( .ypbpr ( ypbpr ) ); -user_io #( - .STRLEN(($size(CONF_STR)>>3))) -user_io( - .clk_sys (clk_sys ), - .conf_str (CONF_STR ), - .SPI_CLK (SPI_SCK ), - .SPI_SS_IO (CONF_DATA0 ), - .SPI_MISO (SPI_DO ), - .SPI_MOSI (SPI_DI ), - .buttons (buttons ), - .switches (switches ), - .scandoubler_disable (scandoublerD ), - .ypbpr (ypbpr ), - .key_strobe (key_strobe ), - .key_pressed (key_pressed ), - .key_code (key_code ), - .joystick_0 (joystick_0 ), - .joystick_1 (joystick_1 ), - .joystick_2 (joystick_2 ), - .joystick_3 (joystick_3 ), - .status (status ) - ); - dac #(10) dac( .clk_i(clk_sys), .res_n_i(1), diff --git a/Arcade_MiST/Midway MCR 3 Monoboard/rtl/mcr3mono.vhd b/Arcade_MiST/Midway MCR 3 Monoboard/rtl/mcr3mono.vhd index ec287ea1..2d99759a 100644 --- a/Arcade_MiST/Midway MCR 3 Monoboard/rtl/mcr3mono.vhd +++ b/Arcade_MiST/Midway MCR 3 Monoboard/rtl/mcr3mono.vhd @@ -397,8 +397,8 @@ begin vcnt >= 1 and vcnt < 241 then video_blankn <= '1';end if; - if hs_cnt = 0 then hsync0 <= '0'; - elsif hs_cnt = 47 then hsync0 <= '1'; + if hs_cnt = 0 then hsync0 <= '0'; video_hs <= '0'; + elsif hs_cnt = 47 then hsync0 <= '1'; video_hs <= '1'; end if; if hs_cnt = 0 then hsync1 <= '0';