ScreenRes problem

Windows specific questions.
Post Reply
integer
Posts: 408
Joined: Feb 01, 2007 16:54
Location: usa

ScreenRes problem

Post by integer »

As I remember (which may be a little unreliable) a few years back ScreenRes on my Win7 sys worked ok.
However, Why this?
------------------------
Command executed:
"c:\_fbc\fbc64.exe" "C:\fbox\fbtry80.bas"

Compiler output:
C:\fbox\fbtry80.bas(346) error 72: Array not dimensioned, before '('
ScreenRes( 320, 200, 8)
^
Results:
Compilation failed
System:
FBIde: 0.4.6
fbc: FreeBASIC Compiler - Version 1.10.0 (2023-05-14), built for win64 (64bit)
OS: Windows NT 6.2 (build 9200)
====================================================================
THIS IS FROM THE HELP FILE:
' Set the screen mode to 320*200, with 8 bits per pixel
ScreenRes 320, 200, 8

my program line 346: ScreenRes( 320, 200, 8) stopped the compilation

Using Screenlist the output says I can have a screen of 2560 x 1440

Does ScreenRes require a prior statement for the compiler?
Why does the 'preview' screen show a smiley face in place of the 8 and parenthesis? '8)'
SARG
Posts: 1768
Joined: May 27, 2005 7:15
Location: FRANCE

Re: ScreenRes problem

Post by SARG »

No problem here with the line. Delete the line and rewrite it.
Try without parenthesis.

You get a smiley just because there is a space between the comma and 8 followed by a parenthesis so it's translated in that smiley.
Remove the space to get the normal text.

Other example
': - )' removing the 2 spaces ---> :-)
paul doe
Moderator
Posts: 1736
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: ScreenRes problem

Post by paul doe »

integer wrote: Aug 31, 2023 0:36 ...
Using Screenlist the output says I can have a screen of 2560 x 1440
...
But it probably doesn't say that it supports it at 320x200x8, right? You can run the code (provided in the example section of the Wiki page for ScreenList) to see the fullscreen modes available:

Code: Select all

Dim As Long mode
Dim As UInteger w, h

Print "Resolutions supported at 8 bits per pixel:"

mode = ScreenList(8)
While (mode <> 0)
    w = HiWord(mode)
    h = LoWord(mode)
    Print w & "x" & h
    mode = ScreenList()
Wend

sleep()
In my machine here the result is:

Code: Select all

Resolutions supported at 8 bits per pixel:
640x480
720x480
800x600
1024x768
1152x864
1280x720
1280x768
1280x800
1280x960
1280x1024
1360x768
1366x768
1440x900
1600x900
1600x1200
As you can see, I can't set a fullscreen, 320x200x8 mode (because the card doesn't support it). As for the code not compiling, that's probably just a typo.
integer
Posts: 408
Joined: Feb 01, 2007 16:54
Location: usa

Re: ScreenRes problem

Post by integer »

@sarg
I did not know that about the smi lies

I re-wrote the line many times, with different dims, still same result.
The problem must be somewhere in the 300+ lines before this statement.
Next try is to comment out sections to isolate the mole hill.


@paul

Screenlist had several dozen screen resolutions -- do not know if 320x200 is/is not available. The list zipped past and stopped at highest res.
Anyway, I thought that it would be a runtime error if I spec'd a non possible screen dims.

thanks @sarg & @paul
integer
Posts: 408
Joined: Feb 01, 2007 16:54
Location: usa

Re: ScreenRes problem

Post by integer »

more development from the same program but with some different flavored problems.
I commented out all of the screen stuff.

when the directive: #lang "qb" is NOT used
The program compiles and works as expected.

when the directive: #lang "qb" is used
The program compiles and runs as expected

Now, at this point, when the directive is changed to: #lang "fb"
this results:
  • Command executed:
    "C:\_fbc\fbc32.exe" "C:\nongon_fb\FBIDETEMP.bas"

    Compiler output:
    Aborting due to runtime error 4 (out of memory) at line 10 of src\compiler\list.bas()

    Results:
    Compilation failed

    System:
    FBIde: 0.4.6
    fbc: FreeBASIC Compiler - Version 1.10.0 (2023-05-14), built for win32 (32bit)
    OS: Windows NT 6.2 (build 9200)
The program is long (over 5000 lines of code), but has nothing identified as: list.bas()
From where did "list.bas()" get created?

When using fbc32.exe with the #lang "fb" the above "compilation failed" occurs.
When using fbc64.exe with the #lang "fb", the compiler stops, freezes, dies. Only a power down & reboot can be done.
Before the power shut down / restart, windows 10 displays something to this effect:
' instruction 004035CF at memory address 07365629B caused the problem

I am beginning to feel as if I am in a dark room looking for a black object that may not exist.

Why did the fbc64.exe compiler lockup (freeze) instead of aborting & spitting out 'compilation failed'??
That is bothersome.
adeyblue
Posts: 301
Joined: Nov 07, 2019 20:08

Re: ScreenRes problem

Post by adeyblue »

The program is long (over 5000 lines of code), but has nothing identified as: list.bas()
From where did "list.bas()" get created?
It didn't. it's part of the compiler's code. The message is saying which part of the compiler crashed. It tried to create a list of something, there wasn't enough memory to do so (probably because this was happening in an infinite loop and it had already allocated it all), and so it crashed,
Why did the fbc64.exe compiler lockup (freeze) instead of aborting & spitting out 'compilation failed'??
32-bit apps can allocate 2-3GB of memory before they will be out of memory. 64-bit apps can allocate several TB. That takes much longer to do.

If you make a copy of the code that causes this problem (or some shorter except that still causes the problem) and either post it here or send it in a PM to coderJeff, then it can be fixed by those who are able to. It likely can't be fixed with just the information in the post.
That is bothersome.
Yep, that's software for you. Always fails when you don't want it to.
fxm
Moderator
Posts: 12134
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: ScreenRes problem

Post by fxm »

Have you tested compiling your code with the current latest version of the compiler: 1.10.0 ?
SARG
Posts: 1768
Joined: May 27, 2005 7:15
Location: FRANCE

Re: ScreenRes problem

Post by SARG »

There are 3 functions returning this kind of message in fbc, one example :

Code: Select all

function xallocate(byval size as long) as any ptr
	dim as any ptr p = allocate(size)
	if (p = NULL) then
		fatalOutOfMemory()
	end if
	return p
end function
If the value of size is zero, depending the used library, returned value can be either null or something valid (even if not really usable).
So 2 cases to get the error message : not enough memory or a bad value for size.

On W10 allocate (0) returns a not null value. Maybe on Window NT it's different.

Anyway as adeyblue said we need your source code.
Post Reply