Recent Posts

Pages: 1 2 [3] 4 5 ... 10
21
Programming / Re: getting a single keypress?
« Last post by Rich Walsh on May 21, 2022, 06:44:21 pm »
Dave, I saw your post a few days ago but was unable to respond until now. I'm glad you recognized that using select() to get a keystroke on OS/2 is just a crazy-bad idea. And, since this will never be ported back to *nix, the use of KbdCharIn() may be the simplest possible to way avoid using 'stdin' (a method I would never have thought of!).

The good news is that it allows you discard just about every other line of code in your test program. There's no need to open anything - notice that it doesn't require a file descriptor. Unless termio is required elsewhere in the app, it's totally unnecessary as well. The only question I have is whether keyboard input occurs on the same thread as 'mpg123's decode/play code. If they're on separate threads, there's no need for a pointless polling loop - just let it block until a keystroke comes in, no DosSleep() needed. The final version of 'test.exe' should require no more than 8-10 lines of actual code, mostly just to display the keystroke on the console.
22
Programming / Re: getting a single keypress?
« Last post by Dave Yeo on May 21, 2022, 05:32:15 pm »
It didn't seem to work while a program was running.
23
Games / Re: DOS VDM - USB and Game port Gamepad support
« Last post by Jochen Schäfer on May 21, 2022, 11:00:18 am »
Hallo Jochen,
What would be the correct algorithm? Since we have the code, we could fix that. Most likely the code in SDL2 is also wrong, because it is a straight port of the SDL1 code.
I think that my proposed algorithm is the correct algorithm. See my original post.

First the calculation of the offset, scale1 and scale2:
Code: [Select]
offset = axis_center
scale1 = SDL_JOYSTICK_AXIS_MIN / (axis_lower - axis_center)
scale2 = SDL_JOYSTICK_AXIS_MAX / (axis_upper - axis_center)

Followed by the recalculation for all axes:
Code: [Select]
if (axis < axis_center)
then axis = (axis - offset) * scale1
else axis = (axis - offset) * scale2

This has of course to be substituted in SDL_os2joystick.c at the right places. Too difficult for me to do.

Cheers,
Wim.
Hi Wim.

I don't know when I can get to it, but I will look into it.
24
Games / Re: DOS VDM - USB and Game port Gamepad support
« Last post by Lars on May 21, 2022, 09:32:43 am »
I'm actually running tests on a tower, with an AMD hexcore processor and 3 Gb of usable memory installed (actually 8 GB in the system, but ArcaOS is not seeing the rest). Occasionally after installing the gamepad package previous to 2022-05-17 and with the current one, I've gotten a black screen trap, attempting to start a game with one of the xevents packages active.

I've attached a photo of the trap screen, if it is of any help - I have not determined a particular reason why it happens at the moment as I've only seen it four times and Best!

M

It`s a trap 3 which means it is a hard coded int3 breakpoint, put there deliberately by the programmer. The reason it fires is that something is calling/jumping to address 1000:0, that is, a ZERO offset. Since this is not expected and likely is a programmer error in that somebody tries to do an indirect near call/jump with a near NULL pointer, that is caught by this breakpoint.
Note that the trap address is 1000:0001 because for an int3 the trap screen will show the address of the instruction following the int3 and the int3 instruction is 1 byte long.

In order to analyze that, you´d need a trap dump in order to find out what code tried to call/jump to 1000:0 (or rather do an indirect near call/jump with a near NULL pointer).

Thinking about it: selector 1000 points to the DOSCODE segment that contains many low level kernel routines. And the DevHelp Routine is located in that segment (and all the subroutines it calls). The DevHelp Routine in turn is the main entry point for any device driver services and therefore used by about any device driver and a pointer to the DevHelp Routine is passed to each device driver on driver load. If that pointer is not properly saved or subsequently accidentally overwritten then you might see that trap.

So if it`s about a driver, Wim should check that the saved DevHelp pointer was not accidentally overwritten (the offset part of it) by a NULL value.

25
Programming / Re: getting a single keypress?
« Last post by Lars on May 21, 2022, 07:26:45 am »
And why can't you use the standard RTL function "getchar"? Is that not available?
26
Games / Re: DOS VDM - USB and Game port Gamepad support
« Last post by Mark Szkolnicki on May 21, 2022, 04:26:01 am »

I'm actually running tests on a tower, with an AMD hexcore processor and 3 Gb of usable memory installed (actually 8 GB in the system, but ArcaOS is not seeing the rest). Occasionally after installing the gamepad package previous to 2022-05-17 and with the current one, I've gotten a black screen trap, attempting to start a game with one of the xevents packages active.

I've attached a photo of the trap screen, if it is of any help - I have not determined a particular reason why it happens at the moment as I've only seen it four times and Best!


Hi Mark, that is a weird trap as it is a breakpoint, probably code that should never be reached and perhaps worth opening an issue with Arca Noae, especially if you could get a system dump of it. Unluckily if it is only occasionally trapping, it'll be hard to get a good dump as rally you should lower your memory, 3GB dump is big.

Heh Dave!

As I have not seen a lot of it, other than in this thread, I think I would give it a miss - if I can find a reason for it that would affect everyone I certainly would report it, if it is the system and not what we are testing - I think I would like to know why first and a fine weekend, as always!

M
27
Programming / Re: getting a single keypress?
« Last post by Dave Yeo on May 21, 2022, 03:45:54 am »
Yea, I'm not a C coder either. This is the code we ended up with, modded to also show the hex value,
Code: [Select]
#define INCL_KBD
#define INCL_DOSPROCESS
#include <os2.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/select.h>
#include <unistd.h>
#include <termios.h>

int term_fd = -1;

int get_key(int do_delay, char *val)
{
KBDKEYINFO key;
key.chChar = 0;
key.chScan = 0;
// optionally: sleep for a tiny bit
        DosSleep(5);
if(!KbdCharIn(&key,IO_NOWAIT,0) && key.chChar)
{
*val = key.chChar;
return 1;
}
return 0;
}


int main(int argc, char **argv)
{
if(argc >= 2)
term_fd = open("CON:", O_RDONLY);
else
term_fd = STDIN_FILENO;
if(term_fd < 0)
{
perror("failure opening terminal input");
return 1;
}
fprintf(stderr, "terminal fd: %d\n", term_fd);

struct termios old_tio;
int termsetup = 0;
if(!tcgetattr(term_fd, &old_tio))
{
fprintf(stderr, "proper terminal setup\n");
struct termios tio = old_tio;
tio.c_lflag &= ~(ICANON|ECHO);
tio.c_cc[VMIN] = 1;
tio.c_cc[VTIME] = 0;
tcsetattr(term_fd,TCSANOW,&tio);
termsetup = 1;
}

char val = 0;
while(val != 'q')
{
if(get_key(1, &val))
fprintf(stderr, "got key: %c %x\n", val, val);
}

if(termsetup)
tcsetattr(term_fd,TCSAFLUSH,&old_tio);
if(term_fd > 0)
close(term_fd);
return 0;
}
Only problem is that it gets a scan code first, which is ignored. Executable attached.
[/code]
28
Programming / Re: getting a single keypress?
« Last post by Pete on May 21, 2022, 02:11:45 am »
Hi Dave

Not really a "c" coder myself but this does not look right

int get_key(int do_delay, char *val)
{
.
.
.
   int n = select(term_fd+1,&r,NULL,NULL,&t);
   if(n > 0 && FD_ISSET(term_fd,&r) && read(term_fd,val,1) == 1)
      return 1;
   return 0;
}


I would expect an If/Else statement:-

   if(n > 0 && FD_ISSET(term_fd,&r) && read(term_fd,val,1) == 1)
      return 1
           else
           return 0;
}


As I said I am not a "c" coder...


Regards

Pete


29
Games / Re: DOS VDM - USB and Game port Gamepad support
« Last post by Dave Yeo on May 21, 2022, 12:57:02 am »

I'm actually running tests on a tower, with an AMD hexcore processor and 3 Gb of usable memory installed (actually 8 GB in the system, but ArcaOS is not seeing the rest). Occasionally after installing the gamepad package previous to 2022-05-17 and with the current one, I've gotten a black screen trap, attempting to start a game with one of the xevents packages active.

I've attached a photo of the trap screen, if it is of any help - I have not determined a particular reason why it happens at the moment as I've only seen it four times and Best!


Hi Mark, that is a weird trap as it is a breakpoint, probably code that should never be reached and perhaps worth opening an issue with Arca Noae, especially if you could get a system dump of it. Unluckily if it is only occasionally trapping, it'll be hard to get a good dump as rally you should lower your memory, 3GB dump is big.
30
Games / Re: DOS VDM - USB and Game port Gamepad support
« Last post by Mark Szkolnicki on May 20, 2022, 11:11:07 pm »
Hi Wim!

Have guests tonight, but just finished cooking the menu with 3 hours to spare, so did get a chance to test both joysticks here under TMScope, both DOS VDM and DOSBOX, using the RAW_DATA provided:

I tested each three times, doing Recal TMS each time between each test and got the following RAW_DATA, DOS VDM TMScope vs TMScope under DOSBOX:

Mk2 Thrustmaster (using xevents, last edit)

                            DOS VDM                                  DOSBOX

               Min         Centre        Max           Min         Centre        Max

X1             4              75           146             5              92            205
                 4              76           146             6              92            207   
                 4              77           146             6              92            207
Y1             5              87           145             6             103          182
                 4              87           143             6              97           182
                 6              90           143             6             100          182

Moving the Joystick to the south (Y1) in the DOS VDM, it would only go 4 notches of 7 in that direction with the output above - this has been the same since we started testing using this program - EDIT: just did this test under DOSBOX - went five notches south of 7. Otherwise full travel in the other directions.

T. Flight (using xeventsf1d)

                          DOS VDM                                    DOSBOX

               Min         Centre        Max           Min         Centre        Max

X1           1              129           256             5             123           234
               1              129           256             6             123           234
               1              131           256             6             124           234

Y1           1              129          256             6              124           233
               1              129          256             6              124           234
               1              129          256             6              124           234

In the case of the DOSBOX TMScope X1 showed the data above moving 6 notches of 7 east. Y1 showed the data above moving 6 notches of 7 south. Otherwise full travel on the display in the other directions.

All done under the latest gamepad. Don't know if that provides anything useful but thought I'd add it to the mix and Best!

M
Pages: 1 2 [3] 4 5 ... 10