Ive been carefully trying out new CVS builds as they come out.
This:
1 NAME JOYSTICK_BUTTONS 2 ASSUME CS:CODE,DS:DATA 3 4DATA SEGMENT PUBLIC 5DATA ENDS 6 7CODE SEGMENT PUBLIC 8 9 PUBLIC JSBTNS 10 11RETAD DW ? 12 13;gets joystick vals 14 15JSBTNS PROC NEAR 16 POP BX 17 MOV RETAD,BX 18 MOV AH,84H 19 MOV DX,0000H 20 INT 15H 21 POP DI 22 POP ES 23 XOR AH,AH 24 MOV ES:WORD PTR [DI],AX 25 MOV BX,RETAD 26 JMP BX 27JSBTNS ENDP 28 29CODE ENDS 30 31 END
recognizes old analog joystick buttons just fine when using MS-DOS 6.22. But, under dosbox, under windows 2000 with a CH products USB fighterstick, it does not.
[bios]
# type -- Type of joystick to emulate: none, 2axis, 4axis,
# fcs (Thrustmaster) ,ch (CH Flightstick).
# n […] Show full quote
[bios]
# type -- Type of joystick to emulate: none, 2axis, 4axis,
# fcs (Thrustmaster) ,ch (CH Flightstick).
# none disables your joysticks and 2axis is the default.
There was a comment in the BIOS section that said something about "nothing yet".
Adding it, didn't change a thing.
BTW Just to add a little information incase someone thinks I havent tried everything, the CH fighterstick control utility comes with 3 different modes.
Off mode, Direct mode, and Mapped mode.
I have made sure I have tried all 3 modes for every test I have run. I have never once gotten dosbox to run this one game, that uses the code I displayed.
Note that its the button reader code. I have no idea if the axises are working. The game will not get past the joystick trainer since I cant click.
A little advice on CVS and new Dosbox versions, it pays to do a writeconf at times because new settings will of course not get listed in your old conf file.
1 case 0x84: /* BIOS - JOYSTICK SUPPORT (XT after 11/8/82,AT,XT286,PS) */ 2 if (reg_dx == 0x0000) { 3 // Get Joystick button status 4 if (JOYSTICK_IsEnabled(0) || JOYSTICK_IsEnabled(1)) { 5 reg_al = (JOYSTICK_GetButton(0,0)<<7)|(JOYSTICK_GetButton(0,1)<<6); 6 reg_al |= (JOYSTICK_GetButton(1,0)<<5)|(JOYSTICK_GetButton(1,1)<<4); 7 CALLBACK_SCF(false); 8 } else { 9 // dos values 10 reg_ax = 0x00f0; reg_dx = 0x0201; 11 CALLBACK_SCF(true); 12 }
This is the code we have there.
Seems to in order I would say. so are you sure you are pressing the right buttons ?
Could you perharps attach an example executable ?
I had forgoten that I had a little test utility that used that assembly code segment. It showed that the buttons were indeed being recognized.
(and just for the record I have ZERO hope of changing any of this code. If I did I would actually program a win2k version, and not try running it under dosbox.)
My utility was reporting:
Button 1 as 128 or 1000-0000 binary.
Button 2 as 64 or 0100-0000 binary.
Hate to say this but that is not the correct classical bios, bit possitions for the buttons.
The game uses the following mask to prevent other bits activating things other than button 1 or 2.
1writeln('Hold the joystick in each of the following positions and'); 2writeln('press a joystick button !!'); 3writeln; 4writeln(' TOP - LEFT'); 5 repeat 6 jsbtns(jbtns) 7 until ((jbtns & $0030) <> $0030); 8 jstick(jxpos,jypos); 9 repeat 10 jsbtns(jbtns) 11 until ((jbtns & $0030) = $0030); 12 jslft := jxpos; 13 jstop := jypos; 14writeln; 15writeln(' CENTER'); 16 repeat 17 jsbtns(jbtns) 18 until ((jbtns & $0030) <> $0030); 19 jstick(jxpos,jypos); 20 repeat 21 jsbtns(jbtns) 22 until ((jbtns & $0030) = $0030); 23 jsrit := jxpos; 24 jsbot := jypos; 25 jslft := jslft + ((jxpos - jslft) div 16); 26 jstop := jstop + ((jypos - jstop) div 16); 27writeln; 28writeln(' BOTTOM - RIGHT'); 29 repeat 30 jsbtns(jbtns) 31 until ((jbtns & $0030) <> $0030); 32 jstick(jxpos,jypos); 33 repeat 34 jsbtns(jbtns) 35 until ((jbtns & $0030) = $0030); 36 jsrit := jxpos - ((jxpos - jsrit) div 16); 37 jsbot := jypos - ((jypos - jsbot) div 16); 38writeln; 39writeln('----- JOYSTICK READY TO GO ------'); 40 (*end*) 41end;
Note the bit mask of 0011_0000 and that it happens to be reversed.
Whatever the classical bit positions are, this code does indeed work under true MS-DOS.
According to my systems programming manual, DOSBox does use the correct bits for those buttons. (I have the sneaky suspicion Qbix and Harekiet might be using the same book -- "PC Intern 4" by Michael Tischer).
Everything I can find on the net, though, says that the mask for jAb1 is 00010000, jAb2 is 00100000, jBb1 is 01000000 and jBb2 is 10000000 and that 0 values mean that the button is actually being held down. This matches what is read from the joystick port.
Whatever it may or may not be, Im just reporting what I had to do when I originally programed it back in 1993.
And, yes it still works correctly if I boot to MS-DOS. My sound card is Cmedia and they do distribute DOS drivers. Of course I have to dig out an old analog stick. But it DOES work in that environment.
And it DOES NOT work in dosbox. And the bit positions and states are obviously the reason why.
Edit: Hmmmm, I wonder if I did get it backward. If you analize my code you can see that if you hold the stick in the correct positions at just the right times it would still work. Maybe thats why the game occasionally doesnt have a good stick calabration.
However you did indeed notice that the A and B controlers are indeed backward in dosbox, right?
Actually I think Im partly wrong and partly right. I think dosbox does have the A and B buttons backward. But I think my bit state code is wrong, which would explain why my game would occasionally misbehave.
I may try and dig out that old Digital pascal compiler and see if I can fix it someday. Maybe make it check for all 4 bits.
Yeah, that's what most of the guides say. There's quite a few places, though, that indicate that the proper value is that mentioned by saur2004. Check out paragraph 4 of chapter 24 of the PC Game Adapter (PDF), old SWAG articles (9 of which deal with INT15 and they all agree).
hmm it seems we have it indeed totally wrong
A and B are switched as well the 0 and 1 (for active or unactive)
will probably switch it using a real port in. and and it with 0xf0
Here is some more technical data from two sources. The information was scanned and attached as three JPG files in the ZIP file attached to this message.
First source is the Microsoft Press "Advanced MSDOS Programming" by Ray Duncan, second edition 1988, page 567 - Int 15h, Function 84h (Read Joystick).
The second source is The IBM Technical Reference, Personal Computer AT, First Edition 1985. Document 6280070 reference S229-9611-00. Specifically, Section 5, System BIOS. Complete BIOS listing, pages 5-165 and 5-166 concerning the Int_15h, Function 84h, Read Joystick BIOS code.
Since there was only a single joystick defined in 1985, it should be fairly easy to determine which was the original "A" and the later defined "B".