[fixed in svn] bug: screen paging in lang -qb mode

General FreeBASIC programming questions.
Post Reply
agamemnus
Posts: 1842
Joined: Jun 02, 2005 4:48

[fixed in svn] bug: screen paging in lang -qb mode

Post by agamemnus »

Code: Select all

SCREEN 7, , 0, 1
line (0,0)-(319,199), 15, bf
PCOPY 0, 1
line (0,0)-(319,199), 0, bf
sleep
The screen should be white, but it is black. (in -lang qb)

Edit: Apparently Mr. counting pine fixed it two months ago in the .22 svn. Thanks, counting pine...
Last edited by agamemnus on Feb 12, 2011 20:17, edited 2 times in total.
badidea
Posts: 2591
Joined: May 24, 2007 22:10
Location: The Netherlands

Post by badidea »

removed
Last edited by badidea on Feb 12, 2011 14:36, edited 1 time in total.
Prime Productions
Posts: 147
Joined: May 24, 2009 23:13
Location: Texas, United States, Planet Earth
Contact:

Post by Prime Productions »

@agamemnus:

Actually, the problem isn't really a 'bug' in the strictest sense, mostly a difference in the way FB does screens.

In QBASIC, this is what SCREEN did:

SCREEN [mode] [colorswitch] [activepage] [visualpage]

FB does the following:

SCREEN [mode] [bit depth] [numpages] [flags]

Notice the difference in that in FB you specify the number of buffer pages and in QB you are specifying the page to draw to.

So in QB:

Code: Select all

SCREEN 7, 0, 1, 0
LINE (0, 0)-(319, 199), 15, BF
PCOPY  1, 0
LINE (0, 0)-(319, 199), 0, BF
SLEEP
That does what you are saying. The thing with FB is that the way to do that you use SCREENSET 1, 0 to do the same as what QB SCREEN did.

So in FB:

Code: Select all

SCREEN 7, 0, 2 'remember we are setting the amount of pages, NOT the active page
SCREENSET 1, 0 'this is the equavilent of the latter part of QB Screen args
LINE (0,0)-(319,199), 15,  BF
PCOPY 1, 0
LINE (0,0)-(319,199), 0, BF
SLEEP
So in answer to your question, it's not exactly a bug, but a difference. So maybe the wiki should be updated to specify this as a difference.

-David
agamemnus
Posts: 1842
Joined: Jun 02, 2005 4:48

Post by agamemnus »

LANG QB mode, lol. I put it in the title... :P
It doesn't work in -lang qb mode.

Edit: I missed a comma. It should be "SCREEN 7, , 0, 1" I believe... doesn't work either way.
Prime Productions
Posts: 147
Joined: May 24, 2009 23:13
Location: Texas, United States, Planet Earth
Contact:

Post by Prime Productions »

agamemnus wrote:LANG QB mode, lol. I put it in the title... :P
It doesn't work in -lang qb mode.

Edit: I missed a comma. It should be "SCREEN 7, , 0, 1" I believe... doesn't work either way.
lol, I know what you meant, but my difference stands. The reason is that the way FB handles screens does not change even if you use -lang qb. And yes, the way QB handles screens would need an extra comma, as I
mentioned in my previous post.

The -lang qb just allows you to not have to dimension variables and things like that. But it dosn't actually change the order of arguments in a command.

-David
Prime Productions
Posts: 147
Joined: May 24, 2009 23:13
Location: Texas, United States, Planet Earth
Contact:

Post by Prime Productions »

Wait a minute, maybe you do have something.

I just figured out that if I was right about FB not changing it's argument structure, than the program should fullscreen:

SCREEN 7, 0, 0, 1

The 1 would be telling the program to fullscreen, which it does not, meaning that the structure is different in -lang qb mode.

If that is so than maybe you are right.

-David
fxm
Moderator
Posts: 12110
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Post by fxm »

Prime Productions wrote:Wait a minute, maybe you do have something.

I just figured out that if I was right about FB not changing it's argument structure, than the program should fullscreen:

SCREEN 7, 0, 0, 1

The 1 would be telling the program to fullscreen, which it does not, meaning that the structure is different in -lang qb mode.

If that is so than maybe you are right.

-David
The FreeBASIC documentation details the structure of the instruction "Screen (graphics)" and the differences depending on dialect :
http://www.freebasic.net/wiki/wikka.php ... engraphics
See more precisely the paragraph "Dialect Differences".

Try :
#LANG "qb"
__SCREEN 7, 0, 0, 1
agamemnus
Posts: 1842
Joined: Jun 02, 2005 4:48

Post by agamemnus »

EDIT: Looks like this was fixed in the SVN.

fxm: __SCREEN does the same as SCREEN, except it apparently goes into fullscreen mode.

As you said, Prime, In "SCREEN", the colorswitch% parameter (second parameter) has nothing to do with full-screen in "-lang qb".


The wiki page says:
# In the -lang qb dialect, the usage is:
Screen [mode] [,[active_page][,[visible_page]]]
I'm not sure if that correctly reflects the compiler, though.. it needs another parameter: the colorswitch%. And, the main part is that it doesn't work correctly anyways! (The screen needs to be white, not black.)

In QBASIC, the actual usage is: (straight from the manual):

Code: Select all

Screen [mode%] [,[colorswitch%] [,[activepage%][,[visiblepage%]]]
That means: "SCREEN 7, , 0, 1" in "-lang qb".

I think it might be a simple problem of only one video page being allocated when "screen" is used in lang qb.
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Post by counting_pine »

Funny how this was spotted by both of us within the same release.
Yeah, I think it's a documentation error that lang qb's syntax differs from QBASIC's. I haven't checked the pasrser code, but empirically it seems to work as SCREEN [n],, a, v.
__SCREEN in lang qb should work the same way as SCREEN in lang fb. That should probably be mentioned as well.
agamemnus
Posts: 1842
Joined: Jun 02, 2005 4:48

Post by agamemnus »

Ok. I meant to change the wiki but forgot. I changed it now to include the colormode switch. I also modified the formatting of the parameter listings slightly to be the same as pages like screenres:

IE:

From:
Screen [mode] [,[colormode][,[active_page][,[visible_page]]]]
to:
Screen [mode] [, [colormode] [, [active_page] [, [visible_page]]]]
Edit: Oh.. one more thing. Perhaps FB is due for another release? This bug/bug fix is pretty serious for people trying to port their QB games over to FB...
Post Reply