DOS TSR program to map Keyb to Joy (a real &useful example)

The intent of this forum is to discuss my DOS TSR programs (available at http://bretjohnson.us), how they work and don't work, new/missing features, status of updates, and anything else related to them that may need to be discussed.

DOS TSR program to map Keyb to Joy (a real &useful example)

Postby DOSlover » Sat Nov 18, 2023 4:06 am

There are a few DOS TSR programs to map a Joystick to a keyboard but not a keyboard to a joystick, this is a real example of mapping a keyboard to a joystick that will be very useful and i don't know how this can be resolved.

I am making a compilation of only MSDOS games that support 3-4 players simultanously (not in turns) ready to play when i meet friends and i have 4 USB gamepads (all are the same model).
I am building this on Batocera, so you can play the games easily selecting them from a friendly menu with the gamepad and all is ready to play.
Batocera uses Dosbox to execute the games.

But I have found a problem with a game that has 4 players support: Dynablaster (Bomberman).

The general idea for every game in my compilation is just map each player keyboard keys (in the case of Dynablaster, only 5 keys are needed for every player: up, down, left, right and fire) to every gamepad (axis/hat and button1), this works well using the mapper that Dosbox has builtin. Every game has its config file for mapping the gamepads to keyboard keys.

But here is the problem: Dynablaster don't use the keyboard for 4 players. It uses keyboard for player 1 and 2, and joystick 1 and 2 for player 3 and 4:
Player1: keyboard
Player2: keyboard
Player 3: Joystick 1
Player 4: Joystick 2

I can map player1 and player2 from my USB gamepad to a keyboard (using the mapper that Dosbox has), so the game receives keys pressings but the problem it's with player3 and player4.
The solution will be: a DOS TSR program that maps a keyboard to a joystick, and then in Dosbox mapper, map the USB gamepad to a keyboard, so the scheme will be this:
USB gamepad button1 —using Dosbox mapper—> key "Z" —TSR program key to joy —> DOS joystick button1

So, when fire button is pressed on my USB gamepad, Dosbox receives it, but produces a "Z" key press instead, then the TSR program receives the "Z" press and send it as normal DOS Joystick button1, so Dynablaster receives what it expects.

There are a few DOS TSR programs to map a Joystick to a keyboard but not a keyboard to a joystick that will resolve this case and let 4 people play with 4 USB gamepads.

Bret, do you think this can be done? This will be very useful for all games like Dynablaster that doesn't support all players on the same keyboard and mix keyboard input and joystick input.
DOSlover
 
Posts: 2
Joined: Sat Nov 18, 2023 3:54 am

Re: DOS TSR program to map Keyb to Joy (a real &useful example)

Postby Bret » Mon Nov 20, 2023 7:18 am

I wrote a program a long time ago, called KEYS2JOY, that does what you're asking. I never officially released it, never made any documentation, etc. I can send it if you're interested, including the source code (for the A86 assembler). You would need to experiment with it yourself to see what happens. I write it a LONG time ago and don't remember exactly what state I left it in.

The one thing you need to keep in mind is that, by default, it monitors the ScrollLock status, and doesn't covert keystrokes into joystick movements unless ScrollLock is on. When ScreollLock is off, the keyboard works normally.

I'd be really surprised if it works very well (if at all) in DOSBox or really any type of VM.
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM

Re: DOS TSR program to map Keyb to Joy (a real &useful example)

Postby DOSlover » Tue Nov 21, 2023 12:25 am

Oh what a good news Bret!
Yes, send me the program (compiled) and the source code please.
I know programming but only a little bit about x86 assembler and system programming (DOS services, IRQs, TSR, IBM PC architecture, etc) but i can try and test it.
I am good at testing programs in general, discover bugs, think about new great features, etc.
DOSlover
 
Posts: 2
Joined: Sat Nov 18, 2023 3:54 am

Re: DOS TSR program to map Keyb to Joy (a real &useful example)

Postby Bret » Tue Nov 21, 2023 1:00 am

Here is KEYS2JOY, both the compiled version and the source code. I've also included THRUST (no documentation), which is a joystick test program.

I did a short experiment/test in DOSBox, and KEYS2JOY does seem to work OK. But it is only able to virtualize the joystick in the BIOS and not at the hardware level because of the way DOSBox works. I don't know how your particular game tries to access the joystick (via the BIOS or via the hardware I/O port), but most games use the I/O port. If that's the case, KEYS2JOY won't help under DOSBox. But it should be possible to get it to work under a different VM that uses a real DOS (which would let you install MS EMM386 which supports I/O virtualization) instead of the virtualized EMM in DOSBox that doesn't allow I/O virtualization.
Attachments
Keys2Joy.zip
(81.1 KiB) Downloaded 140 times
Bret
 
Posts: 478
Joined: Fri Oct 10, 2008 3:43 am
Location: Rio Rancho, NM


Return to Programs

Who is online

Users browsing this forum: No registered users and 1 guest

cron