Skip to content

Commit c53b36b

Browse files
committed
-bus/a2bus: Added SNES MAX game controller interface card.
-docs: Clarified description of EMULATOR make option.
1 parent 8f99c62 commit c53b36b

File tree

5 files changed

+126
-2
lines changed

5 files changed

+126
-2
lines changed

Diff for: docs/source/initialsetup/compilingmame.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -560,8 +560,9 @@ TOOLS
560560
Set to **1** to build additional tools along with the emulator, including
561561
**unidasm**, **chdman**, **romcmp**, and **srcclean**.
562562
EMULATOR
563-
Set to **0** along with **TOOLS=1** to build *only* the tools and not the
564-
main MAME emulator itself.
563+
When set to **0**, the main emulator target will not be created. This is
564+
intended to be used in conjunction with setting **TOOLS** to **1** to build
565+
the additional tools without building the emulator.
565566
NO_OPENGL
566567
Set to **1** to disable building the OpenGL video output module.
567568
NO_USE_PORTAUDIO

Diff for: scripts/src/bus.lua

+2
Original file line numberDiff line numberDiff line change
@@ -2992,6 +2992,8 @@ if (BUSES["A2BUS"]~=null) then
29922992
MAME_DIR .. "src/devices/bus/a2bus/romcard.h",
29932993
MAME_DIR .. "src/devices/bus/a2bus/sider.cpp",
29942994
MAME_DIR .. "src/devices/bus/a2bus/sider.h",
2995+
MAME_DIR .. "src/devices/bus/a2bus/snesmax.cpp",
2996+
MAME_DIR .. "src/devices/bus/a2bus/snesmax.h",
29952997
MAME_DIR .. "src/devices/bus/a2bus/softcard3.cpp",
29962998
MAME_DIR .. "src/devices/bus/a2bus/softcard3.h",
29972999
MAME_DIR .. "src/devices/bus/a2bus/ssbapple.cpp",

Diff for: src/devices/bus/a2bus/cards.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
#include "ramcard16k.h"
6363
#include "romcard.h"
6464
#include "sider.h"
65+
#include "snesmax.h"
6566
#include "softcard3.h"
6667
#include "ssbapple.h"
6768
#include "ssprite.h"
@@ -136,6 +137,7 @@ void apple2_cards(device_slot_interface &device)
136137
device.option_add("ssprite", A2BUS_SSPRITE); // Synetix SuperSprite Board
137138
device.option_add("ssbapple", A2BUS_SSBAPPLE); // SSB Apple speech board
138139
device.option_add("4play", A2BUS_4PLAY); // 4Play Joystick Card (Rev. B)
140+
device.option_add("snesmax", A2BUS_SNES_MAX); // SNES MAX controller adapter
139141
device.option_add("ceyes2", A2BUS_COMPUTEREYES2); // ComputerEyes/2 Video Digitizer
140142
device.option_add("twarp", A2BUS_TRANSWARP); // AE TransWarp accelerator
141143
device.option_add("applesurance", A2BUS_APPLESURANCE); // Applesurance Diagnostic Controller
@@ -212,6 +214,7 @@ void apple2e_cards(device_slot_interface &device)
212214
device.option_add("twarp", A2BUS_TRANSWARP); // AE TransWarp accelerator
213215
device.option_add("vulcan", A2BUS_VULCANIIE); // Applied Engineering Vulcan IDE drive
214216
device.option_add("4play", A2BUS_4PLAY); // 4Play Joystick Card (Rev. B)
217+
device.option_add("snesmax", A2BUS_SNES_MAX); // SNES MAX controller adapter
215218
device.option_add("ceyes2", A2BUS_COMPUTEREYES2); // ComputerEyes/2 Video Digitizer
216219
device.option_add("applesurance", A2BUS_APPLESURANCE); // Applesurance Diagnostic Controller
217220
device.option_add("byte8251", A2BUS_BYTE8251); // BYTE Magazine 8251 serial card
@@ -286,6 +289,7 @@ void apple2gs_cards(device_slot_interface &device)
286289
device.option_add("vulcan", A2BUS_VULCAN); // Applied Engineering Vulcan IDE drive
287290
device.option_add("vulcangold", A2BUS_VULCANGOLD); // Applied Engineering Vulcan Gold IDE drive
288291
device.option_add("4play", A2BUS_4PLAY); // 4Play Joystick Card (Rev. B)
292+
device.option_add("snesmax", A2BUS_SNES_MAX); // SNES MAX controller adapter
289293
// device.option_add("magicmusician", A2BUS_MAGICMUSICIAN); // Magic Musician Card
290294
// device.option_add("pcxport", A2BUS_PCXPORTER); // Applied Engineering PC Transporter
291295
device.option_add("byte8251", A2BUS_BYTE8251); // BYTE Magazine 8251 serial card

Diff for: src/devices/bus/a2bus/snesmax.cpp

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
// license:BSD-3-Clause
2+
// copyright-holders:Vas Crabb
3+
#include "emu.h"
4+
#include "snesmax.h"
5+
6+
#include "bus/snes_ctrl/ctrl.h"
7+
8+
namespace {
9+
10+
class a2bus_snes_max_device : public device_t, public device_a2bus_card_interface
11+
{
12+
public:
13+
a2bus_snes_max_device(
14+
machine_config const &mconfig,
15+
char const *tag,
16+
device_t *owner,
17+
u32 clock) :
18+
device_t(mconfig, A2BUS_SNES_MAX, tag, owner, clock),
19+
device_a2bus_card_interface(mconfig, *this),
20+
m_controllers(*this, "%u", 1U),
21+
m_latch_timer(nullptr),
22+
m_data(0xff)
23+
{
24+
}
25+
26+
virtual u8 read_c0nx(u8 offset) override
27+
{
28+
return m_data;
29+
}
30+
31+
virtual void write_c0nx(u8 offset, u8 data) override
32+
{
33+
if (BIT(offset, 0))
34+
{
35+
m_data =
36+
(m_controllers[0]->read_pin4() ? 0x00 : 0x80) |
37+
(m_controllers[1]->read_pin4() ? 0x00 : 0x40) |
38+
0x3f;
39+
}
40+
else
41+
{
42+
machine().scheduler().synchronize(timer_expired_delegate(FUNC(a2bus_snes_max_device::set_latch), this), 0);
43+
}
44+
}
45+
46+
virtual bool take_c800() override
47+
{
48+
return false;
49+
}
50+
51+
protected:
52+
virtual void device_add_mconfig(machine_config &config) override ATTR_COLD
53+
{
54+
SNES_CONTROL_PORT(config, m_controllers[0], snes_control_port_devices, "joypad");
55+
SNES_CONTROL_PORT(config, m_controllers[1], snes_control_port_devices, "joypad");
56+
}
57+
58+
virtual void device_start() override ATTR_COLD
59+
{
60+
m_latch_timer = timer_alloc(FUNC(a2bus_snes_max_device::reset_latch), this);
61+
62+
m_data = 0xff;
63+
64+
save_item(NAME(m_data));
65+
66+
m_controllers[0]->write_strobe(0);
67+
m_controllers[1]->write_strobe(0);
68+
}
69+
70+
private:
71+
TIMER_CALLBACK_MEMBER(set_latch)
72+
{
73+
m_controllers[0]->write_strobe(1);
74+
m_controllers[1]->write_strobe(1);
75+
m_latch_timer->adjust(attotime::from_ticks(7, clock()));
76+
}
77+
78+
TIMER_CALLBACK_MEMBER(reset_latch)
79+
{
80+
m_controllers[0]->write_strobe(0);
81+
m_controllers[1]->write_strobe(0);
82+
83+
m_data =
84+
(m_controllers[0]->read_pin4() ? 0x00 : 0x80) |
85+
(m_controllers[1]->read_pin4() ? 0x00 : 0x40) |
86+
0x3f;
87+
}
88+
89+
required_device_array<snes_control_port_device, 2> m_controllers;
90+
emu_timer *m_latch_timer;
91+
u8 m_data;
92+
};
93+
94+
} // anonymous namespace
95+
96+
97+
DEFINE_DEVICE_TYPE_PRIVATE(A2BUS_SNES_MAX, device_a2bus_card_interface, a2bus_snes_max_device, "a2snesmax", "SNES MAX Game Controller Interface")

Diff for: src/devices/bus/a2bus/snesmax.h

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// license:BSD-3-Clause
2+
// copyright-holders:Vas Crabb
3+
/***********************************************************************
4+
5+
Orange Micro Grappler/Grappler+ Printer Interface
6+
7+
https://lukazi.blogspot.com/2021/06/game-controller-snes-max-snes.html
8+
9+
***********************************************************************/
10+
#ifndef MAME_BUS_A2BUS_SNESMAX_H
11+
#define MAME_BUS_A2BUS_SNESMAX_H
12+
13+
#pragma once
14+
15+
#include "a2bus.h"
16+
17+
18+
DECLARE_DEVICE_TYPE(A2BUS_SNES_MAX, device_a2bus_card_interface)
19+
20+
#endif // MAME_BUS_A2BUS_SNESMAX_H

0 commit comments

Comments
 (0)