Page 1 of 1

Older code now crashes!

Posted: Mon 23 Jul 2018, 20:18
by hellomike

IN 2014, I contributed the following program to Rosettacode.

As you can see, a very small and simple program. Of course I tested it thoroughly.
Today, in 2018, I find that exactly the same code now crashes BB4W!

Differences 2014 vs 2018 (now): Windows 7 32bit hardware vs Windows 10 64bit hardware.

On Windows 7 32bit hardware it still works.
Both are on BB4W v6.11a.

Also I'm pretty sure that I ran the code like a week ago successfully on the same (Win10) system but in such situations one starts doubting everything :?
I hope someone sees the inconstancy or can test the program on their machine because I'm totally and utterly flabbergasted :shock:



Re: Older code now crashes!

Posted: Tue 24 Jul 2018, 12:14
Hi Mike,

Seems to work here (Win7 64 bit).

Interesting: I've never seen SYS used like that to call an assembled fragment. I like the way you can pass parameters and get a result. I guess you couldn't use USR because of the terms of the challenge?

best wishes,


Re: Older code now crashes!

Posted: Wed 25 Jul 2018, 00:09
by Zaphod
Mike, works here on Windows 10 64 bit, both in the IDE and compiled, so it is a mystery.
At times like that I usually look out the window in case there is a UFO hovering overhead. Not seen one yet though.

Re: Older code now crashes!

Posted: Wed 25 Jul 2018, 08:57
by hellomike
Thanks folks.

Yes, my Win10 has a very deeply rooted abnormality somewhere. VirtualRPC stopped working (crashes) and the Win10 1803 update just doesn't install. I would almost suspect a virus, almost.
But this is so basic.

For a while I suspected the two values on the stack because when the code returns (ret), should the stack be left clean by it?
I.e. isn't the code responsible for cleaning up its own stack section before returning? I'm not that knowledgeable with assembly code.
Of course its isn't the reason because it works everywhere.



Re: Older code now crashes!

Posted: Fri 27 Jul 2018, 09:53
by hellomike
Well, it gets even better. I simplified the code as follows:

Code: Select all

      DIM Dimmed% 15
      [OPT 3
      CALL Dimmed%

      SYS "GlobalAlloc", 0, 16 TO GAlloc%
      IF GAlloc%==0 ERROR 100,"GlobalAlloc failed"
      [OPT 3
      REMCALL GAlloc%
      SYS "GlobalFree", GAlloc%
This works but when I remove the REM, the code crashed BB4W. Even when operating in Save Mode!
Application Log simply reports "Exception code: 0xc0000005".

On a Win10 laptop, there is no problem.

It seems as if I'm not allowed to Execute code in memory allocated with GlobalAlloc. Really super awkward! For the rest this desktop is running perfectly with very complex game-applications and more. Also all my other BB4W programs run fine.

I hope Richard or someone else knowledgeable reads this and can give some kind of hint. It certainly isn't a BB4W issue so definitely off-topic but I feel I'm sooo close in tackling this.