VOGONS

Common searches


First post, by Quadko

User metadata
Rank Newbie
Rank
Newbie

Edit:
I ended up writing JoyMon, the Joystick Monitor for DOSBox in assembly to test joysticks and joystick code in DOSBox. App and source available at:
joelmcintyre.com/joymon.html

---
Original Post:
If I were to write a game for DosBox (wouldn't have to work in real Dos) to be used with modern joysticks, i.e. HOTAS or dual stick game controllers, is there a recommended way to access that inside dosbox? I'm guessing the answer is something like "turn on Thrustmaster emulation and use BIOS int call Int 15#84" or something. I'm assuming some emulation is more efficient than others? I assume cycle counting the joystick port is not the best way? Or is there a "for dosbox" joystick library out there I should just use?

This is more curiosity about future projects than actual code-in-progress work, but I was curious given the initial dreadful PC joystick implementation and a desire for a plethora of buttons and axes. (Hm, axes - axies... learn something new every day! Spelling days aren't my favorite, though.)

I know it's a trivial use of time machines, but if I had one I think I'd go back and beat some sense into the original PC designers. "They could'a been a contender" vs. nintendo, at least. CGA games are fine fun, but the joysticks just stunk. I'm still working on hacking Pango to get the joystick code to work on an XT, since mr programmer coded a fixed value greater than any of my joysticks can provide for right/down. Oops, off topic before I even press submit!
😀

Last edited by Quadko on 2014-10-09, 05:46. Edited 1 time in total.

Reply 1 of 10, by Quadko

User metadata
Rank Newbie
Rank
Newbie

Ok, I tried to track down "how to use Thrustmaster in your dos game" info, but not having luck so far. The Thrustmaster Book promised some info, but I couldn't find the links. Anyone have that info or some guidance?

I also used JoyCalib from www.oldskool.org, testing the 3 joystick input method: timer, loop counting, and bios. Unlike my real XT, bios blows all other methods away in DosBox, so I assume that's very well emulated and best choice. JoyCalib only tests the standard 2 axis 2 button dos joystick, and I only tried dosbox's default joystick setup this time, so I'm not sure how much info bios can give me - 6 axis 6 buttons w/ thrustmaster? - but so far bios looks best. Random first google hit on bios documentation says 2 axis 2 buttons for 2 joysticks, so that's probably 4 axis 4 buttons at least available, but it would be nice to know if emulation allows a mode for even more when using a modern dual stick gamepad or HOTAS setup.

Anyone else can save me time and know more about the subject?

Reply 2 of 10, by Quadko

User metadata
Rank Newbie
Rank
Newbie

I dug up my TASM install to try to write some dos joystick code, but it complained and whined about installing. I see lots of people have both complaining and whining TASM, and lots of people got it working, so I'll follow up with that.

I was looking for some dos timer code to have my "game" run at a constant speed, but I don't see anything straightforward. Does DosBOX emulate anything that would work as a trivial timer, along the lines of getTickCount or a millisecond clock? I know I can do original dos stuff like timer chip redirect or screen v-refresh waiting, but I was hoping there was something more direct, maybe in the pentium opcodes?

Reply 3 of 10, by Qbix

User metadata
Rank DOSBox Author
Rank
DOSBox Author

DOS isn't that easy 😀
You can change the timer rate and hook the timer interrupt to write a counter in a variable that you can check in your game code.

Water flows down the stream
How to ask questions the smart way!

Reply 6 of 10, by Quadko

User metadata
Rank Newbie
Rank
Newbie

I spent lots of time with XT opcodes, but graduated out of assembler before 386 even, so I have magical thinking about the wonders of the pentium opcode set. Just another learning curve to take on sometime. 😀

Timer chip trapping it'll have to be. Someday, it'd be "lovely" to have some dosbox extensions "int 200, ah=1" to enable, then some useful things from frame timers to easy png or zip file support, but since I don't want to write it and don't think it's a big deal for db.next, I'll just leave it as a wish and a dream. But I love the idea of using dosbox as the platform for portability for new games, and extensions that would help. Yes, yes, not the dosbox design goal. Back on track with the thread:

I got a version of TASM working. Dust off some memory cells, and I should be good to go with my hello joystick first attempt some evening soon. For fun I dug up the retro super-nintendo usb joystick; that'll hopefully let me dream in 16 bit. If only IBM hadn't borked their joystick so badly... sigh. Apple wasn't their competitor, Atari/Nintendo should have been.

I wonder if there is a reason to use MASM instead of TASM? I have many old copies of both, but since I always used tasm, I guess I'll stick with it until people recommend different. Assembler is very nice for tests, but I should also go for a C compiler sometime in the joystick project stack. I've got old Borland C versions I'll try, unless someone recommends something better for dos work? Heh, I started with Turbo Pascal, maybe I should try to dig that up... but that's a different project. I used to have all my pascal code, but haven't seen it in a while. Wonder if it is still floating around somewhere... Totally wanted to write a Kroz game back then, would draw screens for it in study hall, and also design elite-style space ships. Graph paper rocks. Ah well, break over, back to work!

Reply 7 of 10, by Quadko

User metadata
Rank Newbie
Rank
Newbie

Hm, this version of TASM (5) isn't quite cooperating with my old ASM files. I've got code in my head but the tools are getting in the way. 😜 Have to scrounge something up, didn't realize I was this rusty. The eternal musty code question: do I adapt old code to current assembler, or try to decipher and setup the old code's original environment? I guess the old code really doesn't matter, was just a quick-start attempt, so just have to figure out how to compile DOS com & exes with this TASM. But I think I still have that old dev box setup, if it still turns on after a cross-country move and years gathering dust... and now I'm just rambling. Cheers, all! 😀

Reply 8 of 10, by Quadko

User metadata
Rank Newbie
Rank
Newbie

I put a few cycles in and got back up to speed with TASM. I got some basic Hello World COM & EXE files created, and the skeleton of an initial joystick test. Hopefully will have that working this week, and I'll have something very basic to show off.

Reply 9 of 10, by Quadko

User metadata
Rank Newbie
Rank
Newbie

Joystick_Demo.png
Here's the demo image, and I'll get a zip package up for download soon.

This is a text mode program to show two working joystick axis and 4 buttons. Move the sticks, the knobs and axis sliders move around, and the numbers across the bottom show Joystick 1 values and which of the four buttons are pressed. I got excited when I saw the DOSBox documentation say 6 buttons, but almost missed that it's only with a 2 axis gamepad. Makes sense, but too bad! 😀 DOS's limitation, not DOSBox.

Of course, if you only have a one axis joystick/gamepad, that works just fine, too!

That pretty much does it for this project, I'm glad to get it out of my brain and TASM brain cells dusted off. 3 ways to go from here: get the timer code working for game speed control, convert this to a graphics mode, or turn it into a text game. Should be fun whatever I get around to doing. 😁

Thanks for letting me show & tell.