Capture a screen ??? def seg mode

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
Lillolullo
Newbie
Posts: 9
Joined: Mon Nov 16, 2015 9:20 am

Capture a screen ??? def seg mode

Post by Lillolullo »

Hi,

I'm still here with another question: in QB71 or QB45 normally I use this statement to capture a screen

screen 12
cls
locate 15,20:print "HELLO..."

def seg=&HA000
bsave"ok.gif",0,64000 (entire screen)
def seg

How can I do the same thing in qb64 ????

and most important statement....

to save an entire page in screen 12 to reuse next like a background...

file$ = "treasure"
DEF SEG = &HA000
OUT &H3CE, 4: OUT &H3CF, 0: BSAVE file$ + ".BLU", 0, 38400
OUT &H3CE, 4: OUT &H3CF, 1: BSAVE file$ + ".GRN", 0, 38400
OUT &H3CE, 4: OUT &H3CF, 2: BSAVE file$ + ".RED", 0, 38400
OUT &H3CE, 4: OUT &H3CF, 3: BSAVE file$ + ".INT", 0, 38400
OUT &H3CE, 4: OUT &H3CF, 0
DEF SEG

Save the palette
DIM pal&(255)
DEF SEG = VARSEG(pal&(0))
FOR col% = 0 TO 255
OUT &H3C7, col%
POKE VARPTR(pal&(col%)), INP(&H3C9)
POKE VARPTR(pal&(col%)) + 1, INP(&H3C9)
POKE VARPTR(pal&(col%)) + 2, INP(&H3C9)
NEXT
BSAVE "treasure.pal", VARPTR(pal&(0)), 1023

load the same page for backgrounding...

SCREEN 12

file$ = "treasure"
DEF SEG = &HA000
OUT &H3C4, 2: OUT &H3C5, 1: BLOAD file$ + ".BLU", 0
OUT &H3C4, 2: OUT &H3C5, 2: BLOAD file$ + ".GRN", 0
OUT &H3C4, 2: OUT &H3C5, 4: BLOAD file$ + ".RED", 0
OUT &H3C4, 2: OUT &H3C5, 8: BLOAD file$ + ".INT", 0
OUT &H3C4, 2: OUT &H3C5, 16
DEF SEG

DIM pal&(255)
DEF SEG = VARSEG(pal&(0))
BLOAD "treasure.pal", VARPTR(pal&(0))
FOR col% = 0 TO 255
OUT &H3C8, col%
OUT &H3C9, PEEK(VARPTR(pal&(col%)))
OUT &H3C9, PEEK(VARPTR(pal&(col%)) + 1)
OUT &H3C9, PEEK(VARPTR(pal&(col%)) + 2)
NEXT

Now these statements in qb64 are not valid and this is a big problem because in my project I use a lot....but when I compile them in qb71 or qb45 there are many problems, this is the reason I'm trying to use qb64...
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Re: Capture a screen ??? def seg mode

Post by burger2227 »

In SCREEN 12 or any graphic screen, you can make a bitmap of the screen several ways and use _LOADIMAGE to view the BMP file: http://www.qb64.net/wiki/index.php/SAVEIMAGE

The OUT code for color palettes should still work if needed.

Look in the See also section for other routines that can use 32 bit colors or memory for faster operations.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Lillolullo
Newbie
Posts: 9
Joined: Mon Nov 16, 2015 9:20 am

Re: Capture a screen ??? def seg mode

Post by Lillolullo »

Thanks for your reply,
but I tried this and it doesn't work, because if I _saveimage I can olny _download in 32 bit mode, not in screen 12 (I got a black screen).

So I did in other way...It works but I always the _fullscreen glitch graphic problems..It's annoying, a lot, can't work in fullscreen.

I'm trying to do a good job with the sprites (made pixel by pixel with data statement)...I have a lot of problems when I try to compile in pds 71 or qb45.

Qb64 had this problem (fullscreen) and I don't know how to solve it.
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Re: Capture a screen ??? def seg mode

Post by burger2227 »

Here is a program for 4 bit SCREEN 12 or 8 bit SCREEN 13. 12 has only 16 colors where 13 has 256.

http://www.qb64.net/wiki/index.php/Program_ScreenShots
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Lillolullo
Newbie
Posts: 9
Joined: Mon Nov 16, 2015 9:20 am

Re: Capture a screen ??? def seg mode

Post by Lillolullo »

Thanks a lot...
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Re: Capture a screen ??? def seg mode

Post by burger2227 »

No problem. 32 bit can do 32 bit colors though. 64 bit ones would be off the scale! :roll:

32 bit and MILLIONS of colors is a bit much when you are making sprites on your own lol!

What OS are you running? XP made full screen a challenge for my laptop. Try FS after SCREEN:

Code: Select all

SCREEN 12

_FULLSCREEN

LINE (100, 100)-(500, 400), 13, BF
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Lillolullo
Newbie
Posts: 9
Joined: Mon Nov 16, 2015 9:20 am

Re: Capture a screen ??? def seg mode

Post by Lillolullo »

I'm using XP...always bad in FS. I have resigned to have to use a window mode :( ...
Post Reply