English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 12 November 2019, 23:26   #61
deimos
Registered User

 
Join Date: Jul 2018
Location: Londonish / UK
Posts: 489
Quote:
Originally Posted by sparhawk View Post
Even a single key crashes. I let it run for some time without touching it, and it was stable. Now I pressed only a single key and waited and after about 10 seconds it crashes.
Could your crashes be because of the WinUAE boot rom thing Ross was talking about? There's some debug output that I think only happens if you press a key, and if that causes a crash...
deimos is offline  
Old 12 November 2019, 23:26   #62
ross
Per aspera ad astra

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 49
Posts: 2,239
Probably I need to contact Bartman to fix this stuff.

I've faced this problem and solved it:
http://eab.abime.net/showpost.php?p=1346694&postcount=7
ross is offline  
Old 12 November 2019, 23:30   #63
deimos
Registered User

 
Join Date: Jul 2018
Location: Londonish / UK
Posts: 489
Quote:
Originally Posted by ross View Post
Probably I need to contact Bartman to fix this stuff.

I've faced this problem and solved it:
http://eab.abime.net/showpost.php?p=1346694&postcount=7
Just a case of not calling the KPrintF function in final code, surely?
deimos is offline  
Old 12 November 2019, 23:36   #64
ross
Per aspera ad astra

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 49
Posts: 2,239
Quote:
Originally Posted by deimos View Post
Just a case of not calling the KPrintF function in final code, surely?
You need to try to be sure.

But I have the code that has been working for me for many minutes, I roll the airplane like a flag in the wind and it doesn't crash.
So it is likely to be so

Are there any other special calls besides KPrintF?
ross is offline  
Old 12 November 2019, 23:42   #65
sparhawk
Registered User

sparhawk's Avatar
 
Join Date: Sep 2019
Location: Essen/Germany
Age: 51
Posts: 87
It works now. I replaced the KPrintf with a simple rts to disable it, and when I run that patched binary it works for me also.

So if you disable KPrintF your program should be fine. I have the standard ROM, as I let it run in an A1000 environment in WinUAE.

You can do this simply by using
Code:
#define KPrintF(x, ...)
then you don't need to change anything.
sparhawk is offline  
Old 13 November 2019, 07:47   #66
deimos
Registered User

 
Join Date: Jul 2018
Location: Londonish / UK
Posts: 489
Quote:
Originally Posted by ross View Post
You need to try to be sure.

But I have the code that has been working for me for many minutes, I roll the airplane like a flag in the wind and it doesn't crash.
So it is likely to be so

Are there any other special calls besides KPrintF?
I don't believe so but I'll check as soon as I can. Maybe KPrintF has concurrency issues with itself and I'm calling it from an interrupt. But I'm not sure that would explain the keyboard mash issues I see on a standard speed A500. I will report back soon.
deimos is offline  
Old 13 November 2019, 09:17   #67
sparhawk
Registered User

sparhawk's Avatar
 
Join Date: Sep 2019
Location: Essen/Germany
Age: 51
Posts: 87
After disabling KPrintF I didn't see any problems with pressing multiple keys.
sparhawk is offline  
Old 13 November 2019, 09:49   #68
deimos
Registered User

 
Join Date: Jul 2018
Location: Londonish / UK
Posts: 489
Quote:
Originally Posted by sparhawk View Post
After disabling KPrintF I didn't see any problems with pressing multiple keys.
I do.

I have no calls to KPrintF left and I still have the problem.

For instance, if I press and hold cursor up and cursor left at exactly the same time, when I get to Keyboard_Interrupt_ProcessRawKeyCode I'm seeing key press keycodes for up and left repeated thousands of times - up left up left up left up left... The plane then spins and spins as those thousands of keycodes are consumed. If you let go of the keys the plane will usually eventually stop when the key release keycodes finally get read - this may take a minute.

If you don't hit the keys at exactly the same time the code seems to handle multiple key presses correctly.

Edit: Attached a version without KPrintF calls.
Attached Files
File Type: zip no-kprintf.zip (21.6 KB, 9 views)

Last edited by deimos; 13 November 2019 at 10:03.
deimos is offline  
Old 13 November 2019, 11:21   #69
sparhawk
Registered User

sparhawk's Avatar
 
Join Date: Sep 2019
Location: Essen/Germany
Age: 51
Posts: 87
This is an entirely different problem though. Can you attach the .s file as well? And if you have it, the .map as well.
sparhawk is offline  
Old 13 November 2019, 11:57   #70
ross
Per aspera ad astra

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 49
Posts: 2,239
Quote:
Originally Posted by deimos View Post
For instance, if I press and hold cursor up and cursor left at exactly the same time ...
It's what I've always tried, but I can't reproduce the problem, despite having tried and tried again.
But maybe can be that I have desynchronized fingers
ross is offline  
Old 13 November 2019, 13:56   #71
deimos
Registered User

 
Join Date: Jul 2018
Location: Londonish / UK
Posts: 489
Quote:
Originally Posted by sparhawk View Post
This is an entirely different problem though. Can you attach the .s file as well? And if you have it, the .map as well.
I'd call it a different manifestation of the same problem though - once you've got the program misbehaving it will eventually guru, or will exit to fireworks.

I've attached the complete directory after doing a clean then a build. There is an a.mingw.map file next to the a.mingw.s file, and both elf and hunk executables.
Attached Files
File Type: zip game-gcc-vasm.zip (417.7 KB, 11 views)
deimos is offline  
Old 13 November 2019, 13:58   #72
deimos
Registered User

 
Join Date: Jul 2018
Location: Londonish / UK
Posts: 489
Quote:
Originally Posted by ross View Post
It's what I've always tried, but I can't reproduce the problem, despite having tried and tried again.
But maybe can be that I have desynchronized fingers
Maybe my mechanical keyboard helps.
deimos is offline  
Old 13 November 2019, 15:42   #73
deimos
Registered User

 
Join Date: Jul 2018
Location: Londonish / UK
Posts: 489
Interesting...

I've stripped out all of the code past what's in my interrupt code. It now looks like this:

Code:
void _GameInterruptHandler_processPORTS(InterruptHandler * interruptHandler) {
    static BOOL handshaking = FALSE;

    extern volatile struct CIA * ciaa;

    UBYTE ciaicr = ciaa->ciaicr;

    if (handshaking && ciaicr & CIAICRF_TA) {
        ciaa->ciacra = 0;
        handshaking = FALSE;
    }

    if (!handshaking && ciaicr & CIAICRF_SP) {
        UBYTE ciasdr = ciaa->ciasdr;
        ciaa->ciacra = CIACRAF_SPMODE | CIACRAF_LOAD | CIACRAF_RUNMODE | CIACRAF_START;
        handshaking = TRUE;

        UBYTE rawKeyCode = ((~ciasdr & 0x01) << 7) | (~ciasdr >> 1 & 0x7F);
        // Keyboard_Interrupt_AddRawKeyCodeToBuffer(rawKeyCode);
KPrintF("rawKeyCode = %ld\n", rawKeyCode);
    }

    // int bufferEmpty = Keyboard_Interrupt_ProcessRawKeyCodeBuffer();

    // if (!bufferEmpty)
    //     ciaa->ciacra = CIACRAF_LOAD | CIACRAF_RUNMODE | CIACRAF_START;
}
and the output is as follows:

Code:
rawKeyCode = 79
rawKeyCode = 76 (very slight delay after this line)
rawKeyCode = 79
rawKeyCode = 76
rawKeyCode = 79
rawKeyCode = 76
rawKeyCode = 79
rawKeyCode = 76
rawKeyCode = 79
rawKeyCode = 76
rawKeyCode = 79
rawKeyCode = 76
... thousands of lines
rawKeyCode = 79
rawKeyCode = 76
rawKeyCode = 79
rawKeyCode = 76
rawKeyCode = 79
rawKeyCode = 76
rawKeyCode = 79
rawKeyCode = 76
rawKeyCode = 79
rawKeyCode = 76
rawKeyCode = 207
rawKeyCode = 204
What's interesting is that there is a very slight delay after the first two lines, that feels exactly like the delay before the windows key repeat kicks in. Could I have discovered a WinUAE bug that only I can reproduce because all my fingers happen to be the same length?

Edit: Yes, if I adjust the windows key repeat settings that changes how quickly the lines of output repeat. It shouldn't be like that, should it?

Edit 2: I only see the repeated lines when I press two keys at exactly the same time. If I press and hold one, then another, then release the first and then release the second, I get:

Code:
rawKeyCode = 76
rawKeyCode = 79
rawKeyCode = 204
rawKeyCode = 207

Last edited by deimos; 13 November 2019 at 16:05.
deimos is offline  
Old 13 November 2019, 16:04   #74
ross
Per aspera ad astra

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 49
Posts: 2,239
Quote:
Originally Posted by deimos View Post
.. the windows key repeat kicks in.

So if you keep pressed a key do you receive a sequence of key_press/key_release based on Windows key repeat feature?
I probably misunderstood what you mean

EDIT:
Ok, I saw your Edit 2: this is what must happen in any double keypress case!
(well, only keycode can change depending on which the 'keyboard controller' decides to send first in the case of competition)

Can you try changing your keyboard?

Last edited by ross; 13 November 2019 at 16:16.
ross is offline  
Old 13 November 2019, 16:09   #75
deimos
Registered User

 
Join Date: Jul 2018
Location: Londonish / UK
Posts: 489
Quote:
Originally Posted by ross View Post

So if you keep pressed a key do you receive a sequence of key_press/key_release based on Windows key repeat feature?
I probably misunderstood what you mean
I've edited my post, probably while you were replying, but yes: if and only if I press and hold two keys at exactly the same time, I get repeated key down keycodes that correspond to the Windows key repeat behaviour. If I go into the control panel and slow that down, the lines get repeated slower.
deimos is offline  
Old 13 November 2019, 16:16   #76
deimos
Registered User

 
Join Date: Jul 2018
Location: Londonish / UK
Posts: 489
Quote:
Originally Posted by ross View Post
Can you try changing the keyboard?
Not for a while.
deimos is offline  
Old 13 November 2019, 16:19   #77
ross
Per aspera ad astra

ross's Avatar
 
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 49
Posts: 2,239
Quote:
Originally Posted by deimos View Post
I've edited my post, probably while you were replying, but yes: if and only if I press and hold two keys at exactly the same time, I get repeated key down keycodes that correspond to the Windows key repeat behaviour. If I go into the control panel and slow that down, the lines get repeated slower.
This is a case for Toni.

It has never happened to me with any keyboard or with any version of Windows.
ross is offline  
Old 13 November 2019, 16:26   #78
sparhawk
Registered User

sparhawk's Avatar
 
Join Date: Sep 2019
Location: Essen/Germany
Age: 51
Posts: 87
Quote:
Originally Posted by deimos View Post
Could I have discovered a WinUAE bug that only I can reproduce because all my fingers happen to be the same length?

I can also reproduce it. Is WinUAE keep sending KeyDown events in this case?
sparhawk is offline  
Old 13 November 2019, 16:26   #79
deimos
Registered User

 
Join Date: Jul 2018
Location: Londonish / UK
Posts: 489
Quote:
Originally Posted by ross View Post
This is a case for Toni.

It has never happened to me with any keyboard or with any version of Windows.
Ok. In the meantime I'll try something without the KPrintFs to prove (or not) that it happens for me on my vanilla WinUAE, and if so I'll code around it while we wait for an answer - the rest of my code is probably still buggy.
deimos is offline  
Old 13 November 2019, 16:29   #80
deimos
Registered User

 
Join Date: Jul 2018
Location: Londonish / UK
Posts: 489
Quote:
Originally Posted by sparhawk View Post
I can also reproduce it. Is WinUAE keep sending KeyDown events in this case?
That's what it looks like. I'll get some new code together to try and get absolute proof in the absence of logging.
deimos is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
loadwb -debug TroyWilkins Amiga scene 22 19 March 2017 12:08
Debug log trap vriviere support.WinUAE 1 01 July 2010 15:27
Hisoft C++ Debug AlfaRomeo Coders. General 0 13 October 2008 22:17
Mame32 Debug redblade Retrogaming General Discussion 4 10 October 2005 06:43
Debug ? mtb support.WinUAE 8 19 December 2002 13:19

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 02:10.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Page generated in 0.17547 seconds with 14 queries