1
0
mirror of https://github.com/Gehstock/Mist_FPGA.git synced 2026-01-18 09:02:08 +00:00

Robotron HW: fix Speed Ball

Add two mouse support - needs a firmware update, to
This commit is contained in:
Gyorgy Szombathelyi 2020-06-18 22:48:14 +02:00
parent 6d608adaa7
commit 3741bcc417
4 changed files with 131 additions and 111 deletions

View File

@ -1,7 +1,8 @@
robotron-fpga MiST port
=======================
Supported games: Robotron 2048, Joust, Sinistar, Bubbles, Splat, Stargate, Alien Arena, Playball!
Supported games: Robotron 2048, Joust, Splat, Bubbles, Stargate, Alien Arena, Sinistar,
Playball!, Lotto Fun, Speed Ball
After loading the RBF (Core), a CMOS clearing happens. When the message
"Factory Settings Restored" appears, press the MiST soft RESET button (right).
@ -29,6 +30,7 @@ Some of the Williams cores use more buttons than usual and require remaps to be
The file [README-joystick-remaps.txt](https://github.com/Gehstock/Mist_FPGA_Cores/blob/master/Arcade_MiST/Williams%206809%20rev.1%20Hardware/README-joystick-remaps.txt) contains joystick remaps for the Williams cores.
** Note: ** Speed Ball is playable only with two human players. It needs two controllers and two mice (with the appropriate firmware supporting two mice).
---

View File

@ -4,7 +4,8 @@
// Robotron-FPGA is Copyright 2012 ShareBrained Technology, Inc.
//
// Supports:
// Robotron 2048/Joust/Stargate/Bubbles/Splat/Sinistar/Lotto Fun
// Robotron 2048/Joust/Splat/Bubbles/Stargate/Alien Arena/Sinistar/
// Playball!/Lotto Fun/Speed Ball
module RobotronFPGA_MiST(
output LED,
@ -56,8 +57,8 @@ wire rotate = status[2];
wire [1:0] scanlines = status[4:3];
wire blend = status[5];
wire joyswap = status[6];
wire autoup = status[7] | (core_mod != 7'h8);// Memory Protect for Lotto Fun
wire adv = status[8] ;
wire autoup = status[7];
wire adv = status[8];
reg [7:0] SW;
reg [7:0] JA;
@ -91,10 +92,10 @@ always @(*) begin
JA = 8'hFF;
JB = 8'hFF;
BTN = 4'hF;
AN0 = 8'hFF;
AN1 = 8'hFF;
AN2 = 8'hFF;
AN3 = 8'hFF;
AN0 = 8'h80;
AN1 = 8'h80;
AN2 = 8'h80;
AN3 = 8'h80;
blitter_sc2 = 0;
sinistar = 0;
speedball = 0;
@ -163,22 +164,43 @@ always @(*) begin
JA = ~{ 4'b0000, m_right, m_left, m_down, m_up };
JB = 8'b11111111;//IN1
end
7'h9: // Speed Ball
7'h9: // SPEED BALL
begin
speedball = 1;
BTN = { m_two_players, m_one_player, m_coin1 | m_coin2, reset };//IN2
JA = 8'b11111111;//IN0
JB = 8'b11111111;//IN1
//todo
// AN0 =;
// AN1 =;
// AN2 =;
// AN3 =;
BTN = { m_two_players, m_one_player, m_coin1 | m_coin2, reset };
JA = { m_fireD, m_fireC, m_fireB, m_fireA | mouse_btns0[0], m_right, m_left, m_down, m_up };
JB = { m_fire2D, m_fire2C, m_fire2B, m_fire2A | mouse_btns1[0], m_right2, m_left2, m_down2, m_up2 };
AN0 = {~y_pos0[8], y_pos0[7:1]};
AN1 = {~x_pos0[8], x_pos0[7:1]};
AN2 = {~y_pos1[8], y_pos1[7:1]};
AN3 = {~x_pos1[8], x_pos1[7:1]};
end
default: ;
endcase
end
reg signed [9:0] x_pos0;
reg signed [9:0] y_pos0;
reg [1:0] mouse_btns0;
reg signed [9:0] x_pos1;
reg signed [9:0] y_pos1;
reg [1:0] mouse_btns1;
always @(posedge clk_sys) begin
if (mouse_strobe) begin
if (~mouse_idx) begin
mouse_btns0 <= mouse_flags[1:0];
x_pos0 <= x_pos0 + mouse_x;
y_pos0 <= y_pos0 + mouse_y;
end else begin
mouse_btns1 <= mouse_flags[1:0];
x_pos1 <= x_pos1 + mouse_x;
y_pos1 <= y_pos1 + mouse_y;
end
end
end
assign LED = ~ioctl_downl;
assign SDRAM_CLK = clk_mem;
assign SDRAM_CKE = 1;
@ -206,6 +228,12 @@ wire key_pressed;
wire [7:0] key_code;
wire key_strobe;
wire mouse_strobe;
wire signed [8:0] mouse_x;
wire signed [8:0] mouse_y;
wire [7:0] mouse_flags;
wire mouse_idx;
user_io #(
.STRLEN($size(CONF_STR)>>3))
user_io(
@ -224,6 +252,11 @@ user_io(
.key_strobe ( key_strobe ),
.key_pressed ( key_pressed ),
.key_code ( key_code ),
.mouse_idx ( mouse_idx ),
.mouse_strobe ( mouse_strobe ),
.mouse_x ( mouse_x ),
.mouse_y ( mouse_y ),
.mouse_flags ( mouse_flags ),
.joystick_0 ( joystick_0 ),
.joystick_1 ( joystick_1 ),
.status ( status )
@ -352,6 +385,10 @@ robotron_soc robotron_soc (
.SW ( SW ),
.JA ( JA ),
.JB ( JB ),
.AN0 ( AN0 ),
.AN1 ( AN1 ),
.AN2 ( AN2 ),
.AN3 ( AN3 ),
.MemAdr ( mem_addr ),
.MemDin ( mem_di ),

View File

@ -39,7 +39,7 @@ entity robotron_cpu is
clock : in std_logic;
blitter_sc2 : in std_logic;
sinistar : in std_logic;
speedball : in std_logic;
speedball : in std_logic;
-- MC6809 signals
A : in std_logic_vector(15 downto 0);
Dout : in std_logic_vector(7 downto 0);
@ -123,11 +123,11 @@ entity robotron_cpu is
JB : in std_logic_vector(7 downto 0);
SIN_FIRE : in std_logic;
SIN_BOMB : in std_logic;
-- Analog Input
AN0 : in std_logic_vector(7 downto 0);
AN1 : in std_logic_vector(7 downto 0);
AN2 : in std_logic_vector(7 downto 0);
AN3 : in std_logic_vector(7 downto 0);
-- Analog Input
AN0 : in std_logic_vector(7 downto 0);
AN1 : in std_logic_vector(7 downto 0);
AN2 : in std_logic_vector(7 downto 0);
AN3 : in std_logic_vector(7 downto 0);
-- To sound board
HAND : in std_logic := '1';
PB : out std_logic_vector(5 downto 0)
@ -228,13 +228,14 @@ architecture Behavioral of robotron_cpu is
signal hiram_access : boolean; -- Sinistar hiram
signal color_table_access : boolean;
signal widget_pia_access : boolean;
signal extra_pia_access : boolean;
signal extra_pia_access : boolean;
signal rom_pia_access : boolean;
signal blt_register_access : boolean;
signal video_counter_access : boolean;
signal watchdog_access : boolean;
signal control_access : boolean;
signal cmos_access : boolean;
signal trkball_access : boolean;
signal video_counter_value : std_logic_vector(7 downto 0);
@ -248,7 +249,6 @@ architecture Behavioral of robotron_cpu is
signal ADVANCE : std_logic := '1';
signal AUTO_UP : std_logic := '0';
signal rom_pia_rs : std_logic_vector(1 downto 0) := (others => '0');
signal rom_pia_cs : std_logic := '0';
signal rom_pia_write : std_logic := '0';
signal rom_pia_data_in : std_logic_vector(7 downto 0);
@ -292,7 +292,6 @@ architecture Behavioral of robotron_cpu is
signal board_interface_w1 : std_logic := '1'; -- Upright application: '1' = jumper present
signal widget_pia_rs : std_logic_vector(1 downto 0) := (others => '0');
signal widget_pia_cs : std_logic;
signal widget_pia_write : std_logic := '0';
signal widget_pia_data_in : std_logic_vector(7 downto 0);
@ -318,18 +317,9 @@ architecture Behavioral of robotron_cpu is
signal widget_ic4_a : std_logic_vector(4 downto 1);
signal widget_ic4_b : std_logic_vector(4 downto 1);
signal widget_ic4_y : std_logic_vector(4 downto 1);
-------------------------------------------------------------------
-- signal SLAM : std_logic := '1';
-- signal R_COIN : std_logic := '1';
-- signal C_COIN : std_logic := '1';
-- signal L_COIN : std_logic := '1';
-- signal H_S_RESET : std_logic := '1';
-- signal ADVANCE : std_logic := '1';
-- signal AUTO_UP : std_logic := '0';
signal extra_pia_rs : std_logic_vector(1 downto 0) := (others => '0');
signal extra_pia_cs : std_logic := '0';
signal extra_pia_write : std_logic := '0';
signal extra_pia_data_in : std_logic_vector(7 downto 0);
@ -466,8 +456,8 @@ begin
widget_pia_access <= std_match(address, "11001000----01--");
-- Speedball PIA: read/write: C8X8 - C8XB
extra_pia_access <= std_match(address, "11001000----1---");
extra_pia_access <= std_match(address, "11001000----10--");
-- ROM PIA: read/write: C8XC - C8XF
rom_pia_access <= std_match(address, "11001000----11--");
@ -486,6 +476,9 @@ begin
-- CMOS "nonvolatile" RAM: read/write: CC00 - CFFF
cmos_access <= std_match(address, "110011----------");
-- Speedball Trackballs: read C800-C803
trkball_access <= std_match(address, "11001000----00--");
SLAM <= not SW(6);
H_S_RESET <= not SW(2);
ADVANCE <= not SW(1);
@ -704,27 +697,24 @@ begin
end if;
if rom_pia_access then
rom_pia_rs <= address(1 downto 0);
rom_pia_data_in <= mpu_data_in;
rom_pia_write <= to_std_logic(write);
rom_pia_cs <= '1';
end if;
if widget_pia_access then
widget_pia_rs <= address(1 downto 0);
widget_pia_data_in <= mpu_data_in;
widget_pia_write <= to_std_logic(write);
widget_pia_cs <= '1';
end if;
if speedball = '1' then
if extra_pia_access then
extra_pia_rs <= address(1 downto 0);
extra_pia_data_in <= mpu_data_in;
extra_pia_write <= to_std_logic(write);
extra_pia_cs <= '1';
end if;
end if;
if speedball = '1' then
if extra_pia_access then
extra_pia_data_in <= mpu_data_in;
extra_pia_write <= to_std_logic(write);
extra_pia_cs <= '1';
end if;
end if;
if control_access and write then
blt_win_en <= mpu_data_in(2) and sinistar;
@ -748,11 +738,23 @@ begin
if widget_pia_access then
mpu_data_out <= widget_pia_data_out;
end if;
if extra_pia_access then
mpu_data_out <= extra_pia_data_out;
if speedball = '1' then
if extra_pia_access then
mpu_data_out <= extra_pia_data_out;
end if;
if trkball_access then
case address(1 downto 0) is
when "00" => mpu_data_out <= AN0;
when "01" => mpu_data_out <= AN1;
when "10" => mpu_data_out <= AN2;
when "11" => mpu_data_out <= AN3;
when others => null;
end case;
end if;
end if;
if rom_pia_access then
mpu_data_out <= rom_pia_data_out;
end if;
@ -887,36 +889,37 @@ begin
widget_ic4_b <= not (FIRE_RIGHT_1 & FIRE_LEFT_1 & FIRE_DOWN_1 & FIRE_UP_1);
widget_ic4_y <= widget_ic4_b when widget_pia_input_select = '1' else widget_ic4_a;
--IN0
widget_pia_pa_in <= widget_ic4_y(2) &--fire down
widget_ic4_y(1) &--fire up
not PLAYER_2_START &
not PLAYER_1_START &
widget_ic3_y(4) &--right
widget_ic3_y(3) &--left
widget_ic3_y(2) &--down
widget_ic3_y(1) when sinistar = '0' else--up
widget_ic4_y(4) &--fire right
widget_pia_pa_in <= widget_ic4_y(4) &--fire right
widget_ic4_y(3) &--fire left
widget_ic4_y(2) &--fire down
widget_ic4_y(1) &--fire up
widget_ic3_y(4) &--right
widget_ic3_y(3) &--left
widget_ic3_y(2) &--down
widget_ic3_y(1);--up
--IN1
widget_ic3_y(1) when sinistar = '1' else --up
"00000000" when speedball = '1' else
widget_ic4_y(2) &--fire down
widget_ic4_y(1) &--fire up
not PLAYER_2_START &
not PLAYER_1_START &
widget_ic3_y(4) &--right
widget_ic3_y(3) &--left
widget_ic3_y(2) &--down
widget_ic3_y(1); --up
widget_pia_pb_in <= not board_interface_w1 &
"00000" &
widget_ic4_y(4) &--fire right
widget_ic4_y(3) when sinistar = '0' else --fire left
not board_interface_w1 &
"0" &
not PLAYER_2_START &
not PLAYER_1_START &
"00" &
not SIN_BOMB &
not SIN_FIRE;
not SIN_FIRE when sinistar = '1' else
"00000000" when speedball = '1' else
not board_interface_w1 &
"00000" &
widget_ic4_y(4) &
widget_ic4_y(3);
widget_pia: work.pia6821
port map(
@ -950,48 +953,24 @@ begin
);
-------------------------------------------------------------------
-- PORT_START("IN3")
-- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
-- PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
-- PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
-- PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
-- PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
-- PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
-- PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)
-- PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
--IN3
extra_pia_pa_in <= '0' & --unknown
FIRE_UP_2 & --fire 2
'0' & --unknown
FIRE_UP_1 & --fire 1
MOVE_DOWN_2 &--down2
MOVE_UP_2 &--up2
MOVE_DOWN_1 &--down1
MOVE_UP_1;--up1
-- PORT_START("IN4")
-- PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
-- PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
-- PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
-- PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
-- PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
-- PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
-- PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START1 )
-- PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START2 )
--IN4
extra_pia_pa_in <= '0' & --unknown
FIRE_UP_2 &
'0' & --unknown
FIRE_UP_1 &
MOVE_DOWN_2 &
MOVE_UP_2 &
MOVE_DOWN_1 &
MOVE_UP_1;
extra_pia_pb_in <= not PLAYER_2_START &
not PLAYER_1_START &
"00" &
MOVE_RIGHT_2 &
MOVE_LEFT_2 &
MOVE_RIGHT_1 &
MOVE_LEFT_1;
"00" &
MOVE_RIGHT_2 &
MOVE_LEFT_2 &
MOVE_RIGHT_1 &
MOVE_LEFT_1;
extra_pia: work.pia6821
port map(
rst => reset,

View File

@ -84,7 +84,9 @@ port (
AN0 : in std_logic_vector(7 downto 0);
AN1 : in std_logic_vector(7 downto 0);
AN2 : in std_logic_vector(7 downto 0);
AN3 : in std_logic_vector(7 downto 0);
AN3 : in std_logic_vector(7 downto 0);
-- ROM download signals
dl_clock : in std_logic;
dl_addr : in std_logic_vector(16 downto 0);
dl_data : in std_logic_vector(7 downto 0);