Jump to content
Trebor

A7800 - the Atari 7800 Emulator

Recommended Posts

Ah, now I get what you're saying... no, 32 unique inputs isn't possible with that method, since you need to stick to the original actions for the mapping. So you'd need a custom controller driver for that.

 

In your proposed controller, you'd get ghosting from simultaneous button presses. I take it that's not a problem for your planned use-case?

Share this post


Link to post
Share on other sites

No, I think you can do all of the combinations depending on how you overlap the mappings for each of the 5 inputs. I'll have to play around with it, though. I was wondering why the Atari keyboard controllers only had 12 buttons and used the paddle lines when you could have 31 possible input combinations (not counting all off as one of them) with the normal joystick inputs.

 

I'm not sure what you mean by "ghosting", and I don't know if there's a hardware reason that I'm unaware of what would explain why this wouldn't work for a real controller. Obviously though it would have to be used with something specifically written for it on the software side.

Share this post


Link to post
Share on other sites

Ghosting is the term used when simultaneous key-presses aren't registered correctly. e.g. if button 1 is pressed and activates left+up, and button 2 is simultaneously pressed and activates right+up, it will be interpreted as an entirely different button that's represented by left+up+right.

 

The atari keypads use a different scheme, with the keypad rows being detected by the joystick directions, and the columns being selected by paddle lines. This is closer to regular keyboard wiring, and less prone to ghosting.

 

faq_vcs_keyboard_schematic.thumb.jpg.1aad186b9d17ed2e2f17aa310c92346c.jpg

  • Like 2

Share this post


Link to post
Share on other sites

Okay, so I thought I'd try my hand at adding a new controller driver to a7800. I figured it could mostly be a clone of the vcs joystick driver with different defaults. I found the files in src/devices/bus/a7800_ctrl, made copies of joystick.cpp and joystick.h, edited them changing names appropriately, and added an entry to ctrl.cpp. Now, I can't figure out where the actual driver code is. grep has not been my friend. If you have a chance, could you please point me in the right direction? 🙂

Share this post


Link to post
Share on other sites

The driver is mostly in the slotted device, like the one you copied - e.g. the a7800_joy_r() routine controls what gets returned on a joystick port read, but the joystick one you picked as a basis is pretty mundane, so it's not very instructive. Have a look at a7800_joy_r() in the trackball driver, or something else that gets a bit more involved.

  • Thanks 1

Share this post


Link to post
Share on other sites

Thanks. I'm not seeing where I can define symbols needed for my new device. When I compile I get:

 

Compiling src/devices/bus/a7800_ctrl/minikeyboard.cpp...
In file included from ../../../../../src/devices/bus/a7800_ctrl/minikeyboard.cpp:10:
In file included from ../../../../../src/devices/bus/a7800_ctrl/minikeyboard.h:14:
../../../../../src/devices/bus/a7800_ctrl/ctrl.h:127:1: warning: 'const' qualifier on reference type 'device_type' (aka 'const emu::detail::device_type_impl &') has no effect [-Wignored-qualifiers]
DECLARE_DEVICE_TYPE(A7800_CONTROL_PORT, a7800_control_port_device)
^
/Users/kdgarris/Downloads/a7800-4.0/build/projects/sdl/mame/gmake-osx/../../../../../src/emu/device.h:236:22: note: expanded from macro 'DECLARE_DEVICE_TYPE'
                extern device_type const Type; \
                                   ^
In file included from ../../../../../src/devices/bus/a7800_ctrl/minikeyboard.cpp:10:
../../../../../src/devices/bus/a7800_ctrl/minikeyboard.h:47:1: warning: 'const' qualifier on reference type 'device_type' (aka 'const emu::detail::device_type_impl &') has no effect [-Wignored-qualifiers]
DECLARE_DEVICE_TYPE(A7800_MINIKEYBOARD, a7800_minikeyboard_device)
^
/Users/kdgarris/Downloads/a7800-4.0/build/projects/sdl/mame/gmake-osx/../../../../../src/emu/device.h:236:22: note: expanded from macro 'DECLARE_DEVICE_TYPE'
                extern device_type const Type; \
                                   ^
../../../../../src/devices/bus/a7800_ctrl/minikeyboard.cpp:18:1: warning: 'const' qualifier on reference type 'device_type' (aka 'const emu::detail::device_type_impl &') has no effect [-Wignored-qualifiers]
DEFINE_DEVICE_TYPE(A7800_MINIKEYBOARD, a7800_minikeyboard_device, "a7800_minikeyboard", "mini keyboard controller")
^
/Users/kdgarris/Downloads/a7800-4.0/build/projects/sdl/mame/gmake-osx/../../../../../src/emu/device.h:251:15: note: expanded from macro 'DEFINE_DEVICE_TYPE'
                device_type const Type = device_creator<Class, (Class##_device_traits::shortname), (Class##_device_traits::fullname), (Class##_device_traits::source)>; \
                            ^
../../../../../src/devices/bus/a7800_ctrl/minikeyboard.cpp:39:9: error: use of undeclared identifier 'construct_ioport_a7800_minikeyboard'; did you mean 'construct_ioport_a7800_joystick'?
        return INPUT_PORTS_NAME( a7800_minikeyboard );
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
               construct_ioport_a7800_joystick
/Users/kdgarris/Downloads/a7800-4.0/build/projects/sdl/mame/gmake-osx/../../../../../src/emu/ioport.h:1582:33: note: expanded from macro 'INPUT_PORTS_NAME'
#define INPUT_PORTS_NAME(_name) construct_ioport_##_name
                                ^
<scratch space>:13:1: note: expanded from here
construct_ioport_a7800_minikeyboard
^
../../../../../src/devices/bus/a7800_ctrl/minikeyboard.cpp:21:8: note: 'construct_ioport_a7800_joystick' declared here
static INPUT_PORTS_START( a7800_joystick )
       ^
/Users/kdgarris/Downloads/a7800-4.0/build/projects/sdl/mame/gmake-osx/../../../../../src/emu/ioport.h:1586:16: note: expanded from macro 'INPUT_PORTS_START'
ATTR_COLD void INPUT_PORTS_NAME(_name)(device_t &owner, ioport_list &portlist, std::string &errorbuf) \
               ^
/Users/kdgarris/Downloads/a7800-4.0/build/projects/sdl/mame/gmake-osx/../../../../../src/emu/ioport.h:1582:33: note: expanded from macro 'INPUT_PORTS_NAME'
#define INPUT_PORTS_NAME(_name) construct_ioport_##_name
                                ^
<scratch space>:12:1: note: expanded from here
construct_ioport_a7800_joystick
^
3 warnings and 1 error generated.
make[2]: *** [../../../../osx_clang/obj/x64/Release/src/devices/bus/a7800_ctrl/minikeyboard.o] Error 1
make[1]: *** [optional] Error 2
make: *** [macosx_x64] Error 2

minikeyboard.cpp

minikeyboard.h

ctrl.cpp

Share this post


Link to post
Share on other sites

Try changing this...

static INPUT_PORTS_START( a7800_joystick )

...to this...

static INPUT_PORTS_START( a7800_minikeyboard )

 

  • Thanks 1

Share this post


Link to post
Share on other sites
10 hours ago, RevEng said:

Try changing this...

static INPUT_PORTS_START( a7800_joystick )

...to this...

static INPUT_PORTS_START( a7800_minikeyboard )

 

D'oh! I missed that. Thanks again!

  • Like 1

Share this post


Link to post
Share on other sites

Edit: Nevermind. I needed to set the "set softresetpause off" option in 7800basic to avoid this.

 

Okay, so in the process of developing my MAME driver for the not-yet-existent minikeyboard controller, I believe I have discovered a bug or limitation in the emulator. While my driver exposes it, I have also reproduced it with the trakball driver. The tiny test program which is attached demonstrates it.

 

What happens is when a7800 registers joystick right, joystick left, and joystick down input all at the same time, it also triggers the reset switch. This is normally impossible with a joystick controller, of course, but the trackball driver can register these inputs all at once.

 

The attached demo program simply changes the background color every frame where it detects the reset button is pressed. To test it, load it in a7800, hit tab, go to Controller Selection, and choose cx22 trakball as the controller for the first port, then reset the emulator to have the setting take effect. If reset is never detected, the background should remain white. If it is detected, the background colors should change as you move your mouse.

 

Could anyone test this to confirm this issue for me? Thanks in advance.  🙂 

 

ControllerReset.78b

ControllerReset.78b.a78

Share this post


Link to post
Share on other sites

Pretty sure you're triggering the 7800basic soft-reset/pause code. 7800basic implements these via impossible joystick directions. This code is disabled compile-time if the game uses a 7800basic controller driver that can generate these directions.

 

It looks like I need to update the manual with this. (I've posted about it a few times in the forums, including the 7800basic thread.)

Share this post


Link to post
Share on other sites
2 minutes ago, RevEng said:

Pretty sure you're triggering the 7800basic soft-reset/pause code. 7800basic implements these via impossible joystick directions. This code is disabled compile-time if the game uses a 7800basic controller driver that can generate these directions.

 

It looks like I need to update the manual with this. (I've posted about it a few times in the forums, including the 7800basic thread.)

Well, that's certainly a relief. Although my sample did set the port to use the trakball to help rule out unrelated issues, so presumably the code should have been disabled in this case?

 

Anyway, if I know it's likely 7800basic that is causing this behavior, I can look at the code there (since it's much less of a headache than MAME source code).  :D  Thanks once again!

Share this post


Link to post
Share on other sites

You're welcome. Not sure why it wasn't disabled... I see the conditions in there.

 

If you're looking to disable this functionality, check std_routines.asm and just search for "soft".

  • Thanks 1

Share this post


Link to post
Share on other sites
16 minutes ago, RevEng said:

Yeah, not sure why it wasn't disabled... I see the conditions in there.

 

If you're looking to disable this, check std_routines.asm and just search for "soft".

It looks like you have an option for it already. I tried it, and it works for me:

 

   set softresetpause off

 

  • Like 1

Share this post


Link to post
Share on other sites

I spoke too soon. Some of the soft switch code in there checked for trakball, mouse, or the softresetpause option, but other parts only checked for mouse support to disable it. Here's a patch (diff -buN) that adds those checks for the other parts as well, if you would like it.

 

 

soft-switch-fix.patch

  • Like 1

Share this post


Link to post
Share on other sites
4 hours ago, Karl G said:

I spoke too soon. Some of the soft switch code in there checked for trakball, mouse, or the softresetpause option, but other parts only checked for mouse support to disable it. Here's a patch (diff -buN) that adds those checks for the other parts as well, if you would like it.

soft-switch-fix.patch 1014 B · 1 download

Yeah, that 7800basic option was just to disable the soft-reset acting as a pause, when pause isn't disabled. It sounds complicated, but basically it means the soft-reset button can start a game (reset when pausing is disabled, as it should be during a title screen), and then act as a pause during a game when pause isn't disabled.

 

I don't actually have a full disable for the soft-switches yet (aside from compiling in a mouse or trackball) but I'll add one in before the next release.

  • Like 1

Share this post


Link to post
Share on other sites

Is there a way to change default emulator keybindings that aren't directly related to the 7800? For example, the "P" key pauses emulation (unrelated to the 7800 pause button, to be clear). Googling for MAME seems to indicate that it should be changeable via the GUI, but I don't see a way in a7800 to do that?

 

I was able to change it via source, but if there's a cleaner way I'd rather do that.

Share this post


Link to post
Share on other sites

Yeah, I don't see a way to do it... I suspect when you compile in only a specific mame driver, as we have for a7800, the UI gets limited to the scope of the driver only. A bit weird, but perhaps there are deeper code reasons.

 

I'm not familiar with the Mame UI code and how I might undo that, so I don't think this will get addressed any time soon.

  • Thanks 1

Share this post


Link to post
Share on other sites

Thanks. Okay; I'm at peace with a source code change to do it so long as I know it's a necessary kludge, and not a matter of me being dumb about it.  :D

  • Like 1

Share this post


Link to post
Share on other sites

You might be able to re-assign the key using the normal mame interface ( download regular mame ) and then use the resulting .cnf file or whatever it is called with A7800.  Plus it might save the trouble of irritating a bunch of people who may not mind having 'p' as pause.

 

Edited by Shannon
  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...